@weave-sdk/widget 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,131 @@
1
+ (function(ft,ce){typeof exports=="object"&&typeof module<"u"?ce(exports,require("react")):typeof define=="function"&&define.amd?define(["exports","react"],ce):(ft=typeof globalThis<"u"?globalThis:ft||self,ce(ft.WeaveWidget={},ft.React))})(this,function(ft,ce){"use strict";var wI=ft=>{throw TypeError(ft)};var tw=(ft,ce,vn)=>ce.has(ft)||wI("Cannot "+vn);var V=(ft,ce,vn)=>(tw(ft,ce,"read from private field"),vn?vn.call(ft):ce.get(ft)),Re=(ft,ce,vn)=>ce.has(ft)?wI("Cannot add the same private member more than once"):ce instanceof WeakSet?ce.add(ft):ce.set(ft,vn),me=(ft,ce,vn,Jo)=>(tw(ft,ce,"write to private field"),Jo?Jo.call(ft,vn):ce.set(ft,vn),vn),Le=(ft,ce,vn)=>(tw(ft,ce,"access private method"),vn);var O0=(ft,ce,vn,Jo)=>({set _(en){me(ft,ce,en,vn)},get _(){return V(ft,ce,Jo)}});var No,Rs,Ac,cI,ui,Lo,uI,Ic,Ts,Cc,lI,jo,dI,$o,Pc,Sr,Fo,hn,zl,Do,ur,_I,Yi,fI,Qn,nt,Wl,Fn,Uo,Rc,zi,Os,Gl,Tc,Oc,Ho,zo,Ms,Mc,ct,Kl,sw,ow,aw,cw,uw,lw,dw,EI,hI,ql,li,In,Wo,di,$s,pI,Wi,Hr,Vl,mI,Gi,Bs,Xn,qi,Vi,M0,fw,gI,fi,yI,$t,Ns,Ls,Bc,Nc,js,Lc,jc,bI;function vn(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const n in e)if(n!=="default"){const r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:()=>e[n]})}}return t.default=e,Object.freeze(t)}function Jo(e,t){for(var n=0;n<t.length;n++){const r=t[n];if(typeof r!="string"&&!Array.isArray(r)){for(const i in r)if(i!=="default"&&!(i in e)){const s=Object.getOwnPropertyDescriptor(r,i);s&&Object.defineProperty(e,i,s.get?s:{enumerable:!0,get:()=>r[i]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}const en=vn(ce);var Pe=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function B0(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function Zo(e){if(e.__esModule)return e;var t=e.default;if(typeof t=="function"){var n=function r(){return this instanceof r?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};n.prototype=t.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(e).forEach(function(r){var i=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(n,r,i.get?i:{enumerable:!0,get:function(){return e[r]}})}),n}var N0={exports:{}},$c={};/**
2
+ * @license React
3
+ * react-jsx-runtime.production.min.js
4
+ *
5
+ * Copyright (c) Facebook, Inc. and its affiliates.
6
+ *
7
+ * This source code is licensed under the MIT license found in the
8
+ * LICENSE file in the root directory of this source tree.
9
+ */var pw;function AI(){if(pw)return $c;pw=1;var e=ce,t=Symbol.for("react.element"),n=Symbol.for("react.fragment"),r=Object.prototype.hasOwnProperty,i=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,s={key:!0,ref:!0,__self:!0,__source:!0};function o(a,c,u){var l,d={},f=null,h=null;u!==void 0&&(f=""+u),c.key!==void 0&&(f=""+c.key),c.ref!==void 0&&(h=c.ref);for(l in c)r.call(c,l)&&!s.hasOwnProperty(l)&&(d[l]=c[l]);if(a&&a.defaultProps)for(l in c=a.defaultProps,c)d[l]===void 0&&(d[l]=c[l]);return{$$typeof:t,type:a,key:f,ref:h,props:d,_owner:i.current}}return $c.Fragment=n,$c.jsx=o,$c.jsxs=o,$c}var Fc={};/**
10
+ * @license React
11
+ * react-jsx-runtime.development.js
12
+ *
13
+ * Copyright (c) Facebook, Inc. and its affiliates.
14
+ *
15
+ * This source code is licensed under the MIT license found in the
16
+ * LICENSE file in the root directory of this source tree.
17
+ */var mw;function II(){return mw||(mw=1,process.env.NODE_ENV!=="production"&&function(){var e=ce,t=Symbol.for("react.element"),n=Symbol.for("react.portal"),r=Symbol.for("react.fragment"),i=Symbol.for("react.strict_mode"),s=Symbol.for("react.profiler"),o=Symbol.for("react.provider"),a=Symbol.for("react.context"),c=Symbol.for("react.forward_ref"),u=Symbol.for("react.suspense"),l=Symbol.for("react.suspense_list"),d=Symbol.for("react.memo"),f=Symbol.for("react.lazy"),h=Symbol.for("react.offscreen"),m=Symbol.iterator,y="@@iterator";function w(W){if(W===null||typeof W!="object")return null;var se=m&&W[m]||W[y];return typeof se=="function"?se:null}var b=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function x(W){{for(var se=arguments.length,ae=new Array(se>1?se-1:0),fe=1;fe<se;fe++)ae[fe-1]=arguments[fe];v("error",W,ae)}}function v(W,se,ae){{var fe=b.ReactDebugCurrentFrame,Se=fe.getStackAddendum();Se!==""&&(se+="%s",ae=ae.concat([Se]));var Ee=ae.map(function(ye){return String(ye)});Ee.unshift("Warning: "+se),Function.prototype.apply.call(console[W],console,Ee)}}var S=!1,I=!1,N=!1,j=!1,U=!1,L;L=Symbol.for("react.module.reference");function Y(W){return!!(typeof W=="string"||typeof W=="function"||W===r||W===s||U||W===i||W===u||W===l||j||W===h||S||I||N||typeof W=="object"&&W!==null&&(W.$$typeof===f||W.$$typeof===d||W.$$typeof===o||W.$$typeof===a||W.$$typeof===c||W.$$typeof===L||W.getModuleId!==void 0))}function Z(W,se,ae){var fe=W.displayName;if(fe)return fe;var Se=se.displayName||se.name||"";return Se!==""?ae+"("+Se+")":ae}function G(W){return W.displayName||"Context"}function C(W){if(W==null)return null;if(typeof W.tag=="number"&&x("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),typeof W=="function")return W.displayName||W.name||null;if(typeof W=="string")return W;switch(W){case r:return"Fragment";case n:return"Portal";case s:return"Profiler";case i:return"StrictMode";case u:return"Suspense";case l:return"SuspenseList"}if(typeof W=="object")switch(W.$$typeof){case a:var se=W;return G(se)+".Consumer";case o:var ae=W;return G(ae._context)+".Provider";case c:return Z(W,W.render,"ForwardRef");case d:var fe=W.displayName||null;return fe!==null?fe:C(W.type)||"Memo";case f:{var Se=W,Ee=Se._payload,ye=Se._init;try{return C(ye(Ee))}catch{return null}}}return null}var p=Object.assign,g=0,k,R,T,M,$,O,_;function F(){}F.__reactDisabledLog=!0;function ue(){{if(g===0){k=console.log,R=console.info,T=console.warn,M=console.error,$=console.group,O=console.groupCollapsed,_=console.groupEnd;var W={configurable:!0,enumerable:!0,value:F,writable:!0};Object.defineProperties(console,{info:W,log:W,warn:W,error:W,group:W,groupCollapsed:W,groupEnd:W})}g++}}function ne(){{if(g--,g===0){var W={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:p({},W,{value:k}),info:p({},W,{value:R}),warn:p({},W,{value:T}),error:p({},W,{value:M}),group:p({},W,{value:$}),groupCollapsed:p({},W,{value:O}),groupEnd:p({},W,{value:_})})}g<0&&x("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var q=b.ReactCurrentDispatcher,J;function te(W,se,ae){{if(J===void 0)try{throw Error()}catch(Se){var fe=Se.stack.trim().match(/\n( *(at )?)/);J=fe&&fe[1]||""}return`
18
+ `+J+W}}var le=!1,pe;{var z=typeof WeakMap=="function"?WeakMap:Map;pe=new z}function D(W,se){if(!W||le)return"";{var ae=pe.get(W);if(ae!==void 0)return ae}var fe;le=!0;var Se=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var Ee;Ee=q.current,q.current=null,ue();try{if(se){var ye=function(){throw Error()};if(Object.defineProperty(ye.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(ye,[])}catch(Ft){fe=Ft}Reflect.construct(W,[],ye)}else{try{ye.call()}catch(Ft){fe=Ft}W.call(ye.prototype)}}else{try{throw Error()}catch(Ft){fe=Ft}W()}}catch(Ft){if(Ft&&fe&&typeof Ft.stack=="string"){for(var ke=Ft.stack.split(`
19
+ `),He=fe.stack.split(`
20
+ `),Ve=ke.length-1,mt=He.length-1;Ve>=1&&mt>=0&&ke[Ve]!==He[mt];)mt--;for(;Ve>=1&&mt>=0;Ve--,mt--)if(ke[Ve]!==He[mt]){if(Ve!==1||mt!==1)do if(Ve--,mt--,mt<0||ke[Ve]!==He[mt]){var Xt=`
21
+ `+ke[Ve].replace(" at new "," at ");return W.displayName&&Xt.includes("<anonymous>")&&(Xt=Xt.replace("<anonymous>",W.displayName)),typeof W=="function"&&pe.set(W,Xt),Xt}while(Ve>=1&&mt>=0);break}}}finally{le=!1,q.current=Ee,ne(),Error.prepareStackTrace=Se}var tr=W?W.displayName||W.name:"",Un=tr?te(tr):"";return typeof W=="function"&&pe.set(W,Un),Un}function ie(W,se,ae){return D(W,!1)}function de(W){var se=W.prototype;return!!(se&&se.isReactComponent)}function _e(W,se,ae){if(W==null)return"";if(typeof W=="function")return D(W,de(W));if(typeof W=="string")return te(W);switch(W){case u:return te("Suspense");case l:return te("SuspenseList")}if(typeof W=="object")switch(W.$$typeof){case c:return ie(W.render);case d:return _e(W.type,se,ae);case f:{var fe=W,Se=fe._payload,Ee=fe._init;try{return _e(Ee(Se),se,ae)}catch{}}}return""}var Ae=Object.prototype.hasOwnProperty,xe={},Ge=b.ReactDebugCurrentFrame;function Tt(W){if(W){var se=W._owner,ae=_e(W.type,W._source,se?se.type:null);Ge.setExtraStackFrame(ae)}else Ge.setExtraStackFrame(null)}function $e(W,se,ae,fe,Se){{var Ee=Function.call.bind(Ae);for(var ye in W)if(Ee(W,ye)){var ke=void 0;try{if(typeof W[ye]!="function"){var He=Error((fe||"React class")+": "+ae+" type `"+ye+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof W[ye]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw He.name="Invariant Violation",He}ke=W[ye](se,ye,fe,ae,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(Ve){ke=Ve}ke&&!(ke instanceof Error)&&(Tt(Se),x("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).",fe||"React class",ae,ye,typeof ke),Tt(null)),ke instanceof Error&&!(ke.message in xe)&&(xe[ke.message]=!0,Tt(Se),x("Failed %s type: %s",ae,ke.message),Tt(null))}}}var Qe=Array.isArray;function At(W){return Qe(W)}function Fe(W){{var se=typeof Symbol=="function"&&Symbol.toStringTag,ae=se&&W[Symbol.toStringTag]||W.constructor.name||"Object";return ae}}function Xe(W){try{return Lt(W),!1}catch{return!0}}function Lt(W){return""+W}function De(W){if(Xe(W))return x("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",Fe(W)),Lt(W)}var B=b.ReactCurrentOwner,E={key:!0,ref:!0,__self:!0,__source:!0},A,H;function Q(W){if(Ae.call(W,"ref")){var se=Object.getOwnPropertyDescriptor(W,"ref").get;if(se&&se.isReactWarning)return!1}return W.ref!==void 0}function X(W){if(Ae.call(W,"key")){var se=Object.getOwnPropertyDescriptor(W,"key").get;if(se&&se.isReactWarning)return!1}return W.key!==void 0}function re(W,se){typeof W.ref=="string"&&B.current}function Me(W,se){{var ae=function(){A||(A=!0,x("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",se))};ae.isReactWarning=!0,Object.defineProperty(W,"key",{get:ae,configurable:!0})}}function Oe(W,se){{var ae=function(){H||(H=!0,x("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",se))};ae.isReactWarning=!0,Object.defineProperty(W,"ref",{get:ae,configurable:!0})}}var Te=function(W,se,ae,fe,Se,Ee,ye){var ke={$$typeof:t,type:W,key:se,ref:ae,props:ye,_owner:Ee};return ke._store={},Object.defineProperty(ke._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(ke,"_self",{configurable:!1,enumerable:!1,writable:!1,value:fe}),Object.defineProperty(ke,"_source",{configurable:!1,enumerable:!1,writable:!1,value:Se}),Object.freeze&&(Object.freeze(ke.props),Object.freeze(ke)),ke};function ot(W,se,ae,fe,Se){{var Ee,ye={},ke=null,He=null;ae!==void 0&&(De(ae),ke=""+ae),X(se)&&(De(se.key),ke=""+se.key),Q(se)&&(He=se.ref,re(se,Se));for(Ee in se)Ae.call(se,Ee)&&!E.hasOwnProperty(Ee)&&(ye[Ee]=se[Ee]);if(W&&W.defaultProps){var Ve=W.defaultProps;for(Ee in Ve)ye[Ee]===void 0&&(ye[Ee]=Ve[Ee])}if(ke||He){var mt=typeof W=="function"?W.displayName||W.name||"Unknown":W;ke&&Me(ye,mt),He&&Oe(ye,mt)}return Te(W,ke,He,Se,fe,B.current,ye)}}var Ce=b.ReactCurrentOwner,Ue=b.ReactDebugCurrentFrame;function Dn(W){if(W){var se=W._owner,ae=_e(W.type,W._source,se?se.type:null);Ue.setExtraStackFrame(ae)}else Ue.setExtraStackFrame(null)}var qe;qe=!1;function ut(W){return typeof W=="object"&&W!==null&&W.$$typeof===t}function zr(){{if(Ce.current){var W=C(Ce.current.type);if(W)return`
22
+
23
+ Check the render method of \``+W+"`."}return""}}function bt(W){return""}var ht={};function Cn(W){{var se=zr();if(!se){var ae=typeof W=="string"?W:W.displayName||W.name;ae&&(se=`
24
+
25
+ Check the top-level render call using <`+ae+">.")}return se}}function lt(W,se){{if(!W._store||W._store.validated||W.key!=null)return;W._store.validated=!0;var ae=Cn(se);if(ht[ae])return;ht[ae]=!0;var fe="";W&&W._owner&&W._owner!==Ce.current&&(fe=" It was passed a child from "+C(W._owner.type)+"."),Dn(W),x('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',ae,fe),Dn(null)}}function pt(W,se){{if(typeof W!="object")return;if(At(W))for(var ae=0;ae<W.length;ae++){var fe=W[ae];ut(fe)&&lt(fe,se)}else if(ut(W))W._store&&(W._store.validated=!0);else if(W){var Se=w(W);if(typeof Se=="function"&&Se!==W.entries)for(var Ee=Se.call(W),ye;!(ye=Ee.next()).done;)ut(ye.value)&&lt(ye.value,se)}}}function Wr(W){{var se=W.type;if(se==null||typeof se=="string")return;var ae;if(typeof se=="function")ae=se.propTypes;else if(typeof se=="object"&&(se.$$typeof===c||se.$$typeof===d))ae=se.propTypes;else return;if(ae){var fe=C(se);$e(ae,W.props,"prop",fe,W)}else if(se.PropTypes!==void 0&&!qe){qe=!0;var Se=C(se);x("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",Se||"Unknown")}typeof se.getDefaultProps=="function"&&!se.getDefaultProps.isReactClassApproved&&x("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function dt(W){{for(var se=Object.keys(W.props),ae=0;ae<se.length;ae++){var fe=se[ae];if(fe!=="children"&&fe!=="key"){Dn(W),x("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",fe),Dn(null);break}}W.ref!==null&&(Dn(W),x("Invalid attribute `ref` supplied to `React.Fragment`."),Dn(null))}}var at={};function er(W,se,ae,fe,Se,Ee){{var ye=Y(W);if(!ye){var ke="";(W===void 0||typeof W=="object"&&W!==null&&Object.keys(W).length===0)&&(ke+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");var He=bt();He?ke+=He:ke+=zr();var Ve;W===null?Ve="null":At(W)?Ve="array":W!==void 0&&W.$$typeof===t?(Ve="<"+(C(W.type)||"Unknown")+" />",ke=" Did you accidentally export a JSX literal instead of a component?"):Ve=typeof W,x("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",Ve,ke)}var mt=ot(W,se,ae,Se,Ee);if(mt==null)return mt;if(ye){var Xt=se.children;if(Xt!==void 0)if(fe)if(At(Xt)){for(var tr=0;tr<Xt.length;tr++)pt(Xt[tr],W);Object.freeze&&Object.freeze(Xt)}else x("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else pt(Xt,W)}if(Ae.call(se,"key")){var Un=C(W),Ft=Object.keys(se).filter(function(Ji){return Ji!=="key"}),Gr=Ft.length>0?"{key: someKey, "+Ft.join(": ..., ")+": ...}":"{key: someKey}";if(!at[Un+Gr]){var Ki=Ft.length>0?"{"+Ft.join(": ..., ")+": ...}":"{}";x(`A props object containing a "key" prop is being spread into JSX:
26
+ let props = %s;
27
+ <%s {...props} />
28
+ React keys must be passed directly to JSX without using spread:
29
+ let props = %s;
30
+ <%s key={someKey} {...props} />`,Gr,Un,Ki,Un),at[Un+Gr]=!0}}return W===r?dt(mt):Wr(mt),mt}}function wt(W,se,ae){return er(W,se,ae,!0)}function vt(W,se,ae){return er(W,se,ae,!1)}var hi=vt,be=wt;Fc.Fragment=r,Fc.jsx=hi,Fc.jsxs=be}()),Fc}process.env.NODE_ENV==="production"?N0.exports=AI():N0.exports=II();var P=N0.exports;const L0=[{key:"fiat:NGN",name:"Nigerian Naira",symbol:"₦",flag:"🇳🇬",rate:1515,min:5e3,country:"Nigeria"}],gw=[{key:"crypto:BASE:USDC",id:"BASE",name:"Base",token:"USDC",tint:"#1C4FE0",icon:"$",network:"Base",logo:"https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48/logo.png"},{key:"crypto:BASE:ETH",id:"BASE",name:"Base",token:"ETH",tint:"#1C4FE0",icon:"Ξ",network:"Base",logo:"https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/info/logo.png"},{key:"crypto:BASE:cbBTC",id:"BASE",name:"Base",token:"cbBTC",tint:"#1C4FE0",icon:"₿",network:"Base",logo:"https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/base/assets/0xcbB7C0000aB88B473b1f5aFd9ef808440eed33Bf/logo.png"},{key:"crypto:ETHEREUM:ETH",id:"ETHEREUM",name:"Ethereum",token:"ETH",tint:"#627EEA",icon:"Ξ",network:"Ethereum",logo:"https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/info/logo.png"},{key:"crypto:ETHEREUM:USDC",id:"ETHEREUM",name:"Ethereum",token:"USDC",tint:"#627EEA",icon:"$",network:"Ethereum",logo:"https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48/logo.png"},{key:"crypto:ETHEREUM:cbBTC",id:"ETHEREUM",name:"Ethereum",token:"cbBTC",tint:"#627EEA",icon:"₿",network:"Ethereum",logo:"https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0xcbB7C0000aB88B473b1f5aFd9ef808440eed33Bf/logo.png"},{key:"crypto:ETHEREUM:USDT",id:"ETHEREUM",name:"Ethereum",token:"USDT",tint:"#627EEA",icon:"T",network:"Ethereum",logo:"https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0xdAC17F958D2ee523a2206206994597C13D831ec7/logo.png"},{id:"ETHEREUM",name:"Ethereum",token:"PEPE",tint:"#627EEA",icon:"P",network:"Ethereum",logo:"https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0x6982508145454Ce325dDbE47A25d4ec3d2311933/logo.png",key:"crypto:ETHEREUM:PEPE"},{key:"crypto:ARBITRUM:ETH",id:"ARBITRUM",name:"Arbitrum",token:"ETH",tint:"#28A0F0",icon:"Ξ",network:"Arbitrum One",logo:"https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/arbitrum/info/logo.png"},{key:"crypto:ARBITRUM:USDC",id:"ARBITRUM",name:"Arbitrum",token:"USDC",tint:"#28A0F0",icon:"$",network:"Arbitrum One",logo:"https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48/logo.png"},{key:"crypto:ARBITRUM:USDT",id:"ARBITRUM",name:"Arbitrum",token:"USDT",tint:"#28A0F0",icon:"T",network:"Arbitrum One",logo:"https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0xdAC17F958D2ee523a2206206994597C13D831ec7/logo.png"},{key:"crypto:ARBITRUM:cbBTC",id:"ARBITRUM",name:"Arbitrum",token:"cbBTC",tint:"#28A0F0",icon:"₿",network:"Arbitrum One",logo:"https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/base/assets/0xcbB7C0000aB88B473b1f5aFd9ef808440eed33Bf/logo.png"},{key:"crypto:OPTIMISM:ETH",id:"OPTIMISM",name:"Optimism",token:"ETH",tint:"#FF0420",icon:"Ξ",network:"Optimism",logo:"https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/optimism/info/logo.png"},{key:"crypto:OPTIMISM:USDC",id:"OPTIMISM",name:"Optimism",token:"USDC",tint:"#FF0420",icon:"$",network:"Optimism",logo:"https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48/logo.png"},{key:"crypto:OPTIMISM:USDT",id:"OPTIMISM",name:"Optimism",token:"USDT",tint:"#FF0420",icon:"T",network:"Optimism",logo:"https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0xdAC17F958D2ee523a2206206994597C13D831ec7/logo.png"},{key:"crypto:POLYGON:POL",id:"POLYGON",name:"Polygon",token:"POL",tint:"#7B3FE4",icon:"P",network:"Polygon",logo:"https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/polygon/info/logo.png"},{key:"crypto:POLYGON:USDC",id:"POLYGON",name:"Polygon",token:"USDC",tint:"#7B3FE4",icon:"$",network:"Polygon",logo:"https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48/logo.png"},{key:"crypto:POLYGON:USDT",id:"POLYGON",name:"Polygon",token:"USDT",tint:"#7B3FE4",icon:"T",network:"Polygon",logo:"https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0xdAC17F958D2ee523a2206206994597C13D831ec7/logo.png"},{key:"crypto:BSC:BNB",id:"BSC",name:"BNB Chain",token:"BNB",tint:"#F0B90B",icon:"B",network:"BNB Smart Chain",logo:"https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/binance/info/logo.png"},{key:"crypto:BSC:USDT",id:"BSC",name:"BNB Chain",token:"USDT",tint:"#F0B90B",icon:"T",network:"BNB Smart Chain",logo:"https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0xdAC17F958D2ee523a2206206994597C13D831ec7/logo.png"},{key:"crypto:BSC:USDC",id:"BSC",name:"BNB Chain",token:"USDC",tint:"#F0B90B",icon:"$",network:"BNB Smart Chain",logo:"https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48/logo.png"},{key:"crypto:AVALANCHE:AVAX",id:"AVALANCHE",name:"Avalanche",token:"AVAX",tint:"#E84142",icon:"A",network:"Avalanche C-Chain",logo:"https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/avalanchex/info/logo.png"},{key:"crypto:AVALANCHE:USDC",id:"AVALANCHE",name:"Avalanche",token:"USDC",tint:"#E84142",icon:"$",network:"Avalanche C-Chain",logo:"https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48/logo.png"},{key:"crypto:AVALANCHE:USDT",id:"AVALANCHE",name:"Avalanche",token:"USDT",tint:"#E84142",icon:"T",network:"Avalanche C-Chain",logo:"https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0xdAC17F958D2ee523a2206206994597C13D831ec7/logo.png"},{key:"crypto:GNOSIS:USDC",id:"GNOSIS",name:"Gnosis",token:"USDC",tint:"#04795B",icon:"$",network:"Gnosis Chain",logo:"https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48/logo.png"},{key:"crypto:GNOSIS:EURe",id:"GNOSIS",name:"Gnosis",token:"EURe",tint:"#04795B",icon:"€",network:"Gnosis Chain",logo:"https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/xdai/info/logo.png"},{key:"crypto:SCROLL:USDC",id:"SCROLL",name:"Scroll",token:"USDC",tint:"#D9A26C",icon:"$",network:"Scroll",logo:"https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48/logo.png"},{key:"crypto:SCROLL:USDT",id:"SCROLL",name:"Scroll",token:"USDT",tint:"#D9A26C",icon:"T",network:"Scroll",logo:"https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0xdAC17F958D2ee523a2206206994597C13D831ec7/logo.png"},{key:"crypto:ALEO:ALEO",id:"ALEO",name:"Aleo",token:"ALEO",tint:"#111111",icon:"A",network:"Aleo",logo:"https://monad.xyz/favicon.ico"},{key:"crypto:XLAYER:USDT",id:"XLAYER",name:"X Layer",token:"USDT",tint:"#1E1E1E",icon:"T",network:"X Layer",logo:"https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0xdAC17F958D2ee523a2206206994597C13D831ec7/logo.png"},{key:"crypto:BERA:BERA",id:"BERA",name:"Berachain",token:"BERA",tint:"#814625",icon:"B",network:"Berachain",logo:"https://assets.coingecko.com/coins/images/31034/standard/bera.png"},{key:"crypto:SOLANA:SOL",id:"SOLANA",name:"Solana",token:"SOL",tint:"#14F195",icon:"S",network:"Solana",logo:"https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/solana/info/logo.png"},{key:"crypto:SOLANA:USDC",id:"SOLANA",name:"Solana",token:"USDC",tint:"#14F195",icon:"$",network:"Solana",logo:"https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48/logo.png"},{key:"crypto:SOLANA:WIF",id:"SOLANA",name:"Solana",token:"WIF",tint:"#14F195",icon:"W",network:"Solana",logo:"https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/solana/assets/EKpQGSJtjMFqKZ9KQanAtY7YXDeJs2H3ob77S2SpxmX/logo.png"},{key:"crypto:TRON:TRX",id:"TRON",name:"Tron",token:"TRX",tint:"#EF0027",icon:"T",network:"Tron",logo:"https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/tron/info/logo.png"},{key:"crypto:TRON:USDT",id:"TRON",name:"Tron",token:"USDT",tint:"#EF0027",icon:"T",network:"Tron",logo:"https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0xdAC17F958D2ee523a2206206994597C13D831ec7/logo.png"},{key:"crypto:NEAR:NEAR",id:"NEAR",name:"NEAR",token:"NEAR",tint:"#111111",icon:"N",network:"NEAR",logo:"https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/near/info/logo.png"},{key:"crypto:NEAR:USDC",id:"NEAR",name:"NEAR",token:"USDC",tint:"#111111",icon:"$",network:"NEAR",logo:"https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48/logo.png"},{key:"crypto:TON:TON",id:"TON",name:"TON",token:"TON",tint:"#0098EA",icon:"T",network:"TON",logo:"https://assets.coingecko.com/coins/images/17980/standard/ton_symbol.png"},{key:"crypto:TON:USDT",id:"TON",name:"TON",token:"USDT",tint:"#0098EA",icon:"T",network:"TON",logo:"https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0xdAC17F958D2ee523a2206206994597C13D831ec7/logo.png"},{key:"crypto:SUI:SUI",id:"SUI",name:"Sui",token:"SUI",tint:"#4DA2FF",icon:"S",network:"Sui",logo:"https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/sui/info/logo.png"},{key:"crypto:SUI:USDC",id:"SUI",name:"Sui",token:"USDC",tint:"#4DA2FF",icon:"$",network:"Sui",logo:"https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48/logo.png"},{key:"crypto:APTOS:APT",id:"APTOS",name:"Aptos",token:"APT",tint:"#111111",icon:"A",network:"Aptos",logo:"https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/aptos/info/logo.png"},{key:"crypto:APTOS:USDC",id:"APTOS",name:"Aptos",token:"USDC",tint:"#111111",icon:"$",network:"Aptos",logo:"https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48/logo.png"},{key:"crypto:APTOS:USDT",id:"APTOS",name:"Aptos",token:"USDT",tint:"#111111",icon:"T",network:"Aptos",logo:"https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0xdAC17F958D2ee523a2206206994597C13D831ec7/logo.png"},{id:"STARKNET",name:"Starknet",token:"STRK",tint:"#EC796B",icon:"S",network:"Starknet",logo:"https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/starknet/info/logo.png",key:"crypto:STARKNET:STRK"},{key:"crypto:BITCOIN:BTC",id:"BITCOIN",name:"Bitcoin",token:"BTC",tint:"#F7931A",icon:"₿",network:"Bitcoin",logo:"https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/bitcoin/info/logo.png"},{key:"crypto:XRP:XRP",id:"XRP",name:"XRP Ledger",token:"XRP",tint:"#23292F",icon:"X",network:"XRP Ledger",logo:"https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ripple/info/logo.png"},{key:"crypto:STELLAR:XLM",id:"STELLAR",name:"Stellar",token:"XLM",tint:"#111111",icon:"★",network:"Stellar",logo:"https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/stellar/info/logo.png"},{key:"crypto:STELLAR:USDC",id:"STELLAR",name:"Stellar",token:"USDC",tint:"#111111",icon:"$",network:"Stellar",logo:"https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48/logo.png"},{id:"CARDANO",name:"Cardano",token:"ADA",tint:"#0033AD",icon:"₳",network:"Cardano",logo:"https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/cardano/info/logo.png",key:"crypto:CARDANO:ADA"},{id:"DOGE",name:"Dogecoin",token:"DOGE",tint:"#C2A633",icon:"D",network:"Dogecoin",logo:"https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/doge/info/logo.png",key:"crypto:DOGE:DOGE"},{id:"LITECOIN",name:"Litecoin",token:"LTC",tint:"#345D9D",icon:"L",network:"Litecoin",logo:"https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/litecoin/info/logo.png",key:"crypto:LITECOIN:LTC"},{id:"BCH",name:"Bitcoin Cash",token:"BCH",tint:"#8DC351",icon:"B",network:"Bitcoin Cash",logo:"https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/bitcoincash/info/logo.png",key:"crypto:BCH:BCH"},{id:"ZEC",name:"Zcash",token:"ZEC",tint:"#F4B728",icon:"Z",network:"Zcash",logo:"https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/zcash/info/logo.png",key:"crypto:ZEC:ZEC"},{id:"DASH",name:"Dash",token:"DASH",tint:"#008CE7",icon:"D",network:"Dash",logo:"https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/dash/info/logo.png",key:"crypto:DASH:DASH"}];function yw(e){if(!e)throw new Error("asset key is required");const t=e.split(":");if(t[0]==="fiat"&&t[1]){const n=t[1].toUpperCase();return{kind:"fiat",currency:n,key:`fiat:${n}`}}if(t[0]==="crypto"&&t[1]&&t[2]){const n=t[1].toUpperCase(),r=t[2].toUpperCase();return{kind:"crypto",chain:n,token:r,key:`crypto:${n}:${r}`}}throw new Error(`Invalid asset key: "${e}". Expected "fiat:CCY" or "crypto:CHAIN:TOKEN"`)}const CI=e=>e.startsWith("fiat:");function PI(e){return CI(e)?L0.find(t=>t.key===e):gw.find(t=>t.key===e)}function RI(e,t){try{const n=yw(e).kind,r=yw(t).kind;return n==="crypto"&&r==="fiat"?"offramp":n==="fiat"&&r==="crypto"?"onramp":n==="crypto"&&r==="crypto"?"bridge":"transfer"}catch{return"transfer"}}const bw={NGN:[{code:"GTBINGLA",name:"Guaranty Trust Bank"},{code:"FBNINGLA",name:"First Bank of Nigeria"},{code:"ZEIBNGLA",name:"Zenith Bank"},{code:"ABNGNGLA",name:"Access Bank"},{code:"UBNINGLA",name:"Union Bank"},{code:"STBKNGLA",name:"Stanbic IBTC Bank"},{code:"FCMBNGLA",name:"First City Monument Bank"},{code:"FIDTNGLA",name:"Fidelity Bank"},{code:"ECOBNGLA",name:"Ecobank Nigeria"},{code:"WEMANGLA",name:"Wema Bank"},{code:"KUDANGPC",name:"Kuda Bank"},{code:"OPAYNGPC",name:"OPay"},{code:"MONINGPC",name:"Moniepoint"},{code:"PALMNGPC",name:"PalmPay"}]};function ww(e,t){const r=(bw[e.toUpperCase()]||[]).find(i=>i.code.toUpperCase()===t.toUpperCase());return r?r.name:t}var TI=Object.defineProperty,Jl=Object.getOwnPropertySymbols,vw=Object.prototype.hasOwnProperty,_w=Object.prototype.propertyIsEnumerable,Ew=(e,t,n)=>t in e?TI(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,j0=(e,t)=>{for(var n in t||(t={}))vw.call(t,n)&&Ew(e,n,t[n]);if(Jl)for(var n of Jl(t))_w.call(t,n)&&Ew(e,n,t[n]);return e},$0=(e,t)=>{var n={};for(var r in e)vw.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&Jl)for(var r of Jl(e))t.indexOf(r)<0&&_w.call(e,r)&&(n[r]=e[r]);return n};/**
31
+ * @license QR Code generator library (TypeScript)
32
+ * Copyright (c) Project Nayuki.
33
+ * SPDX-License-Identifier: MIT
34
+ */var Fs;(e=>{const t=class et{constructor(c,u,l,d){if(this.version=c,this.errorCorrectionLevel=u,this.modules=[],this.isFunction=[],c<et.MIN_VERSION||c>et.MAX_VERSION)throw new RangeError("Version value out of range");if(d<-1||d>7)throw new RangeError("Mask value out of range");this.size=c*4+17;let f=[];for(let m=0;m<this.size;m++)f.push(!1);for(let m=0;m<this.size;m++)this.modules.push(f.slice()),this.isFunction.push(f.slice());this.drawFunctionPatterns();const h=this.addEccAndInterleave(l);if(this.drawCodewords(h),d==-1){let m=1e9;for(let y=0;y<8;y++){this.applyMask(y),this.drawFormatBits(y);const w=this.getPenaltyScore();w<m&&(d=y,m=w),this.applyMask(y)}}i(0<=d&&d<=7),this.mask=d,this.applyMask(d),this.drawFormatBits(d),this.isFunction=[]}static encodeText(c,u){const l=e.QrSegment.makeSegments(c);return et.encodeSegments(l,u)}static encodeBinary(c,u){const l=e.QrSegment.makeBytes(c);return et.encodeSegments([l],u)}static encodeSegments(c,u,l=1,d=40,f=-1,h=!0){if(!(et.MIN_VERSION<=l&&l<=d&&d<=et.MAX_VERSION)||f<-1||f>7)throw new RangeError("Invalid value");let m,y;for(m=l;;m++){const v=et.getNumDataCodewords(m,u)*8,S=o.getTotalBits(c,m);if(S<=v){y=S;break}if(m>=d)throw new RangeError("Data too long")}for(const v of[et.Ecc.MEDIUM,et.Ecc.QUARTILE,et.Ecc.HIGH])h&&y<=et.getNumDataCodewords(m,v)*8&&(u=v);let w=[];for(const v of c){n(v.mode.modeBits,4,w),n(v.numChars,v.mode.numCharCountBits(m),w);for(const S of v.getData())w.push(S)}i(w.length==y);const b=et.getNumDataCodewords(m,u)*8;i(w.length<=b),n(0,Math.min(4,b-w.length),w),n(0,(8-w.length%8)%8,w),i(w.length%8==0);for(let v=236;w.length<b;v^=253)n(v,8,w);let x=[];for(;x.length*8<w.length;)x.push(0);return w.forEach((v,S)=>x[S>>>3]|=v<<7-(S&7)),new et(m,u,x,f)}getModule(c,u){return 0<=c&&c<this.size&&0<=u&&u<this.size&&this.modules[u][c]}getModules(){return this.modules}drawFunctionPatterns(){for(let l=0;l<this.size;l++)this.setFunctionModule(6,l,l%2==0),this.setFunctionModule(l,6,l%2==0);this.drawFinderPattern(3,3),this.drawFinderPattern(this.size-4,3),this.drawFinderPattern(3,this.size-4);const c=this.getAlignmentPatternPositions(),u=c.length;for(let l=0;l<u;l++)for(let d=0;d<u;d++)l==0&&d==0||l==0&&d==u-1||l==u-1&&d==0||this.drawAlignmentPattern(c[l],c[d]);this.drawFormatBits(0),this.drawVersion()}drawFormatBits(c){const u=this.errorCorrectionLevel.formatBits<<3|c;let l=u;for(let f=0;f<10;f++)l=l<<1^(l>>>9)*1335;const d=(u<<10|l)^21522;i(d>>>15==0);for(let f=0;f<=5;f++)this.setFunctionModule(8,f,r(d,f));this.setFunctionModule(8,7,r(d,6)),this.setFunctionModule(8,8,r(d,7)),this.setFunctionModule(7,8,r(d,8));for(let f=9;f<15;f++)this.setFunctionModule(14-f,8,r(d,f));for(let f=0;f<8;f++)this.setFunctionModule(this.size-1-f,8,r(d,f));for(let f=8;f<15;f++)this.setFunctionModule(8,this.size-15+f,r(d,f));this.setFunctionModule(8,this.size-8,!0)}drawVersion(){if(this.version<7)return;let c=this.version;for(let l=0;l<12;l++)c=c<<1^(c>>>11)*7973;const u=this.version<<12|c;i(u>>>18==0);for(let l=0;l<18;l++){const d=r(u,l),f=this.size-11+l%3,h=Math.floor(l/3);this.setFunctionModule(f,h,d),this.setFunctionModule(h,f,d)}}drawFinderPattern(c,u){for(let l=-4;l<=4;l++)for(let d=-4;d<=4;d++){const f=Math.max(Math.abs(d),Math.abs(l)),h=c+d,m=u+l;0<=h&&h<this.size&&0<=m&&m<this.size&&this.setFunctionModule(h,m,f!=2&&f!=4)}}drawAlignmentPattern(c,u){for(let l=-2;l<=2;l++)for(let d=-2;d<=2;d++)this.setFunctionModule(c+d,u+l,Math.max(Math.abs(d),Math.abs(l))!=1)}setFunctionModule(c,u,l){this.modules[u][c]=l,this.isFunction[u][c]=!0}addEccAndInterleave(c){const u=this.version,l=this.errorCorrectionLevel;if(c.length!=et.getNumDataCodewords(u,l))throw new RangeError("Invalid argument");const d=et.NUM_ERROR_CORRECTION_BLOCKS[l.ordinal][u],f=et.ECC_CODEWORDS_PER_BLOCK[l.ordinal][u],h=Math.floor(et.getNumRawDataModules(u)/8),m=d-h%d,y=Math.floor(h/d);let w=[];const b=et.reedSolomonComputeDivisor(f);for(let v=0,S=0;v<d;v++){let I=c.slice(S,S+y-f+(v<m?0:1));S+=I.length;const N=et.reedSolomonComputeRemainder(I,b);v<m&&I.push(0),w.push(I.concat(N))}let x=[];for(let v=0;v<w[0].length;v++)w.forEach((S,I)=>{(v!=y-f||I>=m)&&x.push(S[v])});return i(x.length==h),x}drawCodewords(c){if(c.length!=Math.floor(et.getNumRawDataModules(this.version)/8))throw new RangeError("Invalid argument");let u=0;for(let l=this.size-1;l>=1;l-=2){l==6&&(l=5);for(let d=0;d<this.size;d++)for(let f=0;f<2;f++){const h=l-f,y=(l+1&2)==0?this.size-1-d:d;!this.isFunction[y][h]&&u<c.length*8&&(this.modules[y][h]=r(c[u>>>3],7-(u&7)),u++)}}i(u==c.length*8)}applyMask(c){if(c<0||c>7)throw new RangeError("Mask value out of range");for(let u=0;u<this.size;u++)for(let l=0;l<this.size;l++){let d;switch(c){case 0:d=(l+u)%2==0;break;case 1:d=u%2==0;break;case 2:d=l%3==0;break;case 3:d=(l+u)%3==0;break;case 4:d=(Math.floor(l/3)+Math.floor(u/2))%2==0;break;case 5:d=l*u%2+l*u%3==0;break;case 6:d=(l*u%2+l*u%3)%2==0;break;case 7:d=((l+u)%2+l*u%3)%2==0;break;default:throw new Error("Unreachable")}!this.isFunction[u][l]&&d&&(this.modules[u][l]=!this.modules[u][l])}}getPenaltyScore(){let c=0;for(let f=0;f<this.size;f++){let h=!1,m=0,y=[0,0,0,0,0,0,0];for(let w=0;w<this.size;w++)this.modules[f][w]==h?(m++,m==5?c+=et.PENALTY_N1:m>5&&c++):(this.finderPenaltyAddHistory(m,y),h||(c+=this.finderPenaltyCountPatterns(y)*et.PENALTY_N3),h=this.modules[f][w],m=1);c+=this.finderPenaltyTerminateAndCount(h,m,y)*et.PENALTY_N3}for(let f=0;f<this.size;f++){let h=!1,m=0,y=[0,0,0,0,0,0,0];for(let w=0;w<this.size;w++)this.modules[w][f]==h?(m++,m==5?c+=et.PENALTY_N1:m>5&&c++):(this.finderPenaltyAddHistory(m,y),h||(c+=this.finderPenaltyCountPatterns(y)*et.PENALTY_N3),h=this.modules[w][f],m=1);c+=this.finderPenaltyTerminateAndCount(h,m,y)*et.PENALTY_N3}for(let f=0;f<this.size-1;f++)for(let h=0;h<this.size-1;h++){const m=this.modules[f][h];m==this.modules[f][h+1]&&m==this.modules[f+1][h]&&m==this.modules[f+1][h+1]&&(c+=et.PENALTY_N2)}let u=0;for(const f of this.modules)u=f.reduce((h,m)=>h+(m?1:0),u);const l=this.size*this.size,d=Math.ceil(Math.abs(u*20-l*10)/l)-1;return i(0<=d&&d<=9),c+=d*et.PENALTY_N4,i(0<=c&&c<=2568888),c}getAlignmentPatternPositions(){if(this.version==1)return[];{const c=Math.floor(this.version/7)+2,u=this.version==32?26:Math.ceil((this.version*4+4)/(c*2-2))*2;let l=[6];for(let d=this.size-7;l.length<c;d-=u)l.splice(1,0,d);return l}}static getNumRawDataModules(c){if(c<et.MIN_VERSION||c>et.MAX_VERSION)throw new RangeError("Version number out of range");let u=(16*c+128)*c+64;if(c>=2){const l=Math.floor(c/7)+2;u-=(25*l-10)*l-55,c>=7&&(u-=36)}return i(208<=u&&u<=29648),u}static getNumDataCodewords(c,u){return Math.floor(et.getNumRawDataModules(c)/8)-et.ECC_CODEWORDS_PER_BLOCK[u.ordinal][c]*et.NUM_ERROR_CORRECTION_BLOCKS[u.ordinal][c]}static reedSolomonComputeDivisor(c){if(c<1||c>255)throw new RangeError("Degree out of range");let u=[];for(let d=0;d<c-1;d++)u.push(0);u.push(1);let l=1;for(let d=0;d<c;d++){for(let f=0;f<u.length;f++)u[f]=et.reedSolomonMultiply(u[f],l),f+1<u.length&&(u[f]^=u[f+1]);l=et.reedSolomonMultiply(l,2)}return u}static reedSolomonComputeRemainder(c,u){let l=u.map(d=>0);for(const d of c){const f=d^l.shift();l.push(0),u.forEach((h,m)=>l[m]^=et.reedSolomonMultiply(h,f))}return l}static reedSolomonMultiply(c,u){if(c>>>8||u>>>8)throw new RangeError("Byte out of range");let l=0;for(let d=7;d>=0;d--)l=l<<1^(l>>>7)*285,l^=(u>>>d&1)*c;return i(l>>>8==0),l}finderPenaltyCountPatterns(c){const u=c[1];i(u<=this.size*3);const l=u>0&&c[2]==u&&c[3]==u*3&&c[4]==u&&c[5]==u;return(l&&c[0]>=u*4&&c[6]>=u?1:0)+(l&&c[6]>=u*4&&c[0]>=u?1:0)}finderPenaltyTerminateAndCount(c,u,l){return c&&(this.finderPenaltyAddHistory(u,l),u=0),u+=this.size,this.finderPenaltyAddHistory(u,l),this.finderPenaltyCountPatterns(l)}finderPenaltyAddHistory(c,u){u[0]==0&&(c+=this.size),u.pop(),u.unshift(c)}};t.MIN_VERSION=1,t.MAX_VERSION=40,t.PENALTY_N1=3,t.PENALTY_N2=3,t.PENALTY_N3=40,t.PENALTY_N4=10,t.ECC_CODEWORDS_PER_BLOCK=[[-1,7,10,15,20,26,18,20,24,30,18,20,24,26,30,22,24,28,30,28,28,28,28,30,30,26,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,10,16,26,18,24,16,18,22,22,26,30,22,22,24,24,28,28,26,26,26,26,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28],[-1,13,22,18,26,18,24,18,22,20,24,28,26,24,20,30,24,28,28,26,30,28,30,30,30,30,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,17,28,22,16,22,28,26,26,24,28,24,28,22,24,24,30,28,28,26,28,30,24,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30]],t.NUM_ERROR_CORRECTION_BLOCKS=[[-1,1,1,1,1,1,2,2,2,2,4,4,4,4,4,6,6,6,6,7,8,8,9,9,10,12,12,12,13,14,15,16,17,18,19,19,20,21,22,24,25],[-1,1,1,1,2,2,4,4,4,5,5,5,8,9,9,10,10,11,13,14,16,17,17,18,20,21,23,25,26,28,29,31,33,35,37,38,40,43,45,47,49],[-1,1,1,2,2,4,4,6,6,8,8,8,10,12,16,12,17,16,18,21,20,23,23,25,27,29,34,34,35,38,40,43,45,48,51,53,56,59,62,65,68],[-1,1,1,2,4,4,4,5,6,8,8,11,11,16,16,18,16,19,21,25,25,25,34,30,32,35,37,40,42,45,48,51,54,57,60,63,66,70,74,77,81]],e.QrCode=t;function n(a,c,u){if(c<0||c>31||a>>>c)throw new RangeError("Value out of range");for(let l=c-1;l>=0;l--)u.push(a>>>l&1)}function r(a,c){return(a>>>c&1)!=0}function i(a){if(!a)throw new Error("Assertion error")}const s=class Dt{constructor(c,u,l){if(this.mode=c,this.numChars=u,this.bitData=l,u<0)throw new RangeError("Invalid argument");this.bitData=l.slice()}static makeBytes(c){let u=[];for(const l of c)n(l,8,u);return new Dt(Dt.Mode.BYTE,c.length,u)}static makeNumeric(c){if(!Dt.isNumeric(c))throw new RangeError("String contains non-numeric characters");let u=[];for(let l=0;l<c.length;){const d=Math.min(c.length-l,3);n(parseInt(c.substring(l,l+d),10),d*3+1,u),l+=d}return new Dt(Dt.Mode.NUMERIC,c.length,u)}static makeAlphanumeric(c){if(!Dt.isAlphanumeric(c))throw new RangeError("String contains unencodable characters in alphanumeric mode");let u=[],l;for(l=0;l+2<=c.length;l+=2){let d=Dt.ALPHANUMERIC_CHARSET.indexOf(c.charAt(l))*45;d+=Dt.ALPHANUMERIC_CHARSET.indexOf(c.charAt(l+1)),n(d,11,u)}return l<c.length&&n(Dt.ALPHANUMERIC_CHARSET.indexOf(c.charAt(l)),6,u),new Dt(Dt.Mode.ALPHANUMERIC,c.length,u)}static makeSegments(c){return c==""?[]:Dt.isNumeric(c)?[Dt.makeNumeric(c)]:Dt.isAlphanumeric(c)?[Dt.makeAlphanumeric(c)]:[Dt.makeBytes(Dt.toUtf8ByteArray(c))]}static makeEci(c){let u=[];if(c<0)throw new RangeError("ECI assignment value out of range");if(c<128)n(c,8,u);else if(c<16384)n(2,2,u),n(c,14,u);else if(c<1e6)n(6,3,u),n(c,21,u);else throw new RangeError("ECI assignment value out of range");return new Dt(Dt.Mode.ECI,0,u)}static isNumeric(c){return Dt.NUMERIC_REGEX.test(c)}static isAlphanumeric(c){return Dt.ALPHANUMERIC_REGEX.test(c)}getData(){return this.bitData.slice()}static getTotalBits(c,u){let l=0;for(const d of c){const f=d.mode.numCharCountBits(u);if(d.numChars>=1<<f)return 1/0;l+=4+f+d.bitData.length}return l}static toUtf8ByteArray(c){c=encodeURI(c);let u=[];for(let l=0;l<c.length;l++)c.charAt(l)!="%"?u.push(c.charCodeAt(l)):(u.push(parseInt(c.substring(l+1,l+3),16)),l+=2);return u}};s.NUMERIC_REGEX=/^[0-9]*$/,s.ALPHANUMERIC_REGEX=/^[A-Z0-9 $%*+.\/:-]*$/,s.ALPHANUMERIC_CHARSET="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:";let o=s;e.QrSegment=s})(Fs||(Fs={})),(e=>{(t=>{const n=class{constructor(i,s){this.ordinal=i,this.formatBits=s}};n.LOW=new n(0,1),n.MEDIUM=new n(1,0),n.QUARTILE=new n(2,3),n.HIGH=new n(3,2),t.Ecc=n})(e.QrCode||(e.QrCode={}))})(Fs||(Fs={})),(e=>{(t=>{const n=class{constructor(i,s){this.modeBits=i,this.numBitsCharCount=s}numCharCountBits(i){return this.numBitsCharCount[Math.floor((i+7)/17)]}};n.NUMERIC=new n(1,[10,12,14]),n.ALPHANUMERIC=new n(2,[9,11,13]),n.BYTE=new n(4,[8,16,16]),n.KANJI=new n(8,[8,10,12]),n.ECI=new n(7,[0,0,0]),t.Mode=n})(e.QrSegment||(e.QrSegment={}))})(Fs||(Fs={}));var Yo=Fs;/**
35
+ * @license qrcode.react
36
+ * Copyright (c) Paul O'Shannessy
37
+ * SPDX-License-Identifier: ISC
38
+ */var OI={L:Yo.QrCode.Ecc.LOW,M:Yo.QrCode.Ecc.MEDIUM,Q:Yo.QrCode.Ecc.QUARTILE,H:Yo.QrCode.Ecc.HIGH},xw=128,Sw="L",kw="#FFFFFF",Aw="#000000",Iw=!1,Cw=1,MI=4,BI=0,NI=.1;function Pw(e,t=0){const n=[];return e.forEach(function(r,i){let s=null;r.forEach(function(o,a){if(!o&&s!==null){n.push(`M${s+t} ${i+t}h${a-s}v1H${s+t}z`),s=null;return}if(a===r.length-1){if(!o)return;s===null?n.push(`M${a+t},${i+t} h1v1H${a+t}z`):n.push(`M${s+t},${i+t} h${a+1-s}v1H${s+t}z`);return}o&&s===null&&(s=a)})}),n.join("")}function Rw(e,t){return e.slice().map((n,r)=>r<t.y||r>=t.y+t.h?n:n.map((i,s)=>s<t.x||s>=t.x+t.w?i:!1))}function LI(e,t,n,r){if(r==null)return null;const i=e.length+n*2,s=Math.floor(t*NI),o=i/t,a=(r.width||s)*o,c=(r.height||s)*o,u=r.x==null?e.length/2-a/2:r.x*o,l=r.y==null?e.length/2-c/2:r.y*o,d=r.opacity==null?1:r.opacity;let f=null;if(r.excavate){let m=Math.floor(u),y=Math.floor(l),w=Math.ceil(a+u-m),b=Math.ceil(c+l-y);f={x:m,y,w,h:b}}const h=r.crossOrigin;return{x:u,y:l,h:c,w:a,excavation:f,opacity:d,crossOrigin:h}}function jI(e,t){return t!=null?Math.max(Math.floor(t),0):e?MI:BI}function Tw({value:e,level:t,minVersion:n,includeMargin:r,marginSize:i,imageSettings:s,size:o,boostLevel:a}){let c=ce.useMemo(()=>{const m=(Array.isArray(e)?e:[e]).reduce((y,w)=>(y.push(...Yo.QrSegment.makeSegments(w)),y),[]);return Yo.QrCode.encodeSegments(m,OI[t],n,void 0,void 0,a)},[e,t,n,a]);const{cells:u,margin:l,numCells:d,calculatedImageSettings:f}=ce.useMemo(()=>{let h=c.getModules();const m=jI(r,i),y=h.length+m*2,w=LI(h,o,m,s);return{cells:h,margin:m,numCells:y,calculatedImageSettings:w}},[c,o,s,r,i]);return{qrcode:c,margin:l,cells:u,numCells:d,calculatedImageSettings:f}}var $I=function(){try{new Path2D().addPath(new Path2D)}catch{return!1}return!0}(),FI=ce.forwardRef(function(t,n){const r=t,{value:i,size:s=xw,level:o=Sw,bgColor:a=kw,fgColor:c=Aw,includeMargin:u=Iw,minVersion:l=Cw,boostLevel:d,marginSize:f,imageSettings:h}=r,y=$0(r,["value","size","level","bgColor","fgColor","includeMargin","minVersion","boostLevel","marginSize","imageSettings"]),{style:w}=y,b=$0(y,["style"]),x=h==null?void 0:h.src,v=ce.useRef(null),S=ce.useRef(null),I=ce.useCallback(p=>{v.current=p,typeof n=="function"?n(p):n&&(n.current=p)},[n]),[N,j]=ce.useState(!1),{margin:U,cells:L,numCells:Y,calculatedImageSettings:Z}=Tw({value:i,level:o,minVersion:l,boostLevel:d,includeMargin:u,marginSize:f,imageSettings:h,size:s});ce.useEffect(()=>{if(v.current!=null){const p=v.current,g=p.getContext("2d");if(!g)return;let k=L;const R=S.current,T=Z!=null&&R!==null&&R.complete&&R.naturalHeight!==0&&R.naturalWidth!==0;T&&Z.excavation!=null&&(k=Rw(L,Z.excavation));const M=window.devicePixelRatio||1;p.height=p.width=s*M;const $=s/Y*M;g.scale($,$),g.fillStyle=a,g.fillRect(0,0,Y,Y),g.fillStyle=c,$I?g.fill(new Path2D(Pw(k,U))):L.forEach(function(O,_){O.forEach(function(F,ue){F&&g.fillRect(ue+U,_+U,1,1)})}),Z&&(g.globalAlpha=Z.opacity),T&&g.drawImage(R,Z.x+U,Z.y+U,Z.w,Z.h)}}),ce.useEffect(()=>{j(!1)},[x]);const G=j0({height:s,width:s},w);let C=null;return x!=null&&(C=ce.createElement("img",{src:x,key:x,style:{display:"none"},onLoad:()=>{j(!0)},ref:S,crossOrigin:Z==null?void 0:Z.crossOrigin})),ce.createElement(ce.Fragment,null,ce.createElement("canvas",j0({style:G,height:s,width:s,ref:I,role:"img"},b)),C)});FI.displayName="QRCodeCanvas";var Ow=ce.forwardRef(function(t,n){const r=t,{value:i,size:s=xw,level:o=Sw,bgColor:a=kw,fgColor:c=Aw,includeMargin:u=Iw,minVersion:l=Cw,boostLevel:d,title:f,marginSize:h,imageSettings:m}=r,y=$0(r,["value","size","level","bgColor","fgColor","includeMargin","minVersion","boostLevel","title","marginSize","imageSettings"]),{margin:w,cells:b,numCells:x,calculatedImageSettings:v}=Tw({value:i,level:o,minVersion:l,boostLevel:d,includeMargin:u,marginSize:h,imageSettings:m,size:s});let S=b,I=null;m!=null&&v!=null&&(v.excavation!=null&&(S=Rw(b,v.excavation)),I=ce.createElement("image",{href:m.src,height:v.h,width:v.w,x:v.x+w,y:v.y+w,preserveAspectRatio:"none",opacity:v.opacity,crossOrigin:v.crossOrigin}));const N=Pw(S,w);return ce.createElement("svg",j0({height:s,width:s,viewBox:`0 0 ${x} ${x}`,ref:n,role:"img"},y),!!f&&ce.createElement("title",null,f),ce.createElement("path",{fill:a,d:`M0,0 h${x}v${x}H0z`,shapeRendering:"crispEdges"}),ce.createElement("path",{fill:c,d:N,shapeRendering:"crispEdges"}),I)});Ow.displayName="QRCodeSVG";const Qo=[{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"},{inputs:[{name:"addr",type:"address"}],name:"getEthBalance",outputs:[{name:"balance",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"getCurrentBlockTimestamp",outputs:[{internalType:"uint256",name:"timestamp",type:"uint256"}],stateMutability:"view",type:"function"}],F0=[{name:"query",type:"function",stateMutability:"view",inputs:[{type:"tuple[]",name:"queries",components:[{type:"address",name:"sender"},{type:"string[]",name:"urls"},{type:"bytes",name:"data"}]}],outputs:[{type:"bool[]",name:"failures"},{type:"bytes[]",name:"responses"}]},{name:"HttpError",type:"error",inputs:[{type:"uint16",name:"status"},{type:"string",name:"message"}]}],Mw=[{inputs:[{name:"dns",type:"bytes"}],name:"DNSDecodingFailed",type:"error"},{inputs:[{name:"ens",type:"string"}],name:"DNSEncodingFailed",type:"error"},{inputs:[],name:"EmptyAddress",type:"error"},{inputs:[{name:"status",type:"uint16"},{name:"message",type:"string"}],name:"HttpError",type:"error"},{inputs:[],name:"InvalidBatchGatewayResponse",type:"error"},{inputs:[{name:"errorData",type:"bytes"}],name:"ResolverError",type:"error"},{inputs:[{name:"name",type:"bytes"},{name:"resolver",type:"address"}],name:"ResolverNotContract",type:"error"},{inputs:[{name:"name",type:"bytes"}],name:"ResolverNotFound",type:"error"},{inputs:[{name:"primary",type:"string"},{name:"primaryAddress",type:"bytes"}],name:"ReverseAddressMismatch",type:"error"},{inputs:[{internalType:"bytes4",name:"selector",type:"bytes4"}],name:"UnsupportedResolverProfile",type:"error"}],Bw=[...Mw,{name:"resolveWithGateways",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"}]}],DI=[...Mw,{name:"reverseWithGateways",type:"function",stateMutability:"view",inputs:[{type:"bytes",name:"reverseName"},{type:"uint256",name:"coinType"},{type:"string[]",name:"gateways"}],outputs:[{type:"string",name:"resolvedName"},{type:"address",name:"resolver"},{type:"address",name:"reverseResolver"}]}],Nw=[{name:"text",type:"function",stateMutability:"view",inputs:[{name:"name",type:"bytes32"},{name:"key",type:"string"}],outputs:[{name:"",type:"string"}]}],Lw=[{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"}]}],jw=[{name:"isValidSignature",type:"function",stateMutability:"view",inputs:[{name:"hash",type:"bytes32"},{name:"signature",type:"bytes"}],outputs:[{name:"",type:"bytes4"}]}],$w=[{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"}],UI=[{type:"event",name:"Approval",inputs:[{indexed:!0,name:"owner",type:"address"},{indexed:!0,name:"spender",type:"address"},{indexed:!1,name:"value",type:"uint256"}]},{type:"event",name:"Transfer",inputs:[{indexed:!0,name:"from",type:"address"},{indexed:!0,name:"to",type:"address"},{indexed:!1,name:"value",type:"uint256"}]},{type:"function",name:"allowance",stateMutability:"view",inputs:[{name:"owner",type:"address"},{name:"spender",type:"address"}],outputs:[{type:"uint256"}]},{type:"function",name:"approve",stateMutability:"nonpayable",inputs:[{name:"spender",type:"address"},{name:"amount",type:"uint256"}],outputs:[{type:"bool"}]},{type:"function",name:"balanceOf",stateMutability:"view",inputs:[{name:"account",type:"address"}],outputs:[{type:"uint256"}]},{type:"function",name:"decimals",stateMutability:"view",inputs:[],outputs:[{type:"uint8"}]},{type:"function",name:"name",stateMutability:"view",inputs:[],outputs:[{type:"string"}]},{type:"function",name:"symbol",stateMutability:"view",inputs:[],outputs:[{type:"string"}]},{type:"function",name:"totalSupply",stateMutability:"view",inputs:[],outputs:[{type:"uint256"}]},{type:"function",name:"transfer",stateMutability:"nonpayable",inputs:[{name:"recipient",type:"address"},{name:"amount",type:"uint256"}],outputs:[{type:"bool"}]},{type:"function",name:"transferFrom",stateMutability:"nonpayable",inputs:[{name:"sender",type:"address"},{name:"recipient",type:"address"},{name:"amount",type:"uint256"}],outputs:[{type:"bool"}]}];function kr(e,{includeName:t=!1}={}){if(e.type!=="function"&&e.type!=="event"&&e.type!=="error")throw new XI(e.type);return`${e.name}(${Zl(e.inputs,{includeName:t})})`}function Zl(e,{includeName:t=!1}={}){return e?e.map(n=>HI(n,{includeName:t})).join(t?", ":","):""}function HI(e,{includeName:t}){return e.type.startsWith("tuple")?`(${Zl(e.components,{includeName:t})})${e.type.slice(5)}`:e.type+(t&&e.name?` ${e.name}`:"")}function pn(e,{strict:t=!0}={}){return!e||typeof e!="string"?!1:t?/^0x[0-9a-fA-F]*$/.test(e):e.startsWith("0x")}function Et(e){return pn(e,{strict:!1})?Math.ceil((e.length-2)/2):e.length}const Fw="2.47.11";let Dc={getDocsUrl:({docsBaseUrl:e,docsPath:t="",docsSlug:n})=>t?`${e??"https://viem.sh"}${t}${n?`#${n}`:""}`:void 0,version:`viem@${Fw}`},ee=class nw extends Error{constructor(t,n={}){var a;const r=(()=>{var c;return n.cause instanceof nw?n.cause.details:(c=n.cause)!=null&&c.message?n.cause.message:n.details})(),i=n.cause instanceof nw&&n.cause.docsPath||n.docsPath,s=(a=Dc.getDocsUrl)==null?void 0:a.call(Dc,{...n,docsPath:i}),o=[t||"An error occurred.","",...n.metaMessages?[...n.metaMessages,""]:[],...s?[`Docs: ${s}`]:[],...r?[`Details: ${r}`]:[],...Dc.version?[`Version: ${Dc.version}`]:[]].join(`
39
+ `);super(o,n.cause?{cause:n.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=r,this.docsPath=i,this.metaMessages=n.metaMessages,this.name=n.name??this.name,this.shortMessage=t,this.version=Fw}walk(t){return Dw(this,t)}};function Dw(e,t){return t!=null&&t(e)?e:e&&typeof e=="object"&&"cause"in e&&e.cause!==void 0?Dw(e.cause,t):t?null:e}class zI extends ee{constructor({docsPath:t}){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(`
40
+ `),{docsPath:t,name:"AbiConstructorNotFoundError"})}}class Uw extends ee{constructor({docsPath:t}){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(`
41
+ `),{docsPath:t,name:"AbiConstructorParamsNotFoundError"})}}class Hw extends ee{constructor({data:t,params:n,size:r}){super([`Data size of ${r} bytes is too small for given parameters.`].join(`
42
+ `),{metaMessages:[`Params: (${Zl(n,{includeName:!0})})`,`Data: ${t} (${r} 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=t,this.params=n,this.size=r}}class Uc extends ee{constructor({cause:t}={}){super('Cannot decode zero data ("0x") with ABI parameters.',{name:"AbiDecodingZeroDataError",cause:t})}}class WI extends ee{constructor({expectedLength:t,givenLength:n,type:r}){super([`ABI encoding array length mismatch for type ${r}.`,`Expected length: ${t}`,`Given length: ${n}`].join(`
43
+ `),{name:"AbiEncodingArrayLengthMismatchError"})}}class GI extends ee{constructor({expectedSize:t,value:n}){super(`Size of bytes "${n}" (bytes${Et(n)}) does not match expected size (bytes${t}).`,{name:"AbiEncodingBytesSizeMismatchError"})}}class zw extends ee{constructor({expectedLength:t,givenLength:n}){super(["ABI encoding params/values length mismatch.",`Expected length (params): ${t}`,`Given length (values): ${n}`].join(`
44
+ `),{name:"AbiEncodingLengthMismatchError"})}}class qI extends ee{constructor(t,{docsPath:n}){super([`Arguments (\`args\`) were provided to "${t}", but "${t}" on the ABI does not contain any parameters (\`inputs\`).`,"Cannot encode error result without knowing what the parameter types are.","Make sure you are using the correct ABI and that the inputs exist on it."].join(`
45
+ `),{docsPath:n,name:"AbiErrorInputsNotFoundError"})}}class Ww extends ee{constructor(t,{docsPath:n}={}){super([`Error ${t?`"${t}" `:""}not found on ABI.`,"Make sure you are using the correct ABI and that the error exists on it."].join(`
46
+ `),{docsPath:n,name:"AbiErrorNotFoundError"})}}class Gw extends ee{constructor(t,{docsPath:n,cause:r}){super([`Encoded error signature "${t}" not found on 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://4byte.sourcify.dev/?q=${t}.`].join(`
47
+ `),{docsPath:n,name:"AbiErrorSignatureNotFoundError",cause:r}),Object.defineProperty(this,"signature",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.signature=t}}class VI extends ee{constructor({docsPath:t}){super("Cannot extract event signature from empty topics.",{docsPath:t,name:"AbiEventSignatureEmptyTopicsError"})}}class KI extends ee{constructor(t,{docsPath:n}){super([`Encoded event signature "${t}" not found on ABI.`,"Make sure you are using the correct ABI and that the event exists on it.",`You can look up the signature here: https://4byte.sourcify.dev/?q=${t}.`].join(`
48
+ `),{docsPath:n,name:"AbiEventSignatureNotFoundError"})}}class qw extends ee{constructor(t,{docsPath:n}={}){super([`Event ${t?`"${t}" `:""}not found on ABI.`,"Make sure you are using the correct ABI and that the event exists on it."].join(`
49
+ `),{docsPath:n,name:"AbiEventNotFoundError"})}}class Xo extends ee{constructor(t,{docsPath:n}={}){super([`Function ${t?`"${t}" `:""}not found on ABI.`,"Make sure you are using the correct ABI and that the function exists on it."].join(`
50
+ `),{docsPath:n,name:"AbiFunctionNotFoundError"})}}class Vw extends ee{constructor(t,{docsPath:n}){super([`Function "${t}" does not contain any \`outputs\` on ABI.`,"Cannot decode function result without knowing what the parameter types are.","Make sure you are using the correct ABI and that the function exists on it."].join(`
51
+ `),{docsPath:n,name:"AbiFunctionOutputsNotFoundError"})}}class JI extends ee{constructor(t,{docsPath:n}){super([`Encoded function signature "${t}" not found on ABI.`,"Make sure you are using the correct ABI and that the function exists on it.",`You can look up the signature here: https://4byte.sourcify.dev/?q=${t}.`].join(`
52
+ `),{docsPath:n,name:"AbiFunctionSignatureNotFoundError"})}}class ZI extends ee{constructor(t,n){super("Found ambiguous types in overloaded ABI items.",{metaMessages:[`\`${t.type}\` in \`${kr(t.abiItem)}\`, and`,`\`${n.type}\` in \`${kr(n.abiItem)}\``,"","These types encode differently and cannot be distinguished at runtime.","Remove one of the ambiguous items in the ABI."],name:"AbiItemAmbiguityError"})}}let Kw=class extends ee{constructor({expectedSize:t,givenSize:n}){super(`Expected bytes${t}, got bytes${n}.`,{name:"BytesSizeMismatchError"})}};class Yl extends ee{constructor({abiItem:t,data:n,params:r,size:i}){super([`Data size of ${i} bytes is too small for non-indexed event parameters.`].join(`
53
+ `),{metaMessages:[`Params: (${Zl(r,{includeName:!0})})`,`Data: ${n} (${i} bytes)`],name:"DecodeLogDataMismatch"}),Object.defineProperty(this,"abiItem",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),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.abiItem=t,this.data=n,this.params=r,this.size=i}}class D0 extends ee{constructor({abiItem:t,param:n}){super([`Expected a topic for indexed event parameter${n.name?` "${n.name}"`:""} on event "${kr(t,{includeName:!0})}".`].join(`
54
+ `),{name:"DecodeLogTopicsMismatch"}),Object.defineProperty(this,"abiItem",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.abiItem=t}}class YI extends ee{constructor(t,{docsPath:n}){super([`Type "${t}" is not a valid encoding type.`,"Please provide a valid ABI type."].join(`
55
+ `),{docsPath:n,name:"InvalidAbiEncodingType"})}}class QI extends ee{constructor(t,{docsPath:n}){super([`Type "${t}" is not a valid decoding type.`,"Please provide a valid ABI type."].join(`
56
+ `),{docsPath:n,name:"InvalidAbiDecodingType"})}}let Jw=class extends ee{constructor(t){super([`Value "${t}" is not a valid array.`].join(`
57
+ `),{name:"InvalidArrayError"})}};class XI extends ee{constructor(t){super([`"${t}" is not a valid definition type.`,'Valid types: "function", "event", "error"'].join(`
58
+ `),{name:"InvalidDefinitionTypeError"})}}class eC extends ee{constructor(t){super(`Type "${t}" is not supported for packed encoding.`,{name:"UnsupportedPackedAbiType"})}}let _n=class extends ee{constructor({address:t}){super(`Address "${t}" is invalid.`,{metaMessages:["- Address must be a hex value of 20 bytes (40 hex characters).","- Address must match its checksum counterpart."],name:"InvalidAddressError"})}},Zw=class extends ee{constructor({offset:t,position:n,size:r}){super(`Slice ${n==="start"?"starting":"ending"} at offset "${t}" is out-of-bounds (size: ${r}).`,{name:"SliceOffsetOutOfBoundsError"})}},Yw=class extends ee{constructor({size:t,targetSize:n,type:r}){super(`${r.charAt(0).toUpperCase()}${r.slice(1).toLowerCase()} size (${t}) exceeds padding size (${n}).`,{name:"SizeExceedsPaddingSizeError"})}};class Qw extends ee{constructor({size:t,targetSize:n,type:r}){super(`${r.charAt(0).toUpperCase()}${r.slice(1).toLowerCase()} is expected to be ${n} ${r} long, but is ${t} ${r} long.`,{name:"InvalidBytesLengthError"})}}function Kt(e,{dir:t,size:n=32}={}){return typeof e=="string"?Xi(e,{dir:t,size:n}):tC(e,{dir:t,size:n})}function Xi(e,{dir:t,size:n=32}={}){if(n===null)return e;const r=e.replace("0x","");if(r.length>n*2)throw new Yw({size:Math.ceil(r.length/2),targetSize:n,type:"hex"});return`0x${r[t==="right"?"padEnd":"padStart"](n*2,"0")}`}function tC(e,{dir:t,size:n=32}={}){if(n===null)return e;if(e.length>n)throw new Yw({size:e.length,targetSize:n,type:"bytes"});const r=new Uint8Array(n);for(let i=0;i<n;i++){const s=t==="right";r[s?i:n-i-1]=e[s?i:e.length-i-1]}return r}let U0=class extends ee{constructor({max:t,min:n,signed:r,size:i,value:s}){super(`Number "${s}" is not in safe ${i?`${i*8}-bit ${r?"signed":"unsigned"} `:""}integer range ${t?`(${n} to ${t})`:`(above ${n})`}`,{name:"IntegerOutOfRangeError"})}},nC=class extends ee{constructor(t){super(`Bytes value "${t}" is not a valid boolean. The bytes array must contain a single byte of either a 0 or 1 value.`,{name:"InvalidBytesBooleanError"})}};class rC extends ee{constructor(t){super(`Hex value "${t}" is not a valid boolean. The hex value must be "0x0" (false) or "0x1" (true).`,{name:"InvalidHexBooleanError"})}}let iC=class extends ee{constructor({givenSize:t,maxSize:n}){super(`Size cannot exceed ${n} bytes. Given size: ${t} bytes.`,{name:"SizeOverflowError"})}};function En(e,{dir:t="left"}={}){let n=typeof e=="string"?e.replace("0x",""):e,r=0;for(let i=0;i<n.length-1&&n[t==="left"?i:n.length-i-1].toString()==="0";i++)r++;return n=t==="left"?n.slice(r):n.slice(0,n.length-r),typeof e=="string"?(n.length===1&&t==="right"&&(n=`${n}0`),`0x${n.length%2===1?`0${n}`:n}`):n}function lr(e,{size:t}){if(Et(e)>t)throw new iC({givenSize:Et(e),maxSize:t})}function It(e,t={}){const{signed:n}=t;t.size&&lr(e,{size:t.size});const r=BigInt(e);if(!n)return r;const i=(e.length-2)/2,s=(1n<<BigInt(i)*8n-1n)-1n;return r<=s?r:r-BigInt(`0x${"f".padStart(i*2,"f")}`)-1n}function sC(e,t={}){let n=e;if(t.size&&(lr(n,{size:t.size}),n=En(n)),En(n)==="0x00")return!1;if(En(n)==="0x01")return!0;throw new rC(n)}function Pn(e,t={}){const n=It(e,t),r=Number(n);if(!Number.isSafeInteger(r))throw new U0({max:`${Number.MAX_SAFE_INTEGER}`,min:`${Number.MIN_SAFE_INTEGER}`,signed:t.signed,size:t.size,value:`${n}n`});return r}function Ql(e,t={}){let n=Rn(e);return t.size&&(lr(n,{size:t.size}),n=En(n,{dir:"right"})),new TextDecoder().decode(n)}const oC=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function tn(e,t={}){return typeof e=="number"||typeof e=="bigint"?oe(e,t):typeof e=="string"?Ds(e,t):typeof e=="boolean"?H0(e,t):Jt(e,t)}function H0(e,t={}){const n=`0x${Number(e)}`;return typeof t.size=="number"?(lr(n,{size:t.size}),Kt(n,{size:t.size})):n}function Jt(e,t={}){let n="";for(let i=0;i<e.length;i++)n+=oC[e[i]];const r=`0x${n}`;return typeof t.size=="number"?(lr(r,{size:t.size}),Kt(r,{dir:"right",size:t.size})):r}function oe(e,t={}){const{signed:n,size:r}=t,i=BigInt(e);let s;r?n?s=(1n<<BigInt(r)*8n-1n)-1n:s=2n**(BigInt(r)*8n)-1n:typeof e=="number"&&(s=BigInt(Number.MAX_SAFE_INTEGER));const o=typeof s=="bigint"&&n?-s-1n:0;if(s&&i>s||i<o){const c=typeof e=="bigint"?"n":"";throw new U0({max:s?`${s}${c}`:void 0,min:`${o}${c}`,signed:n,size:r,value:`${e}${c}`})}const a=`0x${(n&&i<0?(1n<<BigInt(r*8))+BigInt(i):i).toString(16)}`;return r?Kt(a,{size:r}):a}const aC=new TextEncoder;function Ds(e,t={}){const n=aC.encode(e);return Jt(n,t)}const cC=new TextEncoder;function ea(e,t={}){return typeof e=="number"||typeof e=="bigint"?lC(e,t):typeof e=="boolean"?uC(e,t):pn(e)?Rn(e,t):gi(e,t)}function uC(e,t={}){const n=new Uint8Array(1);return n[0]=Number(e),typeof t.size=="number"?(lr(n,{size:t.size}),Kt(n,{size:t.size})):n}const mi={zero:48,nine:57,A:65,F:70,a:97,f:102};function Xw(e){if(e>=mi.zero&&e<=mi.nine)return e-mi.zero;if(e>=mi.A&&e<=mi.F)return e-(mi.A-10);if(e>=mi.a&&e<=mi.f)return e-(mi.a-10)}function Rn(e,t={}){let n=e;t.size&&(lr(n,{size:t.size}),n=Kt(n,{dir:"right",size:t.size}));let r=n.slice(2);r.length%2&&(r=`0${r}`);const i=r.length/2,s=new Uint8Array(i);for(let o=0,a=0;o<i;o++){const c=Xw(r.charCodeAt(a++)),u=Xw(r.charCodeAt(a++));if(c===void 0||u===void 0)throw new ee(`Invalid byte sequence ("${r[a-2]}${r[a-1]}" in "${r}").`);s[o]=c*16+u}return s}function lC(e,t){const n=oe(e,t);return Rn(n)}function gi(e,t={}){const n=cC.encode(e);return typeof t.size=="number"?(lr(n,{size:t.size}),Kt(n,{dir:"right",size:t.size})):n}const Xl=BigInt(2**32-1),ev=BigInt(32);function dC(e,t=!1){return t?{h:Number(e&Xl),l:Number(e>>ev&Xl)}:{h:Number(e>>ev&Xl)|0,l:Number(e&Xl)|0}}function tv(e,t=!1){const n=e.length;let r=new Uint32Array(n),i=new Uint32Array(n);for(let s=0;s<n;s++){const{h:o,l:a}=dC(e[s],t);[r[s],i[s]]=[o,a]}return[r,i]}const nv=(e,t,n)=>e>>>n,rv=(e,t,n)=>e<<32-n|t>>>n,ta=(e,t,n)=>e>>>n|t<<32-n,na=(e,t,n)=>e<<32-n|t>>>n,ed=(e,t,n)=>e<<64-n|t>>>n-32,td=(e,t,n)=>e>>>n-32|t<<64-n,fC=(e,t,n)=>e<<n|t>>>32-n,hC=(e,t,n)=>t<<n|e>>>32-n,pC=(e,t,n)=>t<<n-32|e>>>64-n,mC=(e,t,n)=>e<<n-32|t>>>64-n;function yi(e,t,n,r){const i=(t>>>0)+(r>>>0);return{h:e+n+(i/2**32|0)|0,l:i|0}}const gC=(e,t,n)=>(e>>>0)+(t>>>0)+(n>>>0),yC=(e,t,n,r)=>t+n+r+(e/2**32|0)|0,bC=(e,t,n,r)=>(e>>>0)+(t>>>0)+(n>>>0)+(r>>>0),wC=(e,t,n,r,i)=>t+n+r+i+(e/2**32|0)|0,vC=(e,t,n,r,i)=>(e>>>0)+(t>>>0)+(n>>>0)+(r>>>0)+(i>>>0),_C=(e,t,n,r,i,s)=>t+n+r+i+s+(e/2**32|0)|0,ra=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0;/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */function nd(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array"}function ia(e){if(!Number.isSafeInteger(e)||e<0)throw new Error("positive integer expected, got "+e)}function bi(e,...t){if(!nd(e))throw new Error("Uint8Array expected");if(t.length>0&&!t.includes(e.length))throw new Error("Uint8Array expected of length "+t+", got length="+e.length)}function iv(e){if(typeof e!="function"||typeof e.create!="function")throw new Error("Hash should be wrapped by utils.createHasher");ia(e.outputLen),ia(e.blockLen)}function sa(e,t=!0){if(e.destroyed)throw new Error("Hash instance has been destroyed");if(t&&e.finished)throw new Error("Hash#digest() has already been called")}function sv(e,t){bi(e);const n=t.outputLen;if(e.length<n)throw new Error("digestInto() expects output buffer of length at least "+n)}function EC(e){return new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4))}function es(...e){for(let t=0;t<e.length;t++)e[t].fill(0)}function z0(e){return new DataView(e.buffer,e.byteOffset,e.byteLength)}function qr(e,t){return e<<32-t|e>>>t}const xC=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;function SC(e){return e<<24&4278190080|e<<8&16711680|e>>>8&65280|e>>>24&255}function kC(e){for(let t=0;t<e.length;t++)e[t]=SC(e[t]);return e}const ov=xC?e=>e:kC,av=typeof Uint8Array.from([]).toHex=="function"&&typeof Uint8Array.fromHex=="function",AC=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function oa(e){if(bi(e),av)return e.toHex();let t="";for(let n=0;n<e.length;n++)t+=AC[e[n]];return t}const wi={_0:48,_9:57,A:65,F:70,a:97,f:102};function cv(e){if(e>=wi._0&&e<=wi._9)return e-wi._0;if(e>=wi.A&&e<=wi.F)return e-(wi.A-10);if(e>=wi.a&&e<=wi.f)return e-(wi.a-10)}function rd(e){if(typeof e!="string")throw new Error("hex string expected, got "+typeof e);if(av)return Uint8Array.fromHex(e);const t=e.length,n=t/2;if(t%2)throw new Error("hex string expected, got unpadded hex of length "+t);const r=new Uint8Array(n);for(let i=0,s=0;i<n;i++,s+=2){const o=cv(e.charCodeAt(s)),a=cv(e.charCodeAt(s+1));if(o===void 0||a===void 0){const c=e[s]+e[s+1];throw new Error('hex string expected, got non-hex character "'+c+'" at index '+s)}r[i]=o*16+a}return r}function IC(e){if(typeof e!="string")throw new Error("string expected");return new Uint8Array(new TextEncoder().encode(e))}function id(e){return typeof e=="string"&&(e=IC(e)),bi(e),e}function vi(...e){let t=0;for(let r=0;r<e.length;r++){const i=e[r];bi(i),t+=i.length}const n=new Uint8Array(t);for(let r=0,i=0;r<e.length;r++){const s=e[r];n.set(s,i),i+=s.length}return n}let W0=class{};function sd(e){const t=r=>e().update(id(r)).digest(),n=e();return t.outputLen=n.outputLen,t.blockLen=n.blockLen,t.create=()=>e(),t}function G0(e=32){if(ra&&typeof ra.getRandomValues=="function")return ra.getRandomValues(new Uint8Array(e));if(ra&&typeof ra.randomBytes=="function")return Uint8Array.from(ra.randomBytes(e));throw new Error("crypto.getRandomValues must be defined")}const CC=BigInt(0),Hc=BigInt(1),PC=BigInt(2),RC=BigInt(7),TC=BigInt(256),OC=BigInt(113),uv=[],lv=[],dv=[];for(let e=0,t=Hc,n=1,r=0;e<24;e++){[n,r]=[r,(2*n+3*r)%5],uv.push(2*(5*r+n)),lv.push((e+1)*(e+2)/2%64);let i=CC;for(let s=0;s<7;s++)t=(t<<Hc^(t>>RC)*OC)%TC,t&PC&&(i^=Hc<<(Hc<<BigInt(s))-Hc);dv.push(i)}const fv=tv(dv,!0),MC=fv[0],BC=fv[1],hv=(e,t,n)=>n>32?pC(e,t,n):fC(e,t,n),pv=(e,t,n)=>n>32?mC(e,t,n):hC(e,t,n);function NC(e,t=24){const n=new Uint32Array(10);for(let r=24-t;r<24;r++){for(let o=0;o<10;o++)n[o]=e[o]^e[o+10]^e[o+20]^e[o+30]^e[o+40];for(let o=0;o<10;o+=2){const a=(o+8)%10,c=(o+2)%10,u=n[c],l=n[c+1],d=hv(u,l,1)^n[a],f=pv(u,l,1)^n[a+1];for(let h=0;h<50;h+=10)e[o+h]^=d,e[o+h+1]^=f}let i=e[2],s=e[3];for(let o=0;o<24;o++){const a=lv[o],c=hv(i,s,a),u=pv(i,s,a),l=uv[o];i=e[l],s=e[l+1],e[l]=c,e[l+1]=u}for(let o=0;o<50;o+=10){for(let a=0;a<10;a++)n[a]=e[o+a];for(let a=0;a<10;a++)e[o+a]^=~n[(a+2)%10]&n[(a+4)%10]}e[0]^=MC[r],e[1]^=BC[r]}es(n)}let LC=class vI extends W0{constructor(t,n,r,i=!1,s=24){if(super(),this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,this.enableXOF=!1,this.blockLen=t,this.suffix=n,this.outputLen=r,this.enableXOF=i,this.rounds=s,ia(r),!(0<t&&t<200))throw new Error("only keccak-f1600 function is supported");this.state=new Uint8Array(200),this.state32=EC(this.state)}clone(){return this._cloneInto()}keccak(){ov(this.state32),NC(this.state32,this.rounds),ov(this.state32),this.posOut=0,this.pos=0}update(t){sa(this),t=id(t),bi(t);const{blockLen:n,state:r}=this,i=t.length;for(let s=0;s<i;){const o=Math.min(n-this.pos,i-s);for(let a=0;a<o;a++)r[this.pos++]^=t[s++];this.pos===n&&this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;const{state:t,suffix:n,pos:r,blockLen:i}=this;t[r]^=n,n&128&&r===i-1&&this.keccak(),t[i-1]^=128,this.keccak()}writeInto(t){sa(this,!1),bi(t),this.finish();const n=this.state,{blockLen:r}=this;for(let i=0,s=t.length;i<s;){this.posOut>=r&&this.keccak();const o=Math.min(r-this.posOut,s-i);t.set(n.subarray(this.posOut,this.posOut+o),i),this.posOut+=o,i+=o}return t}xofInto(t){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(t)}xof(t){return ia(t),this.xofInto(new Uint8Array(t))}digestInto(t){if(sv(t,this),this.finished)throw new Error("digest() was already called");return this.writeInto(t),this.destroy(),t}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,es(this.state)}_cloneInto(t){const{blockLen:n,suffix:r,outputLen:i,rounds:s,enableXOF:o}=this;return t||(t=new vI(n,r,i,o,s)),t.state32.set(this.state32),t.pos=this.pos,t.posOut=this.posOut,t.finished=this.finished,t.rounds=s,t.suffix=r,t.outputLen=i,t.enableXOF=o,t.destroyed=this.destroyed,t}};const jC=(e,t,n)=>sd(()=>new LC(t,e,n)),mv=jC(1,136,256/8);function xt(e,t){const n=t||"hex",r=mv(pn(e,{strict:!1})?ea(e):e);return n==="bytes"?r:tn(r)}let aa=class extends Map{constructor(t){super(),Object.defineProperty(this,"maxSize",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.maxSize=t}get(t){const n=super.get(t);return super.has(t)&&(super.delete(t),super.set(t,n)),n}set(t,n){if(super.has(t)&&super.delete(t),super.set(t,n),this.maxSize&&this.size>this.maxSize){const r=super.keys().next().value;r!==void 0&&super.delete(r)}return this}};const $C=/^0x[a-fA-F0-9]{40}$/,q0=new aa(8192);function Pt(e,t){const{strict:n=!0}=t??{},r=`${e}.${n}`;if(q0.has(r))return q0.get(r);const i=$C.test(e)?e.toLowerCase()===e?!0:n?od(e)===e:!0:!1;return q0.set(r,i),i}const V0=new aa(8192);function od(e,t){if(V0.has(`${e}.${t}`))return V0.get(`${e}.${t}`);const n=e.substring(2).toLowerCase(),r=xt(gi(n),"bytes"),i=n.split("");for(let o=0;o<40;o+=2)r[o>>1]>>4>=8&&i[o]&&(i[o]=i[o].toUpperCase()),(r[o>>1]&15)>=8&&i[o+1]&&(i[o+1]=i[o+1].toUpperCase());const s=`0x${i.join("")}`;return V0.set(`${e}.${t}`,s),s}function mn(e,t){if(!Pt(e,{strict:!1}))throw new _n({address:e});return od(e,t)}let gv=class extends ee{constructor({offset:t}){super(`Offset \`${t}\` cannot be negative.`,{name:"NegativeOffsetError"})}},yv=class extends ee{constructor({length:t,position:n}){super(`Position \`${n}\` is out of bounds (\`0 < position < ${t}\`).`,{name:"PositionOutOfBoundsError"})}},FC=class extends ee{constructor({count:t,limit:n}){super(`Recursive read limit of \`${n}\` exceeded (recursive read count: \`${t}\`).`,{name:"RecursiveReadLimitExceededError"})}};const DC={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 FC({count:this.recursiveReadCount+1,limit:this.recursiveReadLimit})},assertPosition(e){if(e<0||e>this.bytes.length-1)throw new yv({length:this.bytes.length,position:e})},decrementPosition(e){if(e<0)throw new gv({offset:e});const t=this.position-e;this.assertPosition(t),this.position=t},getReadCount(e){return this.positionReadCount.get(e||this.position)||0},incrementPosition(e){if(e<0)throw new gv({offset:e});const t=this.position+e;this.assertPosition(t),this.position=t},inspectByte(e){const t=e??this.position;return this.assertPosition(t),this.bytes[t]},inspectBytes(e,t){const n=t??this.position;return this.assertPosition(n+e-1),this.bytes.subarray(n,n+e)},inspectUint8(e){const t=e??this.position;return this.assertPosition(t),this.bytes[t]},inspectUint16(e){const t=e??this.position;return this.assertPosition(t+1),this.dataView.getUint16(t)},inspectUint24(e){const t=e??this.position;return this.assertPosition(t+2),(this.dataView.getUint16(t)<<8)+this.dataView.getUint8(t+2)},inspectUint32(e){const t=e??this.position;return this.assertPosition(t+3),this.dataView.getUint32(t)},pushByte(e){this.assertPosition(this.position),this.bytes[this.position]=e,this.position++},pushBytes(e){this.assertPosition(this.position+e.length-1),this.bytes.set(e,this.position),this.position+=e.length},pushUint8(e){this.assertPosition(this.position),this.bytes[this.position]=e,this.position++},pushUint16(e){this.assertPosition(this.position+1),this.dataView.setUint16(this.position,e),this.position+=2},pushUint24(e){this.assertPosition(this.position+2),this.dataView.setUint16(this.position,e>>8),this.dataView.setUint8(this.position+2,e&255),this.position+=3},pushUint32(e){this.assertPosition(this.position+3),this.dataView.setUint32(this.position,e),this.position+=4},readByte(){this.assertReadLimit(),this._touch();const e=this.inspectByte();return this.position++,e},readBytes(e,t){this.assertReadLimit(),this._touch();const n=this.inspectBytes(e);return this.position+=t??e,n},readUint8(){this.assertReadLimit(),this._touch();const e=this.inspectUint8();return this.position+=1,e},readUint16(){this.assertReadLimit(),this._touch();const e=this.inspectUint16();return this.position+=2,e},readUint24(){this.assertReadLimit(),this._touch();const e=this.inspectUint24();return this.position+=3,e},readUint32(){this.assertReadLimit(),this._touch();const e=this.inspectUint32();return this.position+=4,e},get remaining(){return this.bytes.length-this.position},setPosition(e){const t=this.position;return this.assertPosition(e),this.position=e,()=>this.position=t},_touch(){if(this.recursiveReadLimit===Number.POSITIVE_INFINITY)return;const e=this.getReadCount();this.positionReadCount.set(this.position,e+1),e>0&&this.recursiveReadCount++}};function K0(e,{recursiveReadLimit:t=8192}={}){const n=Object.create(DC);return n.bytes=e,n.dataView=new DataView(e.buffer??e,e.byteOffset,e.byteLength),n.positionReadCount=new Map,n.recursiveReadLimit=t,n}function _i(e,t,n,{strict:r}={}){return pn(e,{strict:!1})?J0(e,t,n,{strict:r}):vv(e,t,n,{strict:r})}function bv(e,t){if(typeof t=="number"&&t>0&&t>Et(e)-1)throw new Zw({offset:t,position:"start",size:Et(e)})}function wv(e,t,n){if(typeof t=="number"&&typeof n=="number"&&Et(e)!==n-t)throw new Zw({offset:n,position:"end",size:Et(e)})}function vv(e,t,n,{strict:r}={}){bv(e,t);const i=e.slice(t,n);return r&&wv(i,t,n),i}function J0(e,t,n,{strict:r}={}){bv(e,t);const i=`0x${e.replace("0x","").slice((t??0)*2,(n??e.length)*2)}`;return r&&wv(i,t,n),i}function UC(e,t={}){typeof t.size<"u"&&lr(e,{size:t.size});const n=Jt(e,t);return It(n,t)}function HC(e,t={}){let n=e;if(typeof t.size<"u"&&(lr(n,{size:t.size}),n=En(n)),n.length>1||n[0]>1)throw new nC(n);return!!n[0]}function Ei(e,t={}){typeof t.size<"u"&&lr(e,{size:t.size});const n=Jt(e,t);return Pn(n,t)}function zC(e,t={}){let n=e;return typeof t.size<"u"&&(lr(n,{size:t.size}),n=En(n,{dir:"right"})),new TextDecoder().decode(n)}function Zt(e){return typeof e[0]=="string"?Hn(e):WC(e)}function WC(e){let t=0;for(const i of e)t+=i.length;const n=new Uint8Array(t);let r=0;for(const i of e)n.set(i,r),r+=i.length;return n}function Hn(e){return`0x${e.reduce((t,n)=>t+n.replace("0x",""),"")}`}const GC=/^(.*)\[([0-9]*)\]$/,_v=/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/,Z0=/^(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)?$/;function zn(e,t){if(e.length!==t.length)throw new zw({expectedLength:e.length,givenLength:t.length});const n=qC({params:e,values:t}),r=Q0(n);return r.length===0?"0x":r}function qC({params:e,values:t}){const n=[];for(let r=0;r<e.length;r++)n.push(Y0({param:e[r],value:t[r]}));return n}function Y0({param:e,value:t}){const n=X0(e.type);if(n){const[r,i]=n;return KC(t,{length:r,param:{...e,type:i}})}if(e.type==="tuple")return XC(t,{param:e});if(e.type==="address")return VC(t);if(e.type==="bool")return ZC(t);if(e.type.startsWith("uint")||e.type.startsWith("int")){const r=e.type.startsWith("int"),[,,i="256"]=Z0.exec(e.type)??[];return YC(t,{signed:r,size:Number(i)})}if(e.type.startsWith("bytes"))return JC(t,{param:e});if(e.type==="string")return QC(t);throw new YI(e.type,{docsPath:"/docs/contract/encodeAbiParameters"})}function Q0(e){let t=0;for(let s=0;s<e.length;s++){const{dynamic:o,encoded:a}=e[s];o?t+=32:t+=Et(a)}const n=[],r=[];let i=0;for(let s=0;s<e.length;s++){const{dynamic:o,encoded:a}=e[s];o?(n.push(oe(t+i,{size:32})),r.push(a),i+=Et(a)):n.push(a)}return Zt([...n,...r])}function VC(e){if(!Pt(e))throw new _n({address:e});return{dynamic:!1,encoded:Xi(e.toLowerCase())}}function KC(e,{length:t,param:n}){const r=t===null;if(!Array.isArray(e))throw new Jw(e);if(!r&&e.length!==t)throw new WI({expectedLength:t,givenLength:e.length,type:`${n.type}[${t}]`});let i=!1;const s=[];for(let o=0;o<e.length;o++){const a=Y0({param:n,value:e[o]});a.dynamic&&(i=!0),s.push(a)}if(r||i){const o=Q0(s);if(r){const a=oe(s.length,{size:32});return{dynamic:!0,encoded:s.length>0?Zt([a,o]):a}}if(i)return{dynamic:!0,encoded:o}}return{dynamic:!1,encoded:Zt(s.map(({encoded:o})=>o))}}function JC(e,{param:t}){const[,n]=t.type.split("bytes"),r=Et(e);if(!n){let i=e;return r%32!==0&&(i=Xi(i,{dir:"right",size:Math.ceil((e.length-2)/2/32)*32})),{dynamic:!0,encoded:Zt([Xi(oe(r,{size:32})),i])}}if(r!==Number.parseInt(n,10))throw new GI({expectedSize:Number.parseInt(n,10),value:e});return{dynamic:!1,encoded:Xi(e,{dir:"right"})}}function ZC(e){if(typeof e!="boolean")throw new ee(`Invalid boolean value: "${e}" (type: ${typeof e}). Expected: \`true\` or \`false\`.`);return{dynamic:!1,encoded:Xi(H0(e))}}function YC(e,{signed:t,size:n=256}){if(typeof n=="number"){const r=2n**(BigInt(n)-(t?1n:0n))-1n,i=t?-r-1n:0n;if(e>r||e<i)throw new U0({max:r.toString(),min:i.toString(),signed:t,size:n/8,value:e.toString()})}return{dynamic:!1,encoded:oe(e,{size:32,signed:t})}}function QC(e){const t=Ds(e),n=Math.ceil(Et(t)/32),r=[];for(let i=0;i<n;i++)r.push(Xi(_i(t,i*32,(i+1)*32),{dir:"right"}));return{dynamic:!0,encoded:Zt([Xi(oe(Et(t),{size:32})),...r])}}function XC(e,{param:t}){let n=!1;const r=[];for(let i=0;i<t.components.length;i++){const s=t.components[i],o=Array.isArray(e)?i:s.name,a=Y0({param:s,value:e[o]});r.push(a),a.dynamic&&(n=!0)}return{dynamic:n,encoded:n?Q0(r):Zt(r.map(({encoded:i})=>i))}}function X0(e){const t=e.match(/^(.*)\[(\d+)?\]$/);return t?[t[2]?Number(t[2]):null,t[1]]:void 0}function Us(e,t){const n=typeof t=="string"?Rn(t):t,r=K0(n);if(Et(n)===0&&e.length>0)throw new Uc;if(Et(t)&&Et(t)<32)throw new Hw({data:typeof t=="string"?t:Jt(t),params:e,size:Et(t)});let i=0;const s=[];for(let o=0;o<e.length;++o){const a=e[o];r.setPosition(i);const[c,u]=ca(r,a,{staticPosition:0});i+=u,s.push(c)}return s}function ca(e,t,{staticPosition:n}){const r=X0(t.type);if(r){const[i,s]=r;return tP(e,{...t,type:s},{length:i,staticPosition:n})}if(t.type==="tuple")return sP(e,t,{staticPosition:n});if(t.type==="address")return eP(e);if(t.type==="bool")return nP(e);if(t.type.startsWith("bytes"))return rP(e,t,{staticPosition:n});if(t.type.startsWith("uint")||t.type.startsWith("int"))return iP(e,t);if(t.type==="string")return oP(e,{staticPosition:n});throw new QI(t.type,{docsPath:"/docs/contract/decodeAbiParameters"})}const Ev=32,ep=32;function eP(e){const t=e.readBytes(32);return[od(Jt(vv(t,-20))),32]}function tP(e,t,{length:n,staticPosition:r}){if(!n){const o=Ei(e.readBytes(ep)),a=r+o,c=a+Ev;e.setPosition(a);const u=Ei(e.readBytes(Ev)),l=zc(t);let d=0;const f=[];for(let h=0;h<u;++h){e.setPosition(c+(l?h*32:d));const[m,y]=ca(e,t,{staticPosition:c});d+=y,f.push(m)}return e.setPosition(r+32),[f,32]}if(zc(t)){const o=Ei(e.readBytes(ep)),a=r+o,c=[];for(let u=0;u<n;++u){e.setPosition(a+u*32);const[l]=ca(e,t,{staticPosition:a});c.push(l)}return e.setPosition(r+32),[c,32]}let i=0;const s=[];for(let o=0;o<n;++o){const[a,c]=ca(e,t,{staticPosition:r+i});i+=c,s.push(a)}return[s,i]}function nP(e){return[HC(e.readBytes(32),{size:32}),32]}function rP(e,t,{staticPosition:n}){const[r,i]=t.type.split("bytes");if(!i){const o=Ei(e.readBytes(32));e.setPosition(n+o);const a=Ei(e.readBytes(32));if(a===0)return e.setPosition(n+32),["0x",32];const c=e.readBytes(a);return e.setPosition(n+32),[Jt(c),32]}return[Jt(e.readBytes(Number.parseInt(i,10),32)),32]}function iP(e,t){const n=t.type.startsWith("int"),r=Number.parseInt(t.type.split("int")[1]||"256",10),i=e.readBytes(32);return[r>48?UC(i,{signed:n}):Ei(i,{signed:n}),32]}function sP(e,t,{staticPosition:n}){const r=t.components.length===0||t.components.some(({name:o})=>!o),i=r?[]:{};let s=0;if(zc(t)){const o=Ei(e.readBytes(ep)),a=n+o;for(let c=0;c<t.components.length;++c){const u=t.components[c];e.setPosition(a+s);const[l,d]=ca(e,u,{staticPosition:a});s+=d,i[r?c:u==null?void 0:u.name]=l}return e.setPosition(n+32),[i,32]}for(let o=0;o<t.components.length;++o){const a=t.components[o],[c,u]=ca(e,a,{staticPosition:n});i[r?o:a==null?void 0:a.name]=c,s+=u}return[i,s]}function oP(e,{staticPosition:t}){const n=Ei(e.readBytes(32)),r=t+n;e.setPosition(r);const i=Ei(e.readBytes(32));if(i===0)return e.setPosition(t+32),["",32];const s=e.readBytes(i,32),o=zC(En(s));return e.setPosition(t+32),[o,32]}function zc(e){var r;const{type:t}=e;if(t==="string"||t==="bytes"||t.endsWith("[]"))return!0;if(t==="tuple")return(r=e.components)==null?void 0:r.some(zc);const n=X0(e.type);return!!(n&&zc({...e,type:n[1]}))}const aP=e=>xt(ea(e));function cP(e){return aP(e)}const uP="1.2.3";let Wn=class rw extends Error{constructor(t,n={}){var o;const r=n.cause instanceof rw?n.cause.details:(o=n.cause)!=null&&o.message?n.cause.message:n.details,i=n.cause instanceof rw&&n.cause.docsPath||n.docsPath,s=[t||"An error occurred.","",...n.metaMessages?[...n.metaMessages,""]:[],...i?[`Docs: https://abitype.dev${i}`]:[],...r?[`Details: ${r}`]:[],`Version: abitype@${uP}`].join(`
59
+ `);super(s),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"}),n.cause&&(this.cause=n.cause),this.details=r,this.docsPath=i,this.metaMessages=n.metaMessages,this.shortMessage=t}};function xi(e,t){const n=e.exec(t);return n==null?void 0:n.groups}const xv=/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/,Sv=/^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)?$/,kv=/^\(.+?\).*?$/,Av=/^tuple(?<array>(\[(\d*)\])*)$/;function tp(e){let t=e.type;if(Av.test(e.type)&&"components"in e){t="(";const n=e.components.length;for(let i=0;i<n;i++){const s=e.components[i];t+=tp(s),i<n-1&&(t+=", ")}const r=xi(Av,e.type);return t+=`)${(r==null?void 0:r.array)||""}`,tp({...e,type:t})}return"indexed"in e&&e.indexed&&(t=`${t} indexed`),e.name?`${t} ${e.name}`:t}function ua(e){let t="";const n=e.length;for(let r=0;r<n;r++){const i=e[r];t+=tp(i),r!==n-1&&(t+=", ")}return t}function ad(e){var t;return e.type==="function"?`function ${e.name}(${ua(e.inputs)})${e.stateMutability&&e.stateMutability!=="nonpayable"?` ${e.stateMutability}`:""}${(t=e.outputs)!=null&&t.length?` returns (${ua(e.outputs)})`:""}`:e.type==="event"?`event ${e.name}(${ua(e.inputs)})`:e.type==="error"?`error ${e.name}(${ua(e.inputs)})`:e.type==="constructor"?`constructor(${ua(e.inputs)})${e.stateMutability==="payable"?" payable":""}`:e.type==="fallback"?`fallback() external${e.stateMutability==="payable"?" payable":""}`:"receive() external payable"}const Iv=/^error (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*)\((?<parameters>.*?)\)$/;function lP(e){return Iv.test(e)}function dP(e){return xi(Iv,e)}const Cv=/^event (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*)\((?<parameters>.*?)\)$/;function fP(e){return Cv.test(e)}function hP(e){return xi(Cv,e)}const Pv=/^function (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*)\((?<parameters>.*?)\)(?: (?<scope>external|public{1}))?(?: (?<stateMutability>pure|view|nonpayable|payable{1}))?(?: returns\s?\((?<returns>.*?)\))?$/;function pP(e){return Pv.test(e)}function mP(e){return xi(Pv,e)}const Rv=/^struct (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*) \{(?<properties>.*?)\}$/;function cd(e){return Rv.test(e)}function gP(e){return xi(Rv,e)}const Tv=/^constructor\((?<parameters>.*?)\)(?:\s(?<stateMutability>payable{1}))?$/;function yP(e){return Tv.test(e)}function bP(e){return xi(Tv,e)}const Ov=/^fallback\(\) external(?:\s(?<stateMutability>payable{1}))?$/;function wP(e){return Ov.test(e)}function vP(e){return xi(Ov,e)}const _P=/^receive\(\) external payable$/;function EP(e){return _P.test(e)}const Mv=new Set(["memory","indexed","storage","calldata"]),xP=new Set(["indexed"]),np=new Set(["calldata","memory","storage"]);class SP extends Wn{constructor({signature:t}){super("Failed to parse ABI item.",{details:`parseAbiItem(${JSON.stringify(t,null,2)})`,docsPath:"/api/human#parseabiitem-1"}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidAbiItemError"})}}class kP extends Wn{constructor({type:t}){super("Unknown type.",{metaMessages:[`Type "${t}" 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 AP extends Wn{constructor({type:t}){super("Unknown type.",{metaMessages:[`Type "${t}" is not a valid ABI type.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"UnknownSolidityTypeError"})}}class IP extends Wn{constructor({params:t}){super("Failed to parse ABI parameters.",{details:`parseAbiParameters(${JSON.stringify(t,null,2)})`,docsPath:"/api/human#parseabiparameters-1"}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidAbiParametersError"})}}class CP extends Wn{constructor({param:t}){super("Invalid ABI parameter.",{details:t}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidParameterError"})}}class PP extends Wn{constructor({param:t,name:n}){super("Invalid ABI parameter.",{details:t,metaMessages:[`"${n}" 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 RP extends Wn{constructor({param:t,type:n,modifier:r}){super("Invalid ABI parameter.",{details:t,metaMessages:[`Modifier "${r}" not allowed${n?` in "${n}" type`:""}.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidModifierError"})}}class TP extends Wn{constructor({param:t,type:n,modifier:r}){super("Invalid ABI parameter.",{details:t,metaMessages:[`Modifier "${r}" not allowed${n?` in "${n}" type`:""}.`,`Data location can only be specified for array, struct, or mapping types, but "${r}" was given.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidFunctionModifierError"})}}class OP extends Wn{constructor({abiParameter:t}){super("Invalid ABI parameter.",{details:JSON.stringify(t,null,2),metaMessages:["ABI parameter type is invalid."]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidAbiTypeParameterError"})}}class la extends Wn{constructor({signature:t,type:n}){super(`Invalid ${n} signature.`,{details:t}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidSignatureError"})}}class MP extends Wn{constructor({signature:t}){super("Unknown signature.",{details:t}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"UnknownSignatureError"})}}class BP extends Wn{constructor({signature:t}){super("Invalid struct signature.",{details:t,metaMessages:["No properties exist."]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidStructSignatureError"})}}class NP extends Wn{constructor({type:t}){super("Circular reference detected.",{metaMessages:[`Struct "${t}" is a circular reference.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"CircularReferenceError"})}}class LP extends Wn{constructor({current:t,depth:n}){super("Unbalanced parentheses.",{metaMessages:[`"${t.trim()}" has too many ${n>0?"opening":"closing"} parentheses.`],details:`Depth "${n}"`}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidParenthesisError"})}}function jP(e,t,n){let r="";if(n)for(const i of Object.entries(n)){if(!i)continue;let s="";for(const o of i[1])s+=`[${o.type}${o.name?`:${o.name}`:""}]`;r+=`(${i[0]}{${s}})`}return t?`${t}:${e}${r}`:`${e}${r}`}const rp=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 ip(e,t={}){if(pP(e))return $P(e,t);if(fP(e))return FP(e,t);if(lP(e))return DP(e,t);if(yP(e))return UP(e,t);if(wP(e))return HP(e);if(EP(e))return{type:"receive",stateMutability:"payable"};throw new MP({signature:e})}function $P(e,t={}){const n=mP(e);if(!n)throw new la({signature:e,type:"function"});const r=nr(n.parameters),i=[],s=r.length;for(let a=0;a<s;a++)i.push(Si(r[a],{modifiers:np,structs:t,type:"function"}));const o=[];if(n.returns){const a=nr(n.returns),c=a.length;for(let u=0;u<c;u++)o.push(Si(a[u],{modifiers:np,structs:t,type:"function"}))}return{name:n.name,type:"function",stateMutability:n.stateMutability??"nonpayable",inputs:i,outputs:o}}function FP(e,t={}){const n=hP(e);if(!n)throw new la({signature:e,type:"event"});const r=nr(n.parameters),i=[],s=r.length;for(let o=0;o<s;o++)i.push(Si(r[o],{modifiers:xP,structs:t,type:"event"}));return{name:n.name,type:"event",inputs:i}}function DP(e,t={}){const n=dP(e);if(!n)throw new la({signature:e,type:"error"});const r=nr(n.parameters),i=[],s=r.length;for(let o=0;o<s;o++)i.push(Si(r[o],{structs:t,type:"error"}));return{name:n.name,type:"error",inputs:i}}function UP(e,t={}){const n=bP(e);if(!n)throw new la({signature:e,type:"constructor"});const r=nr(n.parameters),i=[],s=r.length;for(let o=0;o<s;o++)i.push(Si(r[o],{structs:t,type:"constructor"}));return{type:"constructor",stateMutability:n.stateMutability??"nonpayable",inputs:i}}function HP(e){const t=vP(e);if(!t)throw new la({signature:e,type:"fallback"});return{type:"fallback",stateMutability:t.stateMutability??"nonpayable"}}const zP=/^(?<type>[a-zA-Z$_][a-zA-Z0-9$_]*(?:\spayable)?)(?<array>(?:\[\d*?\])+?)?(?:\s(?<modifier>calldata|indexed|memory|storage{1}))?(?:\s(?<name>[a-zA-Z$_][a-zA-Z0-9$_]*))?$/,WP=/^\((?<type>.+?)\)(?<array>(?:\[\d*?\])+?)?(?:\s(?<modifier>calldata|indexed|memory|storage{1}))?(?:\s(?<name>[a-zA-Z$_][a-zA-Z0-9$_]*))?$/,GP=/^u?int$/;function Si(e,t){var d,f;const n=jP(e,t==null?void 0:t.type,t==null?void 0:t.structs);if(rp.has(n))return rp.get(n);const r=kv.test(e),i=xi(r?WP:zP,e);if(!i)throw new CP({param:e});if(i.name&&VP(i.name))throw new PP({param:e,name:i.name});const s=i.name?{name:i.name}:{},o=i.modifier==="indexed"?{indexed:!0}:{},a=(t==null?void 0:t.structs)??{};let c,u={};if(r){c="tuple";const h=nr(i.type),m=[],y=h.length;for(let w=0;w<y;w++)m.push(Si(h[w],{structs:a}));u={components:m}}else if(i.type in a)c="tuple",u={components:a[i.type]};else if(GP.test(i.type))c=`${i.type}256`;else if(i.type==="address payable")c="address";else if(c=i.type,(t==null?void 0:t.type)!=="struct"&&!Bv(c))throw new AP({type:c});if(i.modifier){if(!((f=(d=t==null?void 0:t.modifiers)==null?void 0:d.has)!=null&&f.call(d,i.modifier)))throw new RP({param:e,type:t==null?void 0:t.type,modifier:i.modifier});if(np.has(i.modifier)&&!KP(c,!!i.array))throw new TP({param:e,type:t==null?void 0:t.type,modifier:i.modifier})}const l={type:`${c}${i.array??""}`,...s,...o,...u};return rp.set(n,l),l}function nr(e,t=[],n="",r=0){const i=e.trim().length;for(let s=0;s<i;s++){const o=e[s],a=e.slice(s+1);switch(o){case",":return r===0?nr(a,[...t,n.trim()]):nr(a,t,`${n}${o}`,r);case"(":return nr(a,t,`${n}${o}`,r+1);case")":return nr(a,t,`${n}${o}`,r-1);default:return nr(a,t,`${n}${o}`,r)}}if(n==="")return t;if(r!==0)throw new LP({current:n,depth:r});return t.push(n.trim()),t}function Bv(e){return e==="address"||e==="bool"||e==="function"||e==="string"||xv.test(e)||Sv.test(e)}const qP=/^(?:after|alias|anonymous|apply|auto|byte|calldata|case|catch|constant|copyof|default|defined|error|event|external|false|final|function|immutable|implements|in|indexed|inline|internal|let|mapping|match|memory|mutable|null|of|override|partial|private|promise|public|pure|reference|relocatable|return|returns|sizeof|static|storage|struct|super|supports|switch|this|true|try|typedef|typeof|var|view|virtual)$/;function VP(e){return e==="address"||e==="bool"||e==="function"||e==="string"||e==="tuple"||xv.test(e)||Sv.test(e)||qP.test(e)}function KP(e,t){return t||e==="bytes"||e==="string"||e==="tuple"}function sp(e){const t={},n=e.length;for(let o=0;o<n;o++){const a=e[o];if(!cd(a))continue;const c=gP(a);if(!c)throw new la({signature:a,type:"struct"});const u=c.properties.split(";"),l=[],d=u.length;for(let f=0;f<d;f++){const m=u[f].trim();if(!m)continue;const y=Si(m,{type:"struct"});l.push(y)}if(!l.length)throw new BP({signature:a});t[c.name]=l}const r={},i=Object.entries(t),s=i.length;for(let o=0;o<s;o++){const[a,c]=i[o];r[a]=Nv(c,t)}return r}const JP=/^(?<type>[a-zA-Z$_][a-zA-Z0-9$_]*)(?<array>(?:\[\d*?\])+?)?$/;function Nv(e=[],t={},n=new Set){const r=[],i=e.length;for(let s=0;s<i;s++){const o=e[s];if(kv.test(o.type))r.push(o);else{const c=xi(JP,o.type);if(!(c!=null&&c.type))throw new OP({abiParameter:o});const{array:u,type:l}=c;if(l in t){if(n.has(l))throw new NP({type:l});r.push({...o,type:`tuple${u??""}`,components:Nv(t[l],t,new Set([...n,l]))})}else if(Bv(l))r.push(o);else throw new kP({type:l})}}return r}function op(e){const t=sp(e),n=[],r=e.length;for(let i=0;i<r;i++){const s=e[i];cd(s)||n.push(ip(s,t))}return n}function Lv(e){let t;if(typeof e=="string")t=ip(e);else{const n=sp(e),r=e.length;for(let i=0;i<r;i++){const s=e[i];if(!cd(s)){t=ip(s,n);break}}}if(!t)throw new SP({signature:e});return t}function jv(e){const t=[];if(typeof e=="string"){const n=nr(e),r=n.length;for(let i=0;i<r;i++)t.push(Si(n[i],{modifiers:Mv}))}else{const n=sp(e),r=e.length;for(let i=0;i<r;i++){const s=e[i];if(cd(s))continue;const o=nr(s),a=o.length;for(let c=0;c<a;c++)t.push(Si(o[c],{modifiers:Mv,structs:n}))}}if(t.length===0)throw new IP({params:e});return t}function ZP(e){let t=!0,n="",r=0,i="",s=!1;for(let o=0;o<e.length;o++){const a=e[o];if(["(",")",","].includes(a)&&(t=!0),a==="("&&r++,a===")"&&r--,!!t){if(r===0){if(a===" "&&["event","function",""].includes(i))i="";else if(i+=a,a===")"){s=!0;break}continue}if(a===" "){e[o-1]!==","&&n!==","&&n!==",("&&(n="",t=!1);continue}i+=a,n+=a}}if(!s)throw new ee("Unable to normalize signature.");return i}const YP=e=>{const t=typeof e=="string"?e:ad(e);return ZP(t)};function $v(e){return cP(YP(e))}const ud=$v,Wc=e=>_i($v(e),0,4);function Hs(e){const{abi:t,args:n=[],name:r}=e,i=pn(r,{strict:!1}),s=t.filter(a=>i?a.type==="function"?Wc(a)===r:a.type==="event"?ud(a)===r:!1:"name"in a&&a.name===r);if(s.length===0)return;if(s.length===1)return s[0];let o;for(const a of s){if(!("inputs"in a))continue;if(!n||n.length===0){if(!a.inputs||a.inputs.length===0)return a;continue}if(!a.inputs||a.inputs.length===0||a.inputs.length!==n.length)continue;if(n.every((u,l)=>{const d="inputs"in a&&a.inputs[l];return d?ap(u,d):!1})){if(o&&"inputs"in o&&o.inputs){const u=Fv(a.inputs,o.inputs,n);if(u)throw new ZI({abiItem:a,type:u[0]},{abiItem:o,type:u[1]})}o=a}}return o||s[0]}function ap(e,t){const n=typeof e,r=t.type;switch(r){case"address":return Pt(e,{strict:!1});case"bool":return n==="boolean";case"function":return n==="string";case"string":return n==="string";default:return r==="tuple"&&"components"in t?Object.values(t.components).every((i,s)=>n==="object"&&ap(Object.values(e)[s],i)):/^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(r)?n==="number"||n==="bigint":/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/.test(r)?n==="string"||e instanceof Uint8Array:/[a-z]+[1-9]{0,3}(\[[0-9]{0,}\])+$/.test(r)?Array.isArray(e)&&e.every(i=>ap(i,{...t,type:r.replace(/(\[[0-9]{0,}\])$/,"")})):!1}}function Fv(e,t,n){for(const r in e){const i=e[r],s=t[r];if(i.type==="tuple"&&s.type==="tuple"&&"components"in i&&"components"in s)return Fv(i.components,s.components,n[r]);const o=[i.type,s.type];if(o.includes("address")&&o.includes("bytes20")?!0:o.includes("address")&&o.includes("string")?Pt(n[r],{strict:!1}):o.includes("address")&&o.includes("bytes")?Pt(n[r],{strict:!1}):!1)return o}}const cp="/docs/contract/decodeFunctionResult";function ts(e){const{abi:t,args:n,functionName:r,data:i}=e;let s=t[0];if(r){const a=Hs({abi:t,args:n,name:r});if(!a)throw new Xo(r,{docsPath:cp});s=a}if(s.type!=="function")throw new Xo(void 0,{docsPath:cp});if(!s.outputs)throw new Vw(s.name,{docsPath:cp});const o=Us(s.outputs,i);if(o&&o.length>1)return o;if(o&&o.length===1)return o[0]}const Dv="/docs/contract/encodeFunctionData";function QP(e){const{abi:t,args:n,functionName:r}=e;let i=t[0];if(r){const s=Hs({abi:t,args:n,name:r});if(!s)throw new Xo(r,{docsPath:Dv});i=s}if(i.type!=="function")throw new Xo(void 0,{docsPath:Dv});return{abi:[i],functionName:Wc(kr(i))}}function jt(e){const{args:t}=e,{abi:n,functionName:r}=(()=>{var a;return e.abi.length===1&&((a=e.functionName)!=null&&a.startsWith("0x"))?e:QP(e)})(),i=n[0],s=r,o="inputs"in i&&i.inputs?zn(i.inputs,t??[]):void 0;return Hn([s,o??"0x"])}class up extends ee{constructor({blockNumber:t,chain:n,contract:r}){super(`Chain "${n.name}" does not support contract "${r.name}".`,{metaMessages:["This could be due to any of the following:",...t&&r.blockCreated&&r.blockCreated>t?[`- The contract "${r.name}" was not deployed until block ${r.blockCreated} (current block ${t}).`]:[`- The chain does not have the contract "${r.name}" configured.`]],name:"ChainDoesNotSupportContract"})}}class XP extends ee{constructor({chain:t,currentChainId:n}){super(`The current chain of the wallet (id: ${n}) does not match the target chain for the transaction (id: ${t.id} – ${t.name}).`,{metaMessages:[`Current Chain ID: ${n}`,`Expected Chain ID: ${t.id} – ${t.name}`],name:"ChainMismatchError"})}}class eR extends ee{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(`
60
+ `),{name:"ChainNotFoundError"})}}class Uv extends ee{constructor(){super("No chain was provided to the Client.",{name:"ClientChainNotConfiguredError"})}}class ld extends ee{constructor({chainId:t}){super(typeof t=="number"?`Chain ID "${t}" is invalid.`:"Chain ID is invalid.",{name:"InvalidChainIdError"})}}function da({blockNumber:e,chain:t,contract:n}){var i;const r=(i=t==null?void 0:t.contracts)==null?void 0:i[n];if(!r)throw new up({chain:t,contract:{name:n}});if(e&&r.blockCreated&&r.blockCreated>e)throw new up({blockNumber:e,chain:t,contract:{name:n,blockCreated:r.blockCreated}});return r.address}function Ut(e){return typeof e=="string"?{address:e,type:"json-rpc"}:e}const tR={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."},Hv={inputs:[{name:"message",type:"string"}],name:"Error",type:"error"},nR={inputs:[{name:"reason",type:"uint256"}],name:"Panic",type:"error"};function lp(e){const{abi:t,data:n,cause:r}=e,i=_i(n,0,4);if(i==="0x")throw new Uc({cause:r});const o=[...t||[],Hv,nR].find(a=>a.type==="error"&&i===Wc(kr(a)));if(!o)throw new Gw(i,{docsPath:"/docs/contract/decodeErrorResult",cause:r});return{abiItem:o,args:"inputs"in o&&o.inputs&&o.inputs.length>0?Us(o.inputs,_i(n,4)):void 0,errorName:o.name}}const Ht=(e,t,n)=>JSON.stringify(e,(r,i)=>typeof i=="bigint"?i.toString():i,n);function zv({abiItem:e,args:t,includeFunctionName:n=!0,includeName:r=!1}){if("name"in e&&"inputs"in e&&e.inputs)return`${n?e.name:""}(${e.inputs.map((i,s)=>`${r&&i.name?`${i.name}: `:""}${typeof t[s]=="object"?Ht(t[s]):t[s]}`).join(", ")})`}const Wv={gwei:9,wei:18},rR={ether:-9,wei:9},iR={ether:-18,gwei:-9};function fa(e,t){let n=e.toString();const r=n.startsWith("-");r&&(n=n.slice(1)),n=n.padStart(t,"0");let[i,s]=[n.slice(0,n.length-t),n.slice(n.length-t)];return s=s.replace(/(0+)$/,""),`${r?"-":""}${i||"0"}${s?`.${s}`:""}`}function dd(e,t="wei"){return fa(e,Wv[t])}function xn(e,t="wei"){return fa(e,rR[t])}class sR extends ee{constructor({address:t}){super(`State for account "${t}" is set multiple times.`,{name:"AccountStateConflictError"})}}class oR extends ee{constructor(){super("state and stateDiff are set on the same account.",{name:"StateAssignmentConflictError"})}}function Gv(e){return e.reduce((t,{slot:n,value:r})=>`${t} ${n}: ${r}
61
+ `,"")}function aR(e){return e.reduce((t,{address:n,...r})=>{let i=`${t} ${n}:
62
+ `;return r.nonce&&(i+=` nonce: ${r.nonce}
63
+ `),r.balance&&(i+=` balance: ${r.balance}
64
+ `),r.code&&(i+=` code: ${r.code}
65
+ `),r.state&&(i+=` state:
66
+ `,i+=Gv(r.state)),r.stateDiff&&(i+=` stateDiff:
67
+ `,i+=Gv(r.stateDiff)),i},` State Override:
68
+ `).slice(0,-1)}function ha(e){const t=Object.entries(e).map(([r,i])=>i===void 0||i===!1?null:[r,i]).filter(Boolean),n=t.reduce((r,[i])=>Math.max(r,i.length),0);return t.map(([r,i])=>` ${`${r}:`.padEnd(n+1)} ${i}`).join(`
69
+ `)}class cR extends ee{constructor({v:t}){super(`Invalid \`v\` value "${t}". Expected 27 or 28.`,{name:"InvalidLegacyVError"})}}class uR extends ee{constructor({transaction:t}){super("Cannot infer a transaction type from provided transaction.",{metaMessages:["Provided Transaction:","{",ha(t),"}","","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 lR extends ee{constructor({storageKey:t}){super(`Size for storage key "${t}" is invalid. Expected 32 bytes. Got ${Math.floor((t.length-2)/2)} bytes.`,{name:"InvalidStorageKeySizeError"})}}class dR extends ee{constructor(t,{account:n,docsPath:r,chain:i,data:s,gas:o,gasPrice:a,maxFeePerGas:c,maxPriorityFeePerGas:u,nonce:l,to:d,value:f}){var m;const h=ha({chain:i&&`${i==null?void 0:i.name} (id: ${i==null?void 0:i.id})`,from:n==null?void 0:n.address,to:d,value:typeof f<"u"&&`${dd(f)} ${((m=i==null?void 0:i.nativeCurrency)==null?void 0:m.symbol)||"ETH"}`,data:s,gas:o,gasPrice:typeof a<"u"&&`${xn(a)} gwei`,maxFeePerGas:typeof c<"u"&&`${xn(c)} gwei`,maxPriorityFeePerGas:typeof u<"u"&&`${xn(u)} gwei`,nonce:l});super(t.shortMessage,{cause:t,docsPath:r,metaMessages:[...t.metaMessages?[...t.metaMessages," "]:[],"Request Arguments:",h].filter(Boolean),name:"TransactionExecutionError"}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.cause=t}}class qv extends ee{constructor({blockHash:t,blockNumber:n,blockTag:r,hash:i,index:s}){let o="Transaction";r&&s!==void 0&&(o=`Transaction at block time "${r}" at index "${s}"`),t&&s!==void 0&&(o=`Transaction at block hash "${t}" at index "${s}"`),n&&s!==void 0&&(o=`Transaction at block number "${n}" at index "${s}"`),i&&(o=`Transaction with hash "${i}"`),super(`${o} could not be found.`,{name:"TransactionNotFoundError"})}}class Vv extends ee{constructor({hash:t}){super(`Transaction receipt with hash "${t}" could not be found. The Transaction may not be processed on a block yet.`,{name:"TransactionReceiptNotFoundError"})}}class fR extends ee{constructor({receipt:t}){super(`Transaction with hash "${t.transactionHash}" reverted.`,{metaMessages:['The receipt marked the transaction as "reverted". This could mean that the function on the contract you are trying to call threw an error.'," ","You can attempt to extract the revert reason by:","- calling the `simulateContract` or `simulateCalls` Action with the `abi` and `functionName` of the contract","- using the `call` Action with raw `data`"],name:"TransactionReceiptRevertedError"}),Object.defineProperty(this,"receipt",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.receipt=t}}class hR extends ee{constructor({hash:t}){super(`Timed out while waiting for transaction with hash "${t}" to be confirmed.`,{name:"WaitForTransactionReceiptTimeoutError"})}}const pR=e=>e,Gc=e=>e;class Kv extends ee{constructor(t,{account:n,docsPath:r,chain:i,data:s,gas:o,gasPrice:a,maxFeePerGas:c,maxPriorityFeePerGas:u,nonce:l,to:d,value:f,stateOverride:h}){var w;const m=n?Ut(n):void 0;let y=ha({from:m==null?void 0:m.address,to:d,value:typeof f<"u"&&`${dd(f)} ${((w=i==null?void 0:i.nativeCurrency)==null?void 0:w.symbol)||"ETH"}`,data:s,gas:o,gasPrice:typeof a<"u"&&`${xn(a)} gwei`,maxFeePerGas:typeof c<"u"&&`${xn(c)} gwei`,maxPriorityFeePerGas:typeof u<"u"&&`${xn(u)} gwei`,nonce:l});h&&(y+=`
70
+ ${aR(h)}`),super(t.shortMessage,{cause:t,docsPath:r,metaMessages:[...t.metaMessages?[...t.metaMessages," "]:[],"Raw Call Arguments:",y].filter(Boolean),name:"CallExecutionError"}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.cause=t}}class fd extends ee{constructor(t,{abi:n,args:r,contractAddress:i,docsPath:s,functionName:o,sender:a}){const c=Hs({abi:n,args:r,name:o}),u=c?zv({abiItem:c,args:r,includeFunctionName:!1,includeName:!1}):void 0,l=c?kr(c,{includeName:!0}):void 0,d=ha({address:i&&pR(i),function:l,args:u&&u!=="()"&&`${[...Array((o==null?void 0:o.length)??0).keys()].map(()=>" ").join("")}${u}`,sender:a});super(t.shortMessage||`An unknown error occurred while executing the contract function "${o}".`,{cause:t,docsPath:s,metaMessages:[...t.metaMessages?[...t.metaMessages," "]:[],d&&"Contract Call:",d].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=n,this.args=r,this.cause=t,this.contractAddress=i,this.functionName=o,this.sender=a}}class hd extends ee{constructor({abi:t,data:n,functionName:r,message:i,cause:s}){let o,a,c,u;if(n&&n!=="0x")try{a=lp({abi:t,data:n,cause:s});const{abiItem:d,errorName:f,args:h}=a;if(f==="Error")u=h[0];else if(f==="Panic"){const[m]=h;u=tR[m]}else{const m=d?kr(d,{includeName:!0}):void 0,y=d&&h?zv({abiItem:d,args:h,includeFunctionName:!1,includeName:!1}):void 0;c=[m?`Error: ${m}`:"",y&&y!=="()"?` ${[...Array((f==null?void 0:f.length)??0).keys()].map(()=>" ").join("")}${y}`:""]}}catch(d){o=d}else i&&(u=i);let l;o instanceof Gw&&(l=o.signature,c=[`Unable to decode signature "${l}" 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://4byte.sourcify.dev/?q=${l}.`]),super(u&&u!=="execution reverted"||l?[`The contract function "${r}" reverted with the following ${l?"signature":"reason"}:`,u||l].join(`
71
+ `):`The contract function "${r}" reverted.`,{cause:o??s,metaMessages:c,name:"ContractFunctionRevertedError"}),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"raw",{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=a,this.raw=n,this.reason=u,this.signature=l}}class Jv extends ee{constructor({functionName:t,cause:n}){super(`The contract function "${t}" returned no data ("0x").`,{metaMessages:["This could be due to any of the following:",` - The contract does not have the function "${t}",`," - The parameters passed to the contract function may be invalid, or"," - The address is not a contract."],name:"ContractFunctionZeroDataError",cause:n})}}class mR extends ee{constructor({factory:t}){super(`Deployment for counterfactual contract call failed${t?` for factory "${t}".`:""}`,{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 pd extends ee{constructor({data:t,message:n}){super(n||"",{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=t}}function dp(e){var n,r,i,s,o,a;if(!(e instanceof ee))return!1;const t=e.walk(c=>c instanceof hd);return t instanceof hd?((n=t.data)==null?void 0:n.errorName)==="HttpError"||((r=t.data)==null?void 0:r.errorName)==="ResolverError"||((i=t.data)==null?void 0:i.errorName)==="ResolverNotContract"||((s=t.data)==null?void 0:s.errorName)==="ResolverNotFound"||((o=t.data)==null?void 0:o.errorName)==="ReverseAddressMismatch"||((a=t.data)==null?void 0:a.errorName)==="UnsupportedResolverProfile":!1}function fp(e){const{abi:t,data:n}=e,r=_i(n,0,4),i=t.find(s=>s.type==="function"&&r===Wc(kr(s)));if(!i)throw new JI(r,{docsPath:"/docs/contract/decodeFunctionData"});return{functionName:i.name,args:"inputs"in i&&i.inputs&&i.inputs.length>0?Us(i.inputs,_i(n,4)):void 0}}const hp="/docs/contract/encodeErrorResult";function Zv(e){const{abi:t,errorName:n,args:r}=e;let i=t[0];if(n){const c=Hs({abi:t,args:r,name:n});if(!c)throw new Ww(n,{docsPath:hp});i=c}if(i.type!=="error")throw new Ww(void 0,{docsPath:hp});const s=kr(i),o=Wc(s);let a="0x";if(r&&r.length>0){if(!i.inputs)throw new qI(i.name,{docsPath:hp});a=zn(i.inputs,r)}return Hn([o,a])}const pp="/docs/contract/encodeFunctionResult";function gR(e){const{abi:t,functionName:n,result:r}=e;let i=t[0];if(n){const o=Hs({abi:t,name:n});if(!o)throw new Xo(n,{docsPath:pp});i=o}if(i.type!=="function")throw new Xo(void 0,{docsPath:pp});if(!i.outputs)throw new Vw(i.name,{docsPath:pp});const s=(()=>{if(i.outputs.length===0)return[];if(i.outputs.length===1)return[r];if(Array.isArray(r))return r;throw new Jw(r)})();return zn(i.outputs,s)}const qc="x-batch-gateway:true";async function Yv(e){const{data:t,ccipRequest:n}=e,{args:[r]}=fp({abi:F0,data:t}),i=[],s=[];return await Promise.all(r.map(async(o,a)=>{try{s[a]=o.urls.includes(qc)?await Yv({data:o.data,ccipRequest:n}):await n(o),i[a]=!1}catch(c){i[a]=!0,s[a]=yR(c)}})),gR({abi:F0,functionName:"query",result:[i,s]})}function yR(e){return e.name==="HttpRequestError"&&e.status?Zv({abi:F0,errorName:"HttpError",args:[e.status,e.shortMessage]}):Zv({abi:[Hv],errorName:"Error",args:["shortMessage"in e?e.shortMessage:e.message]})}function Qv(e){if(e.length!==66||e.indexOf("[")!==0||e.indexOf("]")!==65)return null;const t=`0x${e.slice(1,65)}`;return pn(t)?t:null}function mp(e){let t=new Uint8Array(32).fill(0);if(!e)return Jt(t);const n=e.split(".");for(let r=n.length-1;r>=0;r-=1){const i=Qv(n[r]),s=i?ea(i):xt(gi(n[r]),"bytes");t=xt(Zt([t,s]),"bytes")}return Jt(t)}function bR(e){return`[${e.slice(2)}]`}function wR(e){const t=new Uint8Array(32).fill(0);return e?Qv(e)||xt(gi(e)):Jt(t)}function gp(e){const t=e.replace(/^\.|\.$/gm,"");if(t.length===0)return new Uint8Array(1);const n=new Uint8Array(gi(t).byteLength+2);let r=0;const i=t.split(".");for(let s=0;s<i.length;s++){let o=gi(i[s]);o.byteLength>255&&(o=gi(bR(wR(i[s])))),n[r]=o.length,n.set(o,r+1),r+=o.length+1}return n.byteLength!==r+1?n.slice(0,r+1):n}function ve(e,t,n){const r=e[t.name];if(typeof r=="function")return r;const i=e[n];return typeof i=="function"?i:s=>t(e,s)}class zs extends ee{constructor({body:t,cause:n,details:r,headers:i,status:s,url:o}){super("HTTP request failed.",{cause:n,details:r,metaMessages:[s&&`Status: ${s}`,`URL: ${Gc(o)}`,t&&`Request body: ${Ht(t)}`].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=t,this.headers=i,this.status=s,this.url=o}}class yp extends ee{constructor({body:t,error:n,url:r}){super("RPC Request failed.",{cause:n,details:n.message,metaMessages:[`URL: ${Gc(r)}`,`Request body: ${Ht(t)}`],name:"RpcRequestError"}),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"url",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.code=n.code,this.data=n.data,this.url=r}}class Xv extends ee{constructor({body:t,url:n}){super("The request took too long to respond.",{details:"The request timed out.",metaMessages:[`URL: ${Gc(n)}`,`Request body: ${Ht(t)}`],name:"TimeoutError"}),Object.defineProperty(this,"url",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.url=n}}const vR=-1;class Gn extends ee{constructor(t,{code:n,docsPath:r,metaMessages:i,name:s,shortMessage:o}){super(o,{cause:t,docsPath:r,metaMessages:i||(t==null?void 0:t.metaMessages),name:s||"RpcError"}),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.name=s||t.name,this.code=t instanceof yp?t.code:n??vR}}class qn extends Gn{constructor(t,n){super(t,n),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.data=n.data}}class Vc extends Gn{constructor(t){super(t,{code:Vc.code,name:"ParseRpcError",shortMessage:"Invalid JSON was received by the server. An error occurred on the server while parsing the JSON text."})}}Object.defineProperty(Vc,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32700});class Kc extends Gn{constructor(t){super(t,{code:Kc.code,name:"InvalidRequestRpcError",shortMessage:"JSON is not a valid request object."})}}Object.defineProperty(Kc,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32600});class Jc extends Gn{constructor(t,{method:n}={}){super(t,{code:Jc.code,name:"MethodNotFoundRpcError",shortMessage:`The method${n?` "${n}"`:""} does not exist / is not available.`})}}Object.defineProperty(Jc,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32601});class Zc extends Gn{constructor(t){super(t,{code:Zc.code,name:"InvalidParamsRpcError",shortMessage:["Invalid parameters were provided to the RPC method.","Double check you have provided the correct parameters."].join(`
72
+ `)})}}Object.defineProperty(Zc,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32602});class Ws extends Gn{constructor(t){super(t,{code:Ws.code,name:"InternalRpcError",shortMessage:"An internal error was received."})}}Object.defineProperty(Ws,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32603});class ns extends Gn{constructor(t){super(t,{code:ns.code,name:"InvalidInputRpcError",shortMessage:["Missing or invalid parameters.","Double check you have provided the correct parameters."].join(`
73
+ `)})}}Object.defineProperty(ns,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32e3});class Yc extends Gn{constructor(t){super(t,{code:Yc.code,name:"ResourceNotFoundRpcError",shortMessage:"Requested resource not found."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ResourceNotFoundRpcError"})}}Object.defineProperty(Yc,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32001});class rs extends Gn{constructor(t){super(t,{code:rs.code,name:"ResourceUnavailableRpcError",shortMessage:"Requested resource not available."})}}Object.defineProperty(rs,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32002});class Qc extends Gn{constructor(t){super(t,{code:Qc.code,name:"TransactionRejectedRpcError",shortMessage:"Transaction creation failed."})}}Object.defineProperty(Qc,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32003});class Gs extends Gn{constructor(t,{method:n}={}){super(t,{code:Gs.code,name:"MethodNotSupportedRpcError",shortMessage:`Method${n?` "${n}"`:""} is not supported.`})}}Object.defineProperty(Gs,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32004});class pa extends Gn{constructor(t){super(t,{code:pa.code,name:"LimitExceededRpcError",shortMessage:"Request exceeds defined limit."})}}Object.defineProperty(pa,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32005});class Xc extends Gn{constructor(t){super(t,{code:Xc.code,name:"JsonRpcVersionUnsupportedError",shortMessage:"Version of JSON-RPC protocol is not supported."})}}Object.defineProperty(Xc,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32006});class zt extends qn{constructor(t){super(t,{code:zt.code,name:"UserRejectedRequestError",shortMessage:"User rejected the request."})}}Object.defineProperty(zt,"code",{enumerable:!0,configurable:!0,writable:!0,value:4001});class eu extends qn{constructor(t){super(t,{code:eu.code,name:"UnauthorizedProviderError",shortMessage:"The requested method and/or account has not been authorized by the user."})}}Object.defineProperty(eu,"code",{enumerable:!0,configurable:!0,writable:!0,value:4100});class tu extends qn{constructor(t,{method:n}={}){super(t,{code:tu.code,name:"UnsupportedProviderMethodError",shortMessage:`The Provider does not support the requested method${n?` " ${n}"`:""}.`})}}Object.defineProperty(tu,"code",{enumerable:!0,configurable:!0,writable:!0,value:4200});class nu extends qn{constructor(t){super(t,{code:nu.code,name:"ProviderDisconnectedError",shortMessage:"The Provider is disconnected from all chains."})}}Object.defineProperty(nu,"code",{enumerable:!0,configurable:!0,writable:!0,value:4900});class ru extends qn{constructor(t){super(t,{code:ru.code,name:"ChainDisconnectedError",shortMessage:"The Provider is not connected to the requested chain."})}}Object.defineProperty(ru,"code",{enumerable:!0,configurable:!0,writable:!0,value:4901});class Ar extends qn{constructor(t){super(t,{code:Ar.code,name:"SwitchChainError",shortMessage:"An error occurred when attempting to switch chain."})}}Object.defineProperty(Ar,"code",{enumerable:!0,configurable:!0,writable:!0,value:4902});class iu extends qn{constructor(t){super(t,{code:iu.code,name:"UnsupportedNonOptionalCapabilityError",shortMessage:"This Wallet does not support a capability that was not marked as optional."})}}Object.defineProperty(iu,"code",{enumerable:!0,configurable:!0,writable:!0,value:5700});class su extends qn{constructor(t){super(t,{code:su.code,name:"UnsupportedChainIdError",shortMessage:"This Wallet does not support the requested chain ID."})}}Object.defineProperty(su,"code",{enumerable:!0,configurable:!0,writable:!0,value:5710});class ou extends qn{constructor(t){super(t,{code:ou.code,name:"DuplicateIdError",shortMessage:"There is already a bundle submitted with this ID."})}}Object.defineProperty(ou,"code",{enumerable:!0,configurable:!0,writable:!0,value:5720});class au extends qn{constructor(t){super(t,{code:au.code,name:"UnknownBundleIdError",shortMessage:"This bundle id is unknown / has not been submitted"})}}Object.defineProperty(au,"code",{enumerable:!0,configurable:!0,writable:!0,value:5730});class cu extends qn{constructor(t){super(t,{code:cu.code,name:"BundleTooLargeError",shortMessage:"The call bundle is too large for the Wallet to process."})}}Object.defineProperty(cu,"code",{enumerable:!0,configurable:!0,writable:!0,value:5740});class uu extends qn{constructor(t){super(t,{code:uu.code,name:"AtomicReadyWalletRejectedUpgradeError",shortMessage:"The Wallet can support atomicity after an upgrade, but the user rejected the upgrade."})}}Object.defineProperty(uu,"code",{enumerable:!0,configurable:!0,writable:!0,value:5750});class lu extends qn{constructor(t){super(t,{code:lu.code,name:"AtomicityNotSupportedError",shortMessage:"The wallet does not support atomic execution but the request requires it."})}}Object.defineProperty(lu,"code",{enumerable:!0,configurable:!0,writable:!0,value:5760});class du extends qn{constructor(t){super(t,{code:du.code,name:"WalletConnectSessionSettlementError",shortMessage:"WalletConnect session settlement failed."})}}Object.defineProperty(du,"code",{enumerable:!0,configurable:!0,writable:!0,value:7e3});class _R extends Gn{constructor(t){super(t,{name:"UnknownRpcError",shortMessage:"An unknown RPC error occurred."})}}const ER=3;function qs(e,{abi:t,address:n,args:r,docsPath:i,functionName:s,sender:o}){const a=e instanceof pd?e:e instanceof ee?e.walk(m=>"data"in m)||e.walk():{},{code:c,data:u,details:l,message:d,shortMessage:f}=a,h=e instanceof Uc?new Jv({functionName:s,cause:e}):[ER,Ws.code].includes(c)&&(u||l||d||f)||c===ns.code&&l==="execution reverted"&&u?new hd({abi:t,data:typeof u=="object"?u.data:u,functionName:s,message:a instanceof yp?l:f??d,cause:e}):e;return new fd(h,{abi:t,args:r,contractAddress:n,docsPath:i,functionName:s,sender:o})}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const bp=BigInt(0),wp=BigInt(1);function fu(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array"}function vp(e){if(!fu(e))throw new Error("Uint8Array expected")}function hu(e,t){if(typeof t!="boolean")throw new Error(e+" boolean expected, got "+t)}function md(e){const t=e.toString(16);return t.length&1?"0"+t:t}function e2(e){if(typeof e!="string")throw new Error("hex string expected, got "+typeof e);return e===""?bp:BigInt("0x"+e)}const t2=typeof Uint8Array.from([]).toHex=="function"&&typeof Uint8Array.fromHex=="function",xR=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function pu(e){if(vp(e),t2)return e.toHex();let t="";for(let n=0;n<e.length;n++)t+=xR[e[n]];return t}const ki={_0:48,_9:57,A:65,F:70,a:97,f:102};function n2(e){if(e>=ki._0&&e<=ki._9)return e-ki._0;if(e>=ki.A&&e<=ki.F)return e-(ki.A-10);if(e>=ki.a&&e<=ki.f)return e-(ki.a-10)}function gd(e){if(typeof e!="string")throw new Error("hex string expected, got "+typeof e);if(t2)return Uint8Array.fromHex(e);const t=e.length,n=t/2;if(t%2)throw new Error("hex string expected, got unpadded hex of length "+t);const r=new Uint8Array(n);for(let i=0,s=0;i<n;i++,s+=2){const o=n2(e.charCodeAt(s)),a=n2(e.charCodeAt(s+1));if(o===void 0||a===void 0){const c=e[s]+e[s+1];throw new Error('hex string expected, got non-hex character "'+c+'" at index '+s)}r[i]=o*16+a}return r}function Vs(e){return e2(pu(e))}function r2(e){return vp(e),e2(pu(Uint8Array.from(e).reverse()))}function mu(e,t){return gd(e.toString(16).padStart(t*2,"0"))}function i2(e,t){return mu(e,t).reverse()}function dr(e,t,n){let r;if(typeof t=="string")try{r=gd(t)}catch(s){throw new Error(e+" must be hex string or Uint8Array, cause: "+s)}else if(fu(t))r=Uint8Array.from(t);else throw new Error(e+" must be hex string or Uint8Array");const i=r.length;if(typeof n=="number"&&i!==n)throw new Error(e+" of length "+n+" expected, got "+i);return r}function yd(...e){let t=0;for(let r=0;r<e.length;r++){const i=e[r];vp(i),t+=i.length}const n=new Uint8Array(t);for(let r=0,i=0;r<e.length;r++){const s=e[r];n.set(s,i),i+=s.length}return n}const _p=e=>typeof e=="bigint"&&bp<=e;function Ep(e,t,n){return _p(e)&&_p(t)&&_p(n)&&t<=e&&e<n}function ma(e,t,n,r){if(!Ep(t,n,r))throw new Error("expected valid "+e+": "+n+" <= n < "+r+", got "+t)}function SR(e){let t;for(t=0;e>bp;e>>=wp,t+=1);return t}const bd=e=>(wp<<BigInt(e))-wp,xp=e=>new Uint8Array(e),s2=e=>Uint8Array.from(e);function kR(e,t,n){if(typeof e!="number"||e<2)throw new Error("hashLen must be a number");if(typeof t!="number"||t<2)throw new Error("qByteLen must be a number");if(typeof n!="function")throw new Error("hmacFn must be a function");let r=xp(e),i=xp(e),s=0;const o=()=>{r.fill(1),i.fill(0),s=0},a=(...d)=>n(i,r,...d),c=(d=xp(0))=>{i=a(s2([0]),d),r=a(),d.length!==0&&(i=a(s2([1]),d),r=a())},u=()=>{if(s++>=1e3)throw new Error("drbg: tried 1000 values");let d=0;const f=[];for(;d<t;){r=a();const h=r.slice();f.push(h),d+=r.length}return yd(...f)};return(d,f)=>{o(),c(d);let h;for(;!(h=f(u()));)c();return o(),h}}const AR={bigint:e=>typeof e=="bigint",function:e=>typeof e=="function",boolean:e=>typeof e=="boolean",string:e=>typeof e=="string",stringOrUint8Array:e=>typeof e=="string"||fu(e),isSafeInteger:e=>Number.isSafeInteger(e),array:e=>Array.isArray(e),field:(e,t)=>t.Fp.isValid(e),hash:e=>typeof e=="function"&&Number.isSafeInteger(e.outputLen)};function wd(e,t,n={}){const r=(i,s,o)=>{const a=AR[s];if(typeof a!="function")throw new Error("invalid validator function");const c=e[i];if(!(o&&c===void 0)&&!a(c,e))throw new Error("param "+String(i)+" is invalid. Expected "+s+", got "+c)};for(const[i,s]of Object.entries(t))r(i,s,!1);for(const[i,s]of Object.entries(n))r(i,s,!0);return e}function o2(e){const t=new WeakMap;return(n,...r)=>{const i=t.get(n);if(i!==void 0)return i;const s=e(n,...r);return t.set(n,s),s}}const IR="0.1.1";function CR(){return IR}let ze=class Zi extends Error{static setStaticOptions(t){Zi.prototype.docsOrigin=t.docsOrigin,Zi.prototype.showVersion=t.showVersion,Zi.prototype.version=t.version}constructor(t,n={}){const r=(()=>{var l;if(n.cause instanceof Zi){if(n.cause.details)return n.cause.details;if(n.cause.shortMessage)return n.cause.shortMessage}return n.cause&&"details"in n.cause&&typeof n.cause.details=="string"?n.cause.details:(l=n.cause)!=null&&l.message?n.cause.message:n.details})(),i=n.cause instanceof Zi&&n.cause.docsPath||n.docsPath,s=n.docsOrigin??Zi.prototype.docsOrigin,o=`${s}${i??""}`,a=!!(n.version??Zi.prototype.showVersion),c=n.version??Zi.prototype.version,u=[t||"An error occurred.",...n.metaMessages?["",...n.metaMessages]:[],...r||i||a?["",r?`Details: ${r}`:void 0,i?`See: ${o}`:void 0,a?`Version: ${c}`:void 0]:[]].filter(l=>typeof l=="string").join(`
74
+ `);super(u,n.cause?{cause:n.cause}:void 0),Object.defineProperty(this,"details",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docs",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docsOrigin",{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,"shortMessage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"showVersion",{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,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"BaseError"}),this.cause=n.cause,this.details=r,this.docs=o,this.docsOrigin=s,this.docsPath=i,this.shortMessage=t,this.showVersion=a,this.version=c}walk(t){return a2(this,t)}};Object.defineProperty(ze,"defaultStaticOptions",{enumerable:!0,configurable:!0,writable:!0,value:{docsOrigin:"https://oxlib.sh",showVersion:!1,version:`ox@${CR()}`}}),ze.setStaticOptions(ze.defaultStaticOptions);function a2(e,t){return t!=null&&t(e)?e:e&&typeof e=="object"&&"cause"in e&&e.cause?a2(e.cause,t):t?null:e}function gu(e,t){if(ga(e)>t)throw new GR({givenSize:ga(e),maxSize:t})}const Ai={zero:48,nine:57,A:65,F:70,a:97,f:102};function c2(e){if(e>=Ai.zero&&e<=Ai.nine)return e-Ai.zero;if(e>=Ai.A&&e<=Ai.F)return e-(Ai.A-10);if(e>=Ai.a&&e<=Ai.f)return e-(Ai.a-10)}function PR(e,t={}){const{dir:n,size:r=32}=t;if(r===0)return e;if(e.length>r)throw new qR({size:e.length,targetSize:r,type:"Bytes"});const i=new Uint8Array(r);for(let s=0;s<r;s++){const o=n==="right";i[o?s:r-s-1]=e[o?s:e.length-s-1]}return i}function u2(e,t={}){const{dir:n="left"}=t;let r=e,i=0;for(let s=0;s<r.length-1&&r[n==="left"?s:r.length-s-1].toString()==="0";s++)i++;return r=n==="left"?r.slice(i):r.slice(0,r.length-i),r}function vd(e,t){if(rr(e)>t)throw new QR({givenSize:rr(e),maxSize:t})}function RR(e,t){if(typeof t=="number"&&t>0&&t>rr(e)-1)throw new v2({offset:t,position:"start",size:rr(e)})}function TR(e,t,n){if(typeof t=="number"&&typeof n=="number"&&rr(e)!==n-t)throw new v2({offset:n,position:"end",size:rr(e)})}function l2(e,t={}){const{dir:n,size:r=32}=t;if(r===0)return e;const i=e.replace("0x","");if(i.length>r*2)throw new XR({size:Math.ceil(i.length/2),targetSize:r,type:"Hex"});return`0x${i[n==="right"?"padEnd":"padStart"](r*2,"0")}`}const OR="#__bigint";function d2(e,t,n){return JSON.stringify(e,(r,i)=>typeof i=="bigint"?i.toString()+OR:i,n)}const MR=new TextDecoder,BR=new TextEncoder;function NR(e){return e instanceof Uint8Array?e:typeof e=="string"?f2(e):LR(e)}function LR(e){return e instanceof Uint8Array?e:new Uint8Array(e)}function f2(e,t={}){const{size:n}=t;let r=e;n&&(vd(e,n),r=Js(e,n));let i=r.slice(2);i.length%2&&(i=`0${i}`);const s=i.length/2,o=new Uint8Array(s);for(let a=0,c=0;a<s;a++){const u=c2(i.charCodeAt(c++)),l=c2(i.charCodeAt(c++));if(u===void 0||l===void 0)throw new ze(`Invalid byte sequence ("${i[c-2]}${i[c-1]}" in "${i}").`);o[a]=u<<4|l}return o}function jR(e,t={}){const{size:n}=t,r=BR.encode(e);return typeof n=="number"?(gu(r,n),$R(r,n)):r}function $R(e,t){return PR(e,{dir:"right",size:t})}function ga(e){return e.length}function FR(e,t,n,r={}){const{strict:i}=r;return e.slice(t,n)}function DR(e,t={}){const{size:n}=t;typeof n<"u"&&gu(e,n);const r=Cr(e,t);return m2(r,t)}function UR(e,t={}){const{size:n}=t;let r=e;if(typeof n<"u"&&(gu(r,n),r=h2(r)),r.length>1||r[0]>1)throw new WR(r);return!!r[0]}function Ii(e,t={}){const{size:n}=t;typeof n<"u"&&gu(e,n);const r=Cr(e,t);return g2(r,t)}function HR(e,t={}){const{size:n}=t;let r=e;return typeof n<"u"&&(gu(r,n),r=zR(r)),MR.decode(r)}function h2(e){return u2(e,{dir:"left"})}function zR(e){return u2(e,{dir:"right"})}class WR extends ze{constructor(t){super(`Bytes value \`${t}\` is not a valid boolean.`,{metaMessages:["The bytes array must contain a single byte of either a `0` or `1` value."]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Bytes.InvalidBytesBooleanError"})}}let GR=class extends ze{constructor({givenSize:t,maxSize:n}){super(`Size cannot exceed \`${n}\` bytes. Given size: \`${t}\` bytes.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Bytes.SizeOverflowError"})}},qR=class extends ze{constructor({size:t,targetSize:n,type:r}){super(`${r.charAt(0).toUpperCase()}${r.slice(1).toLowerCase()} size (\`${t}\`) exceeds padding size (\`${n}\`).`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Bytes.SizeExceedsPaddingSizeError"})}};const VR=new TextEncoder,KR=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function JR(e,t={}){const{strict:n=!1}=t;if(!e)throw new b2(e);if(typeof e!="string")throw new b2(e);if(n&&!/^0x[0-9a-fA-F]*$/.test(e))throw new w2(e);if(!e.startsWith("0x"))throw new w2(e)}function Ir(...e){return`0x${e.reduce((t,n)=>t+n.replace("0x",""),"")}`}function ZR(e){return e instanceof Uint8Array?Cr(e):Array.isArray(e)?Cr(new Uint8Array(e)):e}function p2(e,t={}){const n=`0x${Number(e)}`;return typeof t.size=="number"?(vd(n,t.size),Ks(n,t.size)):n}function Cr(e,t={}){let n="";for(let i=0;i<e.length;i++)n+=KR[e[i]];const r=`0x${n}`;return typeof t.size=="number"?(vd(r,t.size),Js(r,t.size)):r}function Tn(e,t={}){const{signed:n,size:r}=t,i=BigInt(e);let s;r?n?s=(1n<<BigInt(r)*8n-1n)-1n:s=2n**(BigInt(r)*8n)-1n:typeof e=="number"&&(s=BigInt(Number.MAX_SAFE_INTEGER));const o=typeof s=="bigint"&&n?-s-1n:0;if(s&&i>s||i<o){const u=typeof e=="bigint"?"n":"";throw new y2({max:s?`${s}${u}`:void 0,min:`${o}${u}`,signed:n,size:r,value:`${e}${u}`})}const c=`0x${(n&&i<0?BigInt.asUintN(r*8,BigInt(i)):i).toString(16)}`;return r?Ks(c,r):c}function Sp(e,t={}){return Cr(VR.encode(e),t)}function Ks(e,t){return l2(e,{dir:"left",size:t})}function Js(e,t){return l2(e,{dir:"right",size:t})}function Vr(e,t,n,r={}){const{strict:i}=r;RR(e,t);const s=`0x${e.replace("0x","").slice((t??0)*2,(n??e.length)*2)}`;return i&&TR(s,t,n),s}function rr(e){return Math.ceil((e.length-2)/2)}function m2(e,t={}){const{signed:n}=t;t.size&&vd(e,t.size);const r=BigInt(e);if(!n)return r;const i=(e.length-2)/2,s=(1n<<BigInt(i)*8n)-1n,o=s>>1n;return r<=o?r:r-s-1n}function g2(e,t={}){const{signed:n,size:r}=t;return Number(!n&&!r?e:m2(e,t))}function YR(e,t={}){const{strict:n=!1}=t;try{return JR(e,{strict:n}),!0}catch{return!1}}let y2=class extends ze{constructor({max:t,min:n,signed:r,size:i,value:s}){super(`Number \`${s}\` is not in safe${i?` ${i*8}-bit`:""}${r?" signed":" unsigned"} integer range ${t?`(\`${n}\` to \`${t}\`)`:`(above \`${n}\`)`}`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Hex.IntegerOutOfRangeError"})}},b2=class extends ze{constructor(t){super(`Value \`${typeof t=="object"?d2(t):t}\` of type \`${typeof t}\` is an invalid hex type.`,{metaMessages:['Hex types must be represented as `"0x${string}"`.']}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Hex.InvalidHexTypeError"})}},w2=class extends ze{constructor(t){super(`Value \`${t}\` is an invalid hex value.`,{metaMessages:['Hex values must start with `"0x"` and contain only hexadecimal characters (0-9, a-f, A-F).']}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Hex.InvalidHexValueError"})}},QR=class extends ze{constructor({givenSize:t,maxSize:n}){super(`Size cannot exceed \`${n}\` bytes. Given size: \`${t}\` bytes.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Hex.SizeOverflowError"})}},v2=class extends ze{constructor({offset:t,position:n,size:r}){super(`Slice ${n==="start"?"starting":"ending"} at offset \`${t}\` is out-of-bounds (size: \`${r}\`).`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Hex.SliceOffsetOutOfBoundsError"})}},XR=class extends ze{constructor({size:t,targetSize:n,type:r}){super(`${r.charAt(0).toUpperCase()}${r.slice(1).toLowerCase()} size (\`${t}\`) exceeds padding size (\`${n}\`).`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Hex.SizeExceedsPaddingSizeError"})}};function eT(e){return{address:e.address,amount:Tn(e.amount),index:Tn(e.index),validatorIndex:Tn(e.validatorIndex)}}function _2(e){return{...typeof e.baseFeePerGas=="bigint"&&{baseFeePerGas:Tn(e.baseFeePerGas)},...typeof e.blobBaseFee=="bigint"&&{blobBaseFee:Tn(e.blobBaseFee)},...typeof e.feeRecipient=="string"&&{feeRecipient:e.feeRecipient},...typeof e.gasLimit=="bigint"&&{gasLimit:Tn(e.gasLimit)},...typeof e.number=="bigint"&&{number:Tn(e.number)},...typeof e.prevRandao=="bigint"&&{prevRandao:Tn(e.prevRandao)},...typeof e.time=="bigint"&&{time:Tn(e.time)},...e.withdrawals&&{withdrawals:e.withdrawals.map(eT)}}}const tT="0x82ad56cb",E2="0x608060405234801561001057600080fd5b5060405161018e38038061018e83398101604081905261002f91610124565b6000808351602085016000f59050803b61004857600080fd5b6000808351602085016000855af16040513d6000823e81610067573d81fd5b3d81f35b634e487b7160e01b600052604160045260246000fd5b600082601f83011261009257600080fd5b81516001600160401b038111156100ab576100ab61006b565b604051601f8201601f19908116603f011681016001600160401b03811182821017156100d9576100d961006b565b6040528181528382016020018510156100f157600080fd5b60005b82811015610110576020818601810151838301820152016100f4565b506000918101602001919091529392505050565b6000806040838503121561013757600080fd5b82516001600160401b0381111561014d57600080fd5b61015985828601610081565b602085015190935090506001600160401b0381111561017757600080fd5b61018385828601610081565b915050925092905056fe",nT="0x608060405234801561001057600080fd5b506040516102c03803806102c083398101604081905261002f916101e6565b836001600160a01b03163b6000036100e457600080836001600160a01b03168360405161005c9190610270565b6000604051808303816000865af19150503d8060008114610099576040519150601f19603f3d011682016040523d82523d6000602084013e61009e565b606091505b50915091508115806100b857506001600160a01b0386163b155b156100e1578060405163101bb98d60e01b81526004016100d8919061028c565b60405180910390fd5b50505b6000808451602086016000885af16040513d6000823e81610103573d81fd5b3d81f35b80516001600160a01b038116811461011e57600080fd5b919050565b634e487b7160e01b600052604160045260246000fd5b60005b8381101561015457818101518382015260200161013c565b50506000910152565b600082601f83011261016e57600080fd5b81516001600160401b0381111561018757610187610123565b604051601f8201601f19908116603f011681016001600160401b03811182821017156101b5576101b5610123565b6040528181528382016020018510156101cd57600080fd5b6101de826020830160208701610139565b949350505050565b600080600080608085870312156101fc57600080fd5b61020585610107565b60208601519094506001600160401b0381111561022157600080fd5b61022d8782880161015d565b93505061023c60408601610107565b60608601519092506001600160401b0381111561025857600080fd5b6102648782880161015d565b91505092959194509250565b60008251610282818460208701610139565b9190910192915050565b60208152600082518060208401526102ab816040850160208701610139565b601f01601f1916919091016040019291505056fe",rT="0x608060405234801561001057600080fd5b5060405161069438038061069483398101604081905261002f9161051e565b600061003c848484610048565b9050806000526001601ff35b60007f64926492649264926492649264926492649264926492649264926492649264926100748361040c565b036101e7576000606080848060200190518101906100929190610577565b60405192955090935091506000906001600160a01b038516906100b69085906105dd565b6000604051808303816000865af19150503d80600081146100f3576040519150601f19603f3d011682016040523d82523d6000602084013e6100f8565b606091505b50509050876001600160a01b03163b60000361016057806101605760405162461bcd60e51b815260206004820152601e60248201527f5369676e617475726556616c696461746f723a206465706c6f796d656e74000060448201526064015b60405180910390fd5b604051630b135d3f60e11b808252906001600160a01b038a1690631626ba7e90610190908b9087906004016105f9565b602060405180830381865afa1580156101ad573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101d19190610633565b6001600160e01b03191614945050505050610405565b6001600160a01b0384163b1561027a57604051630b135d3f60e11b808252906001600160a01b03861690631626ba7e9061022790879087906004016105f9565b602060405180830381865afa158015610244573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102689190610633565b6001600160e01b031916149050610405565b81516041146102df5760405162461bcd60e51b815260206004820152603a602482015260008051602061067483398151915260448201527f3a20696e76616c6964207369676e6174757265206c656e6774680000000000006064820152608401610157565b6102e7610425565b5060208201516040808401518451859392600091859190811061030c5761030c61065d565b016020015160f81c9050601b811480159061032b57508060ff16601c14155b1561038c5760405162461bcd60e51b815260206004820152603b602482015260008051602061067483398151915260448201527f3a20696e76616c6964207369676e617475726520762076616c756500000000006064820152608401610157565b60408051600081526020810180835289905260ff83169181019190915260608101849052608081018390526001600160a01b0389169060019060a0016020604051602081039080840390855afa1580156103ea573d6000803e3d6000fd5b505050602060405103516001600160a01b0316149450505050505b9392505050565b600060208251101561041d57600080fd5b508051015190565b60405180606001604052806003906020820280368337509192915050565b6001600160a01b038116811461045857600080fd5b50565b634e487b7160e01b600052604160045260246000fd5b60005b8381101561048c578181015183820152602001610474565b50506000910152565b600082601f8301126104a657600080fd5b81516001600160401b038111156104bf576104bf61045b565b604051601f8201601f19908116603f011681016001600160401b03811182821017156104ed576104ed61045b565b60405281815283820160200185101561050557600080fd5b610516826020830160208701610471565b949350505050565b60008060006060848603121561053357600080fd5b835161053e81610443565b6020850151604086015191945092506001600160401b0381111561056157600080fd5b61056d86828701610495565b9150509250925092565b60008060006060848603121561058c57600080fd5b835161059781610443565b60208501519093506001600160401b038111156105b357600080fd5b6105bf86828701610495565b604086015190935090506001600160401b0381111561056157600080fd5b600082516105ef818460208701610471565b9190910192915050565b828152604060208201526000825180604084015261061e816060850160208701610471565b601f01601f1916919091016060019392505050565b60006020828403121561064557600080fd5b81516001600160e01b03198116811461040557600080fd5b634e487b7160e01b600052603260045260246000fdfe5369676e617475726556616c696461746f72237265636f7665725369676e6572",kp="0x608060405234801561001057600080fd5b506115b9806100206000396000f3fe6080604052600436106100f35760003560e01c80634d2301cc1161008a578063a8b0574e11610059578063a8b0574e14610325578063bce38bd714610350578063c3077fa914610380578063ee82ac5e146103b2576100f3565b80634d2301cc1461026257806372425d9d1461029f57806382ad56cb146102ca57806386d516e8146102fa576100f3565b80633408e470116100c65780633408e470146101af578063399542e9146101da5780633e64a6961461020c57806342cbb15c14610237576100f3565b80630f28c97d146100f8578063174dea7114610123578063252dba421461015357806327e86d6e14610184575b600080fd5b34801561010457600080fd5b5061010d6103ef565b60405161011a9190610c0a565b60405180910390f35b61013d60048036038101906101389190610c94565b6103f7565b60405161014a9190610e94565b60405180910390f35b61016d60048036038101906101689190610f0c565b610615565b60405161017b92919061101b565b60405180910390f35b34801561019057600080fd5b506101996107ab565b6040516101a69190611064565b60405180910390f35b3480156101bb57600080fd5b506101c46107b7565b6040516101d19190610c0a565b60405180910390f35b6101f460048036038101906101ef91906110ab565b6107bf565b6040516102039392919061110b565b60405180910390f35b34801561021857600080fd5b506102216107e1565b60405161022e9190610c0a565b60405180910390f35b34801561024357600080fd5b5061024c6107e9565b6040516102599190610c0a565b60405180910390f35b34801561026e57600080fd5b50610289600480360381019061028491906111a7565b6107f1565b6040516102969190610c0a565b60405180910390f35b3480156102ab57600080fd5b506102b4610812565b6040516102c19190610c0a565b60405180910390f35b6102e460048036038101906102df919061122a565b61081a565b6040516102f19190610e94565b60405180910390f35b34801561030657600080fd5b5061030f6109e4565b60405161031c9190610c0a565b60405180910390f35b34801561033157600080fd5b5061033a6109ec565b6040516103479190611286565b60405180910390f35b61036a600480360381019061036591906110ab565b6109f4565b6040516103779190610e94565b60405180910390f35b61039a60048036038101906103959190610f0c565b610ba6565b6040516103a99392919061110b565b60405180910390f35b3480156103be57600080fd5b506103d960048036038101906103d491906112cd565b610bca565b6040516103e69190611064565b60405180910390f35b600042905090565b60606000808484905090508067ffffffffffffffff81111561041c5761041b6112fa565b5b60405190808252806020026020018201604052801561045557816020015b610442610bd5565b81526020019060019003908161043a5790505b5092503660005b828110156105c957600085828151811061047957610478611329565b5b6020026020010151905087878381811061049657610495611329565b5b90506020028101906104a89190611367565b925060008360400135905080860195508360000160208101906104cb91906111a7565b73ffffffffffffffffffffffffffffffffffffffff16818580606001906104f2919061138f565b604051610500929190611431565b60006040518083038185875af1925050503d806000811461053d576040519150601f19603f3d011682016040523d82523d6000602084013e610542565b606091505b5083600001846020018290528215151515815250505081516020850135176105bc577f08c379a000000000000000000000000000000000000000000000000000000000600052602060045260176024527f4d756c746963616c6c333a2063616c6c206661696c656400000000000000000060445260846000fd5b826001019250505061045c565b5082341461060c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610603906114a7565b60405180910390fd5b50505092915050565b6000606043915060008484905090508067ffffffffffffffff81111561063e5761063d6112fa565b5b60405190808252806020026020018201604052801561067157816020015b606081526020019060019003908161065c5790505b5091503660005b828110156107a157600087878381811061069557610694611329565b5b90506020028101906106a791906114c7565b92508260000160208101906106bc91906111a7565b73ffffffffffffffffffffffffffffffffffffffff168380602001906106e2919061138f565b6040516106f0929190611431565b6000604051808303816000865af19150503d806000811461072d576040519150601f19603f3d011682016040523d82523d6000602084013e610732565b606091505b5086848151811061074657610745611329565b5b60200260200101819052819250505080610795576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161078c9061153b565b60405180910390fd5b81600101915050610678565b5050509250929050565b60006001430340905090565b600046905090565b6000806060439250434091506107d68686866109f4565b905093509350939050565b600048905090565b600043905090565b60008173ffffffffffffffffffffffffffffffffffffffff16319050919050565b600044905090565b606060008383905090508067ffffffffffffffff81111561083e5761083d6112fa565b5b60405190808252806020026020018201604052801561087757816020015b610864610bd5565b81526020019060019003908161085c5790505b5091503660005b828110156109db57600084828151811061089b5761089a611329565b5b602002602001015190508686838181106108b8576108b7611329565b5b90506020028101906108ca919061155b565b92508260000160208101906108df91906111a7565b73ffffffffffffffffffffffffffffffffffffffff16838060400190610905919061138f565b604051610913929190611431565b6000604051808303816000865af19150503d8060008114610950576040519150601f19603f3d011682016040523d82523d6000602084013e610955565b606091505b5082600001836020018290528215151515815250505080516020840135176109cf577f08c379a000000000000000000000000000000000000000000000000000000000600052602060045260176024527f4d756c746963616c6c333a2063616c6c206661696c656400000000000000000060445260646000fd5b8160010191505061087e565b50505092915050565b600045905090565b600041905090565b606060008383905090508067ffffffffffffffff811115610a1857610a176112fa565b5b604051908082528060200260200182016040528015610a5157816020015b610a3e610bd5565b815260200190600190039081610a365790505b5091503660005b82811015610b9c576000848281518110610a7557610a74611329565b5b60200260200101519050868683818110610a9257610a91611329565b5b9050602002810190610aa491906114c7565b9250826000016020810190610ab991906111a7565b73ffffffffffffffffffffffffffffffffffffffff16838060200190610adf919061138f565b604051610aed929190611431565b6000604051808303816000865af19150503d8060008114610b2a576040519150601f19603f3d011682016040523d82523d6000602084013e610b2f565b606091505b508260000183602001829052821515151581525050508715610b90578060000151610b8f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b869061153b565b60405180910390fd5b5b81600101915050610a58565b5050509392505050565b6000806060610bb7600186866107bf565b8093508194508295505050509250925092565b600081409050919050565b6040518060400160405280600015158152602001606081525090565b6000819050919050565b610c0481610bf1565b82525050565b6000602082019050610c1f6000830184610bfb565b92915050565b600080fd5b600080fd5b600080fd5b600080fd5b600080fd5b60008083601f840112610c5457610c53610c2f565b5b8235905067ffffffffffffffff811115610c7157610c70610c34565b5b602083019150836020820283011115610c8d57610c8c610c39565b5b9250929050565b60008060208385031215610cab57610caa610c25565b5b600083013567ffffffffffffffff811115610cc957610cc8610c2a565b5b610cd585828601610c3e565b92509250509250929050565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b60008115159050919050565b610d2281610d0d565b82525050565b600081519050919050565b600082825260208201905092915050565b60005b83811015610d62578082015181840152602081019050610d47565b83811115610d71576000848401525b50505050565b6000601f19601f8301169050919050565b6000610d9382610d28565b610d9d8185610d33565b9350610dad818560208601610d44565b610db681610d77565b840191505092915050565b6000604083016000830151610dd96000860182610d19565b5060208301518482036020860152610df18282610d88565b9150508091505092915050565b6000610e0a8383610dc1565b905092915050565b6000602082019050919050565b6000610e2a82610ce1565b610e348185610cec565b935083602082028501610e4685610cfd565b8060005b85811015610e825784840389528151610e638582610dfe565b9450610e6e83610e12565b925060208a01995050600181019050610e4a565b50829750879550505050505092915050565b60006020820190508181036000830152610eae8184610e1f565b905092915050565b60008083601f840112610ecc57610ecb610c2f565b5b8235905067ffffffffffffffff811115610ee957610ee8610c34565b5b602083019150836020820283011115610f0557610f04610c39565b5b9250929050565b60008060208385031215610f2357610f22610c25565b5b600083013567ffffffffffffffff811115610f4157610f40610c2a565b5b610f4d85828601610eb6565b92509250509250929050565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b6000610f918383610d88565b905092915050565b6000602082019050919050565b6000610fb182610f59565b610fbb8185610f64565b935083602082028501610fcd85610f75565b8060005b858110156110095784840389528151610fea8582610f85565b9450610ff583610f99565b925060208a01995050600181019050610fd1565b50829750879550505050505092915050565b60006040820190506110306000830185610bfb565b81810360208301526110428184610fa6565b90509392505050565b6000819050919050565b61105e8161104b565b82525050565b60006020820190506110796000830184611055565b92915050565b61108881610d0d565b811461109357600080fd5b50565b6000813590506110a58161107f565b92915050565b6000806000604084860312156110c4576110c3610c25565b5b60006110d286828701611096565b935050602084013567ffffffffffffffff8111156110f3576110f2610c2a565b5b6110ff86828701610eb6565b92509250509250925092565b60006060820190506111206000830186610bfb565b61112d6020830185611055565b818103604083015261113f8184610e1f565b9050949350505050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b600061117482611149565b9050919050565b61118481611169565b811461118f57600080fd5b50565b6000813590506111a18161117b565b92915050565b6000602082840312156111bd576111bc610c25565b5b60006111cb84828501611192565b91505092915050565b60008083601f8401126111ea576111e9610c2f565b5b8235905067ffffffffffffffff81111561120757611206610c34565b5b60208301915083602082028301111561122357611222610c39565b5b9250929050565b6000806020838503121561124157611240610c25565b5b600083013567ffffffffffffffff81111561125f5761125e610c2a565b5b61126b858286016111d4565b92509250509250929050565b61128081611169565b82525050565b600060208201905061129b6000830184611277565b92915050565b6112aa81610bf1565b81146112b557600080fd5b50565b6000813590506112c7816112a1565b92915050565b6000602082840312156112e3576112e2610c25565b5b60006112f1848285016112b8565b91505092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b600080fd5b600080fd5b600080fd5b60008235600160800383360303811261138357611382611358565b5b80830191505092915050565b600080833560016020038436030381126113ac576113ab611358565b5b80840192508235915067ffffffffffffffff8211156113ce576113cd61135d565b5b6020830192506001820236038313156113ea576113e9611362565b5b509250929050565b600081905092915050565b82818337600083830152505050565b600061141883856113f2565b93506114258385846113fd565b82840190509392505050565b600061143e82848661140c565b91508190509392505050565b600082825260208201905092915050565b7f4d756c746963616c6c333a2076616c7565206d69736d61746368000000000000600082015250565b6000611491601a8361144a565b915061149c8261145b565b602082019050919050565b600060208201905081810360008301526114c081611484565b9050919050565b6000823560016040038336030381126114e3576114e2611358565b5b80830191505092915050565b7f4d756c746963616c6c333a2063616c6c206661696c6564000000000000000000600082015250565b600061152560178361144a565b9150611530826114ef565b602082019050919050565b6000602082019050818103600083015261155481611518565b9050919050565b60008235600160600383360303811261157757611576611358565b5b8083019150509291505056fea264697066735822122020c1bc9aacf8e4a6507193432a895a8e77094f45a1395583f07b24e860ef06cd64736f6c634300080c0033",Ap="/docs/contract/encodeDeployData";function Ip(e){const{abi:t,args:n,bytecode:r}=e;if(!n||n.length===0)return r;const i=t.find(o=>"type"in o&&o.type==="constructor");if(!i)throw new zI({docsPath:Ap});if(!("inputs"in i))throw new Uw({docsPath:Ap});if(!i.inputs||i.inputs.length===0)throw new Uw({docsPath:Ap});const s=zn(i.inputs,n);return Hn([r,s])}let ya=class extends ee{constructor({cause:t,message:n}={}){var i;const r=(i=n==null?void 0:n.replace("execution reverted: ",""))==null?void 0:i.replace("execution reverted","");super(`Execution reverted ${r?`with reason: ${r}`:"for an unknown reason"}.`,{cause:t,name:"ExecutionRevertedError"})}};Object.defineProperty(ya,"code",{enumerable:!0,configurable:!0,writable:!0,value:3}),Object.defineProperty(ya,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/execution reverted|gas required exceeds allowance/});class Zs extends ee{constructor({cause:t,maxFeePerGas:n}={}){super(`The fee cap (\`maxFeePerGas\`${n?` = ${xn(n)} gwei`:""}) cannot be higher than the maximum allowed value (2^256-1).`,{cause:t,name:"FeeCapTooHighError"})}}Object.defineProperty(Zs,"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 Cp extends ee{constructor({cause:t,maxFeePerGas:n}={}){super(`The fee cap (\`maxFeePerGas\`${n?` = ${xn(n)}`:""} gwei) cannot be lower than the block base fee.`,{cause:t,name:"FeeCapTooLowError"})}}Object.defineProperty(Cp,"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 Pp extends ee{constructor({cause:t,nonce:n}={}){super(`Nonce provided for the transaction ${n?`(${n}) `:""}is higher than the next one expected.`,{cause:t,name:"NonceTooHighError"})}}Object.defineProperty(Pp,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/nonce too high/});class Rp extends ee{constructor({cause:t,nonce:n}={}){super([`Nonce provided for the transaction ${n?`(${n}) `:""}is lower than the current nonce of the account.`,"Try increasing the nonce or find the latest nonce with `getTransactionCount`."].join(`
75
+ `),{cause:t,name:"NonceTooLowError"})}}Object.defineProperty(Rp,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/nonce too low|transaction already imported|already known/});class Tp extends ee{constructor({cause:t,nonce:n}={}){super(`Nonce provided for the transaction ${n?`(${n}) `:""}exceeds the maximum allowed nonce.`,{cause:t,name:"NonceMaxValueError"})}}Object.defineProperty(Tp,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/nonce has max value/});class Op extends ee{constructor({cause:t}={}){super(["The total cost (gas * gas fee + value) of executing this transaction exceeds the balance of the account."].join(`
76
+ `),{cause:t,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(Op,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/insufficient funds|exceeds transaction sender account balance/});class Mp extends ee{constructor({cause:t,gas:n}={}){super(`The amount of gas ${n?`(${n}) `:""}provided for the transaction exceeds the limit allowed for the block.`,{cause:t,name:"IntrinsicGasTooHighError"})}}Object.defineProperty(Mp,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/intrinsic gas too high|gas limit reached/});class Bp extends ee{constructor({cause:t,gas:n}={}){super(`The amount of gas ${n?`(${n}) `:""}provided for the transaction is too low.`,{cause:t,name:"IntrinsicGasTooLowError"})}}Object.defineProperty(Bp,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/intrinsic gas too low/});class Np extends ee{constructor({cause:t}){super("The transaction type is not supported for this chain.",{cause:t,name:"TransactionTypeNotSupportedError"})}}Object.defineProperty(Np,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/transaction type not valid/});class yu extends ee{constructor({cause:t,maxPriorityFeePerGas:n,maxFeePerGas:r}={}){super([`The provided tip (\`maxPriorityFeePerGas\`${n?` = ${xn(n)} gwei`:""}) cannot be higher than the fee cap (\`maxFeePerGas\`${r?` = ${xn(r)} gwei`:""}).`].join(`
77
+ `),{cause:t,name:"TipAboveFeeCapError"})}}Object.defineProperty(yu,"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 bu extends ee{constructor({cause:t}){super(`An error occurred while executing: ${t==null?void 0:t.shortMessage}`,{cause:t,name:"UnknownNodeError"})}}function _d(e,t){const n=(e.details||"").toLowerCase(),r=e instanceof ee?e.walk(i=>(i==null?void 0:i.code)===ya.code):e;return r instanceof ee?new ya({cause:e,message:r.details}):ya.nodeMessage.test(n)?new ya({cause:e,message:e.details}):Zs.nodeMessage.test(n)?new Zs({cause:e,maxFeePerGas:t==null?void 0:t.maxFeePerGas}):Cp.nodeMessage.test(n)?new Cp({cause:e,maxFeePerGas:t==null?void 0:t.maxFeePerGas}):Pp.nodeMessage.test(n)?new Pp({cause:e,nonce:t==null?void 0:t.nonce}):Rp.nodeMessage.test(n)?new Rp({cause:e,nonce:t==null?void 0:t.nonce}):Tp.nodeMessage.test(n)?new Tp({cause:e,nonce:t==null?void 0:t.nonce}):Op.nodeMessage.test(n)?new Op({cause:e}):Mp.nodeMessage.test(n)?new Mp({cause:e,gas:t==null?void 0:t.gas}):Bp.nodeMessage.test(n)?new Bp({cause:e,gas:t==null?void 0:t.gas}):Np.nodeMessage.test(n)?new Np({cause:e}):yu.nodeMessage.test(n)?new yu({cause:e,maxFeePerGas:t==null?void 0:t.maxFeePerGas,maxPriorityFeePerGas:t==null?void 0:t.maxPriorityFeePerGas}):new bu({cause:e})}function x2(e,{docsPath:t,...n}){const r=(()=>{const i=_d(e,n);return i instanceof bu?e:i})();return new Kv(r,{docsPath:t,...n})}function wu(e,{format:t}){if(!t)return{};const n={};function r(s){const o=Object.keys(s);for(const a of o)a in e&&(n[a]=e[a]),s[a]&&typeof s[a]=="object"&&!Array.isArray(s[a])&&r(s[a])}const i=t(e||{});return r(i),n}function Lp(e,t){return({exclude:n,format:r})=>({exclude:n,format:(i,s)=>{const o=t(i,s);if(n)for(const a of n)delete o[a];return{...o,...r(i,s)}},type:e})}const iT={legacy:"0x0",eip2930:"0x1",eip1559:"0x2",eip4844:"0x3",eip7702:"0x4"};function ba(e,t){const n={};return typeof e.authorizationList<"u"&&(n.authorizationList=sT(e.authorizationList)),typeof e.accessList<"u"&&(n.accessList=e.accessList),typeof e.blobVersionedHashes<"u"&&(n.blobVersionedHashes=e.blobVersionedHashes),typeof e.blobs<"u"&&(typeof e.blobs[0]!="string"?n.blobs=e.blobs.map(r=>Jt(r)):n.blobs=e.blobs),typeof e.data<"u"&&(n.data=e.data),e.account&&(n.from=e.account.address),typeof e.from<"u"&&(n.from=e.from),typeof e.gas<"u"&&(n.gas=oe(e.gas)),typeof e.gasPrice<"u"&&(n.gasPrice=oe(e.gasPrice)),typeof e.maxFeePerBlobGas<"u"&&(n.maxFeePerBlobGas=oe(e.maxFeePerBlobGas)),typeof e.maxFeePerGas<"u"&&(n.maxFeePerGas=oe(e.maxFeePerGas)),typeof e.maxPriorityFeePerGas<"u"&&(n.maxPriorityFeePerGas=oe(e.maxPriorityFeePerGas)),typeof e.nonce<"u"&&(n.nonce=oe(e.nonce)),typeof e.to<"u"&&(n.to=e.to),typeof e.type<"u"&&(n.type=iT[e.type]),typeof e.value<"u"&&(n.value=oe(e.value)),n}function sT(e){return e.map(t=>({address:t.address,r:t.r?oe(BigInt(t.r)):t.r,s:t.s?oe(BigInt(t.s)):t.s,chainId:oe(t.chainId),nonce:oe(t.nonce),...typeof t.yParity<"u"?{yParity:oe(t.yParity)}:{},...typeof t.v<"u"&&typeof t.yParity>"u"?{v:oe(t.v)}:{}}))}function jp(){let e=()=>{},t=()=>{};return{promise:new Promise((r,i)=>{e=r,t=i}),resolve:e,reject:t}}const $p=new Map;function S2({fn:e,id:t,shouldSplitBatch:n,wait:r=0,sort:i}){const s=async()=>{const l=c();o();const d=l.map(({args:f})=>f);d.length!==0&&e(d).then(f=>{i&&Array.isArray(f)&&f.sort(i);for(let h=0;h<l.length;h++){const{resolve:m}=l[h];m==null||m([f[h],f])}}).catch(f=>{for(let h=0;h<l.length;h++){const{reject:m}=l[h];m==null||m(f)}})},o=()=>$p.delete(t),a=()=>c().map(({args:l})=>l),c=()=>$p.get(t)||[],u=l=>$p.set(t,[...c(),l]);return{flush:o,async schedule(l){const{promise:d,resolve:f,reject:h}=jp();return(n==null?void 0:n([...a(),l]))&&s(),c().length>0?(u({args:l,resolve:f,reject:h}),d):(u({args:l,resolve:f,reject:h}),setTimeout(s,r),d)}}}function k2(e){if(!(!e||e.length===0))return e.reduce((t,{slot:n,value:r})=>{if(n.length!==66)throw new Qw({size:n.length,targetSize:66,type:"hex"});if(r.length!==66)throw new Qw({size:r.length,targetSize:66,type:"hex"});return t[n]=r,t},{})}function oT(e){const{balance:t,nonce:n,state:r,stateDiff:i,code:s}=e,o={};if(s!==void 0&&(o.code=s),t!==void 0&&(o.balance=oe(t)),n!==void 0&&(o.nonce=oe(n)),r!==void 0&&(o.state=k2(r)),i!==void 0){if(o.state)throw new oR;o.stateDiff=k2(i)}return o}function Ed(e){if(!e)return;const t={};for(const{address:n,...r}of e){if(!Pt(n,{strict:!1}))throw new _n({address:n});if(t[n])throw new sR({address:n});t[n]=oT(r)}return t}const xd=2n**256n-1n;function Ys(e){const{account:t,maxFeePerGas:n,maxPriorityFeePerGas:r,to:i}=e,s=t?Ut(t):void 0;if(s&&!Pt(s.address))throw new _n({address:s.address});if(i&&!Pt(i))throw new _n({address:i});if(n&&n>xd)throw new Zs({maxFeePerGas:n});if(r&&n&&r>n)throw new yu({maxFeePerGas:n,maxPriorityFeePerGas:r})}async function Qs(e,t){var C,p,g,k;const{account:n=e.account,authorizationList:r,batch:i=!!((C=e.batch)!=null&&C.multicall),blockNumber:s,blockTag:o=e.experimental_blockTag??"latest",accessList:a,blobs:c,blockOverrides:u,code:l,data:d,factory:f,factoryData:h,gas:m,gasPrice:y,maxFeePerBlobGas:w,maxFeePerGas:b,maxPriorityFeePerGas:x,nonce:v,to:S,value:I,stateOverride:N,...j}=t,U=n?Ut(n):void 0;if(l&&(f||h))throw new ee("Cannot provide both `code` & `factory`/`factoryData` as parameters.");if(l&&S)throw new ee("Cannot provide both `code` & `to` as parameters.");const L=l&&d,Y=f&&h&&S&&d,Z=L||Y,G=L?A2({code:l,data:d}):Y?uT({data:d,factory:f,factoryData:h,to:S}):d;try{Ys(t);const T=(typeof s=="bigint"?oe(s):void 0)||o,M=u?_2(u):void 0,$=Ed(N),O=(k=(g=(p=e.chain)==null?void 0:p.formatters)==null?void 0:g.transactionRequest)==null?void 0:k.format,F=(O||ba)({...wu(j,{format:O}),accessList:a,account:U,authorizationList:r,blobs:c,data:G,gas:m,gasPrice:y,maxFeePerBlobGas:w,maxFeePerGas:b,maxPriorityFeePerGas:x,nonce:v,to:Z?void 0:S,value:I},"call");if(i&&aT({request:F})&&!$&&!M)try{return await cT(e,{...F,blockNumber:s,blockTag:o})}catch(q){if(!(q instanceof Uv)&&!(q instanceof up))throw q}const ue=(()=>{const q=[F,T];return $&&M?[...q,$,M]:$?[...q,$]:M?[...q,{},M]:q})(),ne=await e.request({method:"eth_call",params:ue});return ne==="0x"?{data:void 0}:{data:ne}}catch(R){const T=lT(R),{offchainLookup:M,offchainLookupSignature:$}=await Promise.resolve().then(()=>UO);if(e.ccipRead!==!1&&(T==null?void 0:T.slice(0,10))===$&&S)return{data:await M(e,{data:T,to:S})};throw Z&&(T==null?void 0:T.slice(0,10))==="0x101bb98d"?new mR({factory:f}):x2(R,{...t,account:U,chain:e.chain})}}function aT({request:e}){const{data:t,to:n,...r}=e;return!(!t||t.startsWith(tT)||!n||Object.values(r).filter(i=>typeof i<"u").length>0)}async function cT(e,t){var y;const{batchSize:n=1024,deployless:r=!1,wait:i=0}=typeof((y=e.batch)==null?void 0:y.multicall)=="object"?e.batch.multicall:{},{blockNumber:s,blockTag:o=e.experimental_blockTag??"latest",data:a,to:c}=t,u=(()=>{if(r)return null;if(t.multicallAddress)return t.multicallAddress;if(e.chain)return da({blockNumber:s,chain:e.chain,contract:"multicall3"});throw new Uv})(),d=(typeof s=="bigint"?oe(s):void 0)||o,{schedule:f}=S2({id:`${e.uid}.${d}`,wait:i,shouldSplitBatch(w){return w.reduce((x,{data:v})=>x+(v.length-2),0)>n*2},fn:async w=>{const b=w.map(S=>({allowFailure:!0,callData:S.data,target:S.to})),x=jt({abi:Qo,args:[b],functionName:"aggregate3"}),v=await e.request({method:"eth_call",params:[{...u===null?{data:A2({code:kp,data:x})}:{to:u,data:x}},d]});return ts({abi:Qo,args:[b],functionName:"aggregate3",data:v||"0x"})}}),[{returnData:h,success:m}]=await f({data:a,to:c});if(!m)throw new pd({data:h});return h==="0x"?{data:void 0}:{data:h}}function A2(e){const{code:t,data:n}=e;return Ip({abi:op(["constructor(bytes, bytes)"]),bytecode:E2,args:[t,n]})}function uT(e){const{data:t,factory:n,factoryData:r,to:i}=e;return Ip({abi:op(["constructor(address, bytes, address, bytes)"]),bytecode:nT,args:[i,t,n,r]})}function lT(e){var n;if(!(e instanceof ee))return;const t=e.walk();return typeof(t==null?void 0:t.data)=="object"?(n=t.data)==null?void 0:n.data:t.data}async function On(e,t){const{abi:n,address:r,args:i,functionName:s,...o}=t,a=jt({abi:n,args:i,functionName:s});try{const{data:c}=await ve(e,Qs,"call")({...o,data:a,to:r});return ts({abi:n,args:i,functionName:s,data:c||"0x"})}catch(c){throw qs(c,{abi:n,address:r,args:i,docsPath:"/docs/contract/readContract",functionName:s})}}async function dT(e,t){const{blockNumber:n,blockTag:r,coinType:i,name:s,gatewayUrls:o,strict:a}=t,{chain:c}=e,u=(()=>{if(t.universalResolverAddress)return t.universalResolverAddress;if(!c)throw new Error("client chain not configured. universalResolverAddress is required.");return da({blockNumber:n,chain:c,contract:"ensUniversalResolver"})})(),l=c==null?void 0:c.ensTlds;if(l&&!l.some(f=>s.endsWith(f)))return null;const d=i!=null?[mp(s),BigInt(i)]:[mp(s)];try{const f=jt({abi:Lw,functionName:"addr",args:d}),h={address:u,abi:Bw,functionName:"resolveWithGateways",args:[tn(gp(s)),f,o??[qc]],blockNumber:n,blockTag:r},y=await ve(e,On,"readContract")(h);if(y[0]==="0x")return null;const w=ts({abi:Lw,args:d,functionName:"addr",data:y[0]});return w==="0x"||En(w)==="0x00"?null:w}catch(f){if(a)throw f;if(dp(f))return null;throw f}}class fT extends ee{constructor({data:t}){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(t)}`],name:"EnsAvatarInvalidMetadataError"})}}class vu extends ee{constructor({reason:t}){super(`ENS NFT avatar URI is invalid. ${t}`,{name:"EnsAvatarInvalidNftUriError"})}}class Fp extends ee{constructor({uri:t}){super(`Unable to resolve ENS avatar URI "${t}". The URI may be malformed, invalid, or does not respond with a valid image.`,{name:"EnsAvatarUriResolutionError"})}}class hT extends ee{constructor({namespace:t}){super(`ENS NFT avatar namespace "${t}" is not supported. Must be "erc721" or "erc1155".`,{name:"EnsAvatarUnsupportedNamespaceError"})}}const pT=/(?<protocol>https?:\/\/[^/]*|ipfs:\/|ipns:\/|ar:\/)?(?<root>\/)?(?<subpath>ipfs\/|ipns\/)?(?<target>[\w\-.]+)(?<subtarget>\/.*)?/,mT=/^(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,})(\/(?<target>[\w\-.]+))?(?<subtarget>\/.*)?$/,gT=/^data:([a-zA-Z\-/+]*);base64,([^"].*)/,yT=/^data:([a-zA-Z\-/+]*)?(;[a-zA-Z0-9].*?)?(,)/;async function bT(e){try{const t=await fetch(e,{method:"HEAD"});if(t.status===200){const n=t.headers.get("content-type");return n==null?void 0:n.startsWith("image/")}return!1}catch(t){return typeof t=="object"&&typeof t.response<"u"||!Object.hasOwn(globalThis,"Image")?!1:new Promise(n=>{const r=new Image;r.onload=()=>{n(!0)},r.onerror=()=>{n(!1)},r.src=e})}}function I2(e,t){return e?e.endsWith("/")?e.slice(0,-1):e:t}function C2({uri:e,gatewayUrls:t}){const n=gT.test(e);if(n)return{uri:e,isOnChain:!0,isEncoded:n};const r=I2(t==null?void 0:t.ipfs,"https://ipfs.io"),i=I2(t==null?void 0:t.arweave,"https://arweave.net"),s=e.match(pT),{protocol:o,subpath:a,target:c,subtarget:u=""}=(s==null?void 0:s.groups)||{},l=o==="ipns:/"||a==="ipns/",d=o==="ipfs:/"||a==="ipfs/"||mT.test(e);if(e.startsWith("http")&&!l&&!d){let h=e;return t!=null&&t.arweave&&(h=e.replace(/https:\/\/arweave.net/g,t==null?void 0:t.arweave)),{uri:h,isOnChain:!1,isEncoded:!1}}if((l||d)&&c)return{uri:`${r}/${l?"ipns":"ipfs"}/${c}${u}`,isOnChain:!1,isEncoded:!1};if(o==="ar:/"&&c)return{uri:`${i}/${c}${u||""}`,isOnChain:!1,isEncoded:!1};let f=e.replace(yT,"");if(f.startsWith("<svg")&&(f=`data:image/svg+xml;base64,${btoa(f)}`),f.startsWith("data:")||f.startsWith("{"))return{uri:f,isOnChain:!0,isEncoded:!1};throw new Fp({uri:e})}function P2(e){if(typeof e!="object"||!("image"in e)&&!("image_url"in e)&&!("image_data"in e))throw new fT({data:e});return e.image||e.image_url||e.image_data}async function wT({gatewayUrls:e,uri:t}){try{const n=await fetch(t).then(i=>i.json());return await Dp({gatewayUrls:e,uri:P2(n)})}catch{throw new Fp({uri:t})}}async function Dp({gatewayUrls:e,uri:t}){const{uri:n,isOnChain:r}=C2({uri:t,gatewayUrls:e});if(r||await bT(n))return n;throw new Fp({uri:t})}function vT(e){let t=e;t.startsWith("did:nft:")&&(t=t.replace("did:nft:","").replace(/_/g,"/"));const[n,r,i]=t.split("/"),[s,o]=n.split(":"),[a,c]=r.split(":");if(!s||s.toLowerCase()!=="eip155")throw new vu({reason:"Only EIP-155 supported"});if(!o)throw new vu({reason:"Chain ID not found"});if(!c)throw new vu({reason:"Contract address not found"});if(!i)throw new vu({reason:"Token ID not found"});if(!a)throw new vu({reason:"ERC namespace not found"});return{chainID:Number.parseInt(o,10),namespace:a.toLowerCase(),contractAddress:c,tokenID:i}}async function _T(e,{nft:t}){if(t.namespace==="erc721")return On(e,{address:t.contractAddress,abi:[{name:"tokenURI",type:"function",stateMutability:"view",inputs:[{name:"tokenId",type:"uint256"}],outputs:[{name:"",type:"string"}]}],functionName:"tokenURI",args:[BigInt(t.tokenID)]});if(t.namespace==="erc1155")return On(e,{address:t.contractAddress,abi:[{name:"uri",type:"function",stateMutability:"view",inputs:[{name:"_id",type:"uint256"}],outputs:[{name:"",type:"string"}]}],functionName:"uri",args:[BigInt(t.tokenID)]});throw new hT({namespace:t.namespace})}async function ET(e,{gatewayUrls:t,record:n}){return/eip155:/i.test(n)?xT(e,{gatewayUrls:t,record:n}):Dp({uri:n,gatewayUrls:t})}async function xT(e,{gatewayUrls:t,record:n}){const r=vT(n),i=await _T(e,{nft:r}),{uri:s,isOnChain:o,isEncoded:a}=C2({uri:i,gatewayUrls:t});if(o&&(s.includes("data:application/json;base64,")||s.startsWith("{"))){const u=a?atob(s.replace("data:application/json;base64,","")):s,l=JSON.parse(u);return Dp({uri:P2(l),gatewayUrls:t})}let c=r.tokenID;return r.namespace==="erc1155"&&(c=c.replace("0x","").padStart(64,"0")),wT({gatewayUrls:t,uri:s.replace(/(?:0x)?{id}/,c)})}async function R2(e,t){const{blockNumber:n,blockTag:r,key:i,name:s,gatewayUrls:o,strict:a}=t,{chain:c}=e,u=(()=>{if(t.universalResolverAddress)return t.universalResolverAddress;if(!c)throw new Error("client chain not configured. universalResolverAddress is required.");return da({blockNumber:n,chain:c,contract:"ensUniversalResolver"})})(),l=c==null?void 0:c.ensTlds;if(l&&!l.some(d=>s.endsWith(d)))return null;try{const d={address:u,abi:Bw,args:[tn(gp(s)),jt({abi:Nw,functionName:"text",args:[mp(s),i]}),o??[qc]],functionName:"resolveWithGateways",blockNumber:n,blockTag:r},h=await ve(e,On,"readContract")(d);if(h[0]==="0x")return null;const m=ts({abi:Nw,functionName:"text",data:h[0]});return m===""?null:m}catch(d){if(a)throw d;if(dp(d))return null;throw d}}async function ST(e,{blockNumber:t,blockTag:n,assetGatewayUrls:r,name:i,gatewayUrls:s,strict:o,universalResolverAddress:a}){const c=await ve(e,R2,"getEnsText")({blockNumber:t,blockTag:n,key:"avatar",name:i,universalResolverAddress:a,gatewayUrls:s,strict:o});if(!c)return null;try{return await ET(e,{record:c,gatewayUrls:r})}catch{return null}}async function kT(e,t){const{address:n,blockNumber:r,blockTag:i,coinType:s=60n,gatewayUrls:o,strict:a}=t,{chain:c}=e,u=(()=>{if(t.universalResolverAddress)return t.universalResolverAddress;if(!c)throw new Error("client chain not configured. universalResolverAddress is required.");return da({blockNumber:r,chain:c,contract:"ensUniversalResolver"})})();try{const l={address:u,abi:DI,args:[n,s,o??[qc]],functionName:"reverseWithGateways",blockNumber:r,blockTag:i},d=ve(e,On,"readContract"),[f]=await d(l);return f||null}catch(l){if(a)throw l;if(dp(l))return null;throw l}}async function AT(e,t){const{blockNumber:n,blockTag:r,name:i}=t,{chain:s}=e,o=(()=>{if(t.universalResolverAddress)return t.universalResolverAddress;if(!s)throw new Error("client chain not configured. universalResolverAddress is required.");return da({blockNumber:n,chain:s,contract:"ensUniversalResolver"})})(),a=s==null?void 0:s.ensTlds;if(a&&!a.some(u=>i.endsWith(u)))throw new Error(`${i} is not a valid ENS TLD (${a==null?void 0:a.join(", ")}) for chain "${s.name}" (id: ${s.id}).`);const[c]=await ve(e,On,"readContract")({address:o,abi:[{inputs:[{type:"bytes"}],name:"findResolver",outputs:[{type:"address"},{type:"bytes32"},{type:"uint256"}],stateMutability:"view",type:"function"}],functionName:"findResolver",args:[tn(gp(i))],blockNumber:n,blockTag:r});return c}async function T2(e,t){var w,b,x;const{account:n=e.account,blockNumber:r,blockTag:i="latest",blobs:s,data:o,gas:a,gasPrice:c,maxFeePerBlobGas:u,maxFeePerGas:l,maxPriorityFeePerGas:d,to:f,value:h,...m}=t,y=n?Ut(n):void 0;try{Ys(t);const S=(typeof r=="bigint"?oe(r):void 0)||i,I=(x=(b=(w=e.chain)==null?void 0:w.formatters)==null?void 0:b.transactionRequest)==null?void 0:x.format,j=(I||ba)({...wu(m,{format:I}),account:y,blobs:s,data:o,gas:a,gasPrice:c,maxFeePerBlobGas:u,maxFeePerGas:l,maxPriorityFeePerGas:d,to:f,value:h},"createAccessList"),U=await e.request({method:"eth_createAccessList",params:[j,S]});return{accessList:U.accessList,gasUsed:BigInt(U.gasUsed)}}catch(v){throw x2(v,{...t,account:y,chain:e.chain})}}function Sd(e,{method:t}){var r,i;const n={};return e.transport.type==="fallback"&&((i=(r=e.transport).onResponse)==null||i.call(r,({method:s,response:o,status:a,transport:c})=>{a==="success"&&t===s&&(n[o]=c.request)})),s=>n[s]||e.request}async function IT(e){const t=Sd(e,{method:"eth_newBlockFilter"}),n=await e.request({method:"eth_newBlockFilter"});return{id:n,request:t(n),type:"block"}}class CT extends ee{constructor(t){super(`Filter type "${t}" is not supported.`,{name:"FilterTypeNotSupportedError"})}}const O2="/docs/contract/encodeEventTopics";function _u(e){var c;const{abi:t,eventName:n,args:r}=e;let i=t[0];if(n){const u=Hs({abi:t,name:n});if(!u)throw new qw(n,{docsPath:O2});i=u}if(i.type!=="event")throw new qw(void 0,{docsPath:O2});const s=kr(i),o=ud(s);let a=[];if(r&&"inputs"in i){const u=(c=i.inputs)==null?void 0:c.filter(d=>"indexed"in d&&d.indexed),l=Array.isArray(r)?r:Object.values(r).length>0?(u==null?void 0:u.map(d=>r[d.name]))??[]:[];l.length>0&&(a=(u==null?void 0:u.map((d,f)=>Array.isArray(l[f])?l[f].map((h,m)=>M2({param:d,value:l[f][m]})):typeof l[f]<"u"&&l[f]!==null?M2({param:d,value:l[f]}):null))??[])}return[o,...a]}function M2({param:e,value:t}){if(e.type==="string"||e.type==="bytes")return xt(ea(t));if(e.type==="tuple"||e.type.match(/^(.*)\[(\d+)?\]$/))throw new CT(e.type);return zn([e],[t])}async function B2(e,t){const{address:n,abi:r,args:i,eventName:s,fromBlock:o,strict:a,toBlock:c}=t,u=Sd(e,{method:"eth_newFilter"}),l=s?_u({abi:r,args:i,eventName:s}):void 0,d=await e.request({method:"eth_newFilter",params:[{address:n,fromBlock:typeof o=="bigint"?oe(o):o,toBlock:typeof c=="bigint"?oe(c):c,topics:l}]});return{abi:r,args:i,eventName:s,id:d,request:u(d),strict:!!a,type:"event"}}async function N2(e,{address:t,args:n,event:r,events:i,fromBlock:s,strict:o,toBlock:a}={}){const c=i??(r?[r]:void 0),u=Sd(e,{method:"eth_newFilter"});let l=[];c&&(l=[c.flatMap(h=>_u({abi:[h],eventName:h.name,args:n}))],r&&(l=l[0]));const d=await e.request({method:"eth_newFilter",params:[{address:t,fromBlock:typeof s=="bigint"?oe(s):s,toBlock:typeof a=="bigint"?oe(a):a,...l.length?{topics:l}:{}}]});return{abi:c,args:n,eventName:r?r.name:void 0,fromBlock:s,id:d,request:u(d),strict:!!o,toBlock:a,type:"event"}}async function L2(e){const t=Sd(e,{method:"eth_newPendingTransactionFilter"}),n=await e.request({method:"eth_newPendingTransactionFilter"});return{id:n,request:t(n),type:"transaction"}}function PT(e){const t=xt(`0x${e.substring(4)}`).substring(26);return od(`0x${t}`)}async function RT({hash:e,signature:t}){const n=pn(e)?e:tn(e),{secp256k1:r}=await Promise.resolve().then(()=>i9);return`0x${(()=>{if(typeof t=="object"&&"r"in t&&"s"in t){const{r:u,s:l,v:d,yParity:f}=t,h=Number(f??d),m=j2(h);return new r.Signature(It(u),It(l)).addRecoveryBit(m)}const o=pn(t)?t:tn(t);if(Et(o)!==65)throw new Error("invalid signature length");const a=Pn(`0x${o.slice(130)}`),c=j2(a);return r.Signature.fromCompact(o.substring(2,130)).addRecoveryBit(c)})().recoverPublicKey(n.substring(2)).toHex(!1)}`}function j2(e){if(e===0||e===1)return e;if(e===27)return 0;if(e===28)return 1;throw new Error("Invalid yParityOrV value")}async function Up({hash:e,signature:t}){return PT(await RT({hash:e,signature:t}))}function is(e,t="hex"){const n=$2(e),r=K0(new Uint8Array(n.length));return n.encode(r),t==="hex"?Jt(r.bytes):r.bytes}function $2(e){return Array.isArray(e)?TT(e.map(t=>$2(t))):OT(e)}function TT(e){const t=e.reduce((i,s)=>i+s.length,0),n=F2(t);return{length:t<=55?1+t:1+n+t,encode(i){t<=55?i.pushByte(192+t):(i.pushByte(247+n),n===1?i.pushUint8(t):n===2?i.pushUint16(t):n===3?i.pushUint24(t):i.pushUint32(t));for(const{encode:s}of e)s(i)}}}function OT(e){const t=typeof e=="string"?Rn(e):e,n=F2(t.length);return{length:t.length===1&&t[0]<128?1:t.length<=55?1+t.length:1+n+t.length,encode(i){t.length===1&&t[0]<128?i.pushBytes(t):t.length<=55?(i.pushByte(128+t.length),i.pushBytes(t)):(i.pushByte(183+n),n===1?i.pushUint8(t.length):n===2?i.pushUint16(t.length):n===3?i.pushUint24(t.length):i.pushUint32(t.length),i.pushBytes(t))}}}function F2(e){if(e<2**8)return 1;if(e<2**16)return 2;if(e<2**24)return 3;if(e<2**32)return 4;throw new ee("Length is too large.")}function MT(e){const{chainId:t,nonce:n,to:r}=e,i=e.contractAddress??e.address,s=xt(Hn(["0x05",is([t?oe(t):"0x",i,n?oe(n):"0x"])]));return r==="bytes"?Rn(s):s}async function Hp(e){const{authorization:t,signature:n}=e;return Up({hash:MT(t),signature:n??t})}class BT extends ee{constructor(t,{account:n,docsPath:r,chain:i,data:s,gas:o,gasPrice:a,maxFeePerGas:c,maxPriorityFeePerGas:u,nonce:l,to:d,value:f}){var m;const h=ha({from:n==null?void 0:n.address,to:d,value:typeof f<"u"&&`${dd(f)} ${((m=i==null?void 0:i.nativeCurrency)==null?void 0:m.symbol)||"ETH"}`,data:s,gas:o,gasPrice:typeof a<"u"&&`${xn(a)} gwei`,maxFeePerGas:typeof c<"u"&&`${xn(c)} gwei`,maxPriorityFeePerGas:typeof u<"u"&&`${xn(u)} gwei`,nonce:l});super(t.shortMessage,{cause:t,docsPath:r,metaMessages:[...t.metaMessages?[...t.metaMessages," "]:[],"Estimate Gas Arguments:",h].filter(Boolean),name:"EstimateGasExecutionError"}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.cause=t}}function NT(e,{docsPath:t,...n}){const r=(()=>{const i=_d(e,n);return i instanceof bu?e:i})();return new BT(r,{docsPath:t,...n})}class D2 extends ee{constructor(){super("`baseFeeMultiplier` must be greater than 1.",{name:"BaseFeeScalarError"})}}class zp extends ee{constructor(){super("Chain does not support EIP-1559 fees.",{name:"Eip1559FeesNotSupportedError"})}}class LT extends ee{constructor({maxPriorityFeePerGas:t}){super(`\`maxFeePerGas\` cannot be less than the \`maxPriorityFeePerGas\` (${xn(t)} gwei).`,{name:"MaxFeePerGasTooLowError"})}}class U2 extends ee{constructor({blockHash:t,blockNumber:n}){let r="Block";t&&(r=`Block at hash "${t}"`),n&&(r=`Block at number "${n}"`),super(`${r} could not be found.`,{name:"BlockNotFoundError"})}}const H2={"0x0":"legacy","0x1":"eip2930","0x2":"eip1559","0x3":"eip4844","0x4":"eip7702"};function Eu(e,t){const n={...e,blockHash:e.blockHash?e.blockHash:null,blockNumber:e.blockNumber?BigInt(e.blockNumber):null,chainId:e.chainId?Pn(e.chainId):void 0,gas:e.gas?BigInt(e.gas):void 0,gasPrice:e.gasPrice?BigInt(e.gasPrice):void 0,maxFeePerBlobGas:e.maxFeePerBlobGas?BigInt(e.maxFeePerBlobGas):void 0,maxFeePerGas:e.maxFeePerGas?BigInt(e.maxFeePerGas):void 0,maxPriorityFeePerGas:e.maxPriorityFeePerGas?BigInt(e.maxPriorityFeePerGas):void 0,nonce:e.nonce?Pn(e.nonce):void 0,to:e.to?e.to:null,transactionIndex:e.transactionIndex?Number(e.transactionIndex):null,type:e.type?H2[e.type]:void 0,typeHex:e.type?e.type:void 0,value:e.value?BigInt(e.value):void 0,v:e.v?BigInt(e.v):void 0};return e.authorizationList&&(n.authorizationList=$T(e.authorizationList)),n.yParity=(()=>{if(e.yParity)return Number(e.yParity);if(typeof n.v=="bigint"){if(n.v===0n||n.v===27n)return 0;if(n.v===1n||n.v===28n)return 1;if(n.v>=35n)return n.v%2n===0n?1:0}})(),n.type==="legacy"&&(delete n.accessList,delete n.maxFeePerBlobGas,delete n.maxFeePerGas,delete n.maxPriorityFeePerGas,delete n.yParity),n.type==="eip2930"&&(delete n.maxFeePerBlobGas,delete n.maxFeePerGas,delete n.maxPriorityFeePerGas),n.type==="eip1559"&&delete n.maxFeePerBlobGas,n}const jT=Lp("transaction",Eu);function $T(e){return e.map(t=>({address:t.address,chainId:Number(t.chainId),nonce:Number(t.nonce),r:t.r,s:t.s,yParity:Number(t.yParity)}))}function Wp(e,t){const n=(e.transactions??[]).map(r=>typeof r=="string"?r:Eu(r));return{...e,baseFeePerGas:e.baseFeePerGas?BigInt(e.baseFeePerGas):null,blobGasUsed:e.blobGasUsed?BigInt(e.blobGasUsed):void 0,difficulty:e.difficulty?BigInt(e.difficulty):void 0,excessBlobGas:e.excessBlobGas?BigInt(e.excessBlobGas):void 0,gasLimit:e.gasLimit?BigInt(e.gasLimit):void 0,gasUsed:e.gasUsed?BigInt(e.gasUsed):void 0,hash:e.hash?e.hash:null,logsBloom:e.logsBloom?e.logsBloom:null,nonce:e.nonce?e.nonce:null,number:e.number?BigInt(e.number):null,size:e.size?BigInt(e.size):void 0,timestamp:e.timestamp?BigInt(e.timestamp):void 0,transactions:n,totalDifficulty:e.totalDifficulty?BigInt(e.totalDifficulty):null}}const FT=Lp("block",Wp);async function Pr(e,{blockHash:t,blockNumber:n,blockTag:r=e.experimental_blockTag??"latest",includeTransactions:i}={}){var u,l,d;const s=i??!1,o=n!==void 0?oe(n):void 0;let a=null;if(t?a=await e.request({method:"eth_getBlockByHash",params:[t,s]},{dedupe:!0}):a=await e.request({method:"eth_getBlockByNumber",params:[o||r,s]},{dedupe:!!o}),!a)throw new U2({blockHash:t,blockNumber:n});return(((d=(l=(u=e.chain)==null?void 0:u.formatters)==null?void 0:l.block)==null?void 0:d.format)||Wp)(a,"getBlock")}async function Gp(e){const t=await e.request({method:"eth_gasPrice"});return BigInt(t)}async function DT(e,t){return z2(e,t)}async function z2(e,t){var s,o;const{block:n,chain:r=e.chain,request:i}=t||{};try{const a=((s=r==null?void 0:r.fees)==null?void 0:s.maxPriorityFeePerGas)??((o=r==null?void 0:r.fees)==null?void 0:o.defaultPriorityFee);if(typeof a=="function"){const u=n||await ve(e,Pr,"getBlock")({}),l=await a({block:u,client:e,request:i});if(l===null)throw new Error;return l}if(typeof a<"u")return a;const c=await e.request({method:"eth_maxPriorityFeePerGas"});return It(c)}catch{const[a,c]=await Promise.all([n?Promise.resolve(n):ve(e,Pr,"getBlock")({}),ve(e,Gp,"getGasPrice")({})]);if(typeof a.baseFeePerGas!="bigint")throw new zp;const u=c-a.baseFeePerGas;return u<0n?0n:u}}async function W2(e,t){return qp(e,t)}async function qp(e,t){var f,h;const{block:n,chain:r=e.chain,request:i,type:s="eip1559"}=t||{},o=await(async()=>{var m,y;return typeof((m=r==null?void 0:r.fees)==null?void 0:m.baseFeeMultiplier)=="function"?r.fees.baseFeeMultiplier({block:n,client:e,request:i}):((y=r==null?void 0:r.fees)==null?void 0:y.baseFeeMultiplier)??1.2})();if(o<1)throw new D2;const c=10**(((f=o.toString().split(".")[1])==null?void 0:f.length)??0),u=m=>m*BigInt(Math.ceil(o*c))/BigInt(c),l=n||await ve(e,Pr,"getBlock")({});if(typeof((h=r==null?void 0:r.fees)==null?void 0:h.estimateFeesPerGas)=="function"){const m=await r.fees.estimateFeesPerGas({block:n,client:e,multiply:u,request:i,type:s});if(m!==null)return m}if(s==="eip1559"){if(typeof l.baseFeePerGas!="bigint")throw new zp;const m=typeof(i==null?void 0:i.maxPriorityFeePerGas)=="bigint"?i.maxPriorityFeePerGas:await z2(e,{block:l,chain:r,request:i}),y=u(l.baseFeePerGas);return{maxFeePerGas:(i==null?void 0:i.maxFeePerGas)??y+m,maxPriorityFeePerGas:m}}return{gasPrice:(i==null?void 0:i.gasPrice)??u(await ve(e,Gp,"getGasPrice")({}))}}async function Vp(e,{address:t,blockTag:n="latest",blockNumber:r}){const i=await e.request({method:"eth_getTransactionCount",params:[t,typeof r=="bigint"?oe(r):n]},{dedupe:!!r});return Pn(i)}function Kp(e){const{kzg:t}=e,n=e.to??(typeof e.blobs[0]=="string"?"hex":"bytes"),r=typeof e.blobs[0]=="string"?e.blobs.map(s=>Rn(s)):e.blobs,i=[];for(const s of r)i.push(Uint8Array.from(t.blobToKzgCommitment(s)));return n==="bytes"?i:i.map(s=>Jt(s))}function Jp(e){const{kzg:t}=e,n=e.to??(typeof e.blobs[0]=="string"?"hex":"bytes"),r=typeof e.blobs[0]=="string"?e.blobs.map(o=>Rn(o)):e.blobs,i=typeof e.commitments[0]=="string"?e.commitments.map(o=>Rn(o)):e.commitments,s=[];for(let o=0;o<r.length;o++){const a=r[o],c=i[o];s.push(Uint8Array.from(t.computeBlobKzgProof(a,c)))}return n==="bytes"?s:s.map(o=>Jt(o))}function UT(e,t,n,r){if(typeof e.setBigUint64=="function")return e.setBigUint64(t,n,r);const i=BigInt(32),s=BigInt(4294967295),o=Number(n>>i&s),a=Number(n&s),c=r?4:0,u=r?0:4;e.setUint32(t+c,o,r),e.setUint32(t+u,a,r)}function HT(e,t,n){return e&t^~e&n}function zT(e,t,n){return e&t^e&n^t&n}let G2=class extends W0{constructor(t,n,r,i){super(),this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.blockLen=t,this.outputLen=n,this.padOffset=r,this.isLE=i,this.buffer=new Uint8Array(t),this.view=z0(this.buffer)}update(t){sa(this),t=id(t),bi(t);const{view:n,buffer:r,blockLen:i}=this,s=t.length;for(let o=0;o<s;){const a=Math.min(i-this.pos,s-o);if(a===i){const c=z0(t);for(;i<=s-o;o+=i)this.process(c,o);continue}r.set(t.subarray(o,o+a),this.pos),this.pos+=a,o+=a,this.pos===i&&(this.process(n,0),this.pos=0)}return this.length+=t.length,this.roundClean(),this}digestInto(t){sa(this),sv(t,this),this.finished=!0;const{buffer:n,view:r,blockLen:i,isLE:s}=this;let{pos:o}=this;n[o++]=128,es(this.buffer.subarray(o)),this.padOffset>i-o&&(this.process(r,0),o=0);for(let d=o;d<i;d++)n[d]=0;UT(r,i-8,BigInt(this.length*8),s),this.process(r,0);const a=z0(t),c=this.outputLen;if(c%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const u=c/4,l=this.get();if(u>l.length)throw new Error("_sha2: outputLen bigger than state");for(let d=0;d<u;d++)a.setUint32(4*d,l[d],s)}digest(){const{buffer:t,outputLen:n}=this;this.digestInto(t);const r=t.slice(0,n);return this.destroy(),r}_cloneInto(t){t||(t=new this.constructor),t.set(...this.get());const{blockLen:n,buffer:r,length:i,finished:s,destroyed:o,pos:a}=this;return t.destroyed=o,t.finished=s,t.length=i,t.pos=a,i%n&&t.buffer.set(r),t}clone(){return this._cloneInto()}};const ss=Uint32Array.from([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),Sn=Uint32Array.from([3418070365,3238371032,1654270250,914150663,2438529370,812702999,355462360,4144912697,1731405415,4290775857,2394180231,1750603025,3675008525,1694076839,1203062813,3204075428]),kn=Uint32Array.from([1779033703,4089235720,3144134277,2227873595,1013904242,4271175723,2773480762,1595750129,1359893119,2917565137,2600822924,725511199,528734635,4215389547,1541459225,327033209]),WT=Uint32Array.from([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]),os=new Uint32Array(64);let GT=class extends G2{constructor(t=32){super(64,t,8,!1),this.A=ss[0]|0,this.B=ss[1]|0,this.C=ss[2]|0,this.D=ss[3]|0,this.E=ss[4]|0,this.F=ss[5]|0,this.G=ss[6]|0,this.H=ss[7]|0}get(){const{A:t,B:n,C:r,D:i,E:s,F:o,G:a,H:c}=this;return[t,n,r,i,s,o,a,c]}set(t,n,r,i,s,o,a,c){this.A=t|0,this.B=n|0,this.C=r|0,this.D=i|0,this.E=s|0,this.F=o|0,this.G=a|0,this.H=c|0}process(t,n){for(let d=0;d<16;d++,n+=4)os[d]=t.getUint32(n,!1);for(let d=16;d<64;d++){const f=os[d-15],h=os[d-2],m=qr(f,7)^qr(f,18)^f>>>3,y=qr(h,17)^qr(h,19)^h>>>10;os[d]=y+os[d-7]+m+os[d-16]|0}let{A:r,B:i,C:s,D:o,E:a,F:c,G:u,H:l}=this;for(let d=0;d<64;d++){const f=qr(a,6)^qr(a,11)^qr(a,25),h=l+f+HT(a,c,u)+WT[d]+os[d]|0,y=(qr(r,2)^qr(r,13)^qr(r,22))+zT(r,i,s)|0;l=u,u=c,c=a,a=o+h|0,o=s,s=i,i=r,r=h+y|0}r=r+this.A|0,i=i+this.B|0,s=s+this.C|0,o=o+this.D|0,a=a+this.E|0,c=c+this.F|0,u=u+this.G|0,l=l+this.H|0,this.set(r,i,s,o,a,c,u,l)}roundClean(){es(os)}destroy(){this.set(0,0,0,0,0,0,0,0),es(this.buffer)}};const q2=tv(["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(e=>BigInt(e))),qT=q2[0],VT=q2[1],as=new Uint32Array(80),cs=new Uint32Array(80);let V2=class extends G2{constructor(t=64){super(128,t,16,!1),this.Ah=kn[0]|0,this.Al=kn[1]|0,this.Bh=kn[2]|0,this.Bl=kn[3]|0,this.Ch=kn[4]|0,this.Cl=kn[5]|0,this.Dh=kn[6]|0,this.Dl=kn[7]|0,this.Eh=kn[8]|0,this.El=kn[9]|0,this.Fh=kn[10]|0,this.Fl=kn[11]|0,this.Gh=kn[12]|0,this.Gl=kn[13]|0,this.Hh=kn[14]|0,this.Hl=kn[15]|0}get(){const{Ah:t,Al:n,Bh:r,Bl:i,Ch:s,Cl:o,Dh:a,Dl:c,Eh:u,El:l,Fh:d,Fl:f,Gh:h,Gl:m,Hh:y,Hl:w}=this;return[t,n,r,i,s,o,a,c,u,l,d,f,h,m,y,w]}set(t,n,r,i,s,o,a,c,u,l,d,f,h,m,y,w){this.Ah=t|0,this.Al=n|0,this.Bh=r|0,this.Bl=i|0,this.Ch=s|0,this.Cl=o|0,this.Dh=a|0,this.Dl=c|0,this.Eh=u|0,this.El=l|0,this.Fh=d|0,this.Fl=f|0,this.Gh=h|0,this.Gl=m|0,this.Hh=y|0,this.Hl=w|0}process(t,n){for(let v=0;v<16;v++,n+=4)as[v]=t.getUint32(n),cs[v]=t.getUint32(n+=4);for(let v=16;v<80;v++){const S=as[v-15]|0,I=cs[v-15]|0,N=ta(S,I,1)^ta(S,I,8)^nv(S,I,7),j=na(S,I,1)^na(S,I,8)^rv(S,I,7),U=as[v-2]|0,L=cs[v-2]|0,Y=ta(U,L,19)^ed(U,L,61)^nv(U,L,6),Z=na(U,L,19)^td(U,L,61)^rv(U,L,6),G=bC(j,Z,cs[v-7],cs[v-16]),C=wC(G,N,Y,as[v-7],as[v-16]);as[v]=C|0,cs[v]=G|0}let{Ah:r,Al:i,Bh:s,Bl:o,Ch:a,Cl:c,Dh:u,Dl:l,Eh:d,El:f,Fh:h,Fl:m,Gh:y,Gl:w,Hh:b,Hl:x}=this;for(let v=0;v<80;v++){const S=ta(d,f,14)^ta(d,f,18)^ed(d,f,41),I=na(d,f,14)^na(d,f,18)^td(d,f,41),N=d&h^~d&y,j=f&m^~f&w,U=vC(x,I,j,VT[v],cs[v]),L=_C(U,b,S,N,qT[v],as[v]),Y=U|0,Z=ta(r,i,28)^ed(r,i,34)^ed(r,i,39),G=na(r,i,28)^td(r,i,34)^td(r,i,39),C=r&s^r&a^s&a,p=i&o^i&c^o&c;b=y|0,x=w|0,y=h|0,w=m|0,h=d|0,m=f|0,{h:d,l:f}=yi(u|0,l|0,L|0,Y|0),u=a|0,l=c|0,a=s|0,c=o|0,s=r|0,o=i|0;const g=gC(Y,G,p);r=yC(g,L,Z,C),i=g|0}({h:r,l:i}=yi(this.Ah|0,this.Al|0,r|0,i|0)),{h:s,l:o}=yi(this.Bh|0,this.Bl|0,s|0,o|0),{h:a,l:c}=yi(this.Ch|0,this.Cl|0,a|0,c|0),{h:u,l}=yi(this.Dh|0,this.Dl|0,u|0,l|0),{h:d,l:f}=yi(this.Eh|0,this.El|0,d|0,f|0),{h,l:m}=yi(this.Fh|0,this.Fl|0,h|0,m|0),{h:y,l:w}=yi(this.Gh|0,this.Gl|0,y|0,w|0),{h:b,l:x}=yi(this.Hh|0,this.Hl|0,b|0,x|0),this.set(r,i,s,o,a,c,u,l,d,f,h,m,y,w,b,x)}roundClean(){es(as,cs)}destroy(){es(this.buffer),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}};class KT extends V2{constructor(){super(48),this.Ah=Sn[0]|0,this.Al=Sn[1]|0,this.Bh=Sn[2]|0,this.Bl=Sn[3]|0,this.Ch=Sn[4]|0,this.Cl=Sn[5]|0,this.Dh=Sn[6]|0,this.Dl=Sn[7]|0,this.Eh=Sn[8]|0,this.El=Sn[9]|0,this.Fh=Sn[10]|0,this.Fl=Sn[11]|0,this.Gh=Sn[12]|0,this.Gl=Sn[13]|0,this.Hh=Sn[14]|0,this.Hl=Sn[15]|0}}const Zp=sd(()=>new GT),JT=sd(()=>new V2),ZT=sd(()=>new KT),K2=Zp;function YT(e,t){return K2(pn(e,{strict:!1})?ea(e):e)}function QT(e){const{commitment:t,version:n=1}=e,r=e.to??(typeof t=="string"?"hex":"bytes"),i=YT(t);return i.set([n],0),r==="bytes"?i:Jt(i)}function J2(e){const{commitments:t,version:n}=e,r=e.to??(typeof t[0]=="string"?"hex":"bytes"),i=[];for(const s of t)i.push(QT({commitment:s,to:r,version:n}));return i}const Z2=6,Y2=32,Yp=4096,Q2=Y2*Yp,X2=Q2*Z2-1-1*Yp*Z2,e_=1;class XT extends ee{constructor({maxSize:t,size:n}){super("Blob size is too large.",{metaMessages:[`Max: ${t} bytes`,`Given: ${n} bytes`],name:"BlobSizeTooLargeError"})}}class t_ extends ee{constructor(){super("Blob data must not be empty.",{name:"EmptyBlobError"})}}class eO extends ee{constructor({hash:t,size:n}){super(`Versioned hash "${t}" size is invalid.`,{metaMessages:["Expected: 32",`Received: ${n}`],name:"InvalidVersionedHashSizeError"})}}class tO extends ee{constructor({hash:t,version:n}){super(`Versioned hash "${t}" version is invalid.`,{metaMessages:[`Expected: ${e_}`,`Received: ${n}`],name:"InvalidVersionedHashVersionError"})}}function nO(e){const t=e.to??(typeof e.data=="string"?"hex":"bytes"),n=typeof e.data=="string"?Rn(e.data):e.data,r=Et(n);if(!r)throw new t_;if(r>X2)throw new XT({maxSize:X2,size:r});const i=[];let s=!0,o=0;for(;s;){const a=K0(new Uint8Array(Q2));let c=0;for(;c<Yp;){const u=n.slice(o,o+(Y2-1));if(a.pushByte(0),a.pushBytes(u),u.length<31){a.pushByte(128),s=!1;break}c++,o+=31}i.push(a)}return t==="bytes"?i.map(a=>a.bytes):i.map(a=>Jt(a.bytes))}function n_(e){const{data:t,kzg:n,to:r}=e,i=e.blobs??nO({data:t,to:r}),s=e.commitments??Kp({blobs:i,kzg:n,to:r}),o=e.proofs??Jp({blobs:i,commitments:s,kzg:n,to:r}),a=[];for(let c=0;c<i.length;c++)a.push({blob:i[c],commitment:s[c],proof:o[c]});return a}function r_(e){if(e.type)return e.type;if(typeof e.authorizationList<"u")return"eip7702";if(typeof e.blobs<"u"||typeof e.blobVersionedHashes<"u"||typeof e.maxFeePerBlobGas<"u"||typeof e.sidecars<"u")return"eip4844";if(typeof e.maxFeePerGas<"u"||typeof e.maxPriorityFeePerGas<"u")return"eip1559";if(typeof e.gasPrice<"u")return typeof e.accessList<"u"?"eip2930":"legacy";throw new uR({transaction:e})}function i_(e,{docsPath:t,...n}){const r=(()=>{const i=_d(e,n);return i instanceof bu?e:i})();return new dR(r,{docsPath:t,...n})}async function Xs(e){const t=await e.request({method:"eth_chainId"},{dedupe:!0});return Pn(t)}async function s_(e,t){var U,L,Y,Z,G;const{account:n=e.account,accessList:r,authorizationList:i,chain:s=e.chain,blobVersionedHashes:o,blobs:a,data:c,gas:u,gasPrice:l,maxFeePerBlobGas:d,maxFeePerGas:f,maxPriorityFeePerGas:h,nonce:m,nonceManager:y,to:w,type:b,value:x,...v}=t,S=await(async()=>{if(!n||!y||typeof m<"u")return m;const C=Ut(n),p=s?s.id:await ve(e,Xs,"getChainId")({});return await y.consume({address:C.address,chainId:p,client:e})})();Ys(t);const I=(L=(U=s==null?void 0:s.formatters)==null?void 0:U.transactionRequest)==null?void 0:L.format,j=(I||ba)({...wu(v,{format:I}),account:n?Ut(n):void 0,accessList:r,authorizationList:i,blobs:a,blobVersionedHashes:o,data:c,gas:u,gasPrice:l,maxFeePerBlobGas:d,maxFeePerGas:f,maxPriorityFeePerGas:h,nonce:S,to:w,type:b,value:x},"fillTransaction");try{const C=await e.request({method:"eth_fillTransaction",params:[j]}),g=(((Z=(Y=s==null?void 0:s.formatters)==null?void 0:Y.transaction)==null?void 0:Z.format)||Eu)(C.tx);delete g.blockHash,delete g.blockNumber,delete g.r,delete g.s,delete g.transactionIndex,delete g.v,delete g.yParity,g.data=g.input,g.gas&&(g.gas=t.gas??g.gas),g.gasPrice&&(g.gasPrice=t.gasPrice??g.gasPrice),g.maxFeePerBlobGas&&(g.maxFeePerBlobGas=t.maxFeePerBlobGas??g.maxFeePerBlobGas),g.maxFeePerGas&&(g.maxFeePerGas=t.maxFeePerGas??g.maxFeePerGas),g.maxPriorityFeePerGas&&(g.maxPriorityFeePerGas=t.maxPriorityFeePerGas??g.maxPriorityFeePerGas),g.nonce&&(g.nonce=t.nonce??g.nonce);const k=await(async()=>{var $,O;if(typeof(($=s==null?void 0:s.fees)==null?void 0:$.baseFeeMultiplier)=="function"){const _=await ve(e,Pr,"getBlock")({});return s.fees.baseFeeMultiplier({block:_,client:e,request:t})}return((O=s==null?void 0:s.fees)==null?void 0:O.baseFeeMultiplier)??1.2})();if(k<1)throw new D2;const T=10**(((G=k.toString().split(".")[1])==null?void 0:G.length)??0),M=$=>$*BigInt(Math.ceil(k*T))/BigInt(T);return g.maxFeePerGas&&!t.maxFeePerGas&&(g.maxFeePerGas=M(g.maxFeePerGas)),g.gasPrice&&!t.gasPrice&&(g.gasPrice=M(g.gasPrice)),{raw:C.raw,transaction:{from:j.from,...g}}}catch(C){throw i_(C,{...t,chain:e.chain})}}const o_=["blobVersionedHashes","chainId","fees","gas","nonce","type"],a_=new Map,Qp=new aa(128);async function Xp(e,t){var S,I,N;let n=t;n.account??(n.account=e.account),n.parameters??(n.parameters=o_);const{account:r,chain:i=e.chain,nonceManager:s,parameters:o}=n,a=(()=>{if(typeof(i==null?void 0:i.prepareTransactionRequest)=="function")return{fn:i.prepareTransactionRequest,runAt:["beforeFillTransaction"]};if(Array.isArray(i==null?void 0:i.prepareTransactionRequest))return{fn:i.prepareTransactionRequest[0],runAt:i.prepareTransactionRequest[1].runAt}})();let c;async function u(){return c||(typeof n.chainId<"u"?n.chainId:i?i.id:(c=await ve(e,Xs,"getChainId")({}),c))}const l=r&&Ut(r);let d=n.nonce;if(o.includes("nonce")&&typeof d>"u"&&l&&s){const j=await u();d=await s.consume({address:l.address,chainId:j,client:e})}a!=null&&a.fn&&((S=a.runAt)!=null&&S.includes("beforeFillTransaction"))&&(n=await a.fn({...n,chain:i},{phase:"beforeFillTransaction"}),d??(d=n.nonce));const h=((o.includes("blobVersionedHashes")||o.includes("sidecars"))&&n.kzg&&n.blobs||Qp.get(e.uid)===!1||!["fees","gas"].some(U=>o.includes(U))?!1:!!(o.includes("chainId")&&typeof n.chainId!="number"||o.includes("nonce")&&typeof d!="number"||o.includes("fees")&&typeof n.gasPrice!="bigint"&&(typeof n.maxFeePerGas!="bigint"||typeof n.maxPriorityFeePerGas!="bigint")||o.includes("gas")&&typeof n.gas!="bigint"))?await ve(e,s_,"fillTransaction")({...n,nonce:d}).then(j=>{const{chainId:U,from:L,gas:Y,gasPrice:Z,nonce:G,maxFeePerBlobGas:C,maxFeePerGas:p,maxPriorityFeePerGas:g,type:k,...R}=j.transaction;return Qp.set(e.uid,!0),{...n,...L?{from:L}:{},...k&&!n.type?{type:k}:{},...typeof U<"u"?{chainId:U}:{},...typeof Y<"u"?{gas:Y}:{},...typeof Z<"u"?{gasPrice:Z}:{},...typeof G<"u"?{nonce:G}:{},...typeof C<"u"&&n.type!=="legacy"&&n.type!=="eip2930"?{maxFeePerBlobGas:C}:{},...typeof p<"u"&&n.type!=="legacy"&&n.type!=="eip2930"?{maxFeePerGas:p}:{},...typeof g<"u"&&n.type!=="legacy"&&n.type!=="eip2930"?{maxPriorityFeePerGas:g}:{},..."nonceKey"in R&&typeof R.nonceKey<"u"?{nonceKey:R.nonceKey}:{},..."keyAuthorization"in R&&typeof R.keyAuthorization<"u"&&R.keyAuthorization!==null&&!("keyAuthorization"in n)?{keyAuthorization:R.keyAuthorization}:{}}}).catch(j=>{var Z,G;const U=j;if(U.name!=="TransactionExecutionError")return n;if((Z=U.walk)==null?void 0:Z.call(U,C=>C.name==="ExecutionRevertedError"))throw j;return((G=U.walk)==null?void 0:G.call(U,C=>{var g;const p=C;return p.name==="MethodNotFoundRpcError"||p.name==="MethodNotSupportedRpcError"||((g=p.message)==null?void 0:g.includes("eth_fillTransaction is not available"))}))&&Qp.set(e.uid,!1),n}):n;d??(d=h.nonce),n={...h,...l?{from:l==null?void 0:l.address}:{},...d?{nonce:d}:{}};const{blobs:m,gas:y,kzg:w,type:b}=n;a!=null&&a.fn&&((I=a.runAt)!=null&&I.includes("beforeFillParameters"))&&(n=await a.fn({...n,chain:i},{phase:"beforeFillParameters"}));let x;async function v(){return x||(x=await ve(e,Pr,"getBlock")({blockTag:"latest"}),x)}if(o.includes("nonce")&&typeof d>"u"&&l&&!s&&(n.nonce=await ve(e,Vp,"getTransactionCount")({address:l.address,blockTag:"pending"})),(o.includes("blobVersionedHashes")||o.includes("sidecars"))&&m&&w){const j=Kp({blobs:m,kzg:w});if(o.includes("blobVersionedHashes")){const U=J2({commitments:j,to:"hex"});n.blobVersionedHashes=U}if(o.includes("sidecars")){const U=Jp({blobs:m,commitments:j,kzg:w}),L=n_({blobs:m,commitments:j,proofs:U,to:"hex"});n.sidecars=L}}if(o.includes("chainId")&&(n.chainId=await u()),(o.includes("fees")||o.includes("type"))&&typeof b>"u")try{n.type=r_(n)}catch{let j=a_.get(e.uid);if(typeof j>"u"){const U=await v();j=typeof(U==null?void 0:U.baseFeePerGas)=="bigint",a_.set(e.uid,j)}n.type=j?"eip1559":"legacy"}if(o.includes("fees"))if(n.type!=="legacy"&&n.type!=="eip2930"){if(typeof n.maxFeePerGas>"u"||typeof n.maxPriorityFeePerGas>"u"){const j=await v(),{maxFeePerGas:U,maxPriorityFeePerGas:L}=await qp(e,{block:j,chain:i,request:n});if(typeof n.maxPriorityFeePerGas>"u"&&n.maxFeePerGas&&n.maxFeePerGas<L)throw new LT({maxPriorityFeePerGas:L});n.maxPriorityFeePerGas=L,n.maxFeePerGas=U}}else{if(typeof n.maxFeePerGas<"u"||typeof n.maxPriorityFeePerGas<"u")throw new zp;if(typeof n.gasPrice>"u"){const j=await v(),{gasPrice:U}=await qp(e,{block:j,chain:i,request:n,type:"legacy"});n.gasPrice=U}}return o.includes("gas")&&typeof y>"u"&&(n.gas=await ve(e,em,"estimateGas")({...n,account:l,prepare:(l==null?void 0:l.type)==="local"?[]:["blobVersionedHashes"]})),a!=null&&a.fn&&((N=a.runAt)!=null&&N.includes("afterFillParameters"))&&(n=await a.fn({...n,chain:i},{phase:"afterFillParameters"})),Ys(n),delete n.parameters,n}async function em(e,t){var o,a,c;const{account:n=e.account,prepare:r=!0}=t,i=n?Ut(n):void 0,s=(()=>{if(Array.isArray(r))return r;if((i==null?void 0:i.type)!=="local")return["blobVersionedHashes"]})();try{const u=await(async()=>{if(t.to)return t.to;if(t.authorizationList&&t.authorizationList.length>0)return await Hp({authorization:t.authorizationList[0]}).catch(()=>{throw new ee("`to` is required. Could not infer from `authorizationList`")})})(),{accessList:l,authorizationList:d,blobs:f,blobVersionedHashes:h,blockNumber:m,blockTag:y,data:w,gas:b,gasPrice:x,maxFeePerBlobGas:v,maxFeePerGas:S,maxPriorityFeePerGas:I,nonce:N,value:j,stateOverride:U,...L}=r?await Xp(e,{...t,parameters:s,to:u}):t;if(b&&t.gas!==b)return b;const Z=(typeof m=="bigint"?oe(m):void 0)||y,G=Ed(U);Ys(t);const C=(c=(a=(o=e.chain)==null?void 0:o.formatters)==null?void 0:a.transactionRequest)==null?void 0:c.format,g=(C||ba)({...wu(L,{format:C}),account:i,accessList:l,authorizationList:d,blobs:f,blobVersionedHashes:h,data:w,gasPrice:x,maxFeePerBlobGas:v,maxFeePerGas:S,maxPriorityFeePerGas:I,nonce:N,to:u,value:j},"estimateGas");return BigInt(await e.request({method:"eth_estimateGas",params:G?[g,Z??e.experimental_blockTag??"latest",G]:Z?[g,Z]:[g]}))}catch(u){throw NT(u,{...t,account:i,chain:e.chain})}}async function rO(e,t){var u;const{abi:n,address:r,args:i,functionName:s,dataSuffix:o=typeof e.dataSuffix=="string"?e.dataSuffix:(u=e.dataSuffix)==null?void 0:u.value,...a}=t,c=jt({abi:n,args:i,functionName:s});try{return await ve(e,em,"estimateGas")({data:`${c}${o?o.replace("0x",""):""}`,to:r,...a})}catch(l){const d=a.account?Ut(a.account):void 0;throw qs(l,{abi:n,address:r,args:i,docsPath:"/docs/contract/estimateContractGas",functionName:s,sender:d==null?void 0:d.address})}}async function c_(e,{address:t,blockNumber:n,blockTag:r=e.experimental_blockTag??"latest"}){var o,a,c;if((o=e.batch)!=null&&o.multicall&&((c=(a=e.chain)==null?void 0:a.contracts)!=null&&c.multicall3)){const u=e.chain.contracts.multicall3.address,l=jt({abi:Qo,functionName:"getEthBalance",args:[t]}),{data:d}=await ve(e,Qs,"call")({to:u,data:l,blockNumber:n,blockTag:r});return ts({abi:Qo,functionName:"getEthBalance",args:[t],data:d||"0x"})}const i=typeof n=="bigint"?oe(n):void 0,s=await e.request({method:"eth_getBalance",params:[t,i||r]});return BigInt(s)}async function iO(e){const t=await e.request({method:"eth_blobBaseFee"});return BigInt(t)}const sO=new Map,oO=new Map;function aO(e){const t=(i,s)=>({clear:()=>s.delete(i),get:()=>s.get(i),set:o=>s.set(i,o)}),n=t(e,sO),r=t(e,oO);return{clear:()=>{n.clear(),r.clear()},promise:n,response:r}}async function cO(e,{cacheKey:t,cacheTime:n=Number.POSITIVE_INFINITY}){const r=aO(t),i=r.response.get();if(i&&n>0&&Date.now()-i.created.getTime()<n)return i.data;let s=r.promise.get();s||(s=e(),r.promise.set(s));try{const o=await s;return r.response.set({created:new Date,data:o}),o}finally{r.promise.clear()}}const uO=e=>`blockNumber.${e}`;async function xu(e,{cacheTime:t=e.cacheTime}={}){const n=await cO(()=>e.request({method:"eth_blockNumber"}),{cacheKey:uO(e.uid),cacheTime:t});return BigInt(n)}async function lO(e,{blockHash:t,blockNumber:n,blockTag:r="latest"}={}){const i=n!==void 0?oe(n):void 0;let s;return t?s=await e.request({method:"eth_getBlockTransactionCountByHash",params:[t]},{dedupe:!0}):s=await e.request({method:"eth_getBlockTransactionCountByNumber",params:[i||r]},{dedupe:!!i}),Pn(s)}async function wa(e,{address:t,blockNumber:n,blockTag:r="latest"}){const i=n!==void 0?oe(n):void 0,s=await e.request({method:"eth_getCode",params:[t,i||r]},{dedupe:!!i});if(s!=="0x")return s}function us(e,t){if(!Pt(e,{strict:!1}))throw new _n({address:e});if(!Pt(t,{strict:!1}))throw new _n({address:t});return e.toLowerCase()===t.toLowerCase()}function Rr(e,{args:t,eventName:n}={}){return{...e,blockHash:e.blockHash?e.blockHash:null,blockNumber:e.blockNumber?BigInt(e.blockNumber):null,blockTimestamp:e.blockTimestamp?BigInt(e.blockTimestamp):e.blockTimestamp===null?null:void 0,logIndex:e.logIndex?Number(e.logIndex):null,transactionHash:e.transactionHash?e.transactionHash:null,transactionIndex:e.transactionIndex?Number(e.transactionIndex):null,...n?{args:t,eventName:n}:{}}}const u_="/docs/contract/decodeEventLog";function kd(e){const{abi:t,data:n,strict:r,topics:i}=e,s=r??!0,[o,...a]=i;if(!o)throw new VI({docsPath:u_});const c=t.find(b=>b.type==="event"&&o===ud(kr(b)));if(!(c&&"name"in c)||c.type!=="event")throw new KI(o,{docsPath:u_});const{name:u,inputs:l}=c,d=l==null?void 0:l.some(b=>!("name"in b&&b.name)),f=d?[]:{},h=l.map((b,x)=>[b,x]).filter(([b])=>"indexed"in b&&b.indexed),m=[];for(let b=0;b<h.length;b++){const[x,v]=h[b],S=a[b];if(!S){if(s)throw new D0({abiItem:c,param:x});m.push([x,v]);continue}f[d?v:x.name||v]=dO({param:x,value:S})}const y=l.filter(b=>!("indexed"in b&&b.indexed)),w=s?y:[...m.map(([b])=>b),...y];if(w.length>0){if(n&&n!=="0x")try{const b=Us(w,n);if(b){let x=0;if(!s)for(const[v,S]of m)f[d?S:v.name||S]=b[x++];if(d)for(let v=0;v<l.length;v++)f[v]===void 0&&x<b.length&&(f[v]=b[x++]);else for(let v=0;v<y.length;v++)f[y[v].name]=b[x++]}}catch(b){if(s)throw b instanceof Hw||b instanceof yv?new Yl({abiItem:c,data:n,params:w,size:Et(n)}):b}else if(s)throw new Yl({abiItem:c,data:"0x",params:w,size:0})}return{eventName:u,args:Object.values(f).length>0?f:void 0}}function dO({param:e,value:t}){return e.type==="string"||e.type==="bytes"||e.type==="tuple"||e.type.match(/^(.*)\[(\d+)?\]$/)?t:(Us([e],t)||[])[0]}function tm(e){const{abi:t,args:n,logs:r,strict:i=!0}=e,s=(()=>{if(e.eventName)return Array.isArray(e.eventName)?e.eventName:[e.eventName]})(),o=t.filter(a=>a.type==="event").map(a=>({abi:a,selector:ud(a)}));return r.map(a=>{var f;const c=typeof a.blockNumber=="string"?Rr(a):a,u=o.filter(h=>c.topics[0]===h.selector);if(u.length===0)return null;let l,d;for(const h of u)try{l=kd({...c,abi:[h.abi],strict:!0}),d=h;break}catch{}if(!l&&!i){d=u[0];try{l=kd({data:c.data,topics:c.topics,abi:[d.abi],strict:!1})}catch{const h=(f=d.abi.inputs)==null?void 0:f.some(m=>!("name"in m&&m.name));return{...c,args:h?[]:{},eventName:d.abi.name}}}return!l||!d||s&&!s.includes(l.eventName)||!fO({args:l.args,inputs:d.abi.inputs,matchArgs:n})?null:{...l,...c}}).filter(Boolean)}function fO(e){const{args:t,inputs:n,matchArgs:r}=e;if(!r)return!0;if(!t)return!1;function i(s,o,a){try{return s.type==="address"?us(o,a):s.type==="string"||s.type==="bytes"?xt(ea(o))===a:o===a}catch{return!1}}return Array.isArray(t)&&Array.isArray(r)?r.every((s,o)=>{if(s==null)return!0;const a=n[o];return a?(Array.isArray(s)?s:[s]).some(u=>i(a,u,t[o])):!1}):typeof t=="object"&&!Array.isArray(t)&&typeof r=="object"&&!Array.isArray(r)?Object.entries(r).every(([s,o])=>{if(o==null)return!0;const a=n.find(u=>u.name===s);return a?(Array.isArray(o)?o:[o]).some(u=>i(a,u,t[s])):!1}):!1}async function nm(e,{address:t,blockHash:n,fromBlock:r,toBlock:i,event:s,events:o,args:a,strict:c}={}){const u=c??!1,l=o??(s?[s]:void 0);let d=[];l&&(d=[l.flatMap(y=>_u({abi:[y],eventName:y.name,args:o?void 0:a}))],s&&(d=d[0]));let f;n?f=await e.request({method:"eth_getLogs",params:[{address:t,topics:d,blockHash:n}]}):f=await e.request({method:"eth_getLogs",params:[{address:t,topics:d,fromBlock:typeof r=="bigint"?oe(r):r,toBlock:typeof i=="bigint"?oe(i):i}]});const h=f.map(m=>Rr(m));return l?tm({abi:l,args:a,logs:h,strict:u}):h}async function l_(e,t){const{abi:n,address:r,args:i,blockHash:s,eventName:o,fromBlock:a,toBlock:c,strict:u}=t,l=o?Hs({abi:n,name:o}):void 0,d=l?void 0:n.filter(f=>f.type==="event");return ve(e,nm,"getLogs")({address:r,args:i,blockHash:s,event:l,events:d,fromBlock:a,toBlock:c,strict:u})}async function hO(e,{address:t,blockNumber:n,blockTag:r="latest"}){const i=await wa(e,{address:t,...n!==void 0?{blockNumber:n}:{blockTag:r}});if(i&&Et(i)===23&&i.startsWith("0xef0100"))return mn(_i(i,3,23))}class pO extends ee{constructor({address:t}){super(`No EIP-712 domain found on contract "${t}".`,{metaMessages:["Ensure that:",`- The contract is deployed at the address "${t}".`,"- `eip712Domain()` function exists on the contract.","- `eip712Domain()` function matches signature to ERC-5267 specification."],name:"Eip712DomainNotFoundError"})}}async function mO(e,t){const{address:n,factory:r,factoryData:i}=t;try{const[s,o,a,c,u,l,d]=await ve(e,On,"readContract")({abi:gO,address:n,functionName:"eip712Domain",factory:r,factoryData:i});return{domain:{name:o,version:a,chainId:Number(c),verifyingContract:u,salt:l},extensions:d,fields:s}}catch(s){const o=s;throw o.name==="ContractFunctionExecutionError"&&o.cause.name==="ContractFunctionZeroDataError"?new pO({address:n}):o}}const gO=[{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"}];function yO(e){var t;return{baseFeePerGas:e.baseFeePerGas.map(n=>BigInt(n)),gasUsedRatio:e.gasUsedRatio,oldestBlock:BigInt(e.oldestBlock),reward:(t=e.reward)==null?void 0:t.map(n=>n.map(r=>BigInt(r)))}}async function bO(e,{blockCount:t,blockNumber:n,blockTag:r="latest",rewardPercentiles:i}){const s=typeof n=="bigint"?oe(n):void 0,o=await e.request({method:"eth_feeHistory",params:[oe(t),s||r,i]},{dedupe:!!s});return yO(o)}async function Ad(e,{filter:t}){const n="strict"in t&&t.strict,r=await t.request({method:"eth_getFilterChanges",params:[t.id]});if(typeof r[0]=="string")return r;const i=r.map(s=>Rr(s));return!("abi"in t)||!t.abi?i:tm({abi:t.abi,logs:i,strict:n})}async function wO(e,{filter:t}){const n=t.strict??!1,i=(await t.request({method:"eth_getFilterLogs",params:[t.id]})).map(s=>Rr(s));return t.abi?tm({abi:t.abi,logs:i,strict:n}):i}function vO(e,t){if(e.length!==t.length)throw new zw({expectedLength:e.length,givenLength:t.length});const n=[];for(let r=0;r<e.length;r++){const i=e[r],s=t[r];n.push(d_(i,s))}return Hn(n)}function d_(e,t,n=!1){if(e==="address"){const o=t;if(!Pt(o))throw new _n({address:o});return Kt(o.toLowerCase(),{size:n?32:null})}if(e==="string")return Ds(t);if(e==="bytes")return t;if(e==="bool")return Kt(H0(t),{size:n?32:1});const r=e.match(Z0);if(r){const[o,a,c="256"]=r,u=Number.parseInt(c,10)/8;return oe(t,{size:n?32:u,signed:a==="int"})}const i=e.match(_v);if(i){const[o,a]=i;if(Number.parseInt(a,10)!==(t.length-2)/2)throw new Kw({expectedSize:Number.parseInt(a,10),givenSize:(t.length-2)/2});return Kt(t,{dir:"right",size:n?32:null})}const s=e.match(GC);if(s&&Array.isArray(t)){const[o,a]=s,c=[];for(let u=0;u<t.length;u++)c.push(d_(a,t[u],!0));return c.length===0?"0x":Hn(c)}throw new eC(e)}function _O(e){const{authorizationList:t}=e;if(t)for(const n of t){const{chainId:r}=n,i=n.address;if(!Pt(i))throw new _n({address:i});if(r<0)throw new ld({chainId:r})}rm(e)}function EO(e){const{blobVersionedHashes:t}=e;if(t){if(t.length===0)throw new t_;for(const n of t){const r=Et(n),i=Pn(_i(n,0,1));if(r!==32)throw new eO({hash:n,size:r});if(i!==e_)throw new tO({hash:n,version:i})}}rm(e)}function rm(e){const{chainId:t,maxPriorityFeePerGas:n,maxFeePerGas:r,to:i}=e;if(t<=0)throw new ld({chainId:t});if(i&&!Pt(i))throw new _n({address:i});if(r&&r>xd)throw new Zs({maxFeePerGas:r});if(n&&r&&n>r)throw new yu({maxFeePerGas:r,maxPriorityFeePerGas:n})}function xO(e){const{chainId:t,maxPriorityFeePerGas:n,gasPrice:r,maxFeePerGas:i,to:s}=e;if(t<=0)throw new ld({chainId:t});if(s&&!Pt(s))throw new _n({address:s});if(n||i)throw new ee("`maxFeePerGas`/`maxPriorityFeePerGas` is not a valid EIP-2930 Transaction attribute.");if(r&&r>xd)throw new Zs({maxFeePerGas:r})}function SO(e){const{chainId:t,maxPriorityFeePerGas:n,gasPrice:r,maxFeePerGas:i,to:s}=e;if(s&&!Pt(s))throw new _n({address:s});if(typeof t<"u"&&t<=0)throw new ld({chainId:t});if(n||i)throw new ee("`maxFeePerGas`/`maxPriorityFeePerGas` is not a valid Legacy Transaction attribute.");if(r&&r>xd)throw new Zs({maxFeePerGas:r})}function Id(e){if(!e||e.length===0)return[];const t=[];for(let n=0;n<e.length;n++){const{address:r,storageKeys:i}=e[n];for(let s=0;s<i.length;s++)if(i[s].length-2!==64)throw new lR({storageKey:i[s]});if(!Pt(r,{strict:!1}))throw new _n({address:r});t.push([r,i])}return t}function kO(e,t){const n=r_(e);return n==="eip1559"?CO(e,t):n==="eip2930"?PO(e,t):n==="eip4844"?IO(e,t):n==="eip7702"?AO(e,t):RO(e,t)}function AO(e,t){const{authorizationList:n,chainId:r,gas:i,nonce:s,to:o,value:a,maxFeePerGas:c,maxPriorityFeePerGas:u,accessList:l,data:d}=e;_O(e);const f=Id(l),h=TO(n);return Hn(["0x04",is([oe(r),s?oe(s):"0x",u?oe(u):"0x",c?oe(c):"0x",i?oe(i):"0x",o??"0x",a?oe(a):"0x",d??"0x",f,h,...Su(e,t)])])}function IO(e,t){const{chainId:n,gas:r,nonce:i,to:s,value:o,maxFeePerBlobGas:a,maxFeePerGas:c,maxPriorityFeePerGas:u,accessList:l,data:d}=e;EO(e);let f=e.blobVersionedHashes,h=e.sidecars;if(e.blobs&&(typeof f>"u"||typeof h>"u")){const v=typeof e.blobs[0]=="string"?e.blobs:e.blobs.map(N=>Jt(N)),S=e.kzg,I=Kp({blobs:v,kzg:S});if(typeof f>"u"&&(f=J2({commitments:I})),typeof h>"u"){const N=Jp({blobs:v,commitments:I,kzg:S});h=n_({blobs:v,commitments:I,proofs:N})}}const m=Id(l),y=[oe(n),i?oe(i):"0x",u?oe(u):"0x",c?oe(c):"0x",r?oe(r):"0x",s??"0x",o?oe(o):"0x",d??"0x",m,a?oe(a):"0x",f??[],...Su(e,t)],w=[],b=[],x=[];if(h)for(let v=0;v<h.length;v++){const{blob:S,commitment:I,proof:N}=h[v];w.push(S),b.push(I),x.push(N)}return Hn(["0x03",is(h?[y,w,b,x]:y)])}function CO(e,t){const{chainId:n,gas:r,nonce:i,to:s,value:o,maxFeePerGas:a,maxPriorityFeePerGas:c,accessList:u,data:l}=e;rm(e);const d=Id(u),f=[oe(n),i?oe(i):"0x",c?oe(c):"0x",a?oe(a):"0x",r?oe(r):"0x",s??"0x",o?oe(o):"0x",l??"0x",d,...Su(e,t)];return Hn(["0x02",is(f)])}function PO(e,t){const{chainId:n,gas:r,data:i,nonce:s,to:o,value:a,accessList:c,gasPrice:u}=e;xO(e);const l=Id(c),d=[oe(n),s?oe(s):"0x",u?oe(u):"0x",r?oe(r):"0x",o??"0x",a?oe(a):"0x",i??"0x",l,...Su(e,t)];return Hn(["0x01",is(d)])}function RO(e,t){const{chainId:n=0,gas:r,data:i,nonce:s,to:o,value:a,gasPrice:c}=e;SO(e);let u=[s?oe(s):"0x",c?oe(c):"0x",r?oe(r):"0x",o??"0x",a?oe(a):"0x",i??"0x"];if(t){const l=(()=>{if(t.v>=35n)return(t.v-35n)/2n>0?t.v:27n+(t.v===35n?0n:1n);if(n>0)return BigInt(n*2)+BigInt(35n+t.v-27n);const h=27n+(t.v===27n?0n:1n);if(t.v!==h)throw new cR({v:t.v});return h})(),d=En(t.r),f=En(t.s);u=[...u,oe(l),d==="0x00"?"0x":d,f==="0x00"?"0x":f]}else n>0&&(u=[...u,oe(n),"0x","0x"]);return is(u)}function Su(e,t){const n=t??e,{v:r,yParity:i}=n;if(typeof n.r>"u")return[];if(typeof n.s>"u")return[];if(typeof r>"u"&&typeof i>"u")return[];const s=En(n.r),o=En(n.s);return[typeof i=="number"?i?oe(1):"0x":r===0n?"0x":r===1n?oe(1):r===27n?"0x":oe(1),s==="0x00"?"0x":s,o==="0x00"?"0x":o]}function TO(e){if(!e||e.length===0)return[];const t=[];for(const n of e){const{chainId:r,nonce:i,...s}=n,o=n.address;t.push([r?tn(r):"0x",o,i?tn(i):"0x",...Su({},s)])}return t}async function OO({address:e,authorization:t,signature:n}){return us(mn(e),await Hp({authorization:t,signature:n}))}const Cd=new aa(8192);function MO(e,{enabled:t=!0,id:n}){if(!t||!n)return e();if(Cd.get(n))return Cd.get(n);const r=e().finally(()=>Cd.delete(n));return Cd.set(n,r),r}async function im(e){return new Promise(t=>setTimeout(t,e))}function ku(e,{delay:t=100,retryCount:n=2,shouldRetry:r=()=>!0}={}){return new Promise((i,s)=>{const o=async({count:a=0}={})=>{const c=async({error:u})=>{const l=typeof t=="function"?t({count:a,error:u}):t;l&&await im(l),o({count:a+1})};try{const u=await e();i(u)}catch(u){if(a<n&&await r({count:a,error:u}))return c({error:u});s(u)}};o()})}function BO(e,t={}){return async(n,r={})=>{var d;const{dedupe:i=!1,methods:s,retryDelay:o=150,retryCount:a=3,uid:c}={...t,...r},{method:u}=n;if((d=s==null?void 0:s.exclude)!=null&&d.includes(u))throw new Gs(new Error("method not supported"),{method:u});if(s!=null&&s.include&&!s.include.includes(u))throw new Gs(new Error("method not supported"),{method:u});const l=i?Ds(`${c}.${Ht(n)}`):void 0;return MO(()=>ku(async()=>{try{return await e(n)}catch(f){const h=f;switch(h.code){case Vc.code:throw new Vc(h);case Kc.code:throw new Kc(h);case Jc.code:throw new Jc(h,{method:n.method});case Zc.code:throw new Zc(h);case Ws.code:throw new Ws(h);case ns.code:throw new ns(h);case Yc.code:throw new Yc(h);case rs.code:throw new rs(h);case Qc.code:throw new Qc(h);case Gs.code:throw new Gs(h,{method:n.method});case pa.code:throw new pa(h);case Xc.code:throw new Xc(h);case zt.code:throw new zt(h);case eu.code:throw new eu(h);case tu.code:throw new tu(h);case nu.code:throw new nu(h);case ru.code:throw new ru(h);case Ar.code:throw new Ar(h);case iu.code:throw new iu(h);case su.code:throw new su(h);case ou.code:throw new ou(h);case au.code:throw new au(h);case cu.code:throw new cu(h);case uu.code:throw new uu(h);case lu.code:throw new lu(h);case 5e3:throw new zt(h);case du.code:throw new du(h);default:throw f instanceof ee?f:new _R(h)}}},{delay:({count:f,error:h})=>{var m;if(h&&h instanceof zs){const y=(m=h==null?void 0:h.headers)==null?void 0:m.get("Retry-After");if(y!=null&&y.match(/\d/))return Number.parseInt(y,10)*1e3}return~~(1<<f)*o},retryCount:a,shouldRetry:({error:f})=>NO(f)}),{enabled:i,id:l})}}function NO(e){return"code"in e&&typeof e.code=="number"?e.code===-1||e.code===pa.code||e.code===Ws.code||e.code===429:e instanceof zs&&e.status?e.status===403||e.status===408||e.status===413||e.status===429||e.status===500||e.status===502||e.status===503||e.status===504:!0}class LO extends ee{constructor({callbackSelector:t,cause:n,data:r,extraData:i,sender:s,urls:o}){var a;super(n.shortMessage||"An error occurred while fetching for an offchain result.",{cause:n,metaMessages:[...n.metaMessages||[],(a=n.metaMessages)!=null&&a.length?"":[],"Offchain Gateway Call:",o&&[" Gateway URL(s):",...o.map(c=>` ${Gc(c)}`)],` Sender: ${s}`,` Data: ${r}`,` Callback selector: ${t}`,` Extra data: ${i}`].flat(),name:"OffchainLookupError"})}}class jO extends ee{constructor({result:t,url:n}){super("Offchain gateway response is malformed. Response data must be a hex value.",{metaMessages:[`Gateway URL: ${Gc(n)}`,`Response: ${Ht(t)}`],name:"OffchainLookupResponseMalformedError"})}}class $O extends ee{constructor({sender:t,to:n}){super("Reverted sender address does not match target contract address (`to`).",{metaMessages:[`Contract address: ${n}`,`OffchainLookup sender address: ${t}`],name:"OffchainLookupSenderMismatchError"})}}const FO="0x556f1830",f_={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 DO(e,{blockNumber:t,blockTag:n,data:r,to:i}){const{args:s}=lp({data:r,abi:[f_]}),[o,a,c,u,l]=s,{ccipRead:d}=e,f=d&&typeof(d==null?void 0:d.request)=="function"?d.request:h_;try{if(!us(i,o))throw new $O({sender:o,to:i});const h=a.includes(qc)?await Yv({data:c,ccipRequest:f}):await f({data:c,sender:o,urls:a}),{data:m}=await Qs(e,{blockNumber:t,blockTag:n,data:Zt([u,zn([{type:"bytes"},{type:"bytes"}],[h,l])]),to:i});return m}catch(h){throw new LO({callbackSelector:u,cause:h,data:r,extraData:l,sender:o,urls:a})}}async function h_({data:e,sender:t,urls:n}){var i;let r=new Error("An unknown error occurred.");for(let s=0;s<n.length;s++){const o=n[s],a=o.includes("{data}")?"GET":"POST",c=a==="POST"?{data:e,sender:t}:void 0,u=a==="POST"?{"Content-Type":"application/json"}:{};try{const l=await fetch(o.replace("{sender}",t.toLowerCase()).replace("{data}",e),{body:JSON.stringify(c),headers:u,method:a});let d;if((i=l.headers.get("Content-Type"))!=null&&i.startsWith("application/json")?d=(await l.json()).data:d=await l.text(),!l.ok){r=new zs({body:c,details:d!=null&&d.error?Ht(d.error):l.statusText,headers:l.headers,status:l.status,url:o});continue}if(!pn(d)){r=new jO({result:d,url:o});continue}return d}catch(l){r=new zs({body:c,details:l.message,url:o})}}throw r}const UO=Object.freeze(Object.defineProperty({__proto__:null,ccipRequest:h_,offchainLookup:DO,offchainLookupAbiItem:f_,offchainLookupSignature:FO},Symbol.toStringTag,{value:"Module"}));function HO({chain:e,currentChainId:t}){if(!e)throw new eR;if(t!==e.id)throw new XP({chain:e,currentChainId:t})}function ls(e){const t={formatters:void 0,fees:void 0,serializers:void 0,...e};function n(r){return i=>{const s=typeof i=="function"?i(r):i,o={...r,...s};return Object.assign(o,{extend:n(o)})}}return Object.assign(t,{extend:n(t)})}const p_={"0x0":"reverted","0x1":"success"};function Pd(e,t){const n={...e,blockNumber:e.blockNumber?BigInt(e.blockNumber):null,contractAddress:e.contractAddress?e.contractAddress:null,cumulativeGasUsed:e.cumulativeGasUsed?BigInt(e.cumulativeGasUsed):null,effectiveGasPrice:e.effectiveGasPrice?BigInt(e.effectiveGasPrice):null,gasUsed:e.gasUsed?BigInt(e.gasUsed):null,logs:e.logs?e.logs.map(r=>Rr(r)):null,to:e.to?e.to:null,transactionIndex:e.transactionIndex?Pn(e.transactionIndex):null,status:e.status?p_[e.status]:null,type:e.type?H2[e.type]||e.type:null};return e.blobGasPrice&&(n.blobGasPrice=BigInt(e.blobGasPrice)),e.blobGasUsed&&(n.blobGasUsed=BigInt(e.blobGasUsed)),n}const zO=Lp("transactionReceipt",Pd);function WO(e){const{source:t}=e,n=new Map,r=new aa(8192),i=new Map,s=({address:o,chainId:a})=>`${o}.${a}`;return{async consume({address:o,chainId:a,client:c}){const u=s({address:o,chainId:a}),l=this.get({address:o,chainId:a,client:c});this.increment({address:o,chainId:a});const d=await l;return await t.set({address:o,chainId:a},d),r.set(u,d),d},async increment({address:o,chainId:a}){const c=s({address:o,chainId:a}),u=n.get(c)??0;n.set(c,u+1)},async get({address:o,chainId:a,client:c}){const u=s({address:o,chainId:a});let l=i.get(u);return l||(l=(async()=>{try{const f=await t.get({address:o,chainId:a,client:c}),h=r.get(u)??0;return h>0&&f<=h?h+1:(r.delete(u),f)}finally{this.reset({address:o,chainId:a})}})(),i.set(u,l)),(n.get(u)??0)+await l},reset({address:o,chainId:a}){const c=s({address:o,chainId:a});n.delete(c),i.delete(c)}}}function m_(e,{errorInstance:t=new Error("timed out"),timeout:n,signal:r}){return new Promise((i,s)=>{(async()=>{let o;try{const a=new AbortController;n>0&&(o=setTimeout(()=>{r?a.abort():s(t)},n)),i(await e({signal:(a==null?void 0:a.signal)||null}))}catch(a){(a==null?void 0:a.name)==="AbortError"&&s(t),s(a)}finally{clearTimeout(o)}})()})}function GO(){return{current:0,take(){return this.current++},reset(){this.current=0}}}const g_=GO();function qO(e,t={}){const{url:n,headers:r}=VO(e);return{async request(i){var m,y,w;const{body:s,fetchFn:o=t.fetchFn??fetch,onRequest:a=t.onRequest,onResponse:c=t.onResponse,timeout:u=t.timeout??1e4}=i,l={...t.fetchOptions??{},...i.fetchOptions??{}},{headers:d,method:f,signal:h}=l;try{const b=await m_(async({signal:v})=>{const S={...l,body:Array.isArray(s)?Ht(s.map(U=>({jsonrpc:"2.0",id:U.id??g_.take(),...U}))):Ht({jsonrpc:"2.0",id:s.id??g_.take(),...s}),headers:{...r,"Content-Type":"application/json",...d},method:f||"POST",signal:h||(u>0?v:null)},I=new Request(n,S),N=await(a==null?void 0:a(I,S))??{...S,url:n};return await o(N.url??n,N)},{errorInstance:new Xv({body:s,url:n}),timeout:u,signal:!0});c&&await c(b);let x;if((m=b.headers.get("Content-Type"))!=null&&m.startsWith("application/json"))x=await b.json();else{x=await b.text();try{x=JSON.parse(x||"{}")}catch(v){if(b.ok)throw v;x={error:x}}}if(!b.ok){if(typeof((y=x.error)==null?void 0:y.code)=="number"&&typeof((w=x.error)==null?void 0:w.message)=="string")return x;throw new zs({body:s,details:Ht(x.error)||b.statusText,headers:b.headers,status:b.status,url:n})}return x}catch(b){throw b instanceof zs||b instanceof Xv?b:new zs({body:s,cause:b,url:n})}}}}function VO(e){try{const t=new URL(e),n=(()=>{if(t.username){const r=`${decodeURIComponent(t.username)}:${decodeURIComponent(t.password)}`;return t.username="",t.password="",{url:t.toString(),headers:{Authorization:`Basic ${btoa(r)}`}}}})();return{url:t.toString(),...n}}catch{return{url:e}}}const KO=`Ethereum Signed Message:
78
+ `;function JO(e){const t=typeof e=="string"?Ds(e):typeof e.raw=="string"?e.raw:Jt(e.raw),n=Ds(`${KO}${Et(t)}`);return Zt([n,t])}function Rd(e,t){return xt(JO(e),t)}class ZO extends ee{constructor({domain:t}){super(`Invalid domain "${Ht(t)}".`,{metaMessages:["Must be a valid EIP-712 domain."]})}}class YO extends ee{constructor({primaryType:t,types:n}){super(`Invalid primary type \`${t}\` must be one of \`${JSON.stringify(Object.keys(n))}\`.`,{docsPath:"/api/glossary/Errors#typeddatainvalidprimarytypeerror",metaMessages:["Check that the primary type is a key in `types`."]})}}class QO extends ee{constructor({type:t}){super(`Struct type "${t}" is invalid.`,{metaMessages:["Struct type must not be a Solidity type."],name:"InvalidStructTypeError"})}}function XO(e){const{domain:t,message:n,primaryType:r,types:i}=e,s=(o,a)=>{for(const c of o){const{name:u,type:l}=c,d=a[u],f=l.match(Z0);if(f&&(typeof d=="number"||typeof d=="bigint")){const[y,w,b]=f;oe(d,{signed:w==="int",size:Number.parseInt(b,10)/8})}if(l==="address"&&typeof d=="string"&&!Pt(d))throw new _n({address:d});const h=l.match(_v);if(h){const[y,w]=h;if(w&&Et(d)!==Number.parseInt(w,10))throw new Kw({expectedSize:Number.parseInt(w,10),givenSize:Et(d)})}const m=i[l];m&&(tM(l),s(m,d))}};if(i.EIP712Domain&&t){if(typeof t!="object")throw new ZO({domain:t});s(i.EIP712Domain,t)}if(r!=="EIP712Domain")if(i[r])s(i[r],n);else throw new YO({primaryType:r,types:i})}function eM({domain:e}){return[typeof(e==null?void 0:e.name)=="string"&&{name:"name",type:"string"},(e==null?void 0:e.version)&&{name:"version",type:"string"},(typeof(e==null?void 0:e.chainId)=="number"||typeof(e==null?void 0:e.chainId)=="bigint")&&{name:"chainId",type:"uint256"},(e==null?void 0:e.verifyingContract)&&{name:"verifyingContract",type:"address"},(e==null?void 0:e.salt)&&{name:"salt",type:"bytes32"}].filter(Boolean)}function tM(e){if(e==="address"||e==="bool"||e==="string"||e.startsWith("bytes")||e.startsWith("uint")||e.startsWith("int"))throw new QO({type:e})}function Au(e){const{domain:t={},message:n,primaryType:r}=e,i={EIP712Domain:eM({domain:t}),...e.types};XO({domain:t,message:n,primaryType:r,types:i});const s=["0x1901"];return t&&s.push(nM({domain:t,types:i})),r!=="EIP712Domain"&&s.push(y_({data:n,primaryType:r,types:i})),xt(Zt(s))}function nM({domain:e,types:t}){return y_({data:e,primaryType:"EIP712Domain",types:t})}function y_({data:e,primaryType:t,types:n}){const r=b_({data:e,primaryType:t,types:n});return xt(r)}function b_({data:e,primaryType:t,types:n}){const r=[{type:"bytes32"}],i=[rM({primaryType:t,types:n})];for(const s of n[t]){const[o,a]=v_({types:n,name:s.name,type:s.type,value:e[s.name]});r.push(o),i.push(a)}return zn(r,i)}function rM({primaryType:e,types:t}){const n=tn(iM({primaryType:e,types:t}));return xt(n)}function iM({primaryType:e,types:t}){let n="";const r=w_({primaryType:e,types:t});r.delete(e);const i=[e,...Array.from(r).sort()];for(const s of i)n+=`${s}(${t[s].map(({name:o,type:a})=>`${a} ${o}`).join(",")})`;return n}function w_({primaryType:e,types:t},n=new Set){const r=e.match(/^\w*/u),i=r==null?void 0:r[0];if(n.has(i)||t[i]===void 0)return n;n.add(i);for(const s of t[i])w_({primaryType:s.type,types:t},n);return n}function v_({types:e,name:t,type:n,value:r}){if(e[n]!==void 0)return[{type:"bytes32"},xt(b_({data:r,primaryType:n,types:e}))];if(n==="bytes")return[{type:"bytes32"},xt(r)];if(n==="string")return[{type:"bytes32"},xt(tn(r))];if(n.lastIndexOf("]")===n.length-1){const i=n.slice(0,n.lastIndexOf("[")),s=r.map(o=>v_({name:t,type:i,types:e,value:o}));return[{type:"bytes32"},xt(zn(s.map(([o])=>o),s.map(([,o])=>o)))]}return[{type:n},r]}const sM="0x6492649264926492649264926492649264926492649264926492649264926492";class oM extends Map{constructor(t){super(),Object.defineProperty(this,"maxSize",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.maxSize=t}get(t){const n=super.get(t);return super.has(t)&&n!==void 0&&(this.delete(t),super.set(t,n)),n}set(t,n){if(super.set(t,n),this.maxSize&&this.size>this.maxSize){const r=this.keys().next().value;r&&this.delete(r)}return this}}const sm={checksum:new oM(8192)}.checksum;class __ extends W0{constructor(t,n){super(),this.finished=!1,this.destroyed=!1,iv(t);const r=id(n);if(this.iHash=t.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 i=this.blockLen,s=new Uint8Array(i);s.set(r.length>i?t.create().update(r).digest():r);for(let o=0;o<s.length;o++)s[o]^=54;this.iHash.update(s),this.oHash=t.create();for(let o=0;o<s.length;o++)s[o]^=106;this.oHash.update(s),es(s)}update(t){return sa(this),this.iHash.update(t),this}digestInto(t){sa(this),bi(t,this.outputLen),this.finished=!0,this.iHash.digestInto(t),this.oHash.update(t),this.oHash.digestInto(t),this.destroy()}digest(){const t=new Uint8Array(this.oHash.outputLen);return this.digestInto(t),t}_cloneInto(t){t||(t=Object.create(Object.getPrototypeOf(this),{}));const{oHash:n,iHash:r,finished:i,destroyed:s,blockLen:o,outputLen:a}=this;return t=t,t.finished=i,t.destroyed=s,t.blockLen=o,t.outputLen=a,t.oHash=n._cloneInto(t.oHash),t.iHash=r._cloneInto(t.iHash),t}clone(){return this._cloneInto()}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}}const om=(e,t,n)=>new __(e,t).update(n).digest();om.create=(e,t)=>new __(e,t);function E_(e,t={}){const{as:n=typeof e=="string"?"Hex":"Bytes"}=t,r=mv(NR(e));return n==="Bytes"?r:Cr(r)}const aM=/^0x[a-fA-F0-9]{40}$/;function Td(e,t={}){const{strict:n=!0}=t;if(!aM.test(e))throw new S_({address:e,cause:new cM});if(n){if(e.toLowerCase()===e)return;if(x_(e)!==e)throw new S_({address:e,cause:new uM})}}function x_(e){if(sm.has(e))return sm.get(e);Td(e,{strict:!1});const t=e.substring(2).toLowerCase(),n=E_(jR(t),{as:"Bytes"}),r=t.split("");for(let s=0;s<40;s+=2)n[s>>1]>>4>=8&&r[s]&&(r[s]=r[s].toUpperCase()),(n[s>>1]&15)>=8&&r[s+1]&&(r[s+1]=r[s+1].toUpperCase());const i=`0x${r.join("")}`;return sm.set(e,i),i}function am(e,t={}){const{strict:n=!0}=t??{};try{return Td(e,{strict:n}),!0}catch{return!1}}class S_ extends ze{constructor({address:t,cause:n}){super(`Address "${t}" is invalid.`,{cause:n}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Address.InvalidAddressError"})}}class cM extends ze{constructor(){super("Address is not a 20 byte (40 hexadecimal character) value."),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Address.InvalidInputError"})}}class uM extends ze{constructor(){super("Address does not match its checksum counterpart."),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Address.InvalidChecksumError"})}}const lM=/^(.*)\[([0-9]*)\]$/,dM=/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/,k_=/^(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)?$/,A_=2n**256n-1n;function va(e,t,n){const{checksumAddress:r,staticPosition:i}=n,s=dm(t.type);if(s){const[o,a]=s;return hM(e,{...t,type:a},{checksumAddress:r,length:o,staticPosition:i})}if(t.type==="tuple")return yM(e,t,{checksumAddress:r,staticPosition:i});if(t.type==="address")return fM(e,{checksum:r});if(t.type==="bool")return pM(e);if(t.type.startsWith("bytes"))return mM(e,t,{staticPosition:i});if(t.type.startsWith("uint")||t.type.startsWith("int"))return gM(e,t);if(t.type==="string")return bM(e,{staticPosition:i});throw new pm(t.type)}const I_=32,cm=32;function fM(e,t={}){const{checksum:n=!1}=t,r=e.readBytes(32);return[(s=>n?x_(s):s)(Cr(FR(r,-20))),32]}function hM(e,t,n){const{checksumAddress:r,length:i,staticPosition:s}=n;if(!i){const c=Ii(e.readBytes(cm)),u=s+c,l=u+I_;e.setPosition(u);const d=Ii(e.readBytes(I_)),f=Iu(t);let h=0;const m=[];for(let y=0;y<d;++y){e.setPosition(l+(f?y*32:h));const[w,b]=va(e,t,{checksumAddress:r,staticPosition:l});h+=b,m.push(w)}return e.setPosition(s+32),[m,32]}if(Iu(t)){const c=Ii(e.readBytes(cm)),u=s+c,l=[];for(let d=0;d<i;++d){e.setPosition(u+d*32);const[f]=va(e,t,{checksumAddress:r,staticPosition:u});l.push(f)}return e.setPosition(s+32),[l,32]}let o=0;const a=[];for(let c=0;c<i;++c){const[u,l]=va(e,t,{checksumAddress:r,staticPosition:s+o});o+=l,a.push(u)}return[a,o]}function pM(e){return[UR(e.readBytes(32),{size:32}),32]}function mM(e,t,{staticPosition:n}){const[r,i]=t.type.split("bytes");if(!i){const o=Ii(e.readBytes(32));e.setPosition(n+o);const a=Ii(e.readBytes(32));if(a===0)return e.setPosition(n+32),["0x",32];const c=e.readBytes(a);return e.setPosition(n+32),[Cr(c),32]}return[Cr(e.readBytes(Number.parseInt(i,10),32)),32]}function gM(e,t){const n=t.type.startsWith("int"),r=Number.parseInt(t.type.split("int")[1]||"256",10),i=e.readBytes(32);return[r>48?DR(i,{signed:n}):Ii(i,{signed:n}),32]}function yM(e,t,n){const{checksumAddress:r,staticPosition:i}=n,s=t.components.length===0||t.components.some(({name:c})=>!c),o=s?[]:{};let a=0;if(Iu(t)){const c=Ii(e.readBytes(cm)),u=i+c;for(let l=0;l<t.components.length;++l){const d=t.components[l];e.setPosition(u+a);const[f,h]=va(e,d,{checksumAddress:r,staticPosition:u});a+=h,o[s?l:d==null?void 0:d.name]=f}return e.setPosition(i+32),[o,32]}for(let c=0;c<t.components.length;++c){const u=t.components[c],[l,d]=va(e,u,{checksumAddress:r,staticPosition:i});o[s?c:u==null?void 0:u.name]=l,a+=d}return[o,a]}function bM(e,{staticPosition:t}){const n=Ii(e.readBytes(32)),r=t+n;e.setPosition(r);const i=Ii(e.readBytes(32));if(i===0)return e.setPosition(t+32),["",32];const s=e.readBytes(i,32),o=HR(h2(s));return e.setPosition(t+32),[o,32]}function wM({checksumAddress:e,parameters:t,values:n}){const r=[];for(let i=0;i<t.length;i++)r.push(um({checksumAddress:e,parameter:t[i],value:n[i]}));return r}function um({checksumAddress:e=!1,parameter:t,value:n}){const r=t,i=dm(r.type);if(i){const[s,o]=i;return _M(n,{checksumAddress:e,length:s,parameter:{...r,type:o}})}if(r.type==="tuple")return AM(n,{checksumAddress:e,parameter:r});if(r.type==="address")return vM(n,{checksum:e});if(r.type==="bool")return xM(n);if(r.type.startsWith("uint")||r.type.startsWith("int")){const s=r.type.startsWith("int"),[,,o="256"]=k_.exec(r.type)??[];return SM(n,{signed:s,size:Number(o)})}if(r.type.startsWith("bytes"))return EM(n,{type:r.type});if(r.type==="string")return kM(n);throw new pm(r.type)}function lm(e){let t=0;for(let s=0;s<e.length;s++){const{dynamic:o,encoded:a}=e[s];o?t+=32:t+=rr(a)}const n=[],r=[];let i=0;for(let s=0;s<e.length;s++){const{dynamic:o,encoded:a}=e[s];o?(n.push(Tn(t+i,{size:32})),r.push(a),i+=rr(a)):n.push(a)}return Ir(...n,...r)}function vM(e,t){const{checksum:n=!1}=t;return Td(e,{strict:n}),{dynamic:!1,encoded:Ks(e.toLowerCase())}}function _M(e,t){const{checksumAddress:n,length:r,parameter:i}=t,s=r===null;if(!Array.isArray(e))throw new NM(e);if(!s&&e.length!==r)throw new BM({expectedLength:r,givenLength:e.length,type:`${i.type}[${r}]`});let o=!1;const a=[];for(let c=0;c<e.length;c++){const u=um({checksumAddress:n,parameter:i,value:e[c]});u.dynamic&&(o=!0),a.push(u)}if(s||o){const c=lm(a);if(s){const u=Tn(a.length,{size:32});return{dynamic:!0,encoded:a.length>0?Ir(u,c):u}}if(o)return{dynamic:!0,encoded:c}}return{dynamic:!1,encoded:Ir(...a.map(({encoded:c})=>c))}}function EM(e,{type:t}){const[,n]=t.split("bytes"),r=rr(e);if(!n){let i=e;return r%32!==0&&(i=Js(i,Math.ceil((e.length-2)/2/32)*32)),{dynamic:!0,encoded:Ir(Ks(Tn(r,{size:32})),i)}}if(r!==Number.parseInt(n,10))throw new R_({expectedSize:Number.parseInt(n,10),value:e});return{dynamic:!1,encoded:Js(e)}}function xM(e){if(typeof e!="boolean")throw new ze(`Invalid boolean value: "${e}" (type: ${typeof e}). Expected: \`true\` or \`false\`.`);return{dynamic:!1,encoded:Ks(p2(e))}}function SM(e,{signed:t,size:n}){if(typeof n=="number"){const r=2n**(BigInt(n)-(t?1n:0n))-1n,i=t?-r-1n:0n;if(e>r||e<i)throw new y2({max:r.toString(),min:i.toString(),signed:t,size:n/8,value:e.toString()})}return{dynamic:!1,encoded:Tn(e,{size:32,signed:t})}}function kM(e){const t=Sp(e),n=Math.ceil(rr(t)/32),r=[];for(let i=0;i<n;i++)r.push(Js(Vr(t,i*32,(i+1)*32)));return{dynamic:!0,encoded:Ir(Js(Tn(rr(t),{size:32})),...r)}}function AM(e,t){const{checksumAddress:n,parameter:r}=t;let i=!1;const s=[];for(let o=0;o<r.components.length;o++){const a=r.components[o],c=Array.isArray(e)?o:a.name,u=um({checksumAddress:n,parameter:a,value:e[c]});s.push(u),u.dynamic&&(i=!0)}return{dynamic:i,encoded:i?lm(s):Ir(...s.map(({encoded:o})=>o))}}function dm(e){const t=e.match(/^(.*)\[(\d+)?\]$/);return t?[t[2]?Number(t[2]):null,t[1]]:void 0}function Iu(e){var r;const{type:t}=e;if(t==="string"||t==="bytes"||t.endsWith("[]"))return!0;if(t==="tuple")return(r=e.components)==null?void 0:r.some(Iu);const n=dm(e.type);return!!(n&&Iu({...e,type:n[1]}))}const IM={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 RM({count:this.recursiveReadCount+1,limit:this.recursiveReadLimit})},assertPosition(e){if(e<0||e>this.bytes.length-1)throw new PM({length:this.bytes.length,position:e})},decrementPosition(e){if(e<0)throw new C_({offset:e});const t=this.position-e;this.assertPosition(t),this.position=t},getReadCount(e){return this.positionReadCount.get(e||this.position)||0},incrementPosition(e){if(e<0)throw new C_({offset:e});const t=this.position+e;this.assertPosition(t),this.position=t},inspectByte(e){const t=e??this.position;return this.assertPosition(t),this.bytes[t]},inspectBytes(e,t){const n=t??this.position;return this.assertPosition(n+e-1),this.bytes.subarray(n,n+e)},inspectUint8(e){const t=e??this.position;return this.assertPosition(t),this.bytes[t]},inspectUint16(e){const t=e??this.position;return this.assertPosition(t+1),this.dataView.getUint16(t)},inspectUint24(e){const t=e??this.position;return this.assertPosition(t+2),(this.dataView.getUint16(t)<<8)+this.dataView.getUint8(t+2)},inspectUint32(e){const t=e??this.position;return this.assertPosition(t+3),this.dataView.getUint32(t)},pushByte(e){this.assertPosition(this.position),this.bytes[this.position]=e,this.position++},pushBytes(e){this.assertPosition(this.position+e.length-1),this.bytes.set(e,this.position),this.position+=e.length},pushUint8(e){this.assertPosition(this.position),this.bytes[this.position]=e,this.position++},pushUint16(e){this.assertPosition(this.position+1),this.dataView.setUint16(this.position,e),this.position+=2},pushUint24(e){this.assertPosition(this.position+2),this.dataView.setUint16(this.position,e>>8),this.dataView.setUint8(this.position+2,e&255),this.position+=3},pushUint32(e){this.assertPosition(this.position+3),this.dataView.setUint32(this.position,e),this.position+=4},readByte(){this.assertReadLimit(),this._touch();const e=this.inspectByte();return this.position++,e},readBytes(e,t){this.assertReadLimit(),this._touch();const n=this.inspectBytes(e);return this.position+=t??e,n},readUint8(){this.assertReadLimit(),this._touch();const e=this.inspectUint8();return this.position+=1,e},readUint16(){this.assertReadLimit(),this._touch();const e=this.inspectUint16();return this.position+=2,e},readUint24(){this.assertReadLimit(),this._touch();const e=this.inspectUint24();return this.position+=3,e},readUint32(){this.assertReadLimit(),this._touch();const e=this.inspectUint32();return this.position+=4,e},get remaining(){return this.bytes.length-this.position},setPosition(e){const t=this.position;return this.assertPosition(e),this.position=e,()=>this.position=t},_touch(){if(this.recursiveReadLimit===Number.POSITIVE_INFINITY)return;const e=this.getReadCount();this.positionReadCount.set(this.position,e+1),e>0&&this.recursiveReadCount++}};function CM(e,{recursiveReadLimit:t=8192}={}){const n=Object.create(IM);return n.bytes=e,n.dataView=new DataView(e.buffer,e.byteOffset,e.byteLength),n.positionReadCount=new Map,n.recursiveReadLimit=t,n}class C_ extends ze{constructor({offset:t}){super(`Offset \`${t}\` cannot be negative.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Cursor.NegativeOffsetError"})}}class PM extends ze{constructor({length:t,position:n}){super(`Position \`${n}\` is out of bounds (\`0 < position < ${t}\`).`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Cursor.PositionOutOfBoundsError"})}}class RM extends ze{constructor({count:t,limit:n}){super(`Recursive read limit of \`${n}\` exceeded (recursive read count: \`${t}\`).`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Cursor.RecursiveReadLimitExceededError"})}}function TM(e,t,n={}){const{as:r="Array",checksumAddress:i=!1}=n,s=typeof t=="string"?f2(t):t,o=CM(s);if(ga(s)===0&&e.length>0)throw new MM;if(ga(s)&&ga(s)<32)throw new OM({data:typeof t=="string"?t:Cr(t),parameters:e,size:ga(s)});let a=0;const c=r==="Array"?[]:{};for(let u=0;u<e.length;++u){const l=e[u];o.setPosition(a);const[d,f]=va(o,l,{checksumAddress:i,staticPosition:0});a+=f,r==="Array"?c.push(d):c[l.name??u]=d}return c}function fm(e,t,n){const{checksumAddress:r=!1}={};if(e.length!==t.length)throw new T_({expectedLength:e.length,givenLength:t.length});const i=wM({checksumAddress:r,parameters:e,values:t}),s=lm(i);return s.length===0?"0x":s}function hm(e,t){if(e.length!==t.length)throw new T_({expectedLength:e.length,givenLength:t.length});const n=[];for(let r=0;r<e.length;r++){const i=e[r],s=t[r];n.push(hm.encode(i,s))}return Ir(...n)}(function(e){function t(n,r,i=!1){if(n==="address"){const c=r;return Td(c),Ks(c.toLowerCase(),i?32:0)}if(n==="string")return Sp(r);if(n==="bytes")return r;if(n==="bool")return Ks(p2(r),i?32:1);const s=n.match(k_);if(s){const[c,u,l="256"]=s,d=Number.parseInt(l,10)/8;return Tn(r,{size:i?32:d,signed:u==="int"})}const o=n.match(dM);if(o){const[c,u]=o;if(Number.parseInt(u,10)!==(r.length-2)/2)throw new R_({expectedSize:Number.parseInt(u,10),value:r});return Js(r,i?32:0)}const a=n.match(lM);if(a&&Array.isArray(r)){const[c,u]=a,l=[];for(let d=0;d<r.length;d++)l.push(t(u,r[d],!0));return l.length===0?"0x":Ir(...l)}throw new pm(n)}e.encode=t})(hm||(hm={}));function P_(e){return Array.isArray(e)&&typeof e[0]=="string"||typeof e=="string"?jv(e):e}class OM extends ze{constructor({data:t,parameters:n,size:r}){super(`Data size of ${r} bytes is too small for given parameters.`,{metaMessages:[`Params: (${ua(n)})`,`Data: ${t} (${r} bytes)`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiParameters.DataSizeTooSmallError"})}}class MM extends ze{constructor(){super('Cannot decode zero data ("0x") with ABI parameters.'),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiParameters.ZeroDataError"})}}class BM extends ze{constructor({expectedLength:t,givenLength:n,type:r}){super(`Array length mismatch for type \`${r}\`. Expected: \`${t}\`. Given: \`${n}\`.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiParameters.ArrayLengthMismatchError"})}}class R_ extends ze{constructor({expectedSize:t,value:n}){super(`Size of bytes "${n}" (bytes${rr(n)}) does not match expected size (bytes${t}).`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiParameters.BytesSizeMismatchError"})}}class T_ extends ze{constructor({expectedLength:t,givenLength:n}){super(["ABI encoding parameters/values length mismatch.",`Expected length (parameters): ${t}`,`Given length (values): ${n}`].join(`
79
+ `)),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiParameters.LengthMismatchError"})}}class NM extends ze{constructor(t){super(`Value \`${t}\` is not a valid array.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiParameters.InvalidArrayError"})}}class pm extends ze{constructor(t){super(`Type \`${t}\` is not a valid ABI Type.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiParameters.InvalidTypeError"})}}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const Vn=BigInt(0),Mn=BigInt(1),eo=BigInt(2),LM=BigInt(3),O_=BigInt(4),M_=BigInt(5),B_=BigInt(8);function Kn(e,t){const n=e%t;return n>=Vn?n:t+n}function fr(e,t,n){let r=e;for(;t-- >Vn;)r*=r,r%=n;return r}function mm(e,t){if(e===Vn)throw new Error("invert: expected non-zero number");if(t<=Vn)throw new Error("invert: expected positive modulus, got "+t);let n=Kn(e,t),r=t,i=Vn,s=Mn;for(;n!==Vn;){const a=r/n,c=r%n,u=i-s*a;r=n,n=c,i=s,s=u}if(r!==Mn)throw new Error("invert: does not exist");return Kn(i,t)}function N_(e,t){const n=(e.ORDER+Mn)/O_,r=e.pow(t,n);if(!e.eql(e.sqr(r),t))throw new Error("Cannot find square root");return r}function jM(e,t){const n=(e.ORDER-M_)/B_,r=e.mul(t,eo),i=e.pow(r,n),s=e.mul(t,i),o=e.mul(e.mul(s,eo),i),a=e.mul(s,e.sub(o,e.ONE));if(!e.eql(e.sqr(a),t))throw new Error("Cannot find square root");return a}function $M(e){if(e<BigInt(3))throw new Error("sqrt is not defined for small field");let t=e-Mn,n=0;for(;t%eo===Vn;)t/=eo,n++;let r=eo;const i=gm(e);for(;j_(i,r)===1;)if(r++>1e3)throw new Error("Cannot find square root: probably non-prime P");if(n===1)return N_;let s=i.pow(r,t);const o=(t+Mn)/eo;return function(c,u){if(c.is0(u))return u;if(j_(c,u)!==1)throw new Error("Cannot find square root");let l=n,d=c.mul(c.ONE,s),f=c.pow(u,t),h=c.pow(u,o);for(;!c.eql(f,c.ONE);){if(c.is0(f))return c.ZERO;let m=1,y=c.sqr(f);for(;!c.eql(y,c.ONE);)if(m++,y=c.sqr(y),m===l)throw new Error("Cannot find square root");const w=Mn<<BigInt(l-m-1),b=c.pow(d,w);l=m,d=c.sqr(b),f=c.mul(f,d),h=c.mul(h,b)}return h}}function FM(e){return e%O_===LM?N_:e%B_===M_?jM:$M(e)}const DM=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function UM(e){const t={ORDER:"bigint",MASK:"bigint",BYTES:"isSafeInteger",BITS:"isSafeInteger"},n=DM.reduce((r,i)=>(r[i]="function",r),t);return wd(e,n)}function HM(e,t,n){if(n<Vn)throw new Error("invalid exponent, negatives unsupported");if(n===Vn)return e.ONE;if(n===Mn)return t;let r=e.ONE,i=t;for(;n>Vn;)n&Mn&&(r=e.mul(r,i)),i=e.sqr(i),n>>=Mn;return r}function L_(e,t,n=!1){const r=new Array(t.length).fill(n?e.ZERO:void 0),i=t.reduce((o,a,c)=>e.is0(a)?o:(r[c]=o,e.mul(o,a)),e.ONE),s=e.inv(i);return t.reduceRight((o,a,c)=>e.is0(a)?o:(r[c]=e.mul(o,r[c]),e.mul(o,a)),s),r}function j_(e,t){const n=(e.ORDER-Mn)/eo,r=e.pow(t,n),i=e.eql(r,e.ONE),s=e.eql(r,e.ZERO),o=e.eql(r,e.neg(e.ONE));if(!i&&!s&&!o)throw new Error("invalid Legendre symbol result");return i?1:s?0:-1}function $_(e,t){t!==void 0&&ia(t);const n=t!==void 0?t:e.toString(2).length,r=Math.ceil(n/8);return{nBitLength:n,nByteLength:r}}function gm(e,t,n=!1,r={}){if(e<=Vn)throw new Error("invalid field: expected ORDER > 0, got "+e);const{nBitLength:i,nByteLength:s}=$_(e,t);if(s>2048)throw new Error("invalid field: expected ORDER of <= 2048 bytes");let o;const a=Object.freeze({ORDER:e,isLE:n,BITS:i,BYTES:s,MASK:bd(i),ZERO:Vn,ONE:Mn,create:c=>Kn(c,e),isValid:c=>{if(typeof c!="bigint")throw new Error("invalid field element: expected bigint, got "+typeof c);return Vn<=c&&c<e},is0:c=>c===Vn,isOdd:c=>(c&Mn)===Mn,neg:c=>Kn(-c,e),eql:(c,u)=>c===u,sqr:c=>Kn(c*c,e),add:(c,u)=>Kn(c+u,e),sub:(c,u)=>Kn(c-u,e),mul:(c,u)=>Kn(c*u,e),pow:(c,u)=>HM(a,c,u),div:(c,u)=>Kn(c*mm(u,e),e),sqrN:c=>c*c,addN:(c,u)=>c+u,subN:(c,u)=>c-u,mulN:(c,u)=>c*u,inv:c=>mm(c,e),sqrt:r.sqrt||(c=>(o||(o=FM(e)),o(a,c))),toBytes:c=>n?i2(c,s):mu(c,s),fromBytes:c=>{if(c.length!==s)throw new Error("Field.fromBytes: expected "+s+" bytes, got "+c.length);return n?r2(c):Vs(c)},invertBatch:c=>L_(a,c),cmov:(c,u,l)=>l?u:c});return Object.freeze(a)}function F_(e){if(typeof e!="bigint")throw new Error("field order must be bigint");const t=e.toString(2).length;return Math.ceil(t/8)}function D_(e){const t=F_(e);return t+Math.ceil(t/2)}function zM(e,t,n=!1){const r=e.length,i=F_(t),s=D_(t);if(r<16||r<s||r>1024)throw new Error("expected "+s+"-1024 bytes of input, got "+r);const o=n?r2(e):Vs(e),a=Kn(o,t-Mn)+Mn;return n?i2(a,i):mu(a,i)}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const U_=BigInt(0),ym=BigInt(1);function bm(e,t){const n=t.negate();return e?n:t}function H_(e,t){if(!Number.isSafeInteger(e)||e<=0||e>t)throw new Error("invalid window size, expected [1.."+t+"], got W="+e)}function wm(e,t){H_(e,t);const n=Math.ceil(t/e)+1,r=2**(e-1),i=2**e,s=bd(e),o=BigInt(e);return{windows:n,windowSize:r,mask:s,maxNumber:i,shiftBy:o}}function z_(e,t,n){const{windowSize:r,mask:i,maxNumber:s,shiftBy:o}=n;let a=Number(e&i),c=e>>o;a>r&&(a-=s,c+=ym);const u=t*r,l=u+Math.abs(a)-1,d=a===0,f=a<0,h=t%2!==0;return{nextN:c,offset:l,isZero:d,isNeg:f,isNegF:h,offsetF:u}}function WM(e,t){if(!Array.isArray(e))throw new Error("array expected");e.forEach((n,r)=>{if(!(n instanceof t))throw new Error("invalid point at index "+r)})}function GM(e,t){if(!Array.isArray(e))throw new Error("array of scalars expected");e.forEach((n,r)=>{if(!t.isValid(n))throw new Error("invalid scalar at index "+r)})}const vm=new WeakMap,W_=new WeakMap;function _m(e){return W_.get(e)||1}function qM(e,t){return{constTimeNegate:bm,hasPrecomputes(n){return _m(n)!==1},unsafeLadder(n,r,i=e.ZERO){let s=n;for(;r>U_;)r&ym&&(i=i.add(s)),s=s.double(),r>>=ym;return i},precomputeWindow(n,r){const{windows:i,windowSize:s}=wm(r,t),o=[];let a=n,c=a;for(let u=0;u<i;u++){c=a,o.push(c);for(let l=1;l<s;l++)c=c.add(a),o.push(c);a=c.double()}return o},wNAF(n,r,i){let s=e.ZERO,o=e.BASE;const a=wm(n,t);for(let c=0;c<a.windows;c++){const{nextN:u,offset:l,isZero:d,isNeg:f,isNegF:h,offsetF:m}=z_(i,c,a);i=u,d?o=o.add(bm(h,r[m])):s=s.add(bm(f,r[l]))}return{p:s,f:o}},wNAFUnsafe(n,r,i,s=e.ZERO){const o=wm(n,t);for(let a=0;a<o.windows&&i!==U_;a++){const{nextN:c,offset:u,isZero:l,isNeg:d}=z_(i,a,o);if(i=c,!l){const f=r[u];s=s.add(d?f.negate():f)}}return s},getPrecomputes(n,r,i){let s=vm.get(r);return s||(s=this.precomputeWindow(r,n),n!==1&&vm.set(r,i(s))),s},wNAFCached(n,r,i){const s=_m(n);return this.wNAF(s,this.getPrecomputes(s,n,i),r)},wNAFCachedUnsafe(n,r,i,s){const o=_m(n);return o===1?this.unsafeLadder(n,r,s):this.wNAFUnsafe(o,this.getPrecomputes(o,n,i),r,s)},setWindowSize(n,r){H_(r,t),W_.set(n,r),vm.delete(n)}}}function VM(e,t,n,r){WM(n,e),GM(r,t);const i=n.length,s=r.length;if(i!==s)throw new Error("arrays of points and scalars must have equal length");const o=e.ZERO,a=SR(BigInt(i));let c=1;a>12?c=a-3:a>4?c=a-2:a>0&&(c=2);const u=bd(c),l=new Array(Number(u)+1).fill(o),d=Math.floor((t.BITS-1)/c)*c;let f=o;for(let h=d;h>=0;h-=c){l.fill(o);for(let y=0;y<s;y++){const w=r[y],b=Number(w>>BigInt(h)&u);l[b]=l[b].add(n[y])}let m=o;for(let y=l.length-1,w=o;y>0;y--)w=w.add(l[y]),m=m.add(w);if(f=f.add(m),h!==0)for(let y=0;y<c;y++)f=f.double()}return f}function G_(e){return UM(e.Fp),wd(e,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze({...$_(e.n,e.nBitLength),...e,p:e.Fp.ORDER})}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */function q_(e){e.lowS!==void 0&&hu("lowS",e.lowS),e.prehash!==void 0&&hu("prehash",e.prehash)}function KM(e){const t=G_(e);wd(t,{a:"field",b:"field"},{allowInfinityPoint:"boolean",allowedPrivateKeyLengths:"array",clearCofactor:"function",fromBytes:"function",isTorsionFree:"function",toBytes:"function",wrapPrivateKey:"boolean"});const{endo:n,Fp:r,a:i}=t;if(n){if(!r.eql(i,r.ZERO))throw new Error("invalid endo: CURVE.a must be 0");if(typeof n!="object"||typeof n.beta!="bigint"||typeof n.splitScalar!="function")throw new Error('invalid endo: expected "beta": bigint and "splitScalar": function')}return Object.freeze({...t})}const Ci={Err:class extends Error{constructor(t=""){super(t)}},_tlv:{encode:(e,t)=>{const{Err:n}=Ci;if(e<0||e>256)throw new n("tlv.encode: wrong tag");if(t.length&1)throw new n("tlv.encode: unpadded data");const r=t.length/2,i=md(r);if(i.length/2&128)throw new n("tlv.encode: long form length too big");const s=r>127?md(i.length/2|128):"";return md(e)+s+i+t},decode(e,t){const{Err:n}=Ci;let r=0;if(e<0||e>256)throw new n("tlv.encode: wrong tag");if(t.length<2||t[r++]!==e)throw new n("tlv.decode: wrong tlv");const i=t[r++],s=!!(i&128);let o=0;if(!s)o=i;else{const c=i&127;if(!c)throw new n("tlv.decode(long): indefinite length not supported");if(c>4)throw new n("tlv.decode(long): byte length is too big");const u=t.subarray(r,r+c);if(u.length!==c)throw new n("tlv.decode: length bytes not complete");if(u[0]===0)throw new n("tlv.decode(long): zero leftmost byte");for(const l of u)o=o<<8|l;if(r+=c,o<128)throw new n("tlv.decode(long): not minimal encoding")}const a=t.subarray(r,r+o);if(a.length!==o)throw new n("tlv.decode: wrong value length");return{v:a,l:t.subarray(r+o)}}},_int:{encode(e){const{Err:t}=Ci;if(e<Pi)throw new t("integer: negative integers are not allowed");let n=md(e);if(Number.parseInt(n[0],16)&8&&(n="00"+n),n.length&1)throw new t("unexpected DER parsing assertion: unpadded hex");return n},decode(e){const{Err:t}=Ci;if(e[0]&128)throw new t("invalid signature integer: negative");if(e[0]===0&&!(e[1]&128))throw new t("invalid signature integer: unnecessary leading zero");return Vs(e)}},toSig(e){const{Err:t,_int:n,_tlv:r}=Ci,i=dr("signature",e),{v:s,l:o}=r.decode(48,i);if(o.length)throw new t("invalid signature: left bytes after parsing");const{v:a,l:c}=r.decode(2,s),{v:u,l}=r.decode(2,c);if(l.length)throw new t("invalid signature: left bytes after parsing");return{r:n.decode(a),s:n.decode(u)}},hexFromSig(e){const{_tlv:t,_int:n}=Ci,r=t.encode(2,n.encode(e.r)),i=t.encode(2,n.encode(e.s)),s=r+i;return t.encode(48,s)}};function Em(e,t){return pu(mu(e,t))}const Pi=BigInt(0),an=BigInt(1);BigInt(2);const xm=BigInt(3),JM=BigInt(4);function ZM(e){const t=KM(e),{Fp:n}=t,r=gm(t.n,t.nBitLength),i=t.toBytes||((v,S,I)=>{const N=S.toAffine();return yd(Uint8Array.from([4]),n.toBytes(N.x),n.toBytes(N.y))}),s=t.fromBytes||(v=>{const S=v.subarray(1),I=n.fromBytes(S.subarray(0,n.BYTES)),N=n.fromBytes(S.subarray(n.BYTES,2*n.BYTES));return{x:I,y:N}});function o(v){const{a:S,b:I}=t,N=n.sqr(v),j=n.mul(N,v);return n.add(n.add(j,n.mul(v,S)),I)}function a(v,S){const I=n.sqr(S),N=o(v);return n.eql(I,N)}if(!a(t.Gx,t.Gy))throw new Error("bad curve params: generator point");const c=n.mul(n.pow(t.a,xm),JM),u=n.mul(n.sqr(t.b),BigInt(27));if(n.is0(n.add(c,u)))throw new Error("bad curve params: a or b");function l(v){return Ep(v,an,t.n)}function d(v){const{allowedPrivateKeyLengths:S,nByteLength:I,wrapPrivateKey:N,n:j}=t;if(S&&typeof v!="bigint"){if(fu(v)&&(v=pu(v)),typeof v!="string"||!S.includes(v.length))throw new Error("invalid private key");v=v.padStart(I*2,"0")}let U;try{U=typeof v=="bigint"?v:Vs(dr("private key",v,I))}catch{throw new Error("invalid private key, expected hex or "+I+" bytes, got "+typeof v)}return N&&(U=Kn(U,j)),ma("private key",U,an,j),U}function f(v){if(!(v instanceof y))throw new Error("ProjectivePoint expected")}const h=o2((v,S)=>{const{px:I,py:N,pz:j}=v;if(n.eql(j,n.ONE))return{x:I,y:N};const U=v.is0();S==null&&(S=U?n.ONE:n.inv(j));const L=n.mul(I,S),Y=n.mul(N,S),Z=n.mul(j,S);if(U)return{x:n.ZERO,y:n.ZERO};if(!n.eql(Z,n.ONE))throw new Error("invZ was invalid");return{x:L,y:Y}}),m=o2(v=>{if(v.is0()){if(t.allowInfinityPoint&&!n.is0(v.py))return;throw new Error("bad point: ZERO")}const{x:S,y:I}=v.toAffine();if(!n.isValid(S)||!n.isValid(I))throw new Error("bad point: x or y not FE");if(!a(S,I))throw new Error("bad point: equation left != right");if(!v.isTorsionFree())throw new Error("bad point: not in prime-order subgroup");return!0});class y{constructor(S,I,N){if(S==null||!n.isValid(S))throw new Error("x required");if(I==null||!n.isValid(I)||n.is0(I))throw new Error("y required");if(N==null||!n.isValid(N))throw new Error("z required");this.px=S,this.py=I,this.pz=N,Object.freeze(this)}static fromAffine(S){const{x:I,y:N}=S||{};if(!S||!n.isValid(I)||!n.isValid(N))throw new Error("invalid affine point");if(S instanceof y)throw new Error("projective point not allowed");const j=U=>n.eql(U,n.ZERO);return j(I)&&j(N)?y.ZERO:new y(I,N,n.ONE)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static normalizeZ(S){const I=L_(n,S.map(N=>N.pz));return S.map((N,j)=>N.toAffine(I[j])).map(y.fromAffine)}static fromHex(S){const I=y.fromAffine(s(dr("pointHex",S)));return I.assertValidity(),I}static fromPrivateKey(S){return y.BASE.multiply(d(S))}static msm(S,I){return VM(y,r,S,I)}_setWindowSize(S){x.setWindowSize(this,S)}assertValidity(){m(this)}hasEvenY(){const{y:S}=this.toAffine();if(n.isOdd)return!n.isOdd(S);throw new Error("Field doesn't support isOdd")}equals(S){f(S);const{px:I,py:N,pz:j}=this,{px:U,py:L,pz:Y}=S,Z=n.eql(n.mul(I,Y),n.mul(U,j)),G=n.eql(n.mul(N,Y),n.mul(L,j));return Z&&G}negate(){return new y(this.px,n.neg(this.py),this.pz)}double(){const{a:S,b:I}=t,N=n.mul(I,xm),{px:j,py:U,pz:L}=this;let Y=n.ZERO,Z=n.ZERO,G=n.ZERO,C=n.mul(j,j),p=n.mul(U,U),g=n.mul(L,L),k=n.mul(j,U);return k=n.add(k,k),G=n.mul(j,L),G=n.add(G,G),Y=n.mul(S,G),Z=n.mul(N,g),Z=n.add(Y,Z),Y=n.sub(p,Z),Z=n.add(p,Z),Z=n.mul(Y,Z),Y=n.mul(k,Y),G=n.mul(N,G),g=n.mul(S,g),k=n.sub(C,g),k=n.mul(S,k),k=n.add(k,G),G=n.add(C,C),C=n.add(G,C),C=n.add(C,g),C=n.mul(C,k),Z=n.add(Z,C),g=n.mul(U,L),g=n.add(g,g),C=n.mul(g,k),Y=n.sub(Y,C),G=n.mul(g,p),G=n.add(G,G),G=n.add(G,G),new y(Y,Z,G)}add(S){f(S);const{px:I,py:N,pz:j}=this,{px:U,py:L,pz:Y}=S;let Z=n.ZERO,G=n.ZERO,C=n.ZERO;const p=t.a,g=n.mul(t.b,xm);let k=n.mul(I,U),R=n.mul(N,L),T=n.mul(j,Y),M=n.add(I,N),$=n.add(U,L);M=n.mul(M,$),$=n.add(k,R),M=n.sub(M,$),$=n.add(I,j);let O=n.add(U,Y);return $=n.mul($,O),O=n.add(k,T),$=n.sub($,O),O=n.add(N,j),Z=n.add(L,Y),O=n.mul(O,Z),Z=n.add(R,T),O=n.sub(O,Z),C=n.mul(p,$),Z=n.mul(g,T),C=n.add(Z,C),Z=n.sub(R,C),C=n.add(R,C),G=n.mul(Z,C),R=n.add(k,k),R=n.add(R,k),T=n.mul(p,T),$=n.mul(g,$),R=n.add(R,T),T=n.sub(k,T),T=n.mul(p,T),$=n.add($,T),k=n.mul(R,$),G=n.add(G,k),k=n.mul(O,$),Z=n.mul(M,Z),Z=n.sub(Z,k),k=n.mul(M,R),C=n.mul(O,C),C=n.add(C,k),new y(Z,G,C)}subtract(S){return this.add(S.negate())}is0(){return this.equals(y.ZERO)}wNAF(S){return x.wNAFCached(this,S,y.normalizeZ)}multiplyUnsafe(S){const{endo:I,n:N}=t;ma("scalar",S,Pi,N);const j=y.ZERO;if(S===Pi)return j;if(this.is0()||S===an)return this;if(!I||x.hasPrecomputes(this))return x.wNAFCachedUnsafe(this,S,y.normalizeZ);let{k1neg:U,k1:L,k2neg:Y,k2:Z}=I.splitScalar(S),G=j,C=j,p=this;for(;L>Pi||Z>Pi;)L&an&&(G=G.add(p)),Z&an&&(C=C.add(p)),p=p.double(),L>>=an,Z>>=an;return U&&(G=G.negate()),Y&&(C=C.negate()),C=new y(n.mul(C.px,I.beta),C.py,C.pz),G.add(C)}multiply(S){const{endo:I,n:N}=t;ma("scalar",S,an,N);let j,U;if(I){const{k1neg:L,k1:Y,k2neg:Z,k2:G}=I.splitScalar(S);let{p:C,f:p}=this.wNAF(Y),{p:g,f:k}=this.wNAF(G);C=x.constTimeNegate(L,C),g=x.constTimeNegate(Z,g),g=new y(n.mul(g.px,I.beta),g.py,g.pz),j=C.add(g),U=p.add(k)}else{const{p:L,f:Y}=this.wNAF(S);j=L,U=Y}return y.normalizeZ([j,U])[0]}multiplyAndAddUnsafe(S,I,N){const j=y.BASE,U=(Y,Z)=>Z===Pi||Z===an||!Y.equals(j)?Y.multiplyUnsafe(Z):Y.multiply(Z),L=U(this,I).add(U(S,N));return L.is0()?void 0:L}toAffine(S){return h(this,S)}isTorsionFree(){const{h:S,isTorsionFree:I}=t;if(S===an)return!0;if(I)return I(y,this);throw new Error("isTorsionFree() has not been declared for the elliptic curve")}clearCofactor(){const{h:S,clearCofactor:I}=t;return S===an?this:I?I(y,this):this.multiplyUnsafe(t.h)}toRawBytes(S=!0){return hu("isCompressed",S),this.assertValidity(),i(y,this,S)}toHex(S=!0){return hu("isCompressed",S),pu(this.toRawBytes(S))}}y.BASE=new y(t.Gx,t.Gy,n.ONE),y.ZERO=new y(n.ZERO,n.ONE,n.ZERO);const{endo:w,nBitLength:b}=t,x=qM(y,w?Math.ceil(b/2):b);return{CURVE:t,ProjectivePoint:y,normPrivateKeyToScalar:d,weierstrassEquation:o,isWithinCurveOrder:l}}function YM(e){const t=G_(e);return wd(t,{hash:"hash",hmac:"function",randomBytes:"function"},{bits2int:"function",bits2int_modN:"function",lowS:"boolean"}),Object.freeze({lowS:!0,...t})}function QM(e){const t=YM(e),{Fp:n,n:r,nByteLength:i,nBitLength:s}=t,o=n.BYTES+1,a=2*n.BYTES+1;function c(g){return Kn(g,r)}function u(g){return mm(g,r)}const{ProjectivePoint:l,normPrivateKeyToScalar:d,weierstrassEquation:f,isWithinCurveOrder:h}=ZM({...t,toBytes(g,k,R){const T=k.toAffine(),M=n.toBytes(T.x),$=yd;return hu("isCompressed",R),R?$(Uint8Array.from([k.hasEvenY()?2:3]),M):$(Uint8Array.from([4]),M,n.toBytes(T.y))},fromBytes(g){const k=g.length,R=g[0],T=g.subarray(1);if(k===o&&(R===2||R===3)){const M=Vs(T);if(!Ep(M,an,n.ORDER))throw new Error("Point is not on curve");const $=f(M);let O;try{O=n.sqrt($)}catch(ue){const ne=ue instanceof Error?": "+ue.message:"";throw new Error("Point is not on curve"+ne)}const _=(O&an)===an;return(R&1)===1!==_&&(O=n.neg(O)),{x:M,y:O}}else if(k===a&&R===4){const M=n.fromBytes(T.subarray(0,n.BYTES)),$=n.fromBytes(T.subarray(n.BYTES,2*n.BYTES));return{x:M,y:$}}else{const M=o,$=a;throw new Error("invalid Point, expected length of "+M+", or uncompressed "+$+", got "+k)}}});function m(g){const k=r>>an;return g>k}function y(g){return m(g)?c(-g):g}const w=(g,k,R)=>Vs(g.slice(k,R));class b{constructor(k,R,T){ma("r",k,an,r),ma("s",R,an,r),this.r=k,this.s=R,T!=null&&(this.recovery=T),Object.freeze(this)}static fromCompact(k){const R=i;return k=dr("compactSignature",k,R*2),new b(w(k,0,R),w(k,R,2*R))}static fromDER(k){const{r:R,s:T}=Ci.toSig(dr("DER",k));return new b(R,T)}assertValidity(){}addRecoveryBit(k){return new b(this.r,this.s,k)}recoverPublicKey(k){const{r:R,s:T,recovery:M}=this,$=j(dr("msgHash",k));if(M==null||![0,1,2,3].includes(M))throw new Error("recovery id invalid");const O=M===2||M===3?R+t.n:R;if(O>=n.ORDER)throw new Error("recovery id 2 or 3 invalid");const _=M&1?"03":"02",F=l.fromHex(_+Em(O,n.BYTES)),ue=u(O),ne=c(-$*ue),q=c(T*ue),J=l.BASE.multiplyAndAddUnsafe(F,ne,q);if(!J)throw new Error("point at infinify");return J.assertValidity(),J}hasHighS(){return m(this.s)}normalizeS(){return this.hasHighS()?new b(this.r,c(-this.s),this.recovery):this}toDERRawBytes(){return gd(this.toDERHex())}toDERHex(){return Ci.hexFromSig(this)}toCompactRawBytes(){return gd(this.toCompactHex())}toCompactHex(){const k=i;return Em(this.r,k)+Em(this.s,k)}}const x={isValidPrivateKey(g){try{return d(g),!0}catch{return!1}},normPrivateKeyToScalar:d,randomPrivateKey:()=>{const g=D_(t.n);return zM(t.randomBytes(g),t.n)},precompute(g=8,k=l.BASE){return k._setWindowSize(g),k.multiply(BigInt(3)),k}};function v(g,k=!0){return l.fromPrivateKey(g).toRawBytes(k)}function S(g){if(typeof g=="bigint")return!1;if(g instanceof l)return!0;const R=dr("key",g).length,T=n.BYTES,M=T+1,$=2*T+1;if(!(t.allowedPrivateKeyLengths||i===M))return R===M||R===$}function I(g,k,R=!0){if(S(g)===!0)throw new Error("first arg must be private key");if(S(k)===!1)throw new Error("second arg must be public key");return l.fromHex(k).multiply(d(g)).toRawBytes(R)}const N=t.bits2int||function(g){if(g.length>8192)throw new Error("input is too large");const k=Vs(g),R=g.length*8-s;return R>0?k>>BigInt(R):k},j=t.bits2int_modN||function(g){return c(N(g))},U=bd(s);function L(g){return ma("num < 2^"+s,g,Pi,U),mu(g,i)}function Y(g,k,R=Z){if(["recovered","canonical"].some(le=>le in R))throw new Error("sign() legacy options not supported");const{hash:T,randomBytes:M}=t;let{lowS:$,prehash:O,extraEntropy:_}=R;$==null&&($=!0),g=dr("msgHash",g),q_(R),O&&(g=dr("prehashed msgHash",T(g)));const F=j(g),ue=d(k),ne=[L(ue),L(F)];if(_!=null&&_!==!1){const le=_===!0?M(n.BYTES):_;ne.push(dr("extraEntropy",le))}const q=yd(...ne),J=F;function te(le){const pe=N(le);if(!h(pe))return;const z=u(pe),D=l.BASE.multiply(pe).toAffine(),ie=c(D.x);if(ie===Pi)return;const de=c(z*c(J+ie*ue));if(de===Pi)return;let _e=(D.x===ie?0:2)|Number(D.y&an),Ae=de;return $&&m(de)&&(Ae=y(de),_e^=1),new b(ie,Ae,_e)}return{seed:q,k2sig:te}}const Z={lowS:t.lowS,prehash:!1},G={lowS:t.lowS,prehash:!1};function C(g,k,R=Z){const{seed:T,k2sig:M}=Y(g,k,R),$=t;return kR($.hash.outputLen,$.nByteLength,$.hmac)(T,M)}l.BASE._setWindowSize(8);function p(g,k,R,T=G){var _e;const M=g;k=dr("msgHash",k),R=dr("publicKey",R);const{lowS:$,prehash:O,format:_}=T;if(q_(T),"strict"in T)throw new Error("options.strict was renamed to lowS");if(_!==void 0&&_!=="compact"&&_!=="der")throw new Error("format must be compact or der");const F=typeof M=="string"||fu(M),ue=!F&&!_&&typeof M=="object"&&M!==null&&typeof M.r=="bigint"&&typeof M.s=="bigint";if(!F&&!ue)throw new Error("invalid signature, expected Uint8Array, hex string or Signature instance");let ne,q;try{if(ue&&(ne=new b(M.r,M.s)),F){try{_!=="compact"&&(ne=b.fromDER(M))}catch(Ae){if(!(Ae instanceof Ci.Err))throw Ae}!ne&&_!=="der"&&(ne=b.fromCompact(M))}q=l.fromHex(R)}catch{return!1}if(!ne||$&&ne.hasHighS())return!1;O&&(k=t.hash(k));const{r:J,s:te}=ne,le=j(k),pe=u(te),z=c(le*pe),D=c(J*pe),ie=(_e=l.BASE.multiplyAndAddUnsafe(q,z,D))==null?void 0:_e.toAffine();return ie?c(ie.x)===J:!1}return{CURVE:t,getPublicKey:v,getSharedSecret:I,sign:C,verify:p,ProjectivePoint:l,Signature:b,utils:x}}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */function XM(e){return{hash:e,hmac:(t,...n)=>om(e,t,vi(...n)),randomBytes:G0}}function e9(e,t){const n=r=>QM({...e,...XM(r)});return{...n(t),create:n}}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const V_=BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),K_=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),t9=BigInt(0),n9=BigInt(1),Sm=BigInt(2),J_=(e,t)=>(e+t/Sm)/t;function r9(e){const t=V_,n=BigInt(3),r=BigInt(6),i=BigInt(11),s=BigInt(22),o=BigInt(23),a=BigInt(44),c=BigInt(88),u=e*e*e%t,l=u*u*e%t,d=fr(l,n,t)*l%t,f=fr(d,n,t)*l%t,h=fr(f,Sm,t)*u%t,m=fr(h,i,t)*h%t,y=fr(m,s,t)*m%t,w=fr(y,a,t)*y%t,b=fr(w,c,t)*w%t,x=fr(b,a,t)*y%t,v=fr(x,n,t)*l%t,S=fr(v,o,t)*m%t,I=fr(S,r,t)*u%t,N=fr(I,Sm,t);if(!km.eql(km.sqr(N),e))throw new Error("Cannot find square root");return N}const km=gm(V_,void 0,void 0,{sqrt:r9}),Am=e9({a:t9,b:BigInt(7),Fp:km,n:K_,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),h:BigInt(1),lowS:!0,endo:{beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar:e=>{const t=K_,n=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),r=-n9*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),i=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),s=n,o=BigInt("0x100000000000000000000000000000000"),a=J_(s*e,t),c=J_(-r*e,t);let u=Kn(e-a*n-c*i,t),l=Kn(-a*r-c*s,t);const d=u>o,f=l>o;if(d&&(u=t-u),f&&(l=t-l),u>o||l>o)throw new Error("splitScalar: Endomorphism failed, k="+e);return{k1neg:d,k1:u,k2neg:f,k2:l}}}},Zp),i9=Object.freeze(Object.defineProperty({__proto__:null,secp256k1:Am},Symbol.toStringTag,{value:"Module"}));function Z_(e,t={}){const{recovered:n}=t;if(typeof e.r>"u")throw new Cm({signature:e});if(typeof e.s>"u")throw new Cm({signature:e});if(n&&typeof e.yParity>"u")throw new Cm({signature:e});if(e.r<0n||e.r>A_)throw new d9({value:e.r});if(e.s<0n||e.s>A_)throw new f9({value:e.s});if(typeof e.yParity=="number"&&e.yParity!==0&&e.yParity!==1)throw new Pm({value:e.yParity})}function s9(e){return Y_(Cr(e))}function Y_(e){if(e.length!==130&&e.length!==132)throw new l9({signature:e});const t=BigInt(Vr(e,0,32)),n=BigInt(Vr(e,32,64)),r=(()=>{const i=+`0x${e.slice(130)}`;if(!Number.isNaN(i))try{return Im(i)}catch{throw new Pm({value:i})}})();return typeof r>"u"?{r:t,s:n}:{r:t,s:n,yParity:r}}function o9(e){if(!(typeof e.r>"u")&&!(typeof e.s>"u"))return a9(e)}function a9(e){const t=typeof e=="string"?Y_(e):e instanceof Uint8Array?s9(e):typeof e.r=="string"?u9(e):e.v?c9(e):{r:e.r,s:e.s,...typeof e.yParity<"u"?{yParity:e.yParity}:{}};return Z_(t),t}function c9(e){return{r:e.r,s:e.s,yParity:Im(e.v)}}function u9(e){const t=(()=>{const n=e.v?Number(e.v):void 0;let r=e.yParity?Number(e.yParity):void 0;if(typeof n=="number"&&typeof r!="number"&&(r=Im(n)),typeof r!="number")throw new Pm({value:e.yParity});return r})();return{r:BigInt(e.r),s:BigInt(e.s),yParity:t}}function Im(e){if(e===0||e===27)return 0;if(e===1||e===28)return 1;if(e>=35)return e%2===0?1:0;throw new h9({value:e})}let l9=class extends ze{constructor({signature:t}){super(`Value \`${t}\` is an invalid signature size.`,{metaMessages:["Expected: 64 bytes or 65 bytes.",`Received ${rr(ZR(t))} bytes.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Signature.InvalidSerializedSizeError"})}},Cm=class extends ze{constructor({signature:t}){super(`Signature \`${d2(t)}\` is missing either an \`r\`, \`s\`, or \`yParity\` property.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Signature.MissingPropertiesError"})}},d9=class extends ze{constructor({value:t}){super(`Value \`${t}\` is an invalid r value. r must be a positive integer less than 2^256.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Signature.InvalidRError"})}},f9=class extends ze{constructor({value:t}){super(`Value \`${t}\` is an invalid s value. s must be a positive integer less than 2^256.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Signature.InvalidSError"})}},Pm=class extends ze{constructor({value:t}){super(`Value \`${t}\` is an invalid y-parity value. Y-parity must be 0 or 1.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Signature.InvalidYParityError"})}},h9=class extends ze{constructor({value:t}){super(`Value \`${t}\` is an invalid v value. v must be 27, 28 or >=35.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Signature.InvalidVError"})}};function p9(e,t={}){return typeof e.chainId=="string"?m9(e):{...e,...t.signature}}function m9(e){const{address:t,chainId:n,nonce:r}=e,i=o9(e);return{address:t,chainId:Number(n),nonce:BigInt(r),...i}}const g9="0x8010801080108010801080108010801080108010801080108010801080108010",y9=P_("(uint256 chainId, address delegation, uint256 nonce, uint8 yParity, uint256 r, uint256 s), address to, bytes data");function Q_(e){if(typeof e=="string"){if(Vr(e,-32)!==g9)throw new v9(e)}else Z_(e.authorization)}function b9(e){Q_(e);const t=g2(Vr(e,-64,-32)),n=Vr(e,-t-64,-64),r=Vr(e,0,-t-64),[i,s,o]=TM(y9,n);return{authorization:p9({address:i.delegation,chainId:Number(i.chainId),nonce:i.nonce,yParity:i.yParity,r:i.r,s:i.s}),signature:r,...o&&o!=="0x"?{data:o,to:s}:{}}}function w9(e){try{return Q_(e),!0}catch{return!1}}let v9=class extends ze{constructor(t){super(`Value \`${t}\` is an invalid ERC-8010 wrapped signature.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"SignatureErc8010.InvalidWrappedSignatureError"})}};function Rm(e){const{address:t,data:n,signature:r,to:i="hex"}=e,s=Hn([zn([{type:"address"},{type:"bytes"},{type:"bytes"}],[t,n,r]),sM]);return i==="hex"?s:Rn(s)}class _9 extends ee{constructor({value:t}){super(`Number \`${t}\` is not a valid decimal number.`,{name:"InvalidDecimalNumberError"})}}function X_(e,t){if(!/^(-?)([0-9]*)\.?([0-9]*)$/.test(e))throw new _9({value:e});let[n,r="0"]=e.split(".");const i=n.startsWith("-");if(i&&(n=n.slice(1)),r=r.replace(/(0+)$/,""),t===0)Math.round(+`.${r}`)===1&&(n=`${BigInt(n)+1n}`),r="";else if(r.length>t){const[s,o,a]=[r.slice(0,t-1),r.slice(t-1,t),r.slice(t)],c=Math.round(+`${o}.${a}`);c>9?r=`${BigInt(s)+BigInt(1)}0`.padStart(s.length+1,"0"):r=`${s}${c}`,r.length>t&&(r=r.slice(1),n=`${BigInt(n)+1n}`),r=r.slice(0,t)}else r=r.padEnd(t,"0");return BigInt(`${i?"-":""}${n}${r}`)}function E9(e,t="wei"){return X_(e,Wv[t])}function x9(e){return e.map(t=>({...t,value:BigInt(t.value)}))}function S9(e){return{...e,balance:e.balance?BigInt(e.balance):void 0,nonce:e.nonce?Pn(e.nonce):void 0,storageProof:e.storageProof?x9(e.storageProof):void 0}}async function k9(e,{address:t,blockNumber:n,blockTag:r,storageKeys:i}){const s=r??"latest",o=n!==void 0?oe(n):void 0,a=await e.request({method:"eth_getProof",params:[t,i,o||s]});return S9(a)}async function A9(e,{address:t,blockNumber:n,blockTag:r="latest",slot:i}){const s=n!==void 0?oe(n):void 0;return await e.request({method:"eth_getStorageAt",params:[t,i,s||r]})}async function Od(e,{blockHash:t,blockNumber:n,blockTag:r,hash:i,index:s,sender:o,nonce:a}){var f,h,m;const c=r||"latest",u=n!==void 0?oe(n):void 0;let l=null;if(i?l=await e.request({method:"eth_getTransactionByHash",params:[i]},{dedupe:!0}):t?l=await e.request({method:"eth_getTransactionByBlockHashAndIndex",params:[t,oe(s)]},{dedupe:!0}):typeof s=="number"?l=await e.request({method:"eth_getTransactionByBlockNumberAndIndex",params:[u||c,oe(s)]},{dedupe:!!u}):o&&typeof a=="number"&&(l=await e.request({method:"eth_getTransactionBySenderAndNonce",params:[o,oe(a)]},{dedupe:!0})),!l)throw new qv({blockHash:t,blockNumber:n,blockTag:c,hash:i,index:s});return(((m=(h=(f=e.chain)==null?void 0:f.formatters)==null?void 0:h.transaction)==null?void 0:m.format)||Eu)(l,"getTransaction")}async function I9(e,{hash:t,transactionReceipt:n}){const[r,i]=await Promise.all([ve(e,xu,"getBlockNumber")({}),t?ve(e,Od,"getTransaction")({hash:t}):void 0]),s=(n==null?void 0:n.blockNumber)||(i==null?void 0:i.blockNumber);return s?r-s+1n:0n}async function Md(e,{hash:t}){var i,s,o;const n=await e.request({method:"eth_getTransactionReceipt",params:[t]},{dedupe:!0});if(!n)throw new Vv({hash:t});return(((o=(s=(i=e.chain)==null?void 0:i.formatters)==null?void 0:s.transactionReceipt)==null?void 0:o.format)||Pd)(n,"getTransactionReceipt")}async function e6(e,t){var x;const{account:n,authorizationList:r,allowFailure:i=!0,blockNumber:s,blockOverrides:o,blockTag:a,stateOverride:c}=t,u=t.contracts,{batchSize:l=t.batchSize??1024,deployless:d=t.deployless??!1}=typeof((x=e.batch)==null?void 0:x.multicall)=="object"?e.batch.multicall:{},f=(()=>{if(t.multicallAddress)return t.multicallAddress;if(d)return null;if(e.chain)return da({blockNumber:s,chain:e.chain,contract:"multicall3"});throw new Error("client chain not configured. multicallAddress is required.")})(),h=[[]];let m=0,y=0;for(let v=0;v<u.length;v++){const{abi:S,address:I,args:N,functionName:j}=u[v];try{const U=jt({abi:S,args:N,functionName:j});y+=(U.length-2)/2,l>0&&y>l&&h[m].length>0&&(m++,y=(U.length-2)/2,h[m]=[]),h[m]=[...h[m],{allowFailure:!0,callData:U,target:I}]}catch(U){const L=qs(U,{abi:S,address:I,args:N,docsPath:"/docs/contract/multicall",functionName:j,sender:n});if(!i)throw L;h[m]=[...h[m],{allowFailure:!0,callData:"0x",target:I}]}}const w=await Promise.allSettled(h.map(v=>ve(e,On,"readContract")({...f===null?{code:kp}:{address:f},abi:Qo,account:n,args:[v],authorizationList:r,blockNumber:s,blockOverrides:o,blockTag:a,functionName:"aggregate3",stateOverride:c}))),b=[];for(let v=0;v<w.length;v++){const S=w[v];if(S.status==="rejected"){if(!i)throw S.reason;for(let N=0;N<h[v].length;N++)b.push({status:"failure",error:S.reason,result:void 0});continue}const I=S.value;for(let N=0;N<I.length;N++){const{returnData:j,success:U}=I[N],{callData:L}=h[v][N],{abi:Y,address:Z,functionName:G,args:C}=u[b.length];try{if(L==="0x")throw new Uc;if(!U)throw new pd({data:j});const p=ts({abi:Y,args:C,data:j,functionName:G});b.push(i?{result:p,status:"success"}:p)}catch(p){const g=qs(p,{abi:Y,address:Z,args:C,docsPath:"/docs/contract/multicall",functionName:G});if(!i)throw g;b.push({error:g,result:void 0,status:"failure"})}}}if(b.length!==u.length)throw new ee("multicall results mismatch");return b}async function Tm(e,t){const{blockNumber:n,blockTag:r=e.experimental_blockTag??"latest",blocks:i,returnFullTransactions:s,traceTransfers:o,validation:a}=t;try{const c=[];for(const f of i){const h=f.blockOverrides?_2(f.blockOverrides):void 0,m=f.calls.map(w=>{const b=w,x=b.account?Ut(b.account):void 0,v=b.abi?jt(b):b.data,S={...b,account:x,data:b.dataSuffix?Zt([v||"0x",b.dataSuffix]):v,from:b.from??(x==null?void 0:x.address)};return Ys(S),ba(S)}),y=f.stateOverrides?Ed(f.stateOverrides):void 0;c.push({blockOverrides:h,calls:m,stateOverrides:y})}const l=(typeof n=="bigint"?oe(n):void 0)||r;return(await e.request({method:"eth_simulateV1",params:[{blockStateCalls:c,returnFullTransactions:s,traceTransfers:o,validation:a},l]})).map((f,h)=>({...Wp(f),calls:f.calls.map((m,y)=>{var Y,Z;const{abi:w,args:b,functionName:x,to:v}=i[h].calls[y],S=((Y=m.error)==null?void 0:Y.data)??m.returnData,I=BigInt(m.gasUsed),N=(Z=m.logs)==null?void 0:Z.map(G=>Rr(G)),j=m.status==="0x1"?"success":"failure",U=w&&j==="success"&&S!=="0x"?ts({abi:w,data:S,functionName:x}):null,L=(()=>{if(j==="success")return;let G;if(S==="0x"?G=new Uc:S&&(G=new pd({data:S})),!!G)return qs(G,{abi:w??[],address:v??"0x",args:b,functionName:x??"<unknown>"})})();return{data:S,gasUsed:I,logs:N,status:j,...j==="success"?{result:U}:{error:L}}})}))}catch(c){const u=c,l=_d(u,{});throw l instanceof bu?u:l}}function Om(e){let t=!0,n="",r=0,i="",s=!1;for(let o=0;o<e.length;o++){const a=e[o];if(["(",")",","].includes(a)&&(t=!0),a==="("&&r++,a===")"&&r--,!!t){if(r===0){if(a===" "&&["event","function","error",""].includes(i))i="";else if(i+=a,a===")"){s=!0;break}continue}if(a===" "){e[o-1]!==","&&n!==","&&n!==",("&&(n="",t=!1);continue}i+=a,n+=a}}if(!s)throw new ze("Unable to normalize signature.");return i}function Mm(e,t){const n=typeof e,r=t.type;switch(r){case"address":return am(e,{strict:!1});case"bool":return n==="boolean";case"function":return n==="string";case"string":return n==="string";default:return r==="tuple"&&"components"in t?Object.values(t.components).every((i,s)=>Mm(Object.values(e)[s],i)):/^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(r)?n==="number"||n==="bigint":/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/.test(r)?n==="string"||e instanceof Uint8Array:/[a-z]+[1-9]{0,3}(\[[0-9]{0,}\])+$/.test(r)?Array.isArray(e)&&e.every(i=>Mm(i,{...t,type:r.replace(/(\[[0-9]{0,}\])$/,"")})):!1}}function t6(e,t,n){for(const r in e){const i=e[r],s=t[r];if(i.type==="tuple"&&s.type==="tuple"&&"components"in i&&"components"in s)return t6(i.components,s.components,n[r]);const o=[i.type,s.type];if(o.includes("address")&&o.includes("bytes20")?!0:o.includes("address")&&o.includes("string")?am(n[r],{strict:!1}):o.includes("address")&&o.includes("bytes")?am(n[r],{strict:!1}):!1)return o}}function n6(e,t={}){const{prepare:n=!0}=t,r=Array.isArray(e)||typeof e=="string"?Lv(e):e;return{...r,...n?{hash:_a(r)}:{}}}function Bd(e,t,n){const{args:r=[],prepare:i=!0}=n??{},s=YR(t,{strict:!1}),o=e.filter(u=>s?u.type==="function"||u.type==="error"?r6(u)===Vr(t,0,4):u.type==="event"?_a(u)===t:!1:"name"in u&&u.name===t);if(o.length===0)throw new Nd({name:t});if(o.length===1)return{...o[0],...i?{hash:_a(o[0])}:{}};let a;for(const u of o){if(!("inputs"in u))continue;if(!r||r.length===0){if(!u.inputs||u.inputs.length===0)return{...u,...i?{hash:_a(u)}:{}};continue}if(!u.inputs||u.inputs.length===0||u.inputs.length!==r.length)continue;if(r.every((d,f)=>{const h="inputs"in u&&u.inputs[f];return h?Mm(d,h):!1})){if(a&&"inputs"in a&&a.inputs){const d=t6(u.inputs,a.inputs,r);if(d)throw new P9({abiItem:u,type:d[0]},{abiItem:a,type:d[1]})}a=u}}const c=(()=>{if(a)return a;const[u,...l]=o;return{...u,overloads:l}})();if(!c)throw new Nd({name:t});return{...c,...i?{hash:_a(c)}:{}}}function r6(...e){const t=(()=>{if(Array.isArray(e[0])){const[n,r]=e;return Bd(n,r)}return e[0]})();return Vr(_a(t),0,4)}function C9(...e){const t=(()=>{if(Array.isArray(e[0])){const[r,i]=e;return Bd(r,i)}return e[0]})(),n=typeof t=="string"?t:ad(t);return Om(n)}function _a(...e){const t=(()=>{if(Array.isArray(e[0])){const[n,r]=e;return Bd(n,r)}return e[0]})();return typeof t!="string"&&"hash"in t&&t.hash?t.hash:E_(Sp(C9(t)))}class P9 extends ze{constructor(t,n){super("Found ambiguous types in overloaded ABI Items.",{metaMessages:[`\`${t.type}\` in \`${Om(ad(t.abiItem))}\`, and`,`\`${n.type}\` in \`${Om(ad(n.abiItem))}\``,"","These types encode differently and cannot be distinguished at runtime.","Remove one of the ambiguous items in the ABI."]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiItem.AmbiguityError"})}}class Nd extends ze{constructor({name:t,data:n,type:r="item"}){const i=t?` with name "${t}"`:n?` with data "${n}"`:"";super(`ABI ${r}${i} not found.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiItem.NotFoundError"})}}function R9(...e){var s;const[t,n]=(()=>{if(Array.isArray(e[0])){const[o,a]=e;return[O9(o),a]}return e})(),{bytecode:r,args:i}=n;return Ir(r,(s=t.inputs)!=null&&s.length&&(i!=null&&i.length)?fm(t.inputs,i):"0x")}function T9(e){return n6(e)}function O9(e){const t=e.find(n=>n.type==="constructor");if(!t)throw new Nd({name:"constructor"});return t}function M9(...e){const[t,n=[]]=(()=>{if(Array.isArray(e[0])){const[u,l,d]=e;return[i6(u,l,{args:d}),d]}const[a,c]=e;return[a,c]})(),{overloads:r}=t,i=r?i6([t,...r],t.name,{args:n}):t,s=B9(i),o=n.length>0?fm(i.inputs,n):void 0;return o?Ir(s,o):s}function Ea(e,t={}){return n6(e,t)}function i6(e,t,n){const r=Bd(e,t,n);if(r.type!=="function")throw new Nd({name:t,type:"function"});return r}function B9(e){return r6(e)}const N9="0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",Tr="0x0000000000000000000000000000000000000000",L9="0x6080604052348015600e575f80fd5b5061016d8061001c5f395ff3fe608060405234801561000f575f80fd5b5060043610610029575f3560e01c8063f8b2cb4f1461002d575b5f80fd5b610047600480360381019061004291906100db565b61005d565b604051610054919061011e565b60405180910390f35b5f8173ffffffffffffffffffffffffffffffffffffffff16319050919050565b5f80fd5b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f6100aa82610081565b9050919050565b6100ba816100a0565b81146100c4575f80fd5b50565b5f813590506100d5816100b1565b92915050565b5f602082840312156100f0576100ef61007d565b5b5f6100fd848285016100c7565b91505092915050565b5f819050919050565b61011881610106565b82525050565b5f6020820190506101315f83018461010f565b9291505056fea26469706673582212203b9fe929fe995c7cf9887f0bdba8a36dd78e8b73f149b17d2d9ad7cd09d2dc6264736f6c634300081a0033";async function j9(e,t){const{blockNumber:n,blockTag:r,calls:i,stateOverrides:s,traceAssetChanges:o,traceTransfers:a,validation:c}=t,u=t.account?Ut(t.account):void 0;if(o&&!u)throw new ee("`account` is required when `traceAssetChanges` is true");const l=u?R9(T9("constructor(bytes, bytes)"),{bytecode:E2,args:[L9,M9(Ea("function getBalance(address)"),[u.address])]}):void 0,d=o?await Promise.all(t.calls.map(async T=>{if(!T.data&&!T.abi)return;const{accessList:M}=await T2(e,{account:u.address,...T,data:T.abi?jt(T):T.data});return M.map(({address:$,storageKeys:O})=>O.length>0?$:null)})).then(T=>T.flat().filter(Boolean)):[],f=await Tm(e,{blockNumber:n,blockTag:r,blocks:[...o?[{calls:[{data:l}],stateOverrides:s},{calls:d.map((T,M)=>({abi:[Ea("function balanceOf(address) returns (uint256)")],functionName:"balanceOf",args:[u.address],to:T,from:Tr,nonce:M})),stateOverrides:[{address:Tr,nonce:0}]}]:[],{calls:[...i,{to:Tr}].map(T=>({...T,from:u==null?void 0:u.address})),stateOverrides:s},...o?[{calls:[{data:l}]},{calls:d.map((T,M)=>({abi:[Ea("function balanceOf(address) returns (uint256)")],functionName:"balanceOf",args:[u.address],to:T,from:Tr,nonce:M})),stateOverrides:[{address:Tr,nonce:0}]},{calls:d.map((T,M)=>({to:T,abi:[Ea("function decimals() returns (uint256)")],functionName:"decimals",from:Tr,nonce:M})),stateOverrides:[{address:Tr,nonce:0}]},{calls:d.map((T,M)=>({to:T,abi:[Ea("function tokenURI(uint256) returns (string)")],functionName:"tokenURI",args:[0n],from:Tr,nonce:M})),stateOverrides:[{address:Tr,nonce:0}]},{calls:d.map((T,M)=>({to:T,abi:[Ea("function symbol() returns (string)")],functionName:"symbol",from:Tr,nonce:M})),stateOverrides:[{address:Tr,nonce:0}]}]:[]],traceTransfers:a,validation:c}),h=o?f[2]:f[0],[m,y,,w,b,x,v,S]=o?f:[],{calls:I,...N}=h,j=I.slice(0,-1)??[],U=(m==null?void 0:m.calls)??[],L=(y==null?void 0:y.calls)??[],Y=[...U,...L].map(T=>T.status==="success"?It(T.data):null),Z=(w==null?void 0:w.calls)??[],G=(b==null?void 0:b.calls)??[],C=[...Z,...G].map(T=>T.status==="success"?It(T.data):null),p=((x==null?void 0:x.calls)??[]).map(T=>T.status==="success"?T.result:null),g=((S==null?void 0:S.calls)??[]).map(T=>T.status==="success"?T.result:null),k=((v==null?void 0:v.calls)??[]).map(T=>T.status==="success"?T.result:null),R=[];for(const[T,M]of C.entries()){const $=Y[T];if(typeof M!="bigint"||typeof $!="bigint")continue;const O=p[T-1],_=g[T-1],F=k[T-1],ue=T===0?{address:N9,decimals:18,symbol:"ETH"}:{address:d[T-1],decimals:F||O?Number(O??1):void 0,symbol:_??void 0};R.some(ne=>ne.token.address===ue.address)||R.push({token:ue,value:{pre:$,post:M,diff:M-$}})}return{assetChanges:R,block:N,results:j}}async function $9(e,t){var l;const{abi:n,address:r,args:i,functionName:s,dataSuffix:o=typeof e.dataSuffix=="string"?e.dataSuffix:(l=e.dataSuffix)==null?void 0:l.value,...a}=t,c=a.account?Ut(a.account):e.account,u=jt({abi:n,args:i,functionName:s});try{const{data:d}=await ve(e,Qs,"call")({batch:!1,data:`${u}${o?o.replace("0x",""):""}`,to:r,...a,account:c}),f=ts({abi:n,args:i,functionName:s,data:d||"0x"}),h=n.filter(m=>"name"in m&&m.name===t.functionName);return{result:f,request:{abi:h,address:r,args:i,dataSuffix:o,functionName:s,...a,account:c}}}catch(d){throw qs(d,{abi:n,address:r,args:i,docsPath:"/docs/contract/simulateContract",functionName:s,sender:c==null?void 0:c.address})}}async function Ld(e,{filter:t}){return t.request({method:"eth_uninstallFilter",params:[t.id]})}const s6="0x6492649264926492649264926492649264926492649264926492649264926492";function F9(e){if(Vr(e,-32)!==s6)throw new H9(e)}function D9(e){const{data:t,signature:n,to:r}=e;return Ir(fm(P_("address, bytes, bytes"),[r,t,n]),s6)}function U9(e){try{return F9(e),!0}catch{return!1}}class H9 extends ze{constructor(t){super(`Value \`${t}\` is an invalid ERC-6492 wrapped signature.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"SignatureErc6492.InvalidWrappedSignatureError"})}}function z9({r:e,s:t,to:n="hex",v:r,yParity:i}){const s=(()=>{if(i===0||i===1)return i;if(r&&(r===27n||r===28n||r>=35n))return r%2n===0n?1:0;throw new Error("Invalid `v` or `yParity` value")})(),o=`0x${new Am.Signature(It(e),It(t)).toCompactHex()}${s===0?"1b":"1c"}`;return n==="hex"?o:Rn(o)}async function jd(e,t){var u,l,d,f;const{address:n,chain:r=e.chain,hash:i,erc6492VerifierAddress:s=t.universalSignatureVerifierAddress??((l=(u=r==null?void 0:r.contracts)==null?void 0:u.erc6492Verifier)==null?void 0:l.address),multicallAddress:o=t.multicallAddress??((f=(d=r==null?void 0:r.contracts)==null?void 0:d.multicall3)==null?void 0:f.address),mode:a="auto"}=t;if(r!=null&&r.verifyHash)return await r.verifyHash(e,t);const c=(()=>{const h=t.signature;return pn(h)?h:typeof h=="object"&&"r"in h&&"s"in h?z9(h):Jt(h)})();try{if(a==="eoa")try{if(us(mn(n),await Up({hash:i,signature:c})))return!0}catch{}return w9(c)?await W9(e,{...t,multicallAddress:o,signature:c}):await G9(e,{...t,verifierAddress:s,signature:c})}catch(h){if(a!=="eoa")try{if(us(mn(n),await Up({hash:i,signature:c})))return!0}catch{}if(h instanceof to)return!1;throw h}}async function W9(e,t){var w;const{address:n,blockNumber:r,blockTag:i,hash:s,multicallAddress:o}=t,{authorization:a,data:c,signature:u,to:l}=b9(t.signature);if(await wa(e,{address:n,blockNumber:r,blockTag:i})===Hn(["0xef0100",a.address]))return await q9(e,{address:n,blockNumber:r,blockTag:i,hash:s,signature:u});const f={address:a.address,chainId:Number(a.chainId),nonce:Number(a.nonce),r:oe(a.r,{size:32}),s:oe(a.s,{size:32}),yParity:a.yParity};if(!await OO({address:n,authorization:f}))throw new to;const m=await ve(e,On,"readContract")({...o?{address:o}:{code:kp},authorizationList:[f],abi:Qo,blockNumber:r,blockTag:"pending",functionName:"aggregate3",args:[[...c?[{allowFailure:!0,target:l??n,callData:c}]:[],{allowFailure:!0,target:n,callData:jt({abi:jw,functionName:"isValidSignature",args:[s,u]})}]]}),y=(w=m[m.length-1])==null?void 0:w.returnData;if(y!=null&&y.startsWith("0x1626ba7e"))return!0;throw new to}async function G9(e,t){const{address:n,factory:r,factoryData:i,hash:s,signature:o,verifierAddress:a,...c}=t,u=await(async()=>!r&&!i||U9(o)?o:D9({data:i,signature:o,to:r}))(),l=a?{to:a,data:jt({abi:$w,functionName:"isValidSig",args:[n,s,u]}),...c}:{data:Ip({abi:$w,args:[n,s,u],bytecode:rT}),...c},{data:d}=await ve(e,Qs,"call")(l).catch(f=>{throw f instanceof Kv?new to:f});if(sC(d??"0x0"))return!0;throw new to}async function q9(e,t){const{address:n,blockNumber:r,blockTag:i,hash:s,signature:o}=t;if((await ve(e,On,"readContract")({address:n,abi:jw,args:[s,o],blockNumber:r,blockTag:i,functionName:"isValidSignature"}).catch(c=>{throw c instanceof fd?new to:c})).startsWith("0x1626ba7e"))return!0;throw new to}class to extends Error{}async function V9(e,{address:t,message:n,factory:r,factoryData:i,signature:s,...o}){const a=Rd(n);return ve(e,jd,"verifyHash")({address:t,factory:r,factoryData:i,hash:a,signature:s,...o})}async function K9(e,t){const{address:n,factory:r,factoryData:i,signature:s,message:o,primaryType:a,types:c,domain:u,...l}=t,d=Au({message:o,primaryType:a,types:c,domain:u});return ve(e,jd,"verifyHash")({address:n,factory:r,factoryData:i,hash:d,signature:s,...l})}const Bm=new Map,o6=new Map;let J9=0;function Kr(e,t,n){const r=++J9,i=()=>Bm.get(e)||[],s=()=>{const l=i();Bm.set(e,l.filter(d=>d.id!==r))},o=()=>{const l=i();if(!l.some(f=>f.id===r))return;const d=o6.get(e);if(l.length===1&&d){const f=d();f instanceof Promise&&f.catch(()=>{})}s()},a=i();if(Bm.set(e,[...a,{id:r,fns:t}]),a&&a.length>0)return o;const c={};for(const l in t)c[l]=(...d)=>{var h,m;const f=i();if(f.length!==0)for(const y of f)(m=(h=y.fns)[l])==null||m.call(h,...d)};const u=n(c);return typeof u=="function"&&o6.set(e,u),o}function no(e,{emitOnBegin:t,initialWaitTime:n,interval:r}){let i=!0;const s=()=>i=!1;return(async()=>{let a;t&&(a=await e({unpoll:s}));const c=await(n==null?void 0:n(a))??r;await im(c);const u=async()=>{i&&(await e({unpoll:s}),await im(r),u())};u()})(),s}function a6(e,{emitOnBegin:t=!1,emitMissed:n=!1,onBlockNumber:r,onError:i,poll:s,pollingInterval:o=e.pollingInterval}){const a=typeof s<"u"?s:!(e.transport.type==="webSocket"||e.transport.type==="ipc"||e.transport.type==="fallback"&&(e.transport.transports[0].config.type==="webSocket"||e.transport.transports[0].config.type==="ipc"));let c;return a?(()=>{const d=Ht(["watchBlockNumber",e.uid,t,n,o]);return Kr(d,{onBlockNumber:r,onError:i},f=>no(async()=>{var h;try{const m=await ve(e,xu,"getBlockNumber")({cacheTime:0});if(c!==void 0){if(m===c)return;if(m-c>1&&n)for(let y=c+1n;y<m;y++)f.onBlockNumber(y,c),c=y}(c===void 0||m>c)&&(f.onBlockNumber(m,c),c=m)}catch(m){(h=f.onError)==null||h.call(f,m)}},{emitOnBegin:t,interval:o}))})():(()=>{const d=Ht(["watchBlockNumber",e.uid,t,n]);return Kr(d,{onBlockNumber:r,onError:i},f=>{let h=!0,m=()=>h=!1;return(async()=>{try{const y=(()=>{if(e.transport.type==="fallback"){const b=e.transport.transports.find(x=>x.config.type==="webSocket"||x.config.type==="ipc");return b?b.value:e.transport}return e.transport})(),{unsubscribe:w}=await y.subscribe({params:["newHeads"],onData(b){var v;if(!h)return;const x=It((v=b.result)==null?void 0:v.number);f.onBlockNumber(x,c),c=x},onError(b){var x;(x=f.onError)==null||x.call(f,b)}});m=w,h||m()}catch(y){i==null||i(y)}})(),()=>m()})})()}async function c6(e,t){const{checkReplacement:n=!0,confirmations:r=1,hash:i,onReplaced:s,retryCount:o=6,retryDelay:a=({count:I})=>~~(1<<I)*200,timeout:c=18e4}=t,u=Ht(["waitForTransactionReceipt",e.uid,i]),l=(()=>{var I;return t.pollingInterval?t.pollingInterval:(I=e.chain)!=null&&I.experimental_preconfirmationTime?e.chain.experimental_preconfirmationTime:e.pollingInterval})();let d,f,h,m=!1,y,w;const{promise:b,resolve:x,reject:v}=jp(),S=c?setTimeout(()=>{w==null||w(),y==null||y(),v(new hR({hash:i}))},c):void 0;return y=Kr(u,{onReplaced:s,resolve:x,reject:v},async I=>{if(h=await ve(e,Md,"getTransactionReceipt")({hash:i}).catch(()=>{}),h&&r<=1){clearTimeout(S),I.resolve(h),y==null||y();return}w=ve(e,a6,"watchBlockNumber")({emitMissed:!0,emitOnBegin:!0,poll:!0,pollingInterval:l,async onBlockNumber(N){const j=L=>{clearTimeout(S),w==null||w(),L(),y==null||y()};let U=N;if(!m)try{if(h){if(r>1&&(!h.blockNumber||U-h.blockNumber+1n<r))return;j(()=>I.resolve(h));return}if(n&&!d&&(m=!0,await ku(async()=>{d=await ve(e,Od,"getTransaction")({hash:i}),d.blockNumber&&(U=d.blockNumber)},{delay:a,retryCount:o}),m=!1),h=await ve(e,Md,"getTransactionReceipt")({hash:i}),r>1&&(!h.blockNumber||U-h.blockNumber+1n<r))return;j(()=>I.resolve(h))}catch(L){if(L instanceof qv||L instanceof Vv){if(!d){m=!1;return}try{f=d,m=!0;const Y=await ku(()=>ve(e,Pr,"getBlock")({blockNumber:U,includeTransactions:!0}),{delay:a,retryCount:o,shouldRetry:({error:C})=>C instanceof U2});m=!1;const Z=Y.transactions.find(({from:C,nonce:p})=>C===f.from&&p===f.nonce);if(!Z||(h=await ve(e,Md,"getTransactionReceipt")({hash:Z.hash}),r>1&&(!h.blockNumber||U-h.blockNumber+1n<r)))return;let G="replaced";Z.to===f.to&&Z.value===f.value&&Z.input===f.input?G="repriced":Z.from===Z.to&&Z.value===0n&&(G="cancelled"),j(()=>{var C;(C=I.onReplaced)==null||C.call(I,{reason:G,replacedTransaction:f,transaction:Z,transactionReceipt:h}),I.resolve(h)})}catch(Y){j(()=>I.reject(Y))}}else j(()=>I.reject(L))}}})}),b}function Z9(e,{blockTag:t=e.experimental_blockTag??"latest",emitMissed:n=!1,emitOnBegin:r=!1,onBlock:i,onError:s,includeTransactions:o,poll:a,pollingInterval:c=e.pollingInterval}){const u=typeof a<"u"?a:!(e.transport.type==="webSocket"||e.transport.type==="ipc"||e.transport.type==="fallback"&&(e.transport.transports[0].config.type==="webSocket"||e.transport.transports[0].config.type==="ipc")),l=o??!1;let d;return u?(()=>{const m=Ht(["watchBlocks",e.uid,t,n,r,l,c]);return Kr(m,{onBlock:i,onError:s},y=>no(async()=>{var w;try{const b=await ve(e,Pr,"getBlock")({blockTag:t,includeTransactions:l});if(b.number!==null&&(d==null?void 0:d.number)!=null){if(b.number===d.number)return;if(b.number-d.number>1&&n)for(let x=(d==null?void 0:d.number)+1n;x<b.number;x++){const v=await ve(e,Pr,"getBlock")({blockNumber:x,includeTransactions:l});y.onBlock(v,d),d=v}}((d==null?void 0:d.number)==null||t==="pending"&&(b==null?void 0:b.number)==null||b.number!==null&&b.number>d.number)&&(y.onBlock(b,d),d=b)}catch(b){(w=y.onError)==null||w.call(y,b)}},{emitOnBegin:r,interval:c}))})():(()=>{let m=!0,y=!0,w=()=>m=!1;return(async()=>{try{r&&ve(e,Pr,"getBlock")({blockTag:t,includeTransactions:l}).then(v=>{m&&y&&(i(v,void 0),y=!1)}).catch(s);const b=(()=>{if(e.transport.type==="fallback"){const v=e.transport.transports.find(S=>S.config.type==="webSocket"||S.config.type==="ipc");return v?v.value:e.transport}return e.transport})(),{unsubscribe:x}=await b.subscribe({params:["newHeads"],async onData(v){var I;if(!m)return;const S=await ve(e,Pr,"getBlock")({blockNumber:(I=v.result)==null?void 0:I.number,includeTransactions:l}).catch(()=>{});m&&(i(S,d),y=!1,d=S)},onError(v){s==null||s(v)}});w=x,m||w()}catch(b){s==null||s(b)}})(),()=>w()})()}function Y9(e,t){const{abi:n,address:r,args:i,batch:s=!0,eventName:o,fromBlock:a,onError:c,onLogs:u,poll:l,pollingInterval:d=e.pollingInterval,strict:f}=t;return(typeof l<"u"?l:typeof a=="bigint"?!0:!(e.transport.type==="webSocket"||e.transport.type==="ipc"||e.transport.type==="fallback"&&(e.transport.transports[0].config.type==="webSocket"||e.transport.transports[0].config.type==="ipc")))?(()=>{const w=f??!1,b=Ht(["watchContractEvent",r,i,s,e.uid,o,d,w,a]);return Kr(b,{onLogs:u,onError:c},x=>{let v;a!==void 0&&(v=a-1n);let S,I=!1;const N=no(async()=>{var j;if(!I){try{S=await ve(e,B2,"createContractEventFilter")({abi:n,address:r,args:i,eventName:o,strict:w,fromBlock:a})}catch{}I=!0;return}try{let U;if(S)U=await ve(e,Ad,"getFilterChanges")({filter:S});else{const L=await ve(e,xu,"getBlockNumber")({});v&&v<L?U=await ve(e,l_,"getContractEvents")({abi:n,address:r,args:i,eventName:o,fromBlock:v+1n,toBlock:L,strict:w}):U=[],v=L}if(U.length===0)return;if(s)x.onLogs(U);else for(const L of U)x.onLogs([L])}catch(U){S&&U instanceof ns&&(I=!1),(j=x.onError)==null||j.call(x,U)}},{emitOnBegin:!0,interval:d});return async()=>{S&&await ve(e,Ld,"uninstallFilter")({filter:S}),N()}})})():(()=>{const w=f??!1,b=Ht(["watchContractEvent",r,i,s,e.uid,o,d,w]);let x=!0,v=()=>x=!1;return Kr(b,{onLogs:u,onError:c},S=>((async()=>{try{const I=(()=>{if(e.transport.type==="fallback"){const U=e.transport.transports.find(L=>L.config.type==="webSocket"||L.config.type==="ipc");return U?U.value:e.transport}return e.transport})(),N=o?_u({abi:n,eventName:o,args:i}):[],{unsubscribe:j}=await I.subscribe({params:["logs",{address:r,topics:N}],onData(U){var Y;if(!x)return;const L=U.result;try{const{eventName:Z,args:G}=kd({abi:n,data:L.data,topics:L.topics,strict:f}),C=Rr(L,{args:G,eventName:Z});S.onLogs([C])}catch(Z){let G,C;if(Z instanceof Yl||Z instanceof D0){if(f)return;G=Z.abiItem.name,C=(Y=Z.abiItem.inputs)==null?void 0:Y.some(g=>!("name"in g&&g.name))}const p=Rr(L,{args:C?[]:{},eventName:G});S.onLogs([p])}},onError(U){var L;(L=S.onError)==null||L.call(S,U)}});v=j,x||v()}catch(I){c==null||c(I)}})(),()=>v()))})()}function Q9(e,{address:t,args:n,batch:r=!0,event:i,events:s,fromBlock:o,onError:a,onLogs:c,poll:u,pollingInterval:l=e.pollingInterval,strict:d}){const f=typeof u<"u"?u:typeof o=="bigint"?!0:!(e.transport.type==="webSocket"||e.transport.type==="ipc"||e.transport.type==="fallback"&&(e.transport.transports[0].config.type==="webSocket"||e.transport.transports[0].config.type==="ipc")),h=d??!1;return f?(()=>{const w=Ht(["watchEvent",t,n,r,e.uid,i,l,o]);return Kr(w,{onLogs:c,onError:a},b=>{let x;o!==void 0&&(x=o-1n);let v,S=!1;const I=no(async()=>{var N;if(!S){try{v=await ve(e,N2,"createEventFilter")({address:t,args:n,event:i,events:s,strict:h,fromBlock:o})}catch{}S=!0;return}try{let j;if(v)j=await ve(e,Ad,"getFilterChanges")({filter:v});else{const U=await ve(e,xu,"getBlockNumber")({});x&&x!==U?j=await ve(e,nm,"getLogs")({address:t,args:n,event:i,events:s,fromBlock:x+1n,toBlock:U}):j=[],x=U}if(j.length===0)return;if(r)b.onLogs(j);else for(const U of j)b.onLogs([U])}catch(j){v&&j instanceof ns&&(S=!1),(N=b.onError)==null||N.call(b,j)}},{emitOnBegin:!0,interval:l});return async()=>{v&&await ve(e,Ld,"uninstallFilter")({filter:v}),I()}})})():(()=>{let w=!0,b=()=>w=!1;return(async()=>{try{const x=(()=>{if(e.transport.type==="fallback"){const N=e.transport.transports.find(j=>j.config.type==="webSocket"||j.config.type==="ipc");return N?N.value:e.transport}return e.transport})(),v=s??(i?[i]:void 0);let S=[];v&&(S=[v.flatMap(j=>_u({abi:[j],eventName:j.name,args:n}))],i&&(S=S[0]));const{unsubscribe:I}=await x.subscribe({params:["logs",{address:t,topics:S}],onData(N){var U;if(!w)return;const j=N.result;try{const{eventName:L,args:Y}=kd({abi:v??[],data:j.data,topics:j.topics,strict:h}),Z=Rr(j,{args:Y,eventName:L});c([Z])}catch(L){let Y,Z;if(L instanceof Yl||L instanceof D0){if(d)return;Y=L.abiItem.name,Z=(U=L.abiItem.inputs)==null?void 0:U.some(C=>!("name"in C&&C.name))}const G=Rr(j,{args:Z?[]:{},eventName:Y});c([G])}},onError(N){a==null||a(N)}});b=I,w||b()}catch(x){a==null||a(x)}})(),()=>b()})()}function X9(e,{batch:t=!0,onError:n,onTransactions:r,poll:i,pollingInterval:s=e.pollingInterval}){return(typeof i<"u"?i:e.transport.type!=="webSocket"&&e.transport.type!=="ipc")?(()=>{const u=Ht(["watchPendingTransactions",e.uid,t,s]);return Kr(u,{onTransactions:r,onError:n},l=>{let d;const f=no(async()=>{var h;try{if(!d)try{d=await ve(e,L2,"createPendingTransactionFilter")({});return}catch(y){throw f(),y}const m=await ve(e,Ad,"getFilterChanges")({filter:d});if(m.length===0)return;if(t)l.onTransactions(m);else for(const y of m)l.onTransactions([y])}catch(m){(h=l.onError)==null||h.call(l,m)}},{emitOnBegin:!0,interval:s});return async()=>{d&&await ve(e,Ld,"uninstallFilter")({filter:d}),f()}})})():(()=>{let u=!0,l=()=>u=!1;return(async()=>{try{const{unsubscribe:d}=await e.transport.subscribe({params:["newPendingTransactions"],onData(f){if(!u)return;const h=f.result;r([h])},onError(f){n==null||n(f)}});l=d,u||l()}catch(d){n==null||n(d)}})(),()=>l()})()}class xa extends ee{constructor({docsPath:t}={}){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(`
80
+ `),{docsPath:t,docsSlug:"account",name:"AccountNotFoundError"})}}class Nm extends ee{constructor({docsPath:t,metaMessages:n,type:r}){super(`Account type "${r}" is not supported.`,{docsPath:t,metaMessages:n,name:"AccountTypeNotSupportedError"})}}async function u6(e,{serializedTransaction:t}){return e.request({method:"eth_sendRawTransaction",params:[t]},{retryCount:0})}const Lm=new aa(128);async function l6(e,t){var S,I,N,j,U;const{account:n=e.account,assertChainId:r=!0,chain:i=e.chain,accessList:s,authorizationList:o,blobs:a,data:c,dataSuffix:u=typeof e.dataSuffix=="string"?e.dataSuffix:(S=e.dataSuffix)==null?void 0:S.value,gas:l,gasPrice:d,maxFeePerBlobGas:f,maxFeePerGas:h,maxPriorityFeePerGas:m,nonce:y,type:w,value:b,...x}=t;if(typeof n>"u")throw new xa({docsPath:"/docs/actions/wallet/sendTransaction"});const v=n?Ut(n):null;try{Ys(t);const L=await(async()=>{if(t.to)return t.to;if(t.to!==null&&o&&o.length>0)return await Hp({authorization:o[0]}).catch(()=>{throw new ee("`to` is required. Could not infer from `authorizationList`.")})})();if((v==null?void 0:v.type)==="json-rpc"||v===null){let Y;i!==null&&(Y=await ve(e,Xs,"getChainId")({}),r&&HO({currentChainId:Y,chain:i}));const Z=(j=(N=(I=e.chain)==null?void 0:I.formatters)==null?void 0:N.transactionRequest)==null?void 0:j.format,C=(Z||ba)({...wu(x,{format:Z}),accessList:s,account:v,authorizationList:o,blobs:a,chainId:Y,data:u?Zt([c??"0x",u]):c,gas:l,gasPrice:d,maxFeePerBlobGas:f,maxFeePerGas:h,maxPriorityFeePerGas:m,nonce:y,to:L,type:w,value:b},"sendTransaction"),p=Lm.get(e.uid),g=p?"wallet_sendTransaction":"eth_sendTransaction";try{return await e.request({method:g,params:[C]},{retryCount:0})}catch(k){if(p===!1)throw k;const R=k;if(R.name==="InvalidInputRpcError"||R.name==="InvalidParamsRpcError"||R.name==="MethodNotFoundRpcError"||R.name==="MethodNotSupportedRpcError")return await e.request({method:"wallet_sendTransaction",params:[C]},{retryCount:0}).then(T=>(Lm.set(e.uid,!0),T)).catch(T=>{const M=T;throw M.name==="MethodNotFoundRpcError"||M.name==="MethodNotSupportedRpcError"?(Lm.set(e.uid,!1),R):M});throw R}}if((v==null?void 0:v.type)==="local"){const Y=await ve(e,Xp,"prepareTransactionRequest")({account:v,accessList:s,authorizationList:o,blobs:a,chain:i,data:u?Zt([c??"0x",u]):c,gas:l,gasPrice:d,maxFeePerBlobGas:f,maxFeePerGas:h,maxPriorityFeePerGas:m,nonce:y,nonceManager:v.nonceManager,parameters:[...o_,"sidecars"],type:w,value:b,...x,to:L}),Z=(U=i==null?void 0:i.serializers)==null?void 0:U.transaction,G=await v.signTransaction(Y,{serializer:Z});return await ve(e,u6,"sendRawTransaction")({serializedTransaction:G})}throw(v==null?void 0:v.type)==="smart"?new Nm({metaMessages:["Consider using the `sendUserOperation` Action instead."],docsPath:"/docs/actions/bundler/sendUserOperation",type:"smart"}):new Nm({docsPath:"/docs/actions/wallet/sendTransaction",type:v==null?void 0:v.type})}catch(L){throw L instanceof Nm?L:i_(L,{...t,account:v,chain:t.chain||void 0})}}const eB="0x5792579257925792579257925792579257925792579257925792579257925792",tB=oe(0,{size:32});async function nB(e,t){async function n(l){if(l.endsWith(eB.slice(2))){const f=En(J0(l,-64,-32)),h=J0(l,0,-64).slice(2).match(/.{1,64}/g),m=await Promise.all(h.map(w=>tB.slice(2)!==w?e.request({method:"eth_getTransactionReceipt",params:[`0x${w}`]},{dedupe:!0}):void 0)),y=m.some(w=>w===null)?100:m.every(w=>(w==null?void 0:w.status)==="0x1")?200:m.every(w=>(w==null?void 0:w.status)==="0x0")?500:600;return{atomic:!1,chainId:Pn(f),receipts:m.filter(Boolean),status:y,version:"2.0.0"}}return e.request({method:"wallet_getCallsStatus",params:[l]})}const{atomic:r=!1,chainId:i,receipts:s,version:o="2.0.0",...a}=await n(t.id),[c,u]=(()=>{const l=a.status;return l>=100&&l<200?["pending",l]:l>=200&&l<300?["success",l]:l>=300&&l<700?["failure",l]:l==="CONFIRMED"?["success",200]:l==="PENDING"?["pending",100]:[void 0,l]})();return{...a,atomic:r,chainId:i?Pn(i):void 0,receipts:(s==null?void 0:s.map(l=>({...l,blockNumber:It(l.blockNumber),gasUsed:It(l.gasUsed),status:p_[l.status]})))??[],statusCode:u,status:c,version:o}}async function rB(e,t){var c;const{account:n=e.account,chainId:r,nonce:i}=t;if(!n)throw new xa({docsPath:"/docs/eip7702/prepareAuthorization"});const s=Ut(n),o=(()=>{if(t.executor)return t.executor==="self"?t.executor:Ut(t.executor)})(),a={address:t.contractAddress??t.address,chainId:r,nonce:i};return typeof a.chainId>"u"&&(a.chainId=((c=e.chain)==null?void 0:c.id)??await ve(e,Xs,"getChainId")({})),typeof a.nonce>"u"&&(a.nonce=await ve(e,Vp,"getTransactionCount")({address:s.address,blockTag:"pending"}),(o==="self"||o!=null&&o.address&&us(o.address,s.address))&&(a.nonce+=1)),a}class iB extends ee{constructor(t){super(`Call bundle failed with status: ${t.statusCode}`,{name:"BundleFailedError"}),Object.defineProperty(this,"result",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.result=t}}async function d6(e,t){const{id:n,pollingInterval:r=e.pollingInterval,status:i=({statusCode:y})=>y===200||y>=300,retryCount:s=4,retryDelay:o=({count:y})=>~~(1<<y)*200,timeout:a=6e4,throwOnFailure:c=!1}=t,u=Ht(["waitForCallsStatus",e.uid,n]),{promise:l,resolve:d,reject:f}=jp();let h;const m=Kr(u,{resolve:d,reject:f},y=>{const w=no(async()=>{const b=x=>{clearTimeout(h),w(),x(),m()};try{const x=await ku(async()=>{const v=await ve(e,nB,"getCallsStatus")({id:n});if(c&&v.status==="failure")throw new iB(v);return v},{retryCount:s,delay:o});if(!i(x))return;b(()=>y.resolve(x))}catch(x){b(()=>y.reject(x))}},{interval:r,emitOnBegin:!0});return w});return h=a?setTimeout(()=>{m(),clearTimeout(h),f(new sB({id:n}))},a):void 0,await l}class sB extends ee{constructor({id:t}){super(`Timed out while waiting for call bundle with id "${t}" to be confirmed.`,{name:"WaitForCallsStatusTimeoutError"})}}async function oB(e,{serializedTransaction:t,throwOnReceiptRevert:n,timeout:r}){var a,c,u;const i=await e.request({method:"eth_sendRawTransactionSync",params:r?[t,r]:[t]},{retryCount:0}),o=(((u=(c=(a=e.chain)==null?void 0:a.formatters)==null?void 0:c.transactionReceipt)==null?void 0:u.format)||Pd)(i);if(o.status==="reverted"&&n)throw new fR({receipt:o});return o}async function $d(e,t){return $d.internal(e,l6,"sendTransaction",t)}(function(e){async function t(n,r,i,s){const{abi:o,account:a=n.account,address:c,args:u,functionName:l,...d}=s;if(typeof a>"u")throw new xa({docsPath:"/docs/contract/writeContract"});const f=a?Ut(a):null,h=jt({abi:o,args:u,functionName:l});try{return await ve(n,r,i)({data:h,to:c,account:f,...d})}catch(m){throw qs(m,{abi:o,address:c,args:u,docsPath:"/docs/contract/writeContract",functionName:l,sender:f==null?void 0:f.address})}}e.internal=t})($d||($d={}));function ds(e,t,n){const r=e[t.name];if(typeof r=="function")return r;const i=e[n];return typeof i=="function"?i:s=>t(e,s)}const Fd="2.22.1",aB=()=>`@wagmi/core@${Fd}`;var f6=function(e,t,n,r){if(n==="a"&&!r)throw new TypeError("Private accessor was defined without a getter");if(typeof t=="function"?e!==t||!r:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return n==="m"?r:n==="a"?r.call(e):r?r.value:t.get(e)},Dd,h6;let Ri=class iw extends Error{get docsBaseUrl(){return"https://wagmi.sh/core"}get version(){return aB()}constructor(t,n={}){var s;super(),Dd.add(this),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:"WagmiCoreError"});const r=n.cause instanceof iw?n.cause.details:(s=n.cause)!=null&&s.message?n.cause.message:n.details,i=n.cause instanceof iw&&n.cause.docsPath||n.docsPath;this.message=[t||"An error occurred.","",...n.metaMessages?[...n.metaMessages,""]:[],...i?[`Docs: ${this.docsBaseUrl}${i}.html${n.docsSlug?`#${n.docsSlug}`:""}`]:[],...r?[`Details: ${r}`]:[],`Version: ${this.version}`].join(`
81
+ `),n.cause&&(this.cause=n.cause),this.details=r,this.docsPath=i,this.metaMessages=n.metaMessages,this.shortMessage=t}walk(t){return f6(this,Dd,"m",h6).call(this,this,t)}};Dd=new WeakSet,h6=function e(t,n){return n!=null&&n(t)?t:t.cause?f6(this,Dd,"m",e).call(this,t.cause,n):t};class Sa extends Ri{constructor(){super("Chain not configured."),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ChainNotConfiguredError"})}}class cB extends Ri{constructor(){super("Connector already connected."),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ConnectorAlreadyConnectedError"})}}class uB extends Ri{constructor(){super("Connector not connected."),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ConnectorNotConnectedError"})}}class lB extends Ri{constructor({address:t,connector:n}){super(`Account "${t}" not found for connector "${n.name}".`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ConnectorAccountNotFoundError"})}}class dB extends Ri{constructor({connectionChainId:t,connectorChainId:n}){super(`The current chain of the connector (id: ${n}) does not match the connection's chain (id: ${t}).`,{metaMessages:[`Current Chain ID: ${n}`,`Expected Chain ID: ${t}`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ConnectorChainMismatchError"})}}class fB extends Ri{constructor({connector:t}){super(`Connector "${t.name}" unavailable while reconnecting.`,{details:["During the reconnection step, the only connector methods guaranteed to be available are: `id`, `name`, `type`, `uid`.","All other methods are not guaranteed to be available until reconnection completes and connectors are fully restored.","This error commonly occurs for connectors that asynchronously inject after reconnection has already started."].join(" ")}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ConnectorUnavailableReconnectingError"})}}async function hB(e,t){var r;let n;if(typeof t.connector=="function"?n=e._internal.connectors.setup(t.connector):n=t.connector,n.uid===e.state.current)throw new cB;try{e.setState(a=>({...a,status:"connecting"})),n.emitter.emit("message",{type:"connecting"});const{connector:i,...s}=t,o=await n.connect(s);return n.emitter.off("connect",e._internal.events.connect),n.emitter.on("change",e._internal.events.change),n.emitter.on("disconnect",e._internal.events.disconnect),await((r=e.storage)==null?void 0:r.setItem("recentConnectorId",n.id)),e.setState(a=>({...a,connections:new Map(a.connections).set(n.uid,{accounts:s.withCapabilities?o.accounts.map(c=>typeof c=="object"?c.address:c):o.accounts,chainId:o.chainId,connector:n}),current:n.uid,status:"connected"})),{accounts:s.withCapabilities?o.accounts.map(a=>typeof a=="object"?a:{address:a,capabilities:{}}):o.accounts,chainId:o.chainId}}catch(i){throw e.setState(s=>({...s,status:s.current?"connected":"disconnected"})),i}}const jm=256;let Ud=jm,Hd;function p6(e=11){if(!Hd||Ud+e>jm*2){Hd="",Ud=0;for(let t=0;t<jm;t++)Hd+=(256+Math.random()*256|0).toString(16).substring(1)}return Hd.substring(Ud,Ud+++e)}function zd(e){const{batch:t,chain:n,ccipRead:r,dataSuffix:i,key:s="base",name:o="Base Client",type:a="base"}=e,c=e.experimental_blockTag??(typeof(n==null?void 0:n.experimental_preconfirmationTime)=="number"?"pending":void 0),u=(n==null?void 0:n.blockTime)??12e3,l=Math.min(Math.max(Math.floor(u/2),500),4e3),d=e.pollingInterval??l,f=e.cacheTime??d,h=e.account?Ut(e.account):void 0,{config:m,request:y,value:w}=e.transport({account:h,chain:n,pollingInterval:d}),b={...m,...w},x={account:h,batch:t,cacheTime:f,ccipRead:r,chain:n,dataSuffix:i,key:s,name:o,pollingInterval:d,request:y,transport:b,type:a,uid:p6(),...c?{experimental_blockTag:c}:{}};function v(S){return I=>{const N=I(S);for(const U in x)delete N[U];const j={...S,...N};return Object.assign(j,{extend:v(j)})}}return Object.assign(x,{extend:v(x)})}function pB(e){var d,f,h;const{scheme:t,statement:n,...r}=((d=e.match(mB))==null?void 0:d.groups)??{},{chainId:i,expirationTime:s,issuedAt:o,notBefore:a,requestId:c,...u}=((f=e.match(gB))==null?void 0:f.groups)??{},l=(h=e.split("Resources:")[1])==null?void 0:h.split(`
82
+ - `).slice(1);return{...r,...u,...i?{chainId:Number(i)}:{},...s?{expirationTime:new Date(s)}:{},...o?{issuedAt:new Date(o)}:{},...a?{notBefore:new Date(a)}:{},...c?{requestId:c}:{},...l?{resources:l}:{},...t?{scheme:t}:{},...n?{statement:n}:{}}}const mB=/^(?:(?<scheme>[a-zA-Z][a-zA-Z0-9+-.]*):\/\/)?(?<domain>[a-zA-Z0-9+-.]*(?::[0-9]{1,5})?) (?:wants you to sign in with your Ethereum account:\n)(?<address>0x[a-fA-F0-9]{40})\n\n(?:(?<statement>.*)\n\n)?/,gB=/(?:URI: (?<uri>.+))\n(?:Version: (?<version>.+))\n(?:Chain ID: (?<chainId>\d+))\n(?:Nonce: (?<nonce>[a-zA-Z0-9]+))\n(?:Issued At: (?<issuedAt>.+))(?:\nExpiration Time: (?<expirationTime>.+))?(?:\nNot Before: (?<notBefore>.+))?(?:\nRequest ID: (?<requestId>.+))?/;function yB(e){const{address:t,domain:n,message:r,nonce:i,scheme:s,time:o=new Date}=e;if(n&&r.domain!==n||i&&r.nonce!==i||s&&r.scheme!==s||r.expirationTime&&o>=r.expirationTime||r.notBefore&&o<r.notBefore)return!1;try{if(!r.address||!Pt(r.address,{strict:!1})||t&&!us(r.address,t))return!1}catch{return!1}return!0}async function bB(e,t){const{address:n,domain:r,message:i,nonce:s,scheme:o,signature:a,time:c=new Date,...u}=t,l=pB(i);if(!l.address||!yB({address:n,domain:r,message:l,nonce:s,scheme:o,time:c}))return!1;const f=Rd(i);return jd(e,{address:l.address,hash:f,signature:a,...u})}function wB(e){return{call:t=>Qs(e,t),createAccessList:t=>T2(e,t),createBlockFilter:()=>IT(e),createContractEventFilter:t=>B2(e,t),createEventFilter:t=>N2(e,t),createPendingTransactionFilter:()=>L2(e),estimateContractGas:t=>rO(e,t),estimateGas:t=>em(e,t),getBalance:t=>c_(e,t),getBlobBaseFee:()=>iO(e),getBlock:t=>Pr(e,t),getBlockNumber:t=>xu(e,t),getBlockTransactionCount:t=>lO(e,t),getBytecode:t=>wa(e,t),getChainId:()=>Xs(e),getCode:t=>wa(e,t),getContractEvents:t=>l_(e,t),getDelegation:t=>hO(e,t),getEip712Domain:t=>mO(e,t),getEnsAddress:t=>dT(e,t),getEnsAvatar:t=>ST(e,t),getEnsName:t=>kT(e,t),getEnsResolver:t=>AT(e,t),getEnsText:t=>R2(e,t),getFeeHistory:t=>bO(e,t),estimateFeesPerGas:t=>W2(e,t),getFilterChanges:t=>Ad(e,t),getFilterLogs:t=>wO(e,t),getGasPrice:()=>Gp(e),getLogs:t=>nm(e,t),getProof:t=>k9(e,t),estimateMaxPriorityFeePerGas:t=>DT(e,t),fillTransaction:t=>s_(e,t),getStorageAt:t=>A9(e,t),getTransaction:t=>Od(e,t),getTransactionConfirmations:t=>I9(e,t),getTransactionCount:t=>Vp(e,t),getTransactionReceipt:t=>Md(e,t),multicall:t=>e6(e,t),prepareTransactionRequest:t=>Xp(e,t),readContract:t=>On(e,t),sendRawTransaction:t=>u6(e,t),sendRawTransactionSync:t=>oB(e,t),simulate:t=>Tm(e,t),simulateBlocks:t=>Tm(e,t),simulateCalls:t=>j9(e,t),simulateContract:t=>$9(e,t),verifyHash:t=>jd(e,t),verifyMessage:t=>V9(e,t),verifySiweMessage:t=>bB(e,t),verifyTypedData:t=>K9(e,t),uninstallFilter:t=>Ld(e,t),waitForTransactionReceipt:t=>c6(e,t),watchBlocks:t=>Z9(e,t),watchBlockNumber:t=>a6(e,t),watchContractEvent:t=>Y9(e,t),watchEvent:t=>Q9(e,t),watchPendingTransactions:t=>X9(e,t)}}function vB(e){const{key:t="public",name:n="Public Client"}=e;return zd({...e,key:t,name:n,type:"publicClient"}).extend(wB)}function m6({key:e,methods:t,name:n,request:r,retryCount:i=3,retryDelay:s=150,timeout:o,type:a},c){const u=p6();return{config:{key:e,methods:t,name:n,request:r,retryCount:i,retryDelay:s,timeout:o,type:a},request:BO(r,{methods:t,retryCount:i,retryDelay:s,uid:u}),value:c}}function _B(e,t={}){const{key:n="custom",methods:r,name:i="Custom Provider",retryDelay:s}=t;return({retryCount:o})=>m6({key:n,methods:r,name:i,request:e.request.bind(e),retryCount:t.retryCount??o,retryDelay:s,type:"custom"})}class EB extends ee{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 fs(e,t={}){const{batch:n,fetchFn:r,fetchOptions:i,key:s="http",methods:o,name:a="HTTP JSON-RPC",onFetchRequest:c,onFetchResponse:u,retryDelay:l,raw:d}=t;return({chain:f,retryCount:h,timeout:m})=>{const{batchSize:y=1e3,wait:w=0}=typeof n=="object"?n:{},b=t.retryCount??h,x=m??t.timeout??1e4,v=e||(f==null?void 0:f.rpcUrls.default.http[0]);if(!v)throw new EB;const S=qO(v,{fetchFn:r,fetchOptions:i,onRequest:c,onResponse:u,timeout:x});return m6({key:s,methods:o,name:a,async request({method:I,params:N}){const j={method:I,params:N},{schedule:U}=S2({id:v,wait:w,shouldSplitBatch(G){return G.length>y},fn:G=>S.request({body:G}),sort:(G,C)=>G.id-C.id}),L=async G=>n?U(G):[await S.request({body:G})],[{error:Y,result:Z}]=await L(j);if(d)return{error:Y,result:Z};if(Y)throw new yp({body:j,error:Y,url:v});return Z},retryCount:b,retryDelay:l,timeout:x,type:"http"},{fetchOptions:i,url:v})}}function xB(e){const{r:t,s:n}=Am.Signature.fromCompact(e.slice(2,130)),r=+`0x${e.slice(130)}`,[i,s]=(()=>{if(r===0||r===1)return[void 0,r];if(r===27)return[BigInt(r),0];if(r===28)return[BigInt(r),1];throw new Error("Invalid yParityOrV value")})();return typeof i<"u"?{r:oe(t,{size:32}),s:oe(n,{size:32}),v:i,yParity:s}:{r:oe(t,{size:32}),s:oe(n,{size:32}),yParity:s}}async function g6(e,t={}){const{assertChainId:n=!0}=t;let r;if(t.connector){const{connector:l}=t;if(e.state.status==="reconnecting"&&!l.getAccounts&&!l.getChainId)throw new fB({connector:l});const[d,f]=await Promise.all([l.getAccounts().catch(h=>{if(t.account===null)return[];throw h}),l.getChainId()]);r={accounts:d,chainId:f,connector:l}}else r=e.state.connections.get(e.state.current);if(!r)throw new uB;const i=t.chainId??r.chainId,s=await r.connector.getChainId();if(n&&s!==i)throw new dB({connectionChainId:i,connectorChainId:s});const o=r.connector;if(o.getClient)return o.getClient({chainId:i});const a=Ut(t.account??r.accounts[0]);if(a&&(a.address=mn(a.address)),t.account&&!r.accounts.some(l=>l.toLowerCase()===a.address.toLowerCase()))throw new lB({address:a.address,connector:o});const c=e.chains.find(l=>l.id===i),u=await r.connector.getProvider({chainId:i});return zd({account:a,chain:c,name:"Connector Client",transport:l=>_B(u)({...l,retryCount:0})})}async function SB(e,t={}){var i,s;let n;if(t.connector)n=t.connector;else{const{connections:o,current:a}=e.state,c=o.get(a);n=c==null?void 0:c.connector}const r=e.state.connections;n&&(await n.disconnect(),n.emitter.off("change",e._internal.events.change),n.emitter.off("disconnect",e._internal.events.disconnect),n.emitter.on("connect",e._internal.events.connect),r.delete(n.uid)),e.setState(o=>{if(r.size===0)return{...o,connections:new Map,current:null,status:"disconnected"};const a=r.values().next().value;return{...o,connections:new Map(r),current:a.connector.uid}});{const o=e.state.current;if(!o)return;const a=(i=e.state.connections.get(o))==null?void 0:i.connector;if(!a)return;await((s=e.storage)==null?void 0:s.setItem("recentConnectorId",a.id))}}function y6(e){return typeof e=="number"?e:e==="wei"?0:Math.abs(iR[e])}function b6(e){const t=e.state.current,n=e.state.connections.get(t),r=n==null?void 0:n.accounts,i=r==null?void 0:r[0],s=e.chains.find(a=>a.id===(n==null?void 0:n.chainId)),o=e.state.status;switch(o){case"connected":return{address:i,addresses:r,chain:s,chainId:n==null?void 0:n.chainId,connector:n==null?void 0:n.connector,isConnected:!0,isConnecting:!1,isDisconnected:!1,isReconnecting:!1,status:o};case"reconnecting":return{address:i,addresses:r,chain:s,chainId:n==null?void 0:n.chainId,connector:n==null?void 0:n.connector,isConnected:!!i,isConnecting:!1,isDisconnected:!1,isReconnecting:!0,status:o};case"connecting":return{address:i,addresses:r,chain:s,chainId:n==null?void 0:n.chainId,connector:n==null?void 0:n.connector,isConnected:!1,isConnecting:!0,isDisconnected:!1,isReconnecting:!1,status:o};case"disconnected":return{address:void 0,addresses:void 0,chain:void 0,chainId:void 0,connector:void 0,isConnected:!1,isConnecting:!1,isDisconnected:!0,isReconnecting:!1,status:o}}}async function kB(e,t){const{allowFailure:n=!0,chainId:r,contracts:i,...s}=t,o=e.getClient({chainId:r});return ds(o,e6,"multicall")({allowFailure:n,contracts:i,...s})}function AB(e,t){const{chainId:n,...r}=t,i=e.getClient({chainId:n});return ds(i,On,"readContract")(r)}async function IB(e,t){var a;const{allowFailure:n=!0,blockNumber:r,blockTag:i,...s}=t,o=t.contracts;try{const c={};for(const[f,h]of o.entries()){const m=h.chainId??e.state.chainId;c[m]||(c[m]=[]),(a=c[m])==null||a.push({contract:h,index:f})}const u=()=>Object.entries(c).map(([f,h])=>kB(e,{...s,allowFailure:n,blockNumber:r,blockTag:i,chainId:Number.parseInt(f,10),contracts:h.map(({contract:m})=>m)})),l=(await Promise.all(u())).flat(),d=Object.values(c).flatMap(f=>f.map(({index:h})=>h));return l.reduce((f,h,m)=>(f&&(f[d[m]]=h),f),[])}catch(c){if(c instanceof fd)throw c;const u=()=>o.map(l=>AB(e,{...l,blockNumber:r,blockTag:i}));return n?(await Promise.allSettled(u())).map(l=>l.status==="fulfilled"?{result:l.value,status:"success"}:{error:l.reason,result:void 0,status:"failure"}):await Promise.all(u())}}async function CB(e,t){const{address:n,blockNumber:r,blockTag:i,chainId:s,token:o,unit:a="ether"}=t;if(o)try{return await w6(e,{balanceAddress:n,chainId:s,symbolType:"string",tokenAddress:o})}catch(f){if(f.name==="ContractFunctionExecutionError"){const h=await w6(e,{balanceAddress:n,chainId:s,symbolType:"bytes32",tokenAddress:o}),m=Ql(En(h.symbol,{dir:"right"}));return{...h,symbol:m}}throw f}const c=e.getClient({chainId:s}),l=await ds(c,c_,"getBalance")(r?{address:n,blockNumber:r}:{address:n,blockTag:i}),d=e.chains.find(f=>f.id===s)??c.chain;return{decimals:d.nativeCurrency.decimals,formatted:fa(l,y6(a)),symbol:d.nativeCurrency.symbol,value:l}}async function w6(e,t){const{balanceAddress:n,chainId:r,symbolType:i,tokenAddress:s,unit:o}=t,a={abi:[{type:"function",name:"balanceOf",stateMutability:"view",inputs:[{type:"address"}],outputs:[{type:"uint256"}]},{type:"function",name:"decimals",stateMutability:"view",inputs:[],outputs:[{type:"uint8"}]},{type:"function",name:"symbol",stateMutability:"view",inputs:[],outputs:[{type:i}]}],address:s},[c,u,l]=await IB(e,{allowFailure:!1,contracts:[{...a,functionName:"balanceOf",args:[n],chainId:r},{...a,functionName:"decimals",chainId:r},{...a,functionName:"symbol",chainId:r}]}),d=fa(c??"0",y6(o??u));return{decimals:u,formatted:d,symbol:l,value:c}}function v6(e){return e.state.chainId}function ro(e,t){if(e===t)return!0;if(e&&t&&typeof e=="object"&&typeof t=="object"){if(e.constructor!==t.constructor)return!1;let n,r;if(Array.isArray(e)&&Array.isArray(t)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!ro(e[r],t[r]))return!1;return!0}if(typeof e.valueOf=="function"&&e.valueOf!==Object.prototype.valueOf)return e.valueOf()===t.valueOf();if(typeof e.toString=="function"&&e.toString!==Object.prototype.toString)return e.toString()===t.toString();const i=Object.keys(e);if(n=i.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!Object.hasOwn(t,i[r]))return!1;for(r=n;r--!==0;){const s=i[r];if(s&&!ro(e[s],t[s]))return!1}return!0}return e!==e&&t!==t}let $m=[];function _6(e){const t=e.chains;return ro($m,t)?$m:($m=t,t)}let Wd=[];function Fm(e){const t=[...e.state.connections.values()];return e.state.status==="reconnecting"||ro(Wd,t)?Wd:(Wd=t,t)}let Gd=[];function E6(e){const t=e.connectors;return Gd.length===t.length&&Gd.every((n,r)=>n===t[r])?Gd:(Gd=t,t)}let Dm=!1;async function PB(e,t={}){var u,l;if(Dm)return[];Dm=!0,e.setState(d=>({...d,status:d.current?"reconnecting":"connecting"}));const n=[];if((u=t.connectors)!=null&&u.length)for(const d of t.connectors){let f;typeof d=="function"?f=e._internal.connectors.setup(d):f=d,n.push(f)}else n.push(...e.connectors);let r;try{r=await((l=e.storage)==null?void 0:l.getItem("recentConnectorId"))}catch{}const i={};for(const[,d]of e.state.connections)i[d.connector.id]=1;r&&(i[r]=0);const s=Object.keys(i).length>0?[...n].sort((d,f)=>(i[d.id]??10)-(i[f.id]??10)):n;let o=!1;const a=[],c=[];for(const d of s){const f=await d.getProvider().catch(()=>{});if(!f||c.some(y=>y===f)||!await d.isAuthorized())continue;const m=await d.connect({isReconnecting:!0}).catch(()=>null);m&&(d.emitter.off("connect",e._internal.events.connect),d.emitter.on("change",e._internal.events.change),d.emitter.on("disconnect",e._internal.events.disconnect),e.setState(y=>{const w=new Map(o?y.connections:new Map).set(d.uid,{accounts:m.accounts,chainId:m.chainId,connector:d});return{...y,current:o?y.current:d.uid,connections:w}}),a.push({accounts:m.accounts,chainId:m.chainId,connector:d}),c.push(f),o=!0)}return(e.state.status==="reconnecting"||e.state.status==="connecting")&&(o?e.setState(d=>({...d,status:"connected"})):e.setState(d=>({...d,connections:new Map,current:null,status:"disconnected"}))),Dm=!1,a}async function RB(e,t){const{account:n,chainId:r,connector:i,...s}=t;let o;return typeof n=="object"&&(n==null?void 0:n.type)==="local"?o=e.getClient({chainId:r}):o=await g6(e,{account:n??void 0,assertChainId:!1,chainId:r,connector:i}),await ds(o,l6,"sendTransaction")({...s,...n?{account:n}:{},chain:r?{id:r}:null,gas:s.gas??void 0})}class ka extends Ri{constructor(){super("Provider not found."),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ProviderNotFoundError"})}}class TB extends Ri{constructor({connector:t}){super(`"${t.name}" does not support programmatic chain switching.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"SwitchChainNotSupportedError"})}}async function OB(e,t){var o;const{addEthereumChainParameter:n,chainId:r}=t,i=e.state.connections.get(((o=t.connector)==null?void 0:o.uid)??e.state.current);if(i){const a=i.connector;if(!a.switchChain)throw new TB({connector:a});return await a.switchChain({addEthereumChainParameter:n,chainId:r})}const s=e.chains.find(a=>a.id===r);if(!s)throw new Sa;return e.setState(a=>({...a,chainId:r})),s}async function MB(e,t){const{chainId:n,timeout:r=0,...i}=t,s=e.getClient({chainId:n}),a=await ds(s,c6,"waitForTransactionReceipt")({...i,timeout:r});if(a.status==="reverted"){const c=ds(s,Od,"getTransaction"),{from:u,...l}=await c({hash:a.transactionHash}),f=await ds(s,Qs,"call")({...l,account:u,data:l.input,gasPrice:l.type!=="eip1559"?l.gasPrice:void 0,maxFeePerGas:l.type==="eip1559"?l.maxFeePerGas:void 0,maxPriorityFeePerGas:l.type==="eip1559"?l.maxPriorityFeePerGas:void 0}),h=f!=null&&f.data?Ql(`0x${f.data.substring(138)}`):"unknown reason";throw new Error(h)}return{...a,chainId:s.chain.id}}function BB(e,t){const{onChange:n}=t;return e.subscribe(()=>b6(e),n,{equalityFn(r,i){const{connector:s,...o}=r,{connector:a,...c}=i;return ro(o,c)&&(s==null?void 0:s.id)===(a==null?void 0:a.id)&&(s==null?void 0:s.uid)===(a==null?void 0:a.uid)}})}function NB(e,t){const{onChange:n}=t;return e.subscribe(r=>r.chainId,n)}function LB(e,t){const{onChange:n}=t;return e.subscribe(()=>Fm(e),n,{equalityFn:ro})}function jB(e,t){const{onChange:n}=t;return e._internal.connectors.subscribe((r,i)=>{n(Object.values(r),i)})}async function $B(e,t){const{account:n,chainId:r,connector:i,...s}=t;let o;return typeof n=="object"&&(n==null?void 0:n.type)==="local"?o=e.getClient({chainId:r}):o=await g6(e,{account:n??void 0,assertChainId:!1,chainId:r,connector:i}),await ds(o,$d,"writeContract")({...s,...n?{account:n}:{},chain:r?{id:r}:null})}function fQ(e){return e}qd.type="injected";function qd(e={}){const{shimDisconnect:t=!0,unstable_shimAsyncInject:n}=e;function r(){const c=e.target;if(typeof c=="function"){const u=c();if(u)return u}return typeof c=="object"?c:typeof c=="string"?{...FB[c]??{id:c,name:`${c[0].toUpperCase()}${c.slice(1)}`,provider:`is${c[0].toUpperCase()}${c.slice(1)}`}}:{id:"injected",name:"Injected",provider(u){return u==null?void 0:u.ethereum}}}let i,s,o,a;return c=>({get icon(){return r().icon},get id(){return r().id},get name(){return r().name},get supportsSimulation(){return!0},type:qd.type,async setup(){const u=await this.getProvider();u!=null&&u.on&&e.target&&(o||(o=this.onConnect.bind(this),u.on("connect",o)),i||(i=this.onAccountsChanged.bind(this),u.on("accountsChanged",i)))},async connect({chainId:u,isReconnecting:l,withCapabilities:d}={}){var m,y,w,b,x,v;const f=await this.getProvider();if(!f)throw new ka;let h=[];if(l)h=await this.getAccounts().catch(()=>[]);else if(t)try{h=(b=(w=(y=(m=(await f.request({method:"wallet_requestPermissions",params:[{eth_accounts:{}}]}))[0])==null?void 0:m.caveats)==null?void 0:y[0])==null?void 0:w.value)==null?void 0:b.map(I=>mn(I)),h.length>0&&(h=await this.getAccounts())}catch(S){const I=S;if(I.code===zt.code)throw new zt(I);if(I.code===rs.code)throw I}try{!(h!=null&&h.length)&&!l&&(h=(await f.request({method:"eth_requestAccounts"})).map(N=>mn(N))),o&&(f.removeListener("connect",o),o=void 0),i||(i=this.onAccountsChanged.bind(this),f.on("accountsChanged",i)),s||(s=this.onChainChanged.bind(this),f.on("chainChanged",s)),a||(a=this.onDisconnect.bind(this),f.on("disconnect",a));let S=await this.getChainId();if(u&&S!==u){const I=await this.switchChain({chainId:u}).catch(N=>{if(N.code===zt.code)throw N;return{id:S}});S=(I==null?void 0:I.id)??S}return t&&await((x=c.storage)==null?void 0:x.removeItem(`${this.id}.disconnected`)),e.target||await((v=c.storage)==null?void 0:v.setItem("injected.connected",!0)),{accounts:d?h.map(I=>({address:I,capabilities:{}})):h,chainId:S}}catch(S){const I=S;throw I.code===zt.code?new zt(I):I.code===rs.code?new rs(I):I}},async disconnect(){var l,d;const u=await this.getProvider();if(!u)throw new ka;s&&(u.removeListener("chainChanged",s),s=void 0),a&&(u.removeListener("disconnect",a),a=void 0),o||(o=this.onConnect.bind(this),u.on("connect",o));try{await m_(()=>u.request({method:"wallet_revokePermissions",params:[{eth_accounts:{}}]}),{timeout:100})}catch{}t&&await((l=c.storage)==null?void 0:l.setItem(`${this.id}.disconnected`,!0)),e.target||await((d=c.storage)==null?void 0:d.removeItem("injected.connected"))},async getAccounts(){const u=await this.getProvider();if(!u)throw new ka;return(await u.request({method:"eth_accounts"})).map(d=>mn(d))},async getChainId(){const u=await this.getProvider();if(!u)throw new ka;const l=await u.request({method:"eth_chainId"});return Number(l)},async getProvider(){if(typeof window>"u")return;let u;const l=r();return typeof l.provider=="function"?u=l.provider(window):typeof l.provider=="string"?u=Vd(window,l.provider):u=l.provider,u&&!u.removeListener&&("off"in u&&typeof u.off=="function"?u.removeListener=u.off:u.removeListener=()=>{}),u},async isAuthorized(){var u,l;try{if(t&&await((u=c.storage)==null?void 0:u.getItem(`${this.id}.disconnected`))||!e.target&&!await((l=c.storage)==null?void 0:l.getItem("injected.connected")))return!1;if(!await this.getProvider()){if(n!==void 0&&n!==!1){const m=async()=>(typeof window<"u"&&window.removeEventListener("ethereum#initialized",m),!!await this.getProvider()),y=typeof n=="number"?n:1e3;if(await Promise.race([...typeof window<"u"?[new Promise(b=>window.addEventListener("ethereum#initialized",()=>b(m()),{once:!0}))]:[],new Promise(b=>setTimeout(()=>b(m()),y))]))return!0}throw new ka}return!!(await ku(()=>this.getAccounts())).length}catch{return!1}},async switchChain({addEthereumChainParameter:u,chainId:l}){var m,y,w,b;const d=await this.getProvider();if(!d)throw new ka;const f=c.chains.find(x=>x.id===l);if(!f)throw new Ar(new Sa);const h=new Promise(x=>{const v=S=>{"chainId"in S&&S.chainId===l&&(c.emitter.off("change",v),x())};c.emitter.on("change",v)});try{return await Promise.all([d.request({method:"wallet_switchEthereumChain",params:[{chainId:oe(l)}]}).then(async()=>{await this.getChainId()===l&&c.emitter.emit("change",{chainId:l})}),h]),f}catch(x){const v=x;if(v.code===4902||((y=(m=v==null?void 0:v.data)==null?void 0:m.originalError)==null?void 0:y.code)===4902)try{const{default:S,...I}=f.blockExplorers??{};let N;u!=null&&u.blockExplorerUrls?N=u.blockExplorerUrls:S&&(N=[S.url,...Object.values(I).map(L=>L.url)]);let j;(w=u==null?void 0:u.rpcUrls)!=null&&w.length?j=u.rpcUrls:j=[((b=f.rpcUrls.default)==null?void 0:b.http[0])??""];const U={blockExplorerUrls:N,chainId:oe(l),chainName:(u==null?void 0:u.chainName)??f.name,iconUrls:u==null?void 0:u.iconUrls,nativeCurrency:(u==null?void 0:u.nativeCurrency)??f.nativeCurrency,rpcUrls:j};return await Promise.all([d.request({method:"wallet_addEthereumChain",params:[U]}).then(async()=>{if(await this.getChainId()===l)c.emitter.emit("change",{chainId:l});else throw new zt(new Error("User rejected switch after adding network."))}),h]),f}catch(S){throw new zt(S)}throw v.code===zt.code?new zt(v):new Ar(v)}},async onAccountsChanged(u){var l;if(u.length===0)this.onDisconnect();else if(c.emitter.listenerCount("connect")){const d=(await this.getChainId()).toString();this.onConnect({chainId:d}),t&&await((l=c.storage)==null?void 0:l.removeItem(`${this.id}.disconnected`))}else c.emitter.emit("change",{accounts:u.map(d=>mn(d))})},onChainChanged(u){const l=Number(u);c.emitter.emit("change",{chainId:l})},async onConnect(u){const l=await this.getAccounts();if(l.length===0)return;const d=Number(u.chainId);c.emitter.emit("connect",{accounts:l,chainId:d});const f=await this.getProvider();f&&(o&&(f.removeListener("connect",o),o=void 0),i||(i=this.onAccountsChanged.bind(this),f.on("accountsChanged",i)),s||(s=this.onChainChanged.bind(this),f.on("chainChanged",s)),a||(a=this.onDisconnect.bind(this),f.on("disconnect",a)))},async onDisconnect(u){const l=await this.getProvider();u&&u.code===1013&&l&&(await this.getAccounts()).length||(c.emitter.emit("disconnect"),l&&(s&&(l.removeListener("chainChanged",s),s=void 0),a&&(l.removeListener("disconnect",a),a=void 0),o||(o=this.onConnect.bind(this),l.on("connect",o))))}})}const FB={coinbaseWallet:{id:"coinbaseWallet",name:"Coinbase Wallet",provider(e){return e!=null&&e.coinbaseWalletExtension?e.coinbaseWalletExtension:Vd(e,"isCoinbaseWallet")}},metaMask:{id:"metaMask",name:"MetaMask",provider(e){return Vd(e,t=>{if(!t.isMetaMask||t.isBraveWallet&&!t._events&&!t._state)return!1;const n=["isApexWallet","isAvalanche","isBitKeep","isBlockWallet","isKuCoinWallet","isMathWallet","isOkxWallet","isOKExWallet","isOneInchIOSWallet","isOneInchAndroidWallet","isOpera","isPhantom","isPortal","isRabby","isTokenPocket","isTokenary","isUniswapWallet","isZerion"];for(const r of n)if(t[r])return!1;return!0})}},phantom:{id:"phantom",name:"Phantom",provider(e){var t,n;return(t=e==null?void 0:e.phantom)!=null&&t.ethereum?(n=e.phantom)==null?void 0:n.ethereum:Vd(e,"isPhantom")}}};function Vd(e,t){function n(i){return typeof t=="function"?t(i):typeof t=="string"?i[t]:!0}const r=e.ethereum;if(r!=null&&r.providers)return r.providers.find(i=>n(i));if(r&&n(r))return r}function DB(e){if(typeof window>"u")return;const t=n=>e(n.detail);return window.addEventListener("eip6963:announceProvider",t),window.dispatchEvent(new CustomEvent("eip6963:requestProvider")),()=>window.removeEventListener("eip6963:announceProvider",t)}function UB(){const e=new Set;let t=[];const n=()=>DB(i=>{t.some(({info:s})=>s.uuid===i.info.uuid)||(t=[...t,i],e.forEach(s=>s(t,{added:[i]})))});let r=n();return{_listeners(){return e},clear(){e.forEach(i=>i([],{removed:[...t]})),t=[]},destroy(){this.clear(),e.clear(),r==null||r()},findProvider({rdns:i}){return t.find(s=>s.info.rdns===i)},getProviders(){return t},reset(){this.clear(),r==null||r(),r=n()},subscribe(i,{emitImmediately:s}={}){return e.add(i),s&&i(t,{added:t}),()=>e.delete(i)}}}const HB=e=>(t,n,r)=>{const i=r.subscribe;return r.subscribe=(o,a,c)=>{let u=o;if(a){const l=(c==null?void 0:c.equalityFn)||Object.is;let d=o(r.getState());u=f=>{const h=o(f);if(!l(d,h)){const m=d;a(d=h,m)}},c!=null&&c.fireImmediately&&a(d,d)}return i(u)},e(t,n,r)};function zB(e,t){let n;try{n=e()}catch{return}return{getItem:i=>{var s;const o=c=>c===null?null:JSON.parse(c,void 0),a=(s=n.getItem(i))!=null?s:null;return a instanceof Promise?a.then(o):o(a)},setItem:(i,s)=>n.setItem(i,JSON.stringify(s,void 0)),removeItem:i=>n.removeItem(i)}}const Um=e=>t=>{try{const n=e(t);return n instanceof Promise?n:{then(r){return Um(r)(n)},catch(r){return this}}}catch(n){return{then(r){return this},catch(r){return Um(r)(n)}}}},WB=(e,t)=>(n,r,i)=>{let s={storage:zB(()=>localStorage),partialize:y=>y,version:0,merge:(y,w)=>({...w,...y}),...t},o=!1;const a=new Set,c=new Set;let u=s.storage;if(!u)return e((...y)=>{console.warn(`[zustand persist middleware] Unable to update item '${s.name}', the given storage is currently unavailable.`),n(...y)},r,i);const l=()=>{const y=s.partialize({...r()});return u.setItem(s.name,{state:y,version:s.version})},d=i.setState;i.setState=(y,w)=>{d(y,w),l()};const f=e((...y)=>{n(...y),l()},r,i);i.getInitialState=()=>f;let h;const m=()=>{var y,w;if(!u)return;o=!1,a.forEach(x=>{var v;return x((v=r())!=null?v:f)});const b=((w=s.onRehydrateStorage)==null?void 0:w.call(s,(y=r())!=null?y:f))||void 0;return Um(u.getItem.bind(u))(s.name).then(x=>{if(x)if(typeof x.version=="number"&&x.version!==s.version){if(s.migrate)return[!0,s.migrate(x.state,x.version)];console.error("State loaded from storage couldn't be migrated since no migrate function was provided")}else return[!1,x.state];return[!1,void 0]}).then(x=>{var v;const[S,I]=x;if(h=s.merge(I,(v=r())!=null?v:f),n(h,!0),S)return l()}).then(()=>{b==null||b(h,void 0),h=r(),o=!0,c.forEach(x=>x(h))}).catch(x=>{b==null||b(void 0,x)})};return i.persist={setOptions:y=>{s={...s,...y},y.storage&&(u=y.storage)},clearStorage:()=>{u==null||u.removeItem(s.name)},getOptions:()=>s,rehydrate:()=>m(),hasHydrated:()=>o,onHydrate:y=>(a.add(y),()=>{a.delete(y)}),onFinishHydration:y=>(c.add(y),()=>{c.delete(y)})},s.skipHydration||m(),h||f},x6=e=>{let t;const n=new Set,r=(u,l)=>{const d=typeof u=="function"?u(t):u;if(!Object.is(d,t)){const f=t;t=l??(typeof d!="object"||d===null)?d:Object.assign({},t,d),n.forEach(h=>h(t,f))}},i=()=>t,a={setState:r,getState:i,getInitialState:()=>c,subscribe:u=>(n.add(u),()=>n.delete(u))},c=t=e(r,i,a);return a},Hm=e=>e?x6(e):x6;var S6={exports:{}};(function(e){var t=Object.prototype.hasOwnProperty,n="~";function r(){}Object.create&&(r.prototype=Object.create(null),new r().__proto__||(n=!1));function i(c,u,l){this.fn=c,this.context=u,this.once=l||!1}function s(c,u,l,d,f){if(typeof l!="function")throw new TypeError("The listener must be a function");var h=new i(l,d||c,f),m=n?n+u:u;return c._events[m]?c._events[m].fn?c._events[m]=[c._events[m],h]:c._events[m].push(h):(c._events[m]=h,c._eventsCount++),c}function o(c,u){--c._eventsCount===0?c._events=new r:delete c._events[u]}function a(){this._events=new r,this._eventsCount=0}a.prototype.eventNames=function(){var u=[],l,d;if(this._eventsCount===0)return u;for(d in l=this._events)t.call(l,d)&&u.push(n?d.slice(1):d);return Object.getOwnPropertySymbols?u.concat(Object.getOwnPropertySymbols(l)):u},a.prototype.listeners=function(u){var l=n?n+u:u,d=this._events[l];if(!d)return[];if(d.fn)return[d.fn];for(var f=0,h=d.length,m=new Array(h);f<h;f++)m[f]=d[f].fn;return m},a.prototype.listenerCount=function(u){var l=n?n+u:u,d=this._events[l];return d?d.fn?1:d.length:0},a.prototype.emit=function(u,l,d,f,h,m){var y=n?n+u:u;if(!this._events[y])return!1;var w=this._events[y],b=arguments.length,x,v;if(w.fn){switch(w.once&&this.removeListener(u,w.fn,void 0,!0),b){case 1:return w.fn.call(w.context),!0;case 2:return w.fn.call(w.context,l),!0;case 3:return w.fn.call(w.context,l,d),!0;case 4:return w.fn.call(w.context,l,d,f),!0;case 5:return w.fn.call(w.context,l,d,f,h),!0;case 6:return w.fn.call(w.context,l,d,f,h,m),!0}for(v=1,x=new Array(b-1);v<b;v++)x[v-1]=arguments[v];w.fn.apply(w.context,x)}else{var S=w.length,I;for(v=0;v<S;v++)switch(w[v].once&&this.removeListener(u,w[v].fn,void 0,!0),b){case 1:w[v].fn.call(w[v].context);break;case 2:w[v].fn.call(w[v].context,l);break;case 3:w[v].fn.call(w[v].context,l,d);break;case 4:w[v].fn.call(w[v].context,l,d,f);break;default:if(!x)for(I=1,x=new Array(b-1);I<b;I++)x[I-1]=arguments[I];w[v].fn.apply(w[v].context,x)}}return!0},a.prototype.on=function(u,l,d){return s(this,u,l,d,!1)},a.prototype.once=function(u,l,d){return s(this,u,l,d,!0)},a.prototype.removeListener=function(u,l,d,f){var h=n?n+u:u;if(!this._events[h])return this;if(!l)return o(this,h),this;var m=this._events[h];if(m.fn)m.fn===l&&(!f||m.once)&&(!d||m.context===d)&&o(this,h);else{for(var y=0,w=[],b=m.length;y<b;y++)(m[y].fn!==l||f&&!m[y].once||d&&m[y].context!==d)&&w.push(m[y]);w.length?this._events[h]=w.length===1?w[0]:w:o(this,h)}return this},a.prototype.removeAllListeners=function(u){var l;return u?(l=n?n+u:u,this._events[l]&&o(this,l)):(this._events=new r,this._eventsCount=0),this},a.prototype.off=a.prototype.removeListener,a.prototype.addListener=a.prototype.on,a.prefixed=n,a.EventEmitter=a,e.exports=a})(S6);var GB=S6.exports;const k6=B0(GB);class qB{constructor(t){Object.defineProperty(this,"uid",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"_emitter",{enumerable:!0,configurable:!0,writable:!0,value:new k6})}on(t,n){this._emitter.on(t,n)}once(t,n){this._emitter.once(t,n)}off(t,n){this._emitter.off(t,n)}emit(t,...n){const r=n[0];this._emitter.emit(t,{uid:this.uid,...r})}listenerCount(t){return this._emitter.listenerCount(t)}}function VB(e){return new qB(e)}function KB(e,t){return JSON.parse(e,(n,r)=>{let i=r;return(i==null?void 0:i.__type)==="bigint"&&(i=BigInt(i.value)),(i==null?void 0:i.__type)==="Map"&&(i=new Map(i.value)),(t==null?void 0:t(n,i))??i})}function A6(e,t){return e.slice(0,t).join(".")||"."}function I6(e,t){const{length:n}=e;for(let r=0;r<n;++r)if(e[r]===t)return r+1;return 0}function JB(e,t){const n=typeof e=="function",r=typeof t=="function",i=[],s=[];return function(a,c){if(typeof c=="object")if(i.length){const u=I6(i,this);u===0?i[i.length]=this:(i.splice(u),s.splice(u)),s[s.length]=a;const l=I6(i,c);if(l!==0)return r?t.call(this,a,c,A6(s,l)):`[ref=${A6(s,l)}]`}else i[0]=c,s[0]=a;return n?e.call(this,a,c):c}}function ZB(e,t,n,r){return JSON.stringify(e,JB((i,s)=>{let o=s;return typeof o=="bigint"&&(o={__type:"bigint",value:s.toString()}),o instanceof Map&&(o={__type:"Map",value:Array.from(s.entries())}),(t==null?void 0:t(i,o))??o},r),n??void 0)}function YB(e){const{deserialize:t=KB,key:n="wagmi",serialize:r=ZB,storage:i=C6}=e;function s(o){return o instanceof Promise?o.then(a=>a).catch(()=>null):o}return{...i,key:n,async getItem(o,a){const c=i.getItem(`${n}.${o}`),u=await s(c);return u?t(u)??null:a??null},async setItem(o,a){const c=`${n}.${o}`;a===null?await s(i.removeItem(c)):await s(i.setItem(c,r(a)))},async removeItem(o){await s(i.removeItem(`${n}.${o}`))}}}const C6={getItem:()=>null,setItem:()=>{},removeItem:()=>{}};function QB(){const e=typeof window<"u"&&window.localStorage?window.localStorage:C6;return{getItem(t){return e.getItem(t)},removeItem(t){e.removeItem(t)},setItem(t,n){try{e.setItem(t,n)}catch{}}}}const zm=256;let Kd=zm,Jd;function XB(e=11){if(!Jd||Kd+e>zm*2){Jd="",Kd=0;for(let t=0;t<zm;t++)Jd+=(256+Math.random()*256|0).toString(16).substring(1)}return Jd.substring(Kd,Kd+++e)}function e7(e){const{multiInjectedProviderDiscovery:t=!0,storage:n=YB({storage:QB()}),syncConnectedChain:r=!0,ssr:i=!1,...s}=e,o=typeof window<"u"&&t?UB():void 0,a=Hm(()=>s.chains),c=Hm(()=>{const I=[],N=new Set;for(const j of s.connectors??[]){const U=u(j);if(I.push(U),!i&&U.rdns){const L=typeof U.rdns=="string"?[U.rdns]:U.rdns;for(const Y of L)N.add(Y)}}if(!i&&o){const j=o.getProviders();for(const U of j)N.has(U.info.rdns)||I.push(u(l(U)))}return I});function u(I){var U;const N=VB(XB()),j={...I({emitter:N,chains:a.getState(),storage:n,transports:s.transports}),emitter:N,uid:N.uid};return N.on("connect",v),(U=j.setup)==null||U.call(j),j}function l(I){const{info:N}=I,j=I.provider;return qd({target:{...N,id:N.rdns,provider:j}})}const d=new Map;function f(I={}){const N=I.chainId??w.getState().chainId,j=a.getState().find(L=>L.id===N);if(I.chainId&&!j)throw new Sa;{const L=d.get(w.getState().chainId);if(L&&!j)return L;if(!j)throw new Sa}{const L=d.get(N);if(L)return L}let U;if(s.client)U=s.client({chain:j});else{const L=j.id,Y=a.getState().map(C=>C.id),Z={},G=Object.entries(s);for(const[C,p]of G)if(!(C==="chains"||C==="client"||C==="connectors"||C==="transports"))if(typeof p=="object")if(L in p)Z[C]=p[L];else{if(Y.some(k=>k in p))continue;Z[C]=p}else Z[C]=p;U=zd({...Z,chain:j,batch:Z.batch??{multicall:!0},transport:C=>s.transports[L]({...C,connectors:c})})}return d.set(N,U),U}function h(){return{chainId:a.getState()[0].id,connections:new Map,current:null,status:"disconnected"}}let m;const y="0.0.0-canary-";Fd.startsWith(y)?m=Number.parseInt(Fd.replace(y,""),10):m=Number.parseInt(Fd.split(".")[0]??"0",10);const w=Hm(HB(n?WB(h,{migrate(I,N){if(N===m)return I;const j=h(),U=b(I,j.chainId);return{...j,chainId:U}},name:"store",partialize(I){return{connections:{__type:"Map",value:Array.from(I.connections.entries()).map(([N,j])=>{const{id:U,name:L,type:Y,uid:Z}=j.connector;return[N,{...j,connector:{id:U,name:L,type:Y,uid:Z}}]})},chainId:I.chainId,current:I.current}},merge(I,N){typeof I=="object"&&I&&"status"in I&&delete I.status;const j=b(I,N.chainId);return{...N,...I,chainId:j}},skipHydration:i,storage:n,version:m}):h));w.setState(h());function b(I,N){return I&&typeof I=="object"&&"chainId"in I&&typeof I.chainId=="number"&&a.getState().some(j=>j.id===I.chainId)?I.chainId:N}r&&w.subscribe(({connections:I,current:N})=>{var j;return N?(j=I.get(N))==null?void 0:j.chainId:void 0},I=>{if(a.getState().some(j=>j.id===I))return w.setState(j=>({...j,chainId:I??j.chainId}))}),o==null||o.subscribe(I=>{const N=new Set,j=new Set;for(const L of c.getState())if(N.add(L.id),L.rdns){const Y=typeof L.rdns=="string"?[L.rdns]:L.rdns;for(const Z of Y)j.add(Z)}const U=[];for(const L of I){if(j.has(L.info.rdns))continue;const Y=u(l(L));N.has(Y.id)||U.push(Y)}n&&!w.persist.hasHydrated()||c.setState(L=>[...L,...U],!0)});function x(I){w.setState(N=>{const j=N.connections.get(I.uid);return j?{...N,connections:new Map(N.connections).set(I.uid,{accounts:I.accounts??j.accounts,chainId:I.chainId??j.chainId,connector:j.connector})}:N})}function v(I){w.getState().status==="connecting"||w.getState().status==="reconnecting"||w.setState(N=>{const j=c.getState().find(U=>U.uid===I.uid);return j?(j.emitter.listenerCount("connect")&&j.emitter.off("connect",x),j.emitter.listenerCount("change")||j.emitter.on("change",x),j.emitter.listenerCount("disconnect")||j.emitter.on("disconnect",S),{...N,connections:new Map(N.connections).set(I.uid,{accounts:I.accounts,chainId:I.chainId,connector:j}),current:I.uid,status:"connected"}):N})}function S(I){w.setState(N=>{const j=N.connections.get(I.uid);if(j){const L=j.connector;L.emitter.listenerCount("change")&&j.connector.emitter.off("change",x),L.emitter.listenerCount("disconnect")&&j.connector.emitter.off("disconnect",S),L.emitter.listenerCount("connect")||j.connector.emitter.on("connect",v)}if(N.connections.delete(I.uid),N.connections.size===0)return{...N,connections:new Map,current:null,status:"disconnected"};const U=N.connections.values().next().value;return{...N,connections:new Map(N.connections),current:U.connector.uid}})}return{get chains(){return a.getState()},get connectors(){return c.getState()},storage:n,getClient:f,get state(){return w.getState()},setState(I){let N;typeof I=="function"?N=I(w.getState()):N=I;const j=h();typeof N!="object"&&(N=j),Object.keys(j).some(L=>!(L in N))&&(N=j),w.setState(N,!0)},subscribe(I,N,j){return w.subscribe(I,N,j?{...j,fireImmediately:j.emitImmediately}:void 0)},_internal:{mipd:o,async revalidate(){const I=w.getState(),N=I.connections;let j=I.current;for(const[,U]of N){const L=U.connector;L.isAuthorized&&await L.isAuthorized()||(N.delete(L.uid),j===L.uid&&(j=null))}w.setState(U=>({...U,connections:N,current:j}))},store:w,ssr:!!i,syncConnectedChain:r,transports:s.transports,chains:{setState(I){const N=typeof I=="function"?I(a.getState()):I;if(N.length!==0)return a.setState(N,!0)},subscribe(I){return a.subscribe(I)}},connectors:{providerDetailToConnector:l,setup:u,setState(I){return c.setState(typeof I=="function"?I(c.getState()):I,!0)},subscribe(I){return c.subscribe(I)}},events:{change:x,connect:v,disconnect:S}}}}function t7(e,t){const{initialState:n,reconnectOnMount:r}=t;return n&&!e._internal.store.persist.hasHydrated()&&e.setState({...n,chainId:e.chains.some(i=>i.id===n.chainId)?n.chainId:e.chains[0].id,connections:r?n.connections:new Map,status:r?"reconnecting":"disconnected"}),{async onMount(){e._internal.ssr&&(await e._internal.store.persist.rehydrate(),e._internal.mipd&&e._internal.connectors.setState(i=>{var c;const s=new Set;for(const u of i??[])if(u.rdns){const l=Array.isArray(u.rdns)?u.rdns:[u.rdns];for(const d of l)s.add(d)}const o=[],a=((c=e._internal.mipd)==null?void 0:c.getProviders())??[];for(const u of a){if(s.has(u.info.rdns))continue;const l=e._internal.connectors.providerDetailToConnector(u),d=e._internal.connectors.setup(l);o.push(d)}return[...i,...o]})),r?PB(e):e.storage&&e.setState(i=>({...i,connections:new Map}))}}}function n7(e){const{children:t,config:n,initialState:r,reconnectOnMount:i=!0}=e,{onMount:s}=t7(n,{initialState:r,reconnectOnMount:i});n._internal.ssr||s();const o=ce.useRef(!0);return ce.useEffect(()=>{if(o.current&&n._internal.ssr)return s(),()=>{o.current=!1}},[]),t}const P6=ce.createContext(void 0);function r7(e){const{children:t,config:n}=e,r={value:n};return ce.createElement(n7,e,ce.createElement(P6.Provider,r,t))}const i7="2.19.5",s7=()=>`wagmi@${i7}`;let o7=class extends Ri{constructor(){super(...arguments),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"WagmiError"})}get docsBaseUrl(){return"https://wagmi.sh/react"}get version(){return s7()}};class a7 extends o7{constructor(){super("`useConfig` must be used within `WagmiProvider`.",{docsPath:"/api/WagmiProvider"}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"WagmiProviderNotFoundError"})}}function Or(e={}){const t=e.config??ce.useContext(P6);if(!t)throw new a7;return t}function c7(e,t){const{onChange:n}=t;return e._internal.chains.subscribe((r,i)=>{n(r,i)})}var Wm={exports:{}},Gm={},Zd={exports:{}},qm={};/**
83
+ * @license React
84
+ * use-sync-external-store-shim.production.js
85
+ *
86
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
87
+ *
88
+ * This source code is licensed under the MIT license found in the
89
+ * LICENSE file in the root directory of this source tree.
90
+ */var R6;function u7(){if(R6)return qm;R6=1;var e=ce;function t(d,f){return d===f&&(d!==0||1/d===1/f)||d!==d&&f!==f}var n=typeof Object.is=="function"?Object.is:t,r=e.useState,i=e.useEffect,s=e.useLayoutEffect,o=e.useDebugValue;function a(d,f){var h=f(),m=r({inst:{value:h,getSnapshot:f}}),y=m[0].inst,w=m[1];return s(function(){y.value=h,y.getSnapshot=f,c(y)&&w({inst:y})},[d,h,f]),i(function(){return c(y)&&w({inst:y}),d(function(){c(y)&&w({inst:y})})},[d]),o(h),h}function c(d){var f=d.getSnapshot;d=d.value;try{var h=f();return!n(d,h)}catch{return!0}}function u(d,f){return f()}var l=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?u:a;return qm.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:l,qm}var Vm={};/**
91
+ * @license React
92
+ * use-sync-external-store-shim.development.js
93
+ *
94
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
95
+ *
96
+ * This source code is licensed under the MIT license found in the
97
+ * LICENSE file in the root directory of this source tree.
98
+ */var T6;function l7(){return T6||(T6=1,process.env.NODE_ENV!=="production"&&function(){function e(h,m){return h===m&&(h!==0||1/h===1/m)||h!==h&&m!==m}function t(h,m){l||i.startTransition===void 0||(l=!0,console.error("You are using an outdated, pre-release alpha of React 18 that does not support useSyncExternalStore. The use-sync-external-store shim will not work correctly. Upgrade to a newer pre-release."));var y=m();if(!d){var w=m();s(y,w)||(console.error("The result of getSnapshot should be cached to avoid an infinite loop"),d=!0)}w=o({inst:{value:y,getSnapshot:m}});var b=w[0].inst,x=w[1];return c(function(){b.value=y,b.getSnapshot=m,n(b)&&x({inst:b})},[h,y,m]),a(function(){return n(b)&&x({inst:b}),h(function(){n(b)&&x({inst:b})})},[h]),u(y),y}function n(h){var m=h.getSnapshot;h=h.value;try{var y=m();return!s(h,y)}catch{return!0}}function r(h,m){return m()}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var i=ce,s=typeof Object.is=="function"?Object.is:e,o=i.useState,a=i.useEffect,c=i.useLayoutEffect,u=i.useDebugValue,l=!1,d=!1,f=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?r:t;Vm.useSyncExternalStore=i.useSyncExternalStore!==void 0?i.useSyncExternalStore:f,typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())}()),Vm}var O6;function M6(){return O6||(O6=1,process.env.NODE_ENV==="production"?Zd.exports=u7():Zd.exports=l7()),Zd.exports}/**
99
+ * @license React
100
+ * use-sync-external-store-shim/with-selector.production.js
101
+ *
102
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
103
+ *
104
+ * This source code is licensed under the MIT license found in the
105
+ * LICENSE file in the root directory of this source tree.
106
+ */var B6;function d7(){if(B6)return Gm;B6=1;var e=ce,t=M6();function n(u,l){return u===l&&(u!==0||1/u===1/l)||u!==u&&l!==l}var r=typeof Object.is=="function"?Object.is:n,i=t.useSyncExternalStore,s=e.useRef,o=e.useEffect,a=e.useMemo,c=e.useDebugValue;return Gm.useSyncExternalStoreWithSelector=function(u,l,d,f,h){var m=s(null);if(m.current===null){var y={hasValue:!1,value:null};m.current=y}else y=m.current;m=a(function(){function b(N){if(!x){if(x=!0,v=N,N=f(N),h!==void 0&&y.hasValue){var j=y.value;if(h(j,N))return S=j}return S=N}if(j=S,r(v,N))return j;var U=f(N);return h!==void 0&&h(j,U)?(v=N,j):(v=N,S=U)}var x=!1,v,S,I=d===void 0?null:d;return[function(){return b(l())},I===null?void 0:function(){return b(I())}]},[l,d,f,h]);var w=i(u,m[0],m[1]);return o(function(){y.hasValue=!0,y.value=w},[w]),c(w),w},Gm}var Km={};/**
107
+ * @license React
108
+ * use-sync-external-store-shim/with-selector.development.js
109
+ *
110
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
111
+ *
112
+ * This source code is licensed under the MIT license found in the
113
+ * LICENSE file in the root directory of this source tree.
114
+ */var N6;function f7(){return N6||(N6=1,process.env.NODE_ENV!=="production"&&function(){function e(u,l){return u===l&&(u!==0||1/u===1/l)||u!==u&&l!==l}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var t=ce,n=M6(),r=typeof Object.is=="function"?Object.is:e,i=n.useSyncExternalStore,s=t.useRef,o=t.useEffect,a=t.useMemo,c=t.useDebugValue;Km.useSyncExternalStoreWithSelector=function(u,l,d,f,h){var m=s(null);if(m.current===null){var y={hasValue:!1,value:null};m.current=y}else y=m.current;m=a(function(){function b(N){if(!x){if(x=!0,v=N,N=f(N),h!==void 0&&y.hasValue){var j=y.value;if(h(j,N))return S=j}return S=N}if(j=S,r(v,N))return j;var U=f(N);return h!==void 0&&h(j,U)?(v=N,j):(v=N,S=U)}var x=!1,v,S,I=d===void 0?null:d;return[function(){return b(l())},I===null?void 0:function(){return b(I())}]},[l,d,f,h]);var w=i(u,m[0],m[1]);return o(function(){y.hasValue=!0,y.value=w},[w]),c(w),w},typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())}()),Km}process.env.NODE_ENV==="production"?Wm.exports=d7():Wm.exports=f7();var h7=Wm.exports;const Jm=e=>typeof e=="object"&&!Array.isArray(e);function p7(e,t,n=t,r=ro){const i=ce.useRef([]),s=h7.useSyncExternalStoreWithSelector(e,t,n,o=>o,(o,a)=>{if(Jm(o)&&Jm(a)&&i.current.length){for(const c of i.current)if(!r(o[c],a[c]))return!1;return!0}return r(o,a)});return ce.useMemo(()=>{if(Jm(s)){const o={...s};let a={};for(const[c,u]of Object.entries(o))a={...a,[c]:{configurable:!1,enumerable:!0,get:()=>(i.current.includes(c)||i.current.push(c),u)}};return Object.defineProperties(o,a),o}return s},[s])}function Zm(e={}){const t=Or(e);return p7(n=>BB(t,{onChange:n}),()=>b6(t))}var Aa=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},m7=(cI=class extends Aa{constructor(){super();Re(this,No);Re(this,Rs);Re(this,Ac);me(this,Ac,t=>{if(typeof window<"u"&&window.addEventListener){const n=()=>t();return window.addEventListener("visibilitychange",n,!1),()=>{window.removeEventListener("visibilitychange",n)}}})}onSubscribe(){V(this,Rs)||this.setEventListener(V(this,Ac))}onUnsubscribe(){var t;this.hasListeners()||((t=V(this,Rs))==null||t.call(this),me(this,Rs,void 0))}setEventListener(t){var n;me(this,Ac,t),(n=V(this,Rs))==null||n.call(this),me(this,Rs,t(r=>{typeof r=="boolean"?this.setFocused(r):this.onFocus()}))}setFocused(t){V(this,No)!==t&&(me(this,No,t),this.onFocus())}onFocus(){const t=this.isFocused();this.listeners.forEach(n=>{n(t)})}isFocused(){var t;return typeof V(this,No)=="boolean"?V(this,No):((t=globalThis.document)==null?void 0:t.visibilityState)!=="hidden"}},No=new WeakMap,Rs=new WeakMap,Ac=new WeakMap,cI),Ym=new m7,g7={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},y7=(uI=class{constructor(){Re(this,ui,g7);Re(this,Lo,!1)}setTimeoutProvider(e){process.env.NODE_ENV!=="production"&&V(this,Lo)&&e!==V(this,ui)&&console.error("[timeoutManager]: Switching provider after calls to previous provider might result in unexpected behavior.",{previous:V(this,ui),provider:e}),me(this,ui,e),process.env.NODE_ENV!=="production"&&me(this,Lo,!1)}setTimeout(e,t){return process.env.NODE_ENV!=="production"&&me(this,Lo,!0),V(this,ui).setTimeout(e,t)}clearTimeout(e){V(this,ui).clearTimeout(e)}setInterval(e,t){return process.env.NODE_ENV!=="production"&&me(this,Lo,!0),V(this,ui).setInterval(e,t)}clearInterval(e){V(this,ui).clearInterval(e)}},ui=new WeakMap,Lo=new WeakMap,uI),io=new y7;function b7(e){setTimeout(e,0)}var w7=typeof window>"u"||"Deno"in globalThis;function Bn(){}function v7(e,t){return typeof e=="function"?e(t):e}function Qm(e){return typeof e=="number"&&e>=0&&e!==1/0}function L6(e,t){return Math.max(e+(t||0)-Date.now(),0)}function hs(e,t){return typeof e=="function"?e(t):e}function hr(e,t){return typeof e=="function"?e(t):e}function j6(e,t){const{type:n="all",exact:r,fetchStatus:i,predicate:s,queryKey:o,stale:a}=e;if(o){if(r){if(t.queryHash!==Xm(o,t.options))return!1}else if(!Cu(t.queryKey,o))return!1}if(n!=="all"){const c=t.isActive();if(n==="active"&&!c||n==="inactive"&&c)return!1}return!(typeof a=="boolean"&&t.isStale()!==a||i&&i!==t.state.fetchStatus||s&&!s(t))}function $6(e,t){const{exact:n,status:r,predicate:i,mutationKey:s}=e;if(s){if(!t.options.mutationKey)return!1;if(n){if(so(t.options.mutationKey)!==so(s))return!1}else if(!Cu(t.options.mutationKey,s))return!1}return!(r&&t.state.status!==r||i&&!i(t))}function Xm(e,t){return((t==null?void 0:t.queryKeyHashFn)||so)(e)}function so(e){return JSON.stringify(e,(t,n)=>tg(n)?Object.keys(n).sort().reduce((r,i)=>(r[i]=n[i],r),{}):n)}function Cu(e,t){return e===t?!0:typeof e!=typeof t?!1:e&&t&&typeof e=="object"&&typeof t=="object"?Object.keys(t).every(n=>Cu(e[n],t[n])):!1}var _7=Object.prototype.hasOwnProperty;function eg(e,t,n=0){if(e===t)return e;if(n>500)return t;const r=F6(e)&&F6(t);if(!r&&!(tg(e)&&tg(t)))return t;const s=(r?e:Object.keys(e)).length,o=r?t:Object.keys(t),a=o.length,c=r?new Array(a):{};let u=0;for(let l=0;l<a;l++){const d=r?l:o[l],f=e[d],h=t[d];if(f===h){c[d]=f,(r?l<s:_7.call(e,d))&&u++;continue}if(f===null||h===null||typeof f!="object"||typeof h!="object"){c[d]=h;continue}const m=eg(f,h,n+1);c[d]=m,m===f&&u++}return s===a&&u===s?e:c}function Yd(e,t){if(!t||Object.keys(e).length!==Object.keys(t).length)return!1;for(const n in e)if(e[n]!==t[n])return!1;return!0}function F6(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function tg(e){if(!D6(e))return!1;const t=e.constructor;if(t===void 0)return!0;const n=t.prototype;return!(!D6(n)||!n.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(e)!==Object.prototype)}function D6(e){return Object.prototype.toString.call(e)==="[object Object]"}function E7(e){return new Promise(t=>{io.setTimeout(t,e)})}function ng(e,t,n){if(typeof n.structuralSharing=="function")return n.structuralSharing(e,t);if(n.structuralSharing!==!1){if(process.env.NODE_ENV!=="production")try{return eg(e,t)}catch(r){throw console.error(`Structural sharing requires data to be JSON serializable. To fix this, turn off structuralSharing or return JSON-serializable data from your queryFn. [${n.queryHash}]: ${r}`),r}return eg(e,t)}return t}function x7(e,t,n=0){const r=[...e,t];return n&&r.length>n?r.slice(1):r}function S7(e,t,n=0){const r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var Qd=Symbol();function U6(e,t){return process.env.NODE_ENV!=="production"&&e.queryFn===Qd&&console.error(`Attempted to invoke queryFn when set to skipToken. This is likely a configuration error. Query hash: '${e.queryHash}'`),!e.queryFn&&(t!=null&&t.initialPromise)?()=>t.initialPromise:!e.queryFn||e.queryFn===Qd?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function rg(e,t){return typeof e=="function"?e(...t):!!e}function k7(e,t,n){let r=!1,i;return Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(i??(i=t()),r||(r=!0,i.aborted?n():i.addEventListener("abort",n,{once:!0})),i)}),e}var Pu=(()=>{let e=()=>w7;return{isServer(){return e()},setIsServer(t){e=t}}})();function ig(){let e,t;const n=new Promise((i,s)=>{e=i,t=s});n.status="pending",n.catch(()=>{});function r(i){Object.assign(n,i),delete n.resolve,delete n.reject}return n.resolve=i=>{r({status:"fulfilled",value:i}),e(i)},n.reject=i=>{r({status:"rejected",reason:i}),t(i)},n}var A7=b7;function I7(){let e=[],t=0,n=a=>{a()},r=a=>{a()},i=A7;const s=a=>{t?e.push(a):i(()=>{n(a)})},o=()=>{const a=e;e=[],a.length&&i(()=>{r(()=>{a.forEach(c=>{n(c)})})})};return{batch:a=>{let c;t++;try{c=a()}finally{t--,t||o()}return c},batchCalls:a=>(...c)=>{s(()=>{a(...c)})},schedule:s,setNotifyFunction:a=>{n=a},setBatchNotifyFunction:a=>{r=a},setScheduler:a=>{i=a}}}var nn=I7(),C7=(lI=class extends Aa{constructor(){super();Re(this,Ic,!0);Re(this,Ts);Re(this,Cc);me(this,Cc,t=>{if(typeof window<"u"&&window.addEventListener){const n=()=>t(!0),r=()=>t(!1);return window.addEventListener("online",n,!1),window.addEventListener("offline",r,!1),()=>{window.removeEventListener("online",n),window.removeEventListener("offline",r)}}})}onSubscribe(){V(this,Ts)||this.setEventListener(V(this,Cc))}onUnsubscribe(){var t;this.hasListeners()||((t=V(this,Ts))==null||t.call(this),me(this,Ts,void 0))}setEventListener(t){var n;me(this,Cc,t),(n=V(this,Ts))==null||n.call(this),me(this,Ts,t(this.setOnline.bind(this)))}setOnline(t){V(this,Ic)!==t&&(me(this,Ic,t),this.listeners.forEach(r=>{r(t)}))}isOnline(){return V(this,Ic)}},Ic=new WeakMap,Ts=new WeakMap,Cc=new WeakMap,lI),Xd=new C7;function P7(e){return Math.min(1e3*2**e,3e4)}function H6(e){return(e??"online")==="online"?Xd.isOnline():!0}var sg=class extends Error{constructor(e){super("CancelledError"),this.revert=e==null?void 0:e.revert,this.silent=e==null?void 0:e.silent}};function z6(e){let t=!1,n=0,r;const i=ig(),s=()=>i.status!=="pending",o=y=>{var w;if(!s()){const b=new sg(y);f(b),(w=e.onCancel)==null||w.call(e,b)}},a=()=>{t=!0},c=()=>{t=!1},u=()=>Ym.isFocused()&&(e.networkMode==="always"||Xd.isOnline())&&e.canRun(),l=()=>H6(e.networkMode)&&e.canRun(),d=y=>{s()||(r==null||r(),i.resolve(y))},f=y=>{s()||(r==null||r(),i.reject(y))},h=()=>new Promise(y=>{var w;r=b=>{(s()||u())&&y(b)},(w=e.onPause)==null||w.call(e)}).then(()=>{var y;r=void 0,s()||(y=e.onContinue)==null||y.call(e)}),m=()=>{if(s())return;let y;const w=n===0?e.initialPromise:void 0;try{y=w??e.fn()}catch(b){y=Promise.reject(b)}Promise.resolve(y).then(d).catch(b=>{var N;if(s())return;const x=e.retry??(Pu.isServer()?0:3),v=e.retryDelay??P7,S=typeof v=="function"?v(n,b):v,I=x===!0||typeof x=="number"&&n<x||typeof x=="function"&&x(n,b);if(t||!I){f(b);return}n++,(N=e.onFail)==null||N.call(e,n,b),E7(S).then(()=>u()?void 0:h()).then(()=>{t?f(b):m()})})};return{promise:i,status:()=>i.status,cancel:o,continue:()=>(r==null||r(),i),cancelRetry:a,continueRetry:c,canStart:l,start:()=>(l()?m():h().then(m),i)}}var W6=(dI=class{constructor(){Re(this,jo)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),Qm(this.gcTime)&&me(this,jo,io.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(Pu.isServer()?1/0:5*60*1e3))}clearGcTimeout(){V(this,jo)!==void 0&&(io.clearTimeout(V(this,jo)),me(this,jo,void 0))}},jo=new WeakMap,dI),R7=(fI=class extends W6{constructor(t){super();Re(this,ur);Re(this,$o);Re(this,Pc);Re(this,Sr);Re(this,Fo);Re(this,hn);Re(this,zl);Re(this,Do);me(this,Do,!1),me(this,zl,t.defaultOptions),this.setOptions(t.options),this.observers=[],me(this,Fo,t.client),me(this,Sr,V(this,Fo).getQueryCache()),this.queryKey=t.queryKey,this.queryHash=t.queryHash,me(this,$o,V6(this.options)),this.state=t.state??V(this,$o),this.scheduleGc()}get meta(){return this.options.meta}get promise(){var t;return(t=V(this,hn))==null?void 0:t.promise}setOptions(t){if(this.options={...V(this,zl),...t},this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const n=V6(this.options);n.data!==void 0&&(this.setState(q6(n.data,n.dataUpdatedAt)),me(this,$o,n))}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&V(this,Sr).remove(this)}setData(t,n){const r=ng(this.state.data,t,this.options);return Le(this,ur,Yi).call(this,{data:r,type:"success",dataUpdatedAt:n==null?void 0:n.updatedAt,manual:n==null?void 0:n.manual}),r}setState(t,n){Le(this,ur,Yi).call(this,{type:"setState",state:t,setStateOptions:n})}cancel(t){var r,i;const n=(r=V(this,hn))==null?void 0:r.promise;return(i=V(this,hn))==null||i.cancel(t),n?n.then(Bn).catch(Bn):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return V(this,$o)}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(t=>hr(t.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===Qd||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0?this.observers.some(t=>hs(t.options.staleTime,this)==="static"):!1}isStale(){return this.getObserversCount()>0?this.observers.some(t=>t.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(t=0){return this.state.data===void 0?!0:t==="static"?!1:this.state.isInvalidated?!0:!L6(this.state.dataUpdatedAt,t)}onFocus(){var n;const t=this.observers.find(r=>r.shouldFetchOnWindowFocus());t==null||t.refetch({cancelRefetch:!1}),(n=V(this,hn))==null||n.continue()}onOnline(){var n;const t=this.observers.find(r=>r.shouldFetchOnReconnect());t==null||t.refetch({cancelRefetch:!1}),(n=V(this,hn))==null||n.continue()}addObserver(t){this.observers.includes(t)||(this.observers.push(t),this.clearGcTimeout(),V(this,Sr).notify({type:"observerAdded",query:this,observer:t}))}removeObserver(t){this.observers.includes(t)&&(this.observers=this.observers.filter(n=>n!==t),this.observers.length||(V(this,hn)&&(V(this,Do)||Le(this,ur,_I).call(this)?V(this,hn).cancel({revert:!0}):V(this,hn).cancelRetry()),this.scheduleGc()),V(this,Sr).notify({type:"observerRemoved",query:this,observer:t}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||Le(this,ur,Yi).call(this,{type:"invalidate"})}async fetch(t,n){var c,u,l,d,f,h,m,y,w,b,x,v;if(this.state.fetchStatus!=="idle"&&((c=V(this,hn))==null?void 0:c.status())!=="rejected"){if(this.state.data!==void 0&&(n!=null&&n.cancelRefetch))this.cancel({silent:!0});else if(V(this,hn))return V(this,hn).continueRetry(),V(this,hn).promise}if(t&&this.setOptions(t),!this.options.queryFn){const S=this.observers.find(I=>I.options.queryFn);S&&this.setOptions(S.options)}process.env.NODE_ENV!=="production"&&(Array.isArray(this.options.queryKey)||console.error("As of v4, queryKey needs to be an Array. If you are using a string like 'repoData', please change it to an Array, e.g. ['repoData']"));const r=new AbortController,i=S=>{Object.defineProperty(S,"signal",{enumerable:!0,get:()=>(me(this,Do,!0),r.signal)})},s=()=>{const S=U6(this.options,n),N=(()=>{const j={client:V(this,Fo),queryKey:this.queryKey,meta:this.meta};return i(j),j})();return me(this,Do,!1),this.options.persister?this.options.persister(S,N,this):S(N)},a=(()=>{const S={fetchOptions:n,options:this.options,queryKey:this.queryKey,client:V(this,Fo),state:this.state,fetchFn:s};return i(S),S})();(u=this.options.behavior)==null||u.onFetch(a,this),me(this,Pc,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((l=a.fetchOptions)==null?void 0:l.meta))&&Le(this,ur,Yi).call(this,{type:"fetch",meta:(d=a.fetchOptions)==null?void 0:d.meta}),me(this,hn,z6({initialPromise:n==null?void 0:n.initialPromise,fn:a.fetchFn,onCancel:S=>{S instanceof sg&&S.revert&&this.setState({...V(this,Pc),fetchStatus:"idle"}),r.abort()},onFail:(S,I)=>{Le(this,ur,Yi).call(this,{type:"failed",failureCount:S,error:I})},onPause:()=>{Le(this,ur,Yi).call(this,{type:"pause"})},onContinue:()=>{Le(this,ur,Yi).call(this,{type:"continue"})},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode,canRun:()=>!0}));try{const S=await V(this,hn).start();if(S===void 0)throw process.env.NODE_ENV!=="production"&&console.error(`Query data cannot be undefined. Please make sure to return a value other than undefined from your query function. Affected query key: ${this.queryHash}`),new Error(`${this.queryHash} data is undefined`);return this.setData(S),(h=(f=V(this,Sr).config).onSuccess)==null||h.call(f,S,this),(y=(m=V(this,Sr).config).onSettled)==null||y.call(m,S,this.state.error,this),S}catch(S){if(S instanceof sg){if(S.silent)return V(this,hn).promise;if(S.revert){if(this.state.data===void 0)throw S;return this.state.data}}throw Le(this,ur,Yi).call(this,{type:"error",error:S}),(b=(w=V(this,Sr).config).onError)==null||b.call(w,S,this),(v=(x=V(this,Sr).config).onSettled)==null||v.call(x,this.state.data,S,this),S}finally{this.scheduleGc()}}},$o=new WeakMap,Pc=new WeakMap,Sr=new WeakMap,Fo=new WeakMap,hn=new WeakMap,zl=new WeakMap,Do=new WeakMap,ur=new WeakSet,_I=function(){return this.state.fetchStatus==="paused"&&this.state.status==="pending"},Yi=function(t){const n=r=>{switch(t.type){case"failed":return{...r,fetchFailureCount:t.failureCount,fetchFailureReason:t.error};case"pause":return{...r,fetchStatus:"paused"};case"continue":return{...r,fetchStatus:"fetching"};case"fetch":return{...r,...G6(r.data,this.options),fetchMeta:t.meta??null};case"success":const i={...r,...q6(t.data,t.dataUpdatedAt),dataUpdateCount:r.dataUpdateCount+1,...!t.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return me(this,Pc,t.manual?i:void 0),i;case"error":const s=t.error;return{...r,error:s,errorUpdateCount:r.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:r.fetchFailureCount+1,fetchFailureReason:s,fetchStatus:"idle",status:"error",isInvalidated:!0};case"invalidate":return{...r,isInvalidated:!0};case"setState":return{...r,...t.state}}};this.state=n(this.state),nn.batch(()=>{this.observers.forEach(r=>{r.onQueryUpdate()}),V(this,Sr).notify({query:this,type:"updated",action:t})})},fI);function G6(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:H6(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function q6(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:"success"}}function V6(e){const t=typeof e.initialData=="function"?e.initialData():e.initialData,n=t!==void 0,r=n?typeof e.initialDataUpdatedAt=="function"?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:n?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?"success":"pending",fetchStatus:"idle"}}var T7=(hI=class extends Aa{constructor(t,n){super();Re(this,ct);Re(this,Qn);Re(this,nt);Re(this,Wl);Re(this,Fn);Re(this,Uo);Re(this,Rc);Re(this,zi);Re(this,Os);Re(this,Gl);Re(this,Tc);Re(this,Oc);Re(this,Ho);Re(this,zo);Re(this,Ms);Re(this,Mc,new Set);this.options=n,me(this,Qn,t),me(this,Os,null),me(this,zi,ig()),this.bindMethods(),this.setOptions(n)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(V(this,nt).addObserver(this),K6(V(this,nt),this.options)?Le(this,ct,Kl).call(this):this.updateResult(),Le(this,ct,cw).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return og(V(this,nt),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return og(V(this,nt),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,Le(this,ct,uw).call(this),Le(this,ct,lw).call(this),V(this,nt).removeObserver(this)}setOptions(t){const n=this.options,r=V(this,nt);if(this.options=V(this,Qn).defaultQueryOptions(t),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof hr(this.options.enabled,V(this,nt))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");Le(this,ct,dw).call(this),V(this,nt).setOptions(this.options),n._defaulted&&!Yd(this.options,n)&&V(this,Qn).getQueryCache().notify({type:"observerOptionsUpdated",query:V(this,nt),observer:this});const i=this.hasListeners();i&&J6(V(this,nt),r,this.options,n)&&Le(this,ct,Kl).call(this),this.updateResult(),i&&(V(this,nt)!==r||hr(this.options.enabled,V(this,nt))!==hr(n.enabled,V(this,nt))||hs(this.options.staleTime,V(this,nt))!==hs(n.staleTime,V(this,nt)))&&Le(this,ct,sw).call(this);const s=Le(this,ct,ow).call(this);i&&(V(this,nt)!==r||hr(this.options.enabled,V(this,nt))!==hr(n.enabled,V(this,nt))||s!==V(this,Ms))&&Le(this,ct,aw).call(this,s)}getOptimisticResult(t){const n=V(this,Qn).getQueryCache().build(V(this,Qn),t),r=this.createResult(n,t);return M7(this,r)&&(me(this,Fn,r),me(this,Rc,this.options),me(this,Uo,V(this,nt).state)),r}getCurrentResult(){return V(this,Fn)}trackResult(t,n){return new Proxy(t,{get:(r,i)=>(this.trackProp(i),n==null||n(i),i==="promise"&&(this.trackProp("data"),!this.options.experimental_prefetchInRender&&V(this,zi).status==="pending"&&V(this,zi).reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(r,i))})}trackProp(t){V(this,Mc).add(t)}getCurrentQuery(){return V(this,nt)}refetch({...t}={}){return this.fetch({...t})}fetchOptimistic(t){const n=V(this,Qn).defaultQueryOptions(t),r=V(this,Qn).getQueryCache().build(V(this,Qn),n);return r.fetch().then(()=>this.createResult(r,n))}fetch(t){return Le(this,ct,Kl).call(this,{...t,cancelRefetch:t.cancelRefetch??!0}).then(()=>(this.updateResult(),V(this,Fn)))}createResult(t,n){var L;const r=V(this,nt),i=this.options,s=V(this,Fn),o=V(this,Uo),a=V(this,Rc),u=t!==r?t.state:V(this,Wl),{state:l}=t;let d={...l},f=!1,h;if(n._optimisticResults){const Y=this.hasListeners(),Z=!Y&&K6(t,n),G=Y&&J6(t,r,n,i);(Z||G)&&(d={...d,...G6(l.data,t.options)}),n._optimisticResults==="isRestoring"&&(d.fetchStatus="idle")}let{error:m,errorUpdatedAt:y,status:w}=d;h=d.data;let b=!1;if(n.placeholderData!==void 0&&h===void 0&&w==="pending"){let Y;s!=null&&s.isPlaceholderData&&n.placeholderData===(a==null?void 0:a.placeholderData)?(Y=s.data,b=!0):Y=typeof n.placeholderData=="function"?n.placeholderData((L=V(this,Oc))==null?void 0:L.state.data,V(this,Oc)):n.placeholderData,Y!==void 0&&(w="success",h=ng(s==null?void 0:s.data,Y,n),f=!0)}if(n.select&&h!==void 0&&!b)if(s&&h===(o==null?void 0:o.data)&&n.select===V(this,Gl))h=V(this,Tc);else try{me(this,Gl,n.select),h=n.select(h),h=ng(s==null?void 0:s.data,h,n),me(this,Tc,h),me(this,Os,null)}catch(Y){me(this,Os,Y)}V(this,Os)&&(m=V(this,Os),h=V(this,Tc),y=Date.now(),w="error");const x=d.fetchStatus==="fetching",v=w==="pending",S=w==="error",I=v&&x,N=h!==void 0,U={status:w,fetchStatus:d.fetchStatus,isPending:v,isSuccess:w==="success",isError:S,isInitialLoading:I,isLoading:I,data:h,dataUpdatedAt:d.dataUpdatedAt,error:m,errorUpdatedAt:y,failureCount:d.fetchFailureCount,failureReason:d.fetchFailureReason,errorUpdateCount:d.errorUpdateCount,isFetched:t.isFetched(),isFetchedAfterMount:d.dataUpdateCount>u.dataUpdateCount||d.errorUpdateCount>u.errorUpdateCount,isFetching:x,isRefetching:x&&!v,isLoadingError:S&&!N,isPaused:d.fetchStatus==="paused",isPlaceholderData:f,isRefetchError:S&&N,isStale:ag(t,n),refetch:this.refetch,promise:V(this,zi),isEnabled:hr(n.enabled,t)!==!1};if(this.options.experimental_prefetchInRender){const Y=U.data!==void 0,Z=U.status==="error"&&!Y,G=g=>{Z?g.reject(U.error):Y&&g.resolve(U.data)},C=()=>{const g=me(this,zi,U.promise=ig());G(g)},p=V(this,zi);switch(p.status){case"pending":t.queryHash===r.queryHash&&G(p);break;case"fulfilled":(Z||U.data!==p.value)&&C();break;case"rejected":(!Z||U.error!==p.reason)&&C();break}}return U}updateResult(){const t=V(this,Fn),n=this.createResult(V(this,nt),this.options);if(me(this,Uo,V(this,nt).state),me(this,Rc,this.options),V(this,Uo).data!==void 0&&me(this,Oc,V(this,nt)),Yd(n,t))return;me(this,Fn,n);const r=()=>{if(!t)return!0;const{notifyOnChangeProps:i}=this.options,s=typeof i=="function"?i():i;if(s==="all"||!s&&!V(this,Mc).size)return!0;const o=new Set(s??V(this,Mc));return this.options.throwOnError&&o.add("error"),Object.keys(V(this,Fn)).some(a=>{const c=a;return V(this,Fn)[c]!==t[c]&&o.has(c)})};Le(this,ct,EI).call(this,{listeners:r()})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&Le(this,ct,cw).call(this)}},Qn=new WeakMap,nt=new WeakMap,Wl=new WeakMap,Fn=new WeakMap,Uo=new WeakMap,Rc=new WeakMap,zi=new WeakMap,Os=new WeakMap,Gl=new WeakMap,Tc=new WeakMap,Oc=new WeakMap,Ho=new WeakMap,zo=new WeakMap,Ms=new WeakMap,Mc=new WeakMap,ct=new WeakSet,Kl=function(t){Le(this,ct,dw).call(this);let n=V(this,nt).fetch(this.options,t);return t!=null&&t.throwOnError||(n=n.catch(Bn)),n},sw=function(){Le(this,ct,uw).call(this);const t=hs(this.options.staleTime,V(this,nt));if(Pu.isServer()||V(this,Fn).isStale||!Qm(t))return;const r=L6(V(this,Fn).dataUpdatedAt,t)+1;me(this,Ho,io.setTimeout(()=>{V(this,Fn).isStale||this.updateResult()},r))},ow=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(V(this,nt)):this.options.refetchInterval)??!1},aw=function(t){Le(this,ct,lw).call(this),me(this,Ms,t),!(Pu.isServer()||hr(this.options.enabled,V(this,nt))===!1||!Qm(V(this,Ms))||V(this,Ms)===0)&&me(this,zo,io.setInterval(()=>{(this.options.refetchIntervalInBackground||Ym.isFocused())&&Le(this,ct,Kl).call(this)},V(this,Ms)))},cw=function(){Le(this,ct,sw).call(this),Le(this,ct,aw).call(this,Le(this,ct,ow).call(this))},uw=function(){V(this,Ho)!==void 0&&(io.clearTimeout(V(this,Ho)),me(this,Ho,void 0))},lw=function(){V(this,zo)!==void 0&&(io.clearInterval(V(this,zo)),me(this,zo,void 0))},dw=function(){const t=V(this,Qn).getQueryCache().build(V(this,Qn),this.options);if(t===V(this,nt))return;const n=V(this,nt);me(this,nt,t),me(this,Wl,t.state),this.hasListeners()&&(n==null||n.removeObserver(this),t.addObserver(this))},EI=function(t){nn.batch(()=>{t.listeners&&this.listeners.forEach(n=>{n(V(this,Fn))}),V(this,Qn).getQueryCache().notify({query:V(this,nt),type:"observerResultsUpdated"})})},hI);function O7(e,t){return hr(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status==="error"&&t.retryOnMount===!1)}function K6(e,t){return O7(e,t)||e.state.data!==void 0&&og(e,t,t.refetchOnMount)}function og(e,t,n){if(hr(t.enabled,e)!==!1&&hs(t.staleTime,e)!=="static"){const r=typeof n=="function"?n(e):n;return r==="always"||r!==!1&&ag(e,t)}return!1}function J6(e,t,n,r){return(e!==t||hr(r.enabled,e)===!1)&&(!n.suspense||e.state.status!=="error")&&ag(e,n)}function ag(e,t){return hr(t.enabled,e)!==!1&&e.isStaleByTime(hs(t.staleTime,e))}function M7(e,t){return!Yd(e.getCurrentResult(),t)}function Z6(e){return{onFetch:(t,n)=>{var l,d,f,h,m;const r=t.options,i=(f=(d=(l=t.fetchOptions)==null?void 0:l.meta)==null?void 0:d.fetchMore)==null?void 0:f.direction,s=((h=t.state.data)==null?void 0:h.pages)||[],o=((m=t.state.data)==null?void 0:m.pageParams)||[];let a={pages:[],pageParams:[]},c=0;const u=async()=>{let y=!1;const w=v=>{k7(v,()=>t.signal,()=>y=!0)},b=U6(t.options,t.fetchOptions),x=async(v,S,I)=>{if(y)return Promise.reject();if(S==null&&v.pages.length)return Promise.resolve(v);const j=(()=>{const Z={client:t.client,queryKey:t.queryKey,pageParam:S,direction:I?"backward":"forward",meta:t.options.meta};return w(Z),Z})(),U=await b(j),{maxPages:L}=t.options,Y=I?S7:x7;return{pages:Y(v.pages,U,L),pageParams:Y(v.pageParams,S,L)}};if(i&&s.length){const v=i==="backward",S=v?B7:Y6,I={pages:s,pageParams:o},N=S(r,I);a=await x(I,N,v)}else{const v=e??s.length;do{const S=c===0?o[0]??r.initialPageParam:Y6(r,a);if(c>0&&S==null)break;a=await x(a,S),c++}while(c<v)}return a};t.options.persister?t.fetchFn=()=>{var y,w;return(w=(y=t.options).persister)==null?void 0:w.call(y,u,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n)}:t.fetchFn=u}}}function Y6(e,{pages:t,pageParams:n}){const r=t.length-1;return t.length>0?e.getNextPageParam(t[r],t,n[r],n):void 0}function B7(e,{pages:t,pageParams:n}){var r;return t.length>0?(r=e.getPreviousPageParam)==null?void 0:r.call(e,t[0],t,n[0],n):void 0}var N7=(pI=class extends W6{constructor(t){super();Re(this,di);Re(this,ql);Re(this,li);Re(this,In);Re(this,Wo);me(this,ql,t.client),this.mutationId=t.mutationId,me(this,In,t.mutationCache),me(this,li,[]),this.state=t.state||Q6(),this.setOptions(t.options),this.scheduleGc()}setOptions(t){this.options=t,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(t){V(this,li).includes(t)||(V(this,li).push(t),this.clearGcTimeout(),V(this,In).notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){me(this,li,V(this,li).filter(n=>n!==t)),this.scheduleGc(),V(this,In).notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){V(this,li).length||(this.state.status==="pending"?this.scheduleGc():V(this,In).remove(this))}continue(){var t;return((t=V(this,Wo))==null?void 0:t.continue())??this.execute(this.state.variables)}async execute(t){var o,a,c,u,l,d,f,h,m,y,w,b,x,v,S,I,N,j;const n=()=>{Le(this,di,$s).call(this,{type:"continue"})},r={client:V(this,ql),meta:this.options.meta,mutationKey:this.options.mutationKey};me(this,Wo,z6({fn:()=>this.options.mutationFn?this.options.mutationFn(t,r):Promise.reject(new Error("No mutationFn found")),onFail:(U,L)=>{Le(this,di,$s).call(this,{type:"failed",failureCount:U,error:L})},onPause:()=>{Le(this,di,$s).call(this,{type:"pause"})},onContinue:n,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>V(this,In).canRun(this)}));const i=this.state.status==="pending",s=!V(this,Wo).canStart();try{if(i)n();else{Le(this,di,$s).call(this,{type:"pending",variables:t,isPaused:s}),V(this,In).config.onMutate&&await V(this,In).config.onMutate(t,this,r);const L=await((a=(o=this.options).onMutate)==null?void 0:a.call(o,t,r));L!==this.state.context&&Le(this,di,$s).call(this,{type:"pending",context:L,variables:t,isPaused:s})}const U=await V(this,Wo).start();return await((u=(c=V(this,In).config).onSuccess)==null?void 0:u.call(c,U,t,this.state.context,this,r)),await((d=(l=this.options).onSuccess)==null?void 0:d.call(l,U,t,this.state.context,r)),await((h=(f=V(this,In).config).onSettled)==null?void 0:h.call(f,U,null,this.state.variables,this.state.context,this,r)),await((y=(m=this.options).onSettled)==null?void 0:y.call(m,U,null,t,this.state.context,r)),Le(this,di,$s).call(this,{type:"success",data:U}),U}catch(U){try{await((b=(w=V(this,In).config).onError)==null?void 0:b.call(w,U,t,this.state.context,this,r))}catch(L){Promise.reject(L)}try{await((v=(x=this.options).onError)==null?void 0:v.call(x,U,t,this.state.context,r))}catch(L){Promise.reject(L)}try{await((I=(S=V(this,In).config).onSettled)==null?void 0:I.call(S,void 0,U,this.state.variables,this.state.context,this,r))}catch(L){Promise.reject(L)}try{await((j=(N=this.options).onSettled)==null?void 0:j.call(N,void 0,U,t,this.state.context,r))}catch(L){Promise.reject(L)}throw Le(this,di,$s).call(this,{type:"error",error:U}),U}finally{V(this,In).runNext(this)}}},ql=new WeakMap,li=new WeakMap,In=new WeakMap,Wo=new WeakMap,di=new WeakSet,$s=function(t){const n=r=>{switch(t.type){case"failed":return{...r,failureCount:t.failureCount,failureReason:t.error};case"pause":return{...r,isPaused:!0};case"continue":return{...r,isPaused:!1};case"pending":return{...r,context:t.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:t.isPaused,status:"pending",variables:t.variables,submittedAt:Date.now()};case"success":return{...r,data:t.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...r,data:void 0,error:t.error,failureCount:r.failureCount+1,failureReason:t.error,isPaused:!1,status:"error"}}};this.state=n(this.state),nn.batch(()=>{V(this,li).forEach(r=>{r.onMutationUpdate(t)}),V(this,In).notify({mutation:this,type:"updated",action:t})})},pI);function Q6(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var L7=(mI=class extends Aa{constructor(t={}){super();Re(this,Wi);Re(this,Hr);Re(this,Vl);this.config=t,me(this,Wi,new Set),me(this,Hr,new Map),me(this,Vl,0)}build(t,n,r){const i=new N7({client:t,mutationCache:this,mutationId:++O0(this,Vl)._,options:t.defaultMutationOptions(n),state:r});return this.add(i),i}add(t){V(this,Wi).add(t);const n=ef(t);if(typeof n=="string"){const r=V(this,Hr).get(n);r?r.push(t):V(this,Hr).set(n,[t])}this.notify({type:"added",mutation:t})}remove(t){if(V(this,Wi).delete(t)){const n=ef(t);if(typeof n=="string"){const r=V(this,Hr).get(n);if(r)if(r.length>1){const i=r.indexOf(t);i!==-1&&r.splice(i,1)}else r[0]===t&&V(this,Hr).delete(n)}}this.notify({type:"removed",mutation:t})}canRun(t){const n=ef(t);if(typeof n=="string"){const r=V(this,Hr).get(n),i=r==null?void 0:r.find(s=>s.state.status==="pending");return!i||i===t}else return!0}runNext(t){var r;const n=ef(t);if(typeof n=="string"){const i=(r=V(this,Hr).get(n))==null?void 0:r.find(s=>s!==t&&s.state.isPaused);return(i==null?void 0:i.continue())??Promise.resolve()}else return Promise.resolve()}clear(){nn.batch(()=>{V(this,Wi).forEach(t=>{this.notify({type:"removed",mutation:t})}),V(this,Wi).clear(),V(this,Hr).clear()})}getAll(){return Array.from(V(this,Wi))}find(t){const n={exact:!0,...t};return this.getAll().find(r=>$6(n,r))}findAll(t={}){return this.getAll().filter(n=>$6(t,n))}notify(t){nn.batch(()=>{this.listeners.forEach(n=>{n(t)})})}resumePausedMutations(){const t=this.getAll().filter(n=>n.state.isPaused);return nn.batch(()=>Promise.all(t.map(n=>n.continue().catch(Bn))))}},Wi=new WeakMap,Hr=new WeakMap,Vl=new WeakMap,mI);function ef(e){var t;return(t=e.options.scope)==null?void 0:t.id}var j7=(gI=class extends Aa{constructor(t,n){super();Re(this,Vi);Re(this,Gi);Re(this,Bs);Re(this,Xn);Re(this,qi);me(this,Gi,t),this.setOptions(n),this.bindMethods(),Le(this,Vi,M0).call(this)}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(t){var r;const n=this.options;this.options=V(this,Gi).defaultMutationOptions(t),Yd(this.options,n)||V(this,Gi).getMutationCache().notify({type:"observerOptionsUpdated",mutation:V(this,Xn),observer:this}),n!=null&&n.mutationKey&&this.options.mutationKey&&so(n.mutationKey)!==so(this.options.mutationKey)?this.reset():((r=V(this,Xn))==null?void 0:r.state.status)==="pending"&&V(this,Xn).setOptions(this.options)}onUnsubscribe(){var t;this.hasListeners()||(t=V(this,Xn))==null||t.removeObserver(this)}onMutationUpdate(t){Le(this,Vi,M0).call(this),Le(this,Vi,fw).call(this,t)}getCurrentResult(){return V(this,Bs)}reset(){var t;(t=V(this,Xn))==null||t.removeObserver(this),me(this,Xn,void 0),Le(this,Vi,M0).call(this),Le(this,Vi,fw).call(this)}mutate(t,n){var r;return me(this,qi,n),(r=V(this,Xn))==null||r.removeObserver(this),me(this,Xn,V(this,Gi).getMutationCache().build(V(this,Gi),this.options)),V(this,Xn).addObserver(this),V(this,Xn).execute(t)}},Gi=new WeakMap,Bs=new WeakMap,Xn=new WeakMap,qi=new WeakMap,Vi=new WeakSet,M0=function(){var n;const t=((n=V(this,Xn))==null?void 0:n.state)??Q6();me(this,Bs,{...t,isPending:t.status==="pending",isSuccess:t.status==="success",isError:t.status==="error",isIdle:t.status==="idle",mutate:this.mutate,reset:this.reset})},fw=function(t){nn.batch(()=>{var n,r,i,s,o,a,c,u;if(V(this,qi)&&this.hasListeners()){const l=V(this,Bs).variables,d=V(this,Bs).context,f={client:V(this,Gi),meta:this.options.meta,mutationKey:this.options.mutationKey};if((t==null?void 0:t.type)==="success"){try{(r=(n=V(this,qi)).onSuccess)==null||r.call(n,t.data,l,d,f)}catch(h){Promise.reject(h)}try{(s=(i=V(this,qi)).onSettled)==null||s.call(i,t.data,null,l,d,f)}catch(h){Promise.reject(h)}}else if((t==null?void 0:t.type)==="error"){try{(a=(o=V(this,qi)).onError)==null||a.call(o,t.error,l,d,f)}catch(h){Promise.reject(h)}try{(u=(c=V(this,qi)).onSettled)==null||u.call(c,void 0,t.error,l,d,f)}catch(h){Promise.reject(h)}}}this.listeners.forEach(l=>{l(V(this,Bs))})})},gI),$7=(yI=class extends Aa{constructor(t={}){super();Re(this,fi);this.config=t,me(this,fi,new Map)}build(t,n,r){const i=n.queryKey,s=n.queryHash??Xm(i,n);let o=this.get(s);return o||(o=new R7({client:t,queryKey:i,queryHash:s,options:t.defaultQueryOptions(n),state:r,defaultOptions:t.getQueryDefaults(i)}),this.add(o)),o}add(t){V(this,fi).has(t.queryHash)||(V(this,fi).set(t.queryHash,t),this.notify({type:"added",query:t}))}remove(t){const n=V(this,fi).get(t.queryHash);n&&(t.destroy(),n===t&&V(this,fi).delete(t.queryHash),this.notify({type:"removed",query:t}))}clear(){nn.batch(()=>{this.getAll().forEach(t=>{this.remove(t)})})}get(t){return V(this,fi).get(t)}getAll(){return[...V(this,fi).values()]}find(t){const n={exact:!0,...t};return this.getAll().find(r=>j6(n,r))}findAll(t={}){const n=this.getAll();return Object.keys(t).length>0?n.filter(r=>j6(t,r)):n}notify(t){nn.batch(()=>{this.listeners.forEach(n=>{n(t)})})}onFocus(){nn.batch(()=>{this.getAll().forEach(t=>{t.onFocus()})})}onOnline(){nn.batch(()=>{this.getAll().forEach(t=>{t.onOnline()})})}},fi=new WeakMap,yI),F7=(bI=class{constructor(e={}){Re(this,$t);Re(this,Ns);Re(this,Ls);Re(this,Bc);Re(this,Nc);Re(this,js);Re(this,Lc);Re(this,jc);me(this,$t,e.queryCache||new $7),me(this,Ns,e.mutationCache||new L7),me(this,Ls,e.defaultOptions||{}),me(this,Bc,new Map),me(this,Nc,new Map),me(this,js,0)}mount(){O0(this,js)._++,V(this,js)===1&&(me(this,Lc,Ym.subscribe(async e=>{e&&(await this.resumePausedMutations(),V(this,$t).onFocus())})),me(this,jc,Xd.subscribe(async e=>{e&&(await this.resumePausedMutations(),V(this,$t).onOnline())})))}unmount(){var e,t;O0(this,js)._--,V(this,js)===0&&((e=V(this,Lc))==null||e.call(this),me(this,Lc,void 0),(t=V(this,jc))==null||t.call(this),me(this,jc,void 0))}isFetching(e){return V(this,$t).findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return V(this,Ns).findAll({...e,status:"pending"}).length}getQueryData(e){var n;const t=this.defaultQueryOptions({queryKey:e});return(n=V(this,$t).get(t.queryHash))==null?void 0:n.state.data}ensureQueryData(e){const t=this.defaultQueryOptions(e),n=V(this,$t).build(this,t),r=n.state.data;return r===void 0?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(hs(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(r))}getQueriesData(e){return V(this,$t).findAll(e).map(({queryKey:t,state:n})=>{const r=n.data;return[t,r]})}setQueryData(e,t,n){const r=this.defaultQueryOptions({queryKey:e}),i=V(this,$t).get(r.queryHash),s=i==null?void 0:i.state.data,o=v7(t,s);if(o!==void 0)return V(this,$t).build(this,r).setData(o,{...n,manual:!0})}setQueriesData(e,t,n){return nn.batch(()=>V(this,$t).findAll(e).map(({queryKey:r})=>[r,this.setQueryData(r,t,n)]))}getQueryState(e){var n;const t=this.defaultQueryOptions({queryKey:e});return(n=V(this,$t).get(t.queryHash))==null?void 0:n.state}removeQueries(e){const t=V(this,$t);nn.batch(()=>{t.findAll(e).forEach(n=>{t.remove(n)})})}resetQueries(e,t){const n=V(this,$t);return nn.batch(()=>(n.findAll(e).forEach(r=>{r.reset()}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e,t={}){const n={revert:!0,...t},r=nn.batch(()=>V(this,$t).findAll(e).map(i=>i.cancel(n)));return Promise.all(r).then(Bn).catch(Bn)}invalidateQueries(e,t={}){return nn.batch(()=>(V(this,$t).findAll(e).forEach(n=>{n.invalidate()}),(e==null?void 0:e.refetchType)==="none"?Promise.resolve():this.refetchQueries({...e,type:(e==null?void 0:e.refetchType)??(e==null?void 0:e.type)??"active"},t)))}refetchQueries(e,t={}){const n={...t,cancelRefetch:t.cancelRefetch??!0},r=nn.batch(()=>V(this,$t).findAll(e).filter(i=>!i.isDisabled()&&!i.isStatic()).map(i=>{let s=i.fetch(void 0,n);return n.throwOnError||(s=s.catch(Bn)),i.state.fetchStatus==="paused"?Promise.resolve():s}));return Promise.all(r).then(Bn)}fetchQuery(e){const t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);const n=V(this,$t).build(this,t);return n.isStaleByTime(hs(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(Bn).catch(Bn)}fetchInfiniteQuery(e){return e.behavior=Z6(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(Bn).catch(Bn)}ensureInfiniteQueryData(e){return e.behavior=Z6(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return Xd.isOnline()?V(this,Ns).resumePausedMutations():Promise.resolve()}getQueryCache(){return V(this,$t)}getMutationCache(){return V(this,Ns)}getDefaultOptions(){return V(this,Ls)}setDefaultOptions(e){me(this,Ls,e)}setQueryDefaults(e,t){V(this,Bc).set(so(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[...V(this,Bc).values()],n={};return t.forEach(r=>{Cu(e,r.queryKey)&&Object.assign(n,r.defaultOptions)}),n}setMutationDefaults(e,t){V(this,Nc).set(so(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[...V(this,Nc).values()],n={};return t.forEach(r=>{Cu(e,r.mutationKey)&&Object.assign(n,r.defaultOptions)}),n}defaultQueryOptions(e){if(e._defaulted)return e;const t={...V(this,Ls).queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=Xm(t.queryKey,t)),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!=="always"),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode="offlineFirst"),t.queryFn===Qd&&(t.enabled=!1),t}defaultMutationOptions(e){return e!=null&&e._defaulted?e:{...V(this,Ls).mutations,...(e==null?void 0:e.mutationKey)&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){V(this,$t).clear(),V(this,Ns).clear()}},$t=new WeakMap,Ns=new WeakMap,Ls=new WeakMap,Bc=new WeakMap,Nc=new WeakMap,js=new WeakMap,Lc=new WeakMap,jc=new WeakMap,bI);function D7(e){return JSON.stringify(e,(t,n)=>U7(n)?Object.keys(n).sort().reduce((r,i)=>(r[i]=n[i],r),{}):typeof n=="bigint"?n.toString():n)}function U7(e){if(!X6(e))return!1;const t=e.constructor;if(typeof t>"u")return!0;const n=t.prototype;return!(!X6(n)||!n.hasOwnProperty("isPrototypeOf"))}function X6(e){return Object.prototype.toString.call(e)==="[object Object]"}function H7(e){const{_defaulted:t,behavior:n,gcTime:r,initialData:i,initialDataUpdatedAt:s,maxPages:o,meta:a,networkMode:c,queryFn:u,queryHash:l,queryKey:d,queryKeyHashFn:f,retry:h,retryDelay:m,structuralSharing:y,getPreviousPageParam:w,getNextPageParam:b,initialPageParam:x,_optimisticResults:v,enabled:S,notifyOnChangeProps:I,placeholderData:N,refetchInterval:j,refetchIntervalInBackground:U,refetchOnMount:L,refetchOnReconnect:Y,refetchOnWindowFocus:Z,retryOnMount:G,select:C,staleTime:p,suspense:g,throwOnError:k,config:R,connector:T,query:M,...$}=e;return $}function z7(e){return{mutationFn(t){return hB(e,t)},mutationKey:["connect"]}}function W7(e){return{mutationFn(t){return SB(e,t)},mutationKey:["disconnect"]}}function G7(e,t={}){return{async queryFn({queryKey:n}){const{address:r,scopeKey:i,...s}=n[1];if(!r)throw new Error("address is required");return await CB(e,{...s,address:r})??null},queryKey:q7(t)}}function q7(e={}){return["balance",H7(e)]}function V7(e){return{mutationFn(t){return RB(e,t)},mutationKey:["sendTransaction"]}}function K7(e){return{mutationFn(t){return OB(e,t)},mutationKey:["switchChain"]}}function J7(e){return{mutationFn(t){return $B(e,t)},mutationKey:["writeContract"]}}var e5=en.createContext(void 0),t5=e=>{const t=en.useContext(e5);if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},Z7=({client:e,children:t})=>(en.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),P.jsx(e5.Provider,{value:e,children:t})),n5=en.createContext(!1),Y7=()=>en.useContext(n5);n5.Provider;function Q7(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var X7=en.createContext(Q7()),eN=()=>en.useContext(X7),tN=(e,t,n)=>{const r=n!=null&&n.state.error&&typeof e.throwOnError=="function"?rg(e.throwOnError,[n.state.error,n]):e.throwOnError;(e.suspense||e.experimental_prefetchInRender||r)&&(t.isReset()||(e.retryOnMount=!1))},nN=e=>{en.useEffect(()=>{e.clearReset()},[e])},rN=({result:e,errorResetBoundary:t,throwOnError:n,query:r,suspense:i})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(i&&e.data===void 0||rg(n,[e.error,r])),iN=e=>{if(e.suspense){const n=i=>i==="static"?i:Math.max(i??1e3,1e3),r=e.staleTime;e.staleTime=typeof r=="function"?(...i)=>n(r(...i)):n(r),typeof e.gcTime=="number"&&(e.gcTime=Math.max(e.gcTime,1e3))}},sN=(e,t)=>e.isLoading&&e.isFetching&&!t,oN=(e,t)=>(e==null?void 0:e.suspense)&&t.isPending,r5=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function aN(e,t,n){var f,h,m,y;if(process.env.NODE_ENV!=="production"&&(typeof e!="object"||Array.isArray(e)))throw new Error('Bad argument type. Starting with v5, only the "Object" form is allowed when calling query related functions. Please use the error stack to find the culprit call. More info here: https://tanstack.com/query/latest/docs/react/guides/migrating-to-v5#supports-a-single-signature-one-object');const r=Y7(),i=eN(),s=t5(),o=s.defaultQueryOptions(e);(h=(f=s.getDefaultOptions().queries)==null?void 0:f._experimental_beforeQuery)==null||h.call(f,o);const a=s.getQueryCache().get(o.queryHash);process.env.NODE_ENV!=="production"&&(o.queryFn||console.error(`[${o.queryHash}]: No queryFn was passed as an option, and no default queryFn was found. The queryFn parameter is only optional when using a default queryFn. More info here: https://tanstack.com/query/latest/docs/framework/react/guides/default-query-function`)),o._optimisticResults=r?"isRestoring":"optimistic",iN(o),tN(o,i,a),nN(i);const c=!s.getQueryCache().get(o.queryHash),[u]=en.useState(()=>new t(s,o)),l=u.getOptimisticResult(o),d=!r&&e.subscribed!==!1;if(en.useSyncExternalStore(en.useCallback(w=>{const b=d?u.subscribe(nn.batchCalls(w)):Bn;return u.updateResult(),b},[u,d]),()=>u.getCurrentResult(),()=>u.getCurrentResult()),en.useEffect(()=>{u.setOptions(o)},[o,u]),oN(o,l))throw r5(o,u,i);if(rN({result:l,errorResetBoundary:i,throwOnError:o.throwOnError,query:a,suspense:o.suspense}))throw l.error;if((y=(m=s.getDefaultOptions().queries)==null?void 0:m._experimental_afterQuery)==null||y.call(m,o,l),o.experimental_prefetchInRender&&!Pu.isServer()&&sN(l,r)){const w=c?r5(o,u,i):a==null?void 0:a.promise;w==null||w.catch(Bn).finally(()=>{u.updateResult()})}return o.notifyOnChangeProps?l:u.trackResult(l)}function cN(e,t){return aN(e,T7)}function Ru(e,t){const n=t5(),[r]=en.useState(()=>new j7(n,e));en.useEffect(()=>{r.setOptions(e)},[r,e]);const i=en.useSyncExternalStore(en.useCallback(o=>r.subscribe(nn.batchCalls(o)),[r]),()=>r.getCurrentResult(),()=>r.getCurrentResult()),s=en.useCallback((o,a)=>{r.mutate(o,a).catch(Bn)},[r]);if(i.error&&rg(r.options.throwOnError,[i.error]))throw i.error;return{...i,mutate:s,mutateAsync:i.mutate}}function uN(e){const t=cN({...e,queryKeyHashFn:D7});return t.queryKey=e.queryKey,t}function lN(e={}){const t=Or(e);return ce.useSyncExternalStore(n=>NB(t,{onChange:n}),()=>v6(t),()=>v6(t))}function cg(e={}){const{address:t,query:n={}}=e,r=Or(e),i=lN({config:r}),s=G7(r,{...e,chainId:e.chainId??i}),o=!!(t&&(n.enabled??!0));return uN({...n,...s,enabled:o})}function dN(e={}){const t=Or(e);return ce.useSyncExternalStore(n=>c7(t,{onChange:n}),()=>_6(t),()=>_6(t))}function fN(e={}){const t=Or(e);return ce.useSyncExternalStore(n=>jB(t,{onChange:n}),()=>E6(t),()=>E6(t))}function hN(e={}){const{mutation:t}=e,n=Or(e),r=z7(n),{mutate:i,mutateAsync:s,...o}=Ru({...t,...r});return ce.useEffect(()=>n.subscribe(({status:a})=>a,(a,c)=>{c==="connected"&&a==="disconnected"&&o.reset()}),[n,o.reset]),{...o,connect:i,connectAsync:s,connectors:fN({config:n})}}function pN(e={}){const t=Or(e);return ce.useSyncExternalStore(n=>LB(t,{onChange:n}),()=>Fm(t),()=>Fm(t))}function mN(e={}){const{mutation:t}=e,n=Or(e),r=W7(n),{mutate:i,mutateAsync:s,...o}=Ru({...t,...r});return{...o,connectors:pN({config:n}).map(a=>a.connector),disconnect:i,disconnectAsync:s}}function gN(e={}){const{mutation:t}=e,n=Or(e),r=V7(n),{mutate:i,mutateAsync:s,...o}=Ru({...t,...r});return{...o,sendTransaction:i,sendTransactionAsync:s}}function yN(e={}){const{mutation:t}=e,n=Or(e),r=K7(n),{mutate:i,mutateAsync:s,...o}=Ru({...t,...r});return{...o,chains:dN({config:n}),switchChain:i,switchChainAsync:s}}function bN(e={}){const{mutation:t}=e,n=Or(e),r=J7(n),{mutate:i,mutateAsync:s,...o}=Ru({...t,...r});return{...o,writeContract:i,writeContractAsync:s}}tf.type="coinbaseWallet";function tf(e={}){return e.version==="3"||e.headlessMode?vN(e):wN(e)}function wN(e){let t,n,r,i;return s=>({id:"coinbaseWalletSDK",name:"Coinbase Wallet",rdns:"com.coinbase.wallet",type:tf.type,async connect({chainId:o,withCapabilities:a,...c}={}){try{const u=await this.getProvider(),l=(await u.request({method:"eth_requestAccounts",params:"instantOnboarding"in c&&c.instantOnboarding?[{onboarding:"instant"}]:[]})).map(f=>mn(f));n||(n=this.onAccountsChanged.bind(this),u.on("accountsChanged",n)),r||(r=this.onChainChanged.bind(this),u.on("chainChanged",r)),i||(i=this.onDisconnect.bind(this),u.on("disconnect",i));let d=await this.getChainId();if(o&&d!==o){const f=await this.switchChain({chainId:o}).catch(h=>{if(h.code===zt.code)throw h;return{id:d}});d=(f==null?void 0:f.id)??d}return{accounts:a?l.map(f=>({address:f,capabilities:{}})):l,chainId:d}}catch(u){throw/(user closed modal|accounts received is empty|user denied account|request rejected)/i.test(u.message)?new zt(u):u}},async disconnect(){var a;const o=await this.getProvider();n&&(o.removeListener("accountsChanged",n),n=void 0),r&&(o.removeListener("chainChanged",r),r=void 0),i&&(o.removeListener("disconnect",i),i=void 0),o.disconnect(),(a=o.close)==null||a.call(o)},async getAccounts(){return(await(await this.getProvider()).request({method:"eth_accounts"})).map(a=>mn(a))},async getChainId(){const a=await(await this.getProvider()).request({method:"eth_chainId"});return Number(a)},async getProvider(){if(!t){const o=(()=>{var u;return typeof e.preference=="string"?{options:e.preference}:{...e.preference,options:((u=e.preference)==null?void 0:u.options)??"all"}})(),{createCoinbaseWalletSDK:a}=await Promise.resolve().then(()=>OH);t=a({...e,appChainIds:s.chains.map(u=>u.id),preference:o}).getProvider()}return t},async isAuthorized(){try{return!!(await this.getAccounts()).length}catch{return!1}},async switchChain({addEthereumChainParameter:o,chainId:a}){var l,d,f,h;const c=s.chains.find(m=>m.id===a);if(!c)throw new Ar(new Sa);const u=await this.getProvider();try{return await u.request({method:"wallet_switchEthereumChain",params:[{chainId:oe(c.id)}]}),c}catch(m){if(m.code===4902)try{let y;o!=null&&o.blockExplorerUrls?y=o.blockExplorerUrls:y=(l=c.blockExplorers)!=null&&l.default.url?[(d=c.blockExplorers)==null?void 0:d.default.url]:[];let w;(f=o==null?void 0:o.rpcUrls)!=null&&f.length?w=o.rpcUrls:w=[((h=c.rpcUrls.default)==null?void 0:h.http[0])??""];const b={blockExplorerUrls:y,chainId:oe(a),chainName:(o==null?void 0:o.chainName)??c.name,iconUrls:o==null?void 0:o.iconUrls,nativeCurrency:(o==null?void 0:o.nativeCurrency)??c.nativeCurrency,rpcUrls:w};return await u.request({method:"wallet_addEthereumChain",params:[b]}),c}catch(y){throw new zt(y)}throw new Ar(m)}},onAccountsChanged(o){o.length===0?this.onDisconnect():s.emitter.emit("change",{accounts:o.map(a=>mn(a))})},onChainChanged(o){const a=Number(o);s.emitter.emit("change",{chainId:a})},async onDisconnect(o){s.emitter.emit("disconnect");const a=await this.getProvider();n&&(a.removeListener("accountsChanged",n),n=void 0),r&&(a.removeListener("chainChanged",r),r=void 0),i&&(a.removeListener("disconnect",i),i=void 0)}})}function vN(e){let n,r,i,s,o;return a=>({id:"coinbaseWalletSDK",name:"Coinbase Wallet",rdns:"com.coinbase.wallet",type:tf.type,async connect({chainId:c,withCapabilities:u}={}){try{const l=await this.getProvider(),d=(await l.request({method:"eth_requestAccounts"})).map(h=>mn(h));i||(i=this.onAccountsChanged.bind(this),l.on("accountsChanged",i)),s||(s=this.onChainChanged.bind(this),l.on("chainChanged",s)),o||(o=this.onDisconnect.bind(this),l.on("disconnect",o));let f=await this.getChainId();if(c&&f!==c){const h=await this.switchChain({chainId:c}).catch(m=>{if(m.code===zt.code)throw m;return{id:f}});f=(h==null?void 0:h.id)??f}return{accounts:u?d.map(h=>({address:h,capabilities:{}})):d,chainId:f}}catch(l){throw/(user closed modal|accounts received is empty|user denied account)/i.test(l.message)?new zt(l):l}},async disconnect(){const c=await this.getProvider();i&&(c.removeListener("accountsChanged",i),i=void 0),s&&(c.removeListener("chainChanged",s),s=void 0),o&&(c.removeListener("disconnect",o),o=void 0),c.disconnect(),c.close()},async getAccounts(){return(await(await this.getProvider()).request({method:"eth_accounts"})).map(u=>mn(u))},async getChainId(){const u=await(await this.getProvider()).request({method:"eth_chainId"});return Number(u)},async getProvider(){var c;if(!r){const u=await(async()=>{const{default:m}=await Promise.resolve().then(()=>uQ);return typeof m!="function"&&typeof m.default=="function"?m.default:m})();n=new u({...e,reloadOnDisconnect:!1});const l=(c=n.walletExtension)==null?void 0:c.getChainId(),d=a.chains.find(m=>e.chainId?m.id===e.chainId:m.id===l)||a.chains[0],f=e.chainId||(d==null?void 0:d.id),h=e.jsonRpcUrl||(d==null?void 0:d.rpcUrls.default.http[0]);r=n.makeWeb3Provider(h,f)}return r},async isAuthorized(){try{return!!(await this.getAccounts()).length}catch{return!1}},async switchChain({addEthereumChainParameter:c,chainId:u}){var f,h,m,y;const l=a.chains.find(w=>w.id===u);if(!l)throw new Ar(new Sa);const d=await this.getProvider();try{return await d.request({method:"wallet_switchEthereumChain",params:[{chainId:oe(l.id)}]}),l}catch(w){if(w.code===4902)try{let b;c!=null&&c.blockExplorerUrls?b=c.blockExplorerUrls:b=(f=l.blockExplorers)!=null&&f.default.url?[(h=l.blockExplorers)==null?void 0:h.default.url]:[];let x;(m=c==null?void 0:c.rpcUrls)!=null&&m.length?x=c.rpcUrls:x=[((y=l.rpcUrls.default)==null?void 0:y.http[0])??""];const v={blockExplorerUrls:b,chainId:oe(u),chainName:(c==null?void 0:c.chainName)??l.name,iconUrls:c==null?void 0:c.iconUrls,nativeCurrency:(c==null?void 0:c.nativeCurrency)??l.nativeCurrency,rpcUrls:x};return await d.request({method:"wallet_addEthereumChain",params:[v]}),l}catch(b){throw new zt(b)}throw new Ar(w)}},onAccountsChanged(c){c.length===0?this.onDisconnect():a.emitter.emit("change",{accounts:c.map(u=>mn(u))})},onChainChanged(c){const u=Number(c);a.emitter.emit("change",{chainId:u})},async onDisconnect(c){a.emitter.emit("disconnect");const u=await this.getProvider();i&&(u.removeListener("accountsChanged",i),i=void 0),s&&(u.removeListener("chainChanged",s),s=void 0),o&&(u.removeListener("disconnect",o),o=void 0)}})}var ug={exports:{}},lg,i5;function _N(){if(i5)return lg;i5=1;var e=1e3,t=e*60,n=t*60,r=n*24,i=r*7,s=r*365.25;lg=function(l,d){d=d||{};var f=typeof l;if(f==="string"&&l.length>0)return o(l);if(f==="number"&&isFinite(l))return d.long?c(l):a(l);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(l))};function o(l){if(l=String(l),!(l.length>100)){var d=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(l);if(d){var f=parseFloat(d[1]),h=(d[2]||"ms").toLowerCase();switch(h){case"years":case"year":case"yrs":case"yr":case"y":return f*s;case"weeks":case"week":case"w":return f*i;case"days":case"day":case"d":return f*r;case"hours":case"hour":case"hrs":case"hr":case"h":return f*n;case"minutes":case"minute":case"mins":case"min":case"m":return f*t;case"seconds":case"second":case"secs":case"sec":case"s":return f*e;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return f;default:return}}}}function a(l){var d=Math.abs(l);return d>=r?Math.round(l/r)+"d":d>=n?Math.round(l/n)+"h":d>=t?Math.round(l/t)+"m":d>=e?Math.round(l/e)+"s":l+"ms"}function c(l){var d=Math.abs(l);return d>=r?u(l,d,r,"day"):d>=n?u(l,d,n,"hour"):d>=t?u(l,d,t,"minute"):d>=e?u(l,d,e,"second"):l+" ms"}function u(l,d,f,h){var m=d>=f*1.5;return Math.round(l/f)+" "+h+(m?"s":"")}return lg}function EN(e){n.debug=n,n.default=n,n.coerce=c,n.disable=o,n.enable=i,n.enabled=a,n.humanize=_N(),n.destroy=u,Object.keys(e).forEach(l=>{n[l]=e[l]}),n.names=[],n.skips=[],n.formatters={};function t(l){let d=0;for(let f=0;f<l.length;f++)d=(d<<5)-d+l.charCodeAt(f),d|=0;return n.colors[Math.abs(d)%n.colors.length]}n.selectColor=t;function n(l){let d,f=null,h,m;function y(...w){if(!y.enabled)return;const b=y,x=Number(new Date),v=x-(d||x);b.diff=v,b.prev=d,b.curr=x,d=x,w[0]=n.coerce(w[0]),typeof w[0]!="string"&&w.unshift("%O");let S=0;w[0]=w[0].replace(/%([a-zA-Z%])/g,(N,j)=>{if(N==="%%")return"%";S++;const U=n.formatters[j];if(typeof U=="function"){const L=w[S];N=U.call(b,L),w.splice(S,1),S--}return N}),n.formatArgs.call(b,w),(b.log||n.log).apply(b,w)}return y.namespace=l,y.useColors=n.useColors(),y.color=n.selectColor(l),y.extend=r,y.destroy=n.destroy,Object.defineProperty(y,"enabled",{enumerable:!0,configurable:!1,get:()=>f!==null?f:(h!==n.namespaces&&(h=n.namespaces,m=n.enabled(l)),m),set:w=>{f=w}}),typeof n.init=="function"&&n.init(y),y}function r(l,d){const f=n(this.namespace+(typeof d>"u"?":":d)+l);return f.log=this.log,f}function i(l){n.save(l),n.namespaces=l,n.names=[],n.skips=[];const d=(typeof l=="string"?l:"").trim().replace(/\s+/g,",").split(",").filter(Boolean);for(const f of d)f[0]==="-"?n.skips.push(f.slice(1)):n.names.push(f)}function s(l,d){let f=0,h=0,m=-1,y=0;for(;f<l.length;)if(h<d.length&&(d[h]===l[f]||d[h]==="*"))d[h]==="*"?(m=h,y=f,h++):(f++,h++);else if(m!==-1)h=m+1,y++,f=y;else return!1;for(;h<d.length&&d[h]==="*";)h++;return h===d.length}function o(){const l=[...n.names,...n.skips.map(d=>"-"+d)].join(",");return n.enable(""),l}function a(l){for(const d of n.skips)if(s(l,d))return!1;for(const d of n.names)if(s(l,d))return!0;return!1}function c(l){return l instanceof Error?l.stack||l.message:l}function u(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}return n.enable(n.load()),n}var xN=EN;(function(e,t){t.formatArgs=r,t.save=i,t.load=s,t.useColors=n,t.storage=o(),t.destroy=(()=>{let c=!1;return()=>{c||(c=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})(),t.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"];function n(){if(typeof window<"u"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs))return!0;if(typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;let c;return typeof document<"u"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window<"u"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator<"u"&&navigator.userAgent&&(c=navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/))&&parseInt(c[1],10)>=31||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function r(c){if(c[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+c[0]+(this.useColors?"%c ":" ")+"+"+e.exports.humanize(this.diff),!this.useColors)return;const u="color: "+this.color;c.splice(1,0,u,"color: inherit");let l=0,d=0;c[0].replace(/%[a-zA-Z%]/g,f=>{f!=="%%"&&(l++,f==="%c"&&(d=l))}),c.splice(d,0,u)}t.log=console.debug||console.log||(()=>{});function i(c){try{c?t.storage.setItem("debug",c):t.storage.removeItem("debug")}catch{}}function s(){let c;try{c=t.storage.getItem("debug")||t.storage.getItem("DEBUG")}catch{}return!c&&typeof process<"u"&&"env"in process&&(c=process.env.DEBUG),c}function o(){try{return localStorage}catch{}}e.exports=xN(t);const{formatters:a}=e.exports;a.j=function(c){try{return JSON.stringify(c)}catch(u){return"[UnexpectedJSONParseError]: "+u.message}}})(ug,ug.exports);var SN=ug.exports,dg={exports:{}};const kN="2.0.0",s5=256,AN=Number.MAX_SAFE_INTEGER||9007199254740991,IN=16,CN=s5-6;var nf={MAX_LENGTH:s5,MAX_SAFE_COMPONENT_LENGTH:IN,MAX_SAFE_BUILD_LENGTH:CN,MAX_SAFE_INTEGER:AN,RELEASE_TYPES:["major","premajor","minor","preminor","patch","prepatch","prerelease"],SEMVER_SPEC_VERSION:kN,FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2},rf=typeof process=="object"&&process.env&&process.env.NODE_DEBUG&&/\bsemver\b/i.test(process.env.NODE_DEBUG)?(...e)=>console.error("SEMVER",...e):()=>{};(function(e,t){const{MAX_SAFE_COMPONENT_LENGTH:n,MAX_SAFE_BUILD_LENGTH:r,MAX_LENGTH:i}=nf,s=rf;t=e.exports={};const o=t.re=[],a=t.safeRe=[],c=t.src=[],u=t.safeSrc=[],l=t.t={};let d=0;const f="[a-zA-Z0-9-]",h=[["\\s",1],["\\d",i],[f,r]],m=w=>{for(const[b,x]of h)w=w.split(`${b}*`).join(`${b}{0,${x}}`).split(`${b}+`).join(`${b}{1,${x}}`);return w},y=(w,b,x)=>{const v=m(b),S=d++;s(w,S,b),l[w]=S,c[S]=b,u[S]=v,o[S]=new RegExp(b,x?"g":void 0),a[S]=new RegExp(v,x?"g":void 0)};y("NUMERICIDENTIFIER","0|[1-9]\\d*"),y("NUMERICIDENTIFIERLOOSE","\\d+"),y("NONNUMERICIDENTIFIER",`\\d*[a-zA-Z-]${f}*`),y("MAINVERSION",`(${c[l.NUMERICIDENTIFIER]})\\.(${c[l.NUMERICIDENTIFIER]})\\.(${c[l.NUMERICIDENTIFIER]})`),y("MAINVERSIONLOOSE",`(${c[l.NUMERICIDENTIFIERLOOSE]})\\.(${c[l.NUMERICIDENTIFIERLOOSE]})\\.(${c[l.NUMERICIDENTIFIERLOOSE]})`),y("PRERELEASEIDENTIFIER",`(?:${c[l.NONNUMERICIDENTIFIER]}|${c[l.NUMERICIDENTIFIER]})`),y("PRERELEASEIDENTIFIERLOOSE",`(?:${c[l.NONNUMERICIDENTIFIER]}|${c[l.NUMERICIDENTIFIERLOOSE]})`),y("PRERELEASE",`(?:-(${c[l.PRERELEASEIDENTIFIER]}(?:\\.${c[l.PRERELEASEIDENTIFIER]})*))`),y("PRERELEASELOOSE",`(?:-?(${c[l.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${c[l.PRERELEASEIDENTIFIERLOOSE]})*))`),y("BUILDIDENTIFIER",`${f}+`),y("BUILD",`(?:\\+(${c[l.BUILDIDENTIFIER]}(?:\\.${c[l.BUILDIDENTIFIER]})*))`),y("FULLPLAIN",`v?${c[l.MAINVERSION]}${c[l.PRERELEASE]}?${c[l.BUILD]}?`),y("FULL",`^${c[l.FULLPLAIN]}$`),y("LOOSEPLAIN",`[v=\\s]*${c[l.MAINVERSIONLOOSE]}${c[l.PRERELEASELOOSE]}?${c[l.BUILD]}?`),y("LOOSE",`^${c[l.LOOSEPLAIN]}$`),y("GTLT","((?:<|>)?=?)"),y("XRANGEIDENTIFIERLOOSE",`${c[l.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`),y("XRANGEIDENTIFIER",`${c[l.NUMERICIDENTIFIER]}|x|X|\\*`),y("XRANGEPLAIN",`[v=\\s]*(${c[l.XRANGEIDENTIFIER]})(?:\\.(${c[l.XRANGEIDENTIFIER]})(?:\\.(${c[l.XRANGEIDENTIFIER]})(?:${c[l.PRERELEASE]})?${c[l.BUILD]}?)?)?`),y("XRANGEPLAINLOOSE",`[v=\\s]*(${c[l.XRANGEIDENTIFIERLOOSE]})(?:\\.(${c[l.XRANGEIDENTIFIERLOOSE]})(?:\\.(${c[l.XRANGEIDENTIFIERLOOSE]})(?:${c[l.PRERELEASELOOSE]})?${c[l.BUILD]}?)?)?`),y("XRANGE",`^${c[l.GTLT]}\\s*${c[l.XRANGEPLAIN]}$`),y("XRANGELOOSE",`^${c[l.GTLT]}\\s*${c[l.XRANGEPLAINLOOSE]}$`),y("COERCEPLAIN",`(^|[^\\d])(\\d{1,${n}})(?:\\.(\\d{1,${n}}))?(?:\\.(\\d{1,${n}}))?`),y("COERCE",`${c[l.COERCEPLAIN]}(?:$|[^\\d])`),y("COERCEFULL",c[l.COERCEPLAIN]+`(?:${c[l.PRERELEASE]})?(?:${c[l.BUILD]})?(?:$|[^\\d])`),y("COERCERTL",c[l.COERCE],!0),y("COERCERTLFULL",c[l.COERCEFULL],!0),y("LONETILDE","(?:~>?)"),y("TILDETRIM",`(\\s*)${c[l.LONETILDE]}\\s+`,!0),t.tildeTrimReplace="$1~",y("TILDE",`^${c[l.LONETILDE]}${c[l.XRANGEPLAIN]}$`),y("TILDELOOSE",`^${c[l.LONETILDE]}${c[l.XRANGEPLAINLOOSE]}$`),y("LONECARET","(?:\\^)"),y("CARETTRIM",`(\\s*)${c[l.LONECARET]}\\s+`,!0),t.caretTrimReplace="$1^",y("CARET",`^${c[l.LONECARET]}${c[l.XRANGEPLAIN]}$`),y("CARETLOOSE",`^${c[l.LONECARET]}${c[l.XRANGEPLAINLOOSE]}$`),y("COMPARATORLOOSE",`^${c[l.GTLT]}\\s*(${c[l.LOOSEPLAIN]})$|^$`),y("COMPARATOR",`^${c[l.GTLT]}\\s*(${c[l.FULLPLAIN]})$|^$`),y("COMPARATORTRIM",`(\\s*)${c[l.GTLT]}\\s*(${c[l.LOOSEPLAIN]}|${c[l.XRANGEPLAIN]})`,!0),t.comparatorTrimReplace="$1$2$3",y("HYPHENRANGE",`^\\s*(${c[l.XRANGEPLAIN]})\\s+-\\s+(${c[l.XRANGEPLAIN]})\\s*$`),y("HYPHENRANGELOOSE",`^\\s*(${c[l.XRANGEPLAINLOOSE]})\\s+-\\s+(${c[l.XRANGEPLAINLOOSE]})\\s*$`),y("STAR","(<|>)?=?\\s*\\*"),y("GTE0","^\\s*>=\\s*0\\.0\\.0\\s*$"),y("GTE0PRE","^\\s*>=\\s*0\\.0\\.0-0\\s*$")})(dg,dg.exports);var Tu=dg.exports;const PN=Object.freeze({loose:!0}),RN=Object.freeze({});var fg=e=>e?typeof e!="object"?PN:e:RN;const o5=/^[0-9]+$/,a5=(e,t)=>{if(typeof e=="number"&&typeof t=="number")return e===t?0:e<t?-1:1;const n=o5.test(e),r=o5.test(t);return n&&r&&(e=+e,t=+t),e===t?0:n&&!r?-1:r&&!n?1:e<t?-1:1};var c5={compareIdentifiers:a5,rcompareIdentifiers:(e,t)=>a5(t,e)};const sf=rf,{MAX_LENGTH:u5,MAX_SAFE_INTEGER:of}=nf,{safeRe:af,t:cf}=Tu,TN=fg,{compareIdentifiers:hg}=c5;var Ou=class pi{constructor(t,n){if(n=TN(n),t instanceof pi){if(t.loose===!!n.loose&&t.includePrerelease===!!n.includePrerelease)return t;t=t.version}else if(typeof t!="string")throw new TypeError(`Invalid version. Must be a string. Got type "${typeof t}".`);if(t.length>u5)throw new TypeError(`version is longer than ${u5} characters`);sf("SemVer",t,n),this.options=n,this.loose=!!n.loose,this.includePrerelease=!!n.includePrerelease;const r=t.trim().match(n.loose?af[cf.LOOSE]:af[cf.FULL]);if(!r)throw new TypeError(`Invalid Version: ${t}`);if(this.raw=t,this.major=+r[1],this.minor=+r[2],this.patch=+r[3],this.major>of||this.major<0)throw new TypeError("Invalid major version");if(this.minor>of||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>of||this.patch<0)throw new TypeError("Invalid patch version");r[4]?this.prerelease=r[4].split(".").map(i=>{if(/^[0-9]+$/.test(i)){const s=+i;if(s>=0&&s<of)return s}return i}):this.prerelease=[],this.build=r[5]?r[5].split("."):[],this.format()}format(){return this.version=`${this.major}.${this.minor}.${this.patch}`,this.prerelease.length&&(this.version+=`-${this.prerelease.join(".")}`),this.version}toString(){return this.version}compare(t){if(sf("SemVer.compare",this.version,this.options,t),!(t instanceof pi)){if(typeof t=="string"&&t===this.version)return 0;t=new pi(t,this.options)}return t.version===this.version?0:this.compareMain(t)||this.comparePre(t)}compareMain(t){return t instanceof pi||(t=new pi(t,this.options)),this.major<t.major?-1:this.major>t.major?1:this.minor<t.minor?-1:this.minor>t.minor?1:this.patch<t.patch?-1:this.patch>t.patch?1:0}comparePre(t){if(t instanceof pi||(t=new pi(t,this.options)),this.prerelease.length&&!t.prerelease.length)return-1;if(!this.prerelease.length&&t.prerelease.length)return 1;if(!this.prerelease.length&&!t.prerelease.length)return 0;let n=0;do{const r=this.prerelease[n],i=t.prerelease[n];if(sf("prerelease compare",n,r,i),r===void 0&&i===void 0)return 0;if(i===void 0)return 1;if(r===void 0)return-1;if(r===i)continue;return hg(r,i)}while(++n)}compareBuild(t){t instanceof pi||(t=new pi(t,this.options));let n=0;do{const r=this.build[n],i=t.build[n];if(sf("build compare",n,r,i),r===void 0&&i===void 0)return 0;if(i===void 0)return 1;if(r===void 0)return-1;if(r===i)continue;return hg(r,i)}while(++n)}inc(t,n,r){if(t.startsWith("pre")){if(!n&&r===!1)throw new Error("invalid increment argument: identifier is empty");if(n){const i=`-${n}`.match(this.options.loose?af[cf.PRERELEASELOOSE]:af[cf.PRERELEASE]);if(!i||i[1]!==n)throw new Error(`invalid identifier: ${n}`)}}switch(t){case"premajor":this.prerelease.length=0,this.patch=0,this.minor=0,this.major++,this.inc("pre",n,r);break;case"preminor":this.prerelease.length=0,this.patch=0,this.minor++,this.inc("pre",n,r);break;case"prepatch":this.prerelease.length=0,this.inc("patch",n,r),this.inc("pre",n,r);break;case"prerelease":this.prerelease.length===0&&this.inc("patch",n,r),this.inc("pre",n,r);break;case"release":if(this.prerelease.length===0)throw new Error(`version ${this.raw} is not a prerelease`);this.prerelease.length=0;break;case"major":(this.minor!==0||this.patch!==0||this.prerelease.length===0)&&this.major++,this.minor=0,this.patch=0,this.prerelease=[];break;case"minor":(this.patch!==0||this.prerelease.length===0)&&this.minor++,this.patch=0,this.prerelease=[];break;case"patch":this.prerelease.length===0&&this.patch++,this.prerelease=[];break;case"pre":{const i=Number(r)?1:0;if(this.prerelease.length===0)this.prerelease=[i];else{let s=this.prerelease.length;for(;--s>=0;)typeof this.prerelease[s]=="number"&&(this.prerelease[s]++,s=-2);if(s===-1){if(n===this.prerelease.join(".")&&r===!1)throw new Error("invalid increment argument: identifier already exists");this.prerelease.push(i)}}if(n){let s=[n,i];r===!1&&(s=[n]),hg(this.prerelease[0],n)===0?isNaN(this.prerelease[1])&&(this.prerelease=s):this.prerelease=s}break}default:throw new Error(`invalid increment argument: ${t}`)}return this.raw=this.format(),this.build.length&&(this.raw+=`+${this.build.join(".")}`),this}};const l5=Ou;var ON=(e,t,n=!1)=>{if(e instanceof l5)return e;try{return new l5(e,t)}catch(r){if(!n)return null;throw r}};const MN=ON;var BN=(e,t)=>{const n=MN(e,t);return n?n.version:null};const d5=Ou;var Ia=(e,t,n)=>new d5(e,n).compare(new d5(t,n));const NN=Ia;var pg=(e,t,n)=>NN(e,t,n)>0;const LN=Ia;var f5=(e,t,n)=>LN(e,t,n)<0;const jN=Ia;var $N=(e,t,n)=>jN(e,t,n)===0;const FN=Ia;var DN=(e,t,n)=>FN(e,t,n)!==0;const UN=Ia;var h5=(e,t,n)=>UN(e,t,n)>=0;const HN=Ia;var p5=(e,t,n)=>HN(e,t,n)<=0;const zN=$N,WN=DN,GN=pg,qN=h5,VN=f5,KN=p5;var JN=(e,t,n,r)=>{switch(t){case"===":return typeof e=="object"&&(e=e.version),typeof n=="object"&&(n=n.version),e===n;case"!==":return typeof e=="object"&&(e=e.version),typeof n=="object"&&(n=n.version),e!==n;case"":case"=":case"==":return zN(e,n,r);case"!=":return WN(e,n,r);case">":return GN(e,n,r);case">=":return qN(e,n,r);case"<":return VN(e,n,r);case"<=":return KN(e,n,r);default:throw new TypeError(`Invalid operator: ${t}`)}};const{safeRe:RQ,t:TQ}=Tu;class ZN{constructor(){this.max=1e3,this.map=new Map}get(t){const n=this.map.get(t);if(n!==void 0)return this.map.delete(t),this.map.set(t,n),n}delete(t){return this.map.delete(t)}set(t,n){if(!this.delete(t)&&n!==void 0){if(this.map.size>=this.max){const i=this.map.keys().next().value;this.delete(i)}this.map.set(t,n)}return this}}var YN=ZN,mg,m5;function Mr(){if(m5)return mg;m5=1;const e=/\s+/g;class t{constructor(g,k){if(k=i(k),g instanceof t)return g.loose===!!k.loose&&g.includePrerelease===!!k.includePrerelease?g:new t(g.raw,k);if(g instanceof s)return this.raw=g.value,this.set=[[g]],this.formatted=void 0,this;if(this.options=k,this.loose=!!k.loose,this.includePrerelease=!!k.includePrerelease,this.raw=g.trim().replace(e," "),this.set=this.raw.split("||").map(R=>this.parseRange(R.trim())).filter(R=>R.length),!this.set.length)throw new TypeError(`Invalid SemVer Range: ${this.raw}`);if(this.set.length>1){const R=this.set[0];if(this.set=this.set.filter(T=>!y(T[0])),this.set.length===0)this.set=[R];else if(this.set.length>1){for(const T of this.set)if(T.length===1&&w(T[0])){this.set=[T];break}}}this.formatted=void 0}get range(){if(this.formatted===void 0){this.formatted="";for(let g=0;g<this.set.length;g++){g>0&&(this.formatted+="||");const k=this.set[g];for(let R=0;R<k.length;R++)R>0&&(this.formatted+=" "),this.formatted+=k[R].toString().trim()}}return this.formatted}format(){return this.range}toString(){return this.range}parseRange(g){const R=((this.options.includePrerelease&&h)|(this.options.loose&&m))+":"+g,T=r.get(R);if(T)return T;const M=this.options.loose,$=M?c[u.HYPHENRANGELOOSE]:c[u.HYPHENRANGE];g=g.replace($,G(this.options.includePrerelease)),o("hyphen replace",g),g=g.replace(c[u.COMPARATORTRIM],l),o("comparator trim",g),g=g.replace(c[u.TILDETRIM],d),o("tilde trim",g),g=g.replace(c[u.CARETTRIM],f),o("caret trim",g);let O=g.split(" ").map(ne=>x(ne,this.options)).join(" ").split(/\s+/).map(ne=>Z(ne,this.options));M&&(O=O.filter(ne=>(o("loose invalid filter",ne,this.options),!!ne.match(c[u.COMPARATORLOOSE])))),o("range list",O);const _=new Map,F=O.map(ne=>new s(ne,this.options));for(const ne of F){if(y(ne))return[ne];_.set(ne.value,ne)}_.size>1&&_.has("")&&_.delete("");const ue=[..._.values()];return r.set(R,ue),ue}intersects(g,k){if(!(g instanceof t))throw new TypeError("a Range is required");return this.set.some(R=>b(R,k)&&g.set.some(T=>b(T,k)&&R.every(M=>T.every($=>M.intersects($,k)))))}test(g){if(!g)return!1;if(typeof g=="string")try{g=new a(g,this.options)}catch{return!1}for(let k=0;k<this.set.length;k++)if(C(this.set[k],g,this.options))return!0;return!1}}mg=t;const n=YN,r=new n,i=fg,s=uf(),o=rf,a=Ou,{safeRe:c,t:u,comparatorTrimReplace:l,tildeTrimReplace:d,caretTrimReplace:f}=Tu,{FLAG_INCLUDE_PRERELEASE:h,FLAG_LOOSE:m}=nf,y=p=>p.value==="<0.0.0-0",w=p=>p.value==="",b=(p,g)=>{let k=!0;const R=p.slice();let T=R.pop();for(;k&&R.length;)k=R.every(M=>T.intersects(M,g)),T=R.pop();return k},x=(p,g)=>(p=p.replace(c[u.BUILD],""),o("comp",p,g),p=N(p,g),o("caret",p),p=S(p,g),o("tildes",p),p=U(p,g),o("xrange",p),p=Y(p,g),o("stars",p),p),v=p=>!p||p.toLowerCase()==="x"||p==="*",S=(p,g)=>p.trim().split(/\s+/).map(k=>I(k,g)).join(" "),I=(p,g)=>{const k=g.loose?c[u.TILDELOOSE]:c[u.TILDE];return p.replace(k,(R,T,M,$,O)=>{o("tilde",p,R,T,M,$,O);let _;return v(T)?_="":v(M)?_=`>=${T}.0.0 <${+T+1}.0.0-0`:v($)?_=`>=${T}.${M}.0 <${T}.${+M+1}.0-0`:O?(o("replaceTilde pr",O),_=`>=${T}.${M}.${$}-${O} <${T}.${+M+1}.0-0`):_=`>=${T}.${M}.${$} <${T}.${+M+1}.0-0`,o("tilde return",_),_})},N=(p,g)=>p.trim().split(/\s+/).map(k=>j(k,g)).join(" "),j=(p,g)=>{o("caret",p,g);const k=g.loose?c[u.CARETLOOSE]:c[u.CARET],R=g.includePrerelease?"-0":"";return p.replace(k,(T,M,$,O,_)=>{o("caret",p,T,M,$,O,_);let F;return v(M)?F="":v($)?F=`>=${M}.0.0${R} <${+M+1}.0.0-0`:v(O)?M==="0"?F=`>=${M}.${$}.0${R} <${M}.${+$+1}.0-0`:F=`>=${M}.${$}.0${R} <${+M+1}.0.0-0`:_?(o("replaceCaret pr",_),M==="0"?$==="0"?F=`>=${M}.${$}.${O}-${_} <${M}.${$}.${+O+1}-0`:F=`>=${M}.${$}.${O}-${_} <${M}.${+$+1}.0-0`:F=`>=${M}.${$}.${O}-${_} <${+M+1}.0.0-0`):(o("no pr"),M==="0"?$==="0"?F=`>=${M}.${$}.${O}${R} <${M}.${$}.${+O+1}-0`:F=`>=${M}.${$}.${O}${R} <${M}.${+$+1}.0-0`:F=`>=${M}.${$}.${O} <${+M+1}.0.0-0`),o("caret return",F),F})},U=(p,g)=>(o("replaceXRanges",p,g),p.split(/\s+/).map(k=>L(k,g)).join(" ")),L=(p,g)=>{p=p.trim();const k=g.loose?c[u.XRANGELOOSE]:c[u.XRANGE];return p.replace(k,(R,T,M,$,O,_)=>{o("xRange",p,R,T,M,$,O,_);const F=v(M),ue=F||v($),ne=ue||v(O),q=ne;return T==="="&&q&&(T=""),_=g.includePrerelease?"-0":"",F?T===">"||T==="<"?R="<0.0.0-0":R="*":T&&q?(ue&&($=0),O=0,T===">"?(T=">=",ue?(M=+M+1,$=0,O=0):($=+$+1,O=0)):T==="<="&&(T="<",ue?M=+M+1:$=+$+1),T==="<"&&(_="-0"),R=`${T+M}.${$}.${O}${_}`):ue?R=`>=${M}.0.0${_} <${+M+1}.0.0-0`:ne&&(R=`>=${M}.${$}.0${_} <${M}.${+$+1}.0-0`),o("xRange return",R),R})},Y=(p,g)=>(o("replaceStars",p,g),p.trim().replace(c[u.STAR],"")),Z=(p,g)=>(o("replaceGTE0",p,g),p.trim().replace(c[g.includePrerelease?u.GTE0PRE:u.GTE0],"")),G=p=>(g,k,R,T,M,$,O,_,F,ue,ne,q)=>(v(R)?k="":v(T)?k=`>=${R}.0.0${p?"-0":""}`:v(M)?k=`>=${R}.${T}.0${p?"-0":""}`:$?k=`>=${k}`:k=`>=${k}${p?"-0":""}`,v(F)?_="":v(ue)?_=`<${+F+1}.0.0-0`:v(ne)?_=`<${F}.${+ue+1}.0-0`:q?_=`<=${F}.${ue}.${ne}-${q}`:p?_=`<${F}.${ue}.${+ne+1}-0`:_=`<=${_}`,`${k} ${_}`.trim()),C=(p,g,k)=>{for(let R=0;R<p.length;R++)if(!p[R].test(g))return!1;if(g.prerelease.length&&!k.includePrerelease){for(let R=0;R<p.length;R++)if(o(p[R].semver),p[R].semver!==s.ANY&&p[R].semver.prerelease.length>0){const T=p[R].semver;if(T.major===g.major&&T.minor===g.minor&&T.patch===g.patch)return!0}return!1}return!0};return mg}var gg,g5;function uf(){if(g5)return gg;g5=1;const e=Symbol("SemVer ANY");class t{static get ANY(){return e}constructor(l,d){if(d=n(d),l instanceof t){if(l.loose===!!d.loose)return l;l=l.value}l=l.trim().split(/\s+/).join(" "),o("comparator",l,d),this.options=d,this.loose=!!d.loose,this.parse(l),this.semver===e?this.value="":this.value=this.operator+this.semver.version,o("comp",this)}parse(l){const d=this.options.loose?r[i.COMPARATORLOOSE]:r[i.COMPARATOR],f=l.match(d);if(!f)throw new TypeError(`Invalid comparator: ${l}`);this.operator=f[1]!==void 0?f[1]:"",this.operator==="="&&(this.operator=""),f[2]?this.semver=new a(f[2],this.options.loose):this.semver=e}toString(){return this.value}test(l){if(o("Comparator.test",l,this.options.loose),this.semver===e||l===e)return!0;if(typeof l=="string")try{l=new a(l,this.options)}catch{return!1}return s(l,this.operator,this.semver,this.options)}intersects(l,d){if(!(l instanceof t))throw new TypeError("a Comparator is required");return this.operator===""?this.value===""?!0:new c(l.value,d).test(this.value):l.operator===""?l.value===""?!0:new c(this.value,d).test(l.semver):(d=n(d),d.includePrerelease&&(this.value==="<0.0.0-0"||l.value==="<0.0.0-0")||!d.includePrerelease&&(this.value.startsWith("<0.0.0")||l.value.startsWith("<0.0.0"))?!1:!!(this.operator.startsWith(">")&&l.operator.startsWith(">")||this.operator.startsWith("<")&&l.operator.startsWith("<")||this.semver.version===l.semver.version&&this.operator.includes("=")&&l.operator.includes("=")||s(this.semver,"<",l.semver,d)&&this.operator.startsWith(">")&&l.operator.startsWith("<")||s(this.semver,">",l.semver,d)&&this.operator.startsWith("<")&&l.operator.startsWith(">")))}}gg=t;const n=fg,{safeRe:r,t:i}=Tu,s=JN,o=rf,a=Ou,c=Mr();return gg}const QN=Mr();var y5=(e,t,n)=>{try{t=new QN(t,n)}catch{return!1}return t.test(e)};Mr(),Mr(),Mr(),Mr();const XN=Mr();var eL=(e,t)=>{try{return new XN(e,t).range||"*"}catch{return null}};const tL=Ou,b5=uf(),{ANY:nL}=b5,rL=Mr(),iL=y5,w5=pg,v5=f5,sL=p5,oL=h5;var aL=(e,t,n,r)=>{e=new tL(e,r),t=new rL(t,r);let i,s,o,a,c;switch(n){case">":i=w5,s=sL,o=v5,a=">",c=">=";break;case"<":i=v5,s=oL,o=w5,a="<",c="<=";break;default:throw new TypeError('Must provide a hilo val of "<" or ">"')}if(iL(e,t,r))return!1;for(let u=0;u<t.set.length;++u){const l=t.set[u];let d=null,f=null;if(l.forEach(h=>{h.semver===nL&&(h=new b5(">=0.0.0")),d=d||h,f=f||h,i(h.semver,d.semver,r)?d=h:o(h.semver,f.semver,r)&&(f=h)}),d.operator===a||d.operator===c||(!f.operator||f.operator===a)&&s(e,f.semver))return!1;if(f.operator===c&&o(e,f.semver))return!1}return!0};const cL=aL;var uL=(e,t,n)=>cL(e,t,">",n);Mr(),Mr();const yg=uf(),{ANY:LQ}=yg;new yg(">=0.0.0-0"),new yg(">=0.0.0");const bg=Tu,_5=nf,E5=c5,lL=BN,dL=pg;uf(),Mr();var fL={valid:lL,gt:dL,satisfies:y5,validRange:eL,gtr:uL,re:bg.re,src:bg.src,tokens:bg.t,SEMVER_SPEC_VERSION:_5.SEMVER_SPEC_VERSION,RELEASE_TYPES:_5.RELEASE_TYPES,compareIdentifiers:E5.compareIdentifiers,rcompareIdentifiers:E5.rcompareIdentifiers},hL=Mu;Mu.default=Mu,Mu.stable=k5,Mu.stableStringify=k5;var lf="[...]",x5="[Circular]",oo=[],ao=[];function S5(){return{depthLimit:Number.MAX_SAFE_INTEGER,edgesLimit:Number.MAX_SAFE_INTEGER}}function Mu(e,t,n,r){typeof r>"u"&&(r=S5()),wg(e,"",0,[],void 0,0,r);var i;try{ao.length===0?i=JSON.stringify(e,t,n):i=JSON.stringify(e,A5(t),n)}catch{return JSON.stringify("[unable to serialize, circular reference is too complex to analyze]")}finally{for(;oo.length!==0;){var s=oo.pop();s.length===4?Object.defineProperty(s[0],s[1],s[3]):s[0][s[1]]=s[2]}}return i}function Ca(e,t,n,r){var i=Object.getOwnPropertyDescriptor(r,n);i.get!==void 0?i.configurable?(Object.defineProperty(r,n,{value:e}),oo.push([r,n,t,i])):ao.push([t,n,e]):(r[n]=e,oo.push([r,n,t]))}function wg(e,t,n,r,i,s,o){s+=1;var a;if(typeof e=="object"&&e!==null){for(a=0;a<r.length;a++)if(r[a]===e){Ca(x5,e,t,i);return}if(typeof o.depthLimit<"u"&&s>o.depthLimit){Ca(lf,e,t,i);return}if(typeof o.edgesLimit<"u"&&n+1>o.edgesLimit){Ca(lf,e,t,i);return}if(r.push(e),Array.isArray(e))for(a=0;a<e.length;a++)wg(e[a],a,a,r,e,s,o);else{var c=Object.keys(e);for(a=0;a<c.length;a++){var u=c[a];wg(e[u],u,a,r,e,s,o)}}r.pop()}}function pL(e,t){return e<t?-1:e>t?1:0}function k5(e,t,n,r){typeof r>"u"&&(r=S5());var i=vg(e,"",0,[],void 0,0,r)||e,s;try{ao.length===0?s=JSON.stringify(i,t,n):s=JSON.stringify(i,A5(t),n)}catch{return JSON.stringify("[unable to serialize, circular reference is too complex to analyze]")}finally{for(;oo.length!==0;){var o=oo.pop();o.length===4?Object.defineProperty(o[0],o[1],o[3]):o[0][o[1]]=o[2]}}return s}function vg(e,t,n,r,i,s,o){s+=1;var a;if(typeof e=="object"&&e!==null){for(a=0;a<r.length;a++)if(r[a]===e){Ca(x5,e,t,i);return}try{if(typeof e.toJSON=="function")return}catch{return}if(typeof o.depthLimit<"u"&&s>o.depthLimit){Ca(lf,e,t,i);return}if(typeof o.edgesLimit<"u"&&n+1>o.edgesLimit){Ca(lf,e,t,i);return}if(r.push(e),Array.isArray(e))for(a=0;a<e.length;a++)vg(e[a],a,a,r,e,s,o);else{var c={},u=Object.keys(e).sort(pL);for(a=0;a<u.length;a++){var l=u[a];vg(e[l],l,a,r,e,s,o),c[l]=e[l]}if(typeof i<"u")oo.push([i,t,e]),i[t]=c;else return c}r.pop()}}function A5(e){return e=typeof e<"u"?e:function(t,n){return n},function(t,n){if(ao.length>0)for(var r=0;r<ao.length;r++){var i=ao[r];if(i[1]===t&&i[0]===n){n=i[2],ao.splice(r,1);break}}return e.call(this,t,n)}}const mL={gasPriceOracle:{address:"0x420000000000000000000000000000000000000F"},l1Block:{address:"0x4200000000000000000000000000000000000015"},l2CrossDomainMessenger:{address:"0x4200000000000000000000000000000000000007"},l2Erc721Bridge:{address:"0x4200000000000000000000000000000000000014"},l2StandardBridge:{address:"0x4200000000000000000000000000000000000010"},l2ToL1MessagePasser:{address:"0x4200000000000000000000000000000000000016"}},gL={block:FT({format(e){var n;return{transactions:(n=e.transactions)==null?void 0:n.map(r=>{if(typeof r=="string")return r;const i=Eu(r);return i.typeHex==="0x7e"&&(i.isSystemTx=r.isSystemTx,i.mint=r.mint?It(r.mint):void 0,i.sourceHash=r.sourceHash,i.type="deposit"),i}),stateRoot:e.stateRoot}}}),transaction:jT({format(e){const t={};return e.type==="0x7e"&&(t.isSystemTx=e.isSystemTx,t.mint=e.mint?It(e.mint):void 0,t.sourceHash=e.sourceHash,t.type="deposit"),t}}),transactionReceipt:zO({format(e){return{l1GasPrice:e.l1GasPrice?It(e.l1GasPrice):null,l1GasUsed:e.l1GasUsed?It(e.l1GasUsed):null,l1Fee:e.l1Fee?It(e.l1Fee):null,l1FeeScalar:e.l1FeeScalar?Number(e.l1FeeScalar):null}}})};function yL(e,t){return vL(e)?wL(e):kO(e,t)}const bL={transaction:yL};function wL(e){_L(e);const{sourceHash:t,data:n,from:r,gas:i,isSystemTx:s,mint:o,to:a,value:c}=e,u=[t,r,a??"0x",o?tn(o):"0x",c?tn(c):"0x",i?tn(i):"0x",s?"0x1":"0x",n??"0x"];return Hn(["0x7e",is(u)])}function vL(e){return e.type==="deposit"||typeof e.sourceHash<"u"}function _L(e){const{from:t,to:n}=e;if(t&&!Pt(t))throw new _n({address:t});if(n&&!Pt(n))throw new _n({address:n})}const df={blockTime:2e3,contracts:mL,formatters:gL,serializers:bL},I5=ls({id:42161,name:"Arbitrum One",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},blockTime:250,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}}}),Bu=1,_g=ls({...df,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:{...df.contracts,disputeGameFactory:{[Bu]:{address:"0x43edB88C4B80fDD2AdFF2412A7BebF9dF42cB40e"}},l2OutputOracle:{[Bu]:{address:"0x56315b90c40730925ec5485cf004d835058518A0"}},multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:5022},portal:{[Bu]:{address:"0x49048044D57e1C92A77f79988d21Fa8fAF74E97e",blockCreated:17482143}},l1StandardBridge:{[Bu]:{address:"0x3154Cf16ccdb4C6d922629664174b904d80F2C35",blockCreated:17482143}}},sourceId:Bu});({..._g});const C5=ls({id:56,name:"BNB Smart Chain",blockTime:750,nativeCurrency:{decimals:18,name:"BNB",symbol:"BNB"},rpcUrls:{default:{http:["https://56.rpc.thirdweb.com"]}},blockExplorers:{default:{name:"BscScan",url:"https://bscscan.com",apiUrl:"https://api.bscscan.com/api"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:15921452}}}),P5=ls({id:1,name:"Ethereum",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},blockTime:12e3,rpcUrls:{default:{http:["https://eth.merkle.io"]}},blockExplorers:{default:{name:"Etherscan",url:"https://etherscan.io",apiUrl:"https://api.etherscan.io/api"}},contracts:{ensUniversalResolver:{address:"0xeeeeeeee14d718c2b47d9923deab1335e144eeee",blockCreated:23085558},multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:14353601}}}),Nu=1,R5=ls({...df,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:{...df.contracts,disputeGameFactory:{[Nu]:{address:"0xe5965Ab5962eDc7477C8520243A95517CD252fA9"}},l2OutputOracle:{[Nu]:{address:"0xdfe97868233d1aa22e815a266982f2cf17685a27"}},multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:4286263},portal:{[Nu]:{address:"0xbEb5Fc579115071764c7423A4f12eDde41f106Ed"}},l1StandardBridge:{[Nu]:{address:"0x99C9fc46f92E8a1c0deC1b1747d010903E884bE1"}}},sourceId:Nu}),T5=ls({id:137,name:"Polygon",blockTime:2e3,nativeCurrency:{name:"POL",symbol:"POL",decimals:18},rpcUrls:{default:{http:["https://polygon.drpc.org"]}},blockExplorers:{default:{name:"PolygonScan",url:"https://polygonscan.com",apiUrl:"https://api.etherscan.io/v2/api"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:25770160}}}),O5=e7({chains:[_g,P5,I5,R5,T5,C5],transports:{[_g.id]:fs(),[P5.id]:fs("https://ethereum-rpc.publicnode.com"),[I5.id]:fs(),[R5.id]:fs(),[T5.id]:fs(),[C5.id]:fs()},connectors:[qd(),tf({appName:"Weave Checkout"})]}),EL=new Set([8453,1,10,42161,137,56]),M5={8453:"BASE",1:"ETHEREUM",10:"OPTIMISM",42161:"ARBITRUM",137:"POLYGON",56:"BSC"},Eg={8453:"Base",1:"Ethereum",10:"Optimism",42161:"Arbitrum",137:"Polygon",56:"BNB Chain"},B5={8453:"#1C4FE0",1:"#627EEA",10:"#FF3F57",42161:"#12AAFF",137:"#8247E5",56:"#F3BA2F"},N5={8453:"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",1:"0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",10:"0x0b2C639c533813f4Aa9D7837CAf62653d097Ff85",42161:"0xaf88d065e77c8cC2239327C5EDb3A432268e5831",137:"0x3c499c542cEF5E3811e1192ce70d8cC03d5c3359",56:"0x8AC76a51cc950d9822D68b83fE1Ad97B32Cd580d"},L5={1:"0xdAC17F958D2ee523a2206206994597C13D831ec7",10:"0x94b008aA00579c1307B0EF2c499aD98a8ce58e58",42161:"0xFd086bC7CD5C481DCC9C85ebE478A1C0b69FCbb9",137:"0xc2132D05D31c914a87C6611C10748AEb04B58e8F",56:"0x55d398326f99059fF775485246999027B3197955"};function xL(){return typeof window<"u"&&window.__WEAVE_API_BASE__?window.__WEAVE_API_BASE__:"http://localhost:4000/api/v1"}async function ff(e,t,n,r=15e3){const i=xL(),s={"Content-Type":"application/json","x-api-key":t,...n==null?void 0:n.headers},o=new AbortController,a=setTimeout(()=>o.abort(),r);try{const c=await fetch(`${i}${e}`,{...n,headers:s,signal:o.signal});if(c.status===204)return null;const u=await c.json();if(!u.success)throw new Error(u.error??"API error");return u.data}catch(c){throw(c==null?void 0:c.name)==="AbortError"?new Error("Request timed out — please check your connection"):c}finally{clearTimeout(a)}}const co=e=>`fiat:${e.toUpperCase()}`,hf=(e,t)=>`crypto:${e.toUpperCase()}:${t.toUpperCase()}`;async function Lu(e,t){const n=new URLSearchParams({from:t.from,to:t.to,amount:String(t.amount),...t.amountIn?{amountIn:t.amountIn}:{}});return ff(`/quotes?${n}`,e)}async function xg(e,t){return ff("/orders",e,{method:"POST",body:JSON.stringify(t)})}async function ju(e,t){return ff(`/orders/${t}`,e)}async function SL(e){return ff("/assets",e)}const kL=[{type:"function",name:"transfer",stateMutability:"nonpayable",inputs:[{name:"recipient",type:"address"},{name:"amount",type:"uint256"}],outputs:[{type:"bool"}]}],AL=Ow,IL=r7,CL=Z7,pf={forest:"#3D6B50",tan:"#B8935A",ink:"#1C1B17"},K={ink:"var(--weave-ink, #0B0F0E)",ink2:"var(--weave-ink2, #3A4240)",mute:"var(--weave-mute, #6B7572)",hair:"var(--weave-hair, #E8EAE6)",surface:"var(--weave-surface, #FFFFFF)",page:"var(--weave-page, #F5F4EF)",panel:"var(--weave-panel, #FAFAF7)",accent:"var(--weave-accent, #0F5D4C)",accentSoft:"var(--weave-accent-soft, #E6F0EC)",good:"var(--weave-good, #1F7A4D)",goodSoft:"var(--weave-good-soft, #E6F3EC)",warn:"var(--weave-warn, #A46A00)",warnSoft:"var(--weave-warn-soft, #FBF0DC)",err:"var(--weave-err, #A8321E)"},Ti=L0.reduce((e,t)=>{const n=t.key.split(":").pop();return e[n]={name:t.name,symbol:t.symbol,flag:t.flag,rate:t.rate,min:t.min,country:t.country,psp:"GTBank",bank:"GTBank ••7890",method:"Bank transfer"},e},{}),mf=[{token:"ETH",chain:"Optimism",amount:.312,usd:1024.4,icon:"Ξ",chainTint:"#ff3f57",logo:"https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/info/logo.png"},{token:"USDC",chain:"Base",amount:150,usd:150,icon:"$",chainTint:"#1C4FE0",logo:"https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48/logo.png"},{token:"STRK",chain:"Starknet",amount:840,usd:184.8,icon:"S",chainTint:"#EC796B",logo:"https://assets.coingecko.com/coins/images/35293/standard/starknet.png"},{token:"DAI",chain:"Ethereum",amount:502,usd:502,icon:"D",chainTint:"#F5AC37",logo:"https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0x6B175474E89094C44Da98b954EedeAC495271d0F/logo.png"}],PL=(e,t,n)=>{const r=Ti[t],s=!!r?0:4,o=Number.isInteger(e)?0:s,a=Math.pow(10,o),c=o>0?Math.ceil(e*a)/a:Math.ceil(e),u=new Intl.NumberFormat("en-US",{minimumFractionDigits:o,maximumFractionDigits:o}).format(c);return`${r.symbol}${u}`},$u=(e,t=4)=>{const n=Math.pow(10,t);return(Math.ceil(e*n)/n).toLocaleString("en-US",{minimumFractionDigits:t,maximumFractionDigits:t})},RL=async(e,t,n,r)=>{const i=document.createElement("canvas"),s=i.getContext("2d");if(!s)return;const o=pf[r]||r||"#0F5D4C",a=800,c=1100;i.width=a,i.height=c,s.fillStyle="#FDFDFB",s.fillRect(0,0,a,c),s.strokeStyle="#E8EAE6",s.lineWidth=2,s.strokeRect(40,40,a-80,c-80),s.fillStyle=o,s.font="700 32px Figtree, Inter, sans-serif",s.fillText("Weave",80,110),s.fillStyle="#6B7572",s.font="500 16px Inter, sans-serif",s.fillText("PAYMENT RECEIPT",a-240,105),s.fillStyle="#E6F0EC";const u=230,l=36;s.beginPath(),s.roundRect(80,160,u,l,8),s.fill(),s.fillStyle=o,s.font="700 12px Inter, sans-serif",s.textAlign="center",s.fillText("✓ TRANSACTION SUCCESSFUL",80+u/2,182),s.textAlign="left",s.fillStyle="#0B0F0E",s.font="700 72px Figtree, Inter, sans-serif";const d=PL(e.amount,e.currency);s.fillText(d,80,280),s.fillStyle="#6B7572",s.font="500 18px Inter, sans-serif",s.fillText("Total amount paid to "+e.name,80,315);const f=(w,b,x)=>{s.fillStyle="#6B7572",s.font="500 15px Inter, sans-serif",s.fillText(w,80,x),s.fillStyle="#0B0F0E",s.font="600 16px Inter, sans-serif",s.textAlign="right",s.fillText(b,a-80,x),s.textAlign="left",s.strokeStyle="#E8EAE6",s.lineWidth=1,s.beginPath(),s.moveTo(80,x+25),s.lineTo(a-80,x+25),s.stroke()},h=new Date((t==null?void 0:t.createdAt)||Date.now()).toLocaleDateString("en-US",{day:"numeric",month:"long",year:"numeric",hour:"2-digit",minute:"2-digit"});f("Payment Date",h,420),f("Transaction Ref",((t==null?void 0:t.id)||"N/A").toUpperCase(),490),f("Merchant",e.name,560),f("Payout Destination",n,630),f("Status","Completed",700),s.fillStyle="#F5F4EF",s.fillRect(80,800,a-160,120),s.fillStyle="#0B0F0E",s.font="600 16px Inter, sans-serif",s.fillText("Security Verification",110,845),s.fillStyle="#6B7572",s.font="400 14px Inter, sans-serif",s.fillText("This transaction was secured with 256-bit encryption by Paycrest.",110,875),s.fillText("You can verify this order directly on the Weave Dashboard.",110,895),s.textAlign="center",s.fillStyle="#0B0F0E",s.font="700 24px Figtree, Inter, sans-serif",s.fillText("Thank you for using Weave.",a/2,1020),s.fillStyle="#6B7572",s.font="400 12px Inter, sans-serif",s.fillText("Support: help@weave.com",a/2,1050);const m=i.toDataURL("image/png"),y=document.createElement("a");y.download=`weave-receipt-${((t==null?void 0:t.id)||"txn").slice(0,8)}.png`,y.href=m,y.click()};function we({gap:e=12,children:t,style:n}){return P.jsx("div",{style:{display:"flex",flexDirection:"column",gap:e,...n},children:t})}function rn({gap:e=10,align:t="center",justify:n="flex-start",children:r,style:i}){return P.jsx("div",{style:{display:"flex",alignItems:t,justifyContent:n,gap:e,...i},children:r})}function Pa(){return P.jsx("div",{style:{height:1,background:K.hair,width:"100%"}})}function Fu({children:e,tone:t="neutral"}){const n={neutral:{bg:"#F1F0EB",fg:K.ink2},good:{bg:K.goodSoft,fg:K.good},accent:{bg:K.accentSoft,fg:K.accent},warn:{bg:K.warnSoft,fg:K.warn}}[t];return P.jsx("span",{style:{display:"inline-flex",alignItems:"center",gap:6,height:22,padding:"0 9px",borderRadius:999,background:n.bg,color:n.fg,fontSize:11.5,fontWeight:500,letterSpacing:.1},children:e})}function Ra({bg:e,children:t,size:n=32}){return P.jsx("div",{style:{width:n,height:n,borderRadius:n/2,background:e,color:"#fff",display:"flex",alignItems:"center",justifyContent:"center",fontWeight:700,fontSize:n*.42,flexShrink:0,fontFamily:"ui-monospace, SFMono-Regular, Menlo, monospace"},children:t})}function Sg({size:e=22}){return P.jsxs("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none","aria-hidden":!0,children:[P.jsx("path",{d:"M3 5 L8 19 L12 9 L16 19 L21 5",stroke:K.accent,strokeWidth:"2.2",strokeLinecap:"round",strokeLinejoin:"round"}),P.jsx("path",{d:"M5 9 L12 19 L19 9",stroke:K.ink,strokeWidth:"1.2",strokeLinecap:"round",strokeLinejoin:"round",opacity:"0.3"})]})}const j5={width:28,height:28,borderRadius:14,border:"none",cursor:"pointer",background:"transparent",color:K.mute,display:"flex",alignItems:"center",justifyContent:"center"},TL={...j5,color:K.ink};function OL({merchantName:e,onClose:t,showBack:n,onBack:r}){return P.jsxs("div",{style:{padding:"16px 20px 14px",display:"flex",alignItems:"center",gap:10,borderBottom:`1px solid ${K.hair}`},children:[n?P.jsx("button",{onClick:r,style:TL,children:P.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",children:P.jsx("path",{d:"M15 18L9 12L15 6",stroke:"currentColor",strokeWidth:"2.2",strokeLinecap:"round",strokeLinejoin:"round"})})}):P.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[P.jsx(Sg,{size:22}),P.jsx("span",{style:{fontWeight:600,fontSize:15,letterSpacing:-.2},children:"Weave"})]}),P.jsxs("div",{style:{flex:1,textAlign:"center",fontSize:12.5,color:K.mute},children:["Paying ",P.jsx("span",{style:{color:K.ink,fontWeight:500},children:e})]}),P.jsx("button",{onClick:t,style:j5,children:P.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",children:P.jsx("path",{d:"M6 6L18 18M6 18L18 6",stroke:"currentColor",strokeWidth:"2.2",strokeLinecap:"round"})})})]})}function ML(){return P.jsxs("div",{style:{padding:"12px 20px 14px",borderTop:`1px solid ${K.hair}`,display:"flex",alignItems:"center",justifyContent:"space-between",fontSize:11,color:K.mute,background:K.panel,borderRadius:"0 0 16px 16px"},children:[P.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6},children:[P.jsx("svg",{width:"11",height:"11",viewBox:"0 0 24 24",fill:"none",children:P.jsx("path",{d:"M12 2L3 6V12C3 17 6.5 21 12 22C17.5 21 21 17 21 12V6L12 2Z",stroke:"currentColor",strokeWidth:"1.8"})}),"Secured by Dewdrop Labs"]}),P.jsx("div",{style:{display:"flex",alignItems:"center",gap:10},children:P.jsx("span",{children:"xoxo ❤️"})})]})}const Du={width:"100%",padding:"12px 14px",borderRadius:12,border:`1px solid ${K.hair}`,background:"#fff",cursor:"pointer",fontFamily:"inherit",display:"flex",alignItems:"center",gap:12,transition:"border-color 0.15s, background 0.15s, transform 0.1s"},BL={padding:"10px 12px",borderRadius:10,border:`1px solid ${K.hair}`,background:"#fff",cursor:"pointer",fontFamily:"inherit",display:"flex",alignItems:"center",gap:8,transition:"border-color 0.15s, background 0.15s"},ps={width:"100%",height:46,borderRadius:10,border:"none",background:K.ink,color:"#fff",fontSize:14.5,fontWeight:500,display:"flex",alignItems:"center",justifyContent:"center",gap:8,cursor:"pointer",fontFamily:"inherit",letterSpacing:-.1,transition:"transform 0.08s, background 0.2s"},kg={width:"100%",height:46,borderRadius:10,border:`1px solid ${K.hair}`,background:"#fff",color:K.ink,fontSize:14,fontWeight:500,display:"flex",alignItems:"center",gap:10,paddingLeft:14,paddingRight:14,cursor:"pointer",fontFamily:"inherit"};function NL({onPick:e,merchant:t,currencies:n,fmtCur:r,submitting:i,disabledMethods:s}){const o=n[t.currency]||Ti[t.currency],[a,c]=ce.useState(!1),[u,l]=ce.useState(null);ce.useEffect(()=>{i||l(null)},[i]);const d=f=>{i||u||(l(f),e(f))};return P.jsxs(we,{gap:16,style:{padding:"22px 20px 6px"},children:[P.jsxs(we,{gap:10,style:{alignItems:"center",padding:"4px 0 6px"},children:[P.jsx("div",{style:{width:44,height:44,borderRadius:10,background:pf[t.currency==="USDC"?"ink":"forest"]||"#2B1810",color:"#FFFFFF",display:"flex",alignItems:"center",justifyContent:"center",fontWeight:700,fontSize:18,fontFamily:"var(--weave-font-display, Georgia, serif)",boxShadow:"0 2px 8px rgba(0,0,0,0.12)"},children:(()=>{var h;const f=t.name.trim().split(/\s+/).filter(Boolean);return f.length>=2?(f[0][0]+f[1][0]).toUpperCase():((h=f[0])==null?void 0:h.slice(0,2).toUpperCase())??"?"})()}),P.jsxs(we,{gap:3,style:{alignItems:"center"},children:[P.jsxs("div",{style:{fontSize:12.5,color:K.mute},children:["Pay ",t.name]}),P.jsx("div",{style:{fontSize:30,fontWeight:600,letterSpacing:-.6,color:K.ink},children:r(t.amount,t.currency)}),P.jsx("div",{style:{fontSize:11.5,color:K.mute},children:t.description||"Secure checkout"})]})]}),P.jsxs(we,{gap:8,children:[P.jsx("div",{style:{fontSize:11,color:K.mute,textTransform:"uppercase",letterSpacing:.6},children:"How would you like to pay?"}),P.jsxs("button",{onClick:()=>!(s!=null&&s.fiat)&&d("fiat"),disabled:!!(i||u||s!=null&&s.fiat),title:s==null?void 0:s.fiat,style:{...Du,opacity:i||u||s!=null&&s.fiat?.7:1,cursor:i||u?"not-allowed":s!=null&&s.fiat?"help":"pointer",filter:s!=null&&s.fiat?"grayscale(1)":"none"},children:[P.jsx("div",{style:{width:40,height:40,borderRadius:10,background:"#fff",border:`1px solid ${K.hair}`,display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0},children:u==="fiat"?P.jsx("div",{style:{width:18,height:18,borderRadius:"50%",border:`2px solid ${K.hair}`,borderTopColor:K.accent,animation:"wspin 0.8s linear infinite"}}):P.jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",children:P.jsx("path",{d:"M3 21H21M5 21V10M9 21V10M15 21V10M19 21V10M2 10L12 3L22 10H2Z",stroke:K.ink,strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round"})})}),P.jsxs(we,{gap:2,style:{flex:1,textAlign:"left",minWidth:0},children:[P.jsx("div",{style:{fontSize:14,fontWeight:500,color:K.ink},children:u==="fiat"?"Setting up payment…":"Bank transfer"}),P.jsx("div",{style:{fontSize:11.5,color:K.mute},children:(s==null?void 0:s.fiat)||`Pay in ${(o==null?void 0:o.name)??t.currency} · Instant · No fees`})]}),u!=="fiat"&&!(s!=null&&s.fiat)&&P.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",style:{marginLeft:4,flexShrink:0},children:P.jsx("path",{d:"M9 6L15 12L9 18",stroke:K.mute,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]}),P.jsxs("button",{onClick:()=>d("deposit"),disabled:!!(i||u),style:{...Du,opacity:i||u?.7:1,cursor:i||u?"not-allowed":"pointer"},children:[P.jsx("div",{style:{width:40,height:40,borderRadius:10,background:"#fff",border:`1px solid ${K.hair}`,display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0},children:P.jsx(Ra,{bg:"#F6851B",size:24,children:"🦊"})}),P.jsxs(we,{gap:2,style:{flex:1,textAlign:"left",minWidth:0},children:[P.jsx("div",{style:{fontSize:14,fontWeight:500},children:"Pay with crypto wallet"}),P.jsx("div",{style:{fontSize:11.5,color:K.mute},children:"MetaMask detected · Any chain, any token"})]}),P.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",style:{marginLeft:4,flexShrink:0},children:P.jsx("path",{d:"M9 6L15 12L9 18",stroke:K.mute,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]}),a?P.jsx(we,{gap:6,style:{padding:"2px 0"},children:P.jsxs("button",{onClick:()=>d("externalDeposit"),disabled:!!(i||u),style:{...BL,opacity:i||u?.7:1,cursor:i||u?"not-allowed":"pointer"},children:[P.jsx("div",{style:{width:20,height:20,borderRadius:5,background:K.panel,border:`1px solid ${K.hair}`,display:"flex",alignItems:"center",justifyContent:"center"},children:P.jsxs("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",children:[P.jsx("rect",{x:"3",y:"3",width:"7",height:"7",stroke:K.ink,strokeWidth:"2"}),P.jsx("rect",{x:"14",y:"3",width:"7",height:"7",stroke:K.ink,strokeWidth:"2"}),P.jsx("rect",{x:"3",y:"14",width:"7",height:"7",stroke:K.ink,strokeWidth:"2"})]})}),P.jsx("span",{style:{fontSize:12.5,fontWeight:500},children:"Pay from mobile / hardware / exchange"}),P.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",style:{marginLeft:"auto"},children:P.jsx("path",{d:"M9 6L15 12L9 18",stroke:K.mute,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]})}):P.jsx("button",{onClick:()=>!u&&c(!0),style:{background:"transparent",border:"none",cursor:u?"not-allowed":"pointer",fontFamily:"inherit",fontSize:12,color:K.mute,padding:"4px 0",textAlign:"center",opacity:u?.5:1},children:"Use a different wallet ↓"})]})]})}function LL({onNext:e,merchant:t,balances:n,selected:r,setSelected:i,currencies:s}){var o;return P.jsxs(we,{gap:14,style:{padding:"18px 20px 6px"},children:[P.jsxs(we,{gap:4,children:[P.jsx("div",{style:{fontSize:18,fontWeight:600,letterSpacing:-.3},children:"Choose what you'd like to pay with"}),P.jsxs("div",{style:{fontSize:12.5,color:K.mute},children:["We found these balances in your wallet. Pick any — we'll convert to ",((o=s[t.currency])==null?void 0:o.name)??t.currency," for ",t.name,"."]})]}),P.jsx(we,{gap:6,children:n.map((a,c)=>{const u=s[t.currency]||Ti[t.currency],l=a.usd>=t.amount/((u==null?void 0:u.rate)||1),d=r===c;return P.jsxs("button",{onClick:()=>l&&i(c),disabled:!l,style:{width:"100%",padding:"12px 14px",background:d?K.accentSoft:"#fff",border:`1.5px solid ${d?K.accent:K.hair}`,borderRadius:12,cursor:l?"pointer":"not-allowed",opacity:l?1:.48,display:"flex",alignItems:"center",gap:12,textAlign:"left",fontFamily:"inherit",transition:"all 0.15s"},children:[P.jsx(Ra,{bg:a.chainTint,size:36,children:a.logo?P.jsx("img",{src:a.logo,style:{width:"100%",height:"100%",borderRadius:"inherit",objectFit:"cover"}}):a.icon}),P.jsxs(we,{gap:2,style:{flex:1},children:[P.jsxs("div",{style:{fontSize:14,fontWeight:500,color:K.ink},children:[$u(a.amount)," ",a.token]}),P.jsxs("div",{style:{fontSize:12,color:K.mute},children:["on ",a.chain," · ≈ $",a.usd.toFixed(2)]})]}),!l&&P.jsx(Fu,{tone:"warn",children:"Too low"}),l&&d&&P.jsx("div",{style:{width:20,height:20,borderRadius:10,background:K.accent,display:"flex",alignItems:"center",justifyContent:"center"},children:P.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",children:P.jsx("path",{d:"M5 12L10 17L19 7",stroke:"white",strokeWidth:"3",strokeLinecap:"round",strokeLinejoin:"round"})})})]},c)})}),P.jsx("button",{onClick:()=>e("quote"),style:{...ps,opacity:r===null?.5:1},disabled:r===null,children:"Continue"})]})}function jL({merchant:e,balance:t,onConfirm:n,submitting:r,error:i,quote:s,quoteLoading:o,currencies:a,fmtCur:c}){if(o&&!s)return P.jsxs(we,{style:{padding:"60px 0",minHeight:320,alignItems:"center",justifyContent:"center"},children:[P.jsx(gf,{}),P.jsx("div",{style:{marginTop:16,fontSize:13,color:K.mute},children:"Calculating best route…"})]});const u=a[e.currency]||Ti[e.currency],l=(u==null?void 0:u.rate)||1,d=e.amount/l,f=s?s.breakdown.inputAmount:d,h=t.amount>0?t.usd/t.amount:t.token==="ETH"?3400:1,m=f/(h||1),y=s?s.breakdown.bridgeFeeUsd:t.chain==="Base"&&t.token==="USDC"?0:1.8,w=s?s.breakdown.senderFeeUsd+s.breakdown.appFeeUsd:f*.0075,b=y+w,x=s?s.breakdown.sellRate:l,v=s?s.estimatedFiat:e.amount;return P.jsxs(we,{gap:14,style:{padding:"16px 20px 6px"},children:[P.jsxs(we,{gap:6,children:[P.jsx("div",{style:{fontSize:11,color:K.mute,textTransform:"uppercase",letterSpacing:.6},children:"You pay"}),P.jsxs(rn,{align:"baseline",gap:8,children:[P.jsx("div",{style:{fontSize:30,fontWeight:600,letterSpacing:-.6},children:$u(m,5)}),P.jsx("div",{style:{fontSize:16,color:K.ink2,fontWeight:500},children:t.token})]}),P.jsxs(rn,{gap:6,style:{fontSize:12,color:K.mute},children:[P.jsx(Ra,{bg:t.chainTint,size:14,children:t.logo?P.jsx("img",{src:t.logo,style:{width:"100%",height:"100%",objectFit:"cover"}}):t.icon}),"on ",t.chain]})]}),P.jsxs("div",{style:{padding:"2px 0",position:"relative"},children:[P.jsx(Pa,{}),P.jsxs("div",{style:{position:"absolute",left:"50%",top:"50%",transform:"translate(-50%, -50%)",background:"#fff",padding:"0 10px",fontSize:11,color:K.mute,letterSpacing:.4,display:"flex",alignItems:"center",gap:6},children:[P.jsx("svg",{width:"11",height:"11",viewBox:"0 0 24 24",fill:"none",children:P.jsx("path",{d:"M12 5V19M5 12L12 19L19 12",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}),"converts to"]})]}),P.jsxs(we,{gap:6,children:[P.jsxs("div",{style:{fontSize:11,color:K.mute,textTransform:"uppercase",letterSpacing:.6},children:[e.name," receives"]}),P.jsx(rn,{align:"baseline",gap:8,children:P.jsx("div",{style:{fontSize:30,fontWeight:600,letterSpacing:-.6,color:K.accent},children:c(v,e.currency)})}),P.jsxs(rn,{gap:6,style:{fontSize:12,color:K.mute},children:["via ",(u==null?void 0:u.method)||"Transfer"," · ",(u==null?void 0:u.psp)||"Partner"]})]}),P.jsxs(we,{gap:7,style:{fontSize:12.5},children:[P.jsxs(rn,{justify:"space-between",children:[P.jsx("span",{style:{color:K.mute},children:"Rate"}),P.jsxs("span",{children:["1 USDC = ",c(x,e.currency)]})]}),y>0&&P.jsxs(rn,{justify:"space-between",children:[P.jsx("span",{style:{color:K.mute},children:"Network & bridge"}),P.jsxs("span",{children:["$",y.toFixed(2)]})]}),P.jsxs(rn,{justify:"space-between",children:[P.jsx("span",{style:{color:K.mute},children:"Weave fee"}),P.jsxs("span",{children:["$",w.toFixed(2)]})]}),P.jsx(Pa,{}),P.jsxs(rn,{justify:"space-between",style:{fontWeight:500,color:K.ink},children:[P.jsx("span",{children:"Total fees"}),P.jsxs("span",{children:["$",b.toFixed(2)]})]}),o&&P.jsx("div",{style:{fontSize:11,color:K.mute,textAlign:"center"},children:"Fetching live rate…"})]}),P.jsxs(we,{gap:8,children:[i&&P.jsx("div",{style:{background:"#FBEEE9",border:`1px solid ${K.err}33`,borderRadius:10,padding:"10px 12px",fontSize:12,color:K.err,lineHeight:1.5},children:i}),P.jsxs("button",{onClick:n,disabled:r,style:{...ps,opacity:r?.6:1,cursor:r?"not-allowed":"pointer"},children:[r?"Creating order…":"Confirm in wallet",!r&&P.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",children:P.jsx("path",{d:"M5 12H19M13 6L19 12L13 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]}),P.jsx("div",{style:{fontSize:11,color:K.mute,textAlign:"center"},children:"Rate locked for 30s · You'll sign one transaction in your wallet"})]})]})}function gf(){return P.jsxs("div",{style:{position:"relative",width:56,height:56},children:[P.jsxs("svg",{width:"56",height:"56",viewBox:"0 0 56 56",style:{position:"absolute",inset:0},children:[P.jsx("circle",{cx:"28",cy:"28",r:"24",stroke:K.hair,strokeWidth:"2.5",fill:"none"}),P.jsx("circle",{cx:"28",cy:"28",r:"24",stroke:K.accent,strokeWidth:"2.5",fill:"none",strokeDasharray:"40 150",strokeLinecap:"round",style:{transformOrigin:"center",animation:"wspin 1.2s linear infinite"}})]}),P.jsx("div",{style:{position:"absolute",inset:0,display:"flex",alignItems:"center",justifyContent:"center"},children:P.jsx(Sg,{size:22})})]})}function $L({onNext:e,details:t}){const[n,r]=ce.useState(!0),[i,s]=ce.useState(null),o=ce.useRef(!1),a=()=>{if(!t){s("Payment details unavailable. Please retry."),r(!1);return}const{accessCode:c}=t,u=()=>{if(o.current)return;o.current=!0,r(!1);const d=window.PaystackPop;if(!d){s("Paystack failed to load. Please check your connection and retry."),o.current=!1;return}new d().resumeTransaction(c,{onSuccess:()=>e("processing"),onCancel:()=>{o.current=!1}})};if(window.PaystackPop){u();return}const l=document.createElement("script");l.src="https://js.paystack.co/v2/inline.js",l.onload=u,l.onerror=()=>{r(!1),s("Could not load Paystack. Check your network and try again.")},document.head.appendChild(l)};return ce.useEffect(()=>{a()},[]),n?P.jsx(we,{gap:24,style:{padding:"28px 20px"},children:P.jsxs("div",{style:{textAlign:"center",padding:"32px 0"},children:[P.jsx("div",{style:{width:36,height:36,borderRadius:"50%",border:`3px solid ${K.hair}`,borderTopColor:K.accent,animation:"wspin 0.8s linear infinite",margin:"0 auto"}}),P.jsx("div",{style:{marginTop:14,fontSize:14,color:K.mute},children:"Opening payment popup…"})]})}):i?P.jsxs(we,{gap:16,style:{padding:"28px 20px"},children:[P.jsx("div",{style:{textAlign:"center",fontSize:14,color:K.err,padding:"8px 0"},children:i}),P.jsx("button",{onClick:()=>{o.current=!1,s(null),r(!0),a()},style:ps,children:"Retry"})]}):P.jsxs(we,{gap:16,style:{padding:"28px 20px"},children:[P.jsx("div",{style:{textAlign:"center",fontSize:14,color:K.mute,padding:"12px 0"},children:"A Paystack payment popup has opened. Complete payment there to continue."}),P.jsx("button",{onClick:()=>{o.current=!1,a()},style:{...ps,background:K.page,color:K.ink},children:"Re-open popup"})]})}const FL=new Set(["completed"]),DL=new Set(["failed","expired","refunded"]);function $5({onNext:e,merchant:t,mode:n,apiKey:r,orderId:i,bankDetails:s,currencies:o,fmtCur:a}){const[c,u]=ce.useState(0),[l,d]=ce.useState(0),f=ce.useRef(!1),h=Ti[t.currency];ce.useEffect(()=>{const b=setInterval(()=>d(x=>x+1),1e3);return()=>clearInterval(b)},[]);const m=s!=null&&s.amountToTransfer?(()=>{const b=s.amountToTransfer,x=b.includes(".")?b.split(".")[1].length:0;return a(Number(b),t.currency,x)})():a(t.amount,t.currency),y=n==="fiat"?[{label:"Confirming your transfer",sub:`Matching the ${m} from your bank`,dur:1600},{label:"Completing payment",sub:`Sending to ${t.name}`,dur:2400}]:[{label:"Confirming transaction",sub:"Processing your transaction on-chain",dur:1400},{label:"Confirming your payment",sub:`Settling ${(h==null?void 0:h.name)||t.currency} to ${t.name}`,dur:2600}];ce.useEffect(()=>{if(i)return;if(c>=y.length){e("success");return}const b=setTimeout(()=>u(x=>x+1),y[c].dur);return()=>clearTimeout(b)},[c,i]),ce.useEffect(()=>{if(!i)return;f.current=!1;let b,x=0;const v=5e3,S=3e4,I=async()=>{if(f.current)return;try{const j=await ju(r,i);x=0;const U=String(j.status??"").toLowerCase(),L=String(j.paycrestStatus??"").toLowerCase();if(FL.has(U)){f.current=!0,e("success");return}if(DL.has(U)){f.current=!0,e("error");return}L==="fulfilled"&&u(1)}catch{x++}const N=Math.min(v*Math.pow(2,x),S);b=setTimeout(I,N)};return I(),()=>{f.current=!0,clearTimeout(b)}},[i,r]);const w=y[Math.min(c,y.length-1)];return P.jsxs(we,{gap:20,style:{padding:"28px 20px 12px",minHeight:360},children:[P.jsxs(we,{gap:12,style:{alignItems:"center",paddingTop:12},children:[P.jsx(gf,{}),P.jsxs(we,{gap:4,style:{alignItems:"center"},children:[P.jsx("div",{style:{fontSize:17,fontWeight:600,letterSpacing:-.3},children:w.label}),P.jsx("div",{style:{fontSize:12.5,color:K.mute,textAlign:"center"},children:w.sub})]})]}),P.jsx(we,{gap:0,style:{padding:"4px 8px"},children:y.map((b,x)=>P.jsxs(rn,{gap:12,style:{padding:"10px 0"},children:[P.jsxs("div",{style:{width:22,height:22,borderRadius:11,flexShrink:0,background:x<c?K.accent:"#fff",border:x<c?"none":`1.5px solid ${x===c?K.accent:K.hair}`,display:"flex",alignItems:"center",justifyContent:"center",position:"relative"},children:[x<c&&P.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",children:P.jsx("path",{d:"M5 12L10 17L19 7",stroke:"white",strokeWidth:"3",strokeLinecap:"round",strokeLinejoin:"round"})}),x===c&&P.jsx("div",{style:{width:8,height:8,borderRadius:4,background:K.accent,animation:"wpulse 1.1s ease-in-out infinite"}})]}),P.jsxs(we,{gap:1,children:[P.jsx("div",{style:{fontSize:13,fontWeight:500,color:x<=c?K.ink:K.mute},children:b.label}),P.jsx("div",{style:{fontSize:11.5,color:K.mute},children:x<c?"Completed":x===c?b.sub:"Pending"})]})]},x))}),P.jsx("div",{style:{fontSize:11,color:K.mute,textAlign:"center"},children:"You can safely close this window. We'll email a receipt."})]})}function F5({onNext:e,merchant:t,balance:n,direction:r,apiKey:i,orderId:s,accentColor:o,currencies:a,fmtCur:c}){var I,N,j,U;const[u,l]=ce.useState(null);ce.useEffect(()=>{if(!s)return;let L=!1;return ju(i,s).then(Y=>{L||l(Y)}).catch(()=>{}),()=>{L=!0}},[i,s]);const f=(u!=null&&u.sourceAssetKey?PI(u.sourceAssetKey):void 0)||n,h=f.token||(typeof(u==null?void 0:u.sourceAssetKey)=="string"?u.sourceAssetKey.split(":").pop():void 0),m=u?Number(u.sourceAmount):t.amount,y=r==="offramp"&&u?`${$u(Number(u.sourceAmount),4)} ${h??f.token}`:`${c(m,t.currency)}`,w=(I=u==null?void 0:u.destInstrument)==null?void 0:I.bankInstitution,b=r==="offramp"?w?ww(t.currency,w):((N=a[t.currency])==null?void 0:N.bank)||((j=Ti[t.currency])==null?void 0:j.bank):t.name,x=u!=null&&u.createdAt&&(u!=null&&u.updatedAt)?Math.max(1,Math.round((new Date(u.updatedAt).getTime()-new Date(u.createdAt).getTime())/1e3)):null,v=x==null?"—":x<60?`${x}s`:`${Math.round(x/60)}m`,S=!u;return P.jsxs(we,{gap:18,style:{padding:"28px 20px 12px",minHeight:360},children:[P.jsxs(we,{gap:14,style:{alignItems:"center",paddingTop:8},children:[P.jsx("div",{style:{width:64,height:64,borderRadius:32,background:K.accent,display:"flex",alignItems:"center",justifyContent:"center",animation:"wpop 0.5s cubic-bezier(0.2, 1.2, 0.4, 1)"},children:P.jsx("svg",{width:"32",height:"32",viewBox:"0 0 24 24",fill:"none",children:P.jsx("path",{d:"M5 12L10 17L19 7",stroke:"white",strokeWidth:"3.2",strokeLinecap:"round",strokeLinejoin:"round"})})}),P.jsxs(we,{gap:4,style:{alignItems:"center"},children:[P.jsx("div",{style:{fontSize:20,fontWeight:600,letterSpacing:-.3},children:"Payment complete"}),P.jsx("div",{style:{fontSize:13,color:K.mute,textAlign:"center",lineHeight:1.5,maxWidth:280,animation:S?"wpulse 1.5s ease-in-out infinite":void 0},children:r==="offramp"?P.jsxs(P.Fragment,{children:[c(t.amount,t.currency)," is on its way to ",P.jsx("span",{style:{color:K.ink},children:t.name}),"."]}):P.jsxs(P.Fragment,{children:["Your payment of ",c(m,t.currency)," has been sent to ",P.jsx("span",{style:{color:K.ink},children:t.name}),"."]})})]})]}),P.jsxs(we,{gap:0,style:{background:K.panel,border:`1px solid ${K.hair}`,borderRadius:12,overflow:"hidden"},children:[P.jsxs(rn,{justify:"space-between",style:{padding:"12px 14px",fontSize:12.5},children:[P.jsx("span",{style:{color:K.mute},children:"Paid with"}),r==="offramp"?P.jsxs(rn,{gap:6,style:{animation:S?"wpulse 1.5s ease-in-out infinite":void 0},children:[P.jsx(Ra,{bg:f.chainTint||f.tint,size:16,children:f.logo?P.jsx("img",{src:f.logo,style:{width:"100%",height:"100%",objectFit:"cover"}}):f.icon?f.icon:f.flag?f.flag:f.symbol}),P.jsx("span",{style:{fontWeight:500},children:y})]}):P.jsxs(rn,{gap:6,children:[P.jsx("div",{style:{width:16,height:16,borderRadius:8,background:"#fff",border:`1px solid ${K.hair}`,display:"flex",alignItems:"center",justifyContent:"center",fontSize:10},children:((U=a[t.currency])==null?void 0:U.flag)||"🇳🇬"}),P.jsx("span",{style:{fontWeight:500},children:c(m,t.currency)})]})]}),P.jsx(Pa,{}),P.jsxs(rn,{justify:"space-between",style:{padding:"12px 14px",fontSize:12.5},children:[P.jsx("span",{style:{color:K.mute},children:r==="offramp"?"Settled to":"Paid to"}),P.jsx("span",{style:{fontWeight:500,animation:S?"wpulse 1.5s ease-in-out infinite":void 0},children:b})]}),P.jsx(Pa,{}),P.jsxs(rn,{justify:"space-between",style:{padding:"12px 14px",fontSize:12.5},children:[P.jsx("span",{style:{color:K.mute},children:"Completed in"}),P.jsx(rn,{gap:6,children:P.jsx("span",{style:{animation:S?"wpulse 1.5s ease-in-out infinite":void 0},children:P.jsx(Fu,{tone:"good",children:v})})})]})]}),P.jsxs(we,{gap:8,children:[P.jsx("button",{onClick:()=>e("connect"),style:ps,children:"Done"}),P.jsxs("button",{onClick:()=>RL(t,u,b,o),style:{...kg,justifyContent:"center",paddingLeft:0},children:[P.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",children:P.jsx("path",{d:"M12 3V15M12 15L7 10M12 15L17 10M3 19H21",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}),"Download receipt"]})]})]})}function D5({onNext:e,onBack:t}){return P.jsxs(we,{gap:16,style:{padding:"28px 20px 12px",minHeight:360},children:[P.jsxs(we,{gap:14,style:{alignItems:"center",paddingTop:8},children:[P.jsx("div",{style:{width:64,height:64,borderRadius:32,background:"#FBEEE9",display:"flex",alignItems:"center",justifyContent:"center"},children:P.jsxs("svg",{width:"32",height:"32",viewBox:"0 0 24 24",fill:"none",children:[P.jsx("path",{d:"M12 8V13M12 17V17.01",stroke:K.err,strokeWidth:"2.4",strokeLinecap:"round"}),P.jsx("circle",{cx:"12",cy:"12",r:"10",stroke:K.err,strokeWidth:"2"})]})}),P.jsxs(we,{gap:4,style:{alignItems:"center"},children:[P.jsx("div",{style:{fontSize:18,fontWeight:600},children:"Transaction didn't go through"}),P.jsx("div",{style:{fontSize:13,color:K.mute,textAlign:"center",maxWidth:280},children:"Your wallet rejected the signature or the rate expired. No funds were moved."})]})]}),P.jsxs(we,{gap:8,children:[P.jsx("button",{onClick:()=>t("quote"),style:ps,children:"Try again"}),P.jsx("button",{onClick:()=>e("connect"),style:kg,children:"Use a different payment method"})]})]})}const UL=new Set(["XRP","TON","STELLAR","NEAR"]),HL={BASE:"0x…",ETHEREUM:"0x…",ARBITRUM:"0x…",OPTIMISM:"0x…",POLYGON:"0x…",BSC:"0x…",AVALANCHE:"0x…",GNOSIS:"0x…",SCROLL:"0x…",XLAYER:"0x…",MONAD:"0x…",BERA:"0x…",SOLANA:"e.g. 5Gh8…base58",TRON:"T…",NEAR:"alice.near or 64-hex",TON:"UQ… / EQ…",SUI:"0x… (64 chars)",APTOS:"0x… (64 chars)",STARKNET:"0x…",BITCOIN:"bc1… or 1…",XRP:"r…",STELLAR:"G…",CARDANO:"addr1…",DOGE:"D…",LITECOIN:"ltc1… or L…",BCH:"bitcoincash:q… or q…",ZEC:"t1… or zs1…",DASH:"X…"},zL={"BASE:USDC":{chainId:8453,contract:"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",decimals:6},"OPTIMISM:USDC":{chainId:10,contract:"0x0b2C639c533813f4Aa9D7837CAf62653d097Ff85",decimals:6},"ARBITRUM:USDC":{chainId:42161,contract:"0xaf88d065e77c8cC2239327C5EDb3A432268e5831",decimals:6},"POLYGON:USDC":{chainId:137,contract:"0x3c499c542cEF5E3811e1192ce70d8cC03d5c3359",decimals:6}},WL=(e,t,n,r)=>{if(!e)return"";if(!t||!n||!r)return e;const i=zL[`${n.toUpperCase()}:${r.toUpperCase()}`];if(!i)return e;const s=Math.ceil(t*100)/100,o=BigInt(Math.round(s*10**i.decimals));return`ethereum:${i.contract}@${i.chainId}/transfer?address=${e}&uint256=${o.toString()}`};function GL({onNext:e,merchant:t,depositAddress:n,depositMemo:r,amountToSend:i,sourceToken:s,sourceChain:o,loading:a,error:c,onChainChange:u,ready:l,apiKey:d,orderId:f,preSelectedChainIdx:h,depositChains:m,currencies:y,fmtCur:w}){var pe,z;const[b,x]=ce.useState(""),[v,S]=ce.useState(h??null),[I,N]=ce.useState(!1),[j,U]=ce.useState(""),[L,Y]=ce.useState(""),[Z,G]=ce.useState(!1),[C,p]=ce.useState(!1),[g,k]=ce.useState(!1),R=j.trim()?m.map((D,ie)=>({c:D,i:ie})).filter(({c:D})=>{const ie=j.trim().toLowerCase();return D.name.toLowerCase().includes(ie)||D.token.toLowerCase().includes(ie)||D.network.toLowerCase().includes(ie)||D.id.toLowerCase().includes(ie)}):m.map((D,ie)=>({c:D,i:ie})),T=v!=null?m[v]:null,M=n??"",$=r??"",O=s??(T==null?void 0:T.token)??"",_=t.amount/(((pe=y[t.currency])==null?void 0:pe.rate)||((z=Ti[t.currency])==null?void 0:z.rate)||1),F=i??_,ue=WL(M,i,o,s),ne=ce.useRef(null),q=T?UL.has(T.id):!1,J=()=>{if(!T||!L.trim())return;const D=`${T.id}:${T.token}:${L.trim()}`;ne.current!==D&&(ne.current=D,G(!0),u(T.id,T.token,L.trim()))};ce.useEffect(()=>{G(!1),Y(""),ne.current=null},[v]),ce.useEffect(()=>{if(!f)return;let D=!1,ie;const de=async()=>{if(!D){try{const _e=await ju(d,f),Ae=String(_e.status??"").toLowerCase(),xe=String(_e.nearStatus??"").toLowerCase();x(xe);const Tt=Array.isArray(_e.steps)&&_e.steps.some($e=>($e==null?void 0:$e.provider)==="nearintents")&&xe==="processing";if(Ae&&Ae!=="awaiting_deposit"||Tt){D=!0,Ae==="completed"?e("success"):["failed","refunded"].includes(Ae)?e("error"):e("processing");return}}catch{}ie=setTimeout(de,5e3)}};return de(),()=>{D=!0,clearTimeout(ie)}},[d,f,e]);const te=()=>{var D;M&&((D=navigator.clipboard)==null||D.writeText(M),p(!0),setTimeout(()=>p(!1),1500))},le=()=>{var D;$&&((D=navigator.clipboard)==null||D.writeText($),k(!0),setTimeout(()=>k(!1),1500))};return I?P.jsxs(we,{gap:12,style:{padding:"16px 20px 6px"},children:[P.jsxs(we,{gap:8,children:[P.jsxs("button",{onClick:()=>{N(!1),U("")},style:{alignSelf:"flex-start",padding:"4px 0",background:"transparent",border:"none",cursor:"pointer",fontSize:12,color:K.mute,fontFamily:"inherit",display:"flex",alignItems:"center",gap:6},children:[P.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",children:P.jsx("path",{d:"M15 18L9 12L15 6",stroke:"currentColor",strokeWidth:"2.2",strokeLinecap:"round",strokeLinejoin:"round"})}),"Back"]}),P.jsx("div",{style:{fontSize:18,fontWeight:600,letterSpacing:-.3},children:"Select a network"}),P.jsx("div",{style:{fontSize:12.5,color:K.mute,lineHeight:1.5},children:"We'll generate a deposit address for the network you choose."})]}),P.jsxs("div",{style:{position:"relative"},children:[P.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",style:{position:"absolute",left:12,top:"50%",transform:"translateY(-50%)",pointerEvents:"none"},children:[P.jsx("circle",{cx:"11",cy:"11",r:"7",stroke:K.mute,strokeWidth:"2"}),P.jsx("path",{d:"M20 20L16 16",stroke:K.mute,strokeWidth:"2",strokeLinecap:"round"})]}),P.jsx("input",{autoFocus:!0,placeholder:"Search networks or tokens…",value:j,onChange:D=>U(D.target.value),style:{width:"100%",boxSizing:"border-box",padding:"10px 12px 10px 34px",borderRadius:10,border:`1px solid ${K.hair}`,background:"#fff",fontSize:13,fontFamily:"inherit",color:K.ink,outline:"none"}})]}),P.jsx("div",{style:{maxHeight:360,overflowY:"auto",border:`1px solid ${K.hair}`,borderRadius:10,background:"#fff",padding:4,display:"flex",flexDirection:"column",gap:1},children:R.length===0?P.jsxs("div",{style:{padding:"24px 10px",fontSize:12,color:K.mute,textAlign:"center"},children:['No matches for "',j.trim(),'"']}):R.map(({c:D,i:ie})=>P.jsxs("button",{onClick:()=>{S(ie),N(!1),U("")},style:{width:"100%",padding:"10px 10px",borderRadius:7,background:ie===v?K.accentSoft:"transparent",border:"none",cursor:"pointer",fontFamily:"inherit",display:"flex",alignItems:"center",gap:10,textAlign:"left"},children:[P.jsx(Ra,{bg:D.tint,size:24,children:D.logo?P.jsx("img",{src:D.logo,style:{width:"100%",height:"100%",borderRadius:"inherit",objectFit:"cover"}}):D.icon}),P.jsxs("div",{style:{flex:1},children:[P.jsxs("div",{style:{fontSize:13,fontWeight:500},children:[D.token," on ",D.name]}),P.jsx("div",{style:{fontSize:10.5,color:K.mute},children:D.network})]}),ie===v&&P.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",children:P.jsx("path",{d:"M5 12L10 17L19 7",stroke:K.accent,strokeWidth:"2.8",strokeLinecap:"round",strokeLinejoin:"round"})})]},`${D.id}:${D.token}`))})]}):P.jsxs(we,{gap:14,style:{padding:"16px 20px 6px"},children:[P.jsxs(we,{gap:4,children:[P.jsx("div",{style:{fontSize:18,fontWeight:600,letterSpacing:-.3},children:"Send from any wallet"}),P.jsx("div",{style:{fontSize:12.5,color:K.mute,lineHeight:1.5},children:"Scan the QR or copy the address. Send from a mobile wallet, exchange, or hardware device — we'll detect the deposit automatically."})]}),P.jsxs(we,{gap:6,children:[P.jsx("div",{style:{fontSize:11,color:K.mute,textTransform:"uppercase",letterSpacing:.6},children:"Network"}),P.jsx("button",{onClick:()=>N(!0),style:{padding:"10px 12px",borderRadius:10,border:`1px solid ${K.hair}`,background:"#fff",cursor:"pointer",fontFamily:"inherit",display:"flex",alignItems:"center",gap:10,textAlign:"left"},children:T?P.jsxs(P.Fragment,{children:[P.jsx(Ra,{bg:T.tint,size:26,children:T.logo?P.jsx("img",{src:T.logo,style:{width:"100%",height:"100%",objectFit:"cover"}}):T.icon}),P.jsxs(we,{gap:1,style:{flex:1},children:[P.jsxs("div",{style:{fontSize:13.5,fontWeight:500},children:[T.token," on ",T.name]}),P.jsx("div",{style:{fontSize:11,color:K.mute},children:T.network})]}),P.jsx("div",{style:{fontSize:11,color:K.mute},children:"Change"})]}):P.jsxs(P.Fragment,{children:[P.jsx("div",{style:{width:26,height:26,borderRadius:13,border:`1px dashed ${K.hair}`,background:K.panel,display:"flex",alignItems:"center",justifyContent:"center",color:K.mute,fontSize:13},children:"?"}),P.jsxs(we,{gap:1,style:{flex:1},children:[P.jsx("div",{style:{fontSize:13.5,fontWeight:500,color:K.ink},children:"Choose a network"}),P.jsx("div",{style:{fontSize:11,color:K.mute},children:"30+ chains supported · powered by NEAR Intents"})]}),P.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",children:P.jsx("path",{d:"M6 9L12 15L18 9",stroke:K.mute,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]})})]}),T?Z?P.jsxs(P.Fragment,{children:[P.jsxs("div",{style:{background:K.panel,border:`1px solid ${K.hair}`,borderRadius:12,padding:"16px",display:"flex",gap:14,alignItems:"center"},children:[P.jsx("div",{style:{padding:8,background:"#fff",borderRadius:10,border:`1px solid ${K.hair}`,flexShrink:0},children:ue?P.jsx(AL,{value:ue,size:120,level:"M",includeMargin:!1}):P.jsxs("div",{style:{width:120,height:120,borderRadius:12,background:K.panel,border:`1px dashed ${K.hair}`,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:10},children:[P.jsx("div",{className:"weaving-spinner"}),P.jsx("div",{style:{fontSize:10,color:K.mute,letterSpacing:.8,fontWeight:500,textTransform:"uppercase"},children:"Generating Address"})]})}),P.jsxs(we,{gap:8,style:{flex:1,minWidth:0},children:[P.jsxs(we,{gap:2,children:[P.jsx("div",{style:{fontSize:10.5,color:K.mute,textTransform:"uppercase",letterSpacing:.6},children:"Amount"}),P.jsx("div",{style:{fontSize:18,fontWeight:600,letterSpacing:-.3},children:a?P.jsx("span",{style:{color:K.mute,fontWeight:400},children:"Calculating…"}):P.jsxs(P.Fragment,{children:[$u(F)," ",O]})}),P.jsxs("div",{style:{fontSize:11,color:K.mute},children:["on ",T.name]})]}),P.jsxs("div",{style:{fontSize:10.5,color:K.mute,lineHeight:1.4},children:["Rate locked for ",P.jsx("span",{style:{color:K.ink,fontWeight:500},children:"9:42"})]})]})]}),P.jsxs(we,{gap:6,children:[P.jsx("div",{style:{fontSize:11,color:K.mute,textTransform:"uppercase",letterSpacing:.6},children:"Deposit address"}),P.jsxs("div",{style:{display:"flex",alignItems:"center",border:`1px solid ${K.hair}`,borderRadius:10,background:"#fff",overflow:"hidden"},children:[P.jsx("div",{style:{flex:1,padding:"10px 12px",fontFamily:"ui-monospace, SFMono-Regular, Menlo, monospace",fontSize:12.5,color:M?K.ink:K.mute,letterSpacing:-.2,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:a?"Generating address…":M||"—"}),P.jsx("button",{onClick:te,disabled:!M,style:{height:40,padding:"0 14px",border:"none",borderLeft:`1px solid ${K.hair}`,background:C?K.accentSoft:"#fff",color:C?K.accent:M?K.ink:K.mute,fontSize:12,fontWeight:500,cursor:M?"pointer":"not-allowed",fontFamily:"inherit",display:"flex",alignItems:"center",gap:6},children:C?P.jsxs(P.Fragment,{children:[P.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",children:P.jsx("path",{d:"M5 12L10 17L19 7",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round"})}),"Copied"]}):P.jsxs(P.Fragment,{children:[P.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",children:[P.jsx("rect",{x:"8",y:"8",width:"12",height:"12",rx:"2",stroke:"currentColor",strokeWidth:"2"}),P.jsx("path",{d:"M16 8V5C16 4.45 15.55 4 15 4H5C4.45 4 4 4.45 4 5V15C4 15.55 4.45 16 5 16H8",stroke:"currentColor",strokeWidth:"2"})]}),"Copy"]})})]}),c&&P.jsxs(we,{gap:6,children:[P.jsx("div",{style:{fontSize:11.5,color:K.err},children:c}),P.jsx("button",{onClick:()=>{G(!1),ne.current=null},style:{alignSelf:"flex-start",padding:"6px 10px",borderRadius:7,background:"transparent",border:`1px solid ${K.hair}`,cursor:"pointer",fontFamily:"inherit",fontSize:11.5,color:K.ink},children:"Edit refund address"})]})]}),($||q)&&P.jsxs(we,{gap:6,children:[P.jsxs("div",{style:{fontSize:11,color:K.mute,textTransform:"uppercase",letterSpacing:.6,display:"flex",alignItems:"center",gap:6},children:[T.id==="XRP"?"Destination tag":"Memo",P.jsx("span",{style:{fontSize:10,color:K.warn,fontWeight:600,letterSpacing:.4},children:"REQUIRED"})]}),P.jsxs("div",{style:{display:"flex",alignItems:"center",border:`1px solid ${K.hair}`,borderRadius:10,background:"#fff",overflow:"hidden"},children:[P.jsx("div",{style:{flex:1,padding:"10px 12px",fontFamily:"ui-monospace, SFMono-Regular, Menlo, monospace",fontSize:12.5,color:$?K.ink:K.mute,letterSpacing:-.2,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:a?"Generating memo…":$||"—"}),P.jsx("button",{onClick:le,disabled:!$,style:{height:40,padding:"0 14px",border:"none",borderLeft:`1px solid ${K.hair}`,background:g?K.accentSoft:"#fff",color:g?K.accent:$?K.ink:K.mute,fontSize:12,fontWeight:500,cursor:$?"pointer":"not-allowed",fontFamily:"inherit",display:"flex",alignItems:"center",gap:6},children:g?P.jsxs(P.Fragment,{children:[P.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",children:P.jsx("path",{d:"M5 12L10 17L19 7",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round"})}),"Copied"]}):P.jsxs(P.Fragment,{children:[P.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",children:[P.jsx("rect",{x:"8",y:"8",width:"12",height:"12",rx:"2",stroke:"currentColor",strokeWidth:"2"}),P.jsx("path",{d:"M16 8V5C16 4.45 15.55 4 15 4H5C4.45 4 4 4.45 4 5V15C4 15.55 4.45 16 5 16H8",stroke:"currentColor",strokeWidth:"2"})]}),"Copy"]})})]}),P.jsxs("div",{style:{fontSize:11,color:K.warn,lineHeight:1.5},children:["You must include this ",T.id==="XRP"?"destination tag":"memo"," when you send — without it the funds can't be credited and may be lost."]})]}),P.jsxs("div",{style:{background:K.warnSoft,border:`1px solid ${K.warn}22`,borderRadius:10,padding:"10px 12px",display:"flex",gap:10,fontSize:11.5,color:K.warn,lineHeight:1.5},children:[P.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",style:{flexShrink:0,marginTop:1},children:[P.jsx("path",{d:"M12 2L2 20H22L12 2Z",stroke:"currentColor",strokeWidth:"1.8",strokeLinejoin:"round"}),P.jsx("path",{d:"M12 10V13M12 16V16.01",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round"})]}),P.jsxs("span",{children:["Only send ",P.jsx("b",{children:T.token})," on the ",P.jsx("b",{children:T.name})," network. Sending other assets or from a different network may result in loss."]})]}),P.jsx("div",{style:{display:"flex",alignItems:"center",gap:10,padding:"10px 12px",background:b==="incomplete_deposit"?"#FFF5F5":"#fff",border:`1px solid ${b==="incomplete_deposit"?"#FFD1D1":K.hair}`,borderRadius:10},children:b==="incomplete_deposit"?P.jsx("div",{style:{flex:1,fontSize:12,color:"#D94E4E",fontWeight:500,lineHeight:1.4},children:"Partial payment received. Still waiting for the remaining balance to complete your order."}):P.jsxs(P.Fragment,{children:[P.jsxs("div",{style:{position:"relative",width:10,height:10},children:[P.jsx("div",{style:{position:"absolute",inset:0,borderRadius:5,background:K.accent}}),P.jsx("div",{style:{position:"absolute",inset:-3,borderRadius:8,background:K.accent,opacity:.25,animation:"wpulse 1.6s ease-in-out infinite"}})]}),P.jsxs("div",{style:{flex:1,fontSize:12,color:K.ink2},children:["Watching for deposit on ",T.name,"…"]})]})})]}):P.jsxs(we,{gap:10,children:[P.jsxs(we,{gap:6,children:[P.jsxs("label",{style:{fontSize:10.5,color:K.mute,textTransform:"uppercase",letterSpacing:.6},children:["Your refund wallet on ",T.name]}),P.jsx("input",{autoFocus:!0,placeholder:HL[T.id]??"Paste your wallet address",value:L,onChange:D=>Y(D.target.value),onKeyDown:D=>{D.key==="Enter"&&J()},style:{width:"100%",boxSizing:"border-box",padding:"11px 14px",borderRadius:10,border:`1px solid ${K.hair}`,background:"#fff",fontSize:13,fontFamily:"ui-monospace, SFMono-Regular, Menlo, monospace",color:K.ink,outline:"none",letterSpacing:-.2}}),P.jsxs("div",{style:{fontSize:11,color:K.mute,lineHeight:1.5},children:["If the swap fails or you send the wrong amount, funds are returned to this address. Must be a valid address on ",P.jsx("b",{children:T.name}),"."]})]}),P.jsx("button",{onClick:J,disabled:!L.trim(),style:{...ps,opacity:L.trim()?1:.5,cursor:L.trim()?"pointer":"not-allowed"},children:"Generate deposit address"})]}):P.jsx("div",{style:{background:K.panel,border:`1px dashed ${K.hair}`,borderRadius:12,padding:"28px 16px",textAlign:"center",fontSize:12.5,color:K.mute,lineHeight:1.5},children:"Pick a network above to generate your deposit address."})]})}const Ag={width:"100%",padding:"11px 14px",borderRadius:10,border:`1px solid ${K.hair}`,background:"#fff",fontSize:14,fontWeight:500,color:K.ink,fontFamily:"inherit",outline:"none",boxSizing:"border-box"};function qL({merchant:e,value:t,onChange:n,onSubmit:r,submitting:i,error:s}){const o=bw[e.currency]??[],a=t.institution.length>0&&t.accountIdentifier.trim().length>=8&&t.accountName.trim().length>=2;return P.jsxs(we,{gap:14,style:{padding:"16px 20px 6px"},children:[P.jsxs(we,{gap:4,children:[P.jsx("div",{style:{fontSize:18,fontWeight:600,letterSpacing:-.3},children:"Where should refunds go?"}),P.jsx("div",{style:{fontSize:12.5,color:K.mute,lineHeight:1.5},children:"If your payment can't be matched, we'll return the funds to this account. Must be in your name."})]}),P.jsxs(we,{gap:10,children:[P.jsxs(we,{gap:6,children:[P.jsx("label",{style:{fontSize:10.5,color:K.mute,textTransform:"uppercase",letterSpacing:.6},children:"Bank"}),P.jsxs("select",{value:t.institution,onChange:c=>n({...t,institution:c.target.value}),style:{...Ag,appearance:"none",backgroundImage:`url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none'><path d='M6 9L12 15L18 9' stroke='%236B7572' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/></svg>")`,backgroundRepeat:"no-repeat",backgroundPosition:"right 12px center",paddingRight:36},children:[P.jsx("option",{value:"",disabled:!0,children:"Select your bank…"}),o.map(c=>P.jsx("option",{value:c.code,children:c.name},c.code))]})]}),P.jsxs(we,{gap:6,children:[P.jsx("label",{style:{fontSize:10.5,color:K.mute,textTransform:"uppercase",letterSpacing:.6},children:"Account number"}),P.jsx("input",{inputMode:"numeric",placeholder:"0123456789",value:t.accountIdentifier,onChange:c=>n({...t,accountIdentifier:c.target.value.replace(/\D/g,"")}),style:{...Ag,fontFamily:"ui-monospace, SFMono-Regular, Menlo, monospace",letterSpacing:-.2}})]}),P.jsxs(we,{gap:6,children:[P.jsx("label",{style:{fontSize:10.5,color:K.mute,textTransform:"uppercase",letterSpacing:.6},children:"Account name"}),P.jsx("input",{placeholder:"Full name as it appears on your account",value:t.accountName,onChange:c=>n({...t,accountName:c.target.value}),style:Ag})]})]}),P.jsxs("div",{style:{background:K.panel,border:`1px solid ${K.hair}`,borderRadius:10,padding:"10px 12px",display:"flex",gap:10,fontSize:11.5,color:K.ink2,lineHeight:1.5},children:[P.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",style:{flexShrink:0,marginTop:1,color:K.mute},children:[P.jsx("circle",{cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"1.8"}),P.jsx("path",{d:"M12 8V13M12 16V16.01",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round"})]}),P.jsx("span",{children:"We only use this account if the payment fails. Refunds arrive within 1 business day."})]}),s&&P.jsx("div",{style:{background:"#FBEEE9",border:`1px solid ${K.err}33`,borderRadius:10,padding:"10px 12px",fontSize:12,color:K.err,lineHeight:1.5},children:s}),P.jsx("button",{onClick:r,disabled:!a||i,style:{...ps,opacity:a&&!i?1:.5,cursor:a&&!i?"pointer":"not-allowed"},children:i?"Creating payment…":"Continue"})]})}const VL={NGN:{bank:"Wema Bank",accountNumber:"8203 7461 92",accountName:"Weave / Afriloom-0481"}};function KL({onNext:e,merchant:t,bankDetails:n,apiKey:r,orderId:i,currencies:s,fmtCur:o}){const a=Ti[t.currency],c=n?{bank:ww(t.currency,n.institution),accountNumber:n.accountIdentifier,accountName:n.accountName}:VL[t.currency],u=n!=null&&n.amountToTransfer?(()=>{const x=n.amountToTransfer,v=x.includes(".")?x.split(".")[1].length:0;return o(Number(x),t.currency,v)})():o(t.amount,t.currency),[l,d]=ce.useState(null),[f,h]=ce.useState(9),[m,y]=ce.useState(42);ce.useEffect(()=>{const x=setInterval(()=>{y(v=>v>0?v-1:(h(S=>Math.max(0,S-1)),59))},1e3);return()=>clearInterval(x)},[]),ce.useEffect(()=>{if(!i)return;let x=!1,v;const S=async()=>{if(!x){try{const I=await ju(r,i),N=String(I.status??"").toLowerCase();if(N&&N!=="awaiting_deposit"){x=!0,N==="completed"?e("success"):["failed","refunded"].includes(N)?e("error"):e("processing");return}}catch{}v=setTimeout(S,5e3)}};return S(),()=>{x=!0,clearTimeout(v)}},[r,i,e]);const w=(x,v)=>{var S;(S=navigator.clipboard)==null||S.writeText(v),d(x),setTimeout(()=>d(null),1400)},b=({label:x,value:v,k:S,mono:I=!0})=>P.jsxs(rn,{justify:"space-between",style:{padding:"11px 14px"},children:[P.jsxs(we,{gap:2,style:{minWidth:0},children:[P.jsx("div",{style:{fontSize:10.5,color:K.mute,textTransform:"uppercase",letterSpacing:.6},children:x}),P.jsx("div",{style:{fontSize:14,fontWeight:500,color:K.ink,fontFamily:I?"ui-monospace, SFMono-Regular, Menlo, monospace":"inherit",letterSpacing:I?-.2:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:v})]}),P.jsx("button",{onClick:()=>w(S,v),style:{height:28,padding:"0 10px",borderRadius:7,border:`1px solid ${K.hair}`,background:l===S?K.accentSoft:"#fff",color:l===S?K.accent:K.ink,fontSize:11.5,fontWeight:500,cursor:"pointer",fontFamily:"inherit",display:"flex",alignItems:"center",gap:5},children:l===S?P.jsxs(P.Fragment,{children:[P.jsx("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",children:P.jsx("path",{d:"M5 12L10 17L19 7",stroke:"currentColor",strokeWidth:"3",strokeLinecap:"round",strokeLinejoin:"round"})}),"Copied"]}):"Copy"})]});return P.jsxs(we,{gap:14,style:{padding:"16px 20px 6px"},children:[P.jsxs(we,{gap:4,children:[P.jsxs(rn,{justify:"space-between",align:"flex-start",children:[P.jsxs("div",{style:{fontSize:18,fontWeight:600,letterSpacing:-.3},children:["Send ",u]}),P.jsxs(Fu,{tone:"warn",children:[P.jsxs("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",style:{marginRight:2},children:[P.jsx("circle",{cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"2"}),P.jsx("path",{d:"M12 7V12L15 14",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})]}),f,":",String(m).padStart(2,"0")]})]}),P.jsx("div",{style:{fontSize:12.5,color:K.mute,lineHeight:1.5},children:"Open your bank app and transfer to this account. We'll confirm your payment automatically — no need to send proof."})]}),P.jsxs("div",{style:{background:"#fff",border:`1px solid ${K.hair}`,borderRadius:12,overflow:"hidden"},children:[P.jsxs(rn,{gap:10,style:{padding:"12px 14px",background:K.panel,borderBottom:`1px solid ${K.hair}`},children:[P.jsx("div",{style:{width:28,height:28,borderRadius:14,background:"#fff",border:`1px solid ${K.hair}`,display:"flex",alignItems:"center",justifyContent:"center",fontSize:13,fontWeight:600,color:K.ink},children:a.flag}),P.jsxs(we,{gap:1,style:{flex:1},children:[P.jsx("div",{style:{fontSize:13,fontWeight:500},children:c.bank}),P.jsxs("div",{style:{fontSize:11,color:K.mute},children:["Virtual account · one-time · ",t.currency]})]})]}),P.jsx(b,{label:"Account number",value:c.accountNumber,k:"acc"}),P.jsx(Pa,{}),P.jsx(b,{label:"Account name",value:c.accountName,k:"name",mono:!1}),P.jsx(Pa,{}),P.jsx(b,{label:"Amount",value:u,k:"amt",mono:!1})]}),P.jsxs("div",{style:{background:K.warnSoft,border:`1px solid ${K.warn}22`,borderRadius:10,padding:"10px 12px",display:"flex",gap:10,fontSize:11.5,color:K.warn,lineHeight:1.5},children:[P.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",style:{flexShrink:0,marginTop:1},children:[P.jsx("path",{d:"M12 2L2 20H22L12 2Z",stroke:"currentColor",strokeWidth:"1.8",strokeLinejoin:"round"}),P.jsx("path",{d:"M12 10V13M12 16V16.01",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round"})]}),P.jsx("span",{children:"Send the exact amount. Any difference may delay delivery."})]})]})}function JL({onConnected:e,onExternalFlow:t}){const{connect:n,connectors:r,isPending:i}=hN(),{isConnected:s}=Zm();return ce.useEffect(()=>{s&&e()},[s]),P.jsxs(we,{gap:16,style:{padding:"22px 20px 6px"},children:[P.jsxs(we,{gap:4,children:[P.jsx("div",{style:{fontSize:18,fontWeight:600,letterSpacing:-.3},children:"Connect your wallet"}),P.jsx("div",{style:{fontSize:12.5,color:K.mute,lineHeight:1.5},children:"Pay directly from your crypto holdings. We'll handle the conversion."})]}),P.jsx(we,{gap:8,children:r.map(o=>{const a=o.name.toLowerCase(),c=a.includes("metamask")?"Browser extension or MetaMask mobile":a.includes("coinbase")?"Coinbase Wallet app or extension":a.includes("phantom")?"Phantom wallet extension":a.includes("brave")?"Brave browser built-in wallet":"Connect with this wallet";return P.jsxs("button",{onClick:()=>n({connector:o}),disabled:i,style:{...Du,opacity:i?.6:1},children:[P.jsx("div",{style:{width:40,height:40,borderRadius:10,background:K.panel,border:`1px solid ${K.hair}`,display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0,overflow:"hidden"},children:o.icon?P.jsx("img",{src:o.icon,alt:o.name,style:{width:28,height:28,borderRadius:6,objectFit:"contain"}}):P.jsxs("svg",{width:"22",height:"22",viewBox:"0 0 24 24",fill:"none",children:[P.jsx("rect",{x:"2",y:"6",width:"20",height:"14",rx:"3",stroke:K.ink2,strokeWidth:"1.8"}),P.jsx("path",{d:"M2 10H22",stroke:K.ink2,strokeWidth:"1.8"}),P.jsx("circle",{cx:"17",cy:"15",r:"1.5",fill:K.ink2})]})}),P.jsxs(we,{gap:2,style:{flex:1,textAlign:"left"},children:[P.jsx("div",{style:{fontSize:14,fontWeight:500},children:o.name}),P.jsx("div",{style:{fontSize:11.5,color:K.mute},children:c})]}),i?P.jsx("div",{style:{width:12,height:12,borderRadius:6,background:K.accent,opacity:.5,animation:"wpulse 1s infinite"}}):P.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",children:P.jsx("path",{d:"M9 6L15 12L9 18",stroke:K.mute,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]},o.uid)})}),P.jsx("button",{onClick:t,style:{background:"transparent",border:"none",cursor:"pointer",fontFamily:"inherit",fontSize:12,color:K.mute,padding:"4px 0",textAlign:"center"},children:"Don't have a browser wallet? Send from any app →"})]})}function ZL({onSelectToken:e,onExternalFlow:t,merchant:n,currencies:r,fmtCur:i,ethUsdPrice:s,loadingEthPrice:o}){var g,k;const{address:a,chainId:c}=Zm(),{switchChain:u,isPending:l}=yN(),d=c?N5[c]:void 0,f=c?L5[c]:void 0,h=c?EL.has(c):!1,m=c?Eg[c]??"Unknown":"Unknown",y=c?B5[c]??K.accent:K.accent,w=a?`${a.slice(0,6)}…${a.slice(-4)}`:"",{data:b,isLoading:x}=cg({address:a,chainId:c,query:{enabled:!!a}}),{data:v,isLoading:S}=cg({address:a,token:d,chainId:c,query:{enabled:!!a&&!!d}}),{data:I,isLoading:N}=cg({address:a,token:f,chainId:c,query:{enabled:!!a&&!!f}}),j=b?Number(dd(b.value)):0,U=v?Number(fa(v.value,v.decimals)):0,L=I?Number(fa(I.value,I.decimals)):0;if(o||x||S||N)return P.jsxs(we,{style:{padding:"60px 0",minHeight:280,alignItems:"center",justifyContent:"center"},children:[P.jsx(gf,{}),P.jsx("div",{style:{marginTop:16,fontSize:13,color:K.mute},children:"Fetching market rates…"})]});const Z=j*s,G=n.amount/(((g=r[n.currency])==null?void 0:g.rate)||1),C={ETH:"https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/info/logo.png",USDC:"https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48/logo.png",USDT:"https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0xdAC17F958D2ee523a2206206994597C13D831ec7/logo.png"},p=[{tokenKey:"USDC",token:"USDC",chain:m,amount:U,usd:U,icon:"$",chainTint:y,logo:C.USDC},...f?[{tokenKey:"USDT",token:"USDT",chain:m,amount:L,usd:L,icon:"$",chainTint:y,logo:C.USDT}]:[],{tokenKey:"ETH",token:"ETH",chain:m,amount:j,usd:Z,icon:"Ξ",chainTint:y,logo:C.ETH}];return h?P.jsxs(we,{gap:14,style:{padding:"18px 20px 6px"},children:[P.jsxs(rn,{justify:"space-between",align:"center",children:[P.jsxs(we,{gap:1,children:[P.jsx("div",{style:{fontSize:10.5,color:K.mute,textTransform:"uppercase",letterSpacing:.6},children:"Connected wallet"}),P.jsx("div",{style:{fontSize:13,fontWeight:500,color:K.ink,fontFamily:"ui-monospace, SFMono-Regular, Menlo, monospace"},children:w})]}),P.jsx(Fu,{tone:"accent",children:m})]}),P.jsxs("div",{style:{fontSize:12.5,color:K.mute,lineHeight:1.5},children:["Select a token to pay with. We'll bridge it to ",((k=r[n.currency])==null?void 0:k.name)??n.currency," automatically."]}),P.jsx(we,{gap:6,children:p.map(R=>{const T=R.usd>=G;return P.jsxs("button",{onClick:()=>T&&e(R.tokenKey,R),disabled:!T,style:{...Du,opacity:T?1:.42,cursor:T?"pointer":"not-allowed"},children:[P.jsx("div",{style:{width:36,height:36,borderRadius:9,flexShrink:0,background:R.chainTint+"22",border:`1px solid ${R.chainTint}44`,display:"flex",alignItems:"center",justifyContent:"center",fontWeight:700,fontSize:15,color:R.chainTint,overflow:"hidden"},children:R.logo?P.jsx("img",{src:R.logo,style:{width:"100%",height:"100%",objectFit:"cover"}}):R.icon}),P.jsxs(we,{gap:2,style:{flex:1,textAlign:"left"},children:[P.jsxs("div",{style:{fontSize:14,fontWeight:500},children:[$u(R.amount,R.tokenKey==="ETH"?4:2)," ",R.tokenKey]}),P.jsxs("div",{style:{fontSize:11.5,color:K.mute},children:["≈ $",R.usd.toFixed(2)," on ",m]})]}),T?P.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",children:P.jsx("path",{d:"M9 6L15 12L9 18",stroke:K.mute,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}):P.jsx(Fu,{tone:"warn",children:"Insufficient"})]},R.tokenKey)})}),P.jsx("button",{onClick:t,style:{background:"transparent",border:"none",cursor:"pointer",fontFamily:"inherit",fontSize:12,color:K.mute,textAlign:"center",padding:"2px 0"},children:"Pay from another wallet or exchange →"})]}):P.jsxs(we,{gap:14,style:{padding:"22px 20px 6px"},children:[P.jsxs(we,{gap:4,children:[P.jsx("div",{style:{fontSize:18,fontWeight:600,letterSpacing:-.3},children:"Switch Network"}),P.jsx("div",{style:{fontSize:12.5,color:K.mute,lineHeight:1.5},children:"Your wallet is on an unsupported chain. Switch to one of these to continue."})]}),P.jsx(we,{gap:6,children:[8453,10,42161,1,137].map(R=>P.jsxs("button",{onClick:()=>u({chainId:R}),disabled:l,style:{...Du,opacity:l?.6:1},children:[P.jsx("div",{style:{width:32,height:32,borderRadius:8,flexShrink:0,background:B5[R],color:"#fff",display:"flex",alignItems:"center",justifyContent:"center",fontWeight:700,fontSize:13},children:Eg[R][0]}),P.jsx("div",{style:{fontSize:13,fontWeight:500},children:Eg[R]}),P.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",style:{marginLeft:"auto"},children:P.jsx("path",{d:"M9 6L15 12L9 18",stroke:K.mute,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]},R))})]})}function YL({onRetry:e}){return P.jsxs(we,{gap:20,style:{padding:"40px 20px 20px",minHeight:280,alignItems:"center",justifyContent:"center"},children:[P.jsx(gf,{}),P.jsxs(we,{gap:6,style:{alignItems:"center"},children:[P.jsx("div",{style:{fontSize:17,fontWeight:600,letterSpacing:-.3},children:"Confirm in your wallet"}),P.jsx("div",{style:{fontSize:12.5,color:K.mute,textAlign:"center",maxWidth:260,lineHeight:1.6},children:"Check your wallet extension or app and approve the transaction to send funds."}),P.jsx("button",{onClick:e,style:{...kg,marginTop:12,fontSize:13,padding:"8px 16px"},children:"Not seeing the pop-up? Try again"})]})]})}const QL={name:"Afriloom Textiles",amount:700,currency:"NGN"},Ig={Base:"BASE",Optimism:"OPTIMISM",Ethereum:"ETHEREUM",Arbitrum:"ARBITRUM",Polygon:"POLYGON"},XL=new F7;function ej({merchant:e=QL,apiKey:t,userAddress:n,theme:r="organic",borderRadius:i=16,accentColor:s,onSuccess:o,onError:a,onClose:c,apiBase:u,disabledMethods:l}){u&&typeof window<"u"&&(window.__WEAVE_API_BASE__=u);const d=t??(typeof window<"u"?window.__WEAVE_API_KEY__:void 0)??"pk_live_72a9e3afde82acf51db54bbcaa65832f4b549c56294fe88f"??"pk_test_demo",f=n??"0x2B4fB6F7255DeF56d985fb01134ab1431Efbd3be"??"0x0000000000000000000000000000000000000000",{address:h,chainId:m,isConnected:y}=Zm(),{disconnect:w}=mN(),b=()=>{w(),localStorage.clear()},{writeContractAsync:x}=bN(),{sendTransactionAsync:v}=gN(),[S,I]=ce.useState("connect"),[N,j]=ce.useState("offramp"),[U,L]=ce.useState(0),[Y,Z]=ce.useState(null),[G,C]=ce.useState(!1),[p,g]=ce.useState({institution:"",accountIdentifier:"",accountName:""}),[k,R]=ce.useState(null),[T,M]=ce.useState(null),[$,O]=ce.useState(null),[_,F]=ce.useState(null),[ue,ne]=ce.useState(null),[q,J]=ce.useState(null),[te,le]=ce.useState(null),[pe,z]=ce.useState(null),[D,ie]=ce.useState(!1),[de,_e]=ce.useState(null),[Ae,xe]=ce.useState(null),[Ge,Tt]=ce.useState(!1),[$e,Qe]=ce.useState(!1),[At,Fe]=ce.useState(null),[Xe,Lt]=ce.useState({fiat:L0,crypto:gw}),De=ce.useRef(0),B=ce.useRef(0),E=ce.useRef(null),[A,H]=ce.useState(()=>typeof navigator<"u"?navigator.onLine:!0);ce.useEffect(()=>{const be=()=>H(!0),W=()=>H(!1);return window.addEventListener("online",be),window.addEventListener("offline",W),()=>{window.removeEventListener("online",be),window.removeEventListener("offline",W)}},[]);const[Q,X]=ce.useState("USDC"),[re,Me]=ce.useState(null),[Oe,Te]=ce.useState(3400),[ot,Ce]=ce.useState(!0);ce.useEffect(()=>{const be=localStorage.getItem(`weave-order-${d}`);if(be)try{const{orderId:W,screen:se,createdAt:ae}=JSON.parse(be);Date.now()-ae<1*60*60*1e3&&ju(d,W).then(fe=>{var ye;const Se=fe,Ee=RI(Se.sourceAssetKey,Se.destAssetKey);if(j(Ee==="onramp"?"onramp":"offramp"),["awaiting_deposit","processing"].includes(Se.status)){R(Se.id);const ke=Se.steps.find(He=>He.status!=="done")||Se.steps[0];if(Ee==="onramp")(ke==null?void 0:ke.provider)==="paycrest"&&(ke.depositAddress||ke.amountOut)?(((ye=Se.sourceInstrument)==null?void 0:ye.kind)==="bank_account"&&M({accountName:Se.sourceInstrument.bankAccountName||"",accountIdentifier:Se.sourceInstrument.bankAccountIdentifier||"",institution:Se.sourceInstrument.bankInstitution||"",currency:Se.destAssetKey.split(":").pop()||"NGN",amountToTransfer:Se.sourceAmount.toString()}),I("vaccount")):I("processing");else if((ke==null?void 0:ke.provider)==="nearintents"&&Se.status==="awaiting_deposit"){F(ke.depositAddress),ne(ke.depositMemo),J(Number(ke.amountIn));const He=ke.fromAsset.split(":");le(He[2]||He[1]),z(He[1]),I("deposit")}else I("processing")}else Se.status==="completed"?(R(Se.id),I("success")):localStorage.removeItem(`weave-order-${d}`)}).catch(()=>{localStorage.removeItem(`weave-order-${d}`)})}catch{localStorage.removeItem(`weave-order-${d}`)}if(SL(d).then(W=>{W&&Lt(W)}).catch(()=>{}),e.sourceAssetKey&&e.amountIn==="source"){const W=Xe.crypto.findIndex(se=>{var ae;return`${se.id}:${se.token}`===((ae=e.sourceAssetKey)==null?void 0:ae.split("crypto:")[1])});W!==-1&&(Z(W),j("offramp"),I("deposit"))}},[d]),ce.useEffect(()=>{d&&(Ce(!0),Lu(d,{from:"crypto:ETHEREUM:ETH",to:co(e.currency),amount:1,amountIn:"source"}).then(be=>{const W=Xe.fiat.find(fe=>fe.key===co(e.currency)),se=(W==null?void 0:W.rate)||1515,ae=be.estimatedDest/se;!isNaN(ae)&&ae>0&&Te(ae),Ce(!1)}).catch(be=>{console.warn("[WeaveCheckoutInner] Live ETH price fetch failed:",be),Ce(!1)}))},[d,e.currency,Xe.fiat]),ce.useEffect(()=>{k&&!["success","error"].includes(S)?localStorage.setItem(`weave-order-${d}`,JSON.stringify({orderId:k,screen:S,createdAt:Date.now()})):S==="success"&&localStorage.removeItem(`weave-order-${d}`)},[k,S,d]);const Ue=Xe.fiat.reduce((be,W)=>{const se=W.key.split(":").pop();return be[se]={name:W.name,symbol:W.symbol,flag:W.flag,rate:W.rate,min:W.min,country:W.country,psp:"GTBank",bank:"GTBank ••7890",method:"Bank transfer"},be},{}),Dn=Xe.crypto,qe=(be,W,se)=>{const ae=Ue[W]||Ti[W];if(!ae)return`${W} ${be}`;const Se=!!ae?0:4,Ee=se??(Number.isInteger(be)?0:Se),ye=Math.pow(10,Ee),ke=Ee>0?Math.ceil(be*ye)/ye:Math.ceil(be),He=new Intl.NumberFormat("en-US",{minimumFractionDigits:Ee,maximumFractionDigits:Ee}).format(ke);return`${ae.symbol}${He}`},ut=be=>{Fe(null),R(null),F(null),ne(null),_e(null),M(null),xe(null),Me(null),be==="fiat"?(j("onramp"),e.currency==="NGN"&&e.destAssetKey==="fiat:NGN"?lt():I("refundAccount")):be==="crypto"?(j("offramp"),I("wallet")):be==="deposit"?(j("offramp"),I(y?"walletAsset":"walletConnect")):be==="externalDeposit"&&(j("offramp"),I("deposit"))},zr=async(be,W,se)=>{const ae=++De.current;ie(!0),_e(null),F(null),ne(null),J(null),le(null),z(null);try{const fe=hf(be,W),Se=e.destAssetKey||co(e.currency),Ee=e.amountIn??"dest";let ye=e.amount;Se.startsWith("crypto:")&&e.currency==="NGN"&&(ye=(await Lu(d,{from:co(e.currency),to:Se,amount:e.amount,amountIn:"source"})).estimatedDest);const ke=await Lu(d,{from:fe,to:Se,amount:ye,amountIn:Ee}),He={inline:{kind:"crypto_wallet",assetKey:fe,walletAddress:""}};E.current??(E.current="weave_"+Math.random().toString(36).slice(2)+Date.now().toString(36));const Ve=await xg(d,{source:He,amount:ye,amountIn:Ee,refundAddress:se,reference:E.current,dest:e.destInstrument?{inline:{...e.destInstrument,assetKey:Se}}:void 0});if(De.current!==ae)return;E.current=null,R(Ve.order.id),F(Ve.nextAction.depositAddress??null),ne(Ve.nextAction.depositMemo??null),M(Ve.nextAction.bankDetails??null),J(typeof Ve.nextAction.amount=="number"?Ve.nextAction.amount:null),le(Ve.nextAction.token??W),z(Ve.nextAction.chain??be)}catch(fe){if(De.current!==ae)return;_e(fe.message??"Could not generate a deposit address"),a==null||a(fe)}finally{De.current===ae&&ie(!1)}},bt=async()=>{I("quote");const be=mf[U??0],W=++B.current;Tt(!0),xe(null);try{const se=await Lu(d,{from:hf(Ig[be.chain]??be.chain,be.token),to:co(e.currency),amount:e.amount,amountIn:"dest"});if(B.current!==W)return;xe({estimatedFiat:se.estimatedDest,netUsdc:se.breakdown.netUsd,fiatCurrency:e.currency,breakdown:{inputAmount:se.breakdown.usdEquivalent,inputToken:be.token,fastPath:se.route.steps.length===1,bridgeFeeUsd:se.breakdown.bridgeFeeUsd,senderFeeUsd:se.breakdown.senderFeeUsd,appFeeUsd:se.breakdown.appFeeUsd,sellRate:se.breakdown.sellRate??0}})}catch{}finally{B.current===W&&Tt(!1)}},ht=async(be,W)=>{if(Me(be),X(W),I("quote"),!m)return;const se=M5[m];if(!se)return;const ae=++B.current;Tt(!0),xe(null);try{const fe=await Lu(d,{from:hf(se,W),to:co(e.currency),amount:e.amount,amountIn:"dest"});if(B.current!==ae)return;xe({estimatedFiat:fe.estimatedDest,netUsdc:fe.breakdown.netUsd,fiatCurrency:e.currency,breakdown:{inputAmount:fe.breakdown.usdEquivalent,inputToken:W,fastPath:fe.route.steps.length===1,bridgeFeeUsd:fe.breakdown.bridgeFeeUsd,senderFeeUsd:fe.breakdown.senderFeeUsd,appFeeUsd:fe.breakdown.appFeeUsd,sellRate:fe.breakdown.sellRate??0}})}catch{}finally{B.current===ae&&Tt(!1)}},Cn=be=>{be==="success"&&o&&k&&o({orderId:k,status:"completed"}),I(be)},lt=async be=>{var W;Qe(!0),Fe(null);try{const se={inline:{kind:"bank_account",assetKey:co(e.currency),bankInstitution:p.institution,bankAccountIdentifier:p.accountIdentifier,bankAccountName:p.accountName}};E.current??(E.current="weave_"+Math.random().toString(36).slice(2)+Date.now().toString(36));const ae=await xg(d,{source:se,amount:e.amount,reference:E.current,dest:e.destInstrument?{inline:{...e.destInstrument,assetKey:e.destAssetKey||e.destInstrument.assetKey}}:void 0,amountIn:(W=e.destAssetKey)!=null&&W.startsWith("fiat:")?"dest":void 0});E.current=null,R(ae.order.id),M(ae.nextAction.bankDetails??null),O(ae.nextAction.paystackPopupDetails??null);const fe=ae.nextAction.screen==="paystack_popup"?"paystack_popup":"vaccount";I(fe)}catch(se){Fe(se.message??"Failed to create order"),a==null||a(se)}finally{Qe(!1)}},pt=()=>lt(),Wr=async()=>{if($e)return;const be=re??mf[U??0],W=y&&h&&m&&re;Qe(!0),Fe(null);try{let se=k,ae=_,fe=q;if(!se||!ae){const Se=W?M5[m]??Ig[be.chain]??be.chain:Ig[be.chain]??be.chain,Ee=W?Q:be.token,ke={inline:{kind:"crypto_wallet",assetKey:hf(Se,Ee),walletAddress:W?h:f}};E.current??(E.current="weave_"+Math.random().toString(36).slice(2)+Date.now().toString(36));const He=await xg(d,{source:ke,amount:e.amount,amountIn:"dest",flow:W?"self":void 0,reference:E.current,dest:e.destInstrument?{inline:{...e.destInstrument,assetKey:e.destAssetKey||e.destInstrument.assetKey}}:void 0});E.current=null,se=He.order.id,ae=He.nextAction.depositAddress??null,fe=He.order.sourceAmount,R(se),F(ae),J(fe),le(He.nextAction.token??Ee),z(He.nextAction.chain??Se)}if(W&&ae){I("walletSign");const Se=Q,Ee=fe;let ye;if(Se==="ETH")ye=await v({to:ae,value:E9(Ee.toString()),chainId:m});else{const ke=Se==="USDC"?N5[m]:L5[m];if(!ke)throw new Error(`${Se} is not available on this chain`);ye=await x({address:ke,abi:kL,functionName:"transfer",args:[ae,X_(Ee.toString(),6)],chainId:m})}try{await MB(O5,{hash:ye,timeout:6e4})}catch(ke){console.warn("[widget] transaction wait timed out or failed:",ke.message)}}else F(ae);I("processing")}catch(se){const ae=se.message??"",fe=ae.toLowerCase().includes("reject")||ae.toLowerCase().includes("denied")||ae.toLowerCase().includes("cancelled");Fe(fe?"Transaction was rejected. Please try again.":ae||"Failed to complete payment"),S==="walletSign"&&I("quote"),a==null||a(se)}finally{Qe(!1)}};if(G)return P.jsxs("div",{style:{position:"absolute",bottom:24,right:24,zIndex:10,background:K.ink,color:"#fff",padding:"10px 16px",borderRadius:999,fontSize:13,display:"flex",alignItems:"center",gap:8,cursor:"pointer",boxShadow:"0 10px 30px rgba(0,0,0,0.25)",minWidth:"185px"},onClick:()=>C(!1),children:[P.jsx(Sg,{size:16}),"Pay with Weave"]});const dt=mf[U??0],at=N==="onramp",er=be=>{E.current=null,R(null),Fe(null),M(null),O(null),F(null),ne(null),_e(null),xe(null),Me(null),I(be)},wt=(()=>{if(S==="connect")return P.jsx(NL,{onPick:ut,merchant:e,currencies:Ue,fmtCur:qe,submitting:$e,disabledMethods:l});if(at){if(S==="refundAccount")return P.jsx(qL,{merchant:e,value:p,onChange:g,onSubmit:pt,submitting:$e,error:At});if(S==="vaccount")return P.jsx(KL,{onNext:Cn,merchant:e,bankDetails:T,apiKey:d,orderId:k,currencies:Ue,fmtCur:qe});if(S==="paystack_popup")return P.jsx($L,{onNext:Cn,details:$});if(S==="processing")return P.jsx($5,{onNext:Cn,merchant:e,mode:"fiat",apiKey:d,orderId:k,bankDetails:T,currencies:Ue,fmtCur:qe});if(S==="success")return P.jsx(F5,{onNext:Cn,balance:dt,merchant:e,direction:N,apiKey:d,orderId:k,accentColor:s,currencies:Ue,fmtCur:qe});if(S==="error")return P.jsx(D5,{onNext:()=>er("connect"),onBack:()=>er("refundAccount")})}else{if(S==="walletConnect")return P.jsx(JL,{onConnected:()=>I("walletAsset"),onExternalFlow:()=>{j("offramp"),I("deposit")}});if(S==="walletAsset")return P.jsx(ZL,{onSelectToken:(be,W)=>ht(W,be),onExternalFlow:()=>I("deposit"),merchant:e,currencies:Ue,fmtCur:qe,ethUsdPrice:Oe,loadingEthPrice:ot});if(S==="walletSign")return P.jsx(YL,{onRetry:Wr});if(S==="deposit")return P.jsx(GL,{onNext:Cn,merchant:e,depositAddress:_,depositMemo:ue,amountToSend:q,sourceToken:te,sourceChain:pe,loading:D,error:de,onChainChange:zr,ready:!!k&&!!_&&!D,apiKey:d,orderId:k,preSelectedChainIdx:Y,depositChains:Dn,currencies:Ue,fmtCur:qe});if(S==="wallet")return P.jsx(LL,{onNext:()=>bt(),merchant:e,balances:mf,selected:U,setSelected:L,currencies:Ue});if(S==="quote")return P.jsx(jL,{merchant:e,balance:re??dt,onConfirm:Wr,submitting:$e,error:At,quote:Ae,quoteLoading:Ge,currencies:Ue,fmtCur:qe});if(S==="processing")return P.jsx($5,{onNext:Cn,merchant:e,mode:"crypto",apiKey:d,orderId:k,currencies:Ue,fmtCur:qe});if(S==="success")return P.jsx(F5,{onNext:Cn,balance:dt,merchant:e,direction:N,apiKey:d,orderId:k,accentColor:s,currencies:Ue,fmtCur:qe});if(S==="error")return P.jsx(D5,{onNext:()=>er("connect"),onBack:()=>er("quote")})}return null})(),vt=["wallet","quote","deposit","walletConnect","walletAsset","walletSign"].includes(S)&&!at||["refundAccount","vaccount"].includes(S)&&at,hi=S==="quote"?re?"walletAsset":"wallet":S==="vaccount"?"refundAccount":S==="walletAsset"?"connect":S==="walletSign"?"quote":"connect";return P.jsxs("div",{className:`weave-checkout weave-theme-${r}`,style:{"--weave-accent":pf[s]||s||"#0F5D4C","--weave-accent-soft":(pf[s]||s||"#0F5D4C")+"15",width:400,background:K.surface,borderRadius:i,boxShadow:"0 30px 80px rgba(11, 15, 14, 0.22), 0 0 0 1px rgba(0,0,0,0.04)",overflow:"hidden",fontFamily:"Inter, -apple-system, BlinkMacSystemFont, sans-serif",color:K.ink,animation:"wslide 0.35s cubic-bezier(0.2, 1, 0.3, 1)"},children:[P.jsx(OL,{merchantName:e.name,onClose:()=>{C(!0),c==null||c()},showBack:vt,onBack:()=>{S==="walletAsset"&&b(),I(hi)}}),!A&&P.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,padding:"8px 16px",background:K.warnSoft,color:K.warn,fontSize:12,fontWeight:500},children:[P.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.2",strokeLinecap:"round",strokeLinejoin:"round",children:[P.jsx("path",{d:"M1 6l5.5 5.5M17 6l-5.5 5.5M12 20v.01"}),P.jsx("path",{d:"M5 10l-4-4M23 2L1 22"})]}),"No connection — your payment is safe, reconnecting…"]}),P.jsx("div",{style:{animation:"wfade 0.25s ease"},children:wt},S),P.jsx(ML,{})]})}function tj(e){return P.jsx(IL,{config:O5,children:P.jsx(CL,{client:XL,children:P.jsx(ej,{...e})})})}const cn={ink:"#0B0F0E",ink2:"#3A4240",mute:"#6B7572",hair:"#E8EAE6",page:"#F5F4EF"},nj={NGN:"₦"},yf=(e,t)=>`${nj[t]??""}${new Intl.NumberFormat("en-US",{maximumFractionDigits:0}).format(e)}`;function rj({currency:e="NGN",amount:t=15e4}){const n=[{name:"Ẹ̀wà Handwoven Throw",sub:"Indigo / 150 × 200cm",price:12e4},{name:"Aso-Oke Runner",sub:"Earth / 35 × 180cm",price:25e3}];return P.jsxs("div",{style:{position:"absolute",inset:0,background:cn.page,fontFamily:"Inter, -apple-system, sans-serif",color:cn.ink,overflow:"hidden"},children:[P.jsxs("div",{style:{height:56,padding:"0 32px",borderBottom:`1px solid ${cn.hair}`,display:"flex",alignItems:"center",background:"#fff"},children:[P.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10},children:[P.jsx("div",{style:{width:26,height:26,borderRadius:6,background:"#2B1810",color:"#F5DEB3",display:"flex",alignItems:"center",justifyContent:"center",fontWeight:700,fontSize:13,fontFamily:"Georgia, serif"},children:"A"}),P.jsx("span",{style:{fontWeight:600,fontSize:14,letterSpacing:-.1},children:"Afriloom"}),P.jsx("span",{style:{color:cn.mute,fontSize:13,marginLeft:16},children:"Shop · Journal · About"})]}),P.jsxs("div",{style:{marginLeft:"auto",display:"flex",gap:14,fontSize:13,color:cn.ink2},children:[P.jsx("span",{children:"Search"}),P.jsx("span",{children:"Account"}),P.jsx("span",{children:"Cart (2)"})]})]}),P.jsxs("div",{style:{display:"flex",padding:"32px 32px",gap:40,height:"calc(100% - 56px)"},children:[P.jsxs("div",{style:{flex:"0 0 340px"},children:[P.jsx("div",{style:{fontSize:11,color:cn.mute,textTransform:"uppercase",letterSpacing:.8,marginBottom:14},children:"Order summary"}),n.map((r,i)=>P.jsxs("div",{style:{display:"flex",gap:14,padding:"12px 0",borderBottom:`1px solid ${cn.hair}`},children:[P.jsx("div",{style:{width:60,height:72,borderRadius:6,flexShrink:0,background:i===0?"repeating-linear-gradient(90deg, #2D3E60 0 6px, #1F2D45 6px 12px, #3A4F75 12px 16px)":"repeating-linear-gradient(0deg, #8B6D47 0 4px, #6B5236 4px 8px, #A8855D 8px 14px)"}}),P.jsxs("div",{style:{flex:1,fontSize:12.5},children:[P.jsx("div",{style:{fontWeight:500},children:r.name}),P.jsx("div",{style:{color:cn.mute,fontSize:11.5,marginTop:2},children:r.sub}),P.jsx("div",{style:{marginTop:4},children:yf(r.price,e)})]})]},i)),P.jsxs("div",{style:{padding:"12px 0",fontSize:12.5,display:"flex",flexDirection:"column",gap:6},children:[P.jsxs("div",{style:{display:"flex",justifyContent:"space-between",color:cn.mute},children:[P.jsx("span",{children:"Subtotal"}),P.jsx("span",{children:yf(145e3,e)})]}),P.jsxs("div",{style:{display:"flex",justifyContent:"space-between",color:cn.mute},children:[P.jsx("span",{children:"Shipping"}),P.jsx("span",{children:yf(5e3,e)})]}),P.jsxs("div",{style:{display:"flex",justifyContent:"space-between",fontWeight:600,fontSize:14,marginTop:6,color:cn.ink},children:[P.jsx("span",{children:"Total"}),P.jsx("span",{children:yf(t,e)})]})]})]}),P.jsxs("div",{style:{flex:1,maxWidth:440},children:[P.jsx("div",{style:{fontSize:11,color:cn.mute,textTransform:"uppercase",letterSpacing:.8,marginBottom:14},children:"Payment"}),P.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:10,opacity:.4},children:[P.jsx("div",{style:{height:42,border:`1px solid ${cn.hair}`,borderRadius:8,background:"#fff",display:"flex",alignItems:"center",padding:"0 14px",fontSize:13,color:cn.mute},children:"Email"}),P.jsx("div",{style:{height:42,border:`1px solid ${cn.hair}`,borderRadius:8,background:"#fff",display:"flex",alignItems:"center",padding:"0 14px",fontSize:13,color:cn.mute},children:"Card number"}),P.jsxs("div",{style:{display:"flex",gap:10},children:[P.jsx("div",{style:{flex:1,height:42,border:`1px solid ${cn.hair}`,borderRadius:8,background:"#fff"}}),P.jsx("div",{style:{flex:1,height:42,border:`1px solid ${cn.hair}`,borderRadius:8,background:"#fff"}})]})]})]})]}),P.jsx("div",{style:{position:"absolute",inset:0,background:"rgba(11, 15, 14, 0.35)",backdropFilter:"blur(1px)"}})]})}function U5(e,t){let n;try{n=e()}catch{return}return{getItem:i=>{var s;const o=c=>c===null?null:JSON.parse(c,void 0),a=(s=n.getItem(i))!=null?s:null;return a instanceof Promise?a.then(o):o(a)},setItem:(i,s)=>n.setItem(i,JSON.stringify(s,void 0)),removeItem:i=>n.removeItem(i)}}const Cg=e=>t=>{try{const n=e(t);return n instanceof Promise?n:{then(r){return Cg(r)(n)},catch(r){return this}}}catch(n){return{then(r){return this},catch(r){return Cg(r)(n)}}}},ij=(e,t)=>(n,r,i)=>{let s={storage:U5(()=>localStorage),partialize:y=>y,version:0,merge:(y,w)=>({...w,...y}),...t},o=!1;const a=new Set,c=new Set;let u=s.storage;if(!u)return e((...y)=>{console.warn(`[zustand persist middleware] Unable to update item '${s.name}', the given storage is currently unavailable.`),n(...y)},r,i);const l=()=>{const y=s.partialize({...r()});return u.setItem(s.name,{state:y,version:s.version})},d=i.setState;i.setState=(y,w)=>{d(y,w),l()};const f=e((...y)=>{n(...y),l()},r,i);i.getInitialState=()=>f;let h;const m=()=>{var y,w;if(!u)return;o=!1,a.forEach(x=>{var v;return x((v=r())!=null?v:f)});const b=((w=s.onRehydrateStorage)==null?void 0:w.call(s,(y=r())!=null?y:f))||void 0;return Cg(u.getItem.bind(u))(s.name).then(x=>{if(x)if(typeof x.version=="number"&&x.version!==s.version){if(s.migrate){const v=s.migrate(x.state,x.version);return v instanceof Promise?v.then(S=>[!0,S]):[!0,v]}console.error("State loaded from storage couldn't be migrated since no migrate function was provided")}else return[!1,x.state];return[!1,void 0]}).then(x=>{var v;const[S,I]=x;if(h=s.merge(I,(v=r())!=null?v:f),n(h,!0),S)return l()}).then(()=>{b==null||b(h,void 0),h=r(),o=!0,c.forEach(x=>x(h))}).catch(x=>{b==null||b(void 0,x)})};return i.persist={setOptions:y=>{s={...s,...y},y.storage&&(u=y.storage)},clearStorage:()=>{u==null||u.removeItem(s.name)},getOptions:()=>s,rehydrate:()=>m(),hasHydrated:()=>o,onHydrate:y=>(a.add(y),()=>{a.delete(y)}),onFinishHydration:y=>(c.add(y),()=>{c.delete(y)})},s.skipHydration||m(),h||f},H5=e=>{let t;const n=new Set,r=(u,l)=>{const d=typeof u=="function"?u(t):u;if(!Object.is(d,t)){const f=t;t=l??(typeof d!="object"||d===null)?d:Object.assign({},t,d),n.forEach(h=>h(t,f))}},i=()=>t,a={setState:r,getState:i,getInitialState:()=>c,subscribe:u=>(n.add(u),()=>n.delete(u))},c=t=e(r,i,a);return a},Pg=e=>e?H5(e):H5;var bf,Ct,z5,uo,W5,G5,Rg,Tg,Og,Mg,Uu={},q5=[],sj=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,Bg=Array.isArray;function ms(e,t){for(var n in t)e[n]=t[n];return e}function V5(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function gt(e,t,n){var r,i,s,o={};for(s in t)s=="key"?r=t[s]:s=="ref"?i=t[s]:o[s]=t[s];if(arguments.length>2&&(o.children=arguments.length>3?bf.call(arguments,2):n),typeof e=="function"&&e.defaultProps!=null)for(s in e.defaultProps)o[s]===void 0&&(o[s]=e.defaultProps[s]);return wf(e,o,r,i,null)}function wf(e,t,n,r,i){var s={type:e,props:t,key:n,ref:r,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,constructor:void 0,__v:i??++z5,__i:-1,__u:0};return i==null&&Ct.vnode!=null&&Ct.vnode(s),s}function vf(e){return e.children}function _f(e,t){this.props=e,this.context=t}function Ta(e,t){if(t==null)return e.__?Ta(e.__,e.__i+1):null;for(var n;t<e.__k.length;t++)if((n=e.__k[t])!=null&&n.__e!=null)return n.__e;return typeof e.type=="function"?Ta(e):null}function K5(e){var t,n;if((e=e.__)!=null&&e.__c!=null){for(e.__e=e.__c.base=null,t=0;t<e.__k.length;t++)if((n=e.__k[t])!=null&&n.__e!=null){e.__e=e.__c.base=n.__e;break}return K5(e)}}function J5(e){(!e.__d&&(e.__d=!0)&&uo.push(e)&&!Ef.__r++||W5!==Ct.debounceRendering)&&((W5=Ct.debounceRendering)||G5)(Ef)}function Ef(){var e,t,n,r,i,s,o,a;for(uo.sort(Rg);e=uo.shift();)e.__d&&(t=uo.length,r=void 0,s=(i=(n=e).__v).__e,o=[],a=[],n.__P&&((r=ms({},i)).__v=i.__v+1,Ct.vnode&&Ct.vnode(r),Ng(n.__P,r,i,n.__n,n.__P.namespaceURI,32&i.__u?[s]:null,o,s??Ta(i),!!(32&i.__u),a),r.__v=i.__v,r.__.__k[r.__i]=r,eE(o,r,a),r.__e!=s&&K5(r)),uo.length>t&&uo.sort(Rg));Ef.__r=0}function Z5(e,t,n,r,i,s,o,a,c,u,l){var d,f,h,m,y,w=r&&r.__k||q5,b=t.length;for(n.__d=c,oj(n,t,w),c=n.__d,d=0;d<b;d++)(h=n.__k[d])!=null&&(f=h.__i===-1?Uu:w[h.__i]||Uu,h.__i=d,Ng(e,h,f,i,s,o,a,c,u,l),m=h.__e,h.ref&&f.ref!=h.ref&&(f.ref&&Lg(f.ref,null,h),l.push(h.ref,h.__c||m,h)),y==null&&m!=null&&(y=m),65536&h.__u||f.__k===h.__k?c=Y5(h,c,e):typeof h.type=="function"&&h.__d!==void 0?c=h.__d:m&&(c=m.nextSibling),h.__d=void 0,h.__u&=-196609);n.__d=c,n.__e=y}function oj(e,t,n){var r,i,s,o,a,c=t.length,u=n.length,l=u,d=0;for(e.__k=[],r=0;r<c;r++)(i=t[r])!=null&&typeof i!="boolean"&&typeof i!="function"?(o=r+d,(i=e.__k[r]=typeof i=="string"||typeof i=="number"||typeof i=="bigint"||i.constructor==String?wf(null,i,null,null,null):Bg(i)?wf(vf,{children:i},null,null,null):i.constructor===void 0&&i.__b>0?wf(i.type,i.props,i.key,i.ref?i.ref:null,i.__v):i).__=e,i.__b=e.__b+1,s=null,(a=i.__i=aj(i,n,o,l))!==-1&&(l--,(s=n[a])&&(s.__u|=131072)),s==null||s.__v===null?(a==-1&&d--,typeof i.type!="function"&&(i.__u|=65536)):a!==o&&(a==o-1?d--:a==o+1?d++:(a>o?d--:d++,i.__u|=65536))):i=e.__k[r]=null;if(l)for(r=0;r<u;r++)(s=n[r])!=null&&!(131072&s.__u)&&(s.__e==e.__d&&(e.__d=Ta(s)),tE(s,s))}function Y5(e,t,n){var r,i;if(typeof e.type=="function"){for(r=e.__k,i=0;r&&i<r.length;i++)r[i]&&(r[i].__=e,t=Y5(r[i],t,n));return t}e.__e!=t&&(t&&e.type&&!n.contains(t)&&(t=Ta(e)),n.insertBefore(e.__e,t||null),t=e.__e);do t=t&&t.nextSibling;while(t!=null&&t.nodeType===8);return t}function aj(e,t,n,r){var i=e.key,s=e.type,o=n-1,a=n+1,c=t[n];if(c===null||c&&i==c.key&&s===c.type&&!(131072&c.__u))return n;if(r>(c!=null&&!(131072&c.__u)?1:0))for(;o>=0||a<t.length;){if(o>=0){if((c=t[o])&&!(131072&c.__u)&&i==c.key&&s===c.type)return o;o--}if(a<t.length){if((c=t[a])&&!(131072&c.__u)&&i==c.key&&s===c.type)return a;a++}}return-1}function Q5(e,t,n){t[0]==="-"?e.setProperty(t,n??""):e[t]=n==null?"":typeof n!="number"||sj.test(t)?n:n+"px"}function xf(e,t,n,r,i){var s;e:if(t==="style")if(typeof n=="string")e.style.cssText=n;else{if(typeof r=="string"&&(e.style.cssText=r=""),r)for(t in r)n&&t in n||Q5(e.style,t,"");if(n)for(t in n)r&&n[t]===r[t]||Q5(e.style,t,n[t])}else if(t[0]==="o"&&t[1]==="n")s=t!==(t=t.replace(/(PointerCapture)$|Capture$/i,"$1")),t=t.toLowerCase()in e||t==="onFocusOut"||t==="onFocusIn"?t.toLowerCase().slice(2):t.slice(2),e.l||(e.l={}),e.l[t+s]=n,n?r?n.u=r.u:(n.u=Tg,e.addEventListener(t,s?Mg:Og,s)):e.removeEventListener(t,s?Mg:Og,s);else{if(i=="http://www.w3.org/2000/svg")t=t.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if(t!="width"&&t!="height"&&t!="href"&&t!="list"&&t!="form"&&t!="tabIndex"&&t!="download"&&t!="rowSpan"&&t!="colSpan"&&t!="role"&&t!="popover"&&t in e)try{e[t]=n??"";break e}catch{}typeof n=="function"||(n==null||n===!1&&t[4]!=="-"?e.removeAttribute(t):e.setAttribute(t,t=="popover"&&n==1?"":n))}}function X5(e){return function(t){if(this.l){var n=this.l[t.type+e];if(t.t==null)t.t=Tg++;else if(t.t<n.u)return;return n(Ct.event?Ct.event(t):t)}}}function Ng(e,t,n,r,i,s,o,a,c,u){var l,d,f,h,m,y,w,b,x,v,S,I,N,j,U,L,Y=t.type;if(t.constructor!==void 0)return null;128&n.__u&&(c=!!(32&n.__u),s=[a=t.__e=n.__e]),(l=Ct.__b)&&l(t);e:if(typeof Y=="function")try{if(b=t.props,x="prototype"in Y&&Y.prototype.render,v=(l=Y.contextType)&&r[l.__c],S=l?v?v.props.value:l.__:r,n.__c?w=(d=t.__c=n.__c).__=d.__E:(x?t.__c=d=new Y(b,S):(t.__c=d=new _f(b,S),d.constructor=Y,d.render=uj),v&&v.sub(d),d.props=b,d.state||(d.state={}),d.context=S,d.__n=r,f=d.__d=!0,d.__h=[],d._sb=[]),x&&d.__s==null&&(d.__s=d.state),x&&Y.getDerivedStateFromProps!=null&&(d.__s==d.state&&(d.__s=ms({},d.__s)),ms(d.__s,Y.getDerivedStateFromProps(b,d.__s))),h=d.props,m=d.state,d.__v=t,f)x&&Y.getDerivedStateFromProps==null&&d.componentWillMount!=null&&d.componentWillMount(),x&&d.componentDidMount!=null&&d.__h.push(d.componentDidMount);else{if(x&&Y.getDerivedStateFromProps==null&&b!==h&&d.componentWillReceiveProps!=null&&d.componentWillReceiveProps(b,S),!d.__e&&(d.shouldComponentUpdate!=null&&d.shouldComponentUpdate(b,d.__s,S)===!1||t.__v===n.__v)){for(t.__v!==n.__v&&(d.props=b,d.state=d.__s,d.__d=!1),t.__e=n.__e,t.__k=n.__k,t.__k.some(function(Z){Z&&(Z.__=t)}),I=0;I<d._sb.length;I++)d.__h.push(d._sb[I]);d._sb=[],d.__h.length&&o.push(d);break e}d.componentWillUpdate!=null&&d.componentWillUpdate(b,d.__s,S),x&&d.componentDidUpdate!=null&&d.__h.push(function(){d.componentDidUpdate(h,m,y)})}if(d.context=S,d.props=b,d.__P=e,d.__e=!1,N=Ct.__r,j=0,x){for(d.state=d.__s,d.__d=!1,N&&N(t),l=d.render(d.props,d.state,d.context),U=0;U<d._sb.length;U++)d.__h.push(d._sb[U]);d._sb=[]}else do d.__d=!1,N&&N(t),l=d.render(d.props,d.state,d.context),d.state=d.__s;while(d.__d&&++j<25);d.state=d.__s,d.getChildContext!=null&&(r=ms(ms({},r),d.getChildContext())),x&&!f&&d.getSnapshotBeforeUpdate!=null&&(y=d.getSnapshotBeforeUpdate(h,m)),Z5(e,Bg(L=l!=null&&l.type===vf&&l.key==null?l.props.children:l)?L:[L],t,n,r,i,s,o,a,c,u),d.base=t.__e,t.__u&=-161,d.__h.length&&o.push(d),w&&(d.__E=d.__=null)}catch(Z){if(t.__v=null,c||s!=null){for(t.__u|=c?160:32;a&&a.nodeType===8&&a.nextSibling;)a=a.nextSibling;s[s.indexOf(a)]=null,t.__e=a}else t.__e=n.__e,t.__k=n.__k;Ct.__e(Z,t,n)}else s==null&&t.__v===n.__v?(t.__k=n.__k,t.__e=n.__e):t.__e=cj(n.__e,t,n,r,i,s,o,c,u);(l=Ct.diffed)&&l(t)}function eE(e,t,n){t.__d=void 0;for(var r=0;r<n.length;r++)Lg(n[r],n[++r],n[++r]);Ct.__c&&Ct.__c(t,e),e.some(function(i){try{e=i.__h,i.__h=[],e.some(function(s){s.call(i)})}catch(s){Ct.__e(s,i.__v)}})}function cj(e,t,n,r,i,s,o,a,c){var u,l,d,f,h,m,y,w=n.props,b=t.props,x=t.type;if(x==="svg"?i="http://www.w3.org/2000/svg":x==="math"?i="http://www.w3.org/1998/Math/MathML":i||(i="http://www.w3.org/1999/xhtml"),s!=null){for(u=0;u<s.length;u++)if((h=s[u])&&"setAttribute"in h==!!x&&(x?h.localName===x:h.nodeType===3)){e=h,s[u]=null;break}}if(e==null){if(x===null)return document.createTextNode(b);e=document.createElementNS(i,x,b.is&&b),a&&(Ct.__m&&Ct.__m(t,s),a=!1),s=null}if(x===null)w===b||a&&e.data===b||(e.data=b);else{if(s=s&&bf.call(e.childNodes),w=n.props||Uu,!a&&s!=null)for(w={},u=0;u<e.attributes.length;u++)w[(h=e.attributes[u]).name]=h.value;for(u in w)if(h=w[u],u!="children"){if(u=="dangerouslySetInnerHTML")d=h;else if(!(u in b)){if(u=="value"&&"defaultValue"in b||u=="checked"&&"defaultChecked"in b)continue;xf(e,u,null,h,i)}}for(u in b)h=b[u],u=="children"?f=h:u=="dangerouslySetInnerHTML"?l=h:u=="value"?m=h:u=="checked"?y=h:a&&typeof h!="function"||w[u]===h||xf(e,u,h,w[u],i);if(l)a||d&&(l.__html===d.__html||l.__html===e.innerHTML)||(e.innerHTML=l.__html),t.__k=[];else if(d&&(e.innerHTML=""),Z5(e,Bg(f)?f:[f],t,n,r,x==="foreignObject"?"http://www.w3.org/1999/xhtml":i,s,o,s?s[0]:n.__k&&Ta(n,0),a,c),s!=null)for(u=s.length;u--;)V5(s[u]);a||(u="value",x==="progress"&&m==null?e.removeAttribute("value"):m!==void 0&&(m!==e[u]||x==="progress"&&!m||x==="option"&&m!==w[u])&&xf(e,u,m,w[u],i),u="checked",y!==void 0&&y!==e[u]&&xf(e,u,y,w[u],i))}return e}function Lg(e,t,n){try{if(typeof e=="function"){var r=typeof e.__u=="function";r&&e.__u(),r&&t==null||(e.__u=e(t))}else e.current=t}catch(i){Ct.__e(i,n)}}function tE(e,t,n){var r,i;if(Ct.unmount&&Ct.unmount(e),(r=e.ref)&&(r.current&&r.current!==e.__e||Lg(r,null,t)),(r=e.__c)!=null){if(r.componentWillUnmount)try{r.componentWillUnmount()}catch(s){Ct.__e(s,t)}r.base=r.__P=null}if(r=e.__k)for(i=0;i<r.length;i++)r[i]&&tE(r[i],t,n||typeof e.type!="function");n||V5(e.__e),e.__c=e.__=e.__e=e.__d=void 0}function uj(e,t,n){return this.constructor(e,n)}function jg(e,t,n){var r,i,s,o;Ct.__&&Ct.__(e,t),i=(r=!1)?null:t.__k,s=[],o=[],Ng(t,e=t.__k=gt(vf,null,[e]),i||Uu,Uu,t.namespaceURI,i?null:t.firstChild?bf.call(t.childNodes):null,s,i?i.__e:t.firstChild,r,o),eE(s,e,o)}bf=q5.slice,Ct={__e:function(e,t,n,r){for(var i,s,o;t=t.__;)if((i=t.__c)&&!i.__)try{if((s=i.constructor)&&s.getDerivedStateFromError!=null&&(i.setState(s.getDerivedStateFromError(e)),o=i.__d),i.componentDidCatch!=null&&(i.componentDidCatch(e,r||{}),o=i.__d),o)return i.__E=i}catch(a){e=a}throw e}},z5=0,_f.prototype.setState=function(e,t){var n;n=this.__s!=null&&this.__s!==this.state?this.__s:this.__s=ms({},this.state),typeof e=="function"&&(e=e(ms({},n),this.props)),e&&ms(n,e),e!=null&&this.__v&&(t&&this._sb.push(t),J5(this))},_f.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),J5(this))},_f.prototype.render=vf,uo=[],G5=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,Rg=function(e,t){return e.__v.__b-t.__v.__b},Ef.__r=0,Tg=0,Og=X5(!1),Mg=X5(!0);function nE(e){var t,n,r="";if(typeof e=="string"||typeof e=="number")r+=e;else if(typeof e=="object")if(Array.isArray(e))for(t=0;t<e.length;t++)e[t]&&(n=nE(e[t]))&&(r&&(r+=" "),r+=n);else for(t in e)e[t]&&(r&&(r+=" "),r+=t);return r}function lo(){for(var e,t,n=0,r="";n<arguments.length;)(e=arguments[n++])&&(t=nE(e))&&(r&&(r+=" "),r+=t);return r}const lj=Object.freeze(Object.defineProperty({__proto__:null,clsx:lo,default:lo},Symbol.toStringTag,{value:"Module"}));var Sf,Wt,$g,rE,Fg=0,iE=[],Yt=Ct,sE=Yt.__b,oE=Yt.__r,aE=Yt.diffed,cE=Yt.__c,uE=Yt.unmount,lE=Yt.__;function dE(e,t){Yt.__h&&Yt.__h(Wt,e,Fg||t),Fg=0;var n=Wt.__H||(Wt.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({}),n.__[e]}function fE(e){return Fg=1,dj(pE,e)}function dj(e,t,n){var r=dE(Sf++,2);if(r.t=e,!r.__c&&(r.__=[pE(void 0,t),function(a){var c=r.__N?r.__N[0]:r.__[0],u=r.t(c,a);c!==u&&(r.__N=[u,r.__[1]],r.__c.setState({}))}],r.__c=Wt,!Wt.u)){var i=function(a,c,u){if(!r.__c.__H)return!0;var l=r.__c.__H.__.filter(function(f){return!!f.__c});if(l.every(function(f){return!f.__N}))return!s||s.call(this,a,c,u);var d=!1;return l.forEach(function(f){if(f.__N){var h=f.__[0];f.__=f.__N,f.__N=void 0,h!==f.__[0]&&(d=!0)}}),!(!d&&r.__c.props===a)&&(!s||s.call(this,a,c,u))};Wt.u=!0;var s=Wt.shouldComponentUpdate,o=Wt.componentWillUpdate;Wt.componentWillUpdate=function(a,c,u){if(this.__e){var l=s;s=void 0,i(a,c,u),s=l}o&&o.call(this,a,c,u)},Wt.shouldComponentUpdate=i}return r.__N||r.__}function fj(e,t){var n=dE(Sf++,3);!Yt.__s&&mj(n.__H,t)&&(n.__=e,n.i=t,Wt.__H.__h.push(n))}function hj(){for(var e;e=iE.shift();)if(e.__P&&e.__H)try{e.__H.__h.forEach(kf),e.__H.__h.forEach(Dg),e.__H.__h=[]}catch(t){e.__H.__h=[],Yt.__e(t,e.__v)}}Yt.__b=function(e){Wt=null,sE&&sE(e)},Yt.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),lE&&lE(e,t)},Yt.__r=function(e){oE&&oE(e),Sf=0;var t=(Wt=e.__c).__H;t&&($g===Wt?(t.__h=[],Wt.__h=[],t.__.forEach(function(n){n.__N&&(n.__=n.__N),n.i=n.__N=void 0})):(t.__h.forEach(kf),t.__h.forEach(Dg),t.__h=[],Sf=0)),$g=Wt},Yt.diffed=function(e){aE&&aE(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(iE.push(t)!==1&&rE===Yt.requestAnimationFrame||((rE=Yt.requestAnimationFrame)||pj)(hj)),t.__H.__.forEach(function(n){n.i&&(n.__H=n.i),n.i=void 0})),$g=Wt=null},Yt.__c=function(e,t){t.some(function(n){try{n.__h.forEach(kf),n.__h=n.__h.filter(function(r){return!r.__||Dg(r)})}catch(r){t.some(function(i){i.__h&&(i.__h=[])}),t=[],Yt.__e(r,n.__v)}}),cE&&cE(e,t)},Yt.unmount=function(e){uE&&uE(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.forEach(function(r){try{kf(r)}catch(i){t=i}}),n.__H=void 0,t&&Yt.__e(t,n.__v))};var hE=typeof requestAnimationFrame=="function";function pj(e){var t,n=function(){clearTimeout(r),hE&&cancelAnimationFrame(t),setTimeout(e)},r=setTimeout(n,100);hE&&(t=requestAnimationFrame(n))}function kf(e){var t=Wt,n=e.__c;typeof n=="function"&&(e.__c=void 0,n()),Wt=t}function Dg(e){var t=Wt;e.__c=e.__(),Wt=t}function mj(e,t){return!e||e.length!==t.length||t.some(function(n,r){return n!==e[r]})}function pE(e,t){return typeof t=="function"?t(e):t}const gj=[{inputs:[{name:"preOpGas",type:"uint256"},{name:"paid",type:"uint256"},{name:"validAfter",type:"uint48"},{name:"validUntil",type:"uint48"},{name:"targetSuccess",type:"bool"},{name:"targetResult",type:"bytes"}],name:"ExecutionResult",type:"error"},{inputs:[{name:"opIndex",type:"uint256"},{name:"reason",type:"string"}],name:"FailedOp",type:"error"},{inputs:[{name:"sender",type:"address"}],name:"SenderAddressResult",type:"error"},{inputs:[{name:"aggregator",type:"address"}],name:"SignatureValidationFailed",type:"error"},{inputs:[{components:[{name:"preOpGas",type:"uint256"},{name:"prefund",type:"uint256"},{name:"sigFailed",type:"bool"},{name:"validAfter",type:"uint48"},{name:"validUntil",type:"uint48"},{name:"paymasterContext",type:"bytes"}],name:"returnInfo",type:"tuple"},{components:[{name:"stake",type:"uint256"},{name:"unstakeDelaySec",type:"uint256"}],name:"senderInfo",type:"tuple"},{components:[{name:"stake",type:"uint256"},{name:"unstakeDelaySec",type:"uint256"}],name:"factoryInfo",type:"tuple"},{components:[{name:"stake",type:"uint256"},{name:"unstakeDelaySec",type:"uint256"}],name:"paymasterInfo",type:"tuple"}],name:"ValidationResult",type:"error"},{inputs:[{components:[{name:"preOpGas",type:"uint256"},{name:"prefund",type:"uint256"},{name:"sigFailed",type:"bool"},{name:"validAfter",type:"uint48"},{name:"validUntil",type:"uint48"},{name:"paymasterContext",type:"bytes"}],name:"returnInfo",type:"tuple"},{components:[{name:"stake",type:"uint256"},{name:"unstakeDelaySec",type:"uint256"}],name:"senderInfo",type:"tuple"},{components:[{name:"stake",type:"uint256"},{name:"unstakeDelaySec",type:"uint256"}],name:"factoryInfo",type:"tuple"},{components:[{name:"stake",type:"uint256"},{name:"unstakeDelaySec",type:"uint256"}],name:"paymasterInfo",type:"tuple"},{components:[{name:"aggregator",type:"address"},{components:[{name:"stake",type:"uint256"},{name:"unstakeDelaySec",type:"uint256"}],name:"stakeInfo",type:"tuple"}],name:"aggregatorInfo",type:"tuple"}],name:"ValidationResultWithAggregation",type:"error"},{anonymous:!1,inputs:[{indexed:!0,name:"userOpHash",type:"bytes32"},{indexed:!0,name:"sender",type:"address"},{indexed:!1,name:"factory",type:"address"},{indexed:!1,name:"paymaster",type:"address"}],name:"AccountDeployed",type:"event"},{anonymous:!1,inputs:[],name:"BeforeExecution",type:"event"},{anonymous:!1,inputs:[{indexed:!0,name:"account",type:"address"},{indexed:!1,name:"totalDeposit",type:"uint256"}],name:"Deposited",type:"event"},{anonymous:!1,inputs:[{indexed:!0,name:"aggregator",type:"address"}],name:"SignatureAggregatorChanged",type:"event"},{anonymous:!1,inputs:[{indexed:!0,name:"account",type:"address"},{indexed:!1,name:"totalStaked",type:"uint256"},{indexed:!1,name:"unstakeDelaySec",type:"uint256"}],name:"StakeLocked",type:"event"},{anonymous:!1,inputs:[{indexed:!0,name:"account",type:"address"},{indexed:!1,name:"withdrawTime",type:"uint256"}],name:"StakeUnlocked",type:"event"},{anonymous:!1,inputs:[{indexed:!0,name:"account",type:"address"},{indexed:!1,name:"withdrawAddress",type:"address"},{indexed:!1,name:"amount",type:"uint256"}],name:"StakeWithdrawn",type:"event"},{anonymous:!1,inputs:[{indexed:!0,name:"userOpHash",type:"bytes32"},{indexed:!0,name:"sender",type:"address"},{indexed:!0,name:"paymaster",type:"address"},{indexed:!1,name:"nonce",type:"uint256"},{indexed:!1,name:"success",type:"bool"},{indexed:!1,name:"actualGasCost",type:"uint256"},{indexed:!1,name:"actualGasUsed",type:"uint256"}],name:"UserOperationEvent",type:"event"},{anonymous:!1,inputs:[{indexed:!0,name:"userOpHash",type:"bytes32"},{indexed:!0,name:"sender",type:"address"},{indexed:!1,name:"nonce",type:"uint256"},{indexed:!1,name:"revertReason",type:"bytes"}],name:"UserOperationRevertReason",type:"event"},{anonymous:!1,inputs:[{indexed:!0,name:"account",type:"address"},{indexed:!1,name:"withdrawAddress",type:"address"},{indexed:!1,name:"amount",type:"uint256"}],name:"Withdrawn",type:"event"},{inputs:[],name:"SIG_VALIDATION_FAILED",outputs:[{name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{name:"initCode",type:"bytes"},{name:"sender",type:"address"},{name:"paymasterAndData",type:"bytes"}],name:"_validateSenderAndPaymaster",outputs:[],stateMutability:"view",type:"function"},{inputs:[{name:"unstakeDelaySec",type:"uint32"}],name:"addStake",outputs:[],stateMutability:"payable",type:"function"},{inputs:[{name:"account",type:"address"}],name:"balanceOf",outputs:[{name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{name:"account",type:"address"}],name:"depositTo",outputs:[],stateMutability:"payable",type:"function"},{inputs:[{name:"",type:"address"}],name:"deposits",outputs:[{name:"deposit",type:"uint112"},{name:"staked",type:"bool"},{name:"stake",type:"uint112"},{name:"unstakeDelaySec",type:"uint32"},{name:"withdrawTime",type:"uint48"}],stateMutability:"view",type:"function"},{inputs:[{name:"account",type:"address"}],name:"getDepositInfo",outputs:[{components:[{name:"deposit",type:"uint112"},{name:"staked",type:"bool"},{name:"stake",type:"uint112"},{name:"unstakeDelaySec",type:"uint32"},{name:"withdrawTime",type:"uint48"}],name:"info",type:"tuple"}],stateMutability:"view",type:"function"},{inputs:[{name:"sender",type:"address"},{name:"key",type:"uint192"}],name:"getNonce",outputs:[{name:"nonce",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{name:"initCode",type:"bytes"}],name:"getSenderAddress",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{components:[{name:"sender",type:"address"},{name:"nonce",type:"uint256"},{name:"initCode",type:"bytes"},{name:"callData",type:"bytes"},{name:"callGasLimit",type:"uint256"},{name:"verificationGasLimit",type:"uint256"},{name:"preVerificationGas",type:"uint256"},{name:"maxFeePerGas",type:"uint256"},{name:"maxPriorityFeePerGas",type:"uint256"},{name:"paymasterAndData",type:"bytes"},{name:"signature",type:"bytes"}],name:"userOp",type:"tuple"}],name:"getUserOpHash",outputs:[{name:"",type:"bytes32"}],stateMutability:"view",type:"function"},{inputs:[{components:[{components:[{name:"sender",type:"address"},{name:"nonce",type:"uint256"},{name:"initCode",type:"bytes"},{name:"callData",type:"bytes"},{name:"callGasLimit",type:"uint256"},{name:"verificationGasLimit",type:"uint256"},{name:"preVerificationGas",type:"uint256"},{name:"maxFeePerGas",type:"uint256"},{name:"maxPriorityFeePerGas",type:"uint256"},{name:"paymasterAndData",type:"bytes"},{name:"signature",type:"bytes"}],name:"userOps",type:"tuple[]"},{name:"aggregator",type:"address"},{name:"signature",type:"bytes"}],name:"opsPerAggregator",type:"tuple[]"},{name:"beneficiary",type:"address"}],name:"handleAggregatedOps",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{components:[{name:"sender",type:"address"},{name:"nonce",type:"uint256"},{name:"initCode",type:"bytes"},{name:"callData",type:"bytes"},{name:"callGasLimit",type:"uint256"},{name:"verificationGasLimit",type:"uint256"},{name:"preVerificationGas",type:"uint256"},{name:"maxFeePerGas",type:"uint256"},{name:"maxPriorityFeePerGas",type:"uint256"},{name:"paymasterAndData",type:"bytes"},{name:"signature",type:"bytes"}],name:"ops",type:"tuple[]"},{name:"beneficiary",type:"address"}],name:"handleOps",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{name:"key",type:"uint192"}],name:"incrementNonce",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{name:"callData",type:"bytes"},{components:[{components:[{name:"sender",type:"address"},{name:"nonce",type:"uint256"},{name:"callGasLimit",type:"uint256"},{name:"verificationGasLimit",type:"uint256"},{name:"preVerificationGas",type:"uint256"},{name:"paymaster",type:"address"},{name:"maxFeePerGas",type:"uint256"},{name:"maxPriorityFeePerGas",type:"uint256"}],name:"mUserOp",type:"tuple"},{name:"userOpHash",type:"bytes32"},{name:"prefund",type:"uint256"},{name:"contextOffset",type:"uint256"},{name:"preOpGas",type:"uint256"}],name:"opInfo",type:"tuple"},{name:"context",type:"bytes"}],name:"innerHandleOp",outputs:[{name:"actualGasCost",type:"uint256"}],stateMutability:"nonpayable",type:"function"},{inputs:[{name:"",type:"address"},{name:"",type:"uint192"}],name:"nonceSequenceNumber",outputs:[{name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{components:[{name:"sender",type:"address"},{name:"nonce",type:"uint256"},{name:"initCode",type:"bytes"},{name:"callData",type:"bytes"},{name:"callGasLimit",type:"uint256"},{name:"verificationGasLimit",type:"uint256"},{name:"preVerificationGas",type:"uint256"},{name:"maxFeePerGas",type:"uint256"},{name:"maxPriorityFeePerGas",type:"uint256"},{name:"paymasterAndData",type:"bytes"},{name:"signature",type:"bytes"}],name:"op",type:"tuple"},{name:"target",type:"address"},{name:"targetCallData",type:"bytes"}],name:"simulateHandleOp",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{components:[{name:"sender",type:"address"},{name:"nonce",type:"uint256"},{name:"initCode",type:"bytes"},{name:"callData",type:"bytes"},{name:"callGasLimit",type:"uint256"},{name:"verificationGasLimit",type:"uint256"},{name:"preVerificationGas",type:"uint256"},{name:"maxFeePerGas",type:"uint256"},{name:"maxPriorityFeePerGas",type:"uint256"},{name:"paymasterAndData",type:"bytes"},{name:"signature",type:"bytes"}],name:"userOp",type:"tuple"}],name:"simulateValidation",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"unlockStake",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{name:"withdrawAddress",type:"address"}],name:"withdrawStake",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{name:"withdrawAddress",type:"address"},{name:"withdrawAmount",type:"uint256"}],name:"withdrawTo",outputs:[],stateMutability:"nonpayable",type:"function"},{stateMutability:"payable",type:"receive"}],yj="0x5FF137D4b0FDCD49DcA30c7CF57E578a026d2789";function mE(e,t={}){const{forHash:n}=t,{authorization:r,factory:i,factoryData:s}=e;return n&&(i==="0x7702"||i==="0x7702000000000000000000000000000000000000")?r?Zt([r.address,s??"0x"]):"0x7702000000000000000000000000000000000000":i?Zt([i,s??"0x"]):"0x"}const gE="0x22e325a297439656";function yE(e,t={}){const{callGasLimit:n,callData:r,maxPriorityFeePerGas:i,maxFeePerGas:s,paymaster:o,paymasterData:a,paymasterPostOpGasLimit:c,paymasterSignature:u,paymasterVerificationGasLimit:l,sender:d,signature:f="0x",verificationGasLimit:h}=e,m=Zt([Kt(oe(h||0n),{size:16}),Kt(oe(n||0n),{size:16})]),y=mE(e,t),w=Zt([Kt(oe(i||0n),{size:16}),Kt(oe(s||0n),{size:16})]),b=e.nonce??0n,x=o?Zt([o,Kt(oe(l||0n),{size:16}),Kt(oe(c||0n),{size:16}),a||"0x",...u?t.forHash?[gE]:[u,Kt(oe(Et(u)),{size:2}),gE]:[]]):"0x",v=e.preVerificationGas??0n;return{accountGasLimits:m,callData:r,initCode:y,gasFees:w,nonce:b,paymasterAndData:x,preVerificationGas:v,sender:d,signature:f}}const bj={PackedUserOperation:[{type:"address",name:"sender"},{type:"uint256",name:"nonce"},{type:"bytes",name:"initCode"},{type:"bytes",name:"callData"},{type:"bytes32",name:"accountGasLimits"},{type:"uint256",name:"preVerificationGas"},{type:"bytes32",name:"gasFees"},{type:"bytes",name:"paymasterAndData"}]};function wj(e){const{chainId:t,entryPointAddress:n,userOperation:r}=e,i=yE(r,{forHash:!0});return{types:bj,primaryType:"PackedUserOperation",domain:{name:"ERC4337",version:"1",chainId:t,verifyingContract:n},message:i}}function vj(e){const{chainId:t,entryPointAddress:n,entryPointVersion:r}=e,i=e.userOperation,{authorization:s,callData:o="0x",callGasLimit:a,maxFeePerGas:c,maxPriorityFeePerGas:u,nonce:l,paymasterAndData:d="0x",preVerificationGas:f,sender:h,verificationGasLimit:m}=i;if(r==="0.8"||r==="0.9")return Au(wj({chainId:t,entryPointAddress:n,userOperation:i}));const y=(()=>{var w,b;if(r==="0.6"){const x=(w=i.initCode)==null?void 0:w.slice(0,42),v=(b=i.initCode)==null?void 0:b.slice(42),S=mE({authorization:s,factory:x,factoryData:v},{forHash:!0});return zn([{type:"address"},{type:"uint256"},{type:"bytes32"},{type:"bytes32"},{type:"uint256"},{type:"uint256"},{type:"uint256"},{type:"uint256"},{type:"uint256"},{type:"bytes32"}],[h,l,xt(S),xt(o),a,m,f,c,u,xt(d)])}if(r==="0.7"){const x=yE(i,{forHash:!0});return zn([{type:"address"},{type:"uint256"},{type:"bytes32"},{type:"bytes32"},{type:"bytes32"},{type:"uint256"},{type:"bytes32"},{type:"bytes32"}],[x.sender,x.nonce,xt(x.initCode),xt(x.callData),x.accountGasLimits,x.preVerificationGas,x.gasFees,xt(x.paymasterAndData)])}throw new Error(`entryPointVersion "${r}" not supported.`)})();return xt(zn([{type:"bytes32"},{type:"address"},{type:"uint256"}],[xt(y),n,BigInt(t)]))}async function _j(e){const{extend:t,nonceKeyManager:n=WO({source:{get(){return Date.now()},set(){}}}),...r}=e;let i=!1;const s=await e.getAddress();return{...t,...r,address:s,async getFactoryArgs(){return"isDeployed"in this&&await this.isDeployed()?{factory:void 0,factoryData:void 0}:e.getFactoryArgs()},async getNonce(o){const a=(o==null?void 0:o.key)??BigInt(await n.consume({address:s,chainId:e.client.chain.id,client:e.client}));return e.getNonce?await e.getNonce({...o,key:a}):await On(e.client,{abi:op(["function getNonce(address, uint192) pure returns (uint256)"]),address:e.entryPoint.address,functionName:"getNonce",args:[s,a]})},async isDeployed(){return i?!0:(i=!!await ve(e.client,wa,"getCode")({address:s}),i)},...e.sign?{async sign(o){const[{factory:a,factoryData:c},u]=await Promise.all([this.getFactoryArgs(),e.sign(o)]);return a&&c?Rm({address:a,data:c,signature:u}):u}}:{},async signMessage(o){const[{factory:a,factoryData:c},u]=await Promise.all([this.getFactoryArgs(),e.signMessage(o)]);return a&&c&&a!=="0x7702"?Rm({address:a,data:c,signature:u}):u},async signTypedData(o){const[{factory:a,factoryData:c},u]=await Promise.all([this.getFactoryArgs(),e.signTypedData(o)]);return a&&c&&a!=="0x7702"?Rm({address:a,data:c,signature:u}):u},type:"smart"}}class Ug extends ee{constructor({cause:t}){super("Smart Account is not deployed.",{cause:t,metaMessages:["This could arise when:","- No `factory`/`factoryData` or `initCode` properties are provided for Smart Account deployment.","- An incorrect `sender` address is provided."],name:"AccountNotDeployedError"})}}Object.defineProperty(Ug,"message",{enumerable:!0,configurable:!0,writable:!0,value:/aa20/});class Oa extends ee{constructor({cause:t,data:n,message:r}={}){var s;const i=(s=r==null?void 0:r.replace("execution reverted: ",""))==null?void 0:s.replace("execution reverted","");super(`Execution reverted ${i?`with reason: ${i}`:"for an unknown reason"}.`,{cause:t,name:"ExecutionRevertedError"}),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.data=n}}Object.defineProperty(Oa,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32521}),Object.defineProperty(Oa,"message",{enumerable:!0,configurable:!0,writable:!0,value:/execution reverted/});class Hg extends ee{constructor({cause:t}){super("Failed to send funds to beneficiary.",{cause:t,name:"FailedToSendToBeneficiaryError"})}}Object.defineProperty(Hg,"message",{enumerable:!0,configurable:!0,writable:!0,value:/aa91/});class zg extends ee{constructor({cause:t}){super("Gas value overflowed.",{cause:t,metaMessages:["This could arise when:","- one of the gas values exceeded 2**120 (uint120)"].filter(Boolean),name:"GasValuesOverflowError"})}}Object.defineProperty(zg,"message",{enumerable:!0,configurable:!0,writable:!0,value:/aa94/});class Wg extends ee{constructor({cause:t}){super("The `handleOps` function was called by the Bundler with a gas limit too low.",{cause:t,name:"HandleOpsOutOfGasError"})}}Object.defineProperty(Wg,"message",{enumerable:!0,configurable:!0,writable:!0,value:/aa95/});class Gg extends ee{constructor({cause:t,factory:n,factoryData:r,initCode:i}){super("Failed to simulate deployment for Smart Account.",{cause:t,metaMessages:["This could arise when:","- Invalid `factory`/`factoryData` or `initCode` properties are present","- Smart Account deployment execution ran out of gas (low `verificationGasLimit` value)",`- Smart Account deployment execution reverted with an error
115
+ `,n&&`factory: ${n}`,r&&`factoryData: ${r}`,i&&`initCode: ${i}`].filter(Boolean),name:"InitCodeFailedError"})}}Object.defineProperty(Gg,"message",{enumerable:!0,configurable:!0,writable:!0,value:/aa13/});class qg extends ee{constructor({cause:t,factory:n,factoryData:r,initCode:i}){super("Smart Account initialization implementation did not create an account.",{cause:t,metaMessages:["This could arise when:","- `factory`/`factoryData` or `initCode` properties are invalid",`- Smart Account initialization implementation is incorrect
116
+ `,n&&`factory: ${n}`,r&&`factoryData: ${r}`,i&&`initCode: ${i}`].filter(Boolean),name:"InitCodeMustCreateSenderError"})}}Object.defineProperty(qg,"message",{enumerable:!0,configurable:!0,writable:!0,value:/aa15/});class Vg extends ee{constructor({cause:t,factory:n,factoryData:r,initCode:i,sender:s}){super("Smart Account initialization implementation does not return the expected sender.",{cause:t,metaMessages:["This could arise when:",`Smart Account initialization implementation does not return a sender address
117
+ `,n&&`factory: ${n}`,r&&`factoryData: ${r}`,i&&`initCode: ${i}`,s&&`sender: ${s}`].filter(Boolean),name:"InitCodeMustReturnSenderError"})}}Object.defineProperty(Vg,"message",{enumerable:!0,configurable:!0,writable:!0,value:/aa14/});class Kg extends ee{constructor({cause:t}){super("Smart Account does not have sufficient funds to execute the User Operation.",{cause:t,metaMessages:["This could arise when:","- the Smart Account does not have sufficient funds to cover the required prefund, or","- a Paymaster was not provided"].filter(Boolean),name:"InsufficientPrefundError"})}}Object.defineProperty(Kg,"message",{enumerable:!0,configurable:!0,writable:!0,value:/aa21/});class Jg extends ee{constructor({cause:t}){super("Bundler attempted to call an invalid function on the EntryPoint.",{cause:t,name:"InternalCallOnlyError"})}}Object.defineProperty(Jg,"message",{enumerable:!0,configurable:!0,writable:!0,value:/aa92/});class Zg extends ee{constructor({cause:t}){super("Bundler used an invalid aggregator for handling aggregated User Operations.",{cause:t,name:"InvalidAggregatorError"})}}Object.defineProperty(Zg,"message",{enumerable:!0,configurable:!0,writable:!0,value:/aa96/});class Yg extends ee{constructor({cause:t,nonce:n}){super("Invalid Smart Account nonce used for User Operation.",{cause:t,metaMessages:[n&&`nonce: ${n}`].filter(Boolean),name:"InvalidAccountNonceError"})}}Object.defineProperty(Yg,"message",{enumerable:!0,configurable:!0,writable:!0,value:/aa25/});class Qg extends ee{constructor({cause:t}){super("Bundler has not set a beneficiary address.",{cause:t,name:"InvalidBeneficiaryError"})}}Object.defineProperty(Qg,"message",{enumerable:!0,configurable:!0,writable:!0,value:/aa90/});class Af extends ee{constructor({cause:t}){super("Invalid fields set on User Operation.",{cause:t,name:"InvalidFieldsError"})}}Object.defineProperty(Af,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32602});class Xg extends ee{constructor({cause:t,paymasterAndData:n}){super("Paymaster properties provided are invalid.",{cause:t,metaMessages:["This could arise when:","- the `paymasterAndData` property is of an incorrect length\n",n&&`paymasterAndData: ${n}`].filter(Boolean),name:"InvalidPaymasterAndDataError"})}}Object.defineProperty(Xg,"message",{enumerable:!0,configurable:!0,writable:!0,value:/aa93/});class fo extends ee{constructor({cause:t}){super("Paymaster deposit for the User Operation is too low.",{cause:t,metaMessages:["This could arise when:","- the Paymaster has deposited less than the expected amount via the `deposit` function"].filter(Boolean),name:"PaymasterDepositTooLowError"})}}Object.defineProperty(fo,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32508}),Object.defineProperty(fo,"message",{enumerable:!0,configurable:!0,writable:!0,value:/aa31/});class ey extends ee{constructor({cause:t}){super("The `validatePaymasterUserOp` function on the Paymaster reverted.",{cause:t,name:"PaymasterFunctionRevertedError"})}}Object.defineProperty(ey,"message",{enumerable:!0,configurable:!0,writable:!0,value:/aa33/});class ty extends ee{constructor({cause:t}){super("The Paymaster contract has not been deployed.",{cause:t,name:"PaymasterNotDeployedError"})}}Object.defineProperty(ty,"message",{enumerable:!0,configurable:!0,writable:!0,value:/aa30/});class If extends ee{constructor({cause:t}){super("UserOperation rejected because paymaster (or signature aggregator) is throttled/banned.",{cause:t,name:"PaymasterRateLimitError"})}}Object.defineProperty(If,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32504});class Cf extends ee{constructor({cause:t}){super("UserOperation rejected because paymaster (or signature aggregator) stake or unstake-delay is too low.",{cause:t,name:"PaymasterStakeTooLowError"})}}Object.defineProperty(Cf,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32505});class ny extends ee{constructor({cause:t}){super("Paymaster `postOp` function reverted.",{cause:t,name:"PaymasterPostOpFunctionRevertedError"})}}Object.defineProperty(ny,"message",{enumerable:!0,configurable:!0,writable:!0,value:/aa50/});class ry extends ee{constructor({cause:t,factory:n,factoryData:r,initCode:i}){super("Smart Account has already been deployed.",{cause:t,metaMessages:["Remove the following properties and try again:",n&&"`factory`",r&&"`factoryData`",i&&"`initCode`"].filter(Boolean),name:"SenderAlreadyConstructedError"})}}Object.defineProperty(ry,"message",{enumerable:!0,configurable:!0,writable:!0,value:/aa10/});class Pf extends ee{constructor({cause:t}){super("UserOperation rejected because account signature check failed (or paymaster signature, if the paymaster uses its data as signature).",{cause:t,name:"SignatureCheckFailedError"})}}Object.defineProperty(Pf,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32507});class iy extends ee{constructor({cause:t}){super("The `validateUserOp` function on the Smart Account reverted.",{cause:t,name:"SmartAccountFunctionRevertedError"})}}Object.defineProperty(iy,"message",{enumerable:!0,configurable:!0,writable:!0,value:/aa23/});class Rf extends ee{constructor({cause:t}){super("UserOperation rejected because account specified unsupported signature aggregator.",{cause:t,name:"UnsupportedSignatureAggregatorError"})}}Object.defineProperty(Rf,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32506});class sy extends ee{constructor({cause:t}){super("User Operation expired.",{cause:t,metaMessages:["This could arise when:","- the `validAfter` or `validUntil` values returned from `validateUserOp` on the Smart Account are not satisfied"].filter(Boolean),name:"UserOperationExpiredError"})}}Object.defineProperty(sy,"message",{enumerable:!0,configurable:!0,writable:!0,value:/aa22/});class oy extends ee{constructor({cause:t}){super("Paymaster for User Operation expired.",{cause:t,metaMessages:["This could arise when:","- the `validAfter` or `validUntil` values returned from `validatePaymasterUserOp` on the Paymaster are not satisfied"].filter(Boolean),name:"UserOperationPaymasterExpiredError"})}}Object.defineProperty(oy,"message",{enumerable:!0,configurable:!0,writable:!0,value:/aa32/});class ay extends ee{constructor({cause:t}){super("Signature provided for the User Operation is invalid.",{cause:t,metaMessages:["This could arise when:","- the `signature` for the User Operation is incorrectly computed, and unable to be verified by the Smart Account"].filter(Boolean),name:"UserOperationSignatureError"})}}Object.defineProperty(ay,"message",{enumerable:!0,configurable:!0,writable:!0,value:/aa24/});class cy extends ee{constructor({cause:t}){super("Signature provided for the User Operation is invalid.",{cause:t,metaMessages:["This could arise when:","- the `signature` for the User Operation is incorrectly computed, and unable to be verified by the Paymaster"].filter(Boolean),name:"UserOperationPaymasterSignatureError"})}}Object.defineProperty(cy,"message",{enumerable:!0,configurable:!0,writable:!0,value:/aa34/});class Tf extends ee{constructor({cause:t}){super("User Operation rejected by EntryPoint's `simulateValidation` during account creation or validation.",{cause:t,name:"UserOperationRejectedByEntryPointError"})}}Object.defineProperty(Tf,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32500});class Of extends ee{constructor({cause:t}){super("User Operation rejected by Paymaster's `validatePaymasterUserOp`.",{cause:t,name:"UserOperationRejectedByPaymasterError"})}}Object.defineProperty(Of,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32501});class Mf extends ee{constructor({cause:t}){super("User Operation rejected with op code validation error.",{cause:t,name:"UserOperationRejectedByOpCodeError"})}}Object.defineProperty(Mf,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32502});class Bf extends ee{constructor({cause:t}){super("UserOperation out of time-range: either wallet or paymaster returned a time-range, and it is already expired (or will expire soon).",{cause:t,name:"UserOperationOutOfTimeRangeError"})}}Object.defineProperty(Bf,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32503});class Ej extends ee{constructor({cause:t}){super(`An error occurred while executing user operation: ${t==null?void 0:t.shortMessage}`,{cause:t,name:"UnknownBundlerError"})}}class uy extends ee{constructor({cause:t}){super("User Operation verification gas limit exceeded.",{cause:t,metaMessages:["This could arise when:","- the gas used for verification exceeded the `verificationGasLimit`"].filter(Boolean),name:"VerificationGasLimitExceededError"})}}Object.defineProperty(uy,"message",{enumerable:!0,configurable:!0,writable:!0,value:/aa40/});class ly extends ee{constructor({cause:t}){super("User Operation verification gas limit is too low.",{cause:t,metaMessages:["This could arise when:","- the `verificationGasLimit` is too low to verify the User Operation"].filter(Boolean),name:"VerificationGasLimitTooLowError"})}}Object.defineProperty(ly,"message",{enumerable:!0,configurable:!0,writable:!0,value:/aa41/});class xj extends ee{constructor(t,{callData:n,callGasLimit:r,docsPath:i,factory:s,factoryData:o,initCode:a,maxFeePerGas:c,maxPriorityFeePerGas:u,nonce:l,paymaster:d,paymasterAndData:f,paymasterData:h,paymasterPostOpGasLimit:m,paymasterVerificationGasLimit:y,preVerificationGas:w,sender:b,signature:x,verificationGasLimit:v}){const S=ha({callData:n,callGasLimit:r,factory:s,factoryData:o,initCode:a,maxFeePerGas:typeof c<"u"&&`${xn(c)} gwei`,maxPriorityFeePerGas:typeof u<"u"&&`${xn(u)} gwei`,nonce:l,paymaster:d,paymasterAndData:f,paymasterData:h,paymasterPostOpGasLimit:m,paymasterVerificationGasLimit:y,preVerificationGas:w,sender:b,signature:x,verificationGasLimit:v});super(t.shortMessage,{cause:t,docsPath:i,metaMessages:[...t.metaMessages?[...t.metaMessages," "]:[],"Request Arguments:",S].filter(Boolean),name:"UserOperationExecutionError"}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.cause=t}}class Sj extends ee{constructor({hash:t}){super(`User Operation receipt with hash "${t}" could not be found. The User Operation may not have been processed yet.`,{name:"UserOperationReceiptNotFoundError"})}}class kj extends ee{constructor({hash:t}){super(`User Operation with hash "${t}" could not be found.`,{name:"UserOperationNotFoundError"})}}class bE extends ee{constructor({hash:t}){super(`Timed out while waiting for User Operation with hash "${t}" to be confirmed.`,{name:"WaitForUserOperationReceiptTimeoutError"})}}const Aj=[Oa,Af,fo,If,Cf,Pf,Rf,Bf,Tf,Of,Mf];function Ij(e,t){const n=(e.details||"").toLowerCase();if(Ug.message.test(n))return new Ug({cause:e});if(Hg.message.test(n))return new Hg({cause:e});if(zg.message.test(n))return new zg({cause:e});if(Wg.message.test(n))return new Wg({cause:e});if(Gg.message.test(n))return new Gg({cause:e,factory:t.factory,factoryData:t.factoryData,initCode:t.initCode});if(qg.message.test(n))return new qg({cause:e,factory:t.factory,factoryData:t.factoryData,initCode:t.initCode});if(Vg.message.test(n))return new Vg({cause:e,factory:t.factory,factoryData:t.factoryData,initCode:t.initCode,sender:t.sender});if(Kg.message.test(n))return new Kg({cause:e});if(Jg.message.test(n))return new Jg({cause:e});if(Yg.message.test(n))return new Yg({cause:e,nonce:t.nonce});if(Zg.message.test(n))return new Zg({cause:e});if(Qg.message.test(n))return new Qg({cause:e});if(Xg.message.test(n))return new Xg({cause:e});if(fo.message.test(n))return new fo({cause:e});if(ey.message.test(n))return new ey({cause:e});if(ty.message.test(n))return new ty({cause:e});if(ny.message.test(n))return new ny({cause:e});if(iy.message.test(n))return new iy({cause:e});if(ry.message.test(n))return new ry({cause:e,factory:t.factory,factoryData:t.factoryData,initCode:t.initCode});if(sy.message.test(n))return new sy({cause:e});if(oy.message.test(n))return new oy({cause:e});if(cy.message.test(n))return new cy({cause:e});if(ay.message.test(n))return new ay({cause:e});if(uy.message.test(n))return new uy({cause:e});if(ly.message.test(n))return new ly({cause:e});const r=e.walk(i=>Aj.some(s=>s.code===i.code));if(r){if(r.code===Oa.code)return new Oa({cause:e,data:r.data,message:r.details});if(r.code===Af.code)return new Af({cause:e});if(r.code===fo.code)return new fo({cause:e});if(r.code===If.code)return new If({cause:e});if(r.code===Cf.code)return new Cf({cause:e});if(r.code===Pf.code)return new Pf({cause:e});if(r.code===Rf.code)return new Rf({cause:e});if(r.code===Bf.code)return new Bf({cause:e});if(r.code===Tf.code)return new Tf({cause:e});if(r.code===Of.code)return new Of({cause:e});if(r.code===Mf.code)return new Mf({cause:e})}return new Ej({cause:e})}function wE(e,{calls:t,docsPath:n,...r}){const i=(()=>{const s=Ij(e,r);if(t&&s instanceof Oa){const o=Cj(s),a=t==null?void 0:t.filter(c=>c.abi);if(o&&a.length>0)return Pj({calls:a,revertData:o})}return s})();return new xj(i,{docsPath:n,...r})}function Cj(e){let t;return e.walk(n=>{var i,s,o,a;const r=n;if(typeof r.data=="string"||typeof((i=r.data)==null?void 0:i.revertData)=="string"||!(r instanceof ee)&&typeof r.message=="string"){const c=(a=(o=((s=r.data)==null?void 0:s.revertData)||r.data||r.message).match)==null?void 0:a.call(o,/(0x[A-Za-z0-9]*)/);if(c)return t=c[1],!0}return!1}),t}function Pj(e){const{calls:t,revertData:n}=e,{abi:r,functionName:i,args:s,to:o}=(()=>{const c=t==null?void 0:t.filter(l=>!!l.abi);if(c.length===1)return c[0];const u=c.filter(l=>{try{return!!lp({abi:l.abi,data:n})}catch{return!1}});return u.length===1?u[0]:{abi:[],functionName:c.reduce((l,d)=>`${l?`${l} | `:""}${d.functionName}`,""),args:void 0,to:void 0}})(),a=n==="0x"?new Jv({functionName:i}):new hd({abi:r,data:n,functionName:i});return new fd(a,{abi:r,args:s,contractAddress:o,functionName:i})}function Rj(e){const t={};return e.callGasLimit&&(t.callGasLimit=BigInt(e.callGasLimit)),e.preVerificationGas&&(t.preVerificationGas=BigInt(e.preVerificationGas)),e.verificationGasLimit&&(t.verificationGasLimit=BigInt(e.verificationGasLimit)),e.paymasterPostOpGasLimit&&(t.paymasterPostOpGasLimit=BigInt(e.paymasterPostOpGasLimit)),e.paymasterVerificationGasLimit&&(t.paymasterVerificationGasLimit=BigInt(e.paymasterVerificationGasLimit)),t}function Nf(e){const t={};return typeof e.callData<"u"&&(t.callData=e.callData),typeof e.callGasLimit<"u"&&(t.callGasLimit=oe(e.callGasLimit)),typeof e.factory<"u"&&(t.factory=e.factory),typeof e.factoryData<"u"&&(t.factoryData=e.factoryData),typeof e.initCode<"u"&&(t.initCode=e.initCode),typeof e.maxFeePerGas<"u"&&(t.maxFeePerGas=oe(e.maxFeePerGas)),typeof e.maxPriorityFeePerGas<"u"&&(t.maxPriorityFeePerGas=oe(e.maxPriorityFeePerGas)),typeof e.nonce<"u"&&(t.nonce=oe(e.nonce)),typeof e.paymaster<"u"&&(t.paymaster=e.paymaster),typeof e.paymasterAndData<"u"&&(t.paymasterAndData=e.paymasterAndData||"0x"),typeof e.paymasterData<"u"&&(t.paymasterData=e.paymasterData),typeof e.paymasterPostOpGasLimit<"u"&&(t.paymasterPostOpGasLimit=oe(e.paymasterPostOpGasLimit)),typeof e.paymasterSignature<"u"&&(t.paymasterSignature=e.paymasterSignature),typeof e.paymasterVerificationGasLimit<"u"&&(t.paymasterVerificationGasLimit=oe(e.paymasterVerificationGasLimit)),typeof e.preVerificationGas<"u"&&(t.preVerificationGas=oe(e.preVerificationGas)),typeof e.sender<"u"&&(t.sender=e.sender),typeof e.signature<"u"&&(t.signature=e.signature),typeof e.verificationGasLimit<"u"&&(t.verificationGasLimit=oe(e.verificationGasLimit)),typeof e.authorization<"u"&&(t.eip7702Auth=Tj(e.authorization)),t}function Tj(e){return{address:e.address,chainId:oe(e.chainId),nonce:oe(e.nonce),r:e.r?oe(BigInt(e.r),{size:32}):Kt("0x",{size:32}),s:e.s?oe(BigInt(e.s),{size:32}):Kt("0x",{size:32}),yParity:e.yParity?oe(e.yParity,{size:1}):Kt("0x",{size:32})}}async function Oj(e,t){const{chainId:n,entryPointAddress:r,context:i,...s}=t,o=Nf(s),{paymasterPostOpGasLimit:a,paymasterVerificationGasLimit:c,...u}=await e.request({method:"pm_getPaymasterData",params:[{...o,callGasLimit:o.callGasLimit??"0x0",verificationGasLimit:o.verificationGasLimit??"0x0",preVerificationGas:o.preVerificationGas??"0x0"},r,oe(n),i]});return{...u,...a&&{paymasterPostOpGasLimit:It(a)},...c&&{paymasterVerificationGasLimit:It(c)}}}async function Mj(e,t){const{chainId:n,entryPointAddress:r,context:i,...s}=t,o=Nf(s),{paymasterPostOpGasLimit:a,paymasterVerificationGasLimit:c,...u}=await e.request({method:"pm_getPaymasterStubData",params:[{...o,callGasLimit:o.callGasLimit??"0x0",verificationGasLimit:o.verificationGasLimit??"0x0",preVerificationGas:o.preVerificationGas??"0x0"},r,oe(n),i]});return{...u,...a&&{paymasterPostOpGasLimit:It(a)},...c&&{paymasterVerificationGasLimit:It(c)}}}const Bj=["factory","fees","gas","paymaster","nonce","signature","authorization"];async function dy(e,t){var j,U;const n=t,{account:r=e.account,dataSuffix:i=typeof e.dataSuffix=="string"?e.dataSuffix:(j=e.dataSuffix)==null?void 0:j.value,parameters:s=Bj,stateOverride:o}=n;if(!r)throw new xa;const a=Ut(r),c=e,u=n.paymaster??(c==null?void 0:c.paymaster),l=typeof u=="string"?u:void 0,{getPaymasterStubData:d,getPaymasterData:f}=(()=>{if(u===!0)return{getPaymasterStubData:L=>ve(c,Mj,"getPaymasterStubData")(L),getPaymasterData:L=>ve(c,Oj,"getPaymasterData")(L)};if(typeof u=="object"){const{getPaymasterStubData:L,getPaymasterData:Y}=u;return{getPaymasterStubData:Y&&L?L:Y,getPaymasterData:Y&&L?Y:void 0}}return{getPaymasterStubData:void 0,getPaymasterData:void 0}})(),h=n.paymasterContext?n.paymasterContext:c==null?void 0:c.paymasterContext;let m={...n,paymaster:l,sender:a.address};const[y,w,b,x,v]=await Promise.all([(async()=>n.calls?a.encodeCalls(n.calls.map(L=>{const Y=L;return Y.abi?{data:jt(Y),to:Y.to,value:Y.value}:Y})):n.callData)(),(async()=>{if(!s.includes("factory"))return;if(n.initCode)return{initCode:n.initCode};if(n.factory&&n.factoryData)return{factory:n.factory,factoryData:n.factoryData};const{factory:L,factoryData:Y}=await a.getFactoryArgs();return a.entryPoint.version==="0.6"?{initCode:L&&Y?Zt([L,Y]):void 0}:{factory:L,factoryData:Y}})(),(async()=>{var L;if(s.includes("fees")){if(typeof n.maxFeePerGas=="bigint"&&typeof n.maxPriorityFeePerGas=="bigint")return m;if((L=c==null?void 0:c.userOperation)!=null&&L.estimateFeesPerGas){const Y=await c.userOperation.estimateFeesPerGas({account:a,bundlerClient:c,userOperation:m});return{...m,...Y}}try{const Y=c.client??e,Z=await ve(Y,W2,"estimateFeesPerGas")({chain:Y.chain,type:"eip1559"});return{maxFeePerGas:typeof n.maxFeePerGas=="bigint"?n.maxFeePerGas:BigInt(2n*Z.maxFeePerGas),maxPriorityFeePerGas:typeof n.maxPriorityFeePerGas=="bigint"?n.maxPriorityFeePerGas:BigInt(2n*Z.maxPriorityFeePerGas)}}catch{return}}})(),(async()=>{if(s.includes("nonce"))return typeof n.nonce=="bigint"?n.nonce:a.getNonce()})(),(async()=>{if(s.includes("authorization")){if(typeof n.authorization=="object")return n.authorization;if(a.authorization&&!await a.isDeployed())return{...await rB(a.client,a.authorization),r:"0xfffffffffffffffffffffffffffffff000000000000000000000000000000000",s:"0x7aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",yParity:1}}})()]);typeof y<"u"&&(m.callData=i?Zt([y,i]):y),typeof w<"u"&&(m={...m,...w}),typeof b<"u"&&(m={...m,...b}),typeof x<"u"&&(m.nonce=x),typeof v<"u"&&(m.authorization=v),s.includes("signature")&&(typeof n.signature<"u"?m.signature=n.signature:m.signature=await a.getStubSignature(m)),a.entryPoint.version==="0.6"&&!m.initCode&&(m.initCode="0x");let S;async function I(){return S||(e.chain?e.chain.id:(S=await ve(e,Xs,"getChainId")({}),S))}let N=!1;if(s.includes("paymaster")&&d&&!l&&!n.paymasterAndData){const{isFinal:L=!1,sponsor:Y,...Z}=await d({chainId:await I(),entryPointAddress:a.entryPoint.address,context:h,...m});N=L,m={...m,...Z}}if(a.entryPoint.version==="0.6"&&!m.paymasterAndData&&(m.paymasterAndData="0x"),s.includes("gas")){if((U=a.userOperation)!=null&&U.estimateGas){const L=await a.userOperation.estimateGas(m);m={...m,...L}}if(typeof m.callGasLimit>"u"||typeof m.preVerificationGas>"u"||typeof m.verificationGasLimit>"u"||m.paymaster&&typeof m.paymasterPostOpGasLimit>"u"||m.paymaster&&typeof m.paymasterVerificationGasLimit>"u"){const L=await ve(c,vE,"estimateUserOperationGas")({account:a,callGasLimit:0n,preVerificationGas:0n,verificationGasLimit:0n,stateOverride:o,...m.paymaster?{paymasterPostOpGasLimit:0n,paymasterVerificationGasLimit:0n}:{},...m});m={...m,callGasLimit:m.callGasLimit??L.callGasLimit,preVerificationGas:m.preVerificationGas??L.preVerificationGas,verificationGasLimit:m.verificationGasLimit??L.verificationGasLimit,paymasterPostOpGasLimit:m.paymasterPostOpGasLimit??L.paymasterPostOpGasLimit,paymasterVerificationGasLimit:m.paymasterVerificationGasLimit??L.paymasterVerificationGasLimit}}}if(s.includes("paymaster")&&f&&!l&&!n.paymasterAndData&&!N){const L=await f({chainId:await I(),entryPointAddress:a.entryPoint.address,context:h,...m});m={...m,...L}}return delete m.calls,delete m.parameters,delete m.paymasterContext,typeof m.paymaster!="string"&&delete m.paymaster,m}async function vE(e,t){var c;const{account:n=e.account,entryPointAddress:r,stateOverride:i}=t;if(!n&&!t.sender)throw new xa;const s=n?Ut(n):void 0,o=Ed(i),a=s?await ve(e,dy,"prepareUserOperation")({...t,parameters:["authorization","factory","nonce","paymaster","signature"]}):t;try{const u=[Nf(a),r??((c=s==null?void 0:s.entryPoint)==null?void 0:c.address)],l=await e.request({method:"eth_estimateUserOperationGas",params:o?[...u,o]:[...u]});return Rj(l)}catch(u){const l=t.calls;throw wE(u,{...a,...l?{calls:l}:{}})}}function Nj(e){return e.request({method:"eth_supportedEntryPoints"})}function Lj(e){const t={...e};return e.callGasLimit&&(t.callGasLimit=BigInt(e.callGasLimit)),e.maxFeePerGas&&(t.maxFeePerGas=BigInt(e.maxFeePerGas)),e.maxPriorityFeePerGas&&(t.maxPriorityFeePerGas=BigInt(e.maxPriorityFeePerGas)),e.nonce&&(t.nonce=BigInt(e.nonce)),e.paymasterPostOpGasLimit&&(t.paymasterPostOpGasLimit=BigInt(e.paymasterPostOpGasLimit)),e.paymasterVerificationGasLimit&&(t.paymasterVerificationGasLimit=BigInt(e.paymasterVerificationGasLimit)),e.preVerificationGas&&(t.preVerificationGas=BigInt(e.preVerificationGas)),e.verificationGasLimit&&(t.verificationGasLimit=BigInt(e.verificationGasLimit)),t}async function jj(e,{hash:t}){const n=await e.request({method:"eth_getUserOperationByHash",params:[t]},{dedupe:!0});if(!n)throw new kj({hash:t});const{blockHash:r,blockNumber:i,entryPoint:s,transactionHash:o,userOperation:a}=n;return{blockHash:r,blockNumber:BigInt(i),entryPoint:s,transactionHash:o,userOperation:Lj(a)}}function $j(e){const t={...e};return e.actualGasCost&&(t.actualGasCost=BigInt(e.actualGasCost)),e.actualGasUsed&&(t.actualGasUsed=BigInt(e.actualGasUsed)),e.logs&&(t.logs=e.logs.map(n=>Rr(n))),e.receipt&&(t.receipt=Pd(t.receipt)),t}async function _E(e,{hash:t}){const n=await e.request({method:"eth_getUserOperationReceipt",params:[t]},{dedupe:!0});if(!n)throw new Sj({hash:t});return $j(n)}async function Fj(e,t){var c,u;const{account:n=e.account,entryPointAddress:r}=t;if(!n&&!t.sender)throw new xa;const i=n?Ut(n):void 0,s=i?await ve(e,dy,"prepareUserOperation")(t):t,o=t.signature||await((c=i==null?void 0:i.signUserOperation)==null?void 0:c.call(i,s)),a=Nf({...s,signature:o});try{return await e.request({method:"eth_sendUserOperation",params:[a,r??((u=i==null?void 0:i.entryPoint)==null?void 0:u.address)]},{retryCount:0})}catch(l){const d=t.calls;throw wE(l,{...s,...d?{calls:d}:{},signature:o})}}function Dj(e,t){const{hash:n,pollingInterval:r=e.pollingInterval,retryCount:i,timeout:s=12e4}=t;let o=0;const a=Ht(["waitForUserOperationReceipt",e.uid,n]);return new Promise((c,u)=>{const l=Kr(a,{resolve:c,reject:u},d=>{const f=y=>{m(),y(),l()},h=s?setTimeout(()=>f(()=>d.reject(new bE({hash:n}))),s):void 0,m=no(async()=>{i&&o>=i&&(clearTimeout(h),f(()=>d.reject(new bE({hash:n}))));try{const y=await ve(e,_E,"getUserOperationReceipt")({hash:n});clearTimeout(h),f(()=>d.resolve(y))}catch(y){const w=y;w.name!=="UserOperationReceiptNotFoundError"&&(clearTimeout(h),f(()=>d.reject(w)))}o++},{emitOnBegin:!0,interval:r});return m})})}function Uj(e){return{estimateUserOperationGas:t=>vE(e,t),getChainId:()=>Xs(e),getSupportedEntryPoints:()=>Nj(e),getUserOperation:t=>jj(e,t),getUserOperationReceipt:t=>_E(e,t),prepareUserOperation:t=>dy(e,t),sendUserOperation:t=>Fj(e,t),waitForUserOperationReceipt:t=>Dj(e,t)}}function Hj(e){const{client:t,dataSuffix:n,key:r="bundler",name:i="Bundler Client",paymaster:s,paymasterContext:o,transport:a,userOperation:c}=e;return Object.assign(zd({...e,chain:e.chain??(t==null?void 0:t.chain),key:r,name:i,transport:a,type:"bundlerClient"}),{client:t,dataSuffix:n??(t==null?void 0:t.dataSuffix),paymaster:s,paymasterContext:o,userOperation:c}).extend(Uj)}const zj="0.1.1";function Wj(){return zj}class Rt extends Error{constructor(t,n={}){const r=(()=>{var c;if(n.cause instanceof Rt){if(n.cause.details)return n.cause.details;if(n.cause.shortMessage)return n.cause.shortMessage}return(c=n.cause)!=null&&c.message?n.cause.message:n.details})(),i=n.cause instanceof Rt&&n.cause.docsPath||n.docsPath,o=`https://oxlib.sh${i??""}`,a=[t||"An error occurred.",...n.metaMessages?["",...n.metaMessages]:[],...r||i?["",r?`Details: ${r}`:void 0,i?`See: ${o}`:void 0]:[]].filter(c=>typeof c=="string").join(`
118
+ `);super(a,n.cause?{cause:n.cause}:void 0),Object.defineProperty(this,"details",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docs",{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,"shortMessage",{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,"name",{enumerable:!0,configurable:!0,writable:!0,value:"BaseError"}),Object.defineProperty(this,"version",{enumerable:!0,configurable:!0,writable:!0,value:`ox@${Wj()}`}),this.cause=n.cause,this.details=r,this.docs=o,this.docsPath=i,this.shortMessage=t}walk(t){return EE(this,t)}}function EE(e,t){return t!=null&&t(e)?e:e&&typeof e=="object"&&"cause"in e&&e.cause?EE(e.cause,t):t?null:e}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const fy=BigInt(0),hy=BigInt(1);function Lf(e,t=""){if(typeof e!="boolean"){const n=t&&`"${t}"`;throw new Error(n+"expected boolean, got type="+typeof e)}return e}function ho(e,t,n=""){const r=nd(e),i=e==null?void 0:e.length,s=t!==void 0;if(!r||s&&i!==t){const o=n&&`"${n}" `,a=s?` of length ${t}`:"",c=r?`length=${i}`:`type=${typeof e}`;throw new Error(o+"expected Uint8Array"+a+", got "+c)}return e}function jf(e){const t=e.toString(16);return t.length&1?"0"+t:t}function xE(e){if(typeof e!="string")throw new Error("hex string expected, got "+typeof e);return e===""?fy:BigInt("0x"+e)}function $f(e){return xE(oa(e))}function SE(e){return bi(e),xE(oa(Uint8Array.from(e).reverse()))}function py(e,t){return rd(e.toString(16).padStart(t*2,"0"))}function kE(e,t){return py(e,t).reverse()}function Jn(e,t,n){let r;if(typeof t=="string")try{r=rd(t)}catch(i){throw new Error(e+" must be hex string or Uint8Array, cause: "+i)}else if(nd(t))r=Uint8Array.from(t);else throw new Error(e+" must be hex string or Uint8Array");return r.length,r}const my=e=>typeof e=="bigint"&&fy<=e;function Gj(e,t,n){return my(e)&&my(t)&&my(n)&&t<=e&&e<n}function qj(e,t,n,r){if(!Gj(t,n,r))throw new Error("expected valid "+e+": "+n+" <= n < "+r+", got "+t)}function AE(e){let t;for(t=0;e>fy;e>>=hy,t+=1);return t}const Hu=e=>(hy<<BigInt(e))-hy;function Vj(e,t,n){if(typeof e!="number"||e<2)throw new Error("hashLen must be a number");if(typeof t!="number"||t<2)throw new Error("qByteLen must be a number");if(typeof n!="function")throw new Error("hmacFn must be a function");const r=h=>new Uint8Array(h),i=h=>Uint8Array.of(h);let s=r(e),o=r(e),a=0;const c=()=>{s.fill(1),o.fill(0),a=0},u=(...h)=>n(o,s,...h),l=(h=r(0))=>{o=u(i(0),h),s=u(),h.length!==0&&(o=u(i(1),h),s=u())},d=()=>{if(a++>=1e3)throw new Error("drbg: tried 1000 values");let h=0;const m=[];for(;h<t;){s=u();const y=s.slice();m.push(y),h+=s.length}return vi(...m)};return(h,m)=>{c(),l(h);let y;for(;!(y=m(d()));)l();return c(),y}}function gy(e,t,n={}){if(!e||typeof e!="object")throw new Error("expected valid options object");function r(i,s,o){const a=e[i];if(o&&a===void 0)return;const c=typeof a;if(c!==s||a===null)throw new Error(`param "${i}" is invalid: expected ${s}, got ${c}`)}Object.entries(t).forEach(([i,s])=>r(i,s,!1)),Object.entries(n).forEach(([i,s])=>r(i,s,!0))}function IE(e){const t=new WeakMap;return(n,...r)=>{const i=t.get(n);if(i!==void 0)return i;const s=e(n,...r);return t.set(n,s),s}}const Kj="#__bigint";function Ff(e,t,n){return JSON.stringify(e,(r,i)=>typeof i=="bigint"?i.toString()+Kj:i,n)}function Jj(e,t){if(Ba(e)>t)throw new d$({givenSize:Ba(e),maxSize:t})}function Zj(e,t){if(typeof t=="number"&&t>0&&t>Ba(e)-1)throw new UE({offset:t,position:"start",size:Ba(e)})}function Yj(e,t,n){if(typeof t=="number"&&typeof n=="number"&&Ba(e)!==n-t)throw new UE({offset:n,position:"end",size:Ba(e)})}const Oi={zero:48,nine:57,A:65,F:70,a:97,f:102};function CE(e){if(e>=Oi.zero&&e<=Oi.nine)return e-Oi.zero;if(e>=Oi.A&&e<=Oi.F)return e-(Oi.A-10);if(e>=Oi.a&&e<=Oi.f)return e-(Oi.a-10)}function yy(e,t){if(ys(e)>t)throw new a$({givenSize:ys(e),maxSize:t})}function Qj(e,t){if(typeof t=="number"&&t>0&&t>ys(e)-1)throw new NE({offset:t,position:"start",size:ys(e)})}function Xj(e,t,n){if(typeof t=="number"&&typeof n=="number"&&ys(e)!==n-t)throw new NE({offset:n,position:"end",size:ys(e)})}function PE(e,t={}){const{dir:n,size:r=32}=t;if(r===0)return e;const i=e.replace("0x","");if(i.length>r*2)throw new c$({size:Math.ceil(i.length/2),targetSize:r,type:"Hex"});return`0x${i[n==="right"?"padEnd":"padStart"](r*2,"0")}`}const e$=new TextEncoder,t$=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function n$(e,t={}){const{strict:n=!1}=t;if(!e)throw new ME(e);if(typeof e!="string")throw new ME(e);if(n&&!/^0x[0-9a-fA-F]*$/.test(e))throw new BE(e);if(!e.startsWith("0x"))throw new BE(e)}function Df(...e){return`0x${e.reduce((t,n)=>t+n.replace("0x",""),"")}`}function RE(e){return e instanceof Uint8Array?Ma(e):Array.isArray(e)?Ma(new Uint8Array(e)):e}function Ma(e,t={}){let n="";for(let i=0;i<e.length;i++)n+=t$[e[i]];const r=`0x${n}`;return typeof t.size=="number"?(yy(r,t.size),OE(r,t.size)):r}function gs(e,t={}){const{signed:n,size:r}=t,i=BigInt(e);let s;r?n?s=(1n<<BigInt(r)*8n-1n)-1n:s=2n**(BigInt(r)*8n)-1n:typeof e=="number"&&(s=BigInt(Number.MAX_SAFE_INTEGER));const o=typeof s=="bigint"&&n?-s-1n:0;if(s&&i>s||i<o){const u=typeof e=="bigint"?"n":"";throw new o$({max:s?`${s}${u}`:void 0,min:`${o}${u}`,signed:n,size:r,value:`${e}${u}`})}const c=`0x${(n&&i<0?(1n<<BigInt(r*8))+BigInt(i):i).toString(16)}`;return r?r$(c,r):c}function TE(e,t={}){return Ma(e$.encode(e),t)}function r$(e,t){return PE(e,{dir:"left",size:t})}function OE(e,t){return PE(e,{dir:"right",size:t})}function pr(e,t,n,r={}){const{strict:i}=r;Qj(e,t);const s=`0x${e.replace("0x","").slice((t??0)*2,(n??e.length)*2)}`;return i&&Xj(s,t,n),s}function ys(e){return Math.ceil((e.length-2)/2)}function i$(e,t={}){const{signed:n}=t;t.size&&yy(e,t.size);const r=BigInt(e);if(!n)return r;const i=(e.length-2)/2,s=(1n<<BigInt(i)*8n)-1n,o=s>>1n;return r<=o?r:r-s-1n}function s$(e,t={}){const{strict:n=!1}=t;try{return n$(e,{strict:n}),!0}catch{return!1}}class o$ extends Rt{constructor({max:t,min:n,signed:r,size:i,value:s}){super(`Number \`${s}\` is not in safe${i?` ${i*8}-bit`:""}${r?" signed":" unsigned"} integer range ${t?`(\`${n}\` to \`${t}\`)`:`(above \`${n}\`)`}`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Hex.IntegerOutOfRangeError"})}}class ME extends Rt{constructor(t){super(`Value \`${typeof t=="object"?Ff(t):t}\` of type \`${typeof t}\` is an invalid hex type.`,{metaMessages:['Hex types must be represented as `"0x${string}"`.']}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Hex.InvalidHexTypeError"})}}class BE extends Rt{constructor(t){super(`Value \`${t}\` is an invalid hex value.`,{metaMessages:['Hex values must start with `"0x"` and contain only hexadecimal characters (0-9, a-f, A-F).']}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Hex.InvalidHexValueError"})}}let a$=class extends Rt{constructor({givenSize:t,maxSize:n}){super(`Size cannot exceed \`${n}\` bytes. Given size: \`${t}\` bytes.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Hex.SizeOverflowError"})}},NE=class extends Rt{constructor({offset:t,position:n,size:r}){super(`Slice ${n==="start"?"starting":"ending"} at offset \`${t}\` is out-of-bounds (size: \`${r}\`).`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Hex.SliceOffsetOutOfBoundsError"})}};class c$ extends Rt{constructor({size:t,targetSize:n,type:r}){super(`${r.charAt(0).toUpperCase()}${r.slice(1).toLowerCase()} size (\`${t}\`) exceeds padding size (\`${n}\`).`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Hex.SizeExceedsPaddingSizeError"})}}function u$(e){if(!(e instanceof Uint8Array)){if(!e)throw new Uf(e);if(typeof e!="object")throw new Uf(e);if(!("BYTES_PER_ELEMENT"in e))throw new Uf(e);if(e.BYTES_PER_ELEMENT!==1||e.constructor.name!=="Uint8Array")throw new Uf(e)}}function LE(e){return e instanceof Uint8Array?e:typeof e=="string"?$E(e):jE(e)}function jE(e){return e instanceof Uint8Array?e:new Uint8Array(e)}function $E(e,t={}){const{size:n}=t;let r=e;n&&(yy(e,n),r=OE(e,n));let i=r.slice(2);i.length%2&&(i=`0${i}`);const s=i.length/2,o=new Uint8Array(s);for(let a=0,c=0;a<s;a++){const u=CE(i.charCodeAt(c++)),l=CE(i.charCodeAt(c++));if(u===void 0||l===void 0)throw new Rt(`Invalid byte sequence ("${i[c-2]}${i[c-1]}" in "${i}").`);o[a]=u*16+l}return o}function Ba(e){return e.length}function FE(e,t,n,r={}){const{strict:i}=r;Zj(e,t);const s=e.slice(t,n);return i&&Yj(s,t,n),s}function DE(e,t={}){const{size:n}=t;typeof n<"u"&&Jj(e,n);const r=Ma(e,t);return i$(r,t)}function l$(e){try{return u$(e),!0}catch{return!1}}class Uf extends Rt{constructor(t){super(`Value \`${typeof t=="object"?Ff(t):t}\` of type \`${typeof t}\` is an invalid Bytes value.`,{metaMessages:["Bytes values must be of type `Bytes`."]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Bytes.InvalidBytesTypeError"})}}class d$ extends Rt{constructor({givenSize:t,maxSize:n}){super(`Size cannot exceed \`${n}\` bytes. Given size: \`${t}\` bytes.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Bytes.SizeOverflowError"})}}class UE extends Rt{constructor({offset:t,position:n,size:r}){super(`Slice ${n==="start"?"starting":"ending"} at offset \`${t}\` is out-of-bounds (size: \`${r}\`).`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Bytes.SliceOffsetOutOfBoundsError"})}}function HE(e,t={}){const{as:n=typeof e=="string"?"Hex":"Bytes"}=t,r=K2(LE(e));return n==="Bytes"?r:Ma(r)}function zE(e,t={}){const{compressed:n}=t,{prefix:r,x:i,y:s}=e;if(n===!1||typeof i=="bigint"&&typeof s=="bigint"){if(r!==4)throw new GE({prefix:r,cause:new g$});return}if(n===!0||typeof i=="bigint"&&typeof s>"u"){if(r!==3&&r!==2)throw new GE({prefix:r,cause:new m$});return}throw new p$({publicKey:e})}function f$(e){const t=(()=>{if(s$(e))return WE(e);if(l$(e))return h$(e);const{prefix:n,x:r,y:i}=e;return typeof r=="bigint"&&typeof i=="bigint"?{prefix:n??4,x:r,y:i}:{prefix:n,x:r}})();return zE(t),t}function h$(e){return WE(Ma(e))}function WE(e){if(e.length!==132&&e.length!==130&&e.length!==68)throw new y$({publicKey:e});if(e.length===130){const r=BigInt(pr(e,0,32)),i=BigInt(pr(e,32,64));return{prefix:4,x:r,y:i}}if(e.length===132){const r=Number(pr(e,0,1)),i=BigInt(pr(e,1,33)),s=BigInt(pr(e,33,65));return{prefix:r,x:i,y:s}}const t=Number(pr(e,0,1)),n=BigInt(pr(e,1,33));return{prefix:t,x:n}}function by(e,t={}){zE(e);const{prefix:n,x:r,y:i}=e,{includePrefix:s=!0}=t;return Df(s?gs(n,{size:1}):"0x",gs(r,{size:32}),typeof i=="bigint"?gs(i,{size:32}):"0x")}class p$ extends Rt{constructor({publicKey:t}){super(`Value \`${Ff(t)}\` is not a valid public key.`,{metaMessages:["Public key must contain:","- an `x` and `prefix` value (compressed)","- an `x`, `y`, and `prefix` value (uncompressed)"]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"PublicKey.InvalidError"})}}class GE extends Rt{constructor({prefix:t,cause:n}){super(`Prefix "${t}" is invalid.`,{cause:n}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"PublicKey.InvalidPrefixError"})}}class m$ extends Rt{constructor(){super("Prefix must be 2 or 3 for compressed public keys."),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"PublicKey.InvalidCompressedPrefixError"})}}class g$ extends Rt{constructor(){super("Prefix must be 4 for uncompressed public keys."),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"PublicKey.InvalidUncompressedPrefixError"})}}let y$=class extends Rt{constructor({publicKey:t}){super(`Value \`${t}\` is an invalid public key size.`,{metaMessages:["Expected: 33 bytes (compressed + prefix), 64 bytes (uncompressed) or 65 bytes (uncompressed + prefix).",`Received ${ys(RE(t))} bytes.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"PublicKey.InvalidSerializedSizeError"})}};const qE=2n**256n-1n;/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const ir=BigInt(0),Nn=BigInt(1),po=BigInt(2),VE=BigInt(3),KE=BigInt(4),JE=BigInt(5),b$=BigInt(7),ZE=BigInt(8),w$=BigInt(9),YE=BigInt(16);function Br(e,t){const n=e%t;return n>=ir?n:t+n}function QE(e,t){if(e===ir)throw new Error("invert: expected non-zero number");if(t<=ir)throw new Error("invert: expected positive modulus, got "+t);let n=Br(e,t),r=t,i=ir,s=Nn;for(;n!==ir;){const a=r/n,c=r%n,u=i-s*a;r=n,n=c,i=s,s=u}if(r!==Nn)throw new Error("invert: does not exist");return Br(i,t)}function wy(e,t,n){if(!e.eql(e.sqr(t),n))throw new Error("Cannot find square root")}function XE(e,t){const n=(e.ORDER+Nn)/KE,r=e.pow(t,n);return wy(e,r,t),r}function v$(e,t){const n=(e.ORDER-JE)/ZE,r=e.mul(t,po),i=e.pow(r,n),s=e.mul(t,i),o=e.mul(e.mul(s,po),i),a=e.mul(s,e.sub(o,e.ONE));return wy(e,a,t),a}function _$(e){const t=mo(e),n=ex(e),r=n(t,t.neg(t.ONE)),i=n(t,r),s=n(t,t.neg(r)),o=(e+b$)/YE;return(a,c)=>{let u=a.pow(c,o),l=a.mul(u,r);const d=a.mul(u,i),f=a.mul(u,s),h=a.eql(a.sqr(l),c),m=a.eql(a.sqr(d),c);u=a.cmov(u,l,h),l=a.cmov(f,d,m);const y=a.eql(a.sqr(l),c),w=a.cmov(u,l,y);return wy(a,w,c),w}}function ex(e){if(e<VE)throw new Error("sqrt is not defined for small field");let t=e-Nn,n=0;for(;t%po===ir;)t/=po,n++;let r=po;const i=mo(e);for(;nx(i,r)===1;)if(r++>1e3)throw new Error("Cannot find square root: probably non-prime P");if(n===1)return XE;let s=i.pow(r,t);const o=(t+Nn)/po;return function(c,u){if(c.is0(u))return u;if(nx(c,u)!==1)throw new Error("Cannot find square root");let l=n,d=c.mul(c.ONE,s),f=c.pow(u,t),h=c.pow(u,o);for(;!c.eql(f,c.ONE);){if(c.is0(f))return c.ZERO;let m=1,y=c.sqr(f);for(;!c.eql(y,c.ONE);)if(m++,y=c.sqr(y),m===l)throw new Error("Cannot find square root");const w=Nn<<BigInt(l-m-1),b=c.pow(d,w);l=m,d=c.sqr(b),f=c.mul(f,d),h=c.mul(h,b)}return h}}function E$(e){return e%KE===VE?XE:e%ZE===JE?v$:e%YE===w$?_$(e):ex(e)}const x$=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function S$(e){const t={ORDER:"bigint",MASK:"bigint",BYTES:"number",BITS:"number"},n=x$.reduce((r,i)=>(r[i]="function",r),t);return gy(e,n),e}function k$(e,t,n){if(n<ir)throw new Error("invalid exponent, negatives unsupported");if(n===ir)return e.ONE;if(n===Nn)return t;let r=e.ONE,i=t;for(;n>ir;)n&Nn&&(r=e.mul(r,i)),i=e.sqr(i),n>>=Nn;return r}function tx(e,t,n=!1){const r=new Array(t.length).fill(n?e.ZERO:void 0),i=t.reduce((o,a,c)=>e.is0(a)?o:(r[c]=o,e.mul(o,a)),e.ONE),s=e.inv(i);return t.reduceRight((o,a,c)=>e.is0(a)?o:(r[c]=e.mul(o,r[c]),e.mul(o,a)),s),r}function nx(e,t){const n=(e.ORDER-Nn)/po,r=e.pow(t,n),i=e.eql(r,e.ONE),s=e.eql(r,e.ZERO),o=e.eql(r,e.neg(e.ONE));if(!i&&!s&&!o)throw new Error("invalid Legendre symbol result");return i?1:s?0:-1}function rx(e,t){t!==void 0&&ia(t);const n=t!==void 0?t:e.toString(2).length,r=Math.ceil(n/8);return{nBitLength:n,nByteLength:r}}function mo(e,t,n=!1,r={}){if(e<=ir)throw new Error("invalid field: expected ORDER > 0, got "+e);let i,s,o=!1,a;if(typeof t=="object"&&t!=null){if(r.sqrt||n)throw new Error("cannot specify opts in two arguments");const f=t;f.BITS&&(i=f.BITS),f.sqrt&&(s=f.sqrt),typeof f.isLE=="boolean"&&(n=f.isLE),typeof f.modFromBytes=="boolean"&&(o=f.modFromBytes),a=f.allowedLengths}else typeof t=="number"&&(i=t),r.sqrt&&(s=r.sqrt);const{nBitLength:c,nByteLength:u}=rx(e,i);if(u>2048)throw new Error("invalid field: expected ORDER of <= 2048 bytes");let l;const d=Object.freeze({ORDER:e,isLE:n,BITS:c,BYTES:u,MASK:Hu(c),ZERO:ir,ONE:Nn,allowedLengths:a,create:f=>Br(f,e),isValid:f=>{if(typeof f!="bigint")throw new Error("invalid field element: expected bigint, got "+typeof f);return ir<=f&&f<e},is0:f=>f===ir,isValidNot0:f=>!d.is0(f)&&d.isValid(f),isOdd:f=>(f&Nn)===Nn,neg:f=>Br(-f,e),eql:(f,h)=>f===h,sqr:f=>Br(f*f,e),add:(f,h)=>Br(f+h,e),sub:(f,h)=>Br(f-h,e),mul:(f,h)=>Br(f*h,e),pow:(f,h)=>k$(d,f,h),div:(f,h)=>Br(f*QE(h,e),e),sqrN:f=>f*f,addN:(f,h)=>f+h,subN:(f,h)=>f-h,mulN:(f,h)=>f*h,inv:f=>QE(f,e),sqrt:s||(f=>(l||(l=E$(e)),l(d,f))),toBytes:f=>n?kE(f,u):py(f,u),fromBytes:(f,h=!0)=>{if(a){if(!a.includes(f.length)||f.length>u)throw new Error("Field.fromBytes: expected "+a+" bytes, got "+f.length);const y=new Uint8Array(u);y.set(f,n?0:y.length-f.length),f=y}if(f.length!==u)throw new Error("Field.fromBytes: expected "+u+" bytes, got "+f.length);let m=n?SE(f):$f(f);if(o&&(m=Br(m,e)),!h&&!d.isValid(m))throw new Error("invalid field element: outside of range 0..ORDER");return m},invertBatch:f=>tx(d,f),cmov:(f,h,m)=>m?h:f});return Object.freeze(d)}function ix(e){if(typeof e!="bigint")throw new Error("field order must be bigint");const t=e.toString(2).length;return Math.ceil(t/8)}function sx(e){const t=ix(e);return t+Math.ceil(t/2)}function A$(e,t,n=!1){const r=e.length,i=ix(t),s=sx(t);if(r<16||r<s||r>1024)throw new Error("expected "+s+"-1024 bytes of input, got "+r);const o=n?SE(e):$f(e),a=Br(o,t-Nn)+Nn;return n?kE(a,i):py(a,i)}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const Na=BigInt(0),go=BigInt(1);function Hf(e,t){const n=t.negate();return e?n:t}function vy(e,t){const n=tx(e.Fp,t.map(r=>r.Z));return t.map((r,i)=>e.fromAffine(r.toAffine(n[i])))}function ox(e,t){if(!Number.isSafeInteger(e)||e<=0||e>t)throw new Error("invalid window size, expected [1.."+t+"], got W="+e)}function _y(e,t){ox(e,t);const n=Math.ceil(t/e)+1,r=2**(e-1),i=2**e,s=Hu(e),o=BigInt(e);return{windows:n,windowSize:r,mask:s,maxNumber:i,shiftBy:o}}function ax(e,t,n){const{windowSize:r,mask:i,maxNumber:s,shiftBy:o}=n;let a=Number(e&i),c=e>>o;a>r&&(a-=s,c+=go);const u=t*r,l=u+Math.abs(a)-1,d=a===0,f=a<0,h=t%2!==0;return{nextN:c,offset:l,isZero:d,isNeg:f,isNegF:h,offsetF:u}}function I$(e,t){if(!Array.isArray(e))throw new Error("array expected");e.forEach((n,r)=>{if(!(n instanceof t))throw new Error("invalid point at index "+r)})}function C$(e,t){if(!Array.isArray(e))throw new Error("array of scalars expected");e.forEach((n,r)=>{if(!t.isValid(n))throw new Error("invalid scalar at index "+r)})}const Ey=new WeakMap,cx=new WeakMap;function xy(e){return cx.get(e)||1}function ux(e){if(e!==Na)throw new Error("invalid wNAF")}class P${constructor(t,n){this.BASE=t.BASE,this.ZERO=t.ZERO,this.Fn=t.Fn,this.bits=n}_unsafeLadder(t,n,r=this.ZERO){let i=t;for(;n>Na;)n&go&&(r=r.add(i)),i=i.double(),n>>=go;return r}precomputeWindow(t,n){const{windows:r,windowSize:i}=_y(n,this.bits),s=[];let o=t,a=o;for(let c=0;c<r;c++){a=o,s.push(a);for(let u=1;u<i;u++)a=a.add(o),s.push(a);o=a.double()}return s}wNAF(t,n,r){if(!this.Fn.isValid(r))throw new Error("invalid scalar");let i=this.ZERO,s=this.BASE;const o=_y(t,this.bits);for(let a=0;a<o.windows;a++){const{nextN:c,offset:u,isZero:l,isNeg:d,isNegF:f,offsetF:h}=ax(r,a,o);r=c,l?s=s.add(Hf(f,n[h])):i=i.add(Hf(d,n[u]))}return ux(r),{p:i,f:s}}wNAFUnsafe(t,n,r,i=this.ZERO){const s=_y(t,this.bits);for(let o=0;o<s.windows&&r!==Na;o++){const{nextN:a,offset:c,isZero:u,isNeg:l}=ax(r,o,s);if(r=a,!u){const d=n[c];i=i.add(l?d.negate():d)}}return ux(r),i}getPrecomputes(t,n,r){let i=Ey.get(n);return i||(i=this.precomputeWindow(n,t),t!==1&&(typeof r=="function"&&(i=r(i)),Ey.set(n,i))),i}cached(t,n,r){const i=xy(t);return this.wNAF(i,this.getPrecomputes(i,t,r),n)}unsafe(t,n,r,i){const s=xy(t);return s===1?this._unsafeLadder(t,n,i):this.wNAFUnsafe(s,this.getPrecomputes(s,t,r),n,i)}createCache(t,n){ox(n,this.bits),cx.set(t,n),Ey.delete(t)}hasCache(t){return xy(t)!==1}}function R$(e,t,n,r){let i=t,s=e.ZERO,o=e.ZERO;for(;n>Na||r>Na;)n&go&&(s=s.add(i)),r&go&&(o=o.add(i)),i=i.double(),n>>=go,r>>=go;return{p1:s,p2:o}}function T$(e,t,n,r){I$(n,e),C$(r,t);const i=n.length,s=r.length;if(i!==s)throw new Error("arrays of points and scalars must have equal length");const o=e.ZERO,a=AE(BigInt(i));let c=1;a>12?c=a-3:a>4?c=a-2:a>0&&(c=2);const u=Hu(c),l=new Array(Number(u)+1).fill(o),d=Math.floor((t.BITS-1)/c)*c;let f=o;for(let h=d;h>=0;h-=c){l.fill(o);for(let y=0;y<s;y++){const w=r[y],b=Number(w>>BigInt(h)&u);l[b]=l[b].add(n[y])}let m=o;for(let y=l.length-1,w=o;y>0;y--)w=w.add(l[y]),m=m.add(w);if(f=f.add(m),h!==0)for(let y=0;y<c;y++)f=f.double()}return f}function lx(e,t,n){if(t){if(t.ORDER!==e)throw new Error("Field.ORDER must match order: Fp == p, Fn == n");return S$(t),t}else return mo(e,{isLE:n})}function O$(e,t,n={},r){if(r===void 0&&(r=e==="edwards"),!t||typeof t!="object")throw new Error(`expected valid ${e} CURVE object`);for(const c of["p","n","h"]){const u=t[c];if(!(typeof u=="bigint"&&u>Na))throw new Error(`CURVE.${c} must be positive bigint`)}const i=lx(t.p,n.Fp,r),s=lx(t.n,n.Fn,r),a=["Gx","Gy","a","b"];for(const c of a)if(!i.isValid(t[c]))throw new Error(`CURVE.${c} must be valid field element of CURVE.Fp`);return t=Object.freeze(Object.assign({},t)),{CURVE:t,Fp:i,Fn:s}}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const dx=(e,t)=>(e+(e>=0?t:-t)/fx)/t;function M$(e,t,n){const[[r,i],[s,o]]=t,a=dx(o*e,n),c=dx(-i*e,n);let u=e-a*r-c*s,l=-a*i-c*o;const d=u<Bi,f=l<Bi;d&&(u=-u),f&&(l=-l);const h=Hu(Math.ceil(AE(n)/2))+La;if(u<Bi||u>=h||l<Bi||l>=h)throw new Error("splitScalar (endomorphism): failed, k="+e);return{k1neg:d,k1:u,k2neg:f,k2:l}}function Sy(e){if(!["compact","recovered","der"].includes(e))throw new Error('Signature format must be "compact", "recovered", or "der"');return e}function ky(e,t){const n={};for(let r of Object.keys(t))n[r]=e[r]===void 0?t[r]:e[r];return Lf(n.lowS,"lowS"),Lf(n.prehash,"prehash"),n.format!==void 0&&Sy(n.format),n}class B$ extends Error{constructor(t=""){super(t)}}const Mi={Err:B$,_tlv:{encode:(e,t)=>{const{Err:n}=Mi;if(e<0||e>256)throw new n("tlv.encode: wrong tag");if(t.length&1)throw new n("tlv.encode: unpadded data");const r=t.length/2,i=jf(r);if(i.length/2&128)throw new n("tlv.encode: long form length too big");const s=r>127?jf(i.length/2|128):"";return jf(e)+s+i+t},decode(e,t){const{Err:n}=Mi;let r=0;if(e<0||e>256)throw new n("tlv.encode: wrong tag");if(t.length<2||t[r++]!==e)throw new n("tlv.decode: wrong tlv");const i=t[r++],s=!!(i&128);let o=0;if(!s)o=i;else{const c=i&127;if(!c)throw new n("tlv.decode(long): indefinite length not supported");if(c>4)throw new n("tlv.decode(long): byte length is too big");const u=t.subarray(r,r+c);if(u.length!==c)throw new n("tlv.decode: length bytes not complete");if(u[0]===0)throw new n("tlv.decode(long): zero leftmost byte");for(const l of u)o=o<<8|l;if(r+=c,o<128)throw new n("tlv.decode(long): not minimal encoding")}const a=t.subarray(r,r+o);if(a.length!==o)throw new n("tlv.decode: wrong value length");return{v:a,l:t.subarray(r+o)}}},_int:{encode(e){const{Err:t}=Mi;if(e<Bi)throw new t("integer: negative integers are not allowed");let n=jf(e);if(Number.parseInt(n[0],16)&8&&(n="00"+n),n.length&1)throw new t("unexpected DER parsing assertion: unpadded hex");return n},decode(e){const{Err:t}=Mi;if(e[0]&128)throw new t("invalid signature integer: negative");if(e[0]===0&&!(e[1]&128))throw new t("invalid signature integer: unnecessary leading zero");return $f(e)}},toSig(e){const{Err:t,_int:n,_tlv:r}=Mi,i=Jn("signature",e),{v:s,l:o}=r.decode(48,i);if(o.length)throw new t("invalid signature: left bytes after parsing");const{v:a,l:c}=r.decode(2,s),{v:u,l}=r.decode(2,c);if(l.length)throw new t("invalid signature: left bytes after parsing");return{r:n.decode(a),s:n.decode(u)}},hexFromSig(e){const{_tlv:t,_int:n}=Mi,r=t.encode(2,n.encode(e.r)),i=t.encode(2,n.encode(e.s)),s=r+i;return t.encode(48,s)}},Bi=BigInt(0),La=BigInt(1),fx=BigInt(2),zf=BigInt(3),N$=BigInt(4);function ja(e,t){const{BYTES:n}=e;let r;if(typeof t=="bigint")r=t;else{let i=Jn("private key",t);try{r=e.fromBytes(i)}catch{throw new Error(`invalid private key: expected ui8a of size ${n}, got ${typeof t}`)}}if(!e.isValidNot0(r))throw new Error("invalid private key: out of range [1..N-1]");return r}function L$(e,t={}){const n=O$("weierstrass",e,t),{Fp:r,Fn:i}=n;let s=n.CURVE;const{h:o,n:a}=s;gy(t,{},{allowInfinityPoint:"boolean",clearCofactor:"function",isTorsionFree:"function",fromBytes:"function",toBytes:"function",endo:"object",wrapPrivateKey:"boolean"});const{endo:c}=t;if(c&&(!r.is0(s.a)||typeof c.beta!="bigint"||!Array.isArray(c.basises)))throw new Error('invalid endo: expected "beta": bigint and "basises": array');const u=px(r,i);function l(){if(!r.isOdd)throw new Error("compression is not supported: Field does not have .isOdd()")}function d(G,C,p){const{x:g,y:k}=C.toAffine(),R=r.toBytes(g);if(Lf(p,"isCompressed"),p){l();const T=!r.isOdd(k);return vi(hx(T),R)}else return vi(Uint8Array.of(4),R,r.toBytes(k))}function f(G){ho(G,void 0,"Point");const{publicKey:C,publicKeyUncompressed:p}=u,g=G.length,k=G[0],R=G.subarray(1);if(g===C&&(k===2||k===3)){const T=r.fromBytes(R);if(!r.isValid(T))throw new Error("bad point: is not on curve, wrong x");const M=y(T);let $;try{$=r.sqrt(M)}catch(F){const ue=F instanceof Error?": "+F.message:"";throw new Error("bad point: is not on curve, sqrt error"+ue)}l();const O=r.isOdd($);return(k&1)===1!==O&&($=r.neg($)),{x:T,y:$}}else if(g===p&&k===4){const T=r.BYTES,M=r.fromBytes(R.subarray(0,T)),$=r.fromBytes(R.subarray(T,T*2));if(!w(M,$))throw new Error("bad point: is not on curve");return{x:M,y:$}}else throw new Error(`bad point: got length ${g}, expected compressed=${C} or uncompressed=${p}`)}const h=t.toBytes||d,m=t.fromBytes||f;function y(G){const C=r.sqr(G),p=r.mul(C,G);return r.add(r.add(p,r.mul(G,s.a)),s.b)}function w(G,C){const p=r.sqr(C),g=y(G);return r.eql(p,g)}if(!w(s.Gx,s.Gy))throw new Error("bad curve params: generator point");const b=r.mul(r.pow(s.a,zf),N$),x=r.mul(r.sqr(s.b),BigInt(27));if(r.is0(r.add(b,x)))throw new Error("bad curve params: a or b");function v(G,C,p=!1){if(!r.isValid(C)||p&&r.is0(C))throw new Error(`bad point coordinate ${G}`);return C}function S(G){if(!(G instanceof L))throw new Error("ProjectivePoint expected")}function I(G){if(!c||!c.basises)throw new Error("no endo");return M$(G,c.basises,i.ORDER)}const N=IE((G,C)=>{const{X:p,Y:g,Z:k}=G;if(r.eql(k,r.ONE))return{x:p,y:g};const R=G.is0();C==null&&(C=R?r.ONE:r.inv(k));const T=r.mul(p,C),M=r.mul(g,C),$=r.mul(k,C);if(R)return{x:r.ZERO,y:r.ZERO};if(!r.eql($,r.ONE))throw new Error("invZ was invalid");return{x:T,y:M}}),j=IE(G=>{if(G.is0()){if(t.allowInfinityPoint&&!r.is0(G.Y))return;throw new Error("bad point: ZERO")}const{x:C,y:p}=G.toAffine();if(!r.isValid(C)||!r.isValid(p))throw new Error("bad point: x or y not field elements");if(!w(C,p))throw new Error("bad point: equation left != right");if(!G.isTorsionFree())throw new Error("bad point: not in prime-order subgroup");return!0});function U(G,C,p,g,k){return p=new L(r.mul(p.X,G),p.Y,p.Z),C=Hf(g,C),p=Hf(k,p),C.add(p)}class L{constructor(C,p,g){this.X=v("x",C),this.Y=v("y",p,!0),this.Z=v("z",g),Object.freeze(this)}static CURVE(){return s}static fromAffine(C){const{x:p,y:g}=C||{};if(!C||!r.isValid(p)||!r.isValid(g))throw new Error("invalid affine point");if(C instanceof L)throw new Error("projective point not allowed");return r.is0(p)&&r.is0(g)?L.ZERO:new L(p,g,r.ONE)}static fromBytes(C){const p=L.fromAffine(m(ho(C,void 0,"point")));return p.assertValidity(),p}static fromHex(C){return L.fromBytes(Jn("pointHex",C))}get x(){return this.toAffine().x}get y(){return this.toAffine().y}precompute(C=8,p=!0){return Z.createCache(this,C),p||this.multiply(zf),this}assertValidity(){j(this)}hasEvenY(){const{y:C}=this.toAffine();if(!r.isOdd)throw new Error("Field doesn't support isOdd");return!r.isOdd(C)}equals(C){S(C);const{X:p,Y:g,Z:k}=this,{X:R,Y:T,Z:M}=C,$=r.eql(r.mul(p,M),r.mul(R,k)),O=r.eql(r.mul(g,M),r.mul(T,k));return $&&O}negate(){return new L(this.X,r.neg(this.Y),this.Z)}double(){const{a:C,b:p}=s,g=r.mul(p,zf),{X:k,Y:R,Z:T}=this;let M=r.ZERO,$=r.ZERO,O=r.ZERO,_=r.mul(k,k),F=r.mul(R,R),ue=r.mul(T,T),ne=r.mul(k,R);return ne=r.add(ne,ne),O=r.mul(k,T),O=r.add(O,O),M=r.mul(C,O),$=r.mul(g,ue),$=r.add(M,$),M=r.sub(F,$),$=r.add(F,$),$=r.mul(M,$),M=r.mul(ne,M),O=r.mul(g,O),ue=r.mul(C,ue),ne=r.sub(_,ue),ne=r.mul(C,ne),ne=r.add(ne,O),O=r.add(_,_),_=r.add(O,_),_=r.add(_,ue),_=r.mul(_,ne),$=r.add($,_),ue=r.mul(R,T),ue=r.add(ue,ue),_=r.mul(ue,ne),M=r.sub(M,_),O=r.mul(ue,F),O=r.add(O,O),O=r.add(O,O),new L(M,$,O)}add(C){S(C);const{X:p,Y:g,Z:k}=this,{X:R,Y:T,Z:M}=C;let $=r.ZERO,O=r.ZERO,_=r.ZERO;const F=s.a,ue=r.mul(s.b,zf);let ne=r.mul(p,R),q=r.mul(g,T),J=r.mul(k,M),te=r.add(p,g),le=r.add(R,T);te=r.mul(te,le),le=r.add(ne,q),te=r.sub(te,le),le=r.add(p,k);let pe=r.add(R,M);return le=r.mul(le,pe),pe=r.add(ne,J),le=r.sub(le,pe),pe=r.add(g,k),$=r.add(T,M),pe=r.mul(pe,$),$=r.add(q,J),pe=r.sub(pe,$),_=r.mul(F,le),$=r.mul(ue,J),_=r.add($,_),$=r.sub(q,_),_=r.add(q,_),O=r.mul($,_),q=r.add(ne,ne),q=r.add(q,ne),J=r.mul(F,J),le=r.mul(ue,le),q=r.add(q,J),J=r.sub(ne,J),J=r.mul(F,J),le=r.add(le,J),ne=r.mul(q,le),O=r.add(O,ne),ne=r.mul(pe,le),$=r.mul(te,$),$=r.sub($,ne),ne=r.mul(te,q),_=r.mul(pe,_),_=r.add(_,ne),new L($,O,_)}subtract(C){return this.add(C.negate())}is0(){return this.equals(L.ZERO)}multiply(C){const{endo:p}=t;if(!i.isValidNot0(C))throw new Error("invalid scalar: out of range");let g,k;const R=T=>Z.cached(this,T,M=>vy(L,M));if(p){const{k1neg:T,k1:M,k2neg:$,k2:O}=I(C),{p:_,f:F}=R(M),{p:ue,f:ne}=R(O);k=F.add(ne),g=U(p.beta,_,ue,T,$)}else{const{p:T,f:M}=R(C);g=T,k=M}return vy(L,[g,k])[0]}multiplyUnsafe(C){const{endo:p}=t,g=this;if(!i.isValid(C))throw new Error("invalid scalar: out of range");if(C===Bi||g.is0())return L.ZERO;if(C===La)return g;if(Z.hasCache(this))return this.multiply(C);if(p){const{k1neg:k,k1:R,k2neg:T,k2:M}=I(C),{p1:$,p2:O}=R$(L,g,R,M);return U(p.beta,$,O,k,T)}else return Z.unsafe(g,C)}multiplyAndAddUnsafe(C,p,g){const k=this.multiplyUnsafe(p).add(C.multiplyUnsafe(g));return k.is0()?void 0:k}toAffine(C){return N(this,C)}isTorsionFree(){const{isTorsionFree:C}=t;return o===La?!0:C?C(L,this):Z.unsafe(this,a).is0()}clearCofactor(){const{clearCofactor:C}=t;return o===La?this:C?C(L,this):this.multiplyUnsafe(o)}isSmallOrder(){return this.multiplyUnsafe(o).is0()}toBytes(C=!0){return Lf(C,"isCompressed"),this.assertValidity(),h(L,this,C)}toHex(C=!0){return oa(this.toBytes(C))}toString(){return`<Point ${this.is0()?"ZERO":this.toHex()}>`}get px(){return this.X}get py(){return this.X}get pz(){return this.Z}toRawBytes(C=!0){return this.toBytes(C)}_setWindowSize(C){this.precompute(C)}static normalizeZ(C){return vy(L,C)}static msm(C,p){return T$(L,i,C,p)}static fromPrivateKey(C){return L.BASE.multiply(ja(i,C))}}L.BASE=new L(s.Gx,s.Gy,r.ONE),L.ZERO=new L(r.ZERO,r.ONE,r.ZERO),L.Fp=r,L.Fn=i;const Y=i.BITS,Z=new P$(L,t.endo?Math.ceil(Y/2):Y);return L.BASE.precompute(8),L}function hx(e){return Uint8Array.of(e?2:3)}function px(e,t){return{secretKey:t.BYTES,publicKey:1+e.BYTES,publicKeyUncompressed:1+2*e.BYTES,publicKeyHasPrefix:!0,signature:2*t.BYTES}}function j$(e,t={}){const{Fn:n}=e,r=t.randomBytes||G0,i=Object.assign(px(e.Fp,n),{seed:sx(n.ORDER)});function s(h){try{return!!ja(n,h)}catch{return!1}}function o(h,m){const{publicKey:y,publicKeyUncompressed:w}=i;try{const b=h.length;return m===!0&&b!==y||m===!1&&b!==w?!1:!!e.fromBytes(h)}catch{return!1}}function a(h=r(i.seed)){return A$(ho(h,i.seed,"seed"),n.ORDER)}function c(h,m=!0){return e.BASE.multiply(ja(n,h)).toBytes(m)}function u(h){const m=a(h);return{secretKey:m,publicKey:c(m)}}function l(h){if(typeof h=="bigint")return!1;if(h instanceof e)return!0;const{secretKey:m,publicKey:y,publicKeyUncompressed:w}=i;if(n.allowedLengths||m===y)return;const b=Jn("key",h).length;return b===y||b===w}function d(h,m,y=!0){if(l(h)===!0)throw new Error("first arg must be private key");if(l(m)===!1)throw new Error("second arg must be public key");const w=ja(n,h);return e.fromHex(m).multiply(w).toBytes(y)}return Object.freeze({getPublicKey:c,getSharedSecret:d,keygen:u,Point:e,utils:{isValidSecretKey:s,isValidPublicKey:o,randomSecretKey:a,isValidPrivateKey:s,randomPrivateKey:a,normPrivateKeyToScalar:h=>ja(n,h),precompute(h=8,m=e.BASE){return m.precompute(h,!1)}},lengths:i})}function $$(e,t,n={}){iv(t),gy(n,{},{hmac:"function",lowS:"boolean",randomBytes:"function",bits2int:"function",bits2int_modN:"function"});const r=n.randomBytes||G0,i=n.hmac||((p,...g)=>om(t,p,vi(...g))),{Fp:s,Fn:o}=e,{ORDER:a,BITS:c}=o,{keygen:u,getPublicKey:l,getSharedSecret:d,utils:f,lengths:h}=j$(e,n),m={prehash:!1,lowS:typeof n.lowS=="boolean"?n.lowS:!1,format:void 0,extraEntropy:!1},y="compact";function w(p){const g=a>>La;return p>g}function b(p,g){if(!o.isValidNot0(g))throw new Error(`invalid signature ${p}: out of range 1..Point.Fn.ORDER`);return g}function x(p,g){Sy(g);const k=h.signature,R=g==="compact"?k:g==="recovered"?k+1:void 0;return ho(p,R,`${g} signature`)}class v{constructor(g,k,R){this.r=b("r",g),this.s=b("s",k),R!=null&&(this.recovery=R),Object.freeze(this)}static fromBytes(g,k=y){x(g,k);let R;if(k==="der"){const{r:O,s:_}=Mi.toSig(ho(g));return new v(O,_)}k==="recovered"&&(R=g[0],k="compact",g=g.subarray(1));const T=o.BYTES,M=g.subarray(0,T),$=g.subarray(T,T*2);return new v(o.fromBytes(M),o.fromBytes($),R)}static fromHex(g,k){return this.fromBytes(rd(g),k)}addRecoveryBit(g){return new v(this.r,this.s,g)}recoverPublicKey(g){const k=s.ORDER,{r:R,s:T,recovery:M}=this;if(M==null||![0,1,2,3].includes(M))throw new Error("recovery id invalid");if(a*fx<k&&M>1)throw new Error("recovery id is ambiguous for h>1 curve");const O=M===2||M===3?R+a:R;if(!s.isValid(O))throw new Error("recovery id 2 or 3 invalid");const _=s.toBytes(O),F=e.fromBytes(vi(hx((M&1)===0),_)),ue=o.inv(O),ne=I(Jn("msgHash",g)),q=o.create(-ne*ue),J=o.create(T*ue),te=e.BASE.multiplyUnsafe(q).add(F.multiplyUnsafe(J));if(te.is0())throw new Error("point at infinify");return te.assertValidity(),te}hasHighS(){return w(this.s)}toBytes(g=y){if(Sy(g),g==="der")return rd(Mi.hexFromSig(this));const k=o.toBytes(this.r),R=o.toBytes(this.s);if(g==="recovered"){if(this.recovery==null)throw new Error("recovery bit must be present");return vi(Uint8Array.of(this.recovery),k,R)}return vi(k,R)}toHex(g){return oa(this.toBytes(g))}assertValidity(){}static fromCompact(g){return v.fromBytes(Jn("sig",g),"compact")}static fromDER(g){return v.fromBytes(Jn("sig",g),"der")}normalizeS(){return this.hasHighS()?new v(this.r,o.neg(this.s),this.recovery):this}toDERRawBytes(){return this.toBytes("der")}toDERHex(){return oa(this.toBytes("der"))}toCompactRawBytes(){return this.toBytes("compact")}toCompactHex(){return oa(this.toBytes("compact"))}}const S=n.bits2int||function(g){if(g.length>8192)throw new Error("input is too large");const k=$f(g),R=g.length*8-c;return R>0?k>>BigInt(R):k},I=n.bits2int_modN||function(g){return o.create(S(g))},N=Hu(c);function j(p){return qj("num < 2^"+c,p,Bi,N),o.toBytes(p)}function U(p,g){return ho(p,void 0,"message"),g?ho(t(p),void 0,"prehashed message"):p}function L(p,g,k){if(["recovered","canonical"].some(q=>q in k))throw new Error("sign() legacy options not supported");const{lowS:R,prehash:T,extraEntropy:M}=ky(k,m);p=U(p,T);const $=I(p),O=ja(o,g),_=[j(O),j($)];if(M!=null&&M!==!1){const q=M===!0?r(h.secretKey):M;_.push(Jn("extraEntropy",q))}const F=vi(..._),ue=$;function ne(q){const J=S(q);if(!o.isValidNot0(J))return;const te=o.inv(J),le=e.BASE.multiply(J).toAffine(),pe=o.create(le.x);if(pe===Bi)return;const z=o.create(te*o.create(ue+pe*O));if(z===Bi)return;let D=(le.x===pe?0:2)|Number(le.y&La),ie=z;return R&&w(z)&&(ie=o.neg(z),D^=1),new v(pe,ie,D)}return{seed:F,k2sig:ne}}function Y(p,g,k={}){p=Jn("message",p);const{seed:R,k2sig:T}=L(p,g,k);return Vj(t.outputLen,o.BYTES,i)(R,T)}function Z(p){let g;const k=typeof p=="string"||nd(p),R=!k&&p!==null&&typeof p=="object"&&typeof p.r=="bigint"&&typeof p.s=="bigint";if(!k&&!R)throw new Error("invalid signature, expected Uint8Array, hex string or Signature instance");if(R)g=new v(p.r,p.s);else if(k){try{g=v.fromBytes(Jn("sig",p),"der")}catch(T){if(!(T instanceof Mi.Err))throw T}if(!g)try{g=v.fromBytes(Jn("sig",p),"compact")}catch{return!1}}return g||!1}function G(p,g,k,R={}){const{lowS:T,prehash:M,format:$}=ky(R,m);if(k=Jn("publicKey",k),g=U(Jn("message",g),M),"strict"in R)throw new Error("options.strict was renamed to lowS");const O=$===void 0?Z(p):v.fromBytes(Jn("sig",p),$);if(O===!1)return!1;try{const _=e.fromBytes(k);if(T&&O.hasHighS())return!1;const{r:F,s:ue}=O,ne=I(g),q=o.inv(ue),J=o.create(ne*q),te=o.create(F*q),le=e.BASE.multiplyUnsafe(J).add(_.multiplyUnsafe(te));return le.is0()?!1:o.create(le.x)===F}catch{return!1}}function C(p,g,k={}){const{prehash:R}=ky(k,m);return g=U(g,R),v.fromBytes(p,"recovered").recoverPublicKey(g).toBytes()}return Object.freeze({keygen:u,getPublicKey:l,getSharedSecret:d,utils:f,lengths:h,Point:e,sign:Y,verify:G,recoverPublicKey:C,Signature:v,hash:t})}function F$(e){const t={a:e.a,b:e.b,p:e.Fp.ORDER,n:e.n,h:e.h,Gx:e.Gx,Gy:e.Gy},n=e.Fp;let r=e.allowedPrivateKeyLengths?Array.from(new Set(e.allowedPrivateKeyLengths.map(o=>Math.ceil(o/2)))):void 0;const i=mo(t.n,{BITS:e.nBitLength,allowedLengths:r,modFromBytes:e.wrapPrivateKey}),s={Fp:n,Fn:i,allowInfinityPoint:e.allowInfinityPoint,endo:e.endo,isTorsionFree:e.isTorsionFree,clearCofactor:e.clearCofactor,fromBytes:e.fromBytes,toBytes:e.toBytes};return{CURVE:t,curveOpts:s}}function D$(e){const{CURVE:t,curveOpts:n}=F$(e),r={hmac:e.hmac,randomBytes:e.randomBytes,lowS:e.lowS,bits2int:e.bits2int,bits2int_modN:e.bits2int_modN};return{CURVE:t,curveOpts:n,hash:e.hash,ecdsaOpts:r}}function U$(e,t){const n=t.Point;return Object.assign({},t,{ProjectivePoint:n,CURVE:Object.assign({},e,rx(n.Fn.ORDER,n.Fn.BITS))})}function H$(e){const{CURVE:t,curveOpts:n,hash:r,ecdsaOpts:i}=D$(e),s=L$(t,n),o=$$(s,r,i);return U$(e,o)}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */function Ay(e,t){const n=r=>H$({...e,hash:r});return{...n(t),create:n}}function z$(e,t={}){const{recovered:n}=t;if(typeof e.r>"u")throw new Iy({signature:e});if(typeof e.s>"u")throw new Iy({signature:e});if(n&&typeof e.yParity>"u")throw new Iy({signature:e});if(e.r<0n||e.r>qE)throw new K$({value:e.r});if(e.s<0n||e.s>qE)throw new J$({value:e.s});if(typeof e.yParity=="number"&&e.yParity!==0&&e.yParity!==1)throw new Cy({value:e.yParity})}function mx(e){if(e.length!==130&&e.length!==132)throw new V$({signature:e});const t=BigInt(pr(e,0,32)),n=BigInt(pr(e,32,64)),r=(()=>{const i=+`0x${e.slice(130)}`;if(!Number.isNaN(i))try{return G$(i)}catch{throw new Cy({value:i})}})();return typeof r>"u"?{r:t,s:n}:{r:t,s:n,yParity:r}}function W$(e){z$(e);const t=e.r,n=e.s;return Df(gs(t,{size:32}),gs(n,{size:32}),typeof e.yParity=="number"?gs(q$(e.yParity),{size:1}):"0x")}function G$(e){if(e===0||e===27)return 0;if(e===1||e===28)return 1;if(e>=35)return e%2===0?1:0;throw new Z$({value:e})}function q$(e){if(e===0)return 27;if(e===1)return 28;throw new Cy({value:e})}class V$ extends Rt{constructor({signature:t}){super(`Value \`${t}\` is an invalid signature size.`,{metaMessages:["Expected: 64 bytes or 65 bytes.",`Received ${ys(RE(t))} bytes.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Signature.InvalidSerializedSizeError"})}}class Iy extends Rt{constructor({signature:t}){super(`Signature \`${Ff(t)}\` is missing either an \`r\`, \`s\`, or \`yParity\` property.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Signature.MissingPropertiesError"})}}class K$ extends Rt{constructor({value:t}){super(`Value \`${t}\` is an invalid r value. r must be a positive integer less than 2^256.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Signature.InvalidRError"})}}class J$ extends Rt{constructor({value:t}){super(`Value \`${t}\` is an invalid s value. s must be a positive integer less than 2^256.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Signature.InvalidSError"})}}class Cy extends Rt{constructor({value:t}){super(`Value \`${t}\` is an invalid y-parity value. Y-parity must be 0 or 1.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Signature.InvalidYParityError"})}}class Z$ extends Rt{constructor({value:t}){super(`Value \`${t}\` is an invalid v value. v must be 27, 28 or >=35.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Signature.InvalidVError"})}}const Y$=new TextDecoder,Wf=Object.fromEntries(Array.from("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/").map((e,t)=>[t,e.charCodeAt(0)]));({...Object.fromEntries(Array.from("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/").map((e,t)=>[e.charCodeAt(0),t]))});function Q$(e,t={}){const{pad:n=!0,url:r=!1}=t,i=new Uint8Array(Math.ceil(e.length/3)*4);for(let c=0,u=0;u<e.length;c+=4,u+=3){const l=(e[u]<<16)+(e[u+1]<<8)+(e[u+2]|0);i[c]=Wf[l>>18],i[c+1]=Wf[l>>12&63],i[c+2]=Wf[l>>6&63],i[c+3]=Wf[l&63]}const s=e.length%3,o=Math.floor(e.length/3)*4+(s&&s+1);let a=Y$.decode(new Uint8Array(i.buffer,0,o));return n&&s===1&&(a+="=="),n&&s===2&&(a+="="),r&&(a=a.replaceAll("+","-").replaceAll("/","_")),a}function X$(e,t={}){return Q$($E(e),t)}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const gx={p:BigInt("0xffffffff00000001000000000000000000000000ffffffffffffffffffffffff"),n:BigInt("0xffffffff00000000ffffffffffffffffbce6faada7179e84f3b9cac2fc632551"),h:BigInt(1),a:BigInt("0xffffffff00000001000000000000000000000000fffffffffffffffffffffffc"),b:BigInt("0x5ac635d8aa3a93e7b3ebbd55769886bc651d06b0cc53b0f63bce3c3e27d2604b"),Gx:BigInt("0x6b17d1f2e12c4247f8bce6e563a440f277037d812deb33a0f4a13945d898c296"),Gy:BigInt("0x4fe342e2fe1a7f9b8ee7eb4a7c0f9e162bce33576b315ececbb6406837bf51f5")},yx={p:BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffeffffffff0000000000000000ffffffff"),n:BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffc7634d81f4372ddf581a0db248b0a77aecec196accc52973"),h:BigInt(1),a:BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffeffffffff0000000000000000fffffffc"),b:BigInt("0xb3312fa7e23ee7e4988e056be3f82d19181d9c6efe8141120314088f5013875ac656398d8a2ed19d2a85c8edd3ec2aef"),Gx:BigInt("0xaa87ca22be8b05378eb1c71ef320ad746e1d3b628ba79b9859f741e082542a385502f25dbf55296c3a545e3872760ab7"),Gy:BigInt("0x3617de4a96262c6f5d9e98bf9292dc29f8f41dbd289a147ce9da3113b5f0b8c00a60b1ce1d7e819d7a431d7c90ea0e5f")},bx={p:BigInt("0x1ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"),n:BigInt("0x01fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffa51868783bf2f966b7fcc0148f709a5d03bb5c9b8899c47aebb6fb71e91386409"),h:BigInt(1),a:BigInt("0x1fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc"),b:BigInt("0x0051953eb9618e1c9a1f929a21a0b68540eea2da725b99b315f3b8b489918ef109e156193951ec7e937b1652c0bd3bb1bf073573df883d2c34f1ef451fd46b503f00"),Gx:BigInt("0x00c6858e06b70404e9cd9e3ecb662395b4429c648139053fb521f828af606b4d3dbaa14b5e77efe75928fe1dc127a2ffa8de3348b3c1856a429bf97e7e31c2e5bd66"),Gy:BigInt("0x011839296a789a3bc0045c8a5fb42c7d1bd998f54449579b446817afbd17273e662c97ee72995ef42640c550b9013fad0761353c7086a272c24088be94769fd16650")},eF=mo(gx.p),tF=mo(yx.p),nF=mo(bx.p),rF=Ay({...gx,Fp:eF,lowS:!1},Zp);Ay({...yx,Fp:tF,lowS:!1},ZT),Ay({...bx,Fp:nF,lowS:!1,allowedPrivateKeyLengths:[130,131,132]},JT);/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const wx=rF;Uint8Array.from([105,171,180,181,160,222,75,198,42,42,32,31,141,37,186,233]);function iF(e={}){const{flag:t=5,rpId:n=window.location.hostname,signCount:r=0}=e,i=HE(TE(n)),s=gs(t,{size:1}),o=gs(r,{size:4});return Df(i,s,o)}function sF(e){const{challenge:t,crossOrigin:n=!1,extraClientData:r,origin:i=window.location.origin}=e;return JSON.stringify({type:"webauthn.get",challenge:X$(t,{url:!0,pad:!1}),origin:i,crossOrigin:n,...r})}function oF(e){const{challenge:t,crossOrigin:n,extraClientData:r,flag:i,origin:s,rpId:o,signCount:a,userVerification:c="required"}=e,u=iF({flag:i,rpId:o,signCount:a}),l=sF({challenge:t,crossOrigin:n,extraClientData:r,origin:s}),d=HE(TE(l)),f=l.indexOf('"challenge"'),h=l.indexOf('"type"'),m={authenticatorData:u,clientDataJSON:l,challengeIndex:f,typeIndex:h,userVerificationRequired:c==="required"},y=Df(u,d);return{metadata:m,payload:y}}async function aF(e={}){const{extractable:t=!1}=e,n=await globalThis.crypto.subtle.generateKey({name:"ECDSA",namedCurve:"P-256"},t,["sign","verify"]),r=await globalThis.crypto.subtle.exportKey("raw",n.publicKey),i=f$(new Uint8Array(r));return{privateKey:n.privateKey,publicKey:i}}async function cF(e){const{payload:t,privateKey:n}=e,r=await globalThis.crypto.subtle.sign({name:"ECDSA",hash:"SHA-256"},n,LE(t)),i=jE(new Uint8Array(r)),s=DE(FE(i,0,32));let o=DE(FE(i,32,64));return o>wx.CURVE.n/2n&&(o=wx.CURVE.n-o),{r:s,s:o}}function Gf(e){return new Promise((t,n)=>{e.oncomplete=e.onsuccess=()=>t(e.result),e.onabort=e.onerror=()=>n(e.error)})}function vx(e,t){const n=indexedDB.open(e);n.onupgradeneeded=()=>n.result.createObjectStore(t);const r=Gf(n);return(i,s)=>r.then(o=>s(o.transaction(t,i).objectStore(t)))}let Py;function Ry(){return Py||(Py=vx("keyval-store","keyval")),Py}function uF(e,t=Ry()){return t("readonly",n=>Gf(n.get(e)))}function lF(e,t,n=Ry()){return n("readwrite",r=>(r.put(t,e),Gf(r.transaction)))}function dF(e,t=Ry()){return t("readwrite",n=>(n.delete(e),Gf(n.transaction)))}const $a="4.3.6",_x="@coinbase/wallet-sdk",fF=()=>({chains:[]}),hF=()=>({keys:{}}),pF=()=>({account:{}}),mF=()=>({subAccount:void 0}),gF=()=>({subAccountConfig:{}}),yF=()=>({spendPermissions:[]}),bF=()=>({config:{version:$a}}),Gt=Pg(ij((...e)=>Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},fF(...e)),hF(...e)),pF(...e)),mF(...e)),yF(...e)),bF(...e)),gF(...e)),{name:"cbwsdk.store",storage:U5(()=>localStorage),partialize:e=>({chains:e.chains,keys:e.keys,account:e.account,subAccount:e.subAccount,spendPermissions:e.spendPermissions,config:e.config})})),wF={get:()=>Gt.getState().subAccountConfig,set:e=>{Gt.setState(t=>({subAccountConfig:Object.assign(Object.assign({},t.subAccountConfig),e)}))},clear:()=>{Gt.setState({subAccountConfig:{}})}},vF={get:()=>Gt.getState().subAccount,set:e=>{Gt.setState(t=>({subAccount:t.subAccount?Object.assign(Object.assign({},t.subAccount),e):Object.assign({address:e.address},e)}))},clear:()=>{Gt.setState({subAccount:void 0})}},_F={get:()=>Gt.getState().spendPermissions,set:e=>{Gt.setState({spendPermissions:e})},clear:()=>{Gt.setState({spendPermissions:[]})}},EF={get:()=>Gt.getState().account,set:e=>{Gt.setState(t=>({account:Object.assign(Object.assign({},t.account),e)}))},clear:()=>{Gt.setState({account:{}})}},xF={get:()=>Gt.getState().chains,set:e=>{Gt.setState({chains:e})},clear:()=>{Gt.setState({chains:[]})}},SF={get:e=>Gt.getState().keys[e],set:(e,t)=>{Gt.setState(n=>({keys:Object.assign(Object.assign({},n.keys),{[e]:t})}))},clear:()=>{Gt.setState({keys:{}})}},Ex={get:()=>Gt.getState().config,set:e=>{Gt.setState(t=>({config:Object.assign(Object.assign({},t.config),e)}))}},kF={subAccounts:vF,subAccountsConfig:wF,spendPermissions:_F,account:EF,chains:xF,keys:SF,config:Ex},ge=Object.assign(Object.assign({},Gt),kF),AF='!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.ClientAnalytics=t():e.ClientAnalytics=t()}(this,(function(){return(()=>{var e={792:e=>{var t={utf8:{stringToBytes:function(e){return t.bin.stringToBytes(unescape(encodeURIComponent(e)))},bytesToString:function(e){return decodeURIComponent(escape(t.bin.bytesToString(e)))}},bin:{stringToBytes:function(e){for(var t=[],n=0;n<e.length;n++)t.push(255&e.charCodeAt(n));return t},bytesToString:function(e){for(var t=[],n=0;n<e.length;n++)t.push(String.fromCharCode(e[n]));return t.join("")}}};e.exports=t},562:e=>{var t,n;t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",n={rotl:function(e,t){return e<<t|e>>>32-t},rotr:function(e,t){return e<<32-t|e>>>t},endian:function(e){if(e.constructor==Number)return 16711935&n.rotl(e,8)|4278255360&n.rotl(e,24);for(var t=0;t<e.length;t++)e[t]=n.endian(e[t]);return e},randomBytes:function(e){for(var t=[];e>0;e--)t.push(Math.floor(256*Math.random()));return t},bytesToWords:function(e){for(var t=[],n=0,r=0;n<e.length;n++,r+=8)t[r>>>5]|=e[n]<<24-r%32;return t},wordsToBytes:function(e){for(var t=[],n=0;n<32*e.length;n+=8)t.push(e[n>>>5]>>>24-n%32&255);return t},bytesToHex:function(e){for(var t=[],n=0;n<e.length;n++)t.push((e[n]>>>4).toString(16)),t.push((15&e[n]).toString(16));return t.join("")},hexToBytes:function(e){for(var t=[],n=0;n<e.length;n+=2)t.push(parseInt(e.substr(n,2),16));return t},bytesToBase64:function(e){for(var n=[],r=0;r<e.length;r+=3)for(var i=e[r]<<16|e[r+1]<<8|e[r+2],a=0;a<4;a++)8*r+6*a<=8*e.length?n.push(t.charAt(i>>>6*(3-a)&63)):n.push("=");return n.join("")},base64ToBytes:function(e){e=e.replace(/[^A-Z0-9+\\/]/gi,"");for(var n=[],r=0,i=0;r<e.length;i=++r%4)0!=i&&n.push((t.indexOf(e.charAt(r-1))&Math.pow(2,-2*i+8)-1)<<2*i|t.indexOf(e.charAt(r))>>>6-2*i);return n}},e.exports=n},335:e=>{function t(e){return!!e.constructor&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)}e.exports=function(e){return null!=e&&(t(e)||function(e){return"function"==typeof e.readFloatLE&&"function"==typeof e.slice&&t(e.slice(0,0))}(e)||!!e._isBuffer)}},762:(e,t,n)=>{var r,i,a,o,s;r=n(562),i=n(792).utf8,a=n(335),o=n(792).bin,(s=function(e,t){e.constructor==String?e=t&&"binary"===t.encoding?o.stringToBytes(e):i.stringToBytes(e):a(e)?e=Array.prototype.slice.call(e,0):Array.isArray(e)||e.constructor===Uint8Array||(e=e.toString());for(var n=r.bytesToWords(e),c=8*e.length,u=1732584193,l=-271733879,d=-1732584194,p=271733878,m=0;m<n.length;m++)n[m]=16711935&(n[m]<<8|n[m]>>>24)|4278255360&(n[m]<<24|n[m]>>>8);n[c>>>5]|=128<<c%32,n[14+(c+64>>>9<<4)]=c;var f=s._ff,v=s._gg,g=s._hh,b=s._ii;for(m=0;m<n.length;m+=16){var h=u,w=l,y=d,T=p;u=f(u,l,d,p,n[m+0],7,-680876936),p=f(p,u,l,d,n[m+1],12,-389564586),d=f(d,p,u,l,n[m+2],17,606105819),l=f(l,d,p,u,n[m+3],22,-1044525330),u=f(u,l,d,p,n[m+4],7,-176418897),p=f(p,u,l,d,n[m+5],12,1200080426),d=f(d,p,u,l,n[m+6],17,-1473231341),l=f(l,d,p,u,n[m+7],22,-45705983),u=f(u,l,d,p,n[m+8],7,1770035416),p=f(p,u,l,d,n[m+9],12,-1958414417),d=f(d,p,u,l,n[m+10],17,-42063),l=f(l,d,p,u,n[m+11],22,-1990404162),u=f(u,l,d,p,n[m+12],7,1804603682),p=f(p,u,l,d,n[m+13],12,-40341101),d=f(d,p,u,l,n[m+14],17,-1502002290),u=v(u,l=f(l,d,p,u,n[m+15],22,1236535329),d,p,n[m+1],5,-165796510),p=v(p,u,l,d,n[m+6],9,-1069501632),d=v(d,p,u,l,n[m+11],14,643717713),l=v(l,d,p,u,n[m+0],20,-373897302),u=v(u,l,d,p,n[m+5],5,-701558691),p=v(p,u,l,d,n[m+10],9,38016083),d=v(d,p,u,l,n[m+15],14,-660478335),l=v(l,d,p,u,n[m+4],20,-405537848),u=v(u,l,d,p,n[m+9],5,568446438),p=v(p,u,l,d,n[m+14],9,-1019803690),d=v(d,p,u,l,n[m+3],14,-187363961),l=v(l,d,p,u,n[m+8],20,1163531501),u=v(u,l,d,p,n[m+13],5,-1444681467),p=v(p,u,l,d,n[m+2],9,-51403784),d=v(d,p,u,l,n[m+7],14,1735328473),u=g(u,l=v(l,d,p,u,n[m+12],20,-1926607734),d,p,n[m+5],4,-378558),p=g(p,u,l,d,n[m+8],11,-2022574463),d=g(d,p,u,l,n[m+11],16,1839030562),l=g(l,d,p,u,n[m+14],23,-35309556),u=g(u,l,d,p,n[m+1],4,-1530992060),p=g(p,u,l,d,n[m+4],11,1272893353),d=g(d,p,u,l,n[m+7],16,-155497632),l=g(l,d,p,u,n[m+10],23,-1094730640),u=g(u,l,d,p,n[m+13],4,681279174),p=g(p,u,l,d,n[m+0],11,-358537222),d=g(d,p,u,l,n[m+3],16,-722521979),l=g(l,d,p,u,n[m+6],23,76029189),u=g(u,l,d,p,n[m+9],4,-640364487),p=g(p,u,l,d,n[m+12],11,-421815835),d=g(d,p,u,l,n[m+15],16,530742520),u=b(u,l=g(l,d,p,u,n[m+2],23,-995338651),d,p,n[m+0],6,-198630844),p=b(p,u,l,d,n[m+7],10,1126891415),d=b(d,p,u,l,n[m+14],15,-1416354905),l=b(l,d,p,u,n[m+5],21,-57434055),u=b(u,l,d,p,n[m+12],6,1700485571),p=b(p,u,l,d,n[m+3],10,-1894986606),d=b(d,p,u,l,n[m+10],15,-1051523),l=b(l,d,p,u,n[m+1],21,-2054922799),u=b(u,l,d,p,n[m+8],6,1873313359),p=b(p,u,l,d,n[m+15],10,-30611744),d=b(d,p,u,l,n[m+6],15,-1560198380),l=b(l,d,p,u,n[m+13],21,1309151649),u=b(u,l,d,p,n[m+4],6,-145523070),p=b(p,u,l,d,n[m+11],10,-1120210379),d=b(d,p,u,l,n[m+2],15,718787259),l=b(l,d,p,u,n[m+9],21,-343485551),u=u+h>>>0,l=l+w>>>0,d=d+y>>>0,p=p+T>>>0}return r.endian([u,l,d,p])})._ff=function(e,t,n,r,i,a,o){var s=e+(t&n|~t&r)+(i>>>0)+o;return(s<<a|s>>>32-a)+t},s._gg=function(e,t,n,r,i,a,o){var s=e+(t&r|n&~r)+(i>>>0)+o;return(s<<a|s>>>32-a)+t},s._hh=function(e,t,n,r,i,a,o){var s=e+(t^n^r)+(i>>>0)+o;return(s<<a|s>>>32-a)+t},s._ii=function(e,t,n,r,i,a,o){var s=e+(n^(t|~r))+(i>>>0)+o;return(s<<a|s>>>32-a)+t},s._blocksize=16,s._digestsize=16,e.exports=function(e,t){if(null==e)throw new Error("Illegal argument "+e);var n=r.wordsToBytes(s(e,t));return t&&t.asBytes?n:t&&t.asString?o.bytesToString(n):r.bytesToHex(n)}},2:(e,t,n)=>{"use strict";n.r(t),n.d(t,{Perfume:()=>ze,incrementUjNavigation:()=>Le,markStep:()=>Re,markStepOnce:()=>qe});var r,i,a={isResourceTiming:!1,isElementTiming:!1,maxTime:3e4,reportOptions:{},enableNavigationTracking:!0},o=window,s=o.console,c=o.navigator,u=o.performance,l=function(){return c.deviceMemory},d=function(){return c.hardwareConcurrency},p="mark.",m=function(){return u&&!!u.getEntriesByType&&!!u.now&&!!u.mark},f="4g",v=!1,g={},b={value:0},h={value:{beacon:0,css:0,fetch:0,img:0,other:0,script:0,total:0,xmlhttprequest:0}},w={value:0},y={value:0},T={},k={isHidden:!1,didChange:!1},_=function(){k.isHidden=!1,document.hidden&&(k.isHidden=document.hidden,k.didChange=!0)},S=function(e,t){try{var n=new PerformanceObserver((function(e){t(e.getEntries())}));return n.observe({type:e,buffered:!0}),n}catch(e){s.warn("Perfume.js:",e)}return null},E=function(){return!!(d()&&d()<=4)||!!(l()&&l()<=4)},x=function(e,t){switch(e){case"slow-2g":case"2g":case"3g":return!0;default:return E()||t}},O=function(e){return parseFloat(e.toFixed(4))},j=function(e){return"number"!=typeof e?null:O(e/Math.pow(1024,2))},N=function(e,t,n,r,i){var s,u=function(){a.analyticsTracker&&(k.isHidden&&!["CLS","INP"].includes(e)||a.analyticsTracker({attribution:r,metricName:e,data:t,navigatorInformation:c?{deviceMemory:l()||0,hardwareConcurrency:d()||0,serviceWorkerStatus:"serviceWorker"in c?c.serviceWorker.controller?"controlled":"supported":"unsupported",isLowEndDevice:E(),isLowEndExperience:x(f,v)}:{},rating:n,navigationType:i}))};["CLS","INP"].includes(e)?u():(s=u,"requestIdleCallback"in o?o.requestIdleCallback(s,{timeout:3e3}):s())},I=function(e){e.forEach((function(e){if(!("self"!==e.name||e.startTime<b.value)){var t=e.duration-50;t>0&&(w.value+=t,y.value+=t)}}))};!function(e){e.instant="instant",e.quick="quick",e.moderate="moderate",e.slow="slow",e.unavoidable="unavoidable"}(r||(r={}));var P,M,B,C,D,A=((i={})[r.instant]={vitalsThresholds:[100,200],maxOutlierThreshold:1e4},i[r.quick]={vitalsThresholds:[200,500],maxOutlierThreshold:1e4},i[r.moderate]={vitalsThresholds:[500,1e3],maxOutlierThreshold:1e4},i[r.slow]={vitalsThresholds:[1e3,2e3],maxOutlierThreshold:1e4},i[r.unavoidable]={vitalsThresholds:[2e3,5e3],maxOutlierThreshold:2e4},i),L={RT:[100,200],TBT:[200,600],NTBT:[200,600]},U=function(e,t){return L[e]?t<=L[e][0]?"good":t<=L[e][1]?"needsImprovement":"poor":null},R=function(e,t,n){Object.keys(t).forEach((function(e){"number"==typeof t[e]&&(t[e]=O(t[e]))})),N(e,t,null,n||{})},q=function(e){var t=e.attribution,n=e.name,r=e.rating,i=e.value,o=e.navigationType;"FCP"===n&&(b.value=i),["FCP","LCP"].includes(n)&&!T[0]&&(T[0]=S("longtask",I)),"FID"===n&&setTimeout((function(){k.didChange||(q({attribution:t,name:"TBT",rating:U("TBT",w.value),value:w.value,navigationType:o}),R("dataConsumption",h.value))}),1e4);var s=O(i);s<=a.maxTime&&s>=0&&N(n,s,r,t,o)},F=function(){return window.performance&&performance.getEntriesByType&&performance.getEntriesByType("navigation")[0]},z=function(e){if("loading"===document.readyState)return"loading";var t=F();if(t){if(e<t.domInteractive)return"loading";if(0===t.domContentLoadedEventStart||e<t.domContentLoadedEventStart)return"dom-interactive";if(0===t.domComplete||e<t.domComplete)return"dom-content-loaded"}return"complete"},K=function(e){var t=e.nodeName;return 1===e.nodeType?t.toLowerCase():t.toUpperCase().replace(/^#/,"")},$=function(e,t){var n="";try{for(;e&&9!==e.nodeType;){var r=e,i=r.id?"#"+r.id:K(r)+(r.className&&r.className.length?"."+r.className.replace(/\\s+/g,"."):"");if(n.length+i.length>(t||100)-1)return n||i;if(n=n?i+">"+n:i,r.id)break;e=r.parentNode}}catch(e){}return n},Q=-1,W=function(){return Q},H=function(e){addEventListener("pageshow",(function(t){t.persisted&&(Q=t.timeStamp,e(t))}),!0)},V=function(){var e=F();return e&&e.activationStart||0},J=function(e,t){var n=F(),r="navigate";return W()>=0?r="back-forward-cache":n&&(r=document.prerendering||V()>0?"prerender":document.wasDiscarded?"restore":n.type.replace(/_/g,"-")),{name:e,value:void 0===t?-1:t,rating:"good",delta:0,entries:[],id:"v3-".concat(Date.now(),"-").concat(Math.floor(8999999999999*Math.random())+1e12),navigationType:r}},X=function(e,t,n){try{if(PerformanceObserver.supportedEntryTypes.includes(e)){var r=new PerformanceObserver((function(e){Promise.resolve().then((function(){t(e.getEntries())}))}));return r.observe(Object.assign({type:e,buffered:!0},n||{})),r}}catch(e){}},G=function(e,t){var n=function n(r){"pagehide"!==r.type&&"hidden"!==document.visibilityState||(e(r),t&&(removeEventListener("visibilitychange",n,!0),removeEventListener("pagehide",n,!0)))};addEventListener("visibilitychange",n,!0),addEventListener("pagehide",n,!0)},Z=function(e,t,n,r){var i,a;return function(o){t.value>=0&&(o||r)&&((a=t.value-(i||0))||void 0===i)&&(i=t.value,t.delta=a,t.rating=function(e,t){return e>t[1]?"poor":e>t[0]?"needs-improvement":"good"}(t.value,n),e(t))}},Y=function(e){requestAnimationFrame((function(){return requestAnimationFrame((function(){return e()}))}))},ee=function(e){document.prerendering?addEventListener("prerenderingchange",(function(){return e()}),!0):e()},te=-1,ne=function(){return"hidden"!==document.visibilityState||document.prerendering?1/0:0},re=function(e){"hidden"===document.visibilityState&&te>-1&&(te="visibilitychange"===e.type?e.timeStamp:0,ae())},ie=function(){addEventListener("visibilitychange",re,!0),addEventListener("prerenderingchange",re,!0)},ae=function(){removeEventListener("visibilitychange",re,!0),removeEventListener("prerenderingchange",re,!0)},oe=function(){return te<0&&(te=ne(),ie(),H((function(){setTimeout((function(){te=ne(),ie()}),0)}))),{get firstHiddenTime(){return te}}},se=function(e,t){t=t||{},ee((function(){var n,r=[1800,3e3],i=oe(),a=J("FCP"),o=X("paint",(function(e){e.forEach((function(e){"first-contentful-paint"===e.name&&(o.disconnect(),e.startTime<i.firstHiddenTime&&(a.value=Math.max(e.startTime-V(),0),a.entries.push(e),n(!0)))}))}));o&&(n=Z(e,a,r,t.reportAllChanges),H((function(i){a=J("FCP"),n=Z(e,a,r,t.reportAllChanges),Y((function(){a.value=performance.now()-i.timeStamp,n(!0)}))})))}))},ce={passive:!0,capture:!0},ue=new Date,le=function(e,t){P||(P=t,M=e,B=new Date,me(removeEventListener),de())},de=function(){if(M>=0&&M<B-ue){var e={entryType:"first-input",name:P.type,target:P.target,cancelable:P.cancelable,startTime:P.timeStamp,processingStart:P.timeStamp+M};C.forEach((function(t){t(e)})),C=[]}},pe=function(e){if(e.cancelable){var t=(e.timeStamp>1e12?new Date:performance.now())-e.timeStamp;"pointerdown"==e.type?function(e,t){var n=function(){le(e,t),i()},r=function(){i()},i=function(){removeEventListener("pointerup",n,ce),removeEventListener("pointercancel",r,ce)};addEventListener("pointerup",n,ce),addEventListener("pointercancel",r,ce)}(t,e):le(t,e)}},me=function(e){["mousedown","keydown","touchstart","pointerdown"].forEach((function(t){return e(t,pe,ce)}))},fe=0,ve=1/0,ge=0,be=function(e){e.forEach((function(e){e.interactionId&&(ve=Math.min(ve,e.interactionId),ge=Math.max(ge,e.interactionId),fe=ge?(ge-ve)/7+1:0)}))},he=function(){return D?fe:performance.interactionCount||0},we=0,ye=function(){return he()-we},Te=[],ke={},_e=function(e){var t=Te[Te.length-1],n=ke[e.interactionId];if(n||Te.length<10||e.duration>t.latency){if(n)n.entries.push(e),n.latency=Math.max(n.latency,e.duration);else{var r={id:e.interactionId,latency:e.duration,entries:[e]};ke[r.id]=r,Te.push(r)}Te.sort((function(e,t){return t.latency-e.latency})),Te.splice(10).forEach((function(e){delete ke[e.id]}))}},Se={},Ee=function e(t){document.prerendering?ee((function(){return e(t)})):"complete"!==document.readyState?addEventListener("load",(function(){return e(t)}),!0):setTimeout(t,0)},xe=function(e,t){t=t||{};var n=[800,1800],r=J("TTFB"),i=Z(e,r,n,t.reportAllChanges);Ee((function(){var a=F();if(a){var o=a.responseStart;if(o<=0||o>performance.now())return;r.value=Math.max(o-V(),0),r.entries=[a],i(!0),H((function(){r=J("TTFB",0),(i=Z(e,r,n,t.reportAllChanges))(!0)}))}}))},Oe=function(e){e.forEach((function(e){e.identifier&&q({attribution:{identifier:e.identifier},name:"ET",rating:null,value:e.startTime})}))},je=function(e){e.forEach((function(e){if(a.isResourceTiming&&R("resourceTiming",e),e.decodedBodySize&&e.initiatorType){var t=e.decodedBodySize/1e3;h.value[e.initiatorType]+=t,h.value.total+=t}}))},Ne=function(){!function(e,t){xe((function(e){!function(e){if(e.entries.length){var t=e.entries[0],n=t.activationStart||0,r=Math.max(t.domainLookupStart-n,0),i=Math.max(t.connectStart-n,0),a=Math.max(t.requestStart-n,0);e.attribution={waitingTime:r,dnsTime:i-r,connectionTime:a-i,requestTime:e.value-a,navigationEntry:t}}else e.attribution={waitingTime:0,dnsTime:0,connectionTime:0,requestTime:0}}(e),function(e){e.value>0&&q(e)}(e)}),t)}(0,a.reportOptions.ttfb),function(e,t){!function(e,t){t=t||{},ee((function(){var e,n=[.1,.25],r=J("CLS"),i=-1,a=0,o=[],s=function(e){i>-1&&function(e){!function(e){if(e.entries.length){var t=e.entries.reduce((function(e,t){return e&&e.value>t.value?e:t}));if(t&&t.sources&&t.sources.length){var n=(r=t.sources).find((function(e){return e.node&&1===e.node.nodeType}))||r[0];if(n)return void(e.attribution={largestShiftTarget:$(n.node),largestShiftTime:t.startTime,largestShiftValue:t.value,largestShiftSource:n,largestShiftEntry:t,loadState:z(t.startTime)})}}var r;e.attribution={}}(e),function(e){q(e)}(e)}(e)},c=function(t){t.forEach((function(t){if(!t.hadRecentInput){var n=o[0],i=o[o.length-1];a&&t.startTime-i.startTime<1e3&&t.startTime-n.startTime<5e3?(a+=t.value,o.push(t)):(a=t.value,o=[t]),a>r.value&&(r.value=a,r.entries=o,e())}}))},u=X("layout-shift",c);u&&(e=Z(s,r,n,t.reportAllChanges),se((function(t){i=t.value,r.value<0&&(r.value=0,e())})),G((function(){c(u.takeRecords()),e(!0)})),H((function(){a=0,i=-1,r=J("CLS",0),e=Z(s,r,n,t.reportAllChanges),Y((function(){return e()}))})))}))}(0,t)}(0,a.reportOptions.cls),function(e,t){se((function(e){!function(e){if(e.entries.length){var t=F(),n=e.entries[e.entries.length-1];if(t){var r=t.activationStart||0,i=Math.max(0,t.responseStart-r);return void(e.attribution={timeToFirstByte:i,firstByteToFCP:e.value-i,loadState:z(e.entries[0].startTime),navigationEntry:t,fcpEntry:n})}}e.attribution={timeToFirstByte:0,firstByteToFCP:e.value,loadState:z(W())}}(e),function(e){q(e)}(e)}),t)}(0,a.reportOptions.fcp),function(e,t){!function(e,t){t=t||{},ee((function(){var n,r=[100,300],i=oe(),a=J("FID"),o=function(e){e.startTime<i.firstHiddenTime&&(a.value=e.processingStart-e.startTime,a.entries.push(e),n(!0))},s=function(e){e.forEach(o)},c=X("first-input",s);n=Z(e,a,r,t.reportAllChanges),c&&G((function(){s(c.takeRecords()),c.disconnect()}),!0),c&&H((function(){var i;a=J("FID"),n=Z(e,a,r,t.reportAllChanges),C=[],M=-1,P=null,me(addEventListener),i=o,C.push(i),de()}))}))}((function(e){!function(e){var t=e.entries[0];e.attribution={eventTarget:$(t.target),eventType:t.name,eventTime:t.startTime,eventEntry:t,loadState:z(t.startTime)}}(e),function(e){q(e)}(e)}),t)}(0,a.reportOptions.fid),function(e,t){!function(e,t){t=t||{},ee((function(){var n,r=[2500,4e3],i=oe(),a=J("LCP"),o=function(e){var t=e[e.length-1];if(t){var r=Math.max(t.startTime-V(),0);r<i.firstHiddenTime&&(a.value=r,a.entries=[t],n())}},s=X("largest-contentful-paint",o);if(s){n=Z(e,a,r,t.reportAllChanges);var c=function(){Se[a.id]||(o(s.takeRecords()),s.disconnect(),Se[a.id]=!0,n(!0))};["keydown","click"].forEach((function(e){addEventListener(e,c,{once:!0,capture:!0})})),G(c,!0),H((function(i){a=J("LCP"),n=Z(e,a,r,t.reportAllChanges),Y((function(){a.value=performance.now()-i.timeStamp,Se[a.id]=!0,n(!0)}))}))}}))}((function(e){!function(e){if(e.entries.length){var t=F();if(t){var n=t.activationStart||0,r=e.entries[e.entries.length-1],i=r.url&&performance.getEntriesByType("resource").filter((function(e){return e.name===r.url}))[0],a=Math.max(0,t.responseStart-n),o=Math.max(a,i?(i.requestStart||i.startTime)-n:0),s=Math.max(o,i?i.responseEnd-n:0),c=Math.max(s,r?r.startTime-n:0),u={element:$(r.element),timeToFirstByte:a,resourceLoadDelay:o-a,resourceLoadTime:s-o,elementRenderDelay:c-s,navigationEntry:t,lcpEntry:r};return r.url&&(u.url=r.url),i&&(u.lcpResourceEntry=i),void(e.attribution=u)}}e.attribution={timeToFirstByte:0,resourceLoadDelay:0,resourceLoadTime:0,elementRenderDelay:e.value}}(e),function(e){q(e)}(e)}),t)}(0,a.reportOptions.lcp),function(e,t){!function(e,t){t=t||{},ee((function(){var n=[200,500];"interactionCount"in performance||D||(D=X("event",be,{type:"event",buffered:!0,durationThreshold:0}));var r,i=J("INP"),a=function(e){e.forEach((function(e){e.interactionId&&_e(e),"first-input"===e.entryType&&!Te.some((function(t){return t.entries.some((function(t){return e.duration===t.duration&&e.startTime===t.startTime}))}))&&_e(e)}));var t,n=(t=Math.min(Te.length-1,Math.floor(ye()/50)),Te[t]);n&&n.latency!==i.value&&(i.value=n.latency,i.entries=n.entries,r())},o=X("event",a,{durationThreshold:t.durationThreshold||40});r=Z(e,i,n,t.reportAllChanges),o&&(o.observe({type:"first-input",buffered:!0}),G((function(){a(o.takeRecords()),i.value<0&&ye()>0&&(i.value=0,i.entries=[]),r(!0)})),H((function(){Te=[],we=he(),i=J("INP"),r=Z(e,i,n,t.reportAllChanges)})))}))}((function(t){!function(e){if(e.entries.length){var t=e.entries.sort((function(e,t){return t.duration-e.duration||t.processingEnd-t.processingStart-(e.processingEnd-e.processingStart)}))[0];e.attribution={eventTarget:$(t.target),eventType:t.name,eventTime:t.startTime,eventEntry:t,loadState:z(t.startTime)}}else e.attribution={}}(t),e(t)}),t)}((function(e){return q(e)}),a.reportOptions.inp),a.isResourceTiming&&S("resource",je),a.isElementTiming&&S("element",Oe)},Ie=function(e){var t="usageDetails"in e?e.usageDetails:{};R("storageEstimate",{quota:j(e.quota),usage:j(e.usage),caches:j(t.caches),indexedDB:j(t.indexedDB),serviceWorker:j(t.serviceWorkerRegistrations)})},Pe={finalMarkToStepsMap:{},startMarkToStepsMap:{},active:{},navigationSteps:{}},Me=function(e){delete Pe.active[e]},Be=function(){return Pe.navigationSteps},Ce=function(e){var t;return null!==(t=Be()[e])&&void 0!==t?t:{}},De=function(e,t,n){var r="step."+e,i=u.getEntriesByName(p+t).length>0;if(u.getEntriesByName(p+n).length>0&&a.steps){var o=A[a.steps[e].threshold],s=o.maxOutlierThreshold,c=o.vitalsThresholds;if(i){var l=u.measure(r,p+t,p+n),d=l.duration;if(d<=s){var m=function(e,t){return e<=t[0]?"good":e<=t[1]?"needsImprovement":"poor"}(d,c);d>=0&&(N("userJourneyStep",d,m,{stepName:e},void 0),u.measure("step.".concat(e,"_vitals_").concat(m),{start:l.startTime+l.duration,end:l.startTime+l.duration,detail:{type:"stepVital",duration:d}}))}}}},Ae=function(){var e=Be(),t=Pe.startMarkToStepsMap,n=Object.keys(e).length;if(0===n)return{};var r={},i=n-1,a=Ce(i);if(Object.keys(a).forEach((function(e){var n,i=null!==(n=t[e])&&void 0!==n?n:[];Object.keys(i).forEach((function(e){r[e]=!0}))})),n>1){var o=Ce(i-1);Object.keys(o).forEach((function(e){var n,i=null!==(n=t[e])&&void 0!==n?n:[];Object.keys(i).forEach((function(e){r[e]=!0}))}))}return r},Le=function(){var e,t=Object.keys(Pe.navigationSteps).length;Pe.navigationSteps[t]={};var n=Ae();null===(e=a.onMarkStep)||void 0===e||e.call(a,"",Object.keys(n))},Ue=function(e){var t,n,r,i,o,s,c;if(Pe.finalMarkToStepsMap[e]){!function(e){var t=Pe.navigationSteps,n=Pe.finalMarkToStepsMap,r=Object.keys(t).length;if(0!==r){var i=r-1,a=Ce(i);if(a&&n[e]){var o=n[e];o&&Object.keys(o).forEach((function(e){if(a[e]){var n=Ce(i)||{};n[e]=!1,t[i]=n}if(r>1){var o=i-1,s=Ce(o);s[e]&&(s[e]=!1,t[o]=s)}}))}}}(e);var u=Pe.finalMarkToStepsMap[e];Object.keys(u).forEach((function(t){var n=u[t];n.forEach(Me),Promise.all(n.map((function(n){return function(e,t,n,r){return new(n||(n=Promise))((function(e,t){function i(e){try{o(r.next(e))}catch(e){t(e)}}function a(e){try{o(r.throw(e))}catch(e){t(e)}}function o(t){var r;t.done?e(t.value):(r=t.value,r instanceof n?r:new n((function(e){e(r)}))).then(i,a)}o((r=r.apply(undefined,[])).next())}))}(0,0,void 0,(function(){return function(e,t){var n,r,i,a,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return a={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function s(a){return function(s){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;o;)try{if(n=1,r&&(i=2&a[0]?r.return:a[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,a[1])).done)return i;switch(r=0,i&&(a=[2&a[0],i.value]),a[0]){case 0:case 1:i=a;break;case 4:return o.label++,{value:a[1],done:!1};case 5:o.label++,r=a[1],a=[0];continue;case 7:a=o.ops.pop(),o.trys.pop();continue;default:if(!((i=(i=o.trys).length>0&&i[i.length-1])||6!==a[0]&&2!==a[0])){o=0;continue}if(3===a[0]&&(!i||a[1]>i[0]&&a[1]<i[3])){o.label=a[1];break}if(6===a[0]&&o.label<i[1]){o.label=i[1],i=a;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(a);break}i[2]&&o.ops.pop(),o.trys.pop();continue}a=t.call(e,o)}catch(e){a=[6,e],r=0}finally{n=i=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,s])}}}(this,(function(r){switch(r.label){case 0:return[4,De(n,t,e)];case 1:return r.sent(),[2]}}))}))}))).catch((function(){}))}))}else r=e,i=Pe.navigationSteps,o=Object.keys(i).length,(c=Ce(s=(o>0?o:1)-1)||[])[r]=!0,i[s]=c,function(e){var t,n=null!==(t=Pe.startMarkToStepsMap[e])&&void 0!==t?t:[];Object.keys(n).forEach((function(e){Pe.active[e]||(Pe.active[e]=!0)}))}(e);if(a.enableNavigationTracking){var l=Ae();null===(t=a.onMarkStep)||void 0===t||t.call(a,e,Object.keys(l))}else null===(n=a.onMarkStep)||void 0===n||n.call(a,e,Object.keys(Pe.active))},Re=function(e){u.mark(p+e),Ue(e)},qe=function(e){0===u.getEntriesByName(p+e).length&&(u.mark(p+e),Ue(e))},Fe=0,ze=function(){function e(e){if(void 0===e&&(e={}),this.v="9.0.0-rc.3",a.analyticsTracker=e.analyticsTracker,a.isResourceTiming=!!e.resourceTiming,a.isElementTiming=!!e.elementTiming,a.maxTime=e.maxMeasureTime||a.maxTime,a.reportOptions=e.reportOptions||a.reportOptions,a.steps=e.steps,a.onMarkStep=e.onMarkStep,a.enableNavigationTracking=e.enableNavigationTracking,m()){"PerformanceObserver"in o&&Ne(),void 0!==document.hidden&&document.addEventListener("visibilitychange",_);var t=function(){if(!m())return{};var e=u.getEntriesByType("navigation")[0];if(!e)return{};var t=e.responseStart,n=e.responseEnd;return{fetchTime:n-e.fetchStart,workerTime:e.workerStart>0?n-e.workerStart:0,totalTime:n-e.requestStart,downloadTime:n-t,timeToFirstByte:t-e.requestStart,headerSize:e.transferSize-e.encodedBodySize||0,dnsLookupTime:e.domainLookupEnd-e.domainLookupStart,redirectTime:e.redirectEnd-e.redirectStart}}();R("navigationTiming",t),t.redirectTime&&q({attribution:{},name:"RT",rating:U("RT",t.redirectTime),value:t.redirectTime}),R("networkInformation",function(){if("connection"in c){var e=c.connection;return"object"!=typeof e?{}:(f=e.effectiveType,v=!!e.saveData,{downlink:e.downlink,effectiveType:e.effectiveType,rtt:e.rtt,saveData:!!e.saveData})}return{}}()),c&&c.storage&&"function"==typeof c.storage.estimate&&c.storage.estimate().then(Ie),a.steps&&a.steps&&(Pe.startMarkToStepsMap={},Pe.finalMarkToStepsMap={},Pe.active={},Pe.navigationSteps={},Object.entries(a.steps).forEach((function(e){var t,n,r=e[0],i=e[1].marks,a=i[0],o=i[1],s=null!==(n=Pe.startMarkToStepsMap[a])&&void 0!==n?n:{};if(s[r]=!0,Pe.startMarkToStepsMap[a]=s,Pe.finalMarkToStepsMap[o]){var c=Pe.finalMarkToStepsMap[o][a]||[];c.push(r),Pe.finalMarkToStepsMap[o][a]=c}else Pe.finalMarkToStepsMap[o]=((t={})[a]=[r],t)})))}}return e.prototype.start=function(e){m()&&!g[e]&&(g[e]=!0,u.mark("mark_".concat(e,"_start")))},e.prototype.end=function(e,t,n){if(void 0===t&&(t={}),void 0===n&&(n=!0),m()&&g[e]){u.mark("mark_".concat(e,"_end")),delete g[e];var r=function(e){u.measure(e,"mark_".concat(e,"_start"),"mark_".concat(e,"_end"));var t=u.getEntriesByName(e).pop();return t&&"measure"===t.entryType?t.duration:-1}(e);n&&R(e,O(r),t)}},e.prototype.endPaint=function(e,t){var n=this;setTimeout((function(){n.end(e,t)}))},e.prototype.clear=function(e){delete g[e],u.clearMarks&&(u.clearMarks("mark_".concat(e,"_start")),u.clearMarks("mark_".concat(e,"_end")))},e.prototype.markNTBT=function(){var e=this;this.start("ntbt"),y.value=0,clearTimeout(Fe),Fe=setTimeout((function(){e.end("ntbt",{},!1),q({attribution:{},name:"NTBT",rating:U("NTBT",y.value),value:y.value}),y.value=0}),2e3)},e}()},426:(e,t)=>{"use strict";Symbol.for("react.element"),Symbol.for("react.portal"),Symbol.for("react.fragment"),Symbol.for("react.strict_mode"),Symbol.for("react.profiler"),Symbol.for("react.provider"),Symbol.for("react.context"),Symbol.for("react.forward_ref"),Symbol.for("react.suspense"),Symbol.for("react.memo"),Symbol.for("react.lazy"),Symbol.iterator;var n={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},r=Object.assign,i={};function a(e,t,r){this.props=e,this.context=t,this.refs=i,this.updater=r||n}function o(){}function s(e,t,r){this.props=e,this.context=t,this.refs=i,this.updater=r||n}a.prototype.isReactComponent={},a.prototype.setState=function(e,t){if("object"!=typeof e&&"function"!=typeof e&&null!=e)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,e,t,"setState")},a.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")},o.prototype=a.prototype;var c=s.prototype=new o;c.constructor=s,r(c,a.prototype),c.isPureReactComponent=!0;Array.isArray,Object.prototype.hasOwnProperty;var u={current:null};t.useCallback=function(e,t){return u.current.useCallback(e,t)},t.useEffect=function(e,t){return u.current.useEffect(e,t)},t.useRef=function(e){return u.current.useRef(e)}},784:(e,t,n)=>{"use strict";e.exports=n(426)},353:function(e,t,n){var r;!function(i,a){"use strict";var o="function",s="undefined",c="object",u="string",l="major",d="model",p="name",m="type",f="vendor",v="version",g="architecture",b="console",h="mobile",w="tablet",y="smarttv",T="wearable",k="embedded",_="Amazon",S="Apple",E="ASUS",x="BlackBerry",O="Browser",j="Chrome",N="Firefox",I="Google",P="Huawei",M="LG",B="Microsoft",C="Motorola",D="Opera",A="Samsung",L="Sharp",U="Sony",R="Xiaomi",q="Zebra",F="Facebook",z="Chromium OS",K="Mac OS",$=function(e){for(var t={},n=0;n<e.length;n++)t[e[n].toUpperCase()]=e[n];return t},Q=function(e,t){return typeof e===u&&-1!==W(t).indexOf(W(e))},W=function(e){return e.toLowerCase()},H=function(e,t){if(typeof e===u)return e=e.replace(/^\\s\\s*/,""),typeof t===s?e:e.substring(0,350)},V=function(e,t){for(var n,r,i,s,u,l,d=0;d<t.length&&!u;){var p=t[d],m=t[d+1];for(n=r=0;n<p.length&&!u&&p[n];)if(u=p[n++].exec(e))for(i=0;i<m.length;i++)l=u[++r],typeof(s=m[i])===c&&s.length>0?2===s.length?typeof s[1]==o?this[s[0]]=s[1].call(this,l):this[s[0]]=s[1]:3===s.length?typeof s[1]!==o||s[1].exec&&s[1].test?this[s[0]]=l?l.replace(s[1],s[2]):a:this[s[0]]=l?s[1].call(this,l,s[2]):a:4===s.length&&(this[s[0]]=l?s[3].call(this,l.replace(s[1],s[2])):a):this[s]=l||a;d+=2}},J=function(e,t){for(var n in t)if(typeof t[n]===c&&t[n].length>0){for(var r=0;r<t[n].length;r++)if(Q(t[n][r],e))return"?"===n?a:n}else if(Q(t[n],e))return"?"===n?a:n;return e},X={ME:"4.90","NT 3.11":"NT3.51","NT 4.0":"NT4.0",2e3:"NT 5.0",XP:["NT 5.1","NT 5.2"],Vista:"NT 6.0",7:"NT 6.1",8:"NT 6.2",8.1:"NT 6.3",10:["NT 6.4","NT 10.0"],RT:"ARM"},G={browser:[[/\\b(?:crmo|crios)\\/([\\w\\.]+)/i],[v,[p,"Chrome"]],[/edg(?:e|ios|a)?\\/([\\w\\.]+)/i],[v,[p,"Edge"]],[/(opera mini)\\/([-\\w\\.]+)/i,/(opera [mobiletab]{3,6})\\b.+version\\/([-\\w\\.]+)/i,/(opera)(?:.+version\\/|[\\/ ]+)([\\w\\.]+)/i],[p,v],[/opios[\\/ ]+([\\w\\.]+)/i],[v,[p,D+" Mini"]],[/\\bopr\\/([\\w\\.]+)/i],[v,[p,D]],[/(kindle)\\/([\\w\\.]+)/i,/(lunascape|maxthon|netfront|jasmine|blazer)[\\/ ]?([\\w\\.]*)/i,/(avant |iemobile|slim)(?:browser)?[\\/ ]?([\\w\\.]*)/i,/(ba?idubrowser)[\\/ ]?([\\w\\.]+)/i,/(?:ms|\\()(ie) ([\\w\\.]+)/i,/(flock|rockmelt|midori|epiphany|silk|skyfire|bolt|iron|vivaldi|iridium|phantomjs|bowser|quark|qupzilla|falkon|rekonq|puffin|brave|whale(?!.+naver)|qqbrowserlite|qq|duckduckgo)\\/([-\\w\\.]+)/i,/(heytap|ovi)browser\\/([\\d\\.]+)/i,/(weibo)__([\\d\\.]+)/i],[p,v],[/(?:\\buc? ?browser|(?:juc.+)ucweb)[\\/ ]?([\\w\\.]+)/i],[v,[p,"UC"+O]],[/microm.+\\bqbcore\\/([\\w\\.]+)/i,/\\bqbcore\\/([\\w\\.]+).+microm/i],[v,[p,"WeChat(Win) Desktop"]],[/micromessenger\\/([\\w\\.]+)/i],[v,[p,"WeChat"]],[/konqueror\\/([\\w\\.]+)/i],[v,[p,"Konqueror"]],[/trident.+rv[: ]([\\w\\.]{1,9})\\b.+like gecko/i],[v,[p,"IE"]],[/ya(?:search)?browser\\/([\\w\\.]+)/i],[v,[p,"Yandex"]],[/(avast|avg)\\/([\\w\\.]+)/i],[[p,/(.+)/,"$1 Secure "+O],v],[/\\bfocus\\/([\\w\\.]+)/i],[v,[p,N+" Focus"]],[/\\bopt\\/([\\w\\.]+)/i],[v,[p,D+" Touch"]],[/coc_coc\\w+\\/([\\w\\.]+)/i],[v,[p,"Coc Coc"]],[/dolfin\\/([\\w\\.]+)/i],[v,[p,"Dolphin"]],[/coast\\/([\\w\\.]+)/i],[v,[p,D+" Coast"]],[/miuibrowser\\/([\\w\\.]+)/i],[v,[p,"MIUI "+O]],[/fxios\\/([-\\w\\.]+)/i],[v,[p,N]],[/\\bqihu|(qi?ho?o?|360)browser/i],[[p,"360 "+O]],[/(oculus|samsung|sailfish|huawei)browser\\/([\\w\\.]+)/i],[[p,/(.+)/,"$1 "+O],v],[/(comodo_dragon)\\/([\\w\\.]+)/i],[[p,/_/g," "],v],[/(electron)\\/([\\w\\.]+) safari/i,/(tesla)(?: qtcarbrowser|\\/(20\\d\\d\\.[-\\w\\.]+))/i,/m?(qqbrowser|baiduboxapp|2345Explorer)[\\/ ]?([\\w\\.]+)/i],[p,v],[/(metasr)[\\/ ]?([\\w\\.]+)/i,/(lbbrowser)/i,/\\[(linkedin)app\\]/i],[p],[/((?:fban\\/fbios|fb_iab\\/fb4a)(?!.+fbav)|;fbav\\/([\\w\\.]+);)/i],[[p,F],v],[/(kakao(?:talk|story))[\\/ ]([\\w\\.]+)/i,/(naver)\\(.*?(\\d+\\.[\\w\\.]+).*\\)/i,/safari (line)\\/([\\w\\.]+)/i,/\\b(line)\\/([\\w\\.]+)\\/iab/i,/(chromium|instagram)[\\/ ]([-\\w\\.]+)/i],[p,v],[/\\bgsa\\/([\\w\\.]+) .*safari\\//i],[v,[p,"GSA"]],[/musical_ly(?:.+app_?version\\/|_)([\\w\\.]+)/i],[v,[p,"TikTok"]],[/headlesschrome(?:\\/([\\w\\.]+)| )/i],[v,[p,j+" Headless"]],[/ wv\\).+(chrome)\\/([\\w\\.]+)/i],[[p,j+" WebView"],v],[/droid.+ version\\/([\\w\\.]+)\\b.+(?:mobile safari|safari)/i],[v,[p,"Android "+O]],[/(chrome|omniweb|arora|[tizenoka]{5} ?browser)\\/v?([\\w\\.]+)/i],[p,v],[/version\\/([\\w\\.\\,]+) .*mobile\\/\\w+ (safari)/i],[v,[p,"Mobile Safari"]],[/version\\/([\\w(\\.|\\,)]+) .*(mobile ?safari|safari)/i],[v,p],[/webkit.+?(mobile ?safari|safari)(\\/[\\w\\.]+)/i],[p,[v,J,{"1.0":"/8",1.2:"/1",1.3:"/3","2.0":"/412","2.0.2":"/416","2.0.3":"/417","2.0.4":"/419","?":"/"}]],[/(webkit|khtml)\\/([\\w\\.]+)/i],[p,v],[/(navigator|netscape\\d?)\\/([-\\w\\.]+)/i],[[p,"Netscape"],v],[/mobile vr; rv:([\\w\\.]+)\\).+firefox/i],[v,[p,N+" Reality"]],[/ekiohf.+(flow)\\/([\\w\\.]+)/i,/(swiftfox)/i,/(icedragon|iceweasel|camino|chimera|fennec|maemo browser|minimo|conkeror|klar)[\\/ ]?([\\w\\.\\+]+)/i,/(seamonkey|k-meleon|icecat|iceape|firebird|phoenix|palemoon|basilisk|waterfox)\\/([-\\w\\.]+)$/i,/(firefox)\\/([\\w\\.]+)/i,/(mozilla)\\/([\\w\\.]+) .+rv\\:.+gecko\\/\\d+/i,/(polaris|lynx|dillo|icab|doris|amaya|w3m|netsurf|sleipnir|obigo|mosaic|(?:go|ice|up)[\\. ]?browser)[-\\/ ]?v?([\\w\\.]+)/i,/(links) \\(([\\w\\.]+)/i,/panasonic;(viera)/i],[p,v],[/(cobalt)\\/([\\w\\.]+)/i],[p,[v,/master.|lts./,""]]],cpu:[[/(?:(amd|x(?:(?:86|64)[-_])?|wow|win)64)[;\\)]/i],[[g,"amd64"]],[/(ia32(?=;))/i],[[g,W]],[/((?:i[346]|x)86)[;\\)]/i],[[g,"ia32"]],[/\\b(aarch64|arm(v?8e?l?|_?64))\\b/i],[[g,"arm64"]],[/\\b(arm(?:v[67])?ht?n?[fl]p?)\\b/i],[[g,"armhf"]],[/windows (ce|mobile); ppc;/i],[[g,"arm"]],[/((?:ppc|powerpc)(?:64)?)(?: mac|;|\\))/i],[[g,/ower/,"",W]],[/(sun4\\w)[;\\)]/i],[[g,"sparc"]],[/((?:avr32|ia64(?=;))|68k(?=\\))|\\barm(?=v(?:[1-7]|[5-7]1)l?|;|eabi)|(?=atmel )avr|(?:irix|mips|sparc)(?:64)?\\b|pa-risc)/i],[[g,W]]],device:[[/\\b(sch-i[89]0\\d|shw-m380s|sm-[ptx]\\w{2,4}|gt-[pn]\\d{2,4}|sgh-t8[56]9|nexus 10)/i],[d,[f,A],[m,w]],[/\\b((?:s[cgp]h|gt|sm)-\\w+|sc[g-]?[\\d]+a?|galaxy nexus)/i,/samsung[- ]([-\\w]+)/i,/sec-(sgh\\w+)/i],[d,[f,A],[m,h]],[/(?:\\/|\\()(ip(?:hone|od)[\\w, ]*)(?:\\/|;)/i],[d,[f,S],[m,h]],[/\\((ipad);[-\\w\\),; ]+apple/i,/applecoremedia\\/[\\w\\.]+ \\((ipad)/i,/\\b(ipad)\\d\\d?,\\d\\d?[;\\]].+ios/i],[d,[f,S],[m,w]],[/(macintosh);/i],[d,[f,S]],[/\\b(sh-?[altvz]?\\d\\d[a-ekm]?)/i],[d,[f,L],[m,h]],[/\\b((?:ag[rs][23]?|bah2?|sht?|btv)-a?[lw]\\d{2})\\b(?!.+d\\/s)/i],[d,[f,P],[m,w]],[/(?:huawei|honor)([-\\w ]+)[;\\)]/i,/\\b(nexus 6p|\\w{2,4}e?-[atu]?[ln][\\dx][012359c][adn]?)\\b(?!.+d\\/s)/i],[d,[f,P],[m,h]],[/\\b(poco[\\w ]+)(?: bui|\\))/i,/\\b; (\\w+) build\\/hm\\1/i,/\\b(hm[-_ ]?note?[_ ]?(?:\\d\\w)?) bui/i,/\\b(redmi[\\-_ ]?(?:note|k)?[\\w_ ]+)(?: bui|\\))/i,/\\b(mi[-_ ]?(?:a\\d|one|one[_ ]plus|note lte|max|cc)?[_ ]?(?:\\d?\\w?)[_ ]?(?:plus|se|lite)?)(?: bui|\\))/i],[[d,/_/g," "],[f,R],[m,h]],[/\\b(mi[-_ ]?(?:pad)(?:[\\w_ ]+))(?: bui|\\))/i],[[d,/_/g," "],[f,R],[m,w]],[/; (\\w+) bui.+ oppo/i,/\\b(cph[12]\\d{3}|p(?:af|c[al]|d\\w|e[ar])[mt]\\d0|x9007|a101op)\\b/i],[d,[f,"OPPO"],[m,h]],[/vivo (\\w+)(?: bui|\\))/i,/\\b(v[12]\\d{3}\\w?[at])(?: bui|;)/i],[d,[f,"Vivo"],[m,h]],[/\\b(rmx[12]\\d{3})(?: bui|;|\\))/i],[d,[f,"Realme"],[m,h]],[/\\b(milestone|droid(?:[2-4x]| (?:bionic|x2|pro|razr))?:?( 4g)?)\\b[\\w ]+build\\//i,/\\bmot(?:orola)?[- ](\\w*)/i,/((?:moto[\\w\\(\\) ]+|xt\\d{3,4}|nexus 6)(?= bui|\\)))/i],[d,[f,C],[m,h]],[/\\b(mz60\\d|xoom[2 ]{0,2}) build\\//i],[d,[f,C],[m,w]],[/((?=lg)?[vl]k\\-?\\d{3}) bui| 3\\.[-\\w; ]{10}lg?-([06cv9]{3,4})/i],[d,[f,M],[m,w]],[/(lm(?:-?f100[nv]?|-[\\w\\.]+)(?= bui|\\))|nexus [45])/i,/\\blg[-e;\\/ ]+((?!browser|netcast|android tv)\\w+)/i,/\\blg-?([\\d\\w]+) bui/i],[d,[f,M],[m,h]],[/(ideatab[-\\w ]+)/i,/lenovo ?(s[56]000[-\\w]+|tab(?:[\\w ]+)|yt[-\\d\\w]{6}|tb[-\\d\\w]{6})/i],[d,[f,"Lenovo"],[m,w]],[/(?:maemo|nokia).*(n900|lumia \\d+)/i,/nokia[-_ ]?([-\\w\\.]*)/i],[[d,/_/g," "],[f,"Nokia"],[m,h]],[/(pixel c)\\b/i],[d,[f,I],[m,w]],[/droid.+; (pixel[\\daxl ]{0,6})(?: bui|\\))/i],[d,[f,I],[m,h]],[/droid.+ (a?\\d[0-2]{2}so|[c-g]\\d{4}|so[-gl]\\w+|xq-a\\w[4-7][12])(?= bui|\\).+chrome\\/(?![1-6]{0,1}\\d\\.))/i],[d,[f,U],[m,h]],[/sony tablet [ps]/i,/\\b(?:sony)?sgp\\w+(?: bui|\\))/i],[[d,"Xperia Tablet"],[f,U],[m,w]],[/ (kb2005|in20[12]5|be20[12][59])\\b/i,/(?:one)?(?:plus)? (a\\d0\\d\\d)(?: b|\\))/i],[d,[f,"OnePlus"],[m,h]],[/(alexa)webm/i,/(kf[a-z]{2}wi|aeo[c-r]{2})( bui|\\))/i,/(kf[a-z]+)( bui|\\)).+silk\\//i],[d,[f,_],[m,w]],[/((?:sd|kf)[0349hijorstuw]+)( bui|\\)).+silk\\//i],[[d,/(.+)/g,"Fire Phone $1"],[f,_],[m,h]],[/(playbook);[-\\w\\),; ]+(rim)/i],[d,f,[m,w]],[/\\b((?:bb[a-f]|st[hv])100-\\d)/i,/\\(bb10; (\\w+)/i],[d,[f,x],[m,h]],[/(?:\\b|asus_)(transfo[prime ]{4,10} \\w+|eeepc|slider \\w+|nexus 7|padfone|p00[cj])/i],[d,[f,E],[m,w]],[/ (z[bes]6[027][012][km][ls]|zenfone \\d\\w?)\\b/i],[d,[f,E],[m,h]],[/(nexus 9)/i],[d,[f,"HTC"],[m,w]],[/(htc)[-;_ ]{1,2}([\\w ]+(?=\\)| bui)|\\w+)/i,/(zte)[- ]([\\w ]+?)(?: bui|\\/|\\))/i,/(alcatel|geeksphone|nexian|panasonic(?!(?:;|\\.))|sony(?!-bra))[-_ ]?([-\\w]*)/i],[f,[d,/_/g," "],[m,h]],[/droid.+; ([ab][1-7]-?[0178a]\\d\\d?)/i],[d,[f,"Acer"],[m,w]],[/droid.+; (m[1-5] note) bui/i,/\\bmz-([-\\w]{2,})/i],[d,[f,"Meizu"],[m,h]],[/(blackberry|benq|palm(?=\\-)|sonyericsson|acer|asus|dell|meizu|motorola|polytron)[-_ ]?([-\\w]*)/i,/(hp) ([\\w ]+\\w)/i,/(asus)-?(\\w+)/i,/(microsoft); (lumia[\\w ]+)/i,/(lenovo)[-_ ]?([-\\w]+)/i,/(jolla)/i,/(oppo) ?([\\w ]+) bui/i],[f,d,[m,h]],[/(kobo)\\s(ereader|touch)/i,/(archos) (gamepad2?)/i,/(hp).+(touchpad(?!.+tablet)|tablet)/i,/(kindle)\\/([\\w\\.]+)/i,/(nook)[\\w ]+build\\/(\\w+)/i,/(dell) (strea[kpr\\d ]*[\\dko])/i,/(le[- ]+pan)[- ]+(\\w{1,9}) bui/i,/(trinity)[- ]*(t\\d{3}) bui/i,/(gigaset)[- ]+(q\\w{1,9}) bui/i,/(vodafone) ([\\w ]+)(?:\\)| bui)/i],[f,d,[m,w]],[/(surface duo)/i],[d,[f,B],[m,w]],[/droid [\\d\\.]+; (fp\\du?)(?: b|\\))/i],[d,[f,"Fairphone"],[m,h]],[/(u304aa)/i],[d,[f,"AT&T"],[m,h]],[/\\bsie-(\\w*)/i],[d,[f,"Siemens"],[m,h]],[/\\b(rct\\w+) b/i],[d,[f,"RCA"],[m,w]],[/\\b(venue[\\d ]{2,7}) b/i],[d,[f,"Dell"],[m,w]],[/\\b(q(?:mv|ta)\\w+) b/i],[d,[f,"Verizon"],[m,w]],[/\\b(?:barnes[& ]+noble |bn[rt])([\\w\\+ ]*) b/i],[d,[f,"Barnes & Noble"],[m,w]],[/\\b(tm\\d{3}\\w+) b/i],[d,[f,"NuVision"],[m,w]],[/\\b(k88) b/i],[d,[f,"ZTE"],[m,w]],[/\\b(nx\\d{3}j) b/i],[d,[f,"ZTE"],[m,h]],[/\\b(gen\\d{3}) b.+49h/i],[d,[f,"Swiss"],[m,h]],[/\\b(zur\\d{3}) b/i],[d,[f,"Swiss"],[m,w]],[/\\b((zeki)?tb.*\\b) b/i],[d,[f,"Zeki"],[m,w]],[/\\b([yr]\\d{2}) b/i,/\\b(dragon[- ]+touch |dt)(\\w{5}) b/i],[[f,"Dragon Touch"],d,[m,w]],[/\\b(ns-?\\w{0,9}) b/i],[d,[f,"Insignia"],[m,w]],[/\\b((nxa|next)-?\\w{0,9}) b/i],[d,[f,"NextBook"],[m,w]],[/\\b(xtreme\\_)?(v(1[045]|2[015]|[3469]0|7[05])) b/i],[[f,"Voice"],d,[m,h]],[/\\b(lvtel\\-)?(v1[12]) b/i],[[f,"LvTel"],d,[m,h]],[/\\b(ph-1) /i],[d,[f,"Essential"],[m,h]],[/\\b(v(100md|700na|7011|917g).*\\b) b/i],[d,[f,"Envizen"],[m,w]],[/\\b(trio[-\\w\\. ]+) b/i],[d,[f,"MachSpeed"],[m,w]],[/\\btu_(1491) b/i],[d,[f,"Rotor"],[m,w]],[/(shield[\\w ]+) b/i],[d,[f,"Nvidia"],[m,w]],[/(sprint) (\\w+)/i],[f,d,[m,h]],[/(kin\\.[onetw]{3})/i],[[d,/\\./g," "],[f,B],[m,h]],[/droid.+; (cc6666?|et5[16]|mc[239][23]x?|vc8[03]x?)\\)/i],[d,[f,q],[m,w]],[/droid.+; (ec30|ps20|tc[2-8]\\d[kx])\\)/i],[d,[f,q],[m,h]],[/smart-tv.+(samsung)/i],[f,[m,y]],[/hbbtv.+maple;(\\d+)/i],[[d,/^/,"SmartTV"],[f,A],[m,y]],[/(nux; netcast.+smarttv|lg (netcast\\.tv-201\\d|android tv))/i],[[f,M],[m,y]],[/(apple) ?tv/i],[f,[d,S+" TV"],[m,y]],[/crkey/i],[[d,j+"cast"],[f,I],[m,y]],[/droid.+aft(\\w)( bui|\\))/i],[d,[f,_],[m,y]],[/\\(dtv[\\);].+(aquos)/i,/(aquos-tv[\\w ]+)\\)/i],[d,[f,L],[m,y]],[/(bravia[\\w ]+)( bui|\\))/i],[d,[f,U],[m,y]],[/(mitv-\\w{5}) bui/i],[d,[f,R],[m,y]],[/Hbbtv.*(technisat) (.*);/i],[f,d,[m,y]],[/\\b(roku)[\\dx]*[\\)\\/]((?:dvp-)?[\\d\\.]*)/i,/hbbtv\\/\\d+\\.\\d+\\.\\d+ +\\([\\w\\+ ]*; *([\\w\\d][^;]*);([^;]*)/i],[[f,H],[d,H],[m,y]],[/\\b(android tv|smart[- ]?tv|opera tv|tv; rv:)\\b/i],[[m,y]],[/(ouya)/i,/(nintendo) ([wids3utch]+)/i],[f,d,[m,b]],[/droid.+; (shield) bui/i],[d,[f,"Nvidia"],[m,b]],[/(playstation [345portablevi]+)/i],[d,[f,U],[m,b]],[/\\b(xbox(?: one)?(?!; xbox))[\\); ]/i],[d,[f,B],[m,b]],[/((pebble))app/i],[f,d,[m,T]],[/(watch)(?: ?os[,\\/]|\\d,\\d\\/)[\\d\\.]+/i],[d,[f,S],[m,T]],[/droid.+; (glass) \\d/i],[d,[f,I],[m,T]],[/droid.+; (wt63?0{2,3})\\)/i],[d,[f,q],[m,T]],[/(quest( 2| pro)?)/i],[d,[f,F],[m,T]],[/(tesla)(?: qtcarbrowser|\\/[-\\w\\.]+)/i],[f,[m,k]],[/(aeobc)\\b/i],[d,[f,_],[m,k]],[/droid .+?; ([^;]+?)(?: bui|\\) applew).+? mobile safari/i],[d,[m,h]],[/droid .+?; ([^;]+?)(?: bui|\\) applew).+?(?! mobile) safari/i],[d,[m,w]],[/\\b((tablet|tab)[;\\/]|focus\\/\\d(?!.+mobile))/i],[[m,w]],[/(phone|mobile(?:[;\\/]| [ \\w\\/\\.]*safari)|pda(?=.+windows ce))/i],[[m,h]],[/(android[-\\w\\. ]{0,9});.+buil/i],[d,[f,"Generic"]]],engine:[[/windows.+ edge\\/([\\w\\.]+)/i],[v,[p,"EdgeHTML"]],[/webkit\\/537\\.36.+chrome\\/(?!27)([\\w\\.]+)/i],[v,[p,"Blink"]],[/(presto)\\/([\\w\\.]+)/i,/(webkit|trident|netfront|netsurf|amaya|lynx|w3m|goanna)\\/([\\w\\.]+)/i,/ekioh(flow)\\/([\\w\\.]+)/i,/(khtml|tasman|links)[\\/ ]\\(?([\\w\\.]+)/i,/(icab)[\\/ ]([23]\\.[\\d\\.]+)/i,/\\b(libweb)/i],[p,v],[/rv\\:([\\w\\.]{1,9})\\b.+(gecko)/i],[v,p]],os:[[/microsoft (windows) (vista|xp)/i],[p,v],[/(windows) nt 6\\.2; (arm)/i,/(windows (?:phone(?: os)?|mobile))[\\/ ]?([\\d\\.\\w ]*)/i,/(windows)[\\/ ]?([ntce\\d\\. ]+\\w)(?!.+xbox)/i],[p,[v,J,X]],[/(win(?=3|9|n)|win 9x )([nt\\d\\.]+)/i],[[p,"Windows"],[v,J,X]],[/ip[honead]{2,4}\\b(?:.*os ([\\w]+) like mac|; opera)/i,/ios;fbsv\\/([\\d\\.]+)/i,/cfnetwork\\/.+darwin/i],[[v,/_/g,"."],[p,"iOS"]],[/(mac os x) ?([\\w\\. ]*)/i,/(macintosh|mac_powerpc\\b)(?!.+haiku)/i],[[p,K],[v,/_/g,"."]],[/droid ([\\w\\.]+)\\b.+(android[- ]x86|harmonyos)/i],[v,p],[/(android|webos|qnx|bada|rim tablet os|maemo|meego|sailfish)[-\\/ ]?([\\w\\.]*)/i,/(blackberry)\\w*\\/([\\w\\.]*)/i,/(tizen|kaios)[\\/ ]([\\w\\.]+)/i,/\\((series40);/i],[p,v],[/\\(bb(10);/i],[v,[p,x]],[/(?:symbian ?os|symbos|s60(?=;)|series60)[-\\/ ]?([\\w\\.]*)/i],[v,[p,"Symbian"]],[/mozilla\\/[\\d\\.]+ \\((?:mobile|tablet|tv|mobile; [\\w ]+); rv:.+ gecko\\/([\\w\\.]+)/i],[v,[p,N+" OS"]],[/web0s;.+rt(tv)/i,/\\b(?:hp)?wos(?:browser)?\\/([\\w\\.]+)/i],[v,[p,"webOS"]],[/watch(?: ?os[,\\/]|\\d,\\d\\/)([\\d\\.]+)/i],[v,[p,"watchOS"]],[/crkey\\/([\\d\\.]+)/i],[v,[p,j+"cast"]],[/(cros) [\\w]+(?:\\)| ([\\w\\.]+)\\b)/i],[[p,z],v],[/panasonic;(viera)/i,/(netrange)mmh/i,/(nettv)\\/(\\d+\\.[\\w\\.]+)/i,/(nintendo|playstation) ([wids345portablevuch]+)/i,/(xbox); +xbox ([^\\);]+)/i,/\\b(joli|palm)\\b ?(?:os)?\\/?([\\w\\.]*)/i,/(mint)[\\/\\(\\) ]?(\\w*)/i,/(mageia|vectorlinux)[; ]/i,/([kxln]?ubuntu|debian|suse|opensuse|gentoo|arch(?= linux)|slackware|fedora|mandriva|centos|pclinuxos|red ?hat|zenwalk|linpus|raspbian|plan 9|minix|risc os|contiki|deepin|manjaro|elementary os|sabayon|linspire)(?: gnu\\/linux)?(?: enterprise)?(?:[- ]linux)?(?:-gnu)?[-\\/ ]?(?!chrom|package)([-\\w\\.]*)/i,/(hurd|linux) ?([\\w\\.]*)/i,/(gnu) ?([\\w\\.]*)/i,/\\b([-frentopcghs]{0,5}bsd|dragonfly)[\\/ ]?(?!amd|[ix346]{1,2}86)([\\w\\.]*)/i,/(haiku) (\\w+)/i],[p,v],[/(sunos) ?([\\w\\.\\d]*)/i],[[p,"Solaris"],v],[/((?:open)?solaris)[-\\/ ]?([\\w\\.]*)/i,/(aix) ((\\d)(?=\\.|\\)| )[\\w\\.])*/i,/\\b(beos|os\\/2|amigaos|morphos|openvms|fuchsia|hp-ux|serenityos)/i,/(unix) ?([\\w\\.]*)/i],[p,v]]},Z=function(e,t){if(typeof e===c&&(t=e,e=a),!(this instanceof Z))return new Z(e,t).getResult();var n=typeof i!==s&&i.navigator?i.navigator:a,r=e||(n&&n.userAgent?n.userAgent:""),b=n&&n.userAgentData?n.userAgentData:a,y=t?function(e,t){var n={};for(var r in e)t[r]&&t[r].length%2==0?n[r]=t[r].concat(e[r]):n[r]=e[r];return n}(G,t):G,T=n&&n.userAgent==r;return this.getBrowser=function(){var e,t={};return t[p]=a,t[v]=a,V.call(t,r,y.browser),t[l]=typeof(e=t[v])===u?e.replace(/[^\\d\\.]/g,"").split(".")[0]:a,T&&n&&n.brave&&typeof n.brave.isBrave==o&&(t[p]="Brave"),t},this.getCPU=function(){var e={};return e[g]=a,V.call(e,r,y.cpu),e},this.getDevice=function(){var e={};return e[f]=a,e[d]=a,e[m]=a,V.call(e,r,y.device),T&&!e[m]&&b&&b.mobile&&(e[m]=h),T&&"Macintosh"==e[d]&&n&&typeof n.standalone!==s&&n.maxTouchPoints&&n.maxTouchPoints>2&&(e[d]="iPad",e[m]=w),e},this.getEngine=function(){var e={};return e[p]=a,e[v]=a,V.call(e,r,y.engine),e},this.getOS=function(){var e={};return e[p]=a,e[v]=a,V.call(e,r,y.os),T&&!e[p]&&b&&"Unknown"!=b.platform&&(e[p]=b.platform.replace(/chrome os/i,z).replace(/macos/i,K)),e},this.getResult=function(){return{ua:this.getUA(),browser:this.getBrowser(),engine:this.getEngine(),os:this.getOS(),device:this.getDevice(),cpu:this.getCPU()}},this.getUA=function(){return r},this.setUA=function(e){return r=typeof e===u&&e.length>350?H(e,350):e,this},this.setUA(r),this};Z.VERSION="1.0.35",Z.BROWSER=$([p,v,l]),Z.CPU=$([g]),Z.DEVICE=$([d,f,m,b,h,y,w,T,k]),Z.ENGINE=Z.OS=$([p,v]),typeof t!==s?(e.exports&&(t=e.exports=Z),t.UAParser=Z):n.amdO?(r=function(){return Z}.call(t,n,t,e))===a||(e.exports=r):typeof i!==s&&(i.UAParser=Z);var Y=typeof i!==s&&(i.jQuery||i.Zepto);if(Y&&!Y.ua){var ee=new Z;Y.ua=ee.getResult(),Y.ua.get=function(){return ee.getUA()},Y.ua.set=function(e){ee.setUA(e);var t=ee.getResult();for(var n in t)Y.ua[n]=t[n]}}}("object"==typeof window?window:this)}},t={};function n(r){var i=t[r];if(void 0!==i)return i.exports;var a=t[r]={exports:{}};return e[r].call(a.exports,a,a.exports,n),a.exports}n.amdO={},n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var r={};return(()=>{"use strict";n.r(r),n.d(r,{ActionType:()=>f,AmplitudePlatformName:()=>g,AnalyticsEventImportance:()=>l,AnalyticsQueries:()=>e,AuthStatus:()=>b,ComponentType:()=>m,IThresholdTier:()=>Jt,MetricType:()=>d,PlatformName:()=>v,SessionActions:()=>h,SessionAutomatedEvents:()=>w,SessionRank:()=>y,SubjectType:()=>p,UserTypeCommerce:()=>c,UserTypeInsto:()=>i,UserTypeRetail:()=>t,UserTypeRetailBusinessBanking:()=>s,UserTypeRetailEmployeeInternal:()=>a,UserTypeRetailEmployeePersonal:()=>o,UserTypeWallet:()=>u,automatedEvents:()=>xn,automatedMappingConfig:()=>In,clearMarkEntry:()=>Vn,clearPerformanceMarkEntries:()=>Xn,config:()=>A,createEventConfig:()=>On,createNewSpan:()=>Ln,createNewTrace:()=>Un,device:()=>W,endPerfMark:()=>Jn,exposeExperiment:()=>wn,flushQueue:()=>or,generateUUID:()=>V,getAnalyticsHeaders:()=>sr,getReferrerData:()=>le,getTracingHeaders:()=>An,getTracingId:()=>Dn,getUrlHostname:()=>pe,getUrlParams:()=>me,getUrlPathname:()=>fe,getUserContext:()=>ar,identify:()=>Tn,identifyFlow:()=>xe,identity:()=>H,identityFlow:()=>Se,incrementUjNavigation:()=>an,init:()=>yn,initNextJsTrackPageview:()=>_n,initTrackPageview:()=>kn,isEventKeyFormatValid:()=>we,isSessionEnded:()=>pt,location:()=>re,logEvent:()=>$t,logMetric:()=>Ht,logPageView:()=>on,logTrace:()=>Rn,markNTBT:()=>tn,markStep:()=>nn,markStepOnce:()=>rn,onVisibilityChange:()=>ln,optIn:()=>En,optOut:()=>Sn,perfMark:()=>Wn,persistentData:()=>oe,postMessage:()=>K,recordSessionDuration:()=>pn,removeFromIdentifyFlow:()=>Ee,savePersistentData:()=>st,sendScheduledEvents:()=>Bt,setBreadcrumbs:()=>ie,setConfig:()=>U,setLocation:()=>ae,setPagePath:()=>ve,setPageview:()=>Kt,setPersistentData:()=>se,setSessionStart:()=>dt,setTime:()=>Ue,startPerfMark:()=>Hn,timeStone:()=>Le,useEventLogger:()=>Yn,useLogEventOnMount:()=>tr,usePerformanceMarks:()=>rr});let e=function(e){return e.fbclid="fbclid",e.gclid="gclid",e.msclkid="msclkid",e.ptclid="ptclid",e.ttclid="ttclid",e.utm_source="utm_source",e.utm_medium="utm_medium",e.utm_campaign="utm_campaign",e.utm_term="utm_term",e.utm_content="utm_content",e}({});const t=0,i=1,a=2,o=3,s=4,c=5,u=6;let l=function(e){return e.low="low",e.high="high",e}({}),d=function(e){return e.count="count",e.rate="rate",e.gauge="gauge",e.distribution="distribution",e.histogram="histogram",e}({}),p=function(e){return e.commerce_merchant="commerce_merchant",e.device="device",e.edp_fingerprint_id="edp_fingerprint_id",e.nft_user="nft_user",e.user="user",e.wallet_user="wallet_user",e.uuid="user_uuid",e}({}),m=function(e){return e.unknown="unknown",e.banner="banner",e.button="button",e.card="card",e.chart="chart",e.content_script="content_script",e.dropdown="dropdown",e.link="link",e.page="page",e.modal="modal",e.table="table",e.search_bar="search_bar",e.service_worker="service_worker",e.text="text",e.text_input="text_input",e.tray="tray",e.checkbox="checkbox",e.icon="icon",e}({}),f=function(e){return e.unknown="unknown",e.blur="blur",e.click="click",e.change="change",e.dismiss="dismiss",e.focus="focus",e.hover="hover",e.select="select",e.measurement="measurement",e.move="move",e.process="process",e.render="render",e.scroll="scroll",e.view="view",e.search="search",e.keyPress="keyPress",e}({}),v=function(e){return e.unknown="unknown",e.web="web",e.android="android",e.ios="ios",e.mobile_web="mobile_web",e.tablet_web="tablet_web",e.server="server",e.windows="windows",e.macos="macos",e.extension="extension",e}({}),g=function(e){return e.web="Web",e.ios="iOS",e.android="Android",e}({}),b=function(e){return e[e.notLoggedIn=0]="notLoggedIn",e[e.loggedIn=1]="loggedIn",e}({}),h=function(e){return e.ac="ac",e.af="af",e.ah="ah",e.al="al",e.am="am",e.ar="ar",e.as="as",e}({}),w=function(e){return e.pv="pv",e}({}),y=function(e){return e.xs="xs",e.s="s",e.m="m",e.l="l",e.xl="xl",e.xxl="xxl",e}({});const T="https://analytics-service-dev.cbhq.net",k=3e5,_=5e3,S="analytics-db",E="experiment-exposure-db",x="Analytics SDK:",O=Object.values(e),j="pageview",N="session_duration",I={navigationTiming:{eventName:"perf_navigation_timing"},redirectTime:{eventName:"perf_redirect_time"},RT:{eventName:"perf_redirect_time"},TTFB:{eventName:"perf_time_to_first_byte"},networkInformation:{eventName:"perf_network_information"},storageEstimate:{eventName:"perf_storage_estimate"},FCP:{eventName:"perf_first_contentful_paint"},FID:{eventName:"perf_first_input_delay"},LCP:{eventName:"perf_largest_contentful_paint"},CLS:{eventName:"perf_cumulative_layout_shift"},TBT:{eventName:"perf_total_blocking_time"},NTBT:{eventName:"perf_navigation_total_blocking_time"},INP:{eventName:"perf_interact_to_next_paint"},ET:{eventName:"perf_element_timing"},userJourneyStep:{eventName:"perf_user_journey_step"}},P="1",M="web";function B(){return B=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},B.apply(this,arguments)}const C=/^(https?:\\/\\/)/;function D(e){return{eventsEndpoint:e+"/amp",metricsEndPoint:e+"/metrics",exposureEndpoint:e+"/track-exposures",tracesEndpoint:e+"/traces"}}const A=B({authCookie:"logged_in",amplitudeApiKey:"",batchEventsPeriod:_,batchEventsThreshold:30,batchMetricsPeriod:_,batchMetricsThreshold:30,batchTracesPeriod:_,batchTracesThreshold:30,headers:{},interactionManager:null,isAlwaysAuthed:!1,isProd:!1,isInternalApplication:!1,onError:(e,t)=>{console.error(x,e,t)},platform:v.unknown,projectName:"",ricTimeoutScheduleEvent:1e3,ricTimeoutSetDevice:500,showDebugLogging:!1,trackUserId:!1,version:null,apiEndpoint:T},D(T),{steps:{}}),L=[].reduce(((e,t)=>n=>e(t(n))),(e=>{if(!e.isProd)return e.isInternalApplication?(e.apiEndpoint="https://analytics-service-internal-dev.cbhq.net",B({},e,D(e.apiEndpoint))):e;const t=(e=>e.apiEndpoint?C.test(e.apiEndpoint)?e.apiEndpoint:`https://${e.apiEndpoint}`:e.isInternalApplication?"https://analytics-service-internal.cbhq.net":"https://as.coinbase.com")(e);return B({},e,{apiEndpoint:t},D(t))})),U=e=>{const{batchEventsThreshold:t,batchMetricsThreshold:n,batchTracesThreshold:r}=e,i=[t,n,r];for(const e of i)if((e||0)>30){console.warn("You are setting the threshhold for the batch limit to be greater than 30. This may cause request overload.");break}Object.assign(A,L(e))},R=[v.web,v.mobile_web,v.tablet_web];function q(){return"android"===A.platform}function F(){return"ios"===A.platform}function z(){return R.includes(A.platform)}function K(e){if(z()&&navigator&&"serviceWorker"in navigator&&navigator.serviceWorker.controller)try{navigator.serviceWorker.controller.postMessage(e)}catch(e){e instanceof Error&&A.onError(e)}}var $=n(353),Q=n.n($);const W={amplitudeOSName:null,amplitudeOSVersion:null,amplitudeDeviceModel:null,amplitudePlatform:null,browserName:null,browserMajor:null,osName:null,userAgent:null,width:null,height:null},H={countryCode:null,deviceId:null,device_os:null,isOptOut:!1,languageCode:null,locale:null,jwt:null,session_lcc_id:null,userAgent:null,userId:null},V=e=>e?(e^16*Math.random()>>e/4).toString(16):"10000000-1000-4000-8000-100000000000".replace(/[018]/g,V),J=()=>A.isAlwaysAuthed||!!H.userId,X=()=>{const e={};return H.countryCode&&(e.country_code=H.countryCode),e},G=()=>{const{platform:e}=A;if(e===v.web)switch(!0){case window.matchMedia("(max-width: 560px)").matches:return v.mobile_web;case window.matchMedia("(max-width: 1024px, min-width: 561px)").matches:return v.tablet_web}return e},Z=()=>{var e,t,n,r,i;z()?("requestIdleCallback"in window?window.requestIdleCallback(ne,{timeout:A.ricTimeoutSetDevice}):ne(),W.amplitudePlatform=g.web,W.userAgent=(null==(e=window)||null==(e=e.navigator)?void 0:e.userAgent)||null,ee({height:null!=(t=null==(n=window)?void 0:n.innerHeight)?t:null,width:null!=(r=null==(i=window)?void 0:i.innerWidth)?r:null})):F()?(W.amplitudePlatform=g.ios,W.userAgent=H.userAgent,W.userAgent&&ne()):q()&&(W.userAgent=H.userAgent,W.amplitudePlatform=g.android,W.userAgent&&ne())},Y=e=>{Object.assign(H,e),z()&&K({identity:{isAuthed:!!H.userId,locale:H.locale||null}})},ee=e=>{W.height=e.height,W.width=e.width},te=()=>{U({platform:G()}),z()&&K({config:{platform:A.platform}})},ne=()=>{var e;performance.mark&&performance.mark("ua_parser_start");const t=new(Q())(null!=(e=W.userAgent)?e:"").getResult();W.browserName=t.browser.name||null,W.browserMajor=t.browser.major||null,W.osName=t.os.name||null,W.amplitudeOSName=W.browserName,W.amplitudeOSVersion=W.browserMajor,W.amplitudeDeviceModel=W.osName,K({device:{browserName:W.browserName,osName:W.osName}}),performance.mark&&(performance.mark("ua_parser_end"),performance.measure("ua_parser","ua_parser_start","ua_parser_end"))},re={breadcrumbs:[],initialUAAData:{},pageKey:"",pageKeyRegex:{},pagePath:"",prevPageKey:"",prevPagePath:""};function ie(e){Object.assign(re,{breadcrumbs:e})}function ae(e){Object.assign(re,e)}const oe={eventId:0,sequenceNumber:0,sessionId:0,lastEventTime:0,sessionStart:0,sessionUUID:null,userId:null,ac:0,af:0,ah:0,al:0,am:0,ar:0,as:0,pv:0};function se(e){Object.assign(oe,e)}function ce(){var e,t;return null!=(e=null==(t=document)?void 0:t.referrer)?e:""}function ue(){return ue=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},ue.apply(this,arguments)}const le=()=>{const e=ce();if(!e)return{};const t=new URL(e);return t.hostname===pe()?{}:{referrer:e,referring_domain:t.hostname}},de=()=>{const e=new URLSearchParams(me()),t={};return O.forEach((n=>{e.has(n)&&(t[n]=(e.get(n)||"").toLowerCase())})),t},pe=()=>{var e;return(null==(e=window)||null==(e=e.location)?void 0:e.hostname)||""},me=()=>{var e;return(null==(e=window)||null==(e=e.location)?void 0:e.search)||""},fe=()=>{var e;return(null==(e=window)||null==(e=e.location)?void 0:e.pathname)||""},ve=()=>{const e=A.overrideWindowLocation?re.pagePath:fe()+me();e&&e!==re.pagePath&&(e!==re.pagePath&&ge(),re.pagePath=e,re.pageKeyRegex&&Object.keys(re.pageKeyRegex).some((e=>{if(re.pageKeyRegex[e].test(re.pagePath))return re.pageKey=e,!0})))},ge=()=>{if(z()){const e=ce();if(!re.prevPagePath&&e){const t=new URL(e);if(t.hostname===pe())return void(re.prevPagePath=t.pathname)}}re.prevPagePath=re.pagePath,re.prevPageKey=re.pageKey},be=e=>{z()&&Object.assign(e,z()?(Object.keys(re.initialUAAData).length>0||(new URLSearchParams(me()),re.initialUAAData=ue({},(()=>{const e={};return O.forEach((t=>{oe[t]&&(e[t]=oe[t])})),e})(),de(),le())),re.initialUAAData):re.initialUAAData)},he=/^[a-zd]+(_[a-zd]+)*$/;function we(e){return he.test(e)}function ye(){return ye=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},ye.apply(this,arguments)}const Te=["action","component_type","component_name","context","logging_id"],ke=["num_non_hardware_accounts","ujs"],_e="ujs_",Se={};function Ee(e){e.forEach((e=>{ke.includes(e)&&delete Se[e]}))}function xe(e){var t;const n=Object.entries(e).reduce(((e,t)=>{const[n,r]=t;return!Te.includes(n)&&ke.includes(n)?we(n)?ye({},e,{[n]:r}):(A.onError(new Error("IdentityFlow property names must have snake case format"),{[n]:r}),e):e}),{});null!=(t=n.ujs)&&t.length&&(n.ujs=n.ujs.map((e=>`${_e}${e}`))),Object.assign(Se,n)}function Oe(){return A.platform!==v.unknown||(A.onError(new Error("SDK platform not initialized")),!1)}const je={eventsQueue:[],eventsScheduled:!1,metricsQueue:[],metricsScheduled:!1,tracesQueue:[],tracesScheduled:!1};function Ne(e){Object.assign(je,e)}const Ie={ac:0,af:0,ah:0,al:0,am:0,ar:0,as:0,pv:0,sqs:0},Pe={ac:20,af:5,ah:1,al:1,am:0,ar:10,as:20},Me={pv:25},Be={xs:0,s:1,m:1,l:2,xl:2,xxl:2},Ce=e=>e<15?y.xs:e<60?y.s:e<240?y.m:e<960?y.l:e<3840?y.xl:y.xxl,De=e=>{Object.assign(Ie,e)};function Ae(){return(new Date).getTime()}const Le={timeStart:Ae(),timeOnPagePath:0,timeOnPageKey:0,prevTimeOnPagePath:0,prevTimeOnPageKey:0,sessionDuration:0,sessionEnd:0,sessionStart:0,prevSessionDuration:0};function Ue(e){Object.assign(Le,e)}const Re=(e,t)=>t.some((t=>e instanceof t));let qe,Fe;const ze=new WeakMap,Ke=new WeakMap,$e=new WeakMap,Qe=new WeakMap,We=new WeakMap;let He={get(e,t,n){if(e instanceof IDBTransaction){if("done"===t)return Ke.get(e);if("objectStoreNames"===t)return e.objectStoreNames||$e.get(e);if("store"===t)return n.objectStoreNames[1]?void 0:n.objectStore(n.objectStoreNames[0])}return Je(e[t])},set:(e,t,n)=>(e[t]=n,!0),has:(e,t)=>e instanceof IDBTransaction&&("done"===t||"store"===t)||t in e};function Ve(e){return"function"==typeof e?(t=e)!==IDBDatabase.prototype.transaction||"objectStoreNames"in IDBTransaction.prototype?(Fe||(Fe=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])).includes(t)?function(...e){return t.apply(Xe(this),e),Je(ze.get(this))}:function(...e){return Je(t.apply(Xe(this),e))}:function(e,...n){const r=t.call(Xe(this),e,...n);return $e.set(r,e.sort?e.sort():[e]),Je(r)}:(e instanceof IDBTransaction&&function(e){if(Ke.has(e))return;const t=new Promise(((t,n)=>{const r=()=>{e.removeEventListener("complete",i),e.removeEventListener("error",a),e.removeEventListener("abort",a)},i=()=>{t(),r()},a=()=>{n(e.error||new DOMException("AbortError","AbortError")),r()};e.addEventListener("complete",i),e.addEventListener("error",a),e.addEventListener("abort",a)}));Ke.set(e,t)}(e),Re(e,qe||(qe=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction]))?new Proxy(e,He):e);var t}function Je(e){if(e instanceof IDBRequest)return function(e){const t=new Promise(((t,n)=>{const r=()=>{e.removeEventListener("success",i),e.removeEventListener("error",a)},i=()=>{t(Je(e.result)),r()},a=()=>{n(e.error),r()};e.addEventListener("success",i),e.addEventListener("error",a)}));return t.then((t=>{t instanceof IDBCursor&&ze.set(t,e)})).catch((()=>{})),We.set(t,e),t}(e);if(Qe.has(e))return Qe.get(e);const t=Ve(e);return t!==e&&(Qe.set(e,t),We.set(t,e)),t}const Xe=e=>We.get(e),Ge=["get","getKey","getAll","getAllKeys","count"],Ze=["put","add","delete","clear"],Ye=new Map;function et(e,t){if(!(e instanceof IDBDatabase)||t in e||"string"!=typeof t)return;if(Ye.get(t))return Ye.get(t);const n=t.replace(/FromIndex$/,""),r=t!==n,i=Ze.includes(n);if(!(n in(r?IDBIndex:IDBObjectStore).prototype)||!i&&!Ge.includes(n))return;const a=async function(e,...t){const a=this.transaction(e,i?"readwrite":"readonly");let o=a.store;return r&&(o=o.index(t.shift())),(await Promise.all([o[n](...t),i&&a.done]))[0]};return Ye.set(t,a),a}var tt;tt=He,He={...tt,get:(e,t,n)=>et(e,t)||tt.get(e,t,n),has:(e,t)=>!!et(e,t)||tt.has(e,t)};const nt={isReady:!1,idbKeyval:null};function rt(e){Object.assign(nt,e)}const it={},at=async e=>{if(!nt.idbKeyval)return Promise.resolve(null);try{return await nt.idbKeyval.get(e)}catch(e){return A.onError(new Error("IndexedDB:Get:InternalError")),Promise.resolve(null)}},ot=async(e,t)=>{if(nt.idbKeyval)try{await nt.idbKeyval.set(e,t)}catch(e){A.onError(new Error("IndexedDB:Set:InternalError"))}},st=()=>{"server"!==A.platform&&(se({sessionStart:Le.sessionStart,ac:Ie.ac,af:Ie.af,ah:Ie.ah,al:Ie.al,am:Ie.am,ar:Ie.ar,as:Ie.as,pv:Ie.pv}),H.userId&&se({userId:H.userId}),ot(S,oe))},ct="rgb(5,177,105)",ut=e=>{const{metricName:t,data:n}=e,r=e.importance||l.low;if(!A.showDebugLogging||!console)return;const i=`%c ${x}`,a=`color:${ct};font-size:11px;`,o=`Importance: ${r}`;console.group(i,a,t,o),n.forEach((e=>{e.event_type?console.log(e.event_type,e):console.log(e)})),console.groupEnd()},lt=e=>{const{metricName:t,data:n}=e,r=e.importance||l.low;if(!A.showDebugLogging||!console)return;const i=`color:${ct};font-size:11px;`,a=`%c ${x}`,o=`Importance: ${r}`;console.log(a,i,t,n,o)},dt=()=>{const e=Ae();oe.sessionId&&oe.lastEventTime&&oe.sessionUUID&&!pt(e)||(oe.sessionId=e,oe.sessionUUID=V(),Ue({sessionStart:e}),lt({metricName:"Started new session:",data:{persistentData:oe,timeStone:Le}})),oe.lastEventTime=e},pt=e=>e-oe.lastEventTime>18e5;function mt(){return mt=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},mt.apply(this,arguments)}const ft=e=>{var t;(e=>{switch(e.action){case f.click:Ie.ac+=1;break;case f.focus:Ie.af+=1;break;case f.hover:Ie.ah+=1;break;case f.move:Ie.am+=1;break;case f.scroll:Ie.al+=1;break;case f.search:Ie.ar+=1;break;case f.select:Ie.as+=1}})(t=e),t.event_type!==j?t.event_type===N&&((e=>{if(!e.session_rank)return;const t=e.session_rank;Object.values(h).forEach((e=>{Ie.sqs+=Ie[e]*Pe[e]})),Object.values(w).forEach((e=>{Ie.sqs+=Ie[e]*Me[e]})),Ie.sqs*=Be[t]})(t),Object.assign(t,Ie),De({ac:0,af:0,ah:0,al:0,am:0,ar:0,as:0,pv:0,sqs:0})):Ie.pv+=1;const n=e.event_type;delete e.event_type;const r=e.deviceId?e.deviceId:null,i=e.timestamp;return delete e.timestamp,se({eventId:oe.eventId+1}),se({sequenceNumber:oe.sequenceNumber+1}),dt(),st(),{device_id:H.deviceId||r||null,user_id:H.userId,timestamp:i,event_id:oe.eventId,session_id:oe.sessionId||-1,event_type:n,version_name:A.version||null,platform:W.amplitudePlatform,os_name:W.amplitudeOSName,os_version:W.amplitudeOSVersion,device_model:W.amplitudeDeviceModel,language:H.languageCode,event_properties:mt({},e,{session_uuid:oe.sessionUUID,height:W.height,width:W.width}),user_properties:X(),uuid:V(),library:{name:"@cbhq/client-analytics",version:"10.6.0"},sequence_number:oe.sequenceNumber,user_agent:W.userAgent||H.userAgent}},vt=e=>e.map((e=>ft(e)));function gt(){return gt=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},gt.apply(this,arguments)}const bt=e=>e.map((e=>(e=>{const t=e.tags||{},n=gt({authed:J()?"true":"false",platform:A.platform},t,{project_name:A.projectName,version_name:A.version||null});return{metric_name:e.metricName,page_path:e.pagePath||null,value:e.value,tags:n,type:e.metricType}})(e))),ht=e=>0!==je.metricsQueue.length&&(je.metricsQueue.length>=A.batchMetricsThreshold||(je.metricsScheduled||(je.metricsScheduled=!0,setTimeout((()=>{je.metricsScheduled=!1,e(bt(je.metricsQueue)),je.metricsQueue=[]}),A.batchMetricsPeriod)),!1)),wt=e=>0!==je.tracesQueue.length&&(je.tracesQueue.length>=A.batchTracesThreshold||(je.tracesScheduled||(je.tracesScheduled=!0,setTimeout((()=>{je.tracesScheduled=!1,e(je.tracesQueue),je.tracesQueue=[]}),A.batchTracesPeriod)),!1)),yt=e=>{var t;z()&&null!=(t=window)&&t.requestIdleCallback?window.requestIdleCallback(e,{timeout:A.ricTimeoutScheduleEvent}):(q()||F())&&A.interactionManager?A.interactionManager.runAfterInteractions(e):e()};function Tt(){return Tt=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Tt.apply(this,arguments)}const kt="application/x-www-form-urlencoded; charset=UTF-8",_t=e=>{const{data:t,importance:n,isJSON:r,onError:i,url:a}=e,o=r?"application/json":kt,s=n||l.low,c=r?JSON.stringify(t):new URLSearchParams(t).toString();function u(){const e=new XMLHttpRequest;e.open("POST",a,!0),Object.keys(A.headers||{}).forEach((t=>{e.setRequestHeader(t,A.headers[t])})),e.setRequestHeader("Content-Type",kt),H.jwt&&e.setRequestHeader("authorization",`Bearer ${H.jwt}`),e.send(c)}if(!z()||r||!("sendBeacon"in navigator)||s!==l.low||A.headers&&0!==Object.keys(A.headers).length)if(z()&&!r)u();else{const e=Tt({},A.headers,{"Content-Type":o});H.jwt&&(e.Authorization=`Bearer ${H.jwt}`),fetch(a,{method:"POST",mode:"no-cors",headers:e,body:c}).catch((e=>{i(e,{context:"AnalyticsSDKApiError"})}))}else{const e=new Blob([c],{type:kt});try{navigator.sendBeacon.bind(navigator)(a,e)||u()}catch(e){console.error(e),u()}}};var St=n(762),Et=n.n(St);const xt=(e,t,n)=>{const r=e||"";return Et()("2"+r+t+n)};function Ot(){return Ot=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Ot.apply(this,arguments)}class jt extends Error{constructor(e){super(e),this.name="CircularJsonReference",this.message=e,"function"==typeof Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error(e).stack}}class Nt extends jt{constructor(...e){super(...e),this.name="DomReferenceInAnalyticsEvent"}}function It(){return It=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},It.apply(this,arguments)}const Pt=(e,t=l.low)=>{var n;e&&je.eventsQueue.push(e),nt.isReady&&(!A.trackUserId||H.userId?(t===l.high||(n=Mt,0!==je.eventsQueue.length&&(je.eventsQueue.length>=A.batchEventsThreshold||(je.eventsScheduled||(je.eventsScheduled=!0,setTimeout((()=>{je.eventsScheduled=!1,n(vt(je.eventsQueue)),je.eventsQueue=[]}),A.batchEventsPeriod)),0))))&&Bt():je.eventsQueue.length>10&&(A.trackUserId=!1,A.onError(new Error("userId not set in Logged-in"))))},Mt=(e,t=l.low)=>{if(H.isOptOut||0===e.length)return;let n;try{n=JSON.stringify(e)}catch(t){const r=e.map((e=>e.event_type)).join(", "),[i,a]=(e=>{try{const n=[];for(const r of e){const e=Ot({},r);r.event_properties&&(e.event_properties=Ot({},e.event_properties,{currentTarget:null,target:null,relatedTarget:null,_dispatchInstances:null,_targetInst:null,view:(t=r.event_properties.view,["string","number","boolean"].includes(typeof t)?r.event_properties.view:null)})),n.push(e)}return[!0,JSON.stringify(n)]}catch(e){return[!1,""]}var t})(e);if(!i)return void A.onError(new jt(t instanceof Error?t.message:"unknown"),{listEventType:r});n=a,A.onError(new Nt("Found DOM element reference"),{listEventType:r,stringifiedEventData:n})}const r=Ae().toString(),i=It({},{e:n,v:"2",upload_time:r},{client:A.amplitudeApiKey,checksum:xt(A.amplitudeApiKey,n,r)});_t({url:A.eventsEndpoint,data:i,importance:t,onError:A.onError}),ut({metricName:"Batch Events",data:e,importance:t})},Bt=()=>{Mt(vt(je.eventsQueue)),Ne({eventsQueue:[]})};function Ct(){return Ct=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Ct.apply(this,arguments)}const Dt=Object.values(f),At=Object.values(m),Lt=e=>Dt.includes(e)?e:f.unknown,Ut=e=>At.includes(e)?e:m.unknown,Rt=(e,t,n)=>{const r={auth:J()?b.loggedIn:b.notLoggedIn,action:Lt(e),component_type:Ut(t),logging_id:n,platform:A.platform,project_name:A.projectName};return"number"==typeof H.userTypeEnum&&(r.user_type_enum=H.userTypeEnum),r},qt=e=>{const t=Ae();if(!e)return A.onError(new Error("missing logData")),Ct({},Rt(f.unknown,m.unknown),{locale:H.locale,session_lcc_id:H.session_lcc_id,timestamp:t,time_start:Le.timeStart});const n=Ct({},e,Rt(e.action,e.componentType,e.loggingId),{locale:H.locale,session_lcc_id:H.session_lcc_id,timestamp:t,time_start:Le.timeStart});return delete n.componentType,delete n.loggingId,n},Ft={blacklistRegex:[],isEnabled:!1};function zt(){return{page_key:re.pageKey,page_path:re.pagePath,prev_page_key:re.prevPageKey,prev_page_path:re.prevPagePath}}function Kt(e){Object.assign(Ft,e)}function $t(e,t,n=l.low){if(H.isOptOut)return;if(!Oe())return;const r=qt(t);!function(e){Ft.isEnabled&&(ve(),Object.assign(e,zt()))}(r),be(r),function(e){Object.keys(Se).length>0&&Object.assign(e,Se)}(r),r.has_double_fired=!1,r.event_type=e,n===l.high?Pt(r,n):yt((()=>{Pt(r)}))}function Qt(e,t=!1){t?_t({url:A.metricsEndPoint,data:{metrics:e},isJSON:!0,onError:A.onError}):yt((()=>{_t({url:A.metricsEndPoint,data:{metrics:e},isJSON:!0,onError:A.onError})})),ut({metricName:"Batch Metrics",data:e})}function Wt(){return Wt=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Wt.apply(this,arguments)}function Ht(e){if(!Oe())return;v.server!==A.platform&&!e.pagePath&&re.pagePath&&(e.pagePath=re.pagePath);const t=Object.keys(Se).length?Wt({},e.tags,Se):e.tags;t&&Object.assign(e,{tags:t}),je.metricsQueue.push(e),ht(Qt)&&(Qt(bt(je.metricsQueue)),je.metricsQueue=[])}function Vt(){return Vt=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Vt.apply(this,arguments)}let Jt=function(e){return e.instant="instant",e.quick="quick",e.moderate="moderate",e.slow="slow",e.unavoidable="unavoidable",e}({});function Xt(e){return e.toLowerCase()}let Gt={};const Zt=(e,t)=>{null!=A&&A.onMarkStep&&A.onMarkStep(e,t),xe({ujs:t})};let Yt;const en={Perfume:()=>{},markStep:e=>{},markStepOnce:e=>{},incrementUjNavigation:()=>{}},tn=()=>{z()&&Yt&&Yt.markNTBT&&Yt.markNTBT()},nn=e=>{z()&&Yt&&en.markStep&&en.markStep(e)},rn=e=>{z()&&Yt&&en.markStepOnce&&en.markStepOnce(e)},an=()=>{z()&&Yt&&en.incrementUjNavigation&&en.incrementUjNavigation()};function on(e={callMarkNTBT:!0}){"unknown"!==A.platform&&(Ft.blacklistRegex.some((e=>e.test(fe())))||($t(j,{action:f.render,componentType:m.page}),e.callMarkNTBT&&tn()))}let sn=!1,cn=!1;const un=e=>{sn=!e.persisted},ln=(e,t="hidden",n=!1)=>{cn||(addEventListener("pagehide",un),addEventListener("beforeunload",(()=>{})),cn=!0),addEventListener("visibilitychange",(({timeStamp:n})=>{document.visibilityState===t&&e({timeStamp:n,isUnloading:sn})}),{capture:!0,once:n})},dn=36e3;function pn(){const e=pt(Ae());if(e&&(O.forEach((e=>{oe[e]&&delete oe[e]})),st()),!oe.lastEventTime||!Le.sessionStart||!e)return;const t=Math.round((oe.lastEventTime-Le.sessionStart)/1e3);if(t<1||t>dn)return;const n=Ce(t);$t(N,{action:f.measurement,componentType:m.page,session_duration:t,session_end:oe.lastEventTime,session_start:Le.sessionStart,session_rank:n})}function mn(){return mn=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},mn.apply(this,arguments)}const fn=[],vn=[],gn=()=>{const e=fn.shift();e&&e()},bn=()=>{const e=vn.shift();e&&e()};let hn={};function wn(e){const t=function(e){return{test_name:e.testName,group_name:e.group,subject_id:e.subjectId,exposed_at:Ae(),subject_type:e.subjectType,platform:A.platform}}(e);hn[e.testName]=hn[e.testName]||0,hn[e.testName]+k>Ae()?lt({metricName:`Event: exposeExperiment ${e.testName} not sent`,data:t}):(hn[e.testName]=Ae(),ot(E,hn),lt({metricName:`Event: exposeExperiment ${e.testName} sent`,data:t}),_t({url:A.exposureEndpoint,data:[t],onError:(t,n)=>{hn[e.testName]=0,ot(E,hn),A.onError(t,n)},isJSON:!0,importance:l.high}))}const yn=e=>{var t,r,i;U(e),z()&&(H.languageCode=(null==(t=navigator)?void 0:t.languages[0])||(null==(r=navigator)?void 0:r.language)||""),te(),(()=>{var e;if(z()&&null!=(e=window)&&e.indexedDB){const e=function(e,t,{blocked:n,upgrade:r,blocking:i,terminated:a}={}){const o=indexedDB.open(e,t),s=Je(o);return r&&o.addEventListener("upgradeneeded",(e=>{r(Je(o.result),e.oldVersion,e.newVersion,Je(o.transaction),e)})),n&&o.addEventListener("blocked",(e=>n(e.oldVersion,e.newVersion,e))),s.then((e=>{a&&e.addEventListener("close",(()=>a())),i&&e.addEventListener("versionchange",(e=>i(e.oldVersion,e.newVersion,e)))})).catch((()=>{})),s}("keyval-store",1,{upgrade(e){e.createObjectStore("keyval")}});rt({idbKeyval:{get:async t=>(await e).get("keyval",t),set:async(t,n)=>(await e).put("keyval",n,t),delete:async t=>(await e).delete("keyval",t),keys:async()=>(await e).getAllKeys("keyval")}})}else rt({idbKeyval:{get:async e=>new Promise((t=>{t(it[e])})),set:async(e,t)=>new Promise((n=>{it[e]=t,n(e)})),delete:async e=>new Promise((()=>{delete it[e]})),keys:async()=>new Promise((e=>{e(Object.keys(it))}))}})})(),lt({metricName:"Initialized Analytics:",data:{deviceId:H.deviceId}}),fn.push((()=>{Pt()})),(async()=>{const e=await at(S);rt({isReady:!0}),gn(),e&&(bn(),se({eventId:e.eventId||oe.eventId,sequenceNumber:e.sequenceNumber||oe.sequenceNumber,sessionId:e.sessionId||oe.sessionId,lastEventTime:e.lastEventTime||oe.lastEventTime,sessionUUID:e.sessionUUID||oe.sessionUUID}),function(e){se(mn({},function(e){const t={};return O.forEach((n=>{e[n]&&(t[n]=e[n])})),t}(e),de()))}(e),Ue({sessionStart:e.sessionStart||oe.sessionStart}),De({ac:e.ac||Ie.ac,af:e.af||Ie.af,ah:e.ah||Ie.ah,al:e.al||Ie.al,am:e.am||Ie.am,ar:e.ar||Ie.ar,as:e.as||Ie.as,pv:e.pv||Ie.pv}),A.trackUserId&&Y({userId:e.userId||H.userId}),pn(),lt({metricName:"Initialized Analytics IndexedDB:",data:e}))})(),async function(){at(E).then((e=>{hn=null!=e?e:{}})).catch((e=>{e instanceof Error&&A.onError(e)}))}(),Z(),z()&&(ln((()=>{se({lastEventTime:Ae()}),st(),Bt()}),"hidden"),ln((()=>{pn()}),"visible")),z()&&(i=()=>{var e,t,n,r;te(),ee({width:null!=(e=null==(t=window)?void 0:t.innerWidth)?e:null,height:null!=(n=null==(r=window)?void 0:r.innerHeight)?n:null})},addEventListener("resize",(()=>{requestAnimationFrame((()=>{i()}))}))),(()=>{if(z())try{const e=n(2);en.markStep=e.markStep,en.markStepOnce=e.markStepOnce,en.incrementUjNavigation=e.incrementUjNavigation,Yt=new e.Perfume({analyticsTracker:e=>{const{data:t,attribution:n,metricName:r,navigatorInformation:i,rating:a}=e,o=I[r],s=(null==n?void 0:n.category)||null;if(!o&&!s)return;const c=(null==i?void 0:i.deviceMemory)||0,u=(null==i?void 0:i.hardwareConcurrency)||0,l=(null==i?void 0:i.isLowEndDevice)||!1,p=(null==i?void 0:i.isLowEndExperience)||!1,v=(null==i?void 0:i.serviceWorkerStatus)||"unsupported",g=Vt({deviceMemory:c,hardwareConcurrency:u,isLowEndDevice:l,isLowEndExperience:p,serviceWorkerStatus:v},Gt),b={is_low_end_device:l,is_low_end_experience:p,page_key:re.pageKey||"",save_data:t.saveData||!1,service_worker:v,is_perf_metric:!0};if("navigationTiming"===r)t&&"number"==typeof t.redirectTime&&Ht({metricName:I.redirectTime.eventName,metricType:d.histogram,tags:b,value:t.redirectTime||0});else if("TTFB"===r)$t(o.eventName,Vt({action:f.measurement,componentType:m.page,duration:t||null,vitalsScore:a||null},g)),Ht({metricName:I.TTFB.eventName,metricType:d.histogram,tags:Vt({},b),value:t}),a&&Ht({metricName:`perf_web_vitals_ttfb_${a}`,metricType:d.count,tags:b,value:1});else if("networkInformation"===r)null!=t&&t.effectiveType&&(Gt=t,$t(o.eventName,{action:f.measurement,componentType:m.page,networkInformationDownlink:t.downlink,networkInformationEffectiveType:t.effectiveType,networkInformationRtt:t.rtt,networkInformationSaveData:t.saveData,navigatorDeviceMemory:c,navigatorHardwareConcurrency:u}));else if("storageEstimate"===r)$t(o.eventName,Vt({action:f.measurement,componentType:m.page},t,g)),Ht({metricName:"perf_storage_estimate_caches",metricType:d.histogram,tags:b,value:t.caches}),Ht({metricName:"perf_storage_estimate_indexed_db",metricType:d.histogram,tags:b,value:t.indexedDB});else if("CLS"===r)$t(o.eventName,Vt({action:f.measurement,componentType:m.page,score:100*t||null,vitalsScore:a||null},g)),a&&Ht({metricName:`perf_web_vitals_cls_${a}`,metricType:d.count,tags:b,value:1});else if("FID"===r){const e=(null==n?void 0:n.performanceEntry)||null,r=parseInt((null==e?void 0:e.processingStart)||"");$t(o.eventName,Vt({action:f.measurement,componentType:m.page,duration:t||null,processingStart:null!=e&&e.processingStart?r:null,startTime:null!=e&&e.startTime?parseInt(e.startTime):null,vitalsScore:a||null},g)),a&&Ht({metricName:`perf_web_vitals_fidVitals_${a}`,metricType:d.count,tags:b,value:1})}else"userJourneyStep"===r?($t("perf_user_journey_step",Vt({action:f.measurement,componentType:m.page,duration:t||null,rating:null!=a?a:null,step_name:(null==n?void 0:n.stepName)||""},g)),Ht({metricName:`user_journey_step.${A.projectName}.${A.platform}.${(null==n?void 0:n.stepName)||""}_vitals_${a}`,metricType:d.count,tags:b,value:1}),Ht({metricName:`user_journey_step.${A.projectName}.${A.platform}.${(null==n?void 0:n.stepName)||""}`,metricType:d.distribution,tags:b,value:t||null})):I[r]&&t&&($t(o.eventName,Vt({action:f.measurement,componentType:m.page,duration:t||null,vitalsScore:a||null},g)),a&&(Ht({metricName:`perf_web_vitals_${Xt(r)}_${a}`,metricType:d.count,tags:b,value:1}),"LCP"===r&&Ht({metricName:`perf_web_vitals_${Xt(r)}`,metricType:d.distribution,tags:b,value:t})))},maxMeasureTime:3e4,steps:A.steps,onMarkStep:Zt})}catch(e){e instanceof Error&&A.onError(e)}})()},Tn=e=>{Y(e),e.userAgent&&Z(),lt({metricName:"Identify:",data:{countryCode:H.countryCode,deviceId:H.deviceId,userId:H.userId}})},kn=({blacklistRegex:e,pageKeyRegex:t,browserHistory:n})=>{Kt({blacklistRegex:e||[],isEnabled:!0}),ae({pageKeyRegex:t}),on({callMarkNTBT:!1}),n.listen((()=>{on()}))},_n=({blacklistRegex:e,pageKeyRegex:t,nextJsRouter:n})=>{Kt({blacklistRegex:e||[],isEnabled:!0}),ae({pageKeyRegex:t}),on({callMarkNTBT:!1}),n.events.on("routeChangeComplete",(()=>{on()}))},Sn=()=>{Y({isOptOut:!0}),ot(S,{})},En=()=>{Y({isOptOut:!1})},xn={Button:{label:"cb_button",uuid:"e921a074-40e6-4371-8700-134d5cd633e6",componentType:m.button}};function On(e,t,n){return{componentName:e,actions:t,data:n}}function jn(){return jn=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},jn.apply(this,arguments)}function Nn(e,t,n){const{componentName:r,data:i}=n;$t(e.label,jn({componentType:e.componentType,action:t,loggingId:e.uuid,component_name:r},i))}const In={actionMapping:{onPress:f.click,onHover:f.hover},handlers:{Button:{[f.click]:e=>Nn(xn.Button,f.click,e),[f.hover]:e=>Nn(xn.Button,f.hover,e)}}};function Pn(e,t=!1){t?_t({url:A.tracesEndpoint,data:{traces:e},isJSON:!0,onError:A.onError}):yt((()=>{_t({url:A.tracesEndpoint,data:{traces:e},isJSON:!0,onError:A.onError})})),ut({metricName:"Batch Traces",data:e})}function Mn(){return Mn=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Mn.apply(this,arguments)}const Bn=1e6;function Cn(e){return e*Bn}function Dn(e=function(){var e;return null==(e=window)?void 0:e.crypto}()){const t=new Uint32Array(2);return null==e||e.getRandomValues(t),((BigInt(t[0])<<BigInt(32))+BigInt(t[1])).toString()}function An(e,t){return{"x-datadog-origin":"rum","x-datadog-parent-id":t,"x-datadog-sampling-priority":"1","x-datadog-trace-id":e}}function Ln(e){var t;const{name:n,traceId:r,spanId:i,start:a,duration:o,resource:s,meta:c}=e;return{duration:o?Cn(o):0,name:n,resource:s,service:A.projectName,span_id:null!=i?i:Dn(),start:a?Cn(a):0,trace_id:null!=r?r:Dn(),parent_id:P,type:M,meta:Mn({platform:A.platform},re.pageKey?{page_key:re.pageKey}:{},null!=(t=Se.ujs)&&t.length?{last_ujs:Se.ujs[Se.ujs.length-1]}:{},null!=c?c:{})}}function Un(e){return[Ln(e)]}function Rn(e,t){Oe()&&function(e){return e.length>0}(e)&&(t&&function(e,t){e.forEach((e=>function(e,t){const n=Mn({},e.meta,t.meta),r={start:t.start?Cn(t.start):e.start,duration:t.duration?Cn(t.duration):e.duration};Object.assign(e,t,Mn({meta:n},r))}(e,t)))}(e,t),je.tracesQueue.push(e),wt(Pn)&&(Pn(je.tracesQueue),je.tracesQueue=[]))}function qn(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}function Fn(){return Fn=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Fn.apply(this,arguments)}function zn(){return void 0!==typeof window&&"performance"in window&&"mark"in performance&&"getEntriesByName"in performance}function Kn(e,t){return`perf_${e}${null!=t&&t.label?`_${t.label}`:""}`}function $n(e,t,n){return`${Kn(e,n)}__${t}`}let Qn={};function Wn(e,t,n){if(!zn())return;const r=$n(e,t,n);if(performance.mark(r),"end"===t){const t=Kn(e,n);!function(e,t,n){try{performance.measure(e,t,n)}catch(e){A.onError(e)}}(t,$n(e,"start",n),r);const i=performance.getEntriesByName(t).pop();i&&Ht(Fn({metricName:e,metricType:d.distribution,value:i.duration},null!=n&&n.tags?{tags:n.tags}:{}))}}function Hn(e,t){if(!zn())return;const n=$n(e,"start",t);Qn[n]||(Wn(e,"start",t),Qn[n]=!0)}function Vn(e,t){const n=$n(e,"start",t),r=function(e,t){if(null==e)return{};var n,r,i={},a=Object.keys(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)>=0||(i[n]=e[n]);return i}(Qn,[n].map(qn));Qn=r}function Jn(e,t){if(!zn())return;const n=$n(e,"start",t);Qn[n]&&(Wn(e,"end",t),Vn(e,t))}function Xn(){zn()&&(performance.clearMarks(),Qn={})}var Gn=n(784);function Zn(){return Zn=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Zn.apply(this,arguments)}function Yn(e,t,n=l.low){const r=(0,Gn.useRef)(t);return(0,Gn.useEffect)((()=>{r.current=t}),[t]),(0,Gn.useCallback)((t=>{$t(e,Zn({},r.current,t),n)}),[e,n])}function er(){return er=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},er.apply(this,arguments)}function tr(e,t,n=l.low){(0,Gn.useEffect)((()=>{const r=er({},t,{action:f.render});$t(e,r,n)}),[])}function nr(){return nr=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},nr.apply(this,arguments)}const rr=function(e,t){return{markStartPerf:(0,Gn.useCallback)((()=>Hn(e,t)),[e,t]),markEndPerf:(0,Gn.useCallback)((n=>Jn(e,nr({},t,n))),[e,t])}};function ir(){return ir=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},ir.apply(this,arguments)}function ar(){return Object.entries(ir({},Se,zt(),{sessionUUID:oe.sessionUUID,userId:oe.userId})).reduce(((e,t)=>{return null!=(n=t[1])&&""!==n?ir({},e,{[t[0]]:t[1]}):e;var n}),{})}async function or(){return new Promise((e=>{Mt(vt(je.eventsQueue)),Qt(bt(je.metricsQueue),!0),Pn(je.tracesQueue,!0),Ne({eventsQueue:[],metricsQueue:[],tracesQueue:[]}),e()}))}function sr(){return{"X-CB-Device-ID":H.deviceId||"unknown","X-CB-Is-Logged-In":H.userId?"true":"false","X-CB-Pagekey":re.pageKey||"unknown","X-CB-UJS":(e=Se.ujs,void 0===e||0===e.length?"":e.join(",")),"X-CB-Platform":A.platform||"unknown","X-CB-Project-Name":A.projectName||"unknown","X-CB-Session-UUID":oe.sessionUUID||"unknown","X-CB-Version-Name":A.version?String(A.version):"unknown"};var e}})(),r})()}));',IF=()=>new Promise((e,t)=>{if(window.ClientAnalytics)return e();try{const n=document.createElement("script");n.textContent=AF,n.type="text/javascript",document.head.appendChild(n),CF(),document.head.removeChild(n),e()}catch{console.error("Failed to execute inlined telemetry script"),t()}}),CF=()=>{var e,t,n;if(typeof window<"u"){const r=(n=(e=ge.config.get().deviceId)!==null&&e!==void 0?e:(t=window.crypto)===null||t===void 0?void 0:t.randomUUID())!==null&&n!==void 0?n:"";if(window.ClientAnalytics){const{init:i,identify:s,PlatformName:o}=window.ClientAnalytics;i({isProd:!0,amplitudeApiKey:"c66737ad47ec354ced777935b0af822e",platform:o.web,projectName:"base_account_sdk",showDebugLogging:!1,version:"1.0.0",apiEndpoint:"https://cca-lite.coinbase.com"}),s({deviceId:r}),ge.config.set({deviceId:r})}}},qt={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}},Ty={"-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."}},xx="Unspecified error message.",PF="Unspecified server error.";function Oy(e,t=xx){if(e&&Number.isInteger(e)){const n=e.toString();if(My(Ty,n))return Ty[n].message;if(Sx(e))return PF}return t}function RF(e){if(!Number.isInteger(e))return!1;const t=e.toString();return!!(Ty[t]||Sx(e))}function TF(e,{shouldIncludeStack:t=!1}={}){const n={};if(e&&typeof e=="object"&&!Array.isArray(e)&&My(e,"code")&&RF(e.code)){const r=e;n.code=r.code,r.message&&typeof r.message=="string"?(n.message=r.message,My(r,"data")&&(n.data=r.data)):(n.message=Oy(n.code),n.data={originalError:kx(e)})}else n.code=qt.rpc.internal,n.message=Ax(e,"message")?e.message:xx,n.data={originalError:kx(e)};return t&&(n.stack=Ax(e,"stack")?e.stack:void 0),n}function Sx(e){return e>=-32099&&e<=-32e3}function kx(e){return e&&typeof e=="object"&&!Array.isArray(e)?Object.assign({},e):e}function My(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function Ax(e,t){return typeof e=="object"&&e!==null&&t in e&&typeof e[t]=="string"}const he={rpc:{parse:e=>mr(qt.rpc.parse,e),invalidRequest:e=>mr(qt.rpc.invalidRequest,e),invalidParams:e=>mr(qt.rpc.invalidParams,e),methodNotFound:e=>mr(qt.rpc.methodNotFound,e),internal:e=>mr(qt.rpc.internal,e),server:e=>{if(!e||typeof e!="object"||Array.isArray(e))throw new Error("Ethereum RPC Server errors must provide single object argument.");const{code:t}=e;if(!Number.isInteger(t)||t>-32005||t<-32099)throw new Error('"code" must be an integer such that: -32099 <= code <= -32005');return mr(t,e)},invalidInput:e=>mr(qt.rpc.invalidInput,e),resourceNotFound:e=>mr(qt.rpc.resourceNotFound,e),resourceUnavailable:e=>mr(qt.rpc.resourceUnavailable,e),transactionRejected:e=>mr(qt.rpc.transactionRejected,e),methodNotSupported:e=>mr(qt.rpc.methodNotSupported,e),limitExceeded:e=>mr(qt.rpc.limitExceeded,e)},provider:{userRejectedRequest:e=>Fa(qt.provider.userRejectedRequest,e),unauthorized:e=>Fa(qt.provider.unauthorized,e),unsupportedMethod:e=>Fa(qt.provider.unsupportedMethod,e),disconnected:e=>Fa(qt.provider.disconnected,e),chainDisconnected:e=>Fa(qt.provider.chainDisconnected,e),unsupportedChain:e=>Fa(qt.provider.unsupportedChain,e),custom:e=>{if(!e||typeof e!="object"||Array.isArray(e))throw new Error("Ethereum Provider custom errors must provide single object argument.");const{code:t,message:n,data:r}=e;if(!n||typeof n!="string")throw new Error('"message" must be a nonempty string');return new Cx(t,n,r)}}};function mr(e,t){const[n,r]=Ix(t);return new By(e,n||Oy(e),r)}function Fa(e,t){const[n,r]=Ix(t);return new Cx(e,n||Oy(e),r)}function Ix(e){if(e){if(typeof e=="string")return[e];if(typeof e=="object"&&!Array.isArray(e)){const{message:t,data:n}=e;if(t&&typeof t!="string")throw new Error("Must specify string message.");return[t||void 0,n]}}return[]}let By=class extends Error{constructor(t,n,r){if(!Number.isInteger(t))throw new Error('"code" must be an integer.');if(!n||typeof n!="string")throw new Error('"message" must be a nonempty string.');super(n),this.code=t,r!==void 0&&(this.data=r)}},Cx=class extends By{constructor(t,n,r){if(!OF(t))throw new Error('"code" must be an integer such that: 1000 <= code <= 4999');super(t,n,r)}};function OF(e){return Number.isInteger(e)&&e>=1e3&&e<=4999}function Px(e){return typeof e=="object"&&e!==null&&"code"in e&&"data"in e&&e.code===-32090&&typeof e.data=="object"&&e.data!==null&&"type"in e.data&&e.data.type==="INSUFFICIENT_FUNDS"}function Rx(e){return typeof e=="object"&&e!==null&&"details"in e}function MF(e){try{const t=JSON.parse(e.details);return new By(t.code,t.message,t.data)}catch{return null}}function Tx(){return e=>e}const zu=Tx(),BF=Tx();function Ni(e){return Math.floor(e)}const Ox=/^[0-9]*$/,Mx=/^[a-f0-9]*$/;function yo(e){return Ny(crypto.getRandomValues(new Uint8Array(e)))}function Ny(e){return[...e].map(t=>t.toString(16).padStart(2,"0")).join("")}function qf(e){return new Uint8Array(e.match(/.{1,2}/g).map(t=>Number.parseInt(t,16)))}function Wu(e,t=!1){const n=e.toString("hex");return zu(t?`0x${n}`:n)}function Ly(e){return Wu(Dy(e),!0)}function Jr(e){return BF(e.toString(10))}function Da(e){return zu(`0x${BigInt(e).toString(16)}`)}function Bx(e){return e.startsWith("0x")||e.startsWith("0X")}function jy(e){return Bx(e)?e.slice(2):e}function Nx(e){return Bx(e)?`0x${e.slice(2)}`:`0x${e}`}function Vf(e){if(typeof e!="string")return!1;const t=jy(e).toLowerCase();return Mx.test(t)}function $y(e,t=!1){if(typeof e=="string"){const n=jy(e).toLowerCase();if(Mx.test(n))return zu(t?`0x${n}`:n)}throw he.rpc.invalidParams(`"${String(e)}" is not a hexadecimal string`)}function Fy(e,t=!1){let n=$y(e,!1);return n.length%2===1&&(n=zu(`0${n}`)),t?zu(`0x${n}`):n}function bs(e){if(typeof e=="string"){const t=jy(e).toLowerCase();if(Vf(t)&&t.length===40)return Nx(t)}throw he.rpc.invalidParams(`Invalid Ethereum address: ${String(e)}`)}function Dy(e){if(Buffer.isBuffer(e))return e;if(typeof e=="string"){if(Vf(e)){const t=Fy(e,!1);return Buffer.from(t,"hex")}return Buffer.from(e,"utf8")}throw he.rpc.invalidParams(`Not binary data: ${String(e)}`)}function Gu(e){if(typeof e=="number"&&Number.isInteger(e))return Ni(e);if(typeof e=="string"){if(Ox.test(e))return Ni(Number(e));if(Vf(e))return Ni(Number(BigInt(Fy(e,!0))))}throw he.rpc.invalidParams(`Not an integer: ${String(e)}`)}function qu(e){if(e!==null&&(typeof e=="bigint"||LF(e)))return BigInt(e.toString(10));if(typeof e=="number")return BigInt(Gu(e));if(typeof e=="string"){if(Ox.test(e))return BigInt(e);if(Vf(e))return BigInt(Fy(e,!0))}throw he.rpc.invalidParams(`Not an integer: ${String(e)}`)}function NF(e){if(typeof e=="string")return JSON.parse(e);if(typeof e=="object")return e;throw he.rpc.invalidParams(`Not a JSON string or an object: ${String(e)}`)}function LF(e){if(e==null||typeof e.constructor!="function")return!1;const{constructor:t}=e;return typeof t.config=="function"&&typeof t.EUCLID=="number"}const jF=`Coinbase Wallet SDK requires the Cross-Origin-Opener-Policy header to not be set to 'same-origin'. This is to ensure that the SDK can communicate with the Coinbase Smart Wallet app.
119
+
120
+ Please see https://www.smartwallet.dev/guides/tips/popup-tips#cross-origin-opener-policy for more information.`,$F=()=>{let e;return{getCrossOriginOpenerPolicy:()=>e===void 0?"undefined":e,checkCrossOriginOpenerPolicy:async()=>{if(typeof window>"u"){e="non-browser-env";return}try{const t=`${window.location.origin}${window.location.pathname}`,n=await fetch(t,{method:"HEAD"});if(!n.ok)throw new Error(`HTTP error! status: ${n.status}`);const r=n.headers.get("Cross-Origin-Opener-Policy");e=r??"null",e==="same-origin"&&console.error(jF)}catch(t){console.error("Error checking Cross-Origin-Opener-Policy:",t.message),e="error"}}}},{checkCrossOriginOpenerPolicy:FF,getCrossOriginOpenerPolicy:DF}=$F();async function Vu(e,t){const n=Object.assign(Object.assign({},e),{jsonrpc:"2.0",id:crypto.randomUUID()}),r=await window.fetch(t,{method:"POST",body:JSON.stringify(n),mode:"cors",headers:{"Content-Type":"application/json","X-Cbw-Sdk-Version":$a,"X-Cbw-Sdk-Platform":_x}}),{result:i,error:s}=await r.json();if(s)throw s;return i}function UF(){return globalThis.coinbaseWalletExtension}function HF(){var e,t;try{const n=globalThis;return(e=n.ethereum)!==null&&e!==void 0?e:(t=n.top)===null||t===void 0?void 0:t.ethereum}catch{return}}function zF({metadata:e,preference:t}){var n,r;const{appName:i,appLogoUrl:s,appChainIds:o}=e;if(t.options!=="smartWalletOnly"){const c=UF();if(c)return(n=c.setAppInfo)===null||n===void 0||n.call(c,i,s,o,t),c}const a=HF();if(a!=null&&a.isCoinbaseBrowser)return(r=a.setAppInfo)===null||r===void 0||r.call(a,i,s,o,t),a}function WF(e){if(!e||typeof e!="object"||Array.isArray(e))throw he.rpc.invalidParams({message:"Expected a single, non-array, object argument.",data:e});const{method:t,params:n}=e;if(typeof t!="string"||t.length===0)throw he.rpc.invalidParams({message:"'args.method' must be a non-empty string.",data:e});if(n!==void 0&&!Array.isArray(n)&&(typeof n!="object"||n===null))throw he.rpc.invalidParams({message:"'args.params' must be an object or array if provided.",data:e});switch(t){case"eth_sign":case"eth_signTypedData_v2":case"eth_subscribe":case"eth_unsubscribe":throw he.provider.unsupportedMethod()}}function GF(e){if(e){if(!["all","smartWalletOnly","eoaOnly"].includes(e.options))throw new Error(`Invalid options: ${e.options}`);if(e.attribution&&e.attribution.auto!==void 0&&e.attribution.dataSuffix!==void 0)throw new Error("Attribution cannot contain both auto and dataSuffix properties");if(e.telemetry&&typeof e.telemetry!="boolean")throw new Error("Telemetry must be a boolean")}}function Lx(e){if(typeof e!="function")throw new Error("toAccount is not a function")}const qF="https://keys.coinbase.com/connect",jx="https://rpc.wallet.coinbase.com",$x="https://www.walletlink.org",VF="https://go.cb-w.com/walletlink";var Ke;(function(e){e.unknown="unknown",e.banner="banner",e.button="button",e.card="card",e.chart="chart",e.content_script="content_script",e.dropdown="dropdown",e.link="link",e.page="page",e.modal="modal",e.table="table",e.search_bar="search_bar",e.service_worker="service_worker",e.text="text",e.text_input="text_input",e.tray="tray",e.checkbox="checkbox",e.icon="icon"})(Ke||(Ke={}));var Je;(function(e){e.unknown="unknown",e.blur="blur",e.click="click",e.change="change",e.dismiss="dismiss",e.focus="focus",e.hover="hover",e.select="select",e.measurement="measurement",e.move="move",e.process="process",e.render="render",e.scroll="scroll",e.view="view",e.search="search",e.keyPress="keyPress",e.error="error"})(Je||(Je={}));var Ze;(function(e){e.low="low",e.high="high"})(Ze||(Ze={}));function tt(e,t,n){var r,i,s,o;window.ClientAnalytics&&((r=window.ClientAnalytics)===null||r===void 0||r.logEvent(e,Object.assign(Object.assign({},t),{sdkVersion:$a,appName:(s=(i=ge.config.get().metadata)===null||i===void 0?void 0:i.appName)!==null&&s!==void 0?s:"",appOrigin:window.location.origin,appPreferredSigner:(o=ge.config.get().preference)===null||o===void 0?void 0:o.options}),n))}const KF=()=>{tt("communicator.popup_setup.started",{action:Je.unknown,componentType:Ke.unknown},Ze.high)},JF=()=>{tt("communicator.popup_setup.completed",{action:Je.unknown,componentType:Ke.unknown},Ze.high)},ZF=()=>{tt("communicator.popup_unload.received",{action:Je.unknown,componentType:Ke.unknown},Ze.high)},Uy=({snackbarContext:e})=>{tt(`snackbar.${e}.shown`,{action:Je.render,componentType:Ke.modal,snackbarContext:e},Ze.high)},Ua=({snackbarContext:e,snackbarAction:t})=>{tt(`snackbar.${e}.action_clicked`,{action:Je.click,componentType:Ke.button,snackbarContext:e,snackbarAction:t},Ze.high)},YF='@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}';function Fx(){const e=document.createElement("style");e.type="text/css",e.appendChild(document.createTextNode(YF)),document.documentElement.appendChild(e)}function QF(){try{return window.frameElement!==null}catch{return!1}}function XF(){try{return QF()&&window.top?window.top.location:window.location}catch{return window.location}}function eD(){var e;return/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test((e=window==null?void 0:window.navigator)===null||e===void 0?void 0:e.userAgent)}function Dx(){var e,t;return(t=(e=window==null?void 0:window.matchMedia)===null||e===void 0?void 0:e.call(window,"(prefers-color-scheme: dark)").matches)!==null&&t!==void 0?t:!1}const tD=".-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}",nD="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMzIiIGhlaWdodD0iMzIiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PHBhdGggZD0iTTEuNDkyIDEwLjQxOWE4LjkzIDguOTMgMCAwMTguOTMtOC45M2gxMS4xNjNhOC45MyA4LjkzIDAgMDE4LjkzIDguOTN2MTEuMTYzYTguOTMgOC45MyAwIDAxLTguOTMgOC45M0gxMC40MjJhOC45MyA4LjkzIDAgMDEtOC45My04LjkzVjEwLjQxOXoiIGZpbGw9IiMxNjUyRjAiLz48cGF0aCBmaWxsLXJ1bGU9ImV2ZW5vZGQiIGNsaXAtcnVsZT0iZXZlbm9kZCIgZD0iTTEwLjQxOSAwSDIxLjU4QzI3LjMzNSAwIDMyIDQuNjY1IDMyIDEwLjQxOVYyMS41OEMzMiAyNy4zMzUgMjcuMzM1IDMyIDIxLjU4MSAzMkgxMC40MkM0LjY2NSAzMiAwIDI3LjMzNSAwIDIxLjU4MVYxMC40MkMwIDQuNjY1IDQuNjY1IDAgMTAuNDE5IDB6bTAgMS40ODhhOC45MyA4LjkzIDAgMDAtOC45MyA4LjkzdjExLjE2M2E4LjkzIDguOTMgMCAwMDguOTMgOC45M0gyMS41OGE4LjkzIDguOTMgMCAwMDguOTMtOC45M1YxMC40MmE4LjkzIDguOTMgMCAwMC04LjkzLTguOTNIMTAuNDJ6IiBmaWxsPSIjZmZmIi8+PHBhdGggZmlsbC1ydWxlPSJldmVub2RkIiBjbGlwLXJ1bGU9ImV2ZW5vZGQiIGQ9Ik0xNS45OTggMjYuMDQ5Yy01LjU0OSAwLTEwLjA0Ny00LjQ5OC0xMC4wNDctMTAuMDQ3IDAtNS41NDggNC40OTgtMTAuMDQ2IDEwLjA0Ny0xMC4wNDYgNS41NDggMCAxMC4wNDYgNC40OTggMTAuMDQ2IDEwLjA0NiAwIDUuNTQ5LTQuNDk4IDEwLjA0Ny0xMC4wNDYgMTAuMDQ3eiIgZmlsbD0iI2ZmZiIvPjxwYXRoIGQ9Ik0xMi43NjIgMTQuMjU0YzAtLjgyMi42NjctMS40ODkgMS40ODktMS40ODloMy40OTdjLjgyMiAwIDEuNDg4LjY2NiAxLjQ4OCAxLjQ4OXYzLjQ5N2MwIC44MjItLjY2NiAxLjQ4OC0xLjQ4OCAxLjQ4OGgtMy40OTdhMS40ODggMS40ODggMCAwMS0xLjQ4OS0xLjQ4OHYtMy40OTh6IiBmaWxsPSIjMTY1MkYwIi8+PC9zdmc+",rD="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTIiIGhlaWdodD0iMTIiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PHBhdGggZD0iTTEyIDYuNzV2LTEuNWwtMS43Mi0uNTdjLS4wOC0uMjctLjE5LS41Mi0uMzItLjc3bC44MS0xLjYyLTEuMDYtMS4wNi0xLjYyLjgxYy0uMjQtLjEzLS41LS4yNC0uNzctLjMyTDYuNzUgMGgtMS41bC0uNTcgMS43MmMtLjI3LjA4LS41My4xOS0uNzcuMzJsLTEuNjItLjgxLTEuMDYgMS4wNi44MSAxLjYyYy0uMTMuMjQtLjI0LjUtLjMyLjc3TDAgNS4yNXYxLjVsMS43Mi41N2MuMDguMjcuMTkuNTMuMzIuNzdsLS44MSAxLjYyIDEuMDYgMS4wNiAxLjYyLS44MWMuMjQuMTMuNS4yMy43Ny4zMkw1LjI1IDEyaDEuNWwuNTctMS43MmMuMjctLjA4LjUyLS4xOS43Ny0uMzJsMS42Mi44MSAxLjA2LTEuMDYtLjgxLTEuNjJjLjEzLS4yNC4yMy0uNS4zMi0uNzdMMTIgNi43NXpNNiA4LjVhMi41IDIuNSAwIDAxMC01IDIuNSAyLjUgMCAwMTAgNXoiIGZpbGw9IiMwNTBGMTkiLz48L3N2Zz4=";let Ux=class{constructor(){this.items=new Map,this.nextItemKey=0,this.root=null,this.darkMode=Dx()}attach(t){this.root=document.createElement("div"),this.root.className="-cbwsdk-snackbar-root",t.appendChild(this.root),this.render()}presentItem(t){const n=this.nextItemKey++;return this.items.set(n,t),this.render(),()=>{this.items.delete(n),this.render()}}clear(){this.items.clear(),this.render()}render(){this.root&&jg(gt("div",null,gt(Hx,{darkMode:this.darkMode},Array.from(this.items.entries()).map(([t,n])=>gt(iD,Object.assign({},n,{key:t}))))),this.root)}};const Hx=e=>gt("div",{class:lo("-cbwsdk-snackbar-container")},gt("style",null,tD),gt("div",{class:"-cbwsdk-snackbar"},e.children)),iD=({autoExpand:e,message:t,menuItems:n})=>{const[r,i]=fE(!0),[s,o]=fE(e??!1);fj(()=>{const c=[window.setTimeout(()=>{i(!1)},1),window.setTimeout(()=>{o(!0)},1e4)];return()=>{c.forEach(window.clearTimeout)}});const a=()=>{o(!s)};return gt("div",{class:lo("-cbwsdk-snackbar-instance",r&&"-cbwsdk-snackbar-instance-hidden",s&&"-cbwsdk-snackbar-instance-expanded")},gt("div",{class:"-cbwsdk-snackbar-instance-header",onClick:a},gt("img",{src:nD,class:"-cbwsdk-snackbar-instance-header-cblogo"})," ",gt("div",{class:"-cbwsdk-snackbar-instance-header-message"},t),gt("div",{class:"-gear-container"},!s&&gt("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},gt("circle",{cx:"12",cy:"12",r:"12",fill:"#F5F7F8"})),gt("img",{src:rD,class:"-gear-icon",title:"Expand"}))),n&&n.length>0&&gt("div",{class:"-cbwsdk-snackbar-instance-menu"},n.map((c,u)=>gt("div",{class:lo("-cbwsdk-snackbar-instance-menu-item",c.isRed&&"-cbwsdk-snackbar-instance-menu-item-is-red"),onClick:c.onClick,key:u},gt("svg",{width:c.svgWidth,height:c.svgHeight,viewBox:"0 0 10 11",fill:"none",xmlns:"http://www.w3.org/2000/svg"},gt("path",{"fill-rule":c.defaultFillRule,"clip-rule":c.defaultClipRule,d:c.path,fill:"#AAAAAA"})),gt("span",{class:lo("-cbwsdk-snackbar-instance-menu-item-info",c.isRed&&"-cbwsdk-snackbar-instance-menu-item-info-is-red")},c.info)))))},zx="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";let sD=class{constructor(){this.attached=!1,this.snackbar=new Ux}attach(){if(this.attached)throw new Error("Coinbase Wallet SDK UI is already attached");const t=document.documentElement,n=document.createElement("div");n.className="-cbwsdk-css-reset",t.appendChild(n),this.snackbar.attach(n),this.attached=!0,Fx()}showConnecting(t){let n;return t.isUnlinkedErrorState?n={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:t.onResetConnection}]}:n={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:t.onCancel},{isRed:!1,info:"Reset connection",svgWidth:"10",svgHeight:"11",path:zx,defaultFillRule:"evenodd",defaultClipRule:"evenodd",onClick:t.onResetConnection}]},this.snackbar.presentItem(n)}};const Wx=420,Gx=700,oD={isRed:!1,info:"Retry",svgWidth:"10",svgHeight:"11",path:zx,defaultFillRule:"evenodd",defaultClipRule:"evenodd"},aD="Popup was blocked. Try again.";let Kf=null;function cD(e){const t=(window.innerWidth-Wx)/2+window.screenX,n=(window.innerHeight-Gx)/2+window.screenY;lD(e);function r(){const s=`wallet_${crypto.randomUUID()}`,o=window.open(e,s,`width=${Wx}, height=${Gx}, left=${t}, top=${n}`);return o==null||o.focus(),o||null}let i=r();if(!i){const s=Hy();return new Promise((o,a)=>{Uy({snackbarContext:"popup_blocked"}),s.presentItem({autoExpand:!0,message:aD,menuItems:[Object.assign(Object.assign({},oD),{onClick:()=>{Ua({snackbarContext:"popup_blocked",snackbarAction:"confirm"}),i=r(),i?o(i):a(he.rpc.internal("Popup window was blocked")),s.clear()}})]})})}return Promise.resolve(i)}function uD(e){e&&!e.closed&&e.close()}function lD(e){const t={sdkName:_x,sdkVersion:$a,origin:window.location.origin,coop:DF()};for(const[n,r]of Object.entries(t))e.searchParams.has(n)||e.searchParams.append(n,r.toString())}function Hy(){if(!Kf){const e=document.createElement("div");e.className="-cbwsdk-css-reset",document.body.appendChild(e),Kf=new Ux,Kf.attach(e)}return Kf}class dD{constructor({url:t=qF,metadata:n,preference:r}){this.popup=null,this.listeners=new Map,this.postMessage=async i=>{(await this.waitForPopupLoaded()).postMessage(i,this.url.origin)},this.postRequestAndWaitForResponse=async i=>{const s=this.onMessage(({requestId:o})=>o===i.id);return this.postMessage(i),await s},this.onMessage=async i=>new Promise((s,o)=>{const a=c=>{if(c.origin!==this.url.origin)return;const u=c.data;i(u)&&(s(u),window.removeEventListener("message",a),this.listeners.delete(a))};window.addEventListener("message",a),this.listeners.set(a,{reject:o})}),this.disconnect=()=>{uD(this.popup),this.popup=null,this.listeners.forEach(({reject:i},s)=>{i(he.provider.userRejectedRequest("Request rejected")),window.removeEventListener("message",s)}),this.listeners.clear()},this.waitForPopupLoaded=async()=>this.popup&&!this.popup.closed?(this.popup.focus(),this.popup):(KF(),this.popup=await cD(this.url),this.onMessage(({event:i})=>i==="PopupUnload").then(()=>{this.disconnect(),ZF()}).catch(()=>{}),this.onMessage(({event:i})=>i==="PopupLoaded").then(i=>{this.postMessage({requestId:i.id,data:{version:$a,metadata:this.metadata,preference:this.preference,location:window.location.toString()}})}).then(()=>{if(!this.popup)throw he.rpc.internal();return JF(),this.popup})),this.url=new URL(t),this.metadata=n,this.preference=r}}function gn(e){return e.errorMessage!==void 0}function fD(e){const t=TF(hD(e),{shouldIncludeStack:!0}),n=new URL("https://docs.cloud.coinbase.com/wallet-sdk/docs/errors");return n.searchParams.set("version",$a),n.searchParams.set("code",t.code.toString()),n.searchParams.set("message",t.message),Object.assign(Object.assign({},t),{docUrl:n.href})}function hD(e){var t;if(typeof e=="string")return{message:e,code:qt.rpc.internal};if(gn(e)){const n=e.errorMessage,r=(t=e.errorCode)!==null&&t!==void 0?t:n.match(/(denied|rejected)/i)?qt.provider.userRejectedRequest:void 0;return Object.assign(Object.assign({},e),{message:n,code:r,data:{method:e.method}})}return e}class pD extends k6{}let Jf=class hw{constructor(t,n){this.scope=t,this.module=n}storeObject(t,n){this.setItem(t,JSON.stringify(n))}loadObject(t){const n=this.getItem(t);return n?JSON.parse(n):void 0}setItem(t,n){localStorage.setItem(this.scopedKey(t),n)}getItem(t){return localStorage.getItem(this.scopedKey(t))}removeItem(t){localStorage.removeItem(this.scopedKey(t))}clear(){const t=this.scopedKey(""),n=[];for(let r=0;r<localStorage.length;r++){const i=localStorage.key(r);typeof i=="string"&&i.startsWith(t)&&n.push(i)}n.forEach(r=>localStorage.removeItem(r))}scopedKey(t){return`-${this.scope}${this.module?`:${this.module}`:""}:${t}`}static clearAll(){new hw("CBWSDK").clear(),new hw("walletlink").clear()}};const mD=({signerType:e})=>{tt("provider.signer.loaded_from_storage",{action:Je.measurement,componentType:Ke.unknown,signerType:e},Ze.low)},gD=({method:e,correlationId:t})=>{tt("provider.request.started",{action:Je.unknown,componentType:Ke.unknown,method:e,correlationId:t},Ze.high)},yD=({method:e,correlationId:t,signerType:n,errorMessage:r})=>{tt("provider.request.error",{action:Je.error,componentType:Ke.unknown,method:e,signerType:n,correlationId:t,errorMessage:r},Ze.high)},bD=({method:e,signerType:t,correlationId:n})=>{tt("provider.request.responded",{action:Je.unknown,componentType:Ke.unknown,method:e,signerType:t,correlationId:n},Ze.high)},wD=()=>{tt("provider.enable_function.called",{action:Je.measurement,componentType:Ke.unknown},Ze.high)},vD=()=>{tt("signer.selection.requested",{action:Je.unknown,componentType:Ke.unknown},Ze.high)},_D=e=>{tt("signer.selection.responded",{action:Je.unknown,componentType:Ke.unknown,signerType:e},Ze.high)},Zf=Pg(()=>({correlationIds:new Map})),Nr={get:e=>Zf.getState().correlationIds.get(e),set:(e,t)=>{Zf.setState(n=>{const r=new Map(n.correlationIds);return r.set(e,t),{correlationIds:r}})},delete:e=>{Zf.setState(t=>{const n=new Map(t.correlationIds);return n.delete(e),{correlationIds:n}})},clear:()=>{Zf.setState({correlationIds:new Map})}},ED=({method:e,correlationId:t})=>{var n;tt("scw_signer.handshake.started",{action:Je.unknown,componentType:Ke.unknown,method:e,correlationId:t,enableAutoSubAccounts:(n=ge.subAccountsConfig.get())===null||n===void 0?void 0:n.enableAutoSubAccounts},Ze.high)},xD=({method:e,correlationId:t,errorMessage:n})=>{var r;tt("scw_signer.handshake.error",{action:Je.error,componentType:Ke.unknown,method:e,correlationId:t,errorMessage:n,enableAutoSubAccounts:(r=ge.subAccountsConfig.get())===null||r===void 0?void 0:r.enableAutoSubAccounts},Ze.high)},SD=({method:e,correlationId:t})=>{var n;tt("scw_signer.handshake.completed",{action:Je.unknown,componentType:Ke.unknown,method:e,correlationId:t,enableAutoSubAccounts:(n=ge.subAccountsConfig.get())===null||n===void 0?void 0:n.enableAutoSubAccounts},Ze.high)},kD=({method:e,correlationId:t})=>{var n;tt("scw_signer.request.started",{action:Je.unknown,componentType:Ke.unknown,method:e,correlationId:t,enableAutoSubAccounts:(n=ge.subAccountsConfig.get())===null||n===void 0?void 0:n.enableAutoSubAccounts},Ze.high)},AD=({method:e,correlationId:t,errorMessage:n})=>{var r;tt("scw_signer.request.error",{action:Je.error,componentType:Ke.unknown,method:e,correlationId:t,errorMessage:n,enableAutoSubAccounts:(r=ge.subAccountsConfig.get())===null||r===void 0?void 0:r.enableAutoSubAccounts},Ze.high)},ID=({method:e,correlationId:t})=>{var n;tt("scw_signer.request.completed",{action:Je.unknown,componentType:Ke.unknown,method:e,correlationId:t,enableAutoSubAccounts:(n=ge.subAccountsConfig.get())===null||n===void 0?void 0:n.enableAutoSubAccounts},Ze.high)},CD=({method:e,correlationId:t})=>{var n;tt("scw_sub_account.request.started",{action:Je.unknown,componentType:Ke.unknown,method:e,correlationId:t,enableAutoSubAccounts:(n=ge.subAccountsConfig.get())===null||n===void 0?void 0:n.enableAutoSubAccounts},Ze.high)},PD=({method:e,correlationId:t})=>{var n;tt("scw_sub_account.request.completed",{action:Je.unknown,componentType:Ke.unknown,method:e,correlationId:t,enableAutoSubAccounts:(n=ge.subAccountsConfig.get())===null||n===void 0?void 0:n.enableAutoSubAccounts},Ze.high)},RD=({method:e,correlationId:t,errorMessage:n})=>{var r;tt("scw_sub_account.request.error",{action:Je.error,componentType:Ke.unknown,method:e,correlationId:t,errorMessage:n,enableAutoSubAccounts:(r=ge.subAccountsConfig.get())===null||r===void 0?void 0:r.enableAutoSubAccounts},Ze.high)},TD=({method:e,correlationId:t})=>{var n;tt("scw_sub_account.add_owner.started",{action:Je.unknown,componentType:Ke.unknown,method:e,correlationId:t,enableAutoSubAccounts:(n=ge.subAccountsConfig.get())===null||n===void 0?void 0:n.enableAutoSubAccounts},Ze.high)},OD=({method:e,correlationId:t})=>{var n;tt("scw_sub_account.add_owner.completed",{action:Je.unknown,componentType:Ke.unknown,method:e,correlationId:t,enableAutoSubAccounts:(n=ge.subAccountsConfig.get())===null||n===void 0?void 0:n.enableAutoSubAccounts},Ze.high)},MD=({method:e,correlationId:t,errorMessage:n})=>{var r;tt("scw_sub_account.add_owner.error",{action:Je.error,componentType:Ke.unknown,method:e,correlationId:t,errorMessage:n,enableAutoSubAccounts:(r=ge.subAccountsConfig.get())===null||r===void 0?void 0:r.enableAutoSubAccounts},Ze.high)},BD=({method:e,correlationId:t})=>{var n;tt("scw_sub_account.insufficient_balance.error_handling.started",{action:Je.unknown,componentType:Ke.unknown,method:e,correlationId:t,enableAutoSubAccounts:(n=ge.subAccountsConfig.get())===null||n===void 0?void 0:n.enableAutoSubAccounts},Ze.high)},ND=({method:e,correlationId:t})=>{var n;tt("scw_sub_account.insufficient_balance.error_handling.completed",{action:Je.unknown,componentType:Ke.unknown,method:e,correlationId:t,enableAutoSubAccounts:(n=ge.subAccountsConfig.get())===null||n===void 0?void 0:n.enableAutoSubAccounts},Ze.high)},LD=({method:e,correlationId:t,errorMessage:n})=>{var r;tt("scw_sub_account.insufficient_balance.error_handling.error",{action:Je.error,componentType:Ke.unknown,method:e,correlationId:t,errorMessage:n,enableAutoSubAccounts:(r=ge.subAccountsConfig.get())===null||r===void 0?void 0:r.enableAutoSubAccounts},Ze.high)},bo=e=>"message"in e&&typeof e.message=="string"?e.message:"",qx=Pg(()=>({}));function Vx(e){e.forEach(t=>{var n,r,i,s,o,a,c,u;if(!t.rpcUrl)return;const l=ls({id:t.id,rpcUrls:{default:{http:[t.rpcUrl]}},name:(r=(n=t.nativeCurrency)===null||n===void 0?void 0:n.name)!==null&&r!==void 0?r:"",nativeCurrency:{name:(s=(i=t.nativeCurrency)===null||i===void 0?void 0:i.name)!==null&&s!==void 0?s:"",symbol:(a=(o=t.nativeCurrency)===null||o===void 0?void 0:o.symbol)!==null&&a!==void 0?a:"",decimals:(u=(c=t.nativeCurrency)===null||c===void 0?void 0:c.decimal)!==null&&u!==void 0?u:18}}),d=vB({chain:l,transport:fs(t.rpcUrl)}),f=Hj({client:d,transport:fs(t.rpcUrl)});qx.setState({[t.id]:{client:d,bundlerClient:f}})})}function Kx(e){var t;return(t=qx.getState()[e])===null||t===void 0?void 0:t.client}function sr(e,t,n){if(e==null)throw t??he.rpc.invalidParams({message:"value must be present",data:e})}function ws(e,t){if(!Array.isArray(e))throw he.rpc.invalidParams({message:t??"value must be an array",data:e})}function Yf(e){if(typeof e!="object"||e===null)throw he.rpc.internal("sub account info is not an object");if(!("address"in e))throw he.rpc.internal("sub account is invalid");if("address"in e&&typeof e.address=="string"&&!Pt(e.address))throw he.rpc.internal("sub account address is invalid");if("factory"in e&&typeof e.factory=="string"&&!Pt(e.factory))throw he.rpc.internal("sub account factory address is invalid");if("factoryData"in e&&typeof e.factoryData=="string"&&!pn(e.factoryData))throw he.rpc.internal("sub account factory data is invalid")}async function jD(){return crypto.subtle.generateKey({name:"ECDH",namedCurve:"P-256"},!0,["deriveKey"])}async function $D(e,t){return crypto.subtle.deriveKey({name:"ECDH",public:t},e,{name:"AES-GCM",length:256},!1,["encrypt","decrypt"])}async function FD(e,t){const n=crypto.getRandomValues(new Uint8Array(12)),r=await crypto.subtle.encrypt({name:"AES-GCM",iv:n},e,new TextEncoder().encode(t));return{iv:n,cipherText:r}}async function DD(e,{iv:t,cipherText:n}){const r=await crypto.subtle.decrypt({name:"AES-GCM",iv:t},e,n);return new TextDecoder().decode(r)}function Jx(e){switch(e){case"public":return"spki";case"private":return"pkcs8"}}async function Zx(e,t){const n=Jx(e),r=await crypto.subtle.exportKey(n,t);return Ny(new Uint8Array(r))}async function Yx(e,t){const n=Jx(e),r=qf(t).buffer;return await crypto.subtle.importKey(n,new Uint8Array(r),{name:"ECDH",namedCurve:"P-256"},!0,e==="private"?["deriveKey"]:[])}async function UD(e,t){const n=JSON.stringify(e,(r,i)=>{if(!(i instanceof Error))return i;const s=i;return Object.assign(Object.assign({},s.code?{code:s.code}:{}),{message:s.message})});return FD(t,n)}async function HD(e,t){return JSON.parse(await DD(t,e))}function zD(e,t){const n=typeof indexedDB<"u"?vx(e,t):void 0;return{getItem:async r=>{const i=await uF(r,n);return i||null},removeItem:async r=>dF(r,n),setItem:async(r,i)=>lF(r,i,n)}}const WD="cbwsdk",GD="keys",zy="activeId",Ha=zD(WD,GD);async function qD(){const e=await aF({extractable:!1}),t=pr(by(e.publicKey),1);return await Ha.setItem(t,e),await Ha.setItem(zy,t),e}async function VD(){const e=await Ha.getItem(zy);if(!e)return null;const t=await Ha.getItem(e);return t||null}async function KD(){const e=await VD();if(!e){const t=await qD(),n=pr(by(t.publicKey),1);return await Ha.setItem(n,t),await Ha.setItem(zy,n),t}return e}async function JD(){const e=await KD(),t=pr(by(e.publicKey),1),n=async r=>{const{payload:i,metadata:s}=oF({challenge:r,origin:"https://keys.coinbase.com",userVerification:"preferred"}),o=await cF({payload:i,privateKey:e.privateKey});return{signature:W$(o),raw:{},webauthn:s}};return{id:t,publicKey:t,async sign({hash:r}){return n(r)},async signMessage({message:r}){return n(Rd(r))},async signTypedData(r){return n(Au(r))},type:"webAuthn"}}async function Qf(){return{account:await JD()}}const Qx={storageKey:"ownPrivateKey",keyType:"private"},Xx={storageKey:"ownPublicKey",keyType:"public"},e3={storageKey:"peerPublicKey",keyType:"public"};class ZD{constructor(){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(t){this.sharedSecret=null,this.peerPublicKey=t,await this.storeKey(e3,t),await this.loadKeysIfNeeded()}async clear(){this.ownPrivateKey=null,this.ownPublicKey=null,this.peerPublicKey=null,this.sharedSecret=null,ge.keys.clear()}async generateKeyPair(){const t=await jD();this.ownPrivateKey=t.privateKey,this.ownPublicKey=t.publicKey,await this.storeKey(Qx,t.privateKey),await this.storeKey(Xx,t.publicKey)}async loadKeysIfNeeded(){if(this.ownPrivateKey===null&&(this.ownPrivateKey=await this.loadKey(Qx)),this.ownPublicKey===null&&(this.ownPublicKey=await this.loadKey(Xx)),(this.ownPrivateKey===null||this.ownPublicKey===null)&&await this.generateKeyPair(),this.peerPublicKey===null&&(this.peerPublicKey=await this.loadKey(e3)),this.sharedSecret===null){if(this.ownPrivateKey===null||this.peerPublicKey===null)return;this.sharedSecret=await $D(this.ownPrivateKey,this.peerPublicKey)}}async loadKey(t){const n=ge.keys.get(t.storageKey);return n?Yx(t.keyType,n):null}async storeKey(t,n){const r=await Zx(t.keyType,n);ge.keys.set(t.storageKey,r)}}function Ku(e,t){if(!(typeof e!="object"||e===null))return t.split(/[.[\]]+/).filter(Boolean).reduce((n,r)=>{if(typeof n=="object"&&n!==null)return n[r]},e)}const t3="0x0ba5ed0c6aa8c49038f819e587e2633c4a9f428a",n3="0xf85210B21cC50302F477BA56686d2019dC9b67Ad",Lr=[{inputs:[],stateMutability:"nonpayable",type:"constructor"},{inputs:[{name:"owner",type:"bytes"}],name:"AlreadyOwner",type:"error"},{inputs:[],name:"Initialized",type:"error"},{inputs:[{name:"owner",type:"bytes"}],name:"InvalidEthereumAddressOwner",type:"error"},{inputs:[{name:"key",type:"uint256"}],name:"InvalidNonceKey",type:"error"},{inputs:[{name:"owner",type:"bytes"}],name:"InvalidOwnerBytesLength",type:"error"},{inputs:[],name:"LastOwner",type:"error"},{inputs:[{name:"index",type:"uint256"}],name:"NoOwnerAtIndex",type:"error"},{inputs:[{name:"ownersRemaining",type:"uint256"}],name:"NotLastOwner",type:"error"},{inputs:[{name:"selector",type:"bytes4"}],name:"SelectorNotAllowed",type:"error"},{inputs:[],name:"Unauthorized",type:"error"},{inputs:[],name:"UnauthorizedCallContext",type:"error"},{inputs:[],name:"UpgradeFailed",type:"error"},{inputs:[{name:"index",type:"uint256"},{name:"expectedOwner",type:"bytes"},{name:"actualOwner",type:"bytes"}],name:"WrongOwnerAtIndex",type:"error"},{anonymous:!1,inputs:[{indexed:!0,name:"index",type:"uint256"},{indexed:!1,name:"owner",type:"bytes"}],name:"AddOwner",type:"event"},{anonymous:!1,inputs:[{indexed:!0,name:"index",type:"uint256"},{indexed:!1,name:"owner",type:"bytes"}],name:"RemoveOwner",type:"event"},{anonymous:!1,inputs:[{indexed:!0,name:"implementation",type:"address"}],name:"Upgraded",type:"event"},{stateMutability:"payable",type:"fallback"},{inputs:[],name:"REPLAYABLE_NONCE_KEY",outputs:[{name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{name:"owner",type:"address"}],name:"addOwnerAddress",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{name:"x",type:"bytes32"},{name:"y",type:"bytes32"}],name:"addOwnerPublicKey",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{name:"functionSelector",type:"bytes4"}],name:"canSkipChainIdValidation",outputs:[{name:"",type:"bool"}],stateMutability:"pure",type:"function"},{inputs:[],name:"domainSeparator",outputs:[{name:"",type:"bytes32"}],stateMutability:"view",type:"function"},{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"},{inputs:[],name:"entryPoint",outputs:[{name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{name:"target",type:"address"},{name:"value",type:"uint256"},{name:"data",type:"bytes"}],name:"execute",outputs:[],stateMutability:"payable",type:"function"},{inputs:[{components:[{name:"target",type:"address"},{name:"value",type:"uint256"},{name:"data",type:"bytes"}],name:"calls",type:"tuple[]"}],name:"executeBatch",outputs:[],stateMutability:"payable",type:"function"},{inputs:[{name:"calls",type:"bytes[]"}],name:"executeWithoutChainIdValidation",outputs:[],stateMutability:"payable",type:"function"},{inputs:[{components:[{name:"sender",type:"address"},{name:"nonce",type:"uint256"},{name:"initCode",type:"bytes"},{name:"callData",type:"bytes"},{name:"callGasLimit",type:"uint256"},{name:"verificationGasLimit",type:"uint256"},{name:"preVerificationGas",type:"uint256"},{name:"maxFeePerGas",type:"uint256"},{name:"maxPriorityFeePerGas",type:"uint256"},{name:"paymasterAndData",type:"bytes"},{name:"signature",type:"bytes"}],name:"userOp",type:"tuple"}],name:"getUserOpHashWithoutChainId",outputs:[{name:"",type:"bytes32"}],stateMutability:"view",type:"function"},{inputs:[],name:"implementation",outputs:[{name:"$",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{name:"owners",type:"bytes[]"}],name:"initialize",outputs:[],stateMutability:"payable",type:"function"},{inputs:[{name:"account",type:"address"}],name:"isOwnerAddress",outputs:[{name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{name:"account",type:"bytes"}],name:"isOwnerBytes",outputs:[{name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{name:"x",type:"bytes32"},{name:"y",type:"bytes32"}],name:"isOwnerPublicKey",outputs:[{name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{name:"hash",type:"bytes32"},{name:"signature",type:"bytes"}],name:"isValidSignature",outputs:[{name:"result",type:"bytes4"}],stateMutability:"view",type:"function"},{inputs:[],name:"nextOwnerIndex",outputs:[{name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{name:"index",type:"uint256"}],name:"ownerAtIndex",outputs:[{name:"",type:"bytes"}],stateMutability:"view",type:"function"},{inputs:[],name:"ownerCount",outputs:[{name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"proxiableUUID",outputs:[{name:"",type:"bytes32"}],stateMutability:"view",type:"function"},{inputs:[{name:"index",type:"uint256"},{name:"owner",type:"bytes"}],name:"removeLastOwner",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{name:"index",type:"uint256"},{name:"owner",type:"bytes"}],name:"removeOwnerAtIndex",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"removedOwnersCount",outputs:[{name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{name:"hash",type:"bytes32"}],name:"replaySafeHash",outputs:[{name:"",type:"bytes32"}],stateMutability:"view",type:"function"},{inputs:[{name:"newImplementation",type:"address"},{name:"data",type:"bytes"}],name:"upgradeToAndCall",outputs:[],stateMutability:"payable",type:"function"},{inputs:[{components:[{name:"sender",type:"address"},{name:"nonce",type:"uint256"},{name:"initCode",type:"bytes"},{name:"callData",type:"bytes"},{name:"callGasLimit",type:"uint256"},{name:"verificationGasLimit",type:"uint256"},{name:"preVerificationGas",type:"uint256"},{name:"maxFeePerGas",type:"uint256"},{name:"maxPriorityFeePerGas",type:"uint256"},{name:"paymasterAndData",type:"bytes"},{name:"signature",type:"bytes"}],name:"userOp",type:"tuple"},{name:"userOpHash",type:"bytes32"},{name:"missingAccountFunds",type:"uint256"}],name:"validateUserOp",outputs:[{name:"validationData",type:"uint256"}],stateMutability:"nonpayable",type:"function"},{stateMutability:"payable",type:"receive"}],r3=[{inputs:[{name:"implementation_",type:"address"}],stateMutability:"payable",type:"constructor"},{inputs:[],name:"OwnerRequired",type:"error"},{inputs:[{name:"owners",type:"bytes[]"},{name:"nonce",type:"uint256"}],name:"createAccount",outputs:[{name:"account",type:"address"}],stateMutability:"payable",type:"function"},{inputs:[{name:"owners",type:"bytes[]"},{name:"nonce",type:"uint256"}],name:"getAddress",outputs:[{name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"implementation",outputs:[{name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"initCodeHash",outputs:[{name:"",type:"bytes32"}],stateMutability:"view",type:"function"}];function i3(e){var t;if(!Array.isArray(e.params))return null;switch(e.method){case"personal_sign":return e.params[1];case"eth_signTypedData_v4":return e.params[0];case"eth_signTransaction":case"eth_sendTransaction":case"wallet_sendCalls":return(t=e.params[0])===null||t===void 0?void 0:t.from;default:return null}}function YD(e,t){if(!Array.isArray(e.params))throw he.rpc.invalidParams();const n=[...e.params];switch(e.method){case"eth_signTransaction":case"eth_sendTransaction":case"wallet_sendCalls":n[0].from=t;break;case"eth_signTypedData_v4":n[0]=t;break;case"personal_sign":n[1]=t;break}return Object.assign(Object.assign({},e),{params:n})}function s3(e){var t;if(!e||!Array.isArray(e)||!(!((t=e[0])===null||t===void 0)&&t.chainId)||typeof e[0].chainId!="string"&&typeof e[0].chainId!="number")throw he.rpc.invalidParams()}function QD(e){if(!e||!Array.isArray(e)||e.length!==1&&e.length!==2||typeof e[0]!="string"||!Pt(e[0]))throw he.rpc.invalidParams();if(e.length===2){if(!Array.isArray(e[1]))throw he.rpc.invalidParams();for(const t of e[1])if(typeof t!="string"||!t.startsWith("0x"))throw he.rpc.invalidParams()}}function Xf(e,t){const n=Object.assign({},e);if(t&&e.method.startsWith("wallet_")){let r=Ku(n,"params.0.capabilities");if(typeof r>"u"&&(r={}),typeof r!="object")throw he.rpc.invalidParams();r=Object.assign(Object.assign({},t),r),n.params&&Array.isArray(n.params)&&(n.params[0]=Object.assign(Object.assign({},n.params[0]),{capabilities:r}))}return n}async function Wy(){var e;const t=(e=ge.subAccountsConfig.get())!==null&&e!==void 0?e:{},n={};if(t.enableAutoSubAccounts){const{account:r}=t.toOwnerAccount?await t.toOwnerAccount():await Qf();if(!r)throw he.provider.unauthorized("No owner account found");n.addSubAccount={account:{type:"create",keys:[{type:r.address?"address":"webauthn-p256",publicKey:r.address||r.publicKey}]}}}ge.subAccountsConfig.set({capabilities:n})}function XD(e){if(!(e.method==="coinbase_fetchPermissions"&&e.params===void 0)){if(e.method==="coinbase_fetchPermissions"&&Array.isArray(e.params)&&e.params.length===1&&typeof e.params[0]=="object"){if(typeof e.params[0].account!="string"||!e.params[0].chainId.startsWith("0x"))throw he.rpc.invalidParams("FetchPermissions - Invalid params: params[0].account must be a hex string");if(typeof e.params[0].chainId!="string"||!e.params[0].chainId.startsWith("0x"))throw he.rpc.invalidParams("FetchPermissions - Invalid params: params[0].chainId must be a hex string");if(typeof e.params[0].spender!="string"||!e.params[0].spender.startsWith("0x"))throw he.rpc.invalidParams("FetchPermissions - Invalid params: params[0].spender must be a hex string");return}throw he.rpc.invalidParams()}}function eU(e){var t,n,r;if(e.params!==void 0)return e;const i=(t=ge.getState().account.accounts)===null||t===void 0?void 0:t[0],s=(n=ge.getState().account.chain)===null||n===void 0?void 0:n.id,o=(r=ge.getState().subAccount)===null||r===void 0?void 0:r.address;if(!i||!o||!s)throw he.rpc.invalidParams("FetchPermissions - one or more of account, sub account, or chain id is missing, connect to sub account via wallet_connect first");return{method:"coinbase_fetchPermissions",params:[{account:i,chainId:oe(s),spender:o}]}}function tU({spendPermission:e,chainId:t}){return{domain:{name:"Spend Permission Manager",version:"1",chainId:t,verifyingContract:n3},types:{SpendPermission:[{name:"account",type:"address"},{name:"spender",type:"address"},{name:"token",type:"address"},{name:"allowance",type:"uint160"},{name:"period",type:"uint48"},{name:"start",type:"uint48"},{name:"end",type:"uint48"},{name:"salt",type:"uint256"},{name:"extraData",type:"bytes"}]},primaryType:"SpendPermission",message:{account:e.account,spender:e.spender,token:e.token,allowance:e.allowance,period:e.period,start:e.start,end:e.end,salt:e.salt,extraData:e.extraData}}}function nU({spendPermissionBatch:e,chainId:t}){return{domain:{name:"Spend Permission Manager",version:"1",chainId:t,verifyingContract:n3},types:{SpendPermissionBatch:[{name:"account",type:"address"},{name:"period",type:"uint48"},{name:"start",type:"uint48"},{name:"end",type:"uint48"},{name:"permissions",type:"PermissionDetails[]"}],PermissionDetails:[{name:"spender",type:"address"},{name:"token",type:"address"},{name:"allowance",type:"uint160"},{name:"salt",type:"uint256"},{name:"extraData",type:"bytes"}]},primaryType:"SpendPermissionBatch",message:{account:e.account,period:e.period,start:e.start,end:e.end,permissions:e.permissions.map(n=>({spender:n.spender,token:n.token,allowance:n.allowance,salt:n.salt,extraData:n.extraData}))}}}async function o3({client:e,id:t}){var n;const r=await d6(e,{id:t});if(r.status==="success")return(n=r.receipts)===null||n===void 0?void 0:n[0].transactionHash;throw he.rpc.internal("failed to send transaction")}function a3({calls:e,from:t,chainId:n,capabilities:r}){const i=Ex.get().paymasterUrls;let s={method:"wallet_sendCalls",params:[{version:"1.0",calls:e,chainId:oe(n),from:t,atomicRequired:!0,capabilities:r}]};return i!=null&&i[n]&&(s=Xf(s,{paymasterService:{url:i==null?void 0:i[n]}})),s}async function rU(){const e=Hy();return await new Promise(n=>{Uy({snackbarContext:"sub_account_insufficient_balance"}),e.presentItem({autoExpand:!0,message:"Insufficient spend permission. Choose how to proceed:",menuItems:[{isRed:!1,info:"Create new Spend Permission",svgWidth:"10",svgHeight:"11",path:"",defaultFillRule:"evenodd",defaultClipRule:"evenodd",onClick:()=>{Ua({snackbarContext:"sub_account_insufficient_balance",snackbarAction:"create_permission"}),e.clear(),n("update_permission")}},{isRed:!1,info:"Continue in Popup",svgWidth:"10",svgHeight:"11",path:"",defaultFillRule:"evenodd",defaultClipRule:"evenodd",onClick:()=>{Ua({snackbarContext:"sub_account_insufficient_balance",snackbarAction:"continue_in_popup"}),e.clear(),n("continue_popup")}},{isRed:!0,info:"Cancel",svgWidth:"10",svgHeight:"11",path:"",defaultFillRule:"evenodd",defaultClipRule:"evenodd",onClick:()=>{Ua({snackbarContext:"sub_account_insufficient_balance",snackbarAction:"cancel"}),e.clear(),n("cancel")}}]})})}function iU({errorData:e,sourceAddress:t}){var n;const r=[];for(const[i,{amount:s,sources:o}]of Object.entries((n=e==null?void 0:e.required)!==null&&n!==void 0?n:{})){if(o.filter(c=>It(c.balance)>=It(s)&&c.address.toLowerCase()===(t==null?void 0:t.toLowerCase())).length===0)throw new Error("Source address has insufficient balance for a token");r.push({token:i,requiredAmount:It(s)})}return r}function sU(e){return typeof e=="object"&&e!==null&&"calls"in e}function oU(e){return Array.isArray(e)&&e.length===1&&typeof e[0]=="object"&&e[0]!==null&&"to"in e[0]}function aU(e){return _i(xt(tn(e)),0,16)}function cU({attribution:e,dappOrigin:t}){if(e){if("auto"in e&&e.auto&&t)return aU(t);if("dataSuffix"in e)return e.dataSuffix}}function uU(e,t){var n;if(!Array.isArray(e==null?void 0:e.params))return!1;const r=(n=e.params[0])===null||n===void 0?void 0:n.capabilities;return!r||typeof r!="object"?!1:t in r}function eh(e,t){const n=e.filter(r=>r!==t);return[t,...n]}function th(e,t){return[...e.filter(r=>r!==t),t]}async function lU(){const e=ge.spendPermissions.get(),t=ge.subAccounts.get(),n=ge.account.get().accounts;return n?{accounts:n==null?void 0:n.map(i=>({address:i,capabilities:{subAccounts:t?[t]:void 0,spendPermissions:e.length>0?{permissions:e}:void 0}}))}:null}function dU(e){return e.replaceAll("+","-").replaceAll("/","_").replace(/=+$/,"")}function nh(e){const t=btoa(String.fromCharCode(...new Uint8Array(e)));return dU(t)}function fU({webauthn:e,signature:t,id:n}){const r=mx(t);return{id:n,rawId:nh(gi(n)),response:{authenticatorData:nh(Rn(e.authenticatorData)),clientDataJSON:nh(gi(e.clientDataJSON)),signature:nh(hU(r.r,r.s))},type:JSON.parse(e.clientDataJSON).type}}function hU(e,t){const n=Rn(En(oe(e))),r=Rn(En(oe(t))),i=n.length,s=r.length,o=i+s+4,a=new Uint8Array(o+2);return a[0]=48,a[1]=o,a[2]=2,a[3]=i,a.set(n,4),a[i+4]=2,a[i+5]=s,a.set(r,i+6),a}var pU=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n};async function mU(e){const{owner:t,ownerIndex:n,address:r,client:i,factoryData:s}=e,o={abi:gj,address:yj,version:"0.6"},a={abi:r3,address:t3};return _j({client:i,entryPoint:o,extend:{abi:Lr,factory:a},async decodeCalls(c){const u=fp({abi:Lr,data:c});if(u.functionName==="execute")return[{to:u.args[0],value:u.args[1],data:u.args[2]}];if(u.functionName==="executeBatch")return u.args[0].map(l=>({to:l.target,value:l.value,data:l.data}));throw new ee(`unable to decode calls for "${u.functionName}"`)},async encodeCalls(c){var u,l;return c.length===1?jt({abi:Lr,functionName:"execute",args:[c[0].to,(u=c[0].value)!==null&&u!==void 0?u:BigInt(0),(l=c[0].data)!==null&&l!==void 0?l:"0x"]}):jt({abi:Lr,functionName:"executeBatch",args:[c.map(d=>{var f,h;return{data:(f=d.data)!==null&&f!==void 0?f:"0x",target:d.to,value:(h=d.value)!==null&&h!==void 0?h:BigInt(0)}})]})},async getAddress(){return r},async getFactoryArgs(){return s?{factory:a.address,factoryData:s}:{factory:a.address,factoryData:s}},async getStubSignature(){return t.type==="webAuthn"?"0x0000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000c0000000000000000000000000000000000000000000000000000000000000012000000000000000000000000000000000000000000000000000000000000000170000000000000000000000000000000000000000000000000000000000000001949fc7c88032b9fcb5f6efc7a7b8c63668eae9871b765e23123bb473ff57aa831a7c0d9276168ebcc29f2875a0239cffdf2a9cd1c2007c5c77c071db9264df1d000000000000000000000000000000000000000000000000000000000000002549960de5880e8c687434170f6476605b8fe4aeb9a28632c7995cf3ba831d97630500000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008a7b2274797065223a22776562617574686e2e676574222c226368616c6c656e6765223a2273496a396e6164474850596759334b7156384f7a4a666c726275504b474f716d59576f4d57516869467773222c226f726967696e223a2268747470733a2f2f7369676e2e636f696e626173652e636f6d222c2263726f73734f726967696e223a66616c73657d00000000000000000000000000000000000000000000":Ju({ownerIndex:n,signature:"0xfffffffffffffffffffffffffffffff0000000000000000000000000000000007aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa1c"})},async sign(c){const u=await this.getAddress(),l=Gy({address:u,chainId:i.chain.id,hash:c.hash}),d=await rh({hash:l,owner:t});return Ju({ownerIndex:n,signature:d})},async signMessage(c){const{message:u}=c,l=await this.getAddress(),d=Gy({address:l,chainId:i.chain.id,hash:Rd(u)}),f=await rh({hash:d,owner:t});return Ju({ownerIndex:n,signature:f})},async signTypedData(c){const{domain:u,types:l,primaryType:d,message:f}=c,h=await this.getAddress(),m=Gy({address:h,chainId:i.chain.id,hash:Au({domain:u,message:f,primaryType:d,types:l})}),y=await rh({hash:m,owner:t});return Ju({ownerIndex:n,signature:y})},async signUserOperation(c){const{chainId:u=i.chain.id}=c,l=pU(c,["chainId"]),d=await this.getAddress(),f=vj({chainId:u,entryPointAddress:o.address,entryPointVersion:o.version,userOperation:Object.assign(Object.assign({},l),{sender:d})}),h=await rh({hash:f,owner:t});return Ju({ownerIndex:n,signature:h})},userOperation:{async estimateGas(c){var u;if(t.type==="webAuthn")return{verificationGasLimit:BigInt(Math.max(Number((u=c.verificationGasLimit)!==null&&u!==void 0?u:BigInt(0)),8e5))}}}})}async function rh({hash:e,owner:t}){if(t.type==="webAuthn"){const{signature:n,webauthn:r}=await t.sign({hash:e});return gU({signature:n,webauthn:r})}if(t.sign)return t.sign({hash:e});throw new ee("`owner` does not support raw sign.")}function Gy({address:e,chainId:t,hash:n}){return Au({domain:{chainId:t,name:"Coinbase Smart Wallet",verifyingContract:e,version:"1"},types:{CoinbaseSmartWalletMessage:[{name:"hash",type:"bytes32"}]},primaryType:"CoinbaseSmartWalletMessage",message:{hash:n}})}function gU({webauthn:e,signature:t}){const{r:n,s:r}=mx(t);return zn([{components:[{name:"authenticatorData",type:"bytes"},{name:"clientDataJSON",type:"bytes"},{name:"challengeIndex",type:"uint256"},{name:"typeIndex",type:"uint256"},{name:"r",type:"uint256"},{name:"s",type:"uint256"}],type:"tuple"}],[{authenticatorData:e.authenticatorData,clientDataJSON:Ds(e.clientDataJSON),challengeIndex:BigInt(e.challengeIndex),typeIndex:BigInt(e.typeIndex),r:n,s:r}])}function Ju(e){const{ownerIndex:t=0}=e,n=(()=>{if(Et(e.signature)!==65)return e.signature;const r=xB(e.signature);return vO(["bytes32","bytes32","uint8"],[r.r,r.s,r.yParity===0?27:28])})();return zn([{components:[{name:"ownerIndex",type:"uint8"},{name:"signatureData",type:"bytes"}],type:"tuple"}],[{ownerIndex:t,signatureData:n}])}async function yU({address:e,client:t,factory:n,factoryData:r,owner:i,ownerIndex:s,parentAddress:o,attribution:a}){var c;const u={address:e,factory:n,factoryData:r},l=(c=t.chain)===null||c===void 0?void 0:c.id;if(!l)throw he.rpc.internal("chainId not found");const d=await mU({owner:i,ownerIndex:s??1,address:e,client:t,factoryData:r}),f=async h=>{var m,y,w,b,x,v;try{switch(h.method){case"wallet_addSubAccount":return u;case"eth_accounts":return[u.address];case"eth_coinbase":return u.address;case"net_version":return l.toString();case"eth_chainId":return oe(l);case"eth_sendTransaction":{ws(h.params);const S=h.params[0];sr(S.to,he.rpc.invalidParams("to is required"));const I={to:S.to,data:$y((m=S.data)!==null&&m!==void 0?m:"0x",!0),value:$y((y=S.value)!==null&&y!==void 0?y:"0x",!0),from:(w=S.from)!==null&&w!==void 0?w:u.address},N=a3({calls:[I],chainId:l,from:I.from}),j=await f(N);return o3({client:t,id:j})}case"wallet_sendCalls":{ws(h.params);const S=Ku(h.params[0],"chainId");if(!S)throw he.rpc.invalidParams("chainId is required");if(!pn(S))throw he.rpc.invalidParams("chainId must be a hex encoded integer");if(!h.params[0])throw he.rpc.invalidParams("params are required");if(!("calls"in h.params[0]))throw he.rpc.invalidParams("calls are required");let I={method:"wallet_prepareCalls",params:[{version:"1.0",calls:h.params[0].calls,chainId:S,from:u.address,capabilities:"capabilities"in h.params[0]?h.params[0].capabilities:{}}]};o&&(I=Xf(I,{funding:[{type:"spendPermission",data:{autoApply:!0,sources:[o],preference:"PREFER_DIRECT_BALANCE"}}]}));let N=await f(I);const j=await((x=(b=i).sign)===null||x===void 0?void 0:x.call(b,{hash:Ql(N.signatureRequest.hash)}));let U;if(!j)throw he.rpc.internal("signature not found");return pn(j)?U={type:"secp256k1",data:{address:i.address,signature:j}}:U={type:"webauthn",data:{signature:JSON.stringify(fU(Object.assign({id:(v=i.id)!==null&&v!==void 0?v:"1"},j))),publicKey:i.publicKey}},(await f({method:"wallet_sendPreparedCalls",params:[{version:"1.0",type:N.type,data:N.userOp,chainId:N.chainId,signature:U}]}))[0]}case"wallet_sendPreparedCalls":{ws(h.params);const S=Ku(h.params[0],"chainId");if(!S)throw he.rpc.invalidParams("chainId is required");if(!pn(S))throw he.rpc.invalidParams("chainId must be a hex encoded integer");return await t.request({method:"wallet_sendPreparedCalls",params:h.params})}case"wallet_prepareCalls":{ws(h.params);const S=Ku(h.params[0],"chainId");if(!S)throw he.rpc.invalidParams("chainId is required");if(!pn(S))throw he.rpc.invalidParams("chainId must be a hex encoded integer");if(!h.params[0])throw he.rpc.invalidParams("params are required");if(!Ku(h.params[0],"calls"))throw he.rpc.invalidParams("calls are required");const I=h.params[0];return a&&I.capabilities&&!("attribution"in I.capabilities)&&(I.capabilities.attribution=a),await t.request({method:"wallet_prepareCalls",params:[Object.assign(Object.assign({},h.params[0]),{chainId:S})]})}case"personal_sign":{if(ws(h.params),!pn(h.params[0]))throw he.rpc.invalidParams("message must be a hex encoded string");const S=Ql(h.params[0]);return d.signMessage({message:S})}case"eth_signTypedData_v4":{ws(h.params);const S=typeof h.params[1]=="string"?JSON.parse(h.params[1]):h.params[1];return d.signTypedData(S)}case"eth_signTypedData_v1":case"eth_signTypedData_v3":case"wallet_addEthereumChain":case"wallet_switchEthereumChain":default:throw he.rpc.methodNotSupported()}}catch(S){if(Rx(S)){const I=MF(S);if(I)throw I}throw S}};return{request:f}}async function c3({address:e,client:t,publicKey:n,factory:r,factoryData:i}){if(!await wa(t,{address:e})&&r&&i){if(mn(r)!==mn(t3))throw he.rpc.internal("unknown factory address");const a=fp({abi:r3,data:i});if(a.functionName!=="createAccount")throw he.rpc.internal("unknown factory function");const[c]=a.args;return c.findIndex(u=>u.toLowerCase()===u3(n).toLowerCase())}const o=await On(t,{address:e,abi:Lr,functionName:"ownerCount"});for(let a=Number(o)-1;a>=0;a--){const c=await On(t,{address:e,abi:Lr,functionName:"ownerAtIndex",args:[BigInt(a)]}),u=u3(n);if(c.toLowerCase()===u.toLowerCase())return a}return-1}function u3(e){return Pt(e)?Kt(e):e}async function bU(){const e=Hy();return new Promise(t=>{Uy({snackbarContext:"sub_account_add_owner"}),e.presentItem({autoExpand:!0,message:"App requires a signer update",menuItems:[{isRed:!1,info:"Confirm",svgWidth:"10",svgHeight:"11",path:"",defaultFillRule:"evenodd",defaultClipRule:"evenodd",onClick:()=>{Ua({snackbarContext:"sub_account_add_owner",snackbarAction:"confirm"}),e.clear(),t("authenticate")}},{isRed:!0,info:"Cancel",svgWidth:"10",svgHeight:"11",path:"",defaultFillRule:"evenodd",defaultClipRule:"evenodd",onClick:()=>{Ua({snackbarContext:"sub_account_add_owner",snackbarAction:"cancel"}),e.clear(),t("cancel")}}]})})}async function wU({ownerAccount:e,globalAccountRequest:t}){var n,r;const i=ge.account.get(),s=ge.subAccounts.get(),o=(n=i.accounts)===null||n===void 0?void 0:n.find(m=>m.toLowerCase()!==(s==null?void 0:s.address.toLowerCase()));sr(o,he.provider.unauthorized("no global account")),sr((r=i.chain)===null||r===void 0?void 0:r.id,he.provider.unauthorized("no chain id")),sr(s==null?void 0:s.address,he.provider.unauthorized("no sub account"));const a=[];if(e.type==="local"&&e.address&&a.push({to:s.address,data:jt({abi:Lr,functionName:"addOwnerAddress",args:[e.address]}),value:tn(0)}),e.publicKey){const[m,y]=Us([{type:"bytes32"},{type:"bytes32"}],e.publicKey);a.push({to:s.address,data:jt({abi:Lr,functionName:"addOwnerPublicKey",args:[m,y]}),value:tn(0)})}const c={method:"wallet_sendCalls",params:[{version:"1",calls:a,chainId:oe(84532),from:o}]};if(await bU()==="cancel")throw he.provider.unauthorized("user cancelled");const l=await t(c),d=Kx(i.chain.id);if(sr(d,he.rpc.internal(`client not found for chainId ${i.chain.id}`)),(await d6(d,{id:l})).status!=="success")throw he.rpc.internal("add owner call failed");const h=await c3({address:s.address,publicKey:e.type==="local"&&e.address?e.address:e.publicKey,client:d});if(h===-1)throw he.rpc.internal("failed to find owner index");return h}async function vU({errorData:e,globalAccountAddress:t,subAccountAddress:n,client:r,request:i,subAccountRequest:s,globalAccountRequest:o}){var a;const c=(a=r.chain)===null||a===void 0?void 0:a.id;sr(c,he.rpc.internal("invalid chainId"));const u=iU({errorData:e,sourceAddress:t}),l=await rU();if(l==="cancel")throw new Error("User cancelled funding");let d;const f=60*60*24,h=3;if(l==="update_permission"){if(u.length===1){const v=u[0],S=tU({spendPermission:{token:v.token,allowance:oe(v.requiredAmount*BigInt(h)),period:f,account:t,spender:n,start:0,end:0xffffffffffff,salt:oe(BigInt(Math.floor(Math.random()*Number.MAX_SAFE_INTEGER))),extraData:"0x"},chainId:c});d={method:"eth_signTypedData_v4",params:[t,S]}}else{const v=nU({spendPermissionBatch:{account:t,period:f,start:0,end:0xffffffffffff,permissions:u.map(S=>({token:S.token,allowance:oe(S.requiredAmount*BigInt(h)),period:f,account:t,spender:n,salt:"0x0",extraData:"0x"}))},chainId:c});d={method:"eth_signTypedData_v4",params:[t,v]}}try{await o(d)}catch(v){throw console.error(v),new Error("User denied spend permission request")}return s(i)}const m=u.map(v=>v.token.toLowerCase()==="0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE".toLowerCase()?{to:n,value:oe(v.requiredAmount),data:"0x"}:{to:v.token,value:"0x0",data:jt({abi:UI,functionName:"transfer",args:[n,v.requiredAmount]})});let y;if(i.method==="wallet_sendCalls"&&sU(i.params))y=i.params[0];else if(i.method==="eth_sendTransaction"&&oU(i.params))y=a3({calls:[i.params[0]],chainId:c,from:i.params[0].from}).params[0];else throw new Error("Could not get original call");const w=jt({abi:Lr,functionName:"executeBatch",args:[y.calls.map(v=>{var S,I;return{target:v.to,value:It((S=v.value)!==null&&S!==void 0?S:"0x0"),data:(I=v.data)!==null&&I!==void 0?I:"0x"}})]}),b=[...m,{data:w,to:n,value:"0x0"}],x=await o({method:"wallet_sendCalls",params:[Object.assign(Object.assign({},y),{calls:b,from:t})]});return i.method==="eth_sendTransaction"?o3({client:r,id:x}):x}class l3{constructor(t){var n,r,i,s;this.communicator=t.communicator,this.callback=t.callback,this.keyManager=new ZD;const{account:o,chains:a}=ge.getState();this.accounts=(n=o.accounts)!==null&&n!==void 0?n:[],this.chain=(r=o.chain)!==null&&r!==void 0?r:{id:(s=(i=t.metadata.appChainIds)===null||i===void 0?void 0:i[0])!==null&&s!==void 0?s:1},a&&Vx(a)}async handshake(t){var n,r,i;const s=Nr.get(t);ED({method:t.method,correlationId:s});try{await((r=(n=this.communicator).waitForPopupLoaded)===null||r===void 0?void 0:r.call(n));const o=await this.createRequestMessage({handshake:{method:t.method,params:(i=t.params)!==null&&i!==void 0?i:[]}},s),a=await this.communicator.postRequestAndWaitForResponse(o);if("failure"in a.content)throw a.content.failure;const c=await Yx("public",a.sender);await this.keyManager.setPeerPublicKey(c);const u=await this.decryptResponseMessage(a);this.handleResponse(t,u),SD({method:t.method,correlationId:s})}catch(o){throw xD({method:t.method,correlationId:s,errorMessage:bo(o)}),o}}async request(t){const n=Nr.get(t);kD({method:t.method,correlationId:n});try{const r=await this._request(t);return ID({method:t.method,correlationId:n}),r}catch(r){throw AD({method:t.method,correlationId:n,errorMessage:bo(r)}),r}}async _request(t){var n,r,i,s,o,a,c,u,l,d,f,h,m,y;if(this.accounts.length===0)switch(t.method){case"eth_requestAccounts":return await((r=(n=this.communicator).waitForPopupLoaded)===null||r===void 0?void 0:r.call(n)),await Wy(),await this.request({method:"wallet_connect",params:[{version:"1",capabilities:Object.assign({},(s=(i=ge.subAccountsConfig.get())===null||i===void 0?void 0:i.capabilities)!==null&&s!==void 0?s:{})}]}),this.accounts;case"wallet_switchEthereumChain":{s3(t.params),this.chain.id=Number(t.params[0].chainId);return}case"wallet_connect":{await((a=(o=this.communicator).waitForPopupLoaded)===null||a===void 0?void 0:a.call(o)),await Wy();let w={};uU(t,"addSubAccount")&&(w=(u=(c=ge.subAccountsConfig.get())===null||c===void 0?void 0:c.capabilities)!==null&&u!==void 0?u:{});const b=Xf(t,w);return this.sendRequestToPopup(b)}case"wallet_sendCalls":case"wallet_sign":return this.sendRequestToPopup(t);default:throw he.provider.unauthorized()}if(this.shouldRequestUseSubAccountSigner(t)){const w=Nr.get(t);CD({method:t.method,correlationId:w});try{const b=await this.sendRequestToSubAccountSigner(t);return PD({method:t.method,correlationId:w}),b}catch(b){throw RD({method:t.method,correlationId:w,errorMessage:bo(b)}),b}}switch(t.method){case"eth_requestAccounts":case"eth_accounts":{const w=ge.subAccounts.get(),b=ge.subAccountsConfig.get();return w!=null&&w.address&&(this.accounts=b!=null&&b.enableAutoSubAccounts?eh(this.accounts,w.address):th(this.accounts,w.address)),(l=this.callback)===null||l===void 0||l.call(this,"connect",{chainId:oe(this.chain.id)}),this.accounts}case"eth_coinbase":return this.accounts[0];case"net_version":return this.chain.id;case"eth_chainId":return oe(this.chain.id);case"wallet_getCapabilities":return this.handleGetCapabilitiesRequest(t);case"wallet_switchEthereumChain":return this.handleSwitchChainRequest(t);case"eth_ecRecover":case"personal_sign":case"wallet_sign":case"personal_ecRecover":case"eth_signTransaction":case"eth_sendTransaction":case"eth_signTypedData_v1":case"eth_signTypedData_v3":case"eth_signTypedData_v4":case"eth_signTypedData":case"wallet_addEthereumChain":case"wallet_watchAsset":case"wallet_sendCalls":case"wallet_showCallsStatus":case"wallet_grantPermissions":return this.sendRequestToPopup(t);case"wallet_connect":{const w=await lU();if(w)return w;await((f=(d=this.communicator).waitForPopupLoaded)===null||f===void 0?void 0:f.call(d)),await Wy();const b=ge.subAccountsConfig.get(),x=Xf(t,(h=b==null?void 0:b.capabilities)!==null&&h!==void 0?h:{});return(m=this.callback)===null||m===void 0||m.call(this,"connect",{chainId:oe(this.chain.id)}),this.sendRequestToPopup(x)}case"wallet_getSubAccounts":{const w=ge.subAccounts.get();if(w!=null&&w.address)return{subAccounts:[w]};if(!this.chain.rpcUrl)throw he.rpc.internal("No RPC URL set for chain");const b=await Vu(t,this.chain.rpcUrl);if(ws(b.subAccounts,"subAccounts"),b.subAccounts.length>0){Yf(b.subAccounts[0]);const x=b.subAccounts[0];ge.subAccounts.set({address:x.address,factory:x.factory,factoryData:x.factoryData})}return b}case"wallet_addSubAccount":return this.addSubAccount(t);case"coinbase_fetchPermissions":{XD(t);const w=eU(t),b=await Vu(w,jx),x=Pn((y=w.params)===null||y===void 0?void 0:y[0].chainId);return ge.spendPermissions.set(b.permissions.map(v=>Object.assign(Object.assign({},v),{chainId:x}))),b}default:if(!this.chain.rpcUrl)throw he.rpc.internal("No RPC URL set for chain");return Vu(t,this.chain.rpcUrl)}}async sendRequestToPopup(t){var n,r;await((r=(n=this.communicator).waitForPopupLoaded)===null||r===void 0?void 0:r.call(n));const i=await this.sendEncryptedRequest(t),s=await this.decryptResponseMessage(i);return this.handleResponse(t,s)}async handleResponse(t,n){var r,i,s,o,a;const c=n.result;if("error"in c)throw c.error;switch(t.method){case"eth_requestAccounts":{const u=c.value;this.accounts=u,ge.account.set({accounts:u,chain:this.chain}),(r=this.callback)===null||r===void 0||r.call(this,"accountsChanged",u);break}case"wallet_connect":{const u=c.value,l=u.accounts.map(b=>b.address);this.accounts=l,ge.account.set({accounts:l});const d=u.accounts.at(0),f=d==null?void 0:d.capabilities;if(f!=null&&f.subAccounts){const b=f==null?void 0:f.subAccounts;ws(b,"subAccounts"),Yf(b[0]),ge.subAccounts.set({address:b[0].address,factory:b[0].factory,factoryData:b[0].factoryData})}let h=[this.accounts[0]];const m=ge.subAccounts.get(),y=ge.subAccountsConfig.get();m!=null&&m.address&&(this.accounts=y!=null&&y.enableAutoSubAccounts?eh(this.accounts,m.address):th(this.accounts,m.address));const w=(s=(i=u==null?void 0:u.accounts)===null||i===void 0?void 0:i[0].capabilities)===null||s===void 0?void 0:s.spendPermissions;w&&"permissions"in w&&ge.spendPermissions.set(w==null?void 0:w.permissions),(o=this.callback)===null||o===void 0||o.call(this,"accountsChanged",h);break}case"wallet_addSubAccount":{Yf(c.value);const u=c.value;ge.subAccounts.set(u);const l=ge.subAccountsConfig.get();this.accounts=l!=null&&l.enableAutoSubAccounts?eh(this.accounts,u.address):th(this.accounts,u.address),(a=this.callback)===null||a===void 0||a.call(this,"accountsChanged",this.accounts);break}}return c.value}async cleanup(){var t,n;const r=ge.config.get().metadata;await this.keyManager.clear(),ge.account.clear(),ge.subAccounts.clear(),ge.spendPermissions.clear(),ge.chains.clear(),this.accounts=[],this.chain={id:(n=(t=r==null?void 0:r.appChainIds)===null||t===void 0?void 0:t[0])!==null&&n!==void 0?n:1}}async handleSwitchChainRequest(t){s3(t.params);const n=Gu(t.params[0].chainId);if(this.updateChain(n))return null;const i=await this.sendRequestToPopup(t);return i===null&&this.updateChain(n),i}async handleGetCapabilitiesRequest(t){QD(t.params);const n=t.params[0],r=t.params[1];if(!this.accounts.some(a=>us(a,n)))throw he.provider.unauthorized("no active account found when getting capabilities");const i=ge.getState().account.capabilities;if(!i)return{};if(!r||r.length===0)return i;const s=new Set(r.map(a=>Pn(a)));return Object.fromEntries(Object.entries(i).filter(([a])=>{try{const c=Pn(a);return s.has(c)}catch{return!1}}))}async sendEncryptedRequest(t){const n=await this.keyManager.getSharedSecret();if(!n)throw he.provider.unauthorized("No shared secret found when encrypting request");const r=await UD({action:t,chainId:this.chain.id},n),i=Nr.get(t),s=await this.createRequestMessage({encrypted:r},i);return this.communicator.postRequestAndWaitForResponse(s)}async createRequestMessage(t,n){const r=await Zx("public",await this.keyManager.getOwnPublicKey());return{id:crypto.randomUUID(),correlationId:n,sender:r,content:t,timestamp:new Date}}async decryptResponseMessage(t){var n,r,i;const s=t.content;if("failure"in s)throw s.failure;const o=await this.keyManager.getSharedSecret();if(!o)throw he.provider.unauthorized("Invalid session: no shared secret found when decrypting response");const a=await HD(s.encrypted,o),c=(n=a.data)===null||n===void 0?void 0:n.chains;if(c){const l=(r=a.data)===null||r===void 0?void 0:r.nativeCurrencies,d=Object.entries(c).map(([f,h])=>{const m=l==null?void 0:l[Number(f)];return Object.assign({id:Number(f),rpcUrl:h},m?{nativeCurrency:m}:{})});ge.chains.set(d),this.updateChain(this.chain.id,d),Vx(d)}const u=(i=a.data)===null||i===void 0?void 0:i.capabilities;return u&&ge.account.set({capabilities:u}),a}updateChain(t,n){var r;const i=ge.getState(),s=n??i.chains,o=s==null?void 0:s.find(a=>a.id===t);return o?(o!==this.chain&&(this.chain=o,ge.account.set({chain:o}),(r=this.callback)===null||r===void 0||r.call(this,"chainChanged",Da(o.id))),!0):!1}async addSubAccount(t){var n,r,i,s;const a=ge.getState().subAccount,c=ge.subAccountsConfig.get();if(a!=null&&a.address)return this.accounts=c!=null&&c.enableAutoSubAccounts?eh(this.accounts,a.address):th(this.accounts,a.address),(n=this.callback)===null||n===void 0||n.call(this,"accountsChanged",this.accounts),a;if(await((i=(r=this.communicator).waitForPopupLoaded)===null||i===void 0?void 0:i.call(r)),Array.isArray(t.params)&&t.params.length>0&&t.params[0].account&&t.params[0].account.type==="create"){let l;if(t.params[0].account.keys&&t.params[0].account.keys.length>0)l=t.params[0].account.keys;else{const d=(s=ge.subAccountsConfig.get())!==null&&s!==void 0?s:{},{account:f}=d.toOwnerAccount?await d.toOwnerAccount():await Qf();if(!f)throw he.provider.unauthorized("could not get subaccount owner account when adding sub account");l=[{type:f.address?"address":"webauthn-p256",publicKey:f.address||f.publicKey}]}t.params[0].account.keys=l}const u=await this.sendRequestToPopup(t);return Yf(u),u}shouldRequestUseSubAccountSigner(t){const n=i3(t),r=ge.subAccounts.get();return n?n.toLowerCase()===(r==null?void 0:r.address.toLowerCase()):!1}async sendRequestToSubAccountSigner(t){var n;const r=ge.subAccounts.get(),i=ge.subAccountsConfig.get(),s=ge.config.get();sr(r==null?void 0:r.address,he.provider.unauthorized("no active sub account when sending request to sub account signer"));const o=i!=null&&i.toOwnerAccount?await i.toOwnerAccount():await Qf();sr(o==null?void 0:o.account,he.provider.unauthorized("no active sub account owner when sending request to sub account signer")),i3(t)===void 0&&(t=YD(t,r.address));const c=Kx(this.chain.id);sr(c,he.rpc.internal(`client not found for chainId ${this.chain.id} when sending request to sub account signer`));const u=this.accounts.find(m=>m.toLowerCase()!==r.address.toLowerCase());sr(u,he.provider.unauthorized("no global account found when sending request to sub account signer"));const l=cU({attribution:(n=s.preference)===null||n===void 0?void 0:n.attribution,dappOrigin:window.location.origin}),d=o.account.type==="local"?o.account.address:o.account.publicKey;let f=await c3({address:r.address,factory:r.factory,factoryData:r.factoryData,publicKey:d,client:c});if(f===-1){const m=Nr.get(t);TD({method:t.method,correlationId:m});try{f=await wU({ownerAccount:o.account,globalAccountRequest:this.sendRequestToPopup.bind(this)}),OD({method:t.method,correlationId:m})}catch(y){return MD({method:t.method,correlationId:m,errorMessage:bo(y)}),he.provider.unauthorized("failed to add sub account owner when sending request to sub account signer")}}const{request:h}=await yU({address:r.address,owner:o.account,client:c,factory:r.factory,factoryData:r.factoryData,parentAddress:u,attribution:l?{suffix:l}:void 0,ownerIndex:f});try{return await h(t)}catch(m){let y;if(Rx(m))y=JSON.parse(m.details);else if(Px(m))y=m;else throw m;if(!(Px(y)&&y.data)||!y.data)throw m;const w=Nr.get(t);BD({method:t.method,correlationId:w});try{const b=await vU({errorData:y.data,globalAccountAddress:u,subAccountAddress:r.address,client:c,request:t,subAccountRequest:h,globalAccountRequest:this.request.bind(this)});return ND({method:t.method,correlationId:w}),b}catch(b){throw console.error(b),LD({method:t.method,correlationId:w,errorMessage:bo(b)}),m}}}}const _U=({method:e,correlationId:t})=>{tt("walletlink_signer.handshake.started",{action:Je.unknown,componentType:Ke.unknown,method:e,correlationId:t},Ze.high)},EU=({method:e,correlationId:t,errorMessage:n})=>{tt("walletlink_signer.handshake.error",{action:Je.error,componentType:Ke.unknown,method:e,correlationId:t,errorMessage:n},Ze.high)},xU=({method:e,correlationId:t})=>{tt("walletlink_signer.handshake.completed",{action:Je.unknown,componentType:Ke.unknown,method:e,correlationId:t},Ze.high)},SU=({method:e,correlationId:t})=>{tt("walletlink_signer.request.started",{action:Je.unknown,componentType:Ke.unknown,method:e,correlationId:t},Ze.high)},kU=({method:e,correlationId:t,errorMessage:n})=>{tt("walletlink_signer.request.error",{action:Je.error,componentType:Ke.unknown,method:e,correlationId:t,errorMessage:n},Ze.high)},AU=({method:e,correlationId:t})=>{tt("walletlink_signer.request.completed",{action:Je.unknown,componentType:Ke.unknown,method:e,correlationId:t},Ze.high)},d3=()=>{tt("walletlink_signer.walletlink_connection.connection_failed",{action:Je.measurement,componentType:Ke.unknown},Ze.high)},IU=()=>{tt("walletlink_signer.walletlink_connection.fetch_unseen_events_failed",{action:Je.measurement,componentType:Ke.unknown},Ze.high)};var St={},un={};Object.defineProperty(un,"__esModule",{value:!0}),un.output=un.exists=un.hash=un.bytes=un.bool=un.number=un.isBytes=void 0;function ih(e){if(!Number.isSafeInteger(e)||e<0)throw new Error(`positive integer expected, not ${e}`)}un.number=ih;function f3(e){if(typeof e!="boolean")throw new Error(`boolean expected, not ${e}`)}un.bool=f3;function h3(e){return e instanceof Uint8Array||e!=null&&typeof e=="object"&&e.constructor.name==="Uint8Array"}un.isBytes=h3;function qy(e,...t){if(!h3(e))throw new Error("Uint8Array expected");if(t.length>0&&!t.includes(e.length))throw new Error(`Uint8Array expected of length ${t}, not of length=${e.length}`)}un.bytes=qy;function p3(e){if(typeof e!="function"||typeof e.create!="function")throw new Error("Hash should be wrapped by utils.wrapConstructor");ih(e.outputLen),ih(e.blockLen)}un.hash=p3;function m3(e,t=!0){if(e.destroyed)throw new Error("Hash instance has been destroyed");if(t&&e.finished)throw new Error("Hash#digest() has already been called")}un.exists=m3;function g3(e,t){qy(e);const n=t.outputLen;if(e.length<n)throw new Error(`digestInto() expects output buffer of length at least ${n}`)}un.output=g3;const CU={number:ih,bool:f3,bytes:qy,hash:p3,exists:m3,output:g3};un.default=CU;var Be={};Object.defineProperty(Be,"__esModule",{value:!0}),Be.add5L=Be.add5H=Be.add4H=Be.add4L=Be.add3H=Be.add3L=Be.add=Be.rotlBL=Be.rotlBH=Be.rotlSL=Be.rotlSH=Be.rotr32L=Be.rotr32H=Be.rotrBL=Be.rotrBH=Be.rotrSL=Be.rotrSH=Be.shrSL=Be.shrSH=Be.toBig=Be.split=Be.fromBig=void 0;const sh=BigInt(2**32-1),Vy=BigInt(32);function Ky(e,t=!1){return t?{h:Number(e&sh),l:Number(e>>Vy&sh)}:{h:Number(e>>Vy&sh)|0,l:Number(e&sh)|0}}Be.fromBig=Ky;function y3(e,t=!1){let n=new Uint32Array(e.length),r=new Uint32Array(e.length);for(let i=0;i<e.length;i++){const{h:s,l:o}=Ky(e[i],t);[n[i],r[i]]=[s,o]}return[n,r]}Be.split=y3;const b3=(e,t)=>BigInt(e>>>0)<<Vy|BigInt(t>>>0);Be.toBig=b3;const w3=(e,t,n)=>e>>>n;Be.shrSH=w3;const v3=(e,t,n)=>e<<32-n|t>>>n;Be.shrSL=v3;const _3=(e,t,n)=>e>>>n|t<<32-n;Be.rotrSH=_3;const E3=(e,t,n)=>e<<32-n|t>>>n;Be.rotrSL=E3;const x3=(e,t,n)=>e<<64-n|t>>>n-32;Be.rotrBH=x3;const S3=(e,t,n)=>e>>>n-32|t<<64-n;Be.rotrBL=S3;const k3=(e,t)=>t;Be.rotr32H=k3;const A3=(e,t)=>e;Be.rotr32L=A3;const I3=(e,t,n)=>e<<n|t>>>32-n;Be.rotlSH=I3;const C3=(e,t,n)=>t<<n|e>>>32-n;Be.rotlSL=C3;const P3=(e,t,n)=>t<<n-32|e>>>64-n;Be.rotlBH=P3;const R3=(e,t,n)=>e<<n-32|t>>>64-n;Be.rotlBL=R3;function T3(e,t,n,r){const i=(t>>>0)+(r>>>0);return{h:e+n+(i/2**32|0)|0,l:i|0}}Be.add=T3;const O3=(e,t,n)=>(e>>>0)+(t>>>0)+(n>>>0);Be.add3L=O3;const M3=(e,t,n,r)=>t+n+r+(e/2**32|0)|0;Be.add3H=M3;const B3=(e,t,n,r)=>(e>>>0)+(t>>>0)+(n>>>0)+(r>>>0);Be.add4L=B3;const N3=(e,t,n,r,i)=>t+n+r+i+(e/2**32|0)|0;Be.add4H=N3;const L3=(e,t,n,r,i)=>(e>>>0)+(t>>>0)+(n>>>0)+(r>>>0)+(i>>>0);Be.add5L=L3;const j3=(e,t,n,r,i,s)=>t+n+r+i+s+(e/2**32|0)|0;Be.add5H=j3;const PU={fromBig:Ky,split:y3,toBig:b3,shrSH:w3,shrSL:v3,rotrSH:_3,rotrSL:E3,rotrBH:x3,rotrBL:S3,rotr32H:k3,rotr32L:A3,rotlSH:I3,rotlSL:C3,rotlBH:P3,rotlBL:R3,add:T3,add3L:O3,add3H:M3,add4L:B3,add4H:N3,add5H:j3,add5L:L3};Be.default=PU;var $3={},oh={};Object.defineProperty(oh,"__esModule",{value:!0}),oh.crypto=void 0,oh.crypto=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0,function(e){/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */Object.defineProperty(e,"__esModule",{value:!0}),e.randomBytes=e.wrapXOFConstructorWithOpts=e.wrapConstructorWithOpts=e.wrapConstructor=e.checkOpts=e.Hash=e.concatBytes=e.toBytes=e.utf8ToBytes=e.asyncLoop=e.nextTick=e.hexToBytes=e.bytesToHex=e.byteSwap32=e.byteSwapIfBE=e.byteSwap=e.isLE=e.rotl=e.rotr=e.createView=e.u32=e.u8=e.isBytes=void 0;const t=oh,n=un;function r(G){return G instanceof Uint8Array||G!=null&&typeof G=="object"&&G.constructor.name==="Uint8Array"}e.isBytes=r;const i=G=>new Uint8Array(G.buffer,G.byteOffset,G.byteLength);e.u8=i;const s=G=>new Uint32Array(G.buffer,G.byteOffset,Math.floor(G.byteLength/4));e.u32=s;const o=G=>new DataView(G.buffer,G.byteOffset,G.byteLength);e.createView=o;const a=(G,C)=>G<<32-C|G>>>C;e.rotr=a;const c=(G,C)=>G<<C|G>>>32-C>>>0;e.rotl=c,e.isLE=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;const u=G=>G<<24&4278190080|G<<8&16711680|G>>>8&65280|G>>>24&255;e.byteSwap=u,e.byteSwapIfBE=e.isLE?G=>G:G=>(0,e.byteSwap)(G);function l(G){for(let C=0;C<G.length;C++)G[C]=(0,e.byteSwap)(G[C])}e.byteSwap32=l;const d=Array.from({length:256},(G,C)=>C.toString(16).padStart(2,"0"));function f(G){(0,n.bytes)(G);let C="";for(let p=0;p<G.length;p++)C+=d[G[p]];return C}e.bytesToHex=f;const h={_0:48,_9:57,_A:65,_F:70,_a:97,_f:102};function m(G){if(G>=h._0&&G<=h._9)return G-h._0;if(G>=h._A&&G<=h._F)return G-(h._A-10);if(G>=h._a&&G<=h._f)return G-(h._a-10)}function y(G){if(typeof G!="string")throw new Error("hex string expected, got "+typeof G);const C=G.length,p=C/2;if(C%2)throw new Error("padded hex string expected, got unpadded hex of length "+C);const g=new Uint8Array(p);for(let k=0,R=0;k<p;k++,R+=2){const T=m(G.charCodeAt(R)),M=m(G.charCodeAt(R+1));if(T===void 0||M===void 0){const $=G[R]+G[R+1];throw new Error('hex string expected, got non-hex character "'+$+'" at index '+R)}g[k]=T*16+M}return g}e.hexToBytes=y;const w=async()=>{};e.nextTick=w;async function b(G,C,p){let g=Date.now();for(let k=0;k<G;k++){p(k);const R=Date.now()-g;R>=0&&R<C||(await(0,e.nextTick)(),g+=R)}}e.asyncLoop=b;function x(G){if(typeof G!="string")throw new Error(`utf8ToBytes expected string, got ${typeof G}`);return new Uint8Array(new TextEncoder().encode(G))}e.utf8ToBytes=x;function v(G){return typeof G=="string"&&(G=x(G)),(0,n.bytes)(G),G}e.toBytes=v;function S(...G){let C=0;for(let g=0;g<G.length;g++){const k=G[g];(0,n.bytes)(k),C+=k.length}const p=new Uint8Array(C);for(let g=0,k=0;g<G.length;g++){const R=G[g];p.set(R,k),k+=R.length}return p}e.concatBytes=S;class I{clone(){return this._cloneInto()}}e.Hash=I;const N={}.toString;function j(G,C){if(C!==void 0&&N.call(C)!=="[object Object]")throw new Error("Options should be object or undefined");return Object.assign(G,C)}e.checkOpts=j;function U(G){const C=g=>G().update(v(g)).digest(),p=G();return C.outputLen=p.outputLen,C.blockLen=p.blockLen,C.create=()=>G(),C}e.wrapConstructor=U;function L(G){const C=(g,k)=>G(k).update(v(g)).digest(),p=G({});return C.outputLen=p.outputLen,C.blockLen=p.blockLen,C.create=g=>G(g),C}e.wrapConstructorWithOpts=L;function Y(G){const C=(g,k)=>G(k).update(v(g)).digest(),p=G({});return C.outputLen=p.outputLen,C.blockLen=p.blockLen,C.create=g=>G(g),C}e.wrapXOFConstructorWithOpts=Y;function Z(G=32){if(t.crypto&&typeof t.crypto.getRandomValues=="function")return t.crypto.getRandomValues(new Uint8Array(G));throw new Error("crypto.getRandomValues must be defined")}e.randomBytes=Z}($3),Object.defineProperty(St,"__esModule",{value:!0}),St.shake256=St.shake128=St.keccak_512=St.keccak_384=St.keccak_256=St.keccak_224=St.sha3_512=St.sha3_384=St.sha3_256=St.sha3_224=St.Keccak=St.keccakP=void 0;const za=un,Zu=Be,Li=$3,F3=[],D3=[],U3=[],RU=BigInt(0),Yu=BigInt(1),TU=BigInt(2),OU=BigInt(7),MU=BigInt(256),BU=BigInt(113);for(let e=0,t=Yu,n=1,r=0;e<24;e++){[n,r]=[r,(2*n+3*r)%5],F3.push(2*(5*r+n)),D3.push((e+1)*(e+2)/2%64);let i=RU;for(let s=0;s<7;s++)t=(t<<Yu^(t>>OU)*BU)%MU,t&TU&&(i^=Yu<<(Yu<<BigInt(s))-Yu);U3.push(i)}const[NU,LU]=(0,Zu.split)(U3,!0),H3=(e,t,n)=>n>32?(0,Zu.rotlBH)(e,t,n):(0,Zu.rotlSH)(e,t,n),z3=(e,t,n)=>n>32?(0,Zu.rotlBL)(e,t,n):(0,Zu.rotlSL)(e,t,n);function W3(e,t=24){const n=new Uint32Array(10);for(let r=24-t;r<24;r++){for(let o=0;o<10;o++)n[o]=e[o]^e[o+10]^e[o+20]^e[o+30]^e[o+40];for(let o=0;o<10;o+=2){const a=(o+8)%10,c=(o+2)%10,u=n[c],l=n[c+1],d=H3(u,l,1)^n[a],f=z3(u,l,1)^n[a+1];for(let h=0;h<50;h+=10)e[o+h]^=d,e[o+h+1]^=f}let i=e[2],s=e[3];for(let o=0;o<24;o++){const a=D3[o],c=H3(i,s,a),u=z3(i,s,a),l=F3[o];i=e[l],s=e[l+1],e[l]=c,e[l+1]=u}for(let o=0;o<50;o+=10){for(let a=0;a<10;a++)n[a]=e[o+a];for(let a=0;a<10;a++)e[o+a]^=~n[(a+2)%10]&n[(a+4)%10]}e[0]^=NU[r],e[1]^=LU[r]}n.fill(0)}St.keccakP=W3;let Jy=class xI extends Li.Hash{constructor(t,n,r,i=!1,s=24){if(super(),this.blockLen=t,this.suffix=n,this.outputLen=r,this.enableXOF=i,this.rounds=s,this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,(0,za.number)(r),0>=this.blockLen||this.blockLen>=200)throw new Error("Sha3 supports only keccak-f1600 function");this.state=new Uint8Array(200),this.state32=(0,Li.u32)(this.state)}keccak(){Li.isLE||(0,Li.byteSwap32)(this.state32),W3(this.state32,this.rounds),Li.isLE||(0,Li.byteSwap32)(this.state32),this.posOut=0,this.pos=0}update(t){(0,za.exists)(this);const{blockLen:n,state:r}=this;t=(0,Li.toBytes)(t);const i=t.length;for(let s=0;s<i;){const o=Math.min(n-this.pos,i-s);for(let a=0;a<o;a++)r[this.pos++]^=t[s++];this.pos===n&&this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;const{state:t,suffix:n,pos:r,blockLen:i}=this;t[r]^=n,n&128&&r===i-1&&this.keccak(),t[i-1]^=128,this.keccak()}writeInto(t){(0,za.exists)(this,!1),(0,za.bytes)(t),this.finish();const n=this.state,{blockLen:r}=this;for(let i=0,s=t.length;i<s;){this.posOut>=r&&this.keccak();const o=Math.min(r-this.posOut,s-i);t.set(n.subarray(this.posOut,this.posOut+o),i),this.posOut+=o,i+=o}return t}xofInto(t){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(t)}xof(t){return(0,za.number)(t),this.xofInto(new Uint8Array(t))}digestInto(t){if((0,za.output)(t,this),this.finished)throw new Error("digest() was already called");return this.writeInto(t),this.destroy(),t}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,this.state.fill(0)}_cloneInto(t){const{blockLen:n,suffix:r,outputLen:i,rounds:s,enableXOF:o}=this;return t||(t=new xI(n,r,i,o,s)),t.state32.set(this.state32),t.pos=this.pos,t.posOut=this.posOut,t.finished=this.finished,t.rounds=s,t.suffix=r,t.outputLen=i,t.enableXOF=o,t.destroyed=this.destroyed,t}};St.Keccak=Jy;const vs=(e,t,n)=>(0,Li.wrapConstructor)(()=>new Jy(t,e,n));St.sha3_224=vs(6,144,224/8),St.sha3_256=vs(6,136,256/8),St.sha3_384=vs(6,104,384/8),St.sha3_512=vs(6,72,512/8),St.keccak_224=vs(1,144,224/8),St.keccak_256=vs(1,136,256/8),St.keccak_384=vs(1,104,384/8),St.keccak_512=vs(1,72,512/8);const G3=(e,t,n)=>(0,Li.wrapXOFConstructorWithOpts)((r={})=>new Jy(t,e,r.dkLen===void 0?n:r.dkLen,!0));St.shake128=G3(31,168,128/8),St.shake256=G3(31,136,256/8);const{keccak_256:jU}=St;function q3(e){return Buffer.allocUnsafe(e).fill(0)}function $U(e){return`0x${e.toString(16)}`}function FU(e){const t=$U(e);return new Buffer(J3(t.slice(2)),"hex")}function DU(e){return e.toString(2).length}function V3(e,t){let n=e.toString(16);n.length%2!==0&&(n="0"+n);const r=n.match(/.{1,2}/g).map(i=>parseInt(i,16));for(;r.length<t;)r.unshift(0);return Buffer.from(r)}function UU(e,t){const n=e<0n;let r;if(n){const i=(1n<<BigInt(t))-1n;r=(~e&i)+1n}else r=e;return r&=(1n<<BigInt(t))-1n,r}function K3(e,t,n){const r=q3(t);return e=ah(e),n?e.length<t?(e.copy(r),r):e.slice(0,t):e.length<t?(e.copy(r,t-e.length),r):e.slice(-t)}function HU(e,t){return K3(e,t,!0)}function ah(e){if(!Buffer.isBuffer(e))if(Array.isArray(e))e=Buffer.from(e);else if(typeof e=="string")Z3(e)?e=Buffer.from(J3(Y3(e)),"hex"):e=Buffer.from(e);else if(typeof e=="number")e=FU(e);else if(e==null)e=Buffer.allocUnsafe(0);else if(typeof e=="bigint")e=V3(e);else if(e.toArray)e=Buffer.from(e.toArray());else throw new Error("invalid type");return e}function zU(e){return e=ah(e),"0x"+e.toString("hex")}function WU(e,t){if(e=ah(e),t||(t=256),t!==256)throw new Error("unsupported");return Buffer.from(jU(new Uint8Array(e)))}function J3(e){return e.length%2?"0"+e:e}function Z3(e){return typeof e=="string"&&e.match(/^0x[0-9A-Fa-f]*$/)}function Y3(e){return typeof e=="string"&&e.startsWith("0x")?e.slice(2):e}var Q3={zeros:q3,setLength:K3,setLengthRight:HU,isHexString:Z3,stripHexPrefix:Y3,toBuffer:ah,bufferToHex:zU,keccak:WU,bitLengthFromBigInt:DU,bufferBEFromBigInt:V3,twosFromBigInt:UU};const Ln=Q3;function X3(e){return e.startsWith("int[")?"int256"+e.slice(3):e==="int"?"int256":e.startsWith("uint[")?"uint256"+e.slice(4):e==="uint"?"uint256":e.startsWith("fixed[")?"fixed128x128"+e.slice(5):e==="fixed"?"fixed128x128":e.startsWith("ufixed[")?"ufixed128x128"+e.slice(6):e==="ufixed"?"ufixed128x128":e}function Wa(e){return Number.parseInt(/^\D+(\d+)$/.exec(e)[1],10)}function eS(e){var t=/^\D+(\d+)x(\d+)$/.exec(e);return[Number.parseInt(t[1],10),Number.parseInt(t[2],10)]}function tS(e){var t=e.match(/(.*)\[(.*?)\]$/);return t?t[2]===""?"dynamic":Number.parseInt(t[2],10):null}function wo(e){var t=typeof e;if(t==="string"||t==="number")return BigInt(e);if(t==="bigint")return e;throw new Error("Argument is not a number")}function Zr(e,t){var n,r,i,s;if(e==="address")return Zr("uint160",wo(t));if(e==="bool")return Zr("uint8",t?1:0);if(e==="string")return Zr("bytes",new Buffer(t,"utf8"));if(qU(e)){if(typeof t.length>"u")throw new Error("Not an array?");if(n=tS(e),n!=="dynamic"&&n!==0&&t.length>n)throw new Error("Elements exceed array size: "+n);i=[],e=e.slice(0,e.lastIndexOf("[")),typeof t=="string"&&(t=JSON.parse(t));for(s in t)i.push(Zr(e,t[s]));if(n==="dynamic"){var o=Zr("uint256",t.length);i.unshift(o)}return Buffer.concat(i)}else{if(e==="bytes")return t=new Buffer(t),i=Buffer.concat([Zr("uint256",t.length),t]),t.length%32!==0&&(i=Buffer.concat([i,Ln.zeros(32-t.length%32)])),i;if(e.startsWith("bytes")){if(n=Wa(e),n<1||n>32)throw new Error("Invalid bytes<N> width: "+n);return Ln.setLengthRight(t,32)}else if(e.startsWith("uint")){if(n=Wa(e),n%8||n<8||n>256)throw new Error("Invalid uint<N> width: "+n);r=wo(t);const a=Ln.bitLengthFromBigInt(r);if(a>n)throw new Error("Supplied uint exceeds width: "+n+" vs "+a);if(r<0)throw new Error("Supplied uint is negative");return Ln.bufferBEFromBigInt(r,32)}else if(e.startsWith("int")){if(n=Wa(e),n%8||n<8||n>256)throw new Error("Invalid int<N> width: "+n);r=wo(t);const a=Ln.bitLengthFromBigInt(r);if(a>n)throw new Error("Supplied int exceeds width: "+n+" vs "+a);const c=Ln.twosFromBigInt(r,256);return Ln.bufferBEFromBigInt(c,32)}else if(e.startsWith("ufixed")){if(n=eS(e),r=wo(t),r<0)throw new Error("Supplied ufixed is negative");return Zr("uint256",r*BigInt(2)**BigInt(n[1]))}else if(e.startsWith("fixed"))return n=eS(e),Zr("int256",wo(t)*BigInt(2)**BigInt(n[1]))}throw new Error("Unsupported or invalid type: "+e)}function GU(e){return e==="string"||e==="bytes"||tS(e)==="dynamic"}function qU(e){return e.lastIndexOf("]")===e.length-1}function VU(e,t){var n=[],r=[],i=32*e.length;for(var s in e){var o=X3(e[s]),a=t[s],c=Zr(o,a);GU(o)?(n.push(Zr("uint256",i)),r.push(c),i+=c.length):n.push(c)}return Buffer.concat(n.concat(r))}function nS(e,t){if(e.length!==t.length)throw new Error("Number of types are not matching the values");for(var n,r,i=[],s=0;s<e.length;s++){var o=X3(e[s]),a=t[s];if(o==="bytes")i.push(a);else if(o==="string")i.push(new Buffer(a,"utf8"));else if(o==="bool")i.push(new Buffer(a?"01":"00","hex"));else if(o==="address")i.push(Ln.setLength(a,20));else if(o.startsWith("bytes")){if(n=Wa(o),n<1||n>32)throw new Error("Invalid bytes<N> width: "+n);i.push(Ln.setLengthRight(a,n))}else if(o.startsWith("uint")){if(n=Wa(o),n%8||n<8||n>256)throw new Error("Invalid uint<N> width: "+n);r=wo(a);const c=Ln.bitLengthFromBigInt(r);if(c>n)throw new Error("Supplied uint exceeds width: "+n+" vs "+c);i.push(Ln.bufferBEFromBigInt(r,n/8))}else if(o.startsWith("int")){if(n=Wa(o),n%8||n<8||n>256)throw new Error("Invalid int<N> width: "+n);r=wo(a);const c=Ln.bitLengthFromBigInt(r);if(c>n)throw new Error("Supplied int exceeds width: "+n+" vs "+c);const u=Ln.twosFromBigInt(r,n);i.push(Ln.bufferBEFromBigInt(u,n/8))}else throw new Error("Unsupported or invalid type: "+o)}return Buffer.concat(i)}function KU(e,t){return Ln.keccak(nS(e,t))}var JU={rawEncode:VU,solidityPack:nS,soliditySHA3:KU};const jr=Q3,Qu=JU,rS={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"]},Zy={encodeData(e,t,n,r=!0){const i=["bytes32"],s=[this.hashType(e,n)];if(r){const o=(a,c,u)=>{if(n[c]!==void 0)return["bytes32",u==null?"0x0000000000000000000000000000000000000000000000000000000000000000":jr.keccak(this.encodeData(c,u,n,r))];if(u===void 0)throw new Error(`missing value for field ${a} of type ${c}`);if(c==="bytes")return["bytes32",jr.keccak(u)];if(c==="string")return typeof u=="string"&&(u=Buffer.from(u,"utf8")),["bytes32",jr.keccak(u)];if(c.lastIndexOf("]")===c.length-1){const l=c.slice(0,c.lastIndexOf("[")),d=u.map(f=>o(a,l,f));return["bytes32",jr.keccak(Qu.rawEncode(d.map(([f])=>f),d.map(([,f])=>f)))]}return[c,u]};for(const a of n[e]){const[c,u]=o(a.name,a.type,t[a.name]);i.push(c),s.push(u)}}else for(const o of n[e]){let a=t[o.name];if(a!==void 0)if(o.type==="bytes")i.push("bytes32"),a=jr.keccak(a),s.push(a);else if(o.type==="string")i.push("bytes32"),typeof a=="string"&&(a=Buffer.from(a,"utf8")),a=jr.keccak(a),s.push(a);else if(n[o.type]!==void 0)i.push("bytes32"),a=jr.keccak(this.encodeData(o.type,a,n,r)),s.push(a);else{if(o.type.lastIndexOf("]")===o.type.length-1)throw new Error("Arrays currently unimplemented in encodeData");i.push(o.type),s.push(a)}}return Qu.rawEncode(i,s)},encodeType(e,t){let n="",r=this.findTypeDependencies(e,t).filter(i=>i!==e);r=[e].concat(r.sort());for(const i of r){if(!t[i])throw new Error("No type definition specified: "+i);n+=i+"("+t[i].map(({name:o,type:a})=>a+" "+o).join(",")+")"}return n},findTypeDependencies(e,t,n=[]){if(e=e.match(/^\w*/)[0],n.includes(e)||t[e]===void 0)return n;n.push(e);for(const r of t[e])for(const i of this.findTypeDependencies(r.type,t,n))!n.includes(i)&&n.push(i);return n},hashStruct(e,t,n,r=!0){return jr.keccak(this.encodeData(e,t,n,r))},hashType(e,t){return jr.keccak(this.encodeType(e,t))},sanitizeData(e){const t={};for(const n in rS.properties)e[n]&&(t[n]=e[n]);return t.types&&(t.types=Object.assign({EIP712Domain:[]},t.types)),t},hash(e,t=!0){const n=this.sanitizeData(e),r=[Buffer.from("1901","hex")];return r.push(this.hashStruct("EIP712Domain",n.domain,n.types,t)),n.primaryType!=="EIP712Domain"&&r.push(this.hashStruct(n.primaryType,n.message,n.types,t)),jr.keccak(Buffer.concat(r))}};var ZU={TYPED_MESSAGE_SCHEMA:rS,TypedDataUtils:Zy,hashForSignTypedDataLegacy:function(e){return YU(e.data)},hashForSignTypedData_v3:function(e){return Zy.hash(e.data,!1)},hashForSignTypedData_v4:function(e){return Zy.hash(e.data)}};function YU(e){const t=new Error("Expect argument to be non-empty array");if(typeof e!="object"||!e.length)throw t;const n=e.map(function(s){return s.type==="bytes"?jr.toBuffer(s.value):s.value}),r=e.map(function(s){return s.type}),i=e.map(function(s){if(!s.name)throw t;return s.type+" "+s.name});return Qu.soliditySHA3(["bytes32","bytes32"],[Qu.soliditySHA3(new Array(e.length).fill("string"),i),Qu.soliditySHA3(r,n)])}const ch=B0(ZU),QU="walletUsername",Yy="Addresses",XU="AppVersion";class eH{constructor(t){this.secret=t}async encrypt(t){const n=this.secret;if(n.length!==64)throw new Error("secret must be 256 bits");const r=crypto.getRandomValues(new Uint8Array(12)),i=await crypto.subtle.importKey("raw",qf(n),{name:"aes-gcm"},!1,["encrypt","decrypt"]),s=new TextEncoder,o=await window.crypto.subtle.encrypt({name:"AES-GCM",iv:r},i,s.encode(t)),a=16,c=o.slice(o.byteLength-a),u=o.slice(0,o.byteLength-a),l=new Uint8Array(c),d=new Uint8Array(u),f=new Uint8Array([...r,...l,...d]);return Ny(f)}async decrypt(t){const n=this.secret;if(n.length!==64)throw new Error("secret must be 256 bits");return new Promise((r,i)=>{(async()=>{const s=await crypto.subtle.importKey("raw",qf(n),{name:"aes-gcm"},!1,["encrypt","decrypt"]),o=qf(t),a=o.slice(0,12),c=o.slice(12,28),u=o.slice(28),l=new Uint8Array([...u,...c]),d={name:"AES-GCM",iv:new Uint8Array(a)};try{const f=await window.crypto.subtle.decrypt(d,s,l),h=new TextDecoder;r(h.decode(f))}catch(f){i(f)}})()})}}let tH=class{constructor(t,n,r){this.linkAPIUrl=t,this.sessionId=n;const i=`${n}:${r}`;this.auth=`Basic ${btoa(i)}`}async markUnseenEventsAsSeen(t){return Promise.all(t.map(n=>fetch(`${this.linkAPIUrl}/events/${n.eventId}/seen`,{method:"POST",headers:{Authorization:this.auth}}))).catch(n=>console.error("Unable to mark events as seen:",n))}async fetchUnseenEvents(){var t;const n=await fetch(`${this.linkAPIUrl}/events?unseen=true`,{headers:{Authorization:this.auth}});if(n.ok){const{events:r,error:i}=await n.json();if(i)throw new Error(`Check unseen events failed: ${i}`);const s=(t=r==null?void 0:r.filter(o=>o.event==="Web3Response").map(o=>({type:"Event",sessionId:this.sessionId,eventId:o.id,event:o.event,data:o.data})))!==null&&t!==void 0?t:[];return this.markUnseenEventsAsSeen(s),s}throw new Error(`Check unseen events failed: ${n.status}`)}};var Yr;(function(e){e[e.DISCONNECTED=0]="DISCONNECTED",e[e.CONNECTING=1]="CONNECTING",e[e.CONNECTED=2]="CONNECTED"})(Yr||(Yr={}));let uh=class Qi{setConnectionStateListener(t){this.connectionStateListener=t}setIncomingDataListener(t){this.incomingDataListener=t}constructor(t,n=WebSocket){this.WebSocketClass=n,this.webSocket=null,this.isDisconnecting=!1,this.url=t.replace(/^http/,"ws"),this.instanceId=Qi.instanceCounter++,Qi.activeInstances.add(this.instanceId)}async connect(){if(this.webSocket)throw new Error("webSocket object is not null");if(this.isDisconnecting)throw new Error("WebSocket is disconnecting, cannot reconnect on same instance");return new Promise((t,n)=>{var r;let i;try{this.webSocket=i=new this.WebSocketClass(this.url)}catch(s){n(s);return}(r=this.connectionStateListener)===null||r===void 0||r.call(this,Yr.CONNECTING),i.onclose=s=>{var o;this.clearWebSocket(),i.readyState!==WebSocket.OPEN&&n(new Error(`websocket error ${s.code}: ${s.reason}`)),(o=this.connectionStateListener)===null||o===void 0||o.call(this,Yr.DISCONNECTED)},i.onopen=s=>{var o;t(),(o=this.connectionStateListener)===null||o===void 0||o.call(this,Yr.CONNECTED),Qi.pendingData.length>0&&([...Qi.pendingData].forEach(c=>this.sendData(c)),Qi.pendingData=[])},i.onmessage=s=>{var o,a;if(s.data==="h")(o=this.incomingDataListener)===null||o===void 0||o.call(this,{type:"Heartbeat"});else try{const c=JSON.parse(s.data);(a=this.incomingDataListener)===null||a===void 0||a.call(this,c)}catch{}}})}disconnect(){var t;const{webSocket:n}=this;if(n){this.isDisconnecting=!0,this.clearWebSocket(),(t=this.connectionStateListener)===null||t===void 0||t.call(this,Yr.DISCONNECTED),this.connectionStateListener=void 0,this.incomingDataListener=void 0;try{n.close()}catch{}}}sendData(t){const{webSocket:n}=this;if(!n){Qi.pendingData.push(t),this.isDisconnecting||this.connect();return}if(n.readyState!==WebSocket.OPEN){Qi.pendingData.push(t);return}n.send(t)}clearWebSocket(){const{webSocket:t}=this;t&&(this.webSocket=null,t.onclose=null,t.onerror=null,t.onmessage=null,t.onopen=null)}cleanup(){Qi.activeInstances.delete(this.instanceId)}};uh.instanceCounter=0,uh.activeInstances=new Set,uh.pendingData=[];const iS=1e4,nH=6e4;let rH=class{constructor({session:t,linkAPIUrl:n,listener:r}){this.destroyed=!1,this.lastHeartbeatResponse=0,this.nextReqId=Ni(1),this.reconnectAttempts=0,this.isReconnecting=!1,this._connected=!1,this._linked=!1,this.requestResolutions=new Map,this.handleSessionMetadataUpdated=s=>{if(!s)return;new Map([["__destroyed",this.handleDestroyed],["EthereumAddress",this.handleAccountUpdated],["WalletUsername",this.handleWalletUsernameUpdated],["AppVersion",this.handleAppVersionUpdated],["ChainId",a=>s.JsonRpcUrl&&this.handleChainUpdated(a,s.JsonRpcUrl)]]).forEach((a,c)=>{const u=s[c];u!==void 0&&a(u)})},this.handleDestroyed=s=>{var o;s==="1"&&((o=this.listener)===null||o===void 0||o.resetAndReload())},this.handleAccountUpdated=async s=>{var o;try{const a=await this.cipher.decrypt(s);(o=this.listener)===null||o===void 0||o.accountUpdated(a)}catch{}},this.handleMetadataUpdated=async(s,o)=>{var a;try{const c=await this.cipher.decrypt(o);(a=this.listener)===null||a===void 0||a.metadataUpdated(s,c)}catch{}},this.handleWalletUsernameUpdated=async s=>{this.handleMetadataUpdated(QU,s)},this.handleAppVersionUpdated=async s=>{this.handleMetadataUpdated(XU,s)},this.handleChainUpdated=async(s,o)=>{var a;try{const c=await this.cipher.decrypt(s),u=await this.cipher.decrypt(o);(a=this.listener)===null||a===void 0||a.chainUpdated(c,u)}catch{}},this.session=t,this.cipher=new eH(t.secret),this.listener=r,this.linkAPIUrl=n,this.WebSocketClass=WebSocket;const i=this.createWebSocket();this.ws=i,this.http=new tH(n,t.id,t.key),this.setupVisibilityChangeHandler()}createWebSocket(){const t=new uh(`${this.linkAPIUrl}/rpc`,this.WebSocketClass);return this.activeWsInstance=t,t.setConnectionStateListener(async n=>{if(t!==this.activeWsInstance)return;let r=!1;switch(n){case Yr.DISCONNECTED:this.heartbeatIntervalId&&(clearInterval(this.heartbeatIntervalId),this.heartbeatIntervalId=void 0),this.lastHeartbeatResponse=0,r=!1,this.destroyed||(async()=>{if(this.isReconnecting)return;this.isReconnecting=!0;const s=this.reconnectAttempts===0?0:3e3;await new Promise(o=>setTimeout(o,s)),!this.destroyed&&t===this.activeWsInstance?(this.reconnectAttempts++,"cleanup"in this.ws&&typeof this.ws.cleanup=="function"&&this.ws.cleanup(),this.ws=this.createWebSocket(),this.ws.connect().catch(()=>{d3()}).finally(()=>{this.isReconnecting=!1})):this.isReconnecting=!1})();break;case Yr.CONNECTED:this.reconnectAttempts=0;try{r=await this.handleConnected(),this.fetchUnseenEventsAPI().catch(()=>{})}catch{break}this.connected=r,this.updateLastHeartbeat(),this.heartbeatIntervalId&&clearInterval(this.heartbeatIntervalId),this.heartbeatIntervalId=window.setInterval(()=>{this.heartbeat()},iS),setTimeout(()=>{this.heartbeat()},100);break;case Yr.CONNECTING:break}n!==Yr.CONNECTED&&(this.connected=r)}),t.setIncomingDataListener(n=>{var r;switch(n.type){case"Heartbeat":this.updateLastHeartbeat();return;case"IsLinkedOK":case"Linked":{const i=n.type==="IsLinkedOK"?n.linked:void 0;this.linked=i||n.onlineGuests>0;break}case"GetSessionConfigOK":case"SessionConfigUpdated":{this.handleSessionMetadataUpdated(n.metadata);break}case"Event":{this.handleIncomingEvent(n);break}}n.id!==void 0&&((r=this.requestResolutions.get(n.id))===null||r===void 0||r(n))}),t}setupVisibilityChangeHandler(){this.visibilityChangeHandler=()=>{!document.hidden&&!this.destroyed&&(this.connected?this.heartbeat():this.reconnectWithFreshWebSocket())},this.focusHandler=()=>{!this.destroyed&&!this.connected&&this.reconnectWithFreshWebSocket()},document.addEventListener("visibilitychange",this.visibilityChangeHandler),window.addEventListener("focus",this.focusHandler),window.addEventListener("pageshow",t=>{t.persisted&&this.focusHandler&&this.focusHandler()})}reconnectWithFreshWebSocket(){if(this.destroyed)return;const t=this.ws;this.activeWsInstance=void 0,t.disconnect(),"cleanup"in t&&typeof t.cleanup=="function"&&t.cleanup(),this.ws=this.createWebSocket(),this.ws.connect().catch(()=>{d3()})}connect(){if(this.destroyed)throw new Error("instance is destroyed");this.ws.connect()}async destroy(){this.destroyed||(await this.makeRequest({type:"SetSessionConfig",id:Ni(this.nextReqId++),sessionId:this.session.id,metadata:{__destroyed:"1"}},{timeout:1e3}),this.destroyed=!0,this.activeWsInstance=void 0,this.heartbeatIntervalId&&(clearInterval(this.heartbeatIntervalId),this.heartbeatIntervalId=void 0),this.visibilityChangeHandler&&document.removeEventListener("visibilitychange",this.visibilityChangeHandler),this.focusHandler&&window.removeEventListener("focus",this.focusHandler),this.ws.disconnect(),"cleanup"in this.ws&&typeof this.ws.cleanup=="function"&&this.ws.cleanup(),this.listener=void 0)}get connected(){return this._connected}set connected(t){this._connected=t}get linked(){return this._linked}set linked(t){var n,r;this._linked=t,t&&((n=this.onceLinked)===null||n===void 0||n.call(this)),(r=this.listener)===null||r===void 0||r.linkedUpdated(t)}setOnceLinked(t){return new Promise(n=>{this.linked?t().then(n):this.onceLinked=()=>{t().then(n),this.onceLinked=void 0}})}async handleIncomingEvent(t){var n;if(!(t.type!=="Event"||t.event!=="Web3Response"))try{const r=await this.cipher.decrypt(t.data),i=JSON.parse(r);if(i.type!=="WEB3_RESPONSE")return;(n=this.listener)===null||n===void 0||n.handleWeb3ResponseMessage(i.id,i.response)}catch{}}async checkUnseenEvents(){await new Promise(t=>setTimeout(t,250));try{await this.fetchUnseenEventsAPI()}catch(t){console.error("Unable to check for unseen events",t)}}async fetchUnseenEventsAPI(){try{(await this.http.fetchUnseenEvents()).forEach(n=>{this.handleIncomingEvent(n)})}catch{IU()}}async publishEvent(t,n,r=!1){const i=await this.cipher.encrypt(JSON.stringify(Object.assign(Object.assign({},n),{origin:location.origin,location:location.href,relaySource:"coinbaseWalletExtension"in window&&window.coinbaseWalletExtension?"injected_sdk":"sdk"}))),s={type:"PublishEvent",id:Ni(this.nextReqId++),sessionId:this.session.id,event:t,data:i,callWebhook:r};return this.setOnceLinked(async()=>{const o=await this.makeRequest(s);if(o.type==="Fail")throw new Error(o.error||"failed to publish event");return o.eventId})}sendData(t){this.ws.sendData(JSON.stringify(t))}updateLastHeartbeat(){this.lastHeartbeatResponse=Date.now()}heartbeat(){if(Date.now()-this.lastHeartbeatResponse>iS*2){this.ws.disconnect();return}if(this.connected)try{this.ws.sendData("h")}catch{}}async makeRequest(t,n={timeout:nH}){const r=t.id;this.sendData(t);let i;return Promise.race([new Promise((s,o)=>{i=window.setTimeout(()=>{o(new Error(`request ${r} timed out`))},n.timeout)}),new Promise(s=>{this.requestResolutions.set(r,o=>{clearTimeout(i),s(o),this.requestResolutions.delete(r)})})])}async handleConnected(){return(await this.makeRequest({type:"HostSession",id:Ni(this.nextReqId++),sessionId:this.session.id,sessionKey:this.session.key})).type==="Fail"?!1:(this.sendData({type:"IsLinked",id:Ni(this.nextReqId++),sessionId:this.session.id}),this.sendData({type:"GetSessionConfig",id:Ni(this.nextReqId++),sessionId:this.session.id}),!0)}},iH=class{constructor(){this._nextRequestId=0,this.callbacks=new Map}makeRequestId(){this._nextRequestId=(this._nextRequestId+1)%2147483647;const t=this._nextRequestId,n=Nx(t.toString(16));return this.callbacks.get(n)&&this.callbacks.delete(n),t}};function sH(e){return e instanceof Uint8Array||e!=null&&typeof e=="object"&&e.constructor.name==="Uint8Array"}function Qy(e,...t){if(!sH(e))throw new Error("Uint8Array expected");if(t.length>0&&!t.includes(e.length))throw new Error(`Uint8Array expected of length ${t}, not of length=${e.length}`)}function sS(e,t=!0){if(e.destroyed)throw new Error("Hash instance has been destroyed");if(t&&e.finished)throw new Error("Hash#digest() has already been called")}function oH(e,t){Qy(e);const n=t.outputLen;if(e.length<n)throw new Error(`digestInto() expects output buffer of length at least ${n}`)}/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */const Xy=e=>new DataView(e.buffer,e.byteOffset,e.byteLength),Qr=(e,t)=>e<<32-t|e>>>t;new Uint8Array(new Uint32Array([287454020]).buffer)[0];const aH=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function cH(e){Qy(e);let t="";for(let n=0;n<e.length;n++)t+=aH[e[n]];return t}function uH(e){if(typeof e!="string")throw new Error(`utf8ToBytes expected string, got ${typeof e}`);return new Uint8Array(new TextEncoder().encode(e))}function oS(e){return typeof e=="string"&&(e=uH(e)),Qy(e),e}let lH=class{clone(){return this._cloneInto()}};function dH(e){const t=r=>e().update(oS(r)).digest(),n=e();return t.outputLen=n.outputLen,t.blockLen=n.blockLen,t.create=()=>e(),t}function fH(e,t,n,r){if(typeof e.setBigUint64=="function")return e.setBigUint64(t,n,r);const i=BigInt(32),s=BigInt(4294967295),o=Number(n>>i&s),a=Number(n&s),c=r?4:0,u=r?0:4;e.setUint32(t+c,o,r),e.setUint32(t+u,a,r)}const hH=(e,t,n)=>e&t^~e&n,pH=(e,t,n)=>e&t^e&n^t&n;class mH extends lH{constructor(t,n,r,i){super(),this.blockLen=t,this.outputLen=n,this.padOffset=r,this.isLE=i,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(t),this.view=Xy(this.buffer)}update(t){sS(this);const{view:n,buffer:r,blockLen:i}=this;t=oS(t);const s=t.length;for(let o=0;o<s;){const a=Math.min(i-this.pos,s-o);if(a===i){const c=Xy(t);for(;i<=s-o;o+=i)this.process(c,o);continue}r.set(t.subarray(o,o+a),this.pos),this.pos+=a,o+=a,this.pos===i&&(this.process(n,0),this.pos=0)}return this.length+=t.length,this.roundClean(),this}digestInto(t){sS(this),oH(t,this),this.finished=!0;const{buffer:n,view:r,blockLen:i,isLE:s}=this;let{pos:o}=this;n[o++]=128,this.buffer.subarray(o).fill(0),this.padOffset>i-o&&(this.process(r,0),o=0);for(let d=o;d<i;d++)n[d]=0;fH(r,i-8,BigInt(this.length*8),s),this.process(r,0);const a=Xy(t),c=this.outputLen;if(c%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const u=c/4,l=this.get();if(u>l.length)throw new Error("_sha2: outputLen bigger than state");for(let d=0;d<u;d++)a.setUint32(4*d,l[d],s)}digest(){const{buffer:t,outputLen:n}=this;this.digestInto(t);const r=t.slice(0,n);return this.destroy(),r}_cloneInto(t){t||(t=new this.constructor),t.set(...this.get());const{blockLen:n,buffer:r,length:i,finished:s,destroyed:o,pos:a}=this;return t.length=i,t.pos=a,t.finished=s,t.destroyed=o,i%n&&t.buffer.set(r),t}}const gH=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]),_s=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),Es=new Uint32Array(64);class yH extends mH{constructor(){super(64,32,8,!1),this.A=_s[0]|0,this.B=_s[1]|0,this.C=_s[2]|0,this.D=_s[3]|0,this.E=_s[4]|0,this.F=_s[5]|0,this.G=_s[6]|0,this.H=_s[7]|0}get(){const{A:t,B:n,C:r,D:i,E:s,F:o,G:a,H:c}=this;return[t,n,r,i,s,o,a,c]}set(t,n,r,i,s,o,a,c){this.A=t|0,this.B=n|0,this.C=r|0,this.D=i|0,this.E=s|0,this.F=o|0,this.G=a|0,this.H=c|0}process(t,n){for(let d=0;d<16;d++,n+=4)Es[d]=t.getUint32(n,!1);for(let d=16;d<64;d++){const f=Es[d-15],h=Es[d-2],m=Qr(f,7)^Qr(f,18)^f>>>3,y=Qr(h,17)^Qr(h,19)^h>>>10;Es[d]=y+Es[d-7]+m+Es[d-16]|0}let{A:r,B:i,C:s,D:o,E:a,F:c,G:u,H:l}=this;for(let d=0;d<64;d++){const f=Qr(a,6)^Qr(a,11)^Qr(a,25),h=l+f+hH(a,c,u)+gH[d]+Es[d]|0,y=(Qr(r,2)^Qr(r,13)^Qr(r,22))+pH(r,i,s)|0;l=u,u=c,c=a,a=o+h|0,o=s,s=i,i=r,r=h+y|0}r=r+this.A|0,i=i+this.B|0,s=s+this.C|0,o=o+this.D|0,a=a+this.E|0,c=c+this.F|0,u=u+this.G|0,l=l+this.H|0,this.set(r,i,s,o,a,c,u,l)}roundClean(){Es.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}}const bH=dH(()=>new yH),aS="session:id",cS="session:secret",uS="session:linked";class Ga{constructor(t,n,r,i=!1){this.storage=t,this.id=n,this.secret=r,this.key=cH(bH(`${n}, ${r} WalletLink`)),this._linked=!!i}static create(t){const n=yo(16),r=yo(32);return new Ga(t,n,r).save()}static load(t){const n=t.getItem(aS),r=t.getItem(uS),i=t.getItem(cS);return n&&i?new Ga(t,n,i,r==="1"):null}get linked(){return this._linked}set linked(t){this._linked=t,this.persistLinked()}save(){return this.storage.setItem(aS,this.id),this.storage.setItem(cS,this.secret),this.persistLinked(),this}persistLinked(){this.storage.setItem(uS,this._linked?"1":"0")}}const wH=".-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}";let vH=class{constructor(){this.root=null,this.darkMode=Dx()}attach(){const t=document.documentElement;this.root=document.createElement("div"),this.root.className="-cbwsdk-css-reset",t.appendChild(this.root),Fx()}present(t){this.render(t)}clear(){this.render(null)}render(t){this.root&&(jg(null,this.root),t&&jg(gt(_H,Object.assign({},t,{onDismiss:()=>{this.clear()},darkMode:this.darkMode})),this.root))}};const _H=({title:e,buttonText:t,darkMode:n,onButtonClick:r,onDismiss:i})=>{const s=n?"dark":"light";return gt(Hx,{darkMode:n},gt("div",{class:"-cbwsdk-redirect-dialog"},gt("style",null,wH),gt("div",{class:"-cbwsdk-redirect-dialog-backdrop",onClick:i}),gt("div",{class:lo("-cbwsdk-redirect-dialog-box",s)},gt("p",null,e),gt("button",{onClick:r},t))))};class lS{constructor(){this.attached=!1,this.redirectDialog=new vH}attach(){if(this.attached)throw new Error("Coinbase Wallet SDK UI is already attached");this.redirectDialog.attach(),this.attached=!0}redirectToCoinbaseWallet(t){const n=new URL(VF);n.searchParams.append("redirect_url",XF().href),t&&n.searchParams.append("wl_url",t);const r=document.createElement("a");r.target="cbw-opener",r.href=n.href,r.rel="noreferrer noopener",r.click()}openCoinbaseWalletDeeplink(t){this.redirectToCoinbaseWallet(t),setTimeout(()=>{this.redirectDialog.present({title:"Redirecting to Coinbase Wallet...",buttonText:"Open",onButtonClick:()=>{this.redirectToCoinbaseWallet(t)}})},99)}showConnecting(t){return()=>{this.redirectDialog.clear()}}}let dS=class Ko{constructor(t){this.chainCallbackParams={chainId:"",jsonRpcUrl:""},this.isMobileWeb=eD(),this.linkedUpdated=s=>{this.isLinked=s;const o=this.storage.getItem(Yy);if(s&&(this._session.linked=s),this.isUnlinkedErrorState=!1,o){const a=o.split(" "),c=this.storage.getItem("IsStandaloneSigning")==="true";a[0]!==""&&!s&&this._session.linked&&!c&&(this.isUnlinkedErrorState=!0)}},this.metadataUpdated=(s,o)=>{this.storage.setItem(s,o)},this.chainUpdated=(s,o)=>{this.chainCallbackParams.chainId===s&&this.chainCallbackParams.jsonRpcUrl===o||(this.chainCallbackParams={chainId:s,jsonRpcUrl:o},this.chainCallback&&this.chainCallback(o,Number.parseInt(s,10)))},this.accountUpdated=s=>{this.accountsCallback&&this.accountsCallback([s]),Ko.accountRequestCallbackIds.size>0&&(Array.from(Ko.accountRequestCallbackIds.values()).forEach(o=>{this.invokeCallback(o,{method:"requestEthereumAccounts",result:[s]})}),Ko.accountRequestCallbackIds.clear())},this.resetAndReload=this.resetAndReload.bind(this),this.linkAPIUrl=t.linkAPIUrl,this.storage=t.storage,this.metadata=t.metadata,this.accountsCallback=t.accountsCallback,this.chainCallback=t.chainCallback;const{session:n,ui:r,connection:i}=this.subscribe();this._session=n,this.connection=i,this.relayEventManager=new iH,this.ui=r,this.ui.attach()}subscribe(){const t=Ga.load(this.storage)||Ga.create(this.storage),{linkAPIUrl:n}=this,r=new rH({session:t,linkAPIUrl:n,listener:this}),i=this.isMobileWeb?new lS:new sD;return r.connect(),{session:t,ui:i,connection:r}}resetAndReload(){this.connection.destroy().then(()=>{const t=Ga.load(this.storage);(t==null?void 0:t.id)===this._session.id&&Jf.clearAll(),document.location.reload()}).catch(t=>{})}signEthereumTransaction(t){return this.sendRequest({method:"signEthereumTransaction",params:{fromAddress:t.fromAddress,toAddress:t.toAddress,weiValue:Jr(t.weiValue),data:Wu(t.data,!0),nonce:t.nonce,gasPriceInWei:t.gasPriceInWei?Jr(t.gasPriceInWei):null,maxFeePerGas:t.gasPriceInWei?Jr(t.gasPriceInWei):null,maxPriorityFeePerGas:t.gasPriceInWei?Jr(t.gasPriceInWei):null,gasLimit:t.gasLimit?Jr(t.gasLimit):null,chainId:t.chainId,shouldSubmit:!1}})}signAndSubmitEthereumTransaction(t){return this.sendRequest({method:"signEthereumTransaction",params:{fromAddress:t.fromAddress,toAddress:t.toAddress,weiValue:Jr(t.weiValue),data:Wu(t.data,!0),nonce:t.nonce,gasPriceInWei:t.gasPriceInWei?Jr(t.gasPriceInWei):null,maxFeePerGas:t.maxFeePerGas?Jr(t.maxFeePerGas):null,maxPriorityFeePerGas:t.maxPriorityFeePerGas?Jr(t.maxPriorityFeePerGas):null,gasLimit:t.gasLimit?Jr(t.gasLimit):null,chainId:t.chainId,shouldSubmit:!0}})}submitEthereumTransaction(t,n){return this.sendRequest({method:"submitEthereumTransaction",params:{signedTransaction:Wu(t,!0),chainId:n}})}getWalletLinkSession(){return this._session}sendRequest(t){let n=null;const r=yo(8),i=s=>{this.publishWeb3RequestCanceledEvent(r),this.handleErrorResponse(r,t.method,s),n==null||n()};return new Promise((s,o)=>{n=this.ui.showConnecting({isUnlinkedErrorState:this.isUnlinkedErrorState,onCancel:i,onResetConnection:this.resetAndReload}),this.relayEventManager.callbacks.set(r,a=>{if(n==null||n(),gn(a))return o(new Error(a.errorMessage));s(a)}),this.publishWeb3RequestEvent(r,t)})}publishWeb3RequestEvent(t,n){const r={type:"WEB3_REQUEST",id:t,request:n};this.publishEvent("Web3Request",r,!0).then(i=>{}).catch(i=>{this.handleWeb3ResponseMessage(r.id,{method:n.method,errorMessage:i.message})}),this.isMobileWeb&&this.openCoinbaseWalletDeeplink(n.method)}openCoinbaseWalletDeeplink(t){if(this.ui instanceof lS)switch(t){case"requestEthereumAccounts":case"switchEthereumChain":return;default:window.addEventListener("blur",()=>{window.addEventListener("focus",()=>{this.connection.checkUnseenEvents()},{once:!0})},{once:!0}),this.ui.openCoinbaseWalletDeeplink();break}}publishWeb3RequestCanceledEvent(t){const n={type:"WEB3_REQUEST_CANCELED",id:t};this.publishEvent("Web3RequestCanceled",n,!1).then()}publishEvent(t,n,r){return this.connection.publishEvent(t,n,r)}handleWeb3ResponseMessage(t,n){if(n.method==="requestEthereumAccounts"){Ko.accountRequestCallbackIds.forEach(r=>this.invokeCallback(r,n)),Ko.accountRequestCallbackIds.clear();return}this.invokeCallback(t,n)}handleErrorResponse(t,n,r){var i;const s=(i=r==null?void 0:r.message)!==null&&i!==void 0?i:"Unspecified error message.";this.handleWeb3ResponseMessage(t,{method:n,errorMessage:s})}invokeCallback(t,n){const r=this.relayEventManager.callbacks.get(t);r&&(r(n),this.relayEventManager.callbacks.delete(t))}requestEthereumAccounts(){const{appName:t,appLogoUrl:n}=this.metadata,r={method:"requestEthereumAccounts",params:{appName:t,appLogoUrl:n}},i=yo(8);return new Promise((s,o)=>{this.relayEventManager.callbacks.set(i,a=>{if(gn(a))return o(new Error(a.errorMessage));s(a)}),Ko.accountRequestCallbackIds.add(i),this.publishWeb3RequestEvent(i,r)})}watchAsset(t,n,r,i,s,o){const a={method:"watchAsset",params:{type:t,options:{address:n,symbol:r,decimals:i,image:s},chainId:o}};let c=null;const u=yo(8),l=d=>{this.publishWeb3RequestCanceledEvent(u),this.handleErrorResponse(u,a.method,d),c==null||c()};return c=this.ui.showConnecting({isUnlinkedErrorState:this.isUnlinkedErrorState,onCancel:l,onResetConnection:this.resetAndReload}),new Promise((d,f)=>{this.relayEventManager.callbacks.set(u,h=>{if(c==null||c(),gn(h))return f(new Error(h.errorMessage));d(h)}),this.publishWeb3RequestEvent(u,a)})}addEthereumChain(t,n,r,i,s,o){const a={method:"addEthereumChain",params:{chainId:t,rpcUrls:n,blockExplorerUrls:i,chainName:s,iconUrls:r,nativeCurrency:o}};let c=null;const u=yo(8),l=d=>{this.publishWeb3RequestCanceledEvent(u),this.handleErrorResponse(u,a.method,d),c==null||c()};return c=this.ui.showConnecting({isUnlinkedErrorState:this.isUnlinkedErrorState,onCancel:l,onResetConnection:this.resetAndReload}),new Promise((d,f)=>{this.relayEventManager.callbacks.set(u,h=>{if(c==null||c(),gn(h))return f(new Error(h.errorMessage));d(h)}),this.publishWeb3RequestEvent(u,a)})}switchEthereumChain(t,n){const r={method:"switchEthereumChain",params:Object.assign({chainId:t},{address:n})};let i=null;const s=yo(8),o=a=>{this.publishWeb3RequestCanceledEvent(s),this.handleErrorResponse(s,r.method,a),i==null||i()};return i=this.ui.showConnecting({isUnlinkedErrorState:this.isUnlinkedErrorState,onCancel:o,onResetConnection:this.resetAndReload}),new Promise((a,c)=>{this.relayEventManager.callbacks.set(s,u=>{if(i==null||i(),gn(u)&&u.errorCode)return c(he.provider.custom({code:u.errorCode,message:"Unrecognized chain ID. Try adding the chain using addEthereumChain first."}));if(gn(u))return c(new Error(u.errorMessage));a(u)}),this.publishWeb3RequestEvent(s,r)})}};dS.accountRequestCallbackIds=new Set;const fS="DefaultChainId",hS="DefaultJsonRpcUrl";class pS{constructor(t){this._relay=null,this._addresses=[],this.metadata=t.metadata,this._storage=new Jf("walletlink",$x),this.callback=t.callback||null;const n=this._storage.getItem(Yy);if(n){const r=n.split(" ");r[0]!==""&&(this._addresses=r.map(i=>bs(i)))}this.initializeRelay()}getSession(){const t=this.initializeRelay(),{id:n,secret:r}=t.getWalletLinkSession();return{id:n,secret:r}}async handshake(t){const n="eth_requestAccounts",r=Nr.get(t);_U({method:n,correlationId:r});try{await this._eth_requestAccounts(),xU({method:n,correlationId:r})}catch(i){throw EU({method:n,correlationId:r,errorMessage:bo(i)}),i}}get selectedAddress(){return this._addresses[0]||void 0}get jsonRpcUrl(){var t;return(t=this._storage.getItem(hS))!==null&&t!==void 0?t:void 0}set jsonRpcUrl(t){this._storage.setItem(hS,t)}updateProviderInfo(t,n){var r;this.jsonRpcUrl=t;const i=this.getChainId();this._storage.setItem(fS,n.toString(10)),Gu(n)!==i&&((r=this.callback)===null||r===void 0||r.call(this,"chainChanged",Da(n)))}async watchAsset(t){const n=Array.isArray(t)?t[0]:t;if(!n.type)throw he.rpc.invalidParams("Type is required");if((n==null?void 0:n.type)!=="ERC20")throw he.rpc.invalidParams(`Asset of type '${n.type}' is not supported`);if(!(n!=null&&n.options))throw he.rpc.invalidParams("Options are required");if(!(n!=null&&n.options.address))throw he.rpc.invalidParams("Address is required");const r=this.getChainId(),{address:i,symbol:s,image:o,decimals:a}=n.options,u=await this.initializeRelay().watchAsset(n.type,i,s,a,o,r==null?void 0:r.toString());return gn(u)?!1:!!u.result}async addEthereumChain(t){var n,r;const i=t[0];if(((n=i.rpcUrls)===null||n===void 0?void 0:n.length)===0)throw he.rpc.invalidParams("please pass in at least 1 rpcUrl");if(!i.chainName||i.chainName.trim()==="")throw he.rpc.invalidParams("chainName is a required field");if(!i.nativeCurrency)throw he.rpc.invalidParams("nativeCurrency is a required field");const s=Number.parseInt(i.chainId,16);if(s===this.getChainId())return!1;const o=this.initializeRelay(),{rpcUrls:a=[],blockExplorerUrls:c=[],chainName:u,iconUrls:l=[],nativeCurrency:d}=i,f=await o.addEthereumChain(s.toString(),a,l,c,u,d);if(gn(f))return!1;if(((r=f.result)===null||r===void 0?void 0:r.isApproved)===!0)return this.updateProviderInfo(a[0],s),null;throw he.rpc.internal("unable to add ethereum chain")}async switchEthereumChain(t){const n=t[0],r=Number.parseInt(n.chainId,16),s=await this.initializeRelay().switchEthereumChain(r.toString(10),this.selectedAddress||void 0);if(gn(s))throw s;const o=s.result;return o.isApproved&&o.rpcUrl.length>0&&this.updateProviderInfo(o.rpcUrl,r),null}async cleanup(){this.callback=null,this._relay&&this._relay.resetAndReload(),this._storage.clear()}_setAddresses(t,n){var r;if(!Array.isArray(t))throw new Error("addresses is not an array");const i=t.map(s=>bs(s));JSON.stringify(i)!==JSON.stringify(this._addresses)&&(this._addresses=i,(r=this.callback)===null||r===void 0||r.call(this,"accountsChanged",i),this._storage.setItem(Yy,i.join(" ")))}async request(t){const n=Nr.get(t);SU({method:t.method,correlationId:n});try{const r=await this._request(t);return AU({method:t.method,correlationId:n}),r}catch(r){throw kU({method:t.method,correlationId:n,errorMessage:bo(r)}),r}}async _request(t){const n=t.params||[];switch(t.method){case"eth_accounts":return[...this._addresses];case"eth_coinbase":return this.selectedAddress||null;case"net_version":return this.getChainId().toString(10);case"eth_chainId":return Da(this.getChainId());case"eth_requestAccounts":return this._eth_requestAccounts();case"eth_ecRecover":case"personal_ecRecover":return this.ecRecover(t);case"personal_sign":return this.personalSign(t);case"eth_signTransaction":return this._eth_signTransaction(n);case"eth_sendRawTransaction":return this._eth_sendRawTransaction(n);case"eth_sendTransaction":return this._eth_sendTransaction(n);case"eth_signTypedData_v1":case"eth_signTypedData_v3":case"eth_signTypedData_v4":case"eth_signTypedData":return this.signTypedData(t);case"wallet_addEthereumChain":return this.addEthereumChain(n);case"wallet_switchEthereumChain":return this.switchEthereumChain(n);case"wallet_watchAsset":return this.watchAsset(n);default:if(!this.jsonRpcUrl)throw he.rpc.internal("No RPC URL set for chain");return Vu(t,this.jsonRpcUrl)}}_ensureKnownAddress(t){const n=bs(t);if(!this._addresses.map(i=>bs(i)).includes(n))throw new Error("Unknown Ethereum address")}_prepareTransactionParams(t){const n=t.from?bs(t.from):this.selectedAddress;if(!n)throw new Error("Ethereum address is unavailable");this._ensureKnownAddress(n);const r=t.to?bs(t.to):null,i=t.value!=null?qu(t.value):BigInt(0),s=t.data?Dy(t.data):Buffer.alloc(0),o=t.nonce!=null?Gu(t.nonce):null,a=t.gasPrice!=null?qu(t.gasPrice):null,c=t.maxFeePerGas!=null?qu(t.maxFeePerGas):null,u=t.maxPriorityFeePerGas!=null?qu(t.maxPriorityFeePerGas):null,l=t.gas!=null?qu(t.gas):null,d=t.chainId?Gu(t.chainId):this.getChainId();return{fromAddress:n,toAddress:r,weiValue:i,data:s,nonce:o,gasPriceInWei:a,maxFeePerGas:c,maxPriorityFeePerGas:u,gasLimit:l,chainId:d}}async ecRecover(t){const{method:n,params:r}=t;if(!Array.isArray(r))throw he.rpc.invalidParams();const s=await this.initializeRelay().sendRequest({method:"ethereumAddressFromSignedMessage",params:{message:Ly(r[0]),signature:Ly(r[1]),addPrefix:n==="personal_ecRecover"}});if(gn(s))throw s;return s.result}getChainId(){var t;return Number.parseInt((t=this._storage.getItem(fS))!==null&&t!==void 0?t:"1",10)}async _eth_requestAccounts(){var t,n;if(this._addresses.length>0)return(t=this.callback)===null||t===void 0||t.call(this,"connect",{chainId:Da(this.getChainId())}),this._addresses;const i=await this.initializeRelay().requestEthereumAccounts();if(gn(i))throw i;if(!i.result)throw new Error("accounts received is empty");return this._setAddresses(i.result),(n=this.callback)===null||n===void 0||n.call(this,"connect",{chainId:Da(this.getChainId())}),this._addresses}async personalSign({params:t}){if(!Array.isArray(t))throw he.rpc.invalidParams();const n=t[1],r=t[0];this._ensureKnownAddress(n);const s=await this.initializeRelay().sendRequest({method:"signEthereumMessage",params:{address:bs(n),message:Ly(r),addPrefix:!0,typedDataJson:null}});if(gn(s))throw s;return s.result}async _eth_signTransaction(t){const n=this._prepareTransactionParams(t[0]||{}),i=await this.initializeRelay().signEthereumTransaction(n);if(gn(i))throw i;return i.result}async _eth_sendRawTransaction(t){const n=Dy(t[0]),i=await this.initializeRelay().submitEthereumTransaction(n,this.getChainId());if(gn(i))throw i;return i.result}async _eth_sendTransaction(t){const n=this._prepareTransactionParams(t[0]||{}),i=await this.initializeRelay().signAndSubmitEthereumTransaction(n);if(gn(i))throw i;return i.result}async signTypedData(t){const{method:n,params:r}=t;if(!Array.isArray(r))throw he.rpc.invalidParams();const i=u=>{const l={eth_signTypedData_v1:ch.hashForSignTypedDataLegacy,eth_signTypedData_v3:ch.hashForSignTypedData_v3,eth_signTypedData_v4:ch.hashForSignTypedData_v4,eth_signTypedData:ch.hashForSignTypedData_v4};return Wu(l[n]({data:NF(u)}),!0)},s=r[n==="eth_signTypedData_v1"?1:0],o=r[n==="eth_signTypedData_v1"?0:1];this._ensureKnownAddress(s);const c=await this.initializeRelay().sendRequest({method:"signEthereumMessage",params:{address:bs(s),message:i(o),typedDataJson:JSON.stringify(o,null,2),addPrefix:!1}});if(gn(c))throw c;return c.result}initializeRelay(){return this._relay||(this._relay=new dS({linkAPIUrl:$x,storage:this._storage,metadata:this.metadata,accountsCallback:this._setAddresses.bind(this),chainCallback:this.updateProviderInfo.bind(this)})),this._relay}}const mS="SignerType",gS=new Jf("CBWSDK","SignerConfigurator");function EH(){return gS.getItem(mS)}function xH(e){gS.setItem(mS,e)}function yS(e){if(e)return e instanceof l3?"scw":"walletlink"}async function SH(e){const{communicator:t,metadata:n,handshakeRequest:r,callback:i}=e;AH(t,n,i,r).catch(()=>{});const s={id:crypto.randomUUID(),event:"selectSignerType",data:Object.assign(Object.assign({},e.preference),{handshakeRequest:r})},{data:o}=await t.postRequestAndWaitForResponse(s);return o}function kH(e){const{signerType:t,metadata:n,communicator:r,callback:i}=e;switch(t){case"scw":return new l3({metadata:n,callback:i,communicator:r});case"walletlink":return new pS({metadata:n,callback:i})}}async function AH(e,t,n,r){await e.onMessage(({event:s})=>s==="WalletLinkSessionRequest");const i=new pS({metadata:t,callback:n});e.postMessage({event:"WalletLinkUpdate",data:{session:i.getSession()}}),await i.handshake(r),e.postMessage({event:"WalletLinkUpdate",data:{connected:!0}})}var IH=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n};let CH=class extends pD{constructor(t){var{metadata:n}=t,r=t.preference,{keysUrl:i}=r,s=IH(r,["keysUrl"]);super(),this.signer=null,this.isCoinbaseWallet=!0,this.metadata=n,this.preference=s,this.communicator=new dD({url:i,metadata:n,preference:s});const o=EH();o&&(this.signer=this.initSigner(o),mD({signerType:o}))}async request(t){const n=crypto.randomUUID();Nr.set(t,n),gD({method:t.method,correlationId:n});try{const r=await this._request(t);return bD({method:t.method,signerType:yS(this.signer),correlationId:n}),r}catch(r){throw yD({method:t.method,correlationId:n,signerType:yS(this.signer),errorMessage:r instanceof Error?r.message:""}),r}finally{Nr.delete(t)}}async _request(t){try{if(WF(t),!this.signer)switch(t.method){case"eth_requestAccounts":{let r;const i=ge.subAccountsConfig.get();i!=null&&i.enableAutoSubAccounts?r="scw":r=await this.requestSignerSelection(t);const s=this.initSigner(r);r==="scw"&&(i!=null&&i.enableAutoSubAccounts)?(await s.handshake({method:"handshake"}),await s.request(t)):await s.handshake(t),this.signer=s,xH(r);break}case"wallet_connect":{const r=this.initSigner("scw");await r.handshake({method:"handshake"});const i=await r.request(t);return this.signer=r,i}case"wallet_sendCalls":case"wallet_sign":{const r=this.initSigner("scw");await r.handshake({method:"handshake"});const i=await r.request(t);return await r.cleanup(),i}case"wallet_getCallsStatus":return await Vu(t,jx);case"net_version":return 1;case"eth_chainId":return Da(1);default:throw he.provider.unauthorized("Must call 'eth_requestAccounts' before other methods")}return await this.signer.request(t)}catch(n){const{code:r}=n;return r===qt.provider.unauthorized&&this.disconnect(),Promise.reject(fD(n))}}async enable(){return console.warn('.enable() has been deprecated. Please use .request({ method: "eth_requestAccounts" }) instead.'),wD(),await this.request({method:"eth_requestAccounts"})}async disconnect(){var t;await((t=this.signer)===null||t===void 0?void 0:t.cleanup()),this.signer=null,Jf.clearAll(),Nr.clear(),this.emit("disconnect",he.provider.disconnected("User initiated disconnection"))}async requestSignerSelection(t){vD();const n=await SH({communicator:this.communicator,preference:this.preference,metadata:this.metadata,handshakeRequest:t,callback:this.emit.bind(this)});return _D(n),n}initSigner(t){return kH({signerType:t,metadata:this.metadata,communicator:this.communicator,callback:this.emit.bind(this)})}};function PH(e){var t;const n={metadata:e.metadata,preference:e.preference};return(t=zF(n))!==null&&t!==void 0?t:new CH(n)}const RH={options:"all"};function TH(e){var t,n,r,i;const s={metadata:{appName:e.appName||"Dapp",appLogoUrl:e.appLogoUrl||"",appChainIds:e.appChainIds||[]},preference:Object.assign(RH,(t=e.preference)!==null&&t!==void 0?t:{}),paymasterUrls:e.paymasterUrls};!((n=e.subAccounts)===null||n===void 0)&&n.toOwnerAccount&&Lx(e.subAccounts.toOwnerAccount),ge.subAccountsConfig.set({toOwnerAccount:(r=e.subAccounts)===null||r===void 0?void 0:r.toOwnerAccount,enableAutoSubAccounts:(i=e.subAccounts)===null||i===void 0?void 0:i.enableAutoSubAccounts}),ge.config.set(s),ge.persist.rehydrate(),FF(),s.preference.telemetry!==!1&&IF(),GF(s.preference);let o=null;const a={getProvider(){return o||(o=PH(s)),o.sdk=a,o},subAccount:{async create(c){var u,l;const d=ge.getState();return sr((u=d.subAccount)===null||u===void 0?void 0:u.address,new Error("subaccount already exists")),await((l=a.getProvider())===null||l===void 0?void 0:l.request({method:"wallet_addSubAccount",params:[{version:"1",account:c}]}))},async get(){var c,u;const l=ge.subAccounts.get();if(l!=null&&l.address)return l;const f=(u=(await((c=a.getProvider())===null||c===void 0?void 0:c.request({method:"wallet_connect",params:[{version:"1",capabilities:{}}]}))).accounts[0].capabilities)===null||u===void 0?void 0:u.subAccounts;return Array.isArray(f)?f[0]:null},async addOwner({address:c,publicKey:u,chainId:l}){var d,f;const h=ge.subAccounts.get(),m=ge.account.get();sr(m,new Error("account does not exist")),sr(h==null?void 0:h.address,new Error("subaccount does not exist"));const y=[];if(u){const[w,b]=Us([{type:"bytes32"},{type:"bytes32"}],u);y.push({to:h.address,data:jt({abi:Lr,functionName:"addOwnerPublicKey",args:[w,b]}),value:tn(0)})}return c&&y.push({to:h.address,data:jt({abi:Lr,functionName:"addOwnerAddress",args:[c]}),value:tn(0)}),await((d=a.getProvider())===null||d===void 0?void 0:d.request({method:"wallet_sendCalls",params:[{calls:y,chainId:tn(l),from:(f=m.accounts)===null||f===void 0?void 0:f[0],version:"1"}]}))},setToOwnerAccount(c){Lx(c),ge.subAccountsConfig.set({toOwnerAccount:c})}}};return a}const OH=Object.freeze(Object.defineProperty({__proto__:null,createCoinbaseWalletSDK:TH,getCryptoKeyAccount:Qf},Symbol.toStringTag,{value:"Module"}));var eb={},Xu={},lh={};Object.defineProperty(lh,"__esModule",{value:!0}),lh.walletLogo=void 0;const MH=(e,t)=>{let n;switch(e){case"standard":return n=t,`data:image/svg+xml,%3Csvg width='${t}' height='${n}' 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 n=t,`data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='${t}' height='${n}' 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 n=(.1*t).toFixed(2),`data:image/svg+xml,%3Csvg width='${t}' height='${n}' 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 n=(.25*t).toFixed(2),`data:image/svg+xml,%3Csvg width='${t}' height='${n}' 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 n=(.1*t).toFixed(2),`data:image/svg+xml,%3Csvg width='${t}' height='${n}' 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 n=(.25*t).toFixed(2),`data:image/svg+xml,%3Csvg width='${t}' height='${n}' 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 n=t,`data:image/svg+xml,%3Csvg width='${t}' height='${n}' 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 `}};lh.walletLogo=MH;var dh={};Object.defineProperty(dh,"__esModule",{value:!0}),dh.LINK_API_URL=void 0,dh.LINK_API_URL="https://www.walletlink.org";var Ie={},tb={exports:{}};const nb=Zo(Object.freeze(Object.defineProperty({__proto__:null,default:{}},Symbol.toStringTag,{value:"Module"})));tb.exports,function(e){(function(t,n){function r(C,p){if(!C)throw new Error(p||"Assertion failed")}function i(C,p){C.super_=p;var g=function(){};g.prototype=p.prototype,C.prototype=new g,C.prototype.constructor=C}function s(C,p,g){if(s.isBN(C))return C;this.negative=0,this.words=null,this.length=0,this.red=null,C!==null&&((p==="le"||p==="be")&&(g=p,p=10),this._init(C||0,p||10,g||"be"))}typeof t=="object"?t.exports=s:n.BN=s,s.BN=s,s.wordSize=26;var o;try{typeof window<"u"&&typeof window.Buffer<"u"?o=window.Buffer:o=nb.Buffer}catch{}s.isBN=function(p){return p instanceof s?!0:p!==null&&typeof p=="object"&&p.constructor.wordSize===s.wordSize&&Array.isArray(p.words)},s.max=function(p,g){return p.cmp(g)>0?p:g},s.min=function(p,g){return p.cmp(g)<0?p:g},s.prototype._init=function(p,g,k){if(typeof p=="number")return this._initNumber(p,g,k);if(typeof p=="object")return this._initArray(p,g,k);g==="hex"&&(g=16),r(g===(g|0)&&g>=2&&g<=36),p=p.toString().replace(/\s+/g,"");var R=0;p[0]==="-"&&(R++,this.negative=1),R<p.length&&(g===16?this._parseHex(p,R,k):(this._parseBase(p,g,R),k==="le"&&this._initArray(this.toArray(),g,k)))},s.prototype._initNumber=function(p,g,k){p<0&&(this.negative=1,p=-p),p<67108864?(this.words=[p&67108863],this.length=1):p<4503599627370496?(this.words=[p&67108863,p/67108864&67108863],this.length=2):(r(p<9007199254740992),this.words=[p&67108863,p/67108864&67108863,1],this.length=3),k==="le"&&this._initArray(this.toArray(),g,k)},s.prototype._initArray=function(p,g,k){if(r(typeof p.length=="number"),p.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(p.length/3),this.words=new Array(this.length);for(var R=0;R<this.length;R++)this.words[R]=0;var T,M,$=0;if(k==="be")for(R=p.length-1,T=0;R>=0;R-=3)M=p[R]|p[R-1]<<8|p[R-2]<<16,this.words[T]|=M<<$&67108863,this.words[T+1]=M>>>26-$&67108863,$+=24,$>=26&&($-=26,T++);else if(k==="le")for(R=0,T=0;R<p.length;R+=3)M=p[R]|p[R+1]<<8|p[R+2]<<16,this.words[T]|=M<<$&67108863,this.words[T+1]=M>>>26-$&67108863,$+=24,$>=26&&($-=26,T++);return this._strip()};function a(C,p){var g=C.charCodeAt(p);if(g>=48&&g<=57)return g-48;if(g>=65&&g<=70)return g-55;if(g>=97&&g<=102)return g-87;r(!1,"Invalid character in "+C)}function c(C,p,g){var k=a(C,g);return g-1>=p&&(k|=a(C,g-1)<<4),k}s.prototype._parseHex=function(p,g,k){this.length=Math.ceil((p.length-g)/6),this.words=new Array(this.length);for(var R=0;R<this.length;R++)this.words[R]=0;var T=0,M=0,$;if(k==="be")for(R=p.length-1;R>=g;R-=2)$=c(p,g,R)<<T,this.words[M]|=$&67108863,T>=18?(T-=18,M+=1,this.words[M]|=$>>>26):T+=8;else{var O=p.length-g;for(R=O%2===0?g+1:g;R<p.length;R+=2)$=c(p,g,R)<<T,this.words[M]|=$&67108863,T>=18?(T-=18,M+=1,this.words[M]|=$>>>26):T+=8}this._strip()};function u(C,p,g,k){for(var R=0,T=0,M=Math.min(C.length,g),$=p;$<M;$++){var O=C.charCodeAt($)-48;R*=k,O>=49?T=O-49+10:O>=17?T=O-17+10:T=O,r(O>=0&&T<k,"Invalid character"),R+=T}return R}s.prototype._parseBase=function(p,g,k){this.words=[0],this.length=1;for(var R=0,T=1;T<=67108863;T*=g)R++;R--,T=T/g|0;for(var M=p.length-k,$=M%R,O=Math.min(M,M-$)+k,_=0,F=k;F<O;F+=R)_=u(p,F,F+R,g),this.imuln(T),this.words[0]+_<67108864?this.words[0]+=_:this._iaddn(_);if($!==0){var ue=1;for(_=u(p,F,p.length,g),F=0;F<$;F++)ue*=g;this.imuln(ue),this.words[0]+_<67108864?this.words[0]+=_:this._iaddn(_)}this._strip()},s.prototype.copy=function(p){p.words=new Array(this.length);for(var g=0;g<this.length;g++)p.words[g]=this.words[g];p.length=this.length,p.negative=this.negative,p.red=this.red};function l(C,p){C.words=p.words,C.length=p.length,C.negative=p.negative,C.red=p.red}if(s.prototype._move=function(p){l(p,this)},s.prototype.clone=function(){var p=new s(null);return this.copy(p),p},s.prototype._expand=function(p){for(;this.length<p;)this.words[this.length++]=0;return this},s.prototype._strip=function(){for(;this.length>1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},s.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},typeof Symbol<"u"&&typeof Symbol.for=="function")try{s.prototype[Symbol.for("nodejs.util.inspect.custom")]=d}catch{s.prototype.inspect=d}else s.prototype.inspect=d;function d(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"}var f=["","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"],h=[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],m=[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];s.prototype.toString=function(p,g){p=p||10,g=g|0||1;var k;if(p===16||p==="hex"){k="";for(var R=0,T=0,M=0;M<this.length;M++){var $=this.words[M],O=(($<<R|T)&16777215).toString(16);T=$>>>24-R&16777215,R+=2,R>=26&&(R-=26,M--),T!==0||M!==this.length-1?k=f[6-O.length]+O+k:k=O+k}for(T!==0&&(k=T.toString(16)+k);k.length%g!==0;)k="0"+k;return this.negative!==0&&(k="-"+k),k}if(p===(p|0)&&p>=2&&p<=36){var _=h[p],F=m[p];k="";var ue=this.clone();for(ue.negative=0;!ue.isZero();){var ne=ue.modrn(F).toString(p);ue=ue.idivn(F),ue.isZero()?k=ne+k:k=f[_-ne.length]+ne+k}for(this.isZero()&&(k="0"+k);k.length%g!==0;)k="0"+k;return this.negative!==0&&(k="-"+k),k}r(!1,"Base should be between 2 and 36")},s.prototype.toNumber=function(){var p=this.words[0];return this.length===2?p+=this.words[1]*67108864:this.length===3&&this.words[2]===1?p+=4503599627370496+this.words[1]*67108864:this.length>2&&r(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-p:p},s.prototype.toJSON=function(){return this.toString(16,2)},o&&(s.prototype.toBuffer=function(p,g){return this.toArrayLike(o,p,g)}),s.prototype.toArray=function(p,g){return this.toArrayLike(Array,p,g)};var y=function(p,g){return p.allocUnsafe?p.allocUnsafe(g):new p(g)};s.prototype.toArrayLike=function(p,g,k){this._strip();var R=this.byteLength(),T=k||Math.max(1,R);r(R<=T,"byte array longer than desired length"),r(T>0,"Requested array length <= 0");var M=y(p,T),$=g==="le"?"LE":"BE";return this["_toArrayLike"+$](M,R),M},s.prototype._toArrayLikeLE=function(p,g){for(var k=0,R=0,T=0,M=0;T<this.length;T++){var $=this.words[T]<<M|R;p[k++]=$&255,k<p.length&&(p[k++]=$>>8&255),k<p.length&&(p[k++]=$>>16&255),M===6?(k<p.length&&(p[k++]=$>>24&255),R=0,M=0):(R=$>>>24,M+=2)}if(k<p.length)for(p[k++]=R;k<p.length;)p[k++]=0},s.prototype._toArrayLikeBE=function(p,g){for(var k=p.length-1,R=0,T=0,M=0;T<this.length;T++){var $=this.words[T]<<M|R;p[k--]=$&255,k>=0&&(p[k--]=$>>8&255),k>=0&&(p[k--]=$>>16&255),M===6?(k>=0&&(p[k--]=$>>24&255),R=0,M=0):(R=$>>>24,M+=2)}if(k>=0)for(p[k--]=R;k>=0;)p[k--]=0},Math.clz32?s.prototype._countBits=function(p){return 32-Math.clz32(p)}:s.prototype._countBits=function(p){var g=p,k=0;return g>=4096&&(k+=13,g>>>=13),g>=64&&(k+=7,g>>>=7),g>=8&&(k+=4,g>>>=4),g>=2&&(k+=2,g>>>=2),k+g},s.prototype._zeroBits=function(p){if(p===0)return 26;var g=p,k=0;return g&8191||(k+=13,g>>>=13),g&127||(k+=7,g>>>=7),g&15||(k+=4,g>>>=4),g&3||(k+=2,g>>>=2),g&1||k++,k},s.prototype.bitLength=function(){var p=this.words[this.length-1],g=this._countBits(p);return(this.length-1)*26+g};function w(C){for(var p=new Array(C.bitLength()),g=0;g<p.length;g++){var k=g/26|0,R=g%26;p[g]=C.words[k]>>>R&1}return p}s.prototype.zeroBits=function(){if(this.isZero())return 0;for(var p=0,g=0;g<this.length;g++){var k=this._zeroBits(this.words[g]);if(p+=k,k!==26)break}return p},s.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},s.prototype.toTwos=function(p){return this.negative!==0?this.abs().inotn(p).iaddn(1):this.clone()},s.prototype.fromTwos=function(p){return this.testn(p-1)?this.notn(p).iaddn(1).ineg():this.clone()},s.prototype.isNeg=function(){return this.negative!==0},s.prototype.neg=function(){return this.clone().ineg()},s.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},s.prototype.iuor=function(p){for(;this.length<p.length;)this.words[this.length++]=0;for(var g=0;g<p.length;g++)this.words[g]=this.words[g]|p.words[g];return this._strip()},s.prototype.ior=function(p){return r((this.negative|p.negative)===0),this.iuor(p)},s.prototype.or=function(p){return this.length>p.length?this.clone().ior(p):p.clone().ior(this)},s.prototype.uor=function(p){return this.length>p.length?this.clone().iuor(p):p.clone().iuor(this)},s.prototype.iuand=function(p){var g;this.length>p.length?g=p:g=this;for(var k=0;k<g.length;k++)this.words[k]=this.words[k]&p.words[k];return this.length=g.length,this._strip()},s.prototype.iand=function(p){return r((this.negative|p.negative)===0),this.iuand(p)},s.prototype.and=function(p){return this.length>p.length?this.clone().iand(p):p.clone().iand(this)},s.prototype.uand=function(p){return this.length>p.length?this.clone().iuand(p):p.clone().iuand(this)},s.prototype.iuxor=function(p){var g,k;this.length>p.length?(g=this,k=p):(g=p,k=this);for(var R=0;R<k.length;R++)this.words[R]=g.words[R]^k.words[R];if(this!==g)for(;R<g.length;R++)this.words[R]=g.words[R];return this.length=g.length,this._strip()},s.prototype.ixor=function(p){return r((this.negative|p.negative)===0),this.iuxor(p)},s.prototype.xor=function(p){return this.length>p.length?this.clone().ixor(p):p.clone().ixor(this)},s.prototype.uxor=function(p){return this.length>p.length?this.clone().iuxor(p):p.clone().iuxor(this)},s.prototype.inotn=function(p){r(typeof p=="number"&&p>=0);var g=Math.ceil(p/26)|0,k=p%26;this._expand(g),k>0&&g--;for(var R=0;R<g;R++)this.words[R]=~this.words[R]&67108863;return k>0&&(this.words[R]=~this.words[R]&67108863>>26-k),this._strip()},s.prototype.notn=function(p){return this.clone().inotn(p)},s.prototype.setn=function(p,g){r(typeof p=="number"&&p>=0);var k=p/26|0,R=p%26;return this._expand(k+1),g?this.words[k]=this.words[k]|1<<R:this.words[k]=this.words[k]&~(1<<R),this._strip()},s.prototype.iadd=function(p){var g;if(this.negative!==0&&p.negative===0)return this.negative=0,g=this.isub(p),this.negative^=1,this._normSign();if(this.negative===0&&p.negative!==0)return p.negative=0,g=this.isub(p),p.negative=1,g._normSign();var k,R;this.length>p.length?(k=this,R=p):(k=p,R=this);for(var T=0,M=0;M<R.length;M++)g=(k.words[M]|0)+(R.words[M]|0)+T,this.words[M]=g&67108863,T=g>>>26;for(;T!==0&&M<k.length;M++)g=(k.words[M]|0)+T,this.words[M]=g&67108863,T=g>>>26;if(this.length=k.length,T!==0)this.words[this.length]=T,this.length++;else if(k!==this)for(;M<k.length;M++)this.words[M]=k.words[M];return this},s.prototype.add=function(p){var g;return p.negative!==0&&this.negative===0?(p.negative=0,g=this.sub(p),p.negative^=1,g):p.negative===0&&this.negative!==0?(this.negative=0,g=p.sub(this),this.negative=1,g):this.length>p.length?this.clone().iadd(p):p.clone().iadd(this)},s.prototype.isub=function(p){if(p.negative!==0){p.negative=0;var g=this.iadd(p);return p.negative=1,g._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(p),this.negative=1,this._normSign();var k=this.cmp(p);if(k===0)return this.negative=0,this.length=1,this.words[0]=0,this;var R,T;k>0?(R=this,T=p):(R=p,T=this);for(var M=0,$=0;$<T.length;$++)g=(R.words[$]|0)-(T.words[$]|0)+M,M=g>>26,this.words[$]=g&67108863;for(;M!==0&&$<R.length;$++)g=(R.words[$]|0)+M,M=g>>26,this.words[$]=g&67108863;if(M===0&&$<R.length&&R!==this)for(;$<R.length;$++)this.words[$]=R.words[$];return this.length=Math.max(this.length,$),R!==this&&(this.negative=1),this._strip()},s.prototype.sub=function(p){return this.clone().isub(p)};function b(C,p,g){g.negative=p.negative^C.negative;var k=C.length+p.length|0;g.length=k,k=k-1|0;var R=C.words[0]|0,T=p.words[0]|0,M=R*T,$=M&67108863,O=M/67108864|0;g.words[0]=$;for(var _=1;_<k;_++){for(var F=O>>>26,ue=O&67108863,ne=Math.min(_,p.length-1),q=Math.max(0,_-C.length+1);q<=ne;q++){var J=_-q|0;R=C.words[J]|0,T=p.words[q]|0,M=R*T+ue,F+=M/67108864|0,ue=M&67108863}g.words[_]=ue|0,O=F|0}return O!==0?g.words[_]=O|0:g.length--,g._strip()}var x=function(p,g,k){var R=p.words,T=g.words,M=k.words,$=0,O,_,F,ue=R[0]|0,ne=ue&8191,q=ue>>>13,J=R[1]|0,te=J&8191,le=J>>>13,pe=R[2]|0,z=pe&8191,D=pe>>>13,ie=R[3]|0,de=ie&8191,_e=ie>>>13,Ae=R[4]|0,xe=Ae&8191,Ge=Ae>>>13,Tt=R[5]|0,$e=Tt&8191,Qe=Tt>>>13,At=R[6]|0,Fe=At&8191,Xe=At>>>13,Lt=R[7]|0,De=Lt&8191,B=Lt>>>13,E=R[8]|0,A=E&8191,H=E>>>13,Q=R[9]|0,X=Q&8191,re=Q>>>13,Me=T[0]|0,Oe=Me&8191,Te=Me>>>13,ot=T[1]|0,Ce=ot&8191,Ue=ot>>>13,Dn=T[2]|0,qe=Dn&8191,ut=Dn>>>13,zr=T[3]|0,bt=zr&8191,ht=zr>>>13,Cn=T[4]|0,lt=Cn&8191,pt=Cn>>>13,Wr=T[5]|0,dt=Wr&8191,at=Wr>>>13,er=T[6]|0,wt=er&8191,vt=er>>>13,hi=T[7]|0,be=hi&8191,W=hi>>>13,se=T[8]|0,ae=se&8191,fe=se>>>13,Se=T[9]|0,Ee=Se&8191,ye=Se>>>13;k.negative=p.negative^g.negative,k.length=19,O=Math.imul(ne,Oe),_=Math.imul(ne,Te),_=_+Math.imul(q,Oe)|0,F=Math.imul(q,Te);var ke=($+O|0)+((_&8191)<<13)|0;$=(F+(_>>>13)|0)+(ke>>>26)|0,ke&=67108863,O=Math.imul(te,Oe),_=Math.imul(te,Te),_=_+Math.imul(le,Oe)|0,F=Math.imul(le,Te),O=O+Math.imul(ne,Ce)|0,_=_+Math.imul(ne,Ue)|0,_=_+Math.imul(q,Ce)|0,F=F+Math.imul(q,Ue)|0;var He=($+O|0)+((_&8191)<<13)|0;$=(F+(_>>>13)|0)+(He>>>26)|0,He&=67108863,O=Math.imul(z,Oe),_=Math.imul(z,Te),_=_+Math.imul(D,Oe)|0,F=Math.imul(D,Te),O=O+Math.imul(te,Ce)|0,_=_+Math.imul(te,Ue)|0,_=_+Math.imul(le,Ce)|0,F=F+Math.imul(le,Ue)|0,O=O+Math.imul(ne,qe)|0,_=_+Math.imul(ne,ut)|0,_=_+Math.imul(q,qe)|0,F=F+Math.imul(q,ut)|0;var Ve=($+O|0)+((_&8191)<<13)|0;$=(F+(_>>>13)|0)+(Ve>>>26)|0,Ve&=67108863,O=Math.imul(de,Oe),_=Math.imul(de,Te),_=_+Math.imul(_e,Oe)|0,F=Math.imul(_e,Te),O=O+Math.imul(z,Ce)|0,_=_+Math.imul(z,Ue)|0,_=_+Math.imul(D,Ce)|0,F=F+Math.imul(D,Ue)|0,O=O+Math.imul(te,qe)|0,_=_+Math.imul(te,ut)|0,_=_+Math.imul(le,qe)|0,F=F+Math.imul(le,ut)|0,O=O+Math.imul(ne,bt)|0,_=_+Math.imul(ne,ht)|0,_=_+Math.imul(q,bt)|0,F=F+Math.imul(q,ht)|0;var mt=($+O|0)+((_&8191)<<13)|0;$=(F+(_>>>13)|0)+(mt>>>26)|0,mt&=67108863,O=Math.imul(xe,Oe),_=Math.imul(xe,Te),_=_+Math.imul(Ge,Oe)|0,F=Math.imul(Ge,Te),O=O+Math.imul(de,Ce)|0,_=_+Math.imul(de,Ue)|0,_=_+Math.imul(_e,Ce)|0,F=F+Math.imul(_e,Ue)|0,O=O+Math.imul(z,qe)|0,_=_+Math.imul(z,ut)|0,_=_+Math.imul(D,qe)|0,F=F+Math.imul(D,ut)|0,O=O+Math.imul(te,bt)|0,_=_+Math.imul(te,ht)|0,_=_+Math.imul(le,bt)|0,F=F+Math.imul(le,ht)|0,O=O+Math.imul(ne,lt)|0,_=_+Math.imul(ne,pt)|0,_=_+Math.imul(q,lt)|0,F=F+Math.imul(q,pt)|0;var Xt=($+O|0)+((_&8191)<<13)|0;$=(F+(_>>>13)|0)+(Xt>>>26)|0,Xt&=67108863,O=Math.imul($e,Oe),_=Math.imul($e,Te),_=_+Math.imul(Qe,Oe)|0,F=Math.imul(Qe,Te),O=O+Math.imul(xe,Ce)|0,_=_+Math.imul(xe,Ue)|0,_=_+Math.imul(Ge,Ce)|0,F=F+Math.imul(Ge,Ue)|0,O=O+Math.imul(de,qe)|0,_=_+Math.imul(de,ut)|0,_=_+Math.imul(_e,qe)|0,F=F+Math.imul(_e,ut)|0,O=O+Math.imul(z,bt)|0,_=_+Math.imul(z,ht)|0,_=_+Math.imul(D,bt)|0,F=F+Math.imul(D,ht)|0,O=O+Math.imul(te,lt)|0,_=_+Math.imul(te,pt)|0,_=_+Math.imul(le,lt)|0,F=F+Math.imul(le,pt)|0,O=O+Math.imul(ne,dt)|0,_=_+Math.imul(ne,at)|0,_=_+Math.imul(q,dt)|0,F=F+Math.imul(q,at)|0;var tr=($+O|0)+((_&8191)<<13)|0;$=(F+(_>>>13)|0)+(tr>>>26)|0,tr&=67108863,O=Math.imul(Fe,Oe),_=Math.imul(Fe,Te),_=_+Math.imul(Xe,Oe)|0,F=Math.imul(Xe,Te),O=O+Math.imul($e,Ce)|0,_=_+Math.imul($e,Ue)|0,_=_+Math.imul(Qe,Ce)|0,F=F+Math.imul(Qe,Ue)|0,O=O+Math.imul(xe,qe)|0,_=_+Math.imul(xe,ut)|0,_=_+Math.imul(Ge,qe)|0,F=F+Math.imul(Ge,ut)|0,O=O+Math.imul(de,bt)|0,_=_+Math.imul(de,ht)|0,_=_+Math.imul(_e,bt)|0,F=F+Math.imul(_e,ht)|0,O=O+Math.imul(z,lt)|0,_=_+Math.imul(z,pt)|0,_=_+Math.imul(D,lt)|0,F=F+Math.imul(D,pt)|0,O=O+Math.imul(te,dt)|0,_=_+Math.imul(te,at)|0,_=_+Math.imul(le,dt)|0,F=F+Math.imul(le,at)|0,O=O+Math.imul(ne,wt)|0,_=_+Math.imul(ne,vt)|0,_=_+Math.imul(q,wt)|0,F=F+Math.imul(q,vt)|0;var Un=($+O|0)+((_&8191)<<13)|0;$=(F+(_>>>13)|0)+(Un>>>26)|0,Un&=67108863,O=Math.imul(De,Oe),_=Math.imul(De,Te),_=_+Math.imul(B,Oe)|0,F=Math.imul(B,Te),O=O+Math.imul(Fe,Ce)|0,_=_+Math.imul(Fe,Ue)|0,_=_+Math.imul(Xe,Ce)|0,F=F+Math.imul(Xe,Ue)|0,O=O+Math.imul($e,qe)|0,_=_+Math.imul($e,ut)|0,_=_+Math.imul(Qe,qe)|0,F=F+Math.imul(Qe,ut)|0,O=O+Math.imul(xe,bt)|0,_=_+Math.imul(xe,ht)|0,_=_+Math.imul(Ge,bt)|0,F=F+Math.imul(Ge,ht)|0,O=O+Math.imul(de,lt)|0,_=_+Math.imul(de,pt)|0,_=_+Math.imul(_e,lt)|0,F=F+Math.imul(_e,pt)|0,O=O+Math.imul(z,dt)|0,_=_+Math.imul(z,at)|0,_=_+Math.imul(D,dt)|0,F=F+Math.imul(D,at)|0,O=O+Math.imul(te,wt)|0,_=_+Math.imul(te,vt)|0,_=_+Math.imul(le,wt)|0,F=F+Math.imul(le,vt)|0,O=O+Math.imul(ne,be)|0,_=_+Math.imul(ne,W)|0,_=_+Math.imul(q,be)|0,F=F+Math.imul(q,W)|0;var Ft=($+O|0)+((_&8191)<<13)|0;$=(F+(_>>>13)|0)+(Ft>>>26)|0,Ft&=67108863,O=Math.imul(A,Oe),_=Math.imul(A,Te),_=_+Math.imul(H,Oe)|0,F=Math.imul(H,Te),O=O+Math.imul(De,Ce)|0,_=_+Math.imul(De,Ue)|0,_=_+Math.imul(B,Ce)|0,F=F+Math.imul(B,Ue)|0,O=O+Math.imul(Fe,qe)|0,_=_+Math.imul(Fe,ut)|0,_=_+Math.imul(Xe,qe)|0,F=F+Math.imul(Xe,ut)|0,O=O+Math.imul($e,bt)|0,_=_+Math.imul($e,ht)|0,_=_+Math.imul(Qe,bt)|0,F=F+Math.imul(Qe,ht)|0,O=O+Math.imul(xe,lt)|0,_=_+Math.imul(xe,pt)|0,_=_+Math.imul(Ge,lt)|0,F=F+Math.imul(Ge,pt)|0,O=O+Math.imul(de,dt)|0,_=_+Math.imul(de,at)|0,_=_+Math.imul(_e,dt)|0,F=F+Math.imul(_e,at)|0,O=O+Math.imul(z,wt)|0,_=_+Math.imul(z,vt)|0,_=_+Math.imul(D,wt)|0,F=F+Math.imul(D,vt)|0,O=O+Math.imul(te,be)|0,_=_+Math.imul(te,W)|0,_=_+Math.imul(le,be)|0,F=F+Math.imul(le,W)|0,O=O+Math.imul(ne,ae)|0,_=_+Math.imul(ne,fe)|0,_=_+Math.imul(q,ae)|0,F=F+Math.imul(q,fe)|0;var Gr=($+O|0)+((_&8191)<<13)|0;$=(F+(_>>>13)|0)+(Gr>>>26)|0,Gr&=67108863,O=Math.imul(X,Oe),_=Math.imul(X,Te),_=_+Math.imul(re,Oe)|0,F=Math.imul(re,Te),O=O+Math.imul(A,Ce)|0,_=_+Math.imul(A,Ue)|0,_=_+Math.imul(H,Ce)|0,F=F+Math.imul(H,Ue)|0,O=O+Math.imul(De,qe)|0,_=_+Math.imul(De,ut)|0,_=_+Math.imul(B,qe)|0,F=F+Math.imul(B,ut)|0,O=O+Math.imul(Fe,bt)|0,_=_+Math.imul(Fe,ht)|0,_=_+Math.imul(Xe,bt)|0,F=F+Math.imul(Xe,ht)|0,O=O+Math.imul($e,lt)|0,_=_+Math.imul($e,pt)|0,_=_+Math.imul(Qe,lt)|0,F=F+Math.imul(Qe,pt)|0,O=O+Math.imul(xe,dt)|0,_=_+Math.imul(xe,at)|0,_=_+Math.imul(Ge,dt)|0,F=F+Math.imul(Ge,at)|0,O=O+Math.imul(de,wt)|0,_=_+Math.imul(de,vt)|0,_=_+Math.imul(_e,wt)|0,F=F+Math.imul(_e,vt)|0,O=O+Math.imul(z,be)|0,_=_+Math.imul(z,W)|0,_=_+Math.imul(D,be)|0,F=F+Math.imul(D,W)|0,O=O+Math.imul(te,ae)|0,_=_+Math.imul(te,fe)|0,_=_+Math.imul(le,ae)|0,F=F+Math.imul(le,fe)|0,O=O+Math.imul(ne,Ee)|0,_=_+Math.imul(ne,ye)|0,_=_+Math.imul(q,Ee)|0,F=F+Math.imul(q,ye)|0;var Ki=($+O|0)+((_&8191)<<13)|0;$=(F+(_>>>13)|0)+(Ki>>>26)|0,Ki&=67108863,O=Math.imul(X,Ce),_=Math.imul(X,Ue),_=_+Math.imul(re,Ce)|0,F=Math.imul(re,Ue),O=O+Math.imul(A,qe)|0,_=_+Math.imul(A,ut)|0,_=_+Math.imul(H,qe)|0,F=F+Math.imul(H,ut)|0,O=O+Math.imul(De,bt)|0,_=_+Math.imul(De,ht)|0,_=_+Math.imul(B,bt)|0,F=F+Math.imul(B,ht)|0,O=O+Math.imul(Fe,lt)|0,_=_+Math.imul(Fe,pt)|0,_=_+Math.imul(Xe,lt)|0,F=F+Math.imul(Xe,pt)|0,O=O+Math.imul($e,dt)|0,_=_+Math.imul($e,at)|0,_=_+Math.imul(Qe,dt)|0,F=F+Math.imul(Qe,at)|0,O=O+Math.imul(xe,wt)|0,_=_+Math.imul(xe,vt)|0,_=_+Math.imul(Ge,wt)|0,F=F+Math.imul(Ge,vt)|0,O=O+Math.imul(de,be)|0,_=_+Math.imul(de,W)|0,_=_+Math.imul(_e,be)|0,F=F+Math.imul(_e,W)|0,O=O+Math.imul(z,ae)|0,_=_+Math.imul(z,fe)|0,_=_+Math.imul(D,ae)|0,F=F+Math.imul(D,fe)|0,O=O+Math.imul(te,Ee)|0,_=_+Math.imul(te,ye)|0,_=_+Math.imul(le,Ee)|0,F=F+Math.imul(le,ye)|0;var Ji=($+O|0)+((_&8191)<<13)|0;$=(F+(_>>>13)|0)+(Ji>>>26)|0,Ji&=67108863,O=Math.imul(X,qe),_=Math.imul(X,ut),_=_+Math.imul(re,qe)|0,F=Math.imul(re,ut),O=O+Math.imul(A,bt)|0,_=_+Math.imul(A,ht)|0,_=_+Math.imul(H,bt)|0,F=F+Math.imul(H,ht)|0,O=O+Math.imul(De,lt)|0,_=_+Math.imul(De,pt)|0,_=_+Math.imul(B,lt)|0,F=F+Math.imul(B,pt)|0,O=O+Math.imul(Fe,dt)|0,_=_+Math.imul(Fe,at)|0,_=_+Math.imul(Xe,dt)|0,F=F+Math.imul(Xe,at)|0,O=O+Math.imul($e,wt)|0,_=_+Math.imul($e,vt)|0,_=_+Math.imul(Qe,wt)|0,F=F+Math.imul(Qe,vt)|0,O=O+Math.imul(xe,be)|0,_=_+Math.imul(xe,W)|0,_=_+Math.imul(Ge,be)|0,F=F+Math.imul(Ge,W)|0,O=O+Math.imul(de,ae)|0,_=_+Math.imul(de,fe)|0,_=_+Math.imul(_e,ae)|0,F=F+Math.imul(_e,fe)|0,O=O+Math.imul(z,Ee)|0,_=_+Math.imul(z,ye)|0,_=_+Math.imul(D,Ee)|0,F=F+Math.imul(D,ye)|0;var Go=($+O|0)+((_&8191)<<13)|0;$=(F+(_>>>13)|0)+(Go>>>26)|0,Go&=67108863,O=Math.imul(X,bt),_=Math.imul(X,ht),_=_+Math.imul(re,bt)|0,F=Math.imul(re,ht),O=O+Math.imul(A,lt)|0,_=_+Math.imul(A,pt)|0,_=_+Math.imul(H,lt)|0,F=F+Math.imul(H,pt)|0,O=O+Math.imul(De,dt)|0,_=_+Math.imul(De,at)|0,_=_+Math.imul(B,dt)|0,F=F+Math.imul(B,at)|0,O=O+Math.imul(Fe,wt)|0,_=_+Math.imul(Fe,vt)|0,_=_+Math.imul(Xe,wt)|0,F=F+Math.imul(Xe,vt)|0,O=O+Math.imul($e,be)|0,_=_+Math.imul($e,W)|0,_=_+Math.imul(Qe,be)|0,F=F+Math.imul(Qe,W)|0,O=O+Math.imul(xe,ae)|0,_=_+Math.imul(xe,fe)|0,_=_+Math.imul(Ge,ae)|0,F=F+Math.imul(Ge,fe)|0,O=O+Math.imul(de,Ee)|0,_=_+Math.imul(de,ye)|0,_=_+Math.imul(_e,Ee)|0,F=F+Math.imul(_e,ye)|0;var qo=($+O|0)+((_&8191)<<13)|0;$=(F+(_>>>13)|0)+(qo>>>26)|0,qo&=67108863,O=Math.imul(X,lt),_=Math.imul(X,pt),_=_+Math.imul(re,lt)|0,F=Math.imul(re,pt),O=O+Math.imul(A,dt)|0,_=_+Math.imul(A,at)|0,_=_+Math.imul(H,dt)|0,F=F+Math.imul(H,at)|0,O=O+Math.imul(De,wt)|0,_=_+Math.imul(De,vt)|0,_=_+Math.imul(B,wt)|0,F=F+Math.imul(B,vt)|0,O=O+Math.imul(Fe,be)|0,_=_+Math.imul(Fe,W)|0,_=_+Math.imul(Xe,be)|0,F=F+Math.imul(Xe,W)|0,O=O+Math.imul($e,ae)|0,_=_+Math.imul($e,fe)|0,_=_+Math.imul(Qe,ae)|0,F=F+Math.imul(Qe,fe)|0,O=O+Math.imul(xe,Ee)|0,_=_+Math.imul(xe,ye)|0,_=_+Math.imul(Ge,Ee)|0,F=F+Math.imul(Ge,ye)|0;var Vo=($+O|0)+((_&8191)<<13)|0;$=(F+(_>>>13)|0)+(Vo>>>26)|0,Vo&=67108863,O=Math.imul(X,dt),_=Math.imul(X,at),_=_+Math.imul(re,dt)|0,F=Math.imul(re,at),O=O+Math.imul(A,wt)|0,_=_+Math.imul(A,vt)|0,_=_+Math.imul(H,wt)|0,F=F+Math.imul(H,vt)|0,O=O+Math.imul(De,be)|0,_=_+Math.imul(De,W)|0,_=_+Math.imul(B,be)|0,F=F+Math.imul(B,W)|0,O=O+Math.imul(Fe,ae)|0,_=_+Math.imul(Fe,fe)|0,_=_+Math.imul(Xe,ae)|0,F=F+Math.imul(Xe,fe)|0,O=O+Math.imul($e,Ee)|0,_=_+Math.imul($e,ye)|0,_=_+Math.imul(Qe,Ee)|0,F=F+Math.imul(Qe,ye)|0;var Z1=($+O|0)+((_&8191)<<13)|0;$=(F+(_>>>13)|0)+(Z1>>>26)|0,Z1&=67108863,O=Math.imul(X,wt),_=Math.imul(X,vt),_=_+Math.imul(re,wt)|0,F=Math.imul(re,vt),O=O+Math.imul(A,be)|0,_=_+Math.imul(A,W)|0,_=_+Math.imul(H,be)|0,F=F+Math.imul(H,W)|0,O=O+Math.imul(De,ae)|0,_=_+Math.imul(De,fe)|0,_=_+Math.imul(B,ae)|0,F=F+Math.imul(B,fe)|0,O=O+Math.imul(Fe,Ee)|0,_=_+Math.imul(Fe,ye)|0,_=_+Math.imul(Xe,Ee)|0,F=F+Math.imul(Xe,ye)|0;var Y1=($+O|0)+((_&8191)<<13)|0;$=(F+(_>>>13)|0)+(Y1>>>26)|0,Y1&=67108863,O=Math.imul(X,be),_=Math.imul(X,W),_=_+Math.imul(re,be)|0,F=Math.imul(re,W),O=O+Math.imul(A,ae)|0,_=_+Math.imul(A,fe)|0,_=_+Math.imul(H,ae)|0,F=F+Math.imul(H,fe)|0,O=O+Math.imul(De,Ee)|0,_=_+Math.imul(De,ye)|0,_=_+Math.imul(B,Ee)|0,F=F+Math.imul(B,ye)|0;var Q1=($+O|0)+((_&8191)<<13)|0;$=(F+(_>>>13)|0)+(Q1>>>26)|0,Q1&=67108863,O=Math.imul(X,ae),_=Math.imul(X,fe),_=_+Math.imul(re,ae)|0,F=Math.imul(re,fe),O=O+Math.imul(A,Ee)|0,_=_+Math.imul(A,ye)|0,_=_+Math.imul(H,Ee)|0,F=F+Math.imul(H,ye)|0;var X1=($+O|0)+((_&8191)<<13)|0;$=(F+(_>>>13)|0)+(X1>>>26)|0,X1&=67108863,O=Math.imul(X,Ee),_=Math.imul(X,ye),_=_+Math.imul(re,Ee)|0,F=Math.imul(re,ye);var ew=($+O|0)+((_&8191)<<13)|0;return $=(F+(_>>>13)|0)+(ew>>>26)|0,ew&=67108863,M[0]=ke,M[1]=He,M[2]=Ve,M[3]=mt,M[4]=Xt,M[5]=tr,M[6]=Un,M[7]=Ft,M[8]=Gr,M[9]=Ki,M[10]=Ji,M[11]=Go,M[12]=qo,M[13]=Vo,M[14]=Z1,M[15]=Y1,M[16]=Q1,M[17]=X1,M[18]=ew,$!==0&&(M[19]=$,k.length++),k};Math.imul||(x=b);function v(C,p,g){g.negative=p.negative^C.negative,g.length=C.length+p.length;for(var k=0,R=0,T=0;T<g.length-1;T++){var M=R;R=0;for(var $=k&67108863,O=Math.min(T,p.length-1),_=Math.max(0,T-C.length+1);_<=O;_++){var F=T-_,ue=C.words[F]|0,ne=p.words[_]|0,q=ue*ne,J=q&67108863;M=M+(q/67108864|0)|0,J=J+$|0,$=J&67108863,M=M+(J>>>26)|0,R+=M>>>26,M&=67108863}g.words[T]=$,k=M,M=R}return k!==0?g.words[T]=k:g.length--,g._strip()}function S(C,p,g){return v(C,p,g)}s.prototype.mulTo=function(p,g){var k,R=this.length+p.length;return this.length===10&&p.length===10?k=x(this,p,g):R<63?k=b(this,p,g):R<1024?k=v(this,p,g):k=S(this,p,g),k},s.prototype.mul=function(p){var g=new s(null);return g.words=new Array(this.length+p.length),this.mulTo(p,g)},s.prototype.mulf=function(p){var g=new s(null);return g.words=new Array(this.length+p.length),S(this,p,g)},s.prototype.imul=function(p){return this.clone().mulTo(p,this)},s.prototype.imuln=function(p){var g=p<0;g&&(p=-p),r(typeof p=="number"),r(p<67108864);for(var k=0,R=0;R<this.length;R++){var T=(this.words[R]|0)*p,M=(T&67108863)+(k&67108863);k>>=26,k+=T/67108864|0,k+=M>>>26,this.words[R]=M&67108863}return k!==0&&(this.words[R]=k,this.length++),this.length=p===0?1:this.length,g?this.ineg():this},s.prototype.muln=function(p){return this.clone().imuln(p)},s.prototype.sqr=function(){return this.mul(this)},s.prototype.isqr=function(){return this.imul(this.clone())},s.prototype.pow=function(p){var g=w(p);if(g.length===0)return new s(1);for(var k=this,R=0;R<g.length&&g[R]===0;R++,k=k.sqr());if(++R<g.length)for(var T=k.sqr();R<g.length;R++,T=T.sqr())g[R]!==0&&(k=k.mul(T));return k},s.prototype.iushln=function(p){r(typeof p=="number"&&p>=0);var g=p%26,k=(p-g)/26,R=67108863>>>26-g<<26-g,T;if(g!==0){var M=0;for(T=0;T<this.length;T++){var $=this.words[T]&R,O=(this.words[T]|0)-$<<g;this.words[T]=O|M,M=$>>>26-g}M&&(this.words[T]=M,this.length++)}if(k!==0){for(T=this.length-1;T>=0;T--)this.words[T+k]=this.words[T];for(T=0;T<k;T++)this.words[T]=0;this.length+=k}return this._strip()},s.prototype.ishln=function(p){return r(this.negative===0),this.iushln(p)},s.prototype.iushrn=function(p,g,k){r(typeof p=="number"&&p>=0);var R;g?R=(g-g%26)/26:R=0;var T=p%26,M=Math.min((p-T)/26,this.length),$=67108863^67108863>>>T<<T,O=k;if(R-=M,R=Math.max(0,R),O){for(var _=0;_<M;_++)O.words[_]=this.words[_];O.length=M}if(M!==0)if(this.length>M)for(this.length-=M,_=0;_<this.length;_++)this.words[_]=this.words[_+M];else this.words[0]=0,this.length=1;var F=0;for(_=this.length-1;_>=0&&(F!==0||_>=R);_--){var ue=this.words[_]|0;this.words[_]=F<<26-T|ue>>>T,F=ue&$}return O&&F!==0&&(O.words[O.length++]=F),this.length===0&&(this.words[0]=0,this.length=1),this._strip()},s.prototype.ishrn=function(p,g,k){return r(this.negative===0),this.iushrn(p,g,k)},s.prototype.shln=function(p){return this.clone().ishln(p)},s.prototype.ushln=function(p){return this.clone().iushln(p)},s.prototype.shrn=function(p){return this.clone().ishrn(p)},s.prototype.ushrn=function(p){return this.clone().iushrn(p)},s.prototype.testn=function(p){r(typeof p=="number"&&p>=0);var g=p%26,k=(p-g)/26,R=1<<g;if(this.length<=k)return!1;var T=this.words[k];return!!(T&R)},s.prototype.imaskn=function(p){r(typeof p=="number"&&p>=0);var g=p%26,k=(p-g)/26;if(r(this.negative===0,"imaskn works only with positive numbers"),this.length<=k)return this;if(g!==0&&k++,this.length=Math.min(k,this.length),g!==0){var R=67108863^67108863>>>g<<g;this.words[this.length-1]&=R}return this.length===0&&(this.words[0]=0,this.length=1),this._strip()},s.prototype.maskn=function(p){return this.clone().imaskn(p)},s.prototype.iaddn=function(p){return r(typeof p=="number"),r(p<67108864),p<0?this.isubn(-p):this.negative!==0?this.length===1&&(this.words[0]|0)<=p?(this.words[0]=p-(this.words[0]|0),this.negative=0,this):(this.negative=0,this.isubn(p),this.negative=1,this):this._iaddn(p)},s.prototype._iaddn=function(p){this.words[0]+=p;for(var g=0;g<this.length&&this.words[g]>=67108864;g++)this.words[g]-=67108864,g===this.length-1?this.words[g+1]=1:this.words[g+1]++;return this.length=Math.max(this.length,g+1),this},s.prototype.isubn=function(p){if(r(typeof p=="number"),r(p<67108864),p<0)return this.iaddn(-p);if(this.negative!==0)return this.negative=0,this.iaddn(p),this.negative=1,this;if(this.words[0]-=p,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var g=0;g<this.length&&this.words[g]<0;g++)this.words[g]+=67108864,this.words[g+1]-=1;return this._strip()},s.prototype.addn=function(p){return this.clone().iaddn(p)},s.prototype.subn=function(p){return this.clone().isubn(p)},s.prototype.iabs=function(){return this.negative=0,this},s.prototype.abs=function(){return this.clone().iabs()},s.prototype._ishlnsubmul=function(p,g,k){var R=p.length+k,T;this._expand(R);var M,$=0;for(T=0;T<p.length;T++){M=(this.words[T+k]|0)+$;var O=(p.words[T]|0)*g;M-=O&67108863,$=(M>>26)-(O/67108864|0),this.words[T+k]=M&67108863}for(;T<this.length-k;T++)M=(this.words[T+k]|0)+$,$=M>>26,this.words[T+k]=M&67108863;if($===0)return this._strip();for(r($===-1),$=0,T=0;T<this.length;T++)M=-(this.words[T]|0)+$,$=M>>26,this.words[T]=M&67108863;return this.negative=1,this._strip()},s.prototype._wordDiv=function(p,g){var k=this.length-p.length,R=this.clone(),T=p,M=T.words[T.length-1]|0,$=this._countBits(M);k=26-$,k!==0&&(T=T.ushln(k),R.iushln(k),M=T.words[T.length-1]|0);var O=R.length-T.length,_;if(g!=="mod"){_=new s(null),_.length=O+1,_.words=new Array(_.length);for(var F=0;F<_.length;F++)_.words[F]=0}var ue=R.clone()._ishlnsubmul(T,1,O);ue.negative===0&&(R=ue,_&&(_.words[O]=1));for(var ne=O-1;ne>=0;ne--){var q=(R.words[T.length+ne]|0)*67108864+(R.words[T.length+ne-1]|0);for(q=Math.min(q/M|0,67108863),R._ishlnsubmul(T,q,ne);R.negative!==0;)q--,R.negative=0,R._ishlnsubmul(T,1,ne),R.isZero()||(R.negative^=1);_&&(_.words[ne]=q)}return _&&_._strip(),R._strip(),g!=="div"&&k!==0&&R.iushrn(k),{div:_||null,mod:R}},s.prototype.divmod=function(p,g,k){if(r(!p.isZero()),this.isZero())return{div:new s(0),mod:new s(0)};var R,T,M;return this.negative!==0&&p.negative===0?(M=this.neg().divmod(p,g),g!=="mod"&&(R=M.div.neg()),g!=="div"&&(T=M.mod.neg(),k&&T.negative!==0&&T.iadd(p)),{div:R,mod:T}):this.negative===0&&p.negative!==0?(M=this.divmod(p.neg(),g),g!=="mod"&&(R=M.div.neg()),{div:R,mod:M.mod}):this.negative&p.negative?(M=this.neg().divmod(p.neg(),g),g!=="div"&&(T=M.mod.neg(),k&&T.negative!==0&&T.isub(p)),{div:M.div,mod:T}):p.length>this.length||this.cmp(p)<0?{div:new s(0),mod:this}:p.length===1?g==="div"?{div:this.divn(p.words[0]),mod:null}:g==="mod"?{div:null,mod:new s(this.modrn(p.words[0]))}:{div:this.divn(p.words[0]),mod:new s(this.modrn(p.words[0]))}:this._wordDiv(p,g)},s.prototype.div=function(p){return this.divmod(p,"div",!1).div},s.prototype.mod=function(p){return this.divmod(p,"mod",!1).mod},s.prototype.umod=function(p){return this.divmod(p,"mod",!0).mod},s.prototype.divRound=function(p){var g=this.divmod(p);if(g.mod.isZero())return g.div;var k=g.div.negative!==0?g.mod.isub(p):g.mod,R=p.ushrn(1),T=p.andln(1),M=k.cmp(R);return M<0||T===1&&M===0?g.div:g.div.negative!==0?g.div.isubn(1):g.div.iaddn(1)},s.prototype.modrn=function(p){var g=p<0;g&&(p=-p),r(p<=67108863);for(var k=(1<<26)%p,R=0,T=this.length-1;T>=0;T--)R=(k*R+(this.words[T]|0))%p;return g?-R:R},s.prototype.modn=function(p){return this.modrn(p)},s.prototype.idivn=function(p){var g=p<0;g&&(p=-p),r(p<=67108863);for(var k=0,R=this.length-1;R>=0;R--){var T=(this.words[R]|0)+k*67108864;this.words[R]=T/p|0,k=T%p}return this._strip(),g?this.ineg():this},s.prototype.divn=function(p){return this.clone().idivn(p)},s.prototype.egcd=function(p){r(p.negative===0),r(!p.isZero());var g=this,k=p.clone();g.negative!==0?g=g.umod(p):g=g.clone();for(var R=new s(1),T=new s(0),M=new s(0),$=new s(1),O=0;g.isEven()&&k.isEven();)g.iushrn(1),k.iushrn(1),++O;for(var _=k.clone(),F=g.clone();!g.isZero();){for(var ue=0,ne=1;!(g.words[0]&ne)&&ue<26;++ue,ne<<=1);if(ue>0)for(g.iushrn(ue);ue-- >0;)(R.isOdd()||T.isOdd())&&(R.iadd(_),T.isub(F)),R.iushrn(1),T.iushrn(1);for(var q=0,J=1;!(k.words[0]&J)&&q<26;++q,J<<=1);if(q>0)for(k.iushrn(q);q-- >0;)(M.isOdd()||$.isOdd())&&(M.iadd(_),$.isub(F)),M.iushrn(1),$.iushrn(1);g.cmp(k)>=0?(g.isub(k),R.isub(M),T.isub($)):(k.isub(g),M.isub(R),$.isub(T))}return{a:M,b:$,gcd:k.iushln(O)}},s.prototype._invmp=function(p){r(p.negative===0),r(!p.isZero());var g=this,k=p.clone();g.negative!==0?g=g.umod(p):g=g.clone();for(var R=new s(1),T=new s(0),M=k.clone();g.cmpn(1)>0&&k.cmpn(1)>0;){for(var $=0,O=1;!(g.words[0]&O)&&$<26;++$,O<<=1);if($>0)for(g.iushrn($);$-- >0;)R.isOdd()&&R.iadd(M),R.iushrn(1);for(var _=0,F=1;!(k.words[0]&F)&&_<26;++_,F<<=1);if(_>0)for(k.iushrn(_);_-- >0;)T.isOdd()&&T.iadd(M),T.iushrn(1);g.cmp(k)>=0?(g.isub(k),R.isub(T)):(k.isub(g),T.isub(R))}var ue;return g.cmpn(1)===0?ue=R:ue=T,ue.cmpn(0)<0&&ue.iadd(p),ue},s.prototype.gcd=function(p){if(this.isZero())return p.abs();if(p.isZero())return this.abs();var g=this.clone(),k=p.clone();g.negative=0,k.negative=0;for(var R=0;g.isEven()&&k.isEven();R++)g.iushrn(1),k.iushrn(1);do{for(;g.isEven();)g.iushrn(1);for(;k.isEven();)k.iushrn(1);var T=g.cmp(k);if(T<0){var M=g;g=k,k=M}else if(T===0||k.cmpn(1)===0)break;g.isub(k)}while(!0);return k.iushln(R)},s.prototype.invm=function(p){return this.egcd(p).a.umod(p)},s.prototype.isEven=function(){return(this.words[0]&1)===0},s.prototype.isOdd=function(){return(this.words[0]&1)===1},s.prototype.andln=function(p){return this.words[0]&p},s.prototype.bincn=function(p){r(typeof p=="number");var g=p%26,k=(p-g)/26,R=1<<g;if(this.length<=k)return this._expand(k+1),this.words[k]|=R,this;for(var T=R,M=k;T!==0&&M<this.length;M++){var $=this.words[M]|0;$+=T,T=$>>>26,$&=67108863,this.words[M]=$}return T!==0&&(this.words[M]=T,this.length++),this},s.prototype.isZero=function(){return this.length===1&&this.words[0]===0},s.prototype.cmpn=function(p){var g=p<0;if(this.negative!==0&&!g)return-1;if(this.negative===0&&g)return 1;this._strip();var k;if(this.length>1)k=1;else{g&&(p=-p),r(p<=67108863,"Number is too big");var R=this.words[0]|0;k=R===p?0:R<p?-1:1}return this.negative!==0?-k|0:k},s.prototype.cmp=function(p){if(this.negative!==0&&p.negative===0)return-1;if(this.negative===0&&p.negative!==0)return 1;var g=this.ucmp(p);return this.negative!==0?-g|0:g},s.prototype.ucmp=function(p){if(this.length>p.length)return 1;if(this.length<p.length)return-1;for(var g=0,k=this.length-1;k>=0;k--){var R=this.words[k]|0,T=p.words[k]|0;if(R!==T){R<T?g=-1:R>T&&(g=1);break}}return g},s.prototype.gtn=function(p){return this.cmpn(p)===1},s.prototype.gt=function(p){return this.cmp(p)===1},s.prototype.gten=function(p){return this.cmpn(p)>=0},s.prototype.gte=function(p){return this.cmp(p)>=0},s.prototype.ltn=function(p){return this.cmpn(p)===-1},s.prototype.lt=function(p){return this.cmp(p)===-1},s.prototype.lten=function(p){return this.cmpn(p)<=0},s.prototype.lte=function(p){return this.cmp(p)<=0},s.prototype.eqn=function(p){return this.cmpn(p)===0},s.prototype.eq=function(p){return this.cmp(p)===0},s.red=function(p){return new Z(p)},s.prototype.toRed=function(p){return r(!this.red,"Already a number in reduction context"),r(this.negative===0,"red works only with positives"),p.convertTo(this)._forceRed(p)},s.prototype.fromRed=function(){return r(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},s.prototype._forceRed=function(p){return this.red=p,this},s.prototype.forceRed=function(p){return r(!this.red,"Already a number in reduction context"),this._forceRed(p)},s.prototype.redAdd=function(p){return r(this.red,"redAdd works only with red numbers"),this.red.add(this,p)},s.prototype.redIAdd=function(p){return r(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,p)},s.prototype.redSub=function(p){return r(this.red,"redSub works only with red numbers"),this.red.sub(this,p)},s.prototype.redISub=function(p){return r(this.red,"redISub works only with red numbers"),this.red.isub(this,p)},s.prototype.redShl=function(p){return r(this.red,"redShl works only with red numbers"),this.red.shl(this,p)},s.prototype.redMul=function(p){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,p),this.red.mul(this,p)},s.prototype.redIMul=function(p){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,p),this.red.imul(this,p)},s.prototype.redSqr=function(){return r(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},s.prototype.redISqr=function(){return r(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},s.prototype.redSqrt=function(){return r(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},s.prototype.redInvm=function(){return r(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},s.prototype.redNeg=function(){return r(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},s.prototype.redPow=function(p){return r(this.red&&!p.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,p)};var I={k256:null,p224:null,p192:null,p25519:null};function N(C,p){this.name=C,this.p=new s(p,16),this.n=this.p.bitLength(),this.k=new s(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}N.prototype._tmp=function(){var p=new s(null);return p.words=new Array(Math.ceil(this.n/13)),p},N.prototype.ireduce=function(p){var g=p,k;do this.split(g,this.tmp),g=this.imulK(g),g=g.iadd(this.tmp),k=g.bitLength();while(k>this.n);var R=k<this.n?-1:g.ucmp(this.p);return R===0?(g.words[0]=0,g.length=1):R>0?g.isub(this.p):g.strip!==void 0?g.strip():g._strip(),g},N.prototype.split=function(p,g){p.iushrn(this.n,0,g)},N.prototype.imulK=function(p){return p.imul(this.k)};function j(){N.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}i(j,N),j.prototype.split=function(p,g){for(var k=4194303,R=Math.min(p.length,9),T=0;T<R;T++)g.words[T]=p.words[T];if(g.length=R,p.length<=9){p.words[0]=0,p.length=1;return}var M=p.words[9];for(g.words[g.length++]=M&k,T=10;T<p.length;T++){var $=p.words[T]|0;p.words[T-10]=($&k)<<4|M>>>22,M=$}M>>>=22,p.words[T-10]=M,M===0&&p.length>10?p.length-=10:p.length-=9},j.prototype.imulK=function(p){p.words[p.length]=0,p.words[p.length+1]=0,p.length+=2;for(var g=0,k=0;k<p.length;k++){var R=p.words[k]|0;g+=R*977,p.words[k]=g&67108863,g=R*64+(g/67108864|0)}return p.words[p.length-1]===0&&(p.length--,p.words[p.length-1]===0&&p.length--),p};function U(){N.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}i(U,N);function L(){N.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}i(L,N);function Y(){N.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}i(Y,N),Y.prototype.imulK=function(p){for(var g=0,k=0;k<p.length;k++){var R=(p.words[k]|0)*19+g,T=R&67108863;R>>>=26,p.words[k]=T,g=R}return g!==0&&(p.words[p.length++]=g),p},s._prime=function(p){if(I[p])return I[p];var g;if(p==="k256")g=new j;else if(p==="p224")g=new U;else if(p==="p192")g=new L;else if(p==="p25519")g=new Y;else throw new Error("Unknown prime "+p);return I[p]=g,g};function Z(C){if(typeof C=="string"){var p=s._prime(C);this.m=p.p,this.prime=p}else r(C.gtn(1),"modulus must be greater than 1"),this.m=C,this.prime=null}Z.prototype._verify1=function(p){r(p.negative===0,"red works only with positives"),r(p.red,"red works only with red numbers")},Z.prototype._verify2=function(p,g){r((p.negative|g.negative)===0,"red works only with positives"),r(p.red&&p.red===g.red,"red works only with red numbers")},Z.prototype.imod=function(p){return this.prime?this.prime.ireduce(p)._forceRed(this):(l(p,p.umod(this.m)._forceRed(this)),p)},Z.prototype.neg=function(p){return p.isZero()?p.clone():this.m.sub(p)._forceRed(this)},Z.prototype.add=function(p,g){this._verify2(p,g);var k=p.add(g);return k.cmp(this.m)>=0&&k.isub(this.m),k._forceRed(this)},Z.prototype.iadd=function(p,g){this._verify2(p,g);var k=p.iadd(g);return k.cmp(this.m)>=0&&k.isub(this.m),k},Z.prototype.sub=function(p,g){this._verify2(p,g);var k=p.sub(g);return k.cmpn(0)<0&&k.iadd(this.m),k._forceRed(this)},Z.prototype.isub=function(p,g){this._verify2(p,g);var k=p.isub(g);return k.cmpn(0)<0&&k.iadd(this.m),k},Z.prototype.shl=function(p,g){return this._verify1(p),this.imod(p.ushln(g))},Z.prototype.imul=function(p,g){return this._verify2(p,g),this.imod(p.imul(g))},Z.prototype.mul=function(p,g){return this._verify2(p,g),this.imod(p.mul(g))},Z.prototype.isqr=function(p){return this.imul(p,p.clone())},Z.prototype.sqr=function(p){return this.mul(p,p)},Z.prototype.sqrt=function(p){if(p.isZero())return p.clone();var g=this.m.andln(3);if(r(g%2===1),g===3){var k=this.m.add(new s(1)).iushrn(2);return this.pow(p,k)}for(var R=this.m.subn(1),T=0;!R.isZero()&&R.andln(1)===0;)T++,R.iushrn(1);r(!R.isZero());var M=new s(1).toRed(this),$=M.redNeg(),O=this.m.subn(1).iushrn(1),_=this.m.bitLength();for(_=new s(2*_*_).toRed(this);this.pow(_,O).cmp($)!==0;)_.redIAdd($);for(var F=this.pow(_,R),ue=this.pow(p,R.addn(1).iushrn(1)),ne=this.pow(p,R),q=T;ne.cmp(M)!==0;){for(var J=ne,te=0;J.cmp(M)!==0;te++)J=J.redSqr();r(te<q);var le=this.pow(F,new s(1).iushln(q-te-1));ue=ue.redMul(le),F=le.redSqr(),ne=ne.redMul(F),q=te}return ue},Z.prototype.invm=function(p){var g=p._invmp(this.m);return g.negative!==0?(g.negative=0,this.imod(g).redNeg()):this.imod(g)},Z.prototype.pow=function(p,g){if(g.isZero())return new s(1).toRed(this);if(g.cmpn(1)===0)return p.clone();var k=4,R=new Array(1<<k);R[0]=new s(1).toRed(this),R[1]=p;for(var T=2;T<R.length;T++)R[T]=this.mul(R[T-1],p);var M=R[0],$=0,O=0,_=g.bitLength()%26;for(_===0&&(_=26),T=g.length-1;T>=0;T--){for(var F=g.words[T],ue=_-1;ue>=0;ue--){var ne=F>>ue&1;if(M!==R[0]&&(M=this.sqr(M)),ne===0&&$===0){O=0;continue}$<<=1,$|=ne,O++,!(O!==k&&(T!==0||ue!==0))&&(M=this.mul(M,R[$]),O=0,$=0)}_=26}return M},Z.prototype.convertTo=function(p){var g=p.umod(this.m);return g===p?g.clone():g},Z.prototype.convertFrom=function(p){var g=p.clone();return g.red=null,g},s.mont=function(p){return new G(p)};function G(C){Z.call(this,C),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new s(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)}i(G,Z),G.prototype.convertTo=function(p){return this.imod(p.ushln(this.shift))},G.prototype.convertFrom=function(p){var g=this.imod(p.mul(this.rinv));return g.red=null,g},G.prototype.imul=function(p,g){if(p.isZero()||g.isZero())return p.words[0]=0,p.length=1,p;var k=p.imul(g),R=k.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),T=k.isub(R).iushrn(this.shift),M=T;return T.cmp(this.m)>=0?M=T.isub(this.m):T.cmpn(0)<0&&(M=T.iadd(this.m)),M._forceRed(this)},G.prototype.mul=function(p,g){if(p.isZero()||g.isZero())return new s(0)._forceRed(this);var k=p.mul(g),R=k.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),T=k.isub(R).iushrn(this.shift),M=T;return T.cmp(this.m)>=0?M=T.isub(this.m):T.cmpn(0)<0&&(M=T.iadd(this.m)),M._forceRed(this)},G.prototype.invm=function(p){var g=this.imod(p._invmp(this.m).mul(this.r2));return g._forceRed(this)}})(e,Pe)}(tb);var fh=tb.exports,el={},ji={};Object.defineProperty(ji,"__esModule",{value:!0}),ji.errorValues=ji.standardErrorCodes=void 0,ji.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}},ji.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 hh={},ph={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.serialize=e.getErrorCode=e.isValidCode=e.getMessageFromCode=e.JSON_RPC_SERVER_ERROR_MESSAGE=void 0;const t=ji,n="Unspecified error message.";e.JSON_RPC_SERVER_ERROR_MESSAGE="Unspecified server error.";function r(f,h=n){if(f&&Number.isInteger(f)){const m=f.toString();if(l(t.errorValues,m))return t.errorValues[m].message;if(c(f))return e.JSON_RPC_SERVER_ERROR_MESSAGE}return h}e.getMessageFromCode=r;function i(f){if(!Number.isInteger(f))return!1;const h=f.toString();return!!(t.errorValues[h]||c(f))}e.isValidCode=i;function s(f){var h;if(typeof f=="number")return f;if(o(f))return(h=f.code)!==null&&h!==void 0?h:f.errorCode}e.getErrorCode=s;function o(f){return typeof f=="object"&&f!==null&&(typeof f.code=="number"||typeof f.errorCode=="number")}function a(f,{shouldIncludeStack:h=!1}={}){const m={};if(f&&typeof f=="object"&&!Array.isArray(f)&&l(f,"code")&&i(f.code)){const y=f;m.code=y.code,y.message&&typeof y.message=="string"?(m.message=y.message,l(y,"data")&&(m.data=y.data)):(m.message=r(m.code),m.data={originalError:u(f)})}else m.code=t.standardErrorCodes.rpc.internal,m.message=d(f,"message")?f.message:n,m.data={originalError:u(f)};return h&&(m.stack=d(f,"stack")?f.stack:void 0),m}e.serialize=a;function c(f){return f>=-32099&&f<=-32e3}function u(f){return f&&typeof f=="object"&&!Array.isArray(f)?Object.assign({},f):f}function l(f,h){return Object.prototype.hasOwnProperty.call(f,h)}function d(f,h){return typeof f=="object"&&f!==null&&h in f&&typeof f[h]=="string"}})(ph),Object.defineProperty(hh,"__esModule",{value:!0}),hh.standardErrors=void 0;const yn=ji,bS=ph;hh.standardErrors={rpc:{parse:e=>gr(yn.standardErrorCodes.rpc.parse,e),invalidRequest:e=>gr(yn.standardErrorCodes.rpc.invalidRequest,e),invalidParams:e=>gr(yn.standardErrorCodes.rpc.invalidParams,e),methodNotFound:e=>gr(yn.standardErrorCodes.rpc.methodNotFound,e),internal:e=>gr(yn.standardErrorCodes.rpc.internal,e),server:e=>{if(!e||typeof e!="object"||Array.isArray(e))throw new Error("Ethereum RPC Server errors must provide single object argument.");const{code:t}=e;if(!Number.isInteger(t)||t>-32005||t<-32099)throw new Error('"code" must be an integer such that: -32099 <= code <= -32005');return gr(t,e)},invalidInput:e=>gr(yn.standardErrorCodes.rpc.invalidInput,e),resourceNotFound:e=>gr(yn.standardErrorCodes.rpc.resourceNotFound,e),resourceUnavailable:e=>gr(yn.standardErrorCodes.rpc.resourceUnavailable,e),transactionRejected:e=>gr(yn.standardErrorCodes.rpc.transactionRejected,e),methodNotSupported:e=>gr(yn.standardErrorCodes.rpc.methodNotSupported,e),limitExceeded:e=>gr(yn.standardErrorCodes.rpc.limitExceeded,e)},provider:{userRejectedRequest:e=>qa(yn.standardErrorCodes.provider.userRejectedRequest,e),unauthorized:e=>qa(yn.standardErrorCodes.provider.unauthorized,e),unsupportedMethod:e=>qa(yn.standardErrorCodes.provider.unsupportedMethod,e),disconnected:e=>qa(yn.standardErrorCodes.provider.disconnected,e),chainDisconnected:e=>qa(yn.standardErrorCodes.provider.chainDisconnected,e),unsupportedChain:e=>qa(yn.standardErrorCodes.provider.unsupportedChain,e),custom:e=>{if(!e||typeof e!="object"||Array.isArray(e))throw new Error("Ethereum Provider custom errors must provide single object argument.");const{code:t,message:n,data:r}=e;if(!n||typeof n!="string")throw new Error('"message" must be a nonempty string');return new _S(t,n,r)}}};function gr(e,t){const[n,r]=wS(t);return new vS(e,n||(0,bS.getMessageFromCode)(e),r)}function qa(e,t){const[n,r]=wS(t);return new _S(e,n||(0,bS.getMessageFromCode)(e),r)}function wS(e){if(e){if(typeof e=="string")return[e];if(typeof e=="object"&&!Array.isArray(e)){const{message:t,data:n}=e;if(t&&typeof t!="string")throw new Error("Must specify string message.");return[t||void 0,n]}}return[]}let vS=class extends Error{constructor(t,n,r){if(!Number.isInteger(t))throw new Error('"code" must be an integer.');if(!n||typeof n!="string")throw new Error('"message" must be a nonempty string.');super(n),this.code=t,r!==void 0&&(this.data=r)}},_S=class extends vS{constructor(t,n,r){if(!BH(t))throw new Error('"code" must be an integer such that: 1000 <= code <= 4999');super(t,n,r)}};function BH(e){return Number.isInteger(e)&&e>=1e3&&e<=4999}var mh={},Va={};Object.defineProperty(Va,"__esModule",{value:!0}),Va.isErrorResponse=void 0;function NH(e){return e.errorMessage!==void 0}Va.isErrorResponse=NH;var Ka={};Object.defineProperty(Ka,"__esModule",{value:!0}),Ka.LIB_VERSION=void 0,Ka.LIB_VERSION="3.9.3",Object.defineProperty(mh,"__esModule",{value:!0}),mh.serializeError=void 0;const LH=Va,jH=Ka,$H=ji,FH=ph;function DH(e,t){const n=(0,FH.serialize)(UH(e),{shouldIncludeStack:!0}),r=new URL("https://docs.cloud.coinbase.com/wallet-sdk/docs/errors");r.searchParams.set("version",jH.LIB_VERSION),r.searchParams.set("code",n.code.toString());const i=HH(n.data,t);return i&&r.searchParams.set("method",i),r.searchParams.set("message",n.message),Object.assign(Object.assign({},n),{docUrl:r.href})}mh.serializeError=DH;function UH(e){return typeof e=="string"?{message:e,code:$H.standardErrorCodes.rpc.internal}:(0,LH.isErrorResponse)(e)?Object.assign(Object.assign({},e),{message:e.errorMessage,code:e.errorCode,data:{method:e.method}}):e}function HH(e,t){const n=e==null?void 0:e.method;if(n)return n;if(t!==void 0){if(typeof t=="string")return t;if(Array.isArray(t)){if(t.length>0)return t[0].method}else return t.method}}(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.standardErrors=e.standardErrorCodes=e.serializeError=e.getMessageFromCode=e.getErrorCode=void 0;const t=ji;Object.defineProperty(e,"standardErrorCodes",{enumerable:!0,get:function(){return t.standardErrorCodes}});const n=hh;Object.defineProperty(e,"standardErrors",{enumerable:!0,get:function(){return n.standardErrors}});const r=mh;Object.defineProperty(e,"serializeError",{enumerable:!0,get:function(){return r.serializeError}});const i=ph;Object.defineProperty(e,"getErrorCode",{enumerable:!0,get:function(){return i.getErrorCode}}),Object.defineProperty(e,"getMessageFromCode",{enumerable:!0,get:function(){return i.getMessageFromCode}})})(el);var sn={};Object.defineProperty(sn,"__esModule",{value:!0}),sn.ProviderType=sn.RegExpString=sn.IntNumber=sn.BigIntString=sn.AddressString=sn.HexString=sn.OpaqueType=void 0;function tl(){return e=>e}sn.OpaqueType=tl,sn.HexString=tl(),sn.AddressString=tl(),sn.BigIntString=tl();function zH(e){return Math.floor(e)}sn.IntNumber=zH,sn.RegExpString=tl();var ES;(function(e){e.CoinbaseWallet="CoinbaseWallet",e.MetaMask="MetaMask",e.Unselected=""})(ES||(sn.ProviderType=ES={}));var WH=Pe&&Pe.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Ie,"__esModule",{value:!0}),Ie.isMobileWeb=Ie.getLocation=Ie.isInIFrame=Ie.createQrUrl=Ie.getFavicon=Ie.range=Ie.isBigNumber=Ie.ensureParsedJSONObject=Ie.ensureBN=Ie.ensureRegExpString=Ie.ensureIntNumber=Ie.ensureBuffer=Ie.ensureAddressString=Ie.ensureEvenLengthHexString=Ie.ensureHexString=Ie.isHexString=Ie.prepend0x=Ie.strip0x=Ie.has0xPrefix=Ie.hexStringFromIntNumber=Ie.intNumberFromHexString=Ie.bigIntStringFromBN=Ie.hexStringFromBuffer=Ie.hexStringToUint8Array=Ie.uint8ArrayToHex=Ie.randomBytesHex=void 0;const xs=WH(fh),vo=el,yr=sn,xS=/^[0-9]*$/,SS=/^[a-f0-9]*$/;function GH(e){return kS(crypto.getRandomValues(new Uint8Array(e)))}Ie.randomBytesHex=GH;function kS(e){return[...e].map(t=>t.toString(16).padStart(2,"0")).join("")}Ie.uint8ArrayToHex=kS;function qH(e){return new Uint8Array(e.match(/.{1,2}/g).map(t=>parseInt(t,16)))}Ie.hexStringToUint8Array=qH;function VH(e,t=!1){const n=e.toString("hex");return(0,yr.HexString)(t?`0x${n}`:n)}Ie.hexStringFromBuffer=VH;function KH(e){return(0,yr.BigIntString)(e.toString(10))}Ie.bigIntStringFromBN=KH;function JH(e){return(0,yr.IntNumber)(new xs.default(rl(e,!1),16).toNumber())}Ie.intNumberFromHexString=JH;function ZH(e){return(0,yr.HexString)(`0x${new xs.default(e).toString(16)}`)}Ie.hexStringFromIntNumber=ZH;function rb(e){return e.startsWith("0x")||e.startsWith("0X")}Ie.has0xPrefix=rb;function gh(e){return rb(e)?e.slice(2):e}Ie.strip0x=gh;function AS(e){return rb(e)?`0x${e.slice(2)}`:`0x${e}`}Ie.prepend0x=AS;function nl(e){if(typeof e!="string")return!1;const t=gh(e).toLowerCase();return SS.test(t)}Ie.isHexString=nl;function IS(e,t=!1){if(typeof e=="string"){const n=gh(e).toLowerCase();if(SS.test(n))return(0,yr.HexString)(t?`0x${n}`:n)}throw vo.standardErrors.rpc.invalidParams(`"${String(e)}" is not a hexadecimal string`)}Ie.ensureHexString=IS;function rl(e,t=!1){let n=IS(e,!1);return n.length%2===1&&(n=(0,yr.HexString)(`0${n}`)),t?(0,yr.HexString)(`0x${n}`):n}Ie.ensureEvenLengthHexString=rl;function YH(e){if(typeof e=="string"){const t=gh(e).toLowerCase();if(nl(t)&&t.length===40)return(0,yr.AddressString)(AS(t))}throw vo.standardErrors.rpc.invalidParams(`Invalid Ethereum address: ${String(e)}`)}Ie.ensureAddressString=YH;function QH(e){if(Buffer.isBuffer(e))return e;if(typeof e=="string"){if(nl(e)){const t=rl(e,!1);return Buffer.from(t,"hex")}return Buffer.from(e,"utf8")}throw vo.standardErrors.rpc.invalidParams(`Not binary data: ${String(e)}`)}Ie.ensureBuffer=QH;function CS(e){if(typeof e=="number"&&Number.isInteger(e))return(0,yr.IntNumber)(e);if(typeof e=="string"){if(xS.test(e))return(0,yr.IntNumber)(Number(e));if(nl(e))return(0,yr.IntNumber)(new xs.default(rl(e,!1),16).toNumber())}throw vo.standardErrors.rpc.invalidParams(`Not an integer: ${String(e)}`)}Ie.ensureIntNumber=CS;function XH(e){if(e instanceof RegExp)return(0,yr.RegExpString)(e.toString());throw vo.standardErrors.rpc.invalidParams(`Not a RegExp: ${String(e)}`)}Ie.ensureRegExpString=XH;function ez(e){if(e!==null&&(xs.default.isBN(e)||PS(e)))return new xs.default(e.toString(10),10);if(typeof e=="number")return new xs.default(CS(e));if(typeof e=="string"){if(xS.test(e))return new xs.default(e,10);if(nl(e))return new xs.default(rl(e,!1),16)}throw vo.standardErrors.rpc.invalidParams(`Not an integer: ${String(e)}`)}Ie.ensureBN=ez;function tz(e){if(typeof e=="string")return JSON.parse(e);if(typeof e=="object")return e;throw vo.standardErrors.rpc.invalidParams(`Not a JSON string or an object: ${String(e)}`)}Ie.ensureParsedJSONObject=tz;function PS(e){if(e==null||typeof e.constructor!="function")return!1;const{constructor:t}=e;return typeof t.config=="function"&&typeof t.EUCLID=="number"}Ie.isBigNumber=PS;function nz(e,t){return Array.from({length:t-e},(n,r)=>e+r)}Ie.range=nz;function rz(){const e=document.querySelector('link[sizes="192x192"]')||document.querySelector('link[sizes="180x180"]')||document.querySelector('link[rel="icon"]')||document.querySelector('link[rel="shortcut icon"]'),{protocol:t,host:n}=document.location,r=e?e.getAttribute("href"):null;return!r||r.startsWith("javascript:")||r.startsWith("vbscript:")?null:r.startsWith("http://")||r.startsWith("https://")||r.startsWith("data:")?r:r.startsWith("//")?t+r:`${t}//${n}${r}`}Ie.getFavicon=rz;function iz(e,t,n,r,i,s){const o=r?"parent-id":"id",a=new URLSearchParams({[o]:e,secret:t,server:n,v:i,chainId:s.toString()}).toString();return`${n}/#/link?${a}`}Ie.createQrUrl=iz;function RS(){try{return window.frameElement!==null}catch{return!1}}Ie.isInIFrame=RS;function sz(){try{return RS()&&window.top?window.top.location:window.location}catch{return window.location}}Ie.getLocation=sz;function oz(){var e;return/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test((e=window==null?void 0:window.navigator)===null||e===void 0?void 0:e.userAgent)}Ie.isMobileWeb=oz;var yh={};Object.defineProperty(yh,"__esModule",{value:!0}),yh.ScopedLocalStorage=void 0;class az{constructor(t){this.scope=t}setItem(t,n){localStorage.setItem(this.scopedKey(t),n)}getItem(t){return localStorage.getItem(this.scopedKey(t))}removeItem(t){localStorage.removeItem(this.scopedKey(t))}clear(){const t=this.scopedKey(""),n=[];for(let r=0;r<localStorage.length;r++){const i=localStorage.key(r);typeof i=="string"&&i.startsWith(t)&&n.push(i)}n.forEach(r=>localStorage.removeItem(r))}scopedKey(t){return`${this.scope}:${t}`}}yh.ScopedLocalStorage=az;var Ja={},TS={exports:{}};(function(e){var t=Object.prototype.hasOwnProperty,n="~";function r(){}Object.create&&(r.prototype=Object.create(null),new r().__proto__||(n=!1));function i(c,u,l){this.fn=c,this.context=u,this.once=l||!1}function s(c,u,l,d,f){if(typeof l!="function")throw new TypeError("The listener must be a function");var h=new i(l,d||c,f),m=n?n+u:u;return c._events[m]?c._events[m].fn?c._events[m]=[c._events[m],h]:c._events[m].push(h):(c._events[m]=h,c._eventsCount++),c}function o(c,u){--c._eventsCount===0?c._events=new r:delete c._events[u]}function a(){this._events=new r,this._eventsCount=0}a.prototype.eventNames=function(){var u=[],l,d;if(this._eventsCount===0)return u;for(d in l=this._events)t.call(l,d)&&u.push(n?d.slice(1):d);return Object.getOwnPropertySymbols?u.concat(Object.getOwnPropertySymbols(l)):u},a.prototype.listeners=function(u){var l=n?n+u:u,d=this._events[l];if(!d)return[];if(d.fn)return[d.fn];for(var f=0,h=d.length,m=new Array(h);f<h;f++)m[f]=d[f].fn;return m},a.prototype.listenerCount=function(u){var l=n?n+u:u,d=this._events[l];return d?d.fn?1:d.length:0},a.prototype.emit=function(u,l,d,f,h,m){var y=n?n+u:u;if(!this._events[y])return!1;var w=this._events[y],b=arguments.length,x,v;if(w.fn){switch(w.once&&this.removeListener(u,w.fn,void 0,!0),b){case 1:return w.fn.call(w.context),!0;case 2:return w.fn.call(w.context,l),!0;case 3:return w.fn.call(w.context,l,d),!0;case 4:return w.fn.call(w.context,l,d,f),!0;case 5:return w.fn.call(w.context,l,d,f,h),!0;case 6:return w.fn.call(w.context,l,d,f,h,m),!0}for(v=1,x=new Array(b-1);v<b;v++)x[v-1]=arguments[v];w.fn.apply(w.context,x)}else{var S=w.length,I;for(v=0;v<S;v++)switch(w[v].once&&this.removeListener(u,w[v].fn,void 0,!0),b){case 1:w[v].fn.call(w[v].context);break;case 2:w[v].fn.call(w[v].context,l);break;case 3:w[v].fn.call(w[v].context,l,d);break;case 4:w[v].fn.call(w[v].context,l,d,f);break;default:if(!x)for(I=1,x=new Array(b-1);I<b;I++)x[I-1]=arguments[I];w[v].fn.apply(w[v].context,x)}}return!0},a.prototype.on=function(u,l,d){return s(this,u,l,d,!1)},a.prototype.once=function(u,l,d){return s(this,u,l,d,!0)},a.prototype.removeListener=function(u,l,d,f){var h=n?n+u:u;if(!this._events[h])return this;if(!l)return o(this,h),this;var m=this._events[h];if(m.fn)m.fn===l&&(!f||m.once)&&(!d||m.context===d)&&o(this,h);else{for(var y=0,w=[],b=m.length;y<b;y++)(m[y].fn!==l||f&&!m[y].once||d&&m[y].context!==d)&&w.push(m[y]);w.length?this._events[h]=w.length===1?w[0]:w:o(this,h)}return this},a.prototype.removeAllListeners=function(u){var l;return u?(l=n?n+u:u,this._events[l]&&o(this,l)):(this._events=new r,this._eventsCount=0),this},a.prototype.off=a.prototype.removeListener,a.prototype.addListener=a.prototype.on,a.prefixed=n,a.EventEmitter=a,e.exports=a})(TS);var cz=TS.exports,il={},sl={},Za={};Object.defineProperty(Za,"__esModule",{value:!0}),Za.EVENTS=void 0,Za.EVENTS={STARTED_CONNECTING:"walletlink_sdk.started.connecting",CONNECTED_STATE_CHANGE:"walletlink_sdk.connected",DISCONNECTED:"walletlink_sdk.disconnected",METADATA_DESTROYED:"walletlink_sdk_metadata_destroyed",LINKED:"walletlink_sdk.linked",FAILURE:"walletlink_sdk.generic_failure",SESSION_CONFIG_RECEIVED:"walletlink_sdk.session_config_event_received",ETH_ACCOUNTS_STATE:"walletlink_sdk.eth_accounts_state",SESSION_STATE_CHANGE:"walletlink_sdk.session_state_change",UNLINKED_ERROR_STATE:"walletlink_sdk.unlinked_error_state",SKIPPED_CLEARING_SESSION:"walletlink_sdk.skipped_clearing_session",GENERAL_ERROR:"walletlink_sdk.general_error",WEB3_REQUEST:"walletlink_sdk.web3.request",WEB3_REQUEST_PUBLISHED:"walletlink_sdk.web3.request_published",WEB3_RESPONSE:"walletlink_sdk.web3.response",METHOD_NOT_IMPLEMENTED:"walletlink_sdk.method_not_implemented",UNKNOWN_ADDRESS_ENCOUNTERED:"walletlink_sdk.unknown_address_encountered"};var br={};Object.defineProperty(br,"__esModule",{value:!0}),br.RelayAbstract=br.APP_VERSION_KEY=br.LOCAL_STORAGE_ADDRESSES_KEY=br.WALLET_USER_NAME_KEY=void 0;const OS=el;br.WALLET_USER_NAME_KEY="walletUsername",br.LOCAL_STORAGE_ADDRESSES_KEY="Addresses",br.APP_VERSION_KEY="AppVersion";class uz{async makeEthereumJSONRPCRequest(t,n){if(!n)throw new Error("Error: No jsonRpcUrl provided");return window.fetch(n,{method:"POST",body:JSON.stringify(t),mode:"cors",headers:{"Content-Type":"application/json"}}).then(r=>r.json()).then(r=>{if(!r)throw OS.standardErrors.rpc.parse({});const i=r,{error:s}=i;if(s)throw(0,OS.serializeError)(s,t.method);return i})}}br.RelayAbstract=uz;var Ya={},MS={exports:{}},ib={exports:{}};typeof Object.create=="function"?ib.exports=function(t,n){n&&(t.super_=n,t.prototype=Object.create(n.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}))}:ib.exports=function(t,n){if(n){t.super_=n;var r=function(){};r.prototype=n.prototype,t.prototype=new r,t.prototype.constructor=t}};var $r=ib.exports,sb={exports:{}},ol={},bh={};bh.byteLength=fz,bh.toByteArray=pz,bh.fromByteArray=yz;for(var Xr=[],wr=[],lz=typeof Uint8Array<"u"?Uint8Array:Array,ob="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Qa=0,dz=ob.length;Qa<dz;++Qa)Xr[Qa]=ob[Qa],wr[ob.charCodeAt(Qa)]=Qa;wr[45]=62,wr[95]=63;function BS(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var n=e.indexOf("=");n===-1&&(n=t);var r=n===t?0:4-n%4;return[n,r]}function fz(e){var t=BS(e),n=t[0],r=t[1];return(n+r)*3/4-r}function hz(e,t,n){return(t+n)*3/4-n}function pz(e){var t,n=BS(e),r=n[0],i=n[1],s=new lz(hz(e,r,i)),o=0,a=i>0?r-4:r,c;for(c=0;c<a;c+=4)t=wr[e.charCodeAt(c)]<<18|wr[e.charCodeAt(c+1)]<<12|wr[e.charCodeAt(c+2)]<<6|wr[e.charCodeAt(c+3)],s[o++]=t>>16&255,s[o++]=t>>8&255,s[o++]=t&255;return i===2&&(t=wr[e.charCodeAt(c)]<<2|wr[e.charCodeAt(c+1)]>>4,s[o++]=t&255),i===1&&(t=wr[e.charCodeAt(c)]<<10|wr[e.charCodeAt(c+1)]<<4|wr[e.charCodeAt(c+2)]>>2,s[o++]=t>>8&255,s[o++]=t&255),s}function mz(e){return Xr[e>>18&63]+Xr[e>>12&63]+Xr[e>>6&63]+Xr[e&63]}function gz(e,t,n){for(var r,i=[],s=t;s<n;s+=3)r=(e[s]<<16&16711680)+(e[s+1]<<8&65280)+(e[s+2]&255),i.push(mz(r));return i.join("")}function yz(e){for(var t,n=e.length,r=n%3,i=[],s=16383,o=0,a=n-r;o<a;o+=s)i.push(gz(e,o,o+s>a?a:o+s));return r===1?(t=e[n-1],i.push(Xr[t>>2]+Xr[t<<4&63]+"==")):r===2&&(t=(e[n-2]<<8)+e[n-1],i.push(Xr[t>>10]+Xr[t>>4&63]+Xr[t<<2&63]+"=")),i.join("")}var ab={};/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */ab.read=function(e,t,n,r,i){var s,o,a=i*8-r-1,c=(1<<a)-1,u=c>>1,l=-7,d=n?i-1:0,f=n?-1:1,h=e[t+d];for(d+=f,s=h&(1<<-l)-1,h>>=-l,l+=a;l>0;s=s*256+e[t+d],d+=f,l-=8);for(o=s&(1<<-l)-1,s>>=-l,l+=r;l>0;o=o*256+e[t+d],d+=f,l-=8);if(s===0)s=1-u;else{if(s===c)return o?NaN:(h?-1:1)*(1/0);o=o+Math.pow(2,r),s=s-u}return(h?-1:1)*o*Math.pow(2,s-r)},ab.write=function(e,t,n,r,i,s){var o,a,c,u=s*8-i-1,l=(1<<u)-1,d=l>>1,f=i===23?Math.pow(2,-24)-Math.pow(2,-77):0,h=r?0:s-1,m=r?1:-1,y=t<0||t===0&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(a=isNaN(t)?1:0,o=l):(o=Math.floor(Math.log(t)/Math.LN2),t*(c=Math.pow(2,-o))<1&&(o--,c*=2),o+d>=1?t+=f/c:t+=f*Math.pow(2,1-d),t*c>=2&&(o++,c/=2),o+d>=l?(a=0,o=l):o+d>=1?(a=(t*c-1)*Math.pow(2,i),o=o+d):(a=t*Math.pow(2,d-1)*Math.pow(2,i),o=0));i>=8;e[n+h]=a&255,h+=m,a/=256,i-=8);for(o=o<<i|a,u+=i;u>0;e[n+h]=o&255,h+=m,o/=256,u-=8);e[n+h-m]|=y*128};/*!
121
+ * The buffer module from node.js, for the browser.
122
+ *
123
+ * @author Feross Aboukhadijeh <https://feross.org>
124
+ * @license MIT
125
+ */(function(e){const t=bh,n=ab,r=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;e.Buffer=a,e.SlowBuffer=x,e.INSPECT_MAX_BYTES=50;const i=2147483647;e.kMaxLength=i,a.TYPED_ARRAY_SUPPORT=s(),!a.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 s(){try{const B=new Uint8Array(1),E={foo:function(){return 42}};return Object.setPrototypeOf(E,Uint8Array.prototype),Object.setPrototypeOf(B,E),B.foo()===42}catch{return!1}}Object.defineProperty(a.prototype,"parent",{enumerable:!0,get:function(){if(a.isBuffer(this))return this.buffer}}),Object.defineProperty(a.prototype,"offset",{enumerable:!0,get:function(){if(a.isBuffer(this))return this.byteOffset}});function o(B){if(B>i)throw new RangeError('The value "'+B+'" is invalid for option "size"');const E=new Uint8Array(B);return Object.setPrototypeOf(E,a.prototype),E}function a(B,E,A){if(typeof B=="number"){if(typeof E=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return d(B)}return c(B,E,A)}a.poolSize=8192;function c(B,E,A){if(typeof B=="string")return f(B,E);if(ArrayBuffer.isView(B))return m(B);if(B==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof B);if(At(B,ArrayBuffer)||B&&At(B.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(At(B,SharedArrayBuffer)||B&&At(B.buffer,SharedArrayBuffer)))return y(B,E,A);if(typeof B=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');const H=B.valueOf&&B.valueOf();if(H!=null&&H!==B)return a.from(H,E,A);const Q=w(B);if(Q)return Q;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof B[Symbol.toPrimitive]=="function")return a.from(B[Symbol.toPrimitive]("string"),E,A);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof B)}a.from=function(B,E,A){return c(B,E,A)},Object.setPrototypeOf(a.prototype,Uint8Array.prototype),Object.setPrototypeOf(a,Uint8Array);function u(B){if(typeof B!="number")throw new TypeError('"size" argument must be of type number');if(B<0)throw new RangeError('The value "'+B+'" is invalid for option "size"')}function l(B,E,A){return u(B),B<=0?o(B):E!==void 0?typeof A=="string"?o(B).fill(E,A):o(B).fill(E):o(B)}a.alloc=function(B,E,A){return l(B,E,A)};function d(B){return u(B),o(B<0?0:b(B)|0)}a.allocUnsafe=function(B){return d(B)},a.allocUnsafeSlow=function(B){return d(B)};function f(B,E){if((typeof E!="string"||E==="")&&(E="utf8"),!a.isEncoding(E))throw new TypeError("Unknown encoding: "+E);const A=v(B,E)|0;let H=o(A);const Q=H.write(B,E);return Q!==A&&(H=H.slice(0,Q)),H}function h(B){const E=B.length<0?0:b(B.length)|0,A=o(E);for(let H=0;H<E;H+=1)A[H]=B[H]&255;return A}function m(B){if(At(B,Uint8Array)){const E=new Uint8Array(B);return y(E.buffer,E.byteOffset,E.byteLength)}return h(B)}function y(B,E,A){if(E<0||B.byteLength<E)throw new RangeError('"offset" is outside of buffer bounds');if(B.byteLength<E+(A||0))throw new RangeError('"length" is outside of buffer bounds');let H;return E===void 0&&A===void 0?H=new Uint8Array(B):A===void 0?H=new Uint8Array(B,E):H=new Uint8Array(B,E,A),Object.setPrototypeOf(H,a.prototype),H}function w(B){if(a.isBuffer(B)){const E=b(B.length)|0,A=o(E);return A.length===0||B.copy(A,0,0,E),A}if(B.length!==void 0)return typeof B.length!="number"||Fe(B.length)?o(0):h(B);if(B.type==="Buffer"&&Array.isArray(B.data))return h(B.data)}function b(B){if(B>=i)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+i.toString(16)+" bytes");return B|0}function x(B){return+B!=B&&(B=0),a.alloc(+B)}a.isBuffer=function(E){return E!=null&&E._isBuffer===!0&&E!==a.prototype},a.compare=function(E,A){if(At(E,Uint8Array)&&(E=a.from(E,E.offset,E.byteLength)),At(A,Uint8Array)&&(A=a.from(A,A.offset,A.byteLength)),!a.isBuffer(E)||!a.isBuffer(A))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(E===A)return 0;let H=E.length,Q=A.length;for(let X=0,re=Math.min(H,Q);X<re;++X)if(E[X]!==A[X]){H=E[X],Q=A[X];break}return H<Q?-1:Q<H?1:0},a.isEncoding=function(E){switch(String(E).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},a.concat=function(E,A){if(!Array.isArray(E))throw new TypeError('"list" argument must be an Array of Buffers');if(E.length===0)return a.alloc(0);let H;if(A===void 0)for(A=0,H=0;H<E.length;++H)A+=E[H].length;const Q=a.allocUnsafe(A);let X=0;for(H=0;H<E.length;++H){let re=E[H];if(At(re,Uint8Array))X+re.length>Q.length?(a.isBuffer(re)||(re=a.from(re)),re.copy(Q,X)):Uint8Array.prototype.set.call(Q,re,X);else if(a.isBuffer(re))re.copy(Q,X);else throw new TypeError('"list" argument must be an Array of Buffers');X+=re.length}return Q};function v(B,E){if(a.isBuffer(B))return B.length;if(ArrayBuffer.isView(B)||At(B,ArrayBuffer))return B.byteLength;if(typeof B!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof B);const A=B.length,H=arguments.length>2&&arguments[2]===!0;if(!H&&A===0)return 0;let Q=!1;for(;;)switch(E){case"ascii":case"latin1":case"binary":return A;case"utf8":case"utf-8":return xe(B).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return A*2;case"hex":return A>>>1;case"base64":return $e(B).length;default:if(Q)return H?-1:xe(B).length;E=(""+E).toLowerCase(),Q=!0}}a.byteLength=v;function S(B,E,A){let H=!1;if((E===void 0||E<0)&&(E=0),E>this.length||((A===void 0||A>this.length)&&(A=this.length),A<=0)||(A>>>=0,E>>>=0,A<=E))return"";for(B||(B="utf8");;)switch(B){case"hex":return M(this,E,A);case"utf8":case"utf-8":return p(this,E,A);case"ascii":return R(this,E,A);case"latin1":case"binary":return T(this,E,A);case"base64":return C(this,E,A);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return $(this,E,A);default:if(H)throw new TypeError("Unknown encoding: "+B);B=(B+"").toLowerCase(),H=!0}}a.prototype._isBuffer=!0;function I(B,E,A){const H=B[E];B[E]=B[A],B[A]=H}a.prototype.swap16=function(){const E=this.length;if(E%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let A=0;A<E;A+=2)I(this,A,A+1);return this},a.prototype.swap32=function(){const E=this.length;if(E%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let A=0;A<E;A+=4)I(this,A,A+3),I(this,A+1,A+2);return this},a.prototype.swap64=function(){const E=this.length;if(E%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let A=0;A<E;A+=8)I(this,A,A+7),I(this,A+1,A+6),I(this,A+2,A+5),I(this,A+3,A+4);return this},a.prototype.toString=function(){const E=this.length;return E===0?"":arguments.length===0?p(this,0,E):S.apply(this,arguments)},a.prototype.toLocaleString=a.prototype.toString,a.prototype.equals=function(E){if(!a.isBuffer(E))throw new TypeError("Argument must be a Buffer");return this===E?!0:a.compare(this,E)===0},a.prototype.inspect=function(){let E="";const A=e.INSPECT_MAX_BYTES;return E=this.toString("hex",0,A).replace(/(.{2})/g,"$1 ").trim(),this.length>A&&(E+=" ... "),"<Buffer "+E+">"},r&&(a.prototype[r]=a.prototype.inspect),a.prototype.compare=function(E,A,H,Q,X){if(At(E,Uint8Array)&&(E=a.from(E,E.offset,E.byteLength)),!a.isBuffer(E))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof E);if(A===void 0&&(A=0),H===void 0&&(H=E?E.length:0),Q===void 0&&(Q=0),X===void 0&&(X=this.length),A<0||H>E.length||Q<0||X>this.length)throw new RangeError("out of range index");if(Q>=X&&A>=H)return 0;if(Q>=X)return-1;if(A>=H)return 1;if(A>>>=0,H>>>=0,Q>>>=0,X>>>=0,this===E)return 0;let re=X-Q,Me=H-A;const Oe=Math.min(re,Me),Te=this.slice(Q,X),ot=E.slice(A,H);for(let Ce=0;Ce<Oe;++Ce)if(Te[Ce]!==ot[Ce]){re=Te[Ce],Me=ot[Ce];break}return re<Me?-1:Me<re?1:0};function N(B,E,A,H,Q){if(B.length===0)return-1;if(typeof A=="string"?(H=A,A=0):A>2147483647?A=2147483647:A<-2147483648&&(A=-2147483648),A=+A,Fe(A)&&(A=Q?0:B.length-1),A<0&&(A=B.length+A),A>=B.length){if(Q)return-1;A=B.length-1}else if(A<0)if(Q)A=0;else return-1;if(typeof E=="string"&&(E=a.from(E,H)),a.isBuffer(E))return E.length===0?-1:j(B,E,A,H,Q);if(typeof E=="number")return E=E&255,typeof Uint8Array.prototype.indexOf=="function"?Q?Uint8Array.prototype.indexOf.call(B,E,A):Uint8Array.prototype.lastIndexOf.call(B,E,A):j(B,[E],A,H,Q);throw new TypeError("val must be string, number or Buffer")}function j(B,E,A,H,Q){let X=1,re=B.length,Me=E.length;if(H!==void 0&&(H=String(H).toLowerCase(),H==="ucs2"||H==="ucs-2"||H==="utf16le"||H==="utf-16le")){if(B.length<2||E.length<2)return-1;X=2,re/=2,Me/=2,A/=2}function Oe(ot,Ce){return X===1?ot[Ce]:ot.readUInt16BE(Ce*X)}let Te;if(Q){let ot=-1;for(Te=A;Te<re;Te++)if(Oe(B,Te)===Oe(E,ot===-1?0:Te-ot)){if(ot===-1&&(ot=Te),Te-ot+1===Me)return ot*X}else ot!==-1&&(Te-=Te-ot),ot=-1}else for(A+Me>re&&(A=re-Me),Te=A;Te>=0;Te--){let ot=!0;for(let Ce=0;Ce<Me;Ce++)if(Oe(B,Te+Ce)!==Oe(E,Ce)){ot=!1;break}if(ot)return Te}return-1}a.prototype.includes=function(E,A,H){return this.indexOf(E,A,H)!==-1},a.prototype.indexOf=function(E,A,H){return N(this,E,A,H,!0)},a.prototype.lastIndexOf=function(E,A,H){return N(this,E,A,H,!1)};function U(B,E,A,H){A=Number(A)||0;const Q=B.length-A;H?(H=Number(H),H>Q&&(H=Q)):H=Q;const X=E.length;H>X/2&&(H=X/2);let re;for(re=0;re<H;++re){const Me=parseInt(E.substr(re*2,2),16);if(Fe(Me))return re;B[A+re]=Me}return re}function L(B,E,A,H){return Qe(xe(E,B.length-A),B,A,H)}function Y(B,E,A,H){return Qe(Ge(E),B,A,H)}function Z(B,E,A,H){return Qe($e(E),B,A,H)}function G(B,E,A,H){return Qe(Tt(E,B.length-A),B,A,H)}a.prototype.write=function(E,A,H,Q){if(A===void 0)Q="utf8",H=this.length,A=0;else if(H===void 0&&typeof A=="string")Q=A,H=this.length,A=0;else if(isFinite(A))A=A>>>0,isFinite(H)?(H=H>>>0,Q===void 0&&(Q="utf8")):(Q=H,H=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");const X=this.length-A;if((H===void 0||H>X)&&(H=X),E.length>0&&(H<0||A<0)||A>this.length)throw new RangeError("Attempt to write outside buffer bounds");Q||(Q="utf8");let re=!1;for(;;)switch(Q){case"hex":return U(this,E,A,H);case"utf8":case"utf-8":return L(this,E,A,H);case"ascii":case"latin1":case"binary":return Y(this,E,A,H);case"base64":return Z(this,E,A,H);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return G(this,E,A,H);default:if(re)throw new TypeError("Unknown encoding: "+Q);Q=(""+Q).toLowerCase(),re=!0}},a.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function C(B,E,A){return E===0&&A===B.length?t.fromByteArray(B):t.fromByteArray(B.slice(E,A))}function p(B,E,A){A=Math.min(B.length,A);const H=[];let Q=E;for(;Q<A;){const X=B[Q];let re=null,Me=X>239?4:X>223?3:X>191?2:1;if(Q+Me<=A){let Oe,Te,ot,Ce;switch(Me){case 1:X<128&&(re=X);break;case 2:Oe=B[Q+1],(Oe&192)===128&&(Ce=(X&31)<<6|Oe&63,Ce>127&&(re=Ce));break;case 3:Oe=B[Q+1],Te=B[Q+2],(Oe&192)===128&&(Te&192)===128&&(Ce=(X&15)<<12|(Oe&63)<<6|Te&63,Ce>2047&&(Ce<55296||Ce>57343)&&(re=Ce));break;case 4:Oe=B[Q+1],Te=B[Q+2],ot=B[Q+3],(Oe&192)===128&&(Te&192)===128&&(ot&192)===128&&(Ce=(X&15)<<18|(Oe&63)<<12|(Te&63)<<6|ot&63,Ce>65535&&Ce<1114112&&(re=Ce))}}re===null?(re=65533,Me=1):re>65535&&(re-=65536,H.push(re>>>10&1023|55296),re=56320|re&1023),H.push(re),Q+=Me}return k(H)}const g=4096;function k(B){const E=B.length;if(E<=g)return String.fromCharCode.apply(String,B);let A="",H=0;for(;H<E;)A+=String.fromCharCode.apply(String,B.slice(H,H+=g));return A}function R(B,E,A){let H="";A=Math.min(B.length,A);for(let Q=E;Q<A;++Q)H+=String.fromCharCode(B[Q]&127);return H}function T(B,E,A){let H="";A=Math.min(B.length,A);for(let Q=E;Q<A;++Q)H+=String.fromCharCode(B[Q]);return H}function M(B,E,A){const H=B.length;(!E||E<0)&&(E=0),(!A||A<0||A>H)&&(A=H);let Q="";for(let X=E;X<A;++X)Q+=Xe[B[X]];return Q}function $(B,E,A){const H=B.slice(E,A);let Q="";for(let X=0;X<H.length-1;X+=2)Q+=String.fromCharCode(H[X]+H[X+1]*256);return Q}a.prototype.slice=function(E,A){const H=this.length;E=~~E,A=A===void 0?H:~~A,E<0?(E+=H,E<0&&(E=0)):E>H&&(E=H),A<0?(A+=H,A<0&&(A=0)):A>H&&(A=H),A<E&&(A=E);const Q=this.subarray(E,A);return Object.setPrototypeOf(Q,a.prototype),Q};function O(B,E,A){if(B%1!==0||B<0)throw new RangeError("offset is not uint");if(B+E>A)throw new RangeError("Trying to access beyond buffer length")}a.prototype.readUintLE=a.prototype.readUIntLE=function(E,A,H){E=E>>>0,A=A>>>0,H||O(E,A,this.length);let Q=this[E],X=1,re=0;for(;++re<A&&(X*=256);)Q+=this[E+re]*X;return Q},a.prototype.readUintBE=a.prototype.readUIntBE=function(E,A,H){E=E>>>0,A=A>>>0,H||O(E,A,this.length);let Q=this[E+--A],X=1;for(;A>0&&(X*=256);)Q+=this[E+--A]*X;return Q},a.prototype.readUint8=a.prototype.readUInt8=function(E,A){return E=E>>>0,A||O(E,1,this.length),this[E]},a.prototype.readUint16LE=a.prototype.readUInt16LE=function(E,A){return E=E>>>0,A||O(E,2,this.length),this[E]|this[E+1]<<8},a.prototype.readUint16BE=a.prototype.readUInt16BE=function(E,A){return E=E>>>0,A||O(E,2,this.length),this[E]<<8|this[E+1]},a.prototype.readUint32LE=a.prototype.readUInt32LE=function(E,A){return E=E>>>0,A||O(E,4,this.length),(this[E]|this[E+1]<<8|this[E+2]<<16)+this[E+3]*16777216},a.prototype.readUint32BE=a.prototype.readUInt32BE=function(E,A){return E=E>>>0,A||O(E,4,this.length),this[E]*16777216+(this[E+1]<<16|this[E+2]<<8|this[E+3])},a.prototype.readBigUInt64LE=Lt(function(E){E=E>>>0,ie(E,"offset");const A=this[E],H=this[E+7];(A===void 0||H===void 0)&&de(E,this.length-8);const Q=A+this[++E]*2**8+this[++E]*2**16+this[++E]*2**24,X=this[++E]+this[++E]*2**8+this[++E]*2**16+H*2**24;return BigInt(Q)+(BigInt(X)<<BigInt(32))}),a.prototype.readBigUInt64BE=Lt(function(E){E=E>>>0,ie(E,"offset");const A=this[E],H=this[E+7];(A===void 0||H===void 0)&&de(E,this.length-8);const Q=A*2**24+this[++E]*2**16+this[++E]*2**8+this[++E],X=this[++E]*2**24+this[++E]*2**16+this[++E]*2**8+H;return(BigInt(Q)<<BigInt(32))+BigInt(X)}),a.prototype.readIntLE=function(E,A,H){E=E>>>0,A=A>>>0,H||O(E,A,this.length);let Q=this[E],X=1,re=0;for(;++re<A&&(X*=256);)Q+=this[E+re]*X;return X*=128,Q>=X&&(Q-=Math.pow(2,8*A)),Q},a.prototype.readIntBE=function(E,A,H){E=E>>>0,A=A>>>0,H||O(E,A,this.length);let Q=A,X=1,re=this[E+--Q];for(;Q>0&&(X*=256);)re+=this[E+--Q]*X;return X*=128,re>=X&&(re-=Math.pow(2,8*A)),re},a.prototype.readInt8=function(E,A){return E=E>>>0,A||O(E,1,this.length),this[E]&128?(255-this[E]+1)*-1:this[E]},a.prototype.readInt16LE=function(E,A){E=E>>>0,A||O(E,2,this.length);const H=this[E]|this[E+1]<<8;return H&32768?H|4294901760:H},a.prototype.readInt16BE=function(E,A){E=E>>>0,A||O(E,2,this.length);const H=this[E+1]|this[E]<<8;return H&32768?H|4294901760:H},a.prototype.readInt32LE=function(E,A){return E=E>>>0,A||O(E,4,this.length),this[E]|this[E+1]<<8|this[E+2]<<16|this[E+3]<<24},a.prototype.readInt32BE=function(E,A){return E=E>>>0,A||O(E,4,this.length),this[E]<<24|this[E+1]<<16|this[E+2]<<8|this[E+3]},a.prototype.readBigInt64LE=Lt(function(E){E=E>>>0,ie(E,"offset");const A=this[E],H=this[E+7];(A===void 0||H===void 0)&&de(E,this.length-8);const Q=this[E+4]+this[E+5]*2**8+this[E+6]*2**16+(H<<24);return(BigInt(Q)<<BigInt(32))+BigInt(A+this[++E]*2**8+this[++E]*2**16+this[++E]*2**24)}),a.prototype.readBigInt64BE=Lt(function(E){E=E>>>0,ie(E,"offset");const A=this[E],H=this[E+7];(A===void 0||H===void 0)&&de(E,this.length-8);const Q=(A<<24)+this[++E]*2**16+this[++E]*2**8+this[++E];return(BigInt(Q)<<BigInt(32))+BigInt(this[++E]*2**24+this[++E]*2**16+this[++E]*2**8+H)}),a.prototype.readFloatLE=function(E,A){return E=E>>>0,A||O(E,4,this.length),n.read(this,E,!0,23,4)},a.prototype.readFloatBE=function(E,A){return E=E>>>0,A||O(E,4,this.length),n.read(this,E,!1,23,4)},a.prototype.readDoubleLE=function(E,A){return E=E>>>0,A||O(E,8,this.length),n.read(this,E,!0,52,8)},a.prototype.readDoubleBE=function(E,A){return E=E>>>0,A||O(E,8,this.length),n.read(this,E,!1,52,8)};function _(B,E,A,H,Q,X){if(!a.isBuffer(B))throw new TypeError('"buffer" argument must be a Buffer instance');if(E>Q||E<X)throw new RangeError('"value" argument is out of bounds');if(A+H>B.length)throw new RangeError("Index out of range")}a.prototype.writeUintLE=a.prototype.writeUIntLE=function(E,A,H,Q){if(E=+E,A=A>>>0,H=H>>>0,!Q){const Me=Math.pow(2,8*H)-1;_(this,E,A,H,Me,0)}let X=1,re=0;for(this[A]=E&255;++re<H&&(X*=256);)this[A+re]=E/X&255;return A+H},a.prototype.writeUintBE=a.prototype.writeUIntBE=function(E,A,H,Q){if(E=+E,A=A>>>0,H=H>>>0,!Q){const Me=Math.pow(2,8*H)-1;_(this,E,A,H,Me,0)}let X=H-1,re=1;for(this[A+X]=E&255;--X>=0&&(re*=256);)this[A+X]=E/re&255;return A+H},a.prototype.writeUint8=a.prototype.writeUInt8=function(E,A,H){return E=+E,A=A>>>0,H||_(this,E,A,1,255,0),this[A]=E&255,A+1},a.prototype.writeUint16LE=a.prototype.writeUInt16LE=function(E,A,H){return E=+E,A=A>>>0,H||_(this,E,A,2,65535,0),this[A]=E&255,this[A+1]=E>>>8,A+2},a.prototype.writeUint16BE=a.prototype.writeUInt16BE=function(E,A,H){return E=+E,A=A>>>0,H||_(this,E,A,2,65535,0),this[A]=E>>>8,this[A+1]=E&255,A+2},a.prototype.writeUint32LE=a.prototype.writeUInt32LE=function(E,A,H){return E=+E,A=A>>>0,H||_(this,E,A,4,4294967295,0),this[A+3]=E>>>24,this[A+2]=E>>>16,this[A+1]=E>>>8,this[A]=E&255,A+4},a.prototype.writeUint32BE=a.prototype.writeUInt32BE=function(E,A,H){return E=+E,A=A>>>0,H||_(this,E,A,4,4294967295,0),this[A]=E>>>24,this[A+1]=E>>>16,this[A+2]=E>>>8,this[A+3]=E&255,A+4};function F(B,E,A,H,Q){D(E,H,Q,B,A,7);let X=Number(E&BigInt(4294967295));B[A++]=X,X=X>>8,B[A++]=X,X=X>>8,B[A++]=X,X=X>>8,B[A++]=X;let re=Number(E>>BigInt(32)&BigInt(4294967295));return B[A++]=re,re=re>>8,B[A++]=re,re=re>>8,B[A++]=re,re=re>>8,B[A++]=re,A}function ue(B,E,A,H,Q){D(E,H,Q,B,A,7);let X=Number(E&BigInt(4294967295));B[A+7]=X,X=X>>8,B[A+6]=X,X=X>>8,B[A+5]=X,X=X>>8,B[A+4]=X;let re=Number(E>>BigInt(32)&BigInt(4294967295));return B[A+3]=re,re=re>>8,B[A+2]=re,re=re>>8,B[A+1]=re,re=re>>8,B[A]=re,A+8}a.prototype.writeBigUInt64LE=Lt(function(E,A=0){return F(this,E,A,BigInt(0),BigInt("0xffffffffffffffff"))}),a.prototype.writeBigUInt64BE=Lt(function(E,A=0){return ue(this,E,A,BigInt(0),BigInt("0xffffffffffffffff"))}),a.prototype.writeIntLE=function(E,A,H,Q){if(E=+E,A=A>>>0,!Q){const Oe=Math.pow(2,8*H-1);_(this,E,A,H,Oe-1,-Oe)}let X=0,re=1,Me=0;for(this[A]=E&255;++X<H&&(re*=256);)E<0&&Me===0&&this[A+X-1]!==0&&(Me=1),this[A+X]=(E/re>>0)-Me&255;return A+H},a.prototype.writeIntBE=function(E,A,H,Q){if(E=+E,A=A>>>0,!Q){const Oe=Math.pow(2,8*H-1);_(this,E,A,H,Oe-1,-Oe)}let X=H-1,re=1,Me=0;for(this[A+X]=E&255;--X>=0&&(re*=256);)E<0&&Me===0&&this[A+X+1]!==0&&(Me=1),this[A+X]=(E/re>>0)-Me&255;return A+H},a.prototype.writeInt8=function(E,A,H){return E=+E,A=A>>>0,H||_(this,E,A,1,127,-128),E<0&&(E=255+E+1),this[A]=E&255,A+1},a.prototype.writeInt16LE=function(E,A,H){return E=+E,A=A>>>0,H||_(this,E,A,2,32767,-32768),this[A]=E&255,this[A+1]=E>>>8,A+2},a.prototype.writeInt16BE=function(E,A,H){return E=+E,A=A>>>0,H||_(this,E,A,2,32767,-32768),this[A]=E>>>8,this[A+1]=E&255,A+2},a.prototype.writeInt32LE=function(E,A,H){return E=+E,A=A>>>0,H||_(this,E,A,4,2147483647,-2147483648),this[A]=E&255,this[A+1]=E>>>8,this[A+2]=E>>>16,this[A+3]=E>>>24,A+4},a.prototype.writeInt32BE=function(E,A,H){return E=+E,A=A>>>0,H||_(this,E,A,4,2147483647,-2147483648),E<0&&(E=4294967295+E+1),this[A]=E>>>24,this[A+1]=E>>>16,this[A+2]=E>>>8,this[A+3]=E&255,A+4},a.prototype.writeBigInt64LE=Lt(function(E,A=0){return F(this,E,A,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),a.prototype.writeBigInt64BE=Lt(function(E,A=0){return ue(this,E,A,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function ne(B,E,A,H,Q,X){if(A+H>B.length)throw new RangeError("Index out of range");if(A<0)throw new RangeError("Index out of range")}function q(B,E,A,H,Q){return E=+E,A=A>>>0,Q||ne(B,E,A,4),n.write(B,E,A,H,23,4),A+4}a.prototype.writeFloatLE=function(E,A,H){return q(this,E,A,!0,H)},a.prototype.writeFloatBE=function(E,A,H){return q(this,E,A,!1,H)};function J(B,E,A,H,Q){return E=+E,A=A>>>0,Q||ne(B,E,A,8),n.write(B,E,A,H,52,8),A+8}a.prototype.writeDoubleLE=function(E,A,H){return J(this,E,A,!0,H)},a.prototype.writeDoubleBE=function(E,A,H){return J(this,E,A,!1,H)},a.prototype.copy=function(E,A,H,Q){if(!a.isBuffer(E))throw new TypeError("argument should be a Buffer");if(H||(H=0),!Q&&Q!==0&&(Q=this.length),A>=E.length&&(A=E.length),A||(A=0),Q>0&&Q<H&&(Q=H),Q===H||E.length===0||this.length===0)return 0;if(A<0)throw new RangeError("targetStart out of bounds");if(H<0||H>=this.length)throw new RangeError("Index out of range");if(Q<0)throw new RangeError("sourceEnd out of bounds");Q>this.length&&(Q=this.length),E.length-A<Q-H&&(Q=E.length-A+H);const X=Q-H;return this===E&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(A,H,Q):Uint8Array.prototype.set.call(E,this.subarray(H,Q),A),X},a.prototype.fill=function(E,A,H,Q){if(typeof E=="string"){if(typeof A=="string"?(Q=A,A=0,H=this.length):typeof H=="string"&&(Q=H,H=this.length),Q!==void 0&&typeof Q!="string")throw new TypeError("encoding must be a string");if(typeof Q=="string"&&!a.isEncoding(Q))throw new TypeError("Unknown encoding: "+Q);if(E.length===1){const re=E.charCodeAt(0);(Q==="utf8"&&re<128||Q==="latin1")&&(E=re)}}else typeof E=="number"?E=E&255:typeof E=="boolean"&&(E=Number(E));if(A<0||this.length<A||this.length<H)throw new RangeError("Out of range index");if(H<=A)return this;A=A>>>0,H=H===void 0?this.length:H>>>0,E||(E=0);let X;if(typeof E=="number")for(X=A;X<H;++X)this[X]=E;else{const re=a.isBuffer(E)?E:a.from(E,Q),Me=re.length;if(Me===0)throw new TypeError('The value "'+E+'" is invalid for argument "value"');for(X=0;X<H-A;++X)this[X+A]=re[X%Me]}return this};const te={};function le(B,E,A){te[B]=class extends A{constructor(){super(),Object.defineProperty(this,"message",{value:E.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${B}]`,this.stack,delete this.name}get code(){return B}set code(Q){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:Q,writable:!0})}toString(){return`${this.name} [${B}]: ${this.message}`}}}le("ERR_BUFFER_OUT_OF_BOUNDS",function(B){return B?`${B} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError),le("ERR_INVALID_ARG_TYPE",function(B,E){return`The "${B}" argument must be of type number. Received type ${typeof E}`},TypeError),le("ERR_OUT_OF_RANGE",function(B,E,A){let H=`The value of "${B}" is out of range.`,Q=A;return Number.isInteger(A)&&Math.abs(A)>2**32?Q=pe(String(A)):typeof A=="bigint"&&(Q=String(A),(A>BigInt(2)**BigInt(32)||A<-(BigInt(2)**BigInt(32)))&&(Q=pe(Q)),Q+="n"),H+=` It must be ${E}. Received ${Q}`,H},RangeError);function pe(B){let E="",A=B.length;const H=B[0]==="-"?1:0;for(;A>=H+4;A-=3)E=`_${B.slice(A-3,A)}${E}`;return`${B.slice(0,A)}${E}`}function z(B,E,A){ie(E,"offset"),(B[E]===void 0||B[E+A]===void 0)&&de(E,B.length-(A+1))}function D(B,E,A,H,Q,X){if(B>A||B<E){const re=typeof E=="bigint"?"n":"";let Me;throw E===0||E===BigInt(0)?Me=`>= 0${re} and < 2${re} ** ${(X+1)*8}${re}`:Me=`>= -(2${re} ** ${(X+1)*8-1}${re}) and < 2 ** ${(X+1)*8-1}${re}`,new te.ERR_OUT_OF_RANGE("value",Me,B)}z(H,Q,X)}function ie(B,E){if(typeof B!="number")throw new te.ERR_INVALID_ARG_TYPE(E,"number",B)}function de(B,E,A){throw Math.floor(B)!==B?(ie(B,A),new te.ERR_OUT_OF_RANGE("offset","an integer",B)):E<0?new te.ERR_BUFFER_OUT_OF_BOUNDS:new te.ERR_OUT_OF_RANGE("offset",`>= 0 and <= ${E}`,B)}const _e=/[^+/0-9A-Za-z-_]/g;function Ae(B){if(B=B.split("=")[0],B=B.trim().replace(_e,""),B.length<2)return"";for(;B.length%4!==0;)B=B+"=";return B}function xe(B,E){E=E||1/0;let A;const H=B.length;let Q=null;const X=[];for(let re=0;re<H;++re){if(A=B.charCodeAt(re),A>55295&&A<57344){if(!Q){if(A>56319){(E-=3)>-1&&X.push(239,191,189);continue}else if(re+1===H){(E-=3)>-1&&X.push(239,191,189);continue}Q=A;continue}if(A<56320){(E-=3)>-1&&X.push(239,191,189),Q=A;continue}A=(Q-55296<<10|A-56320)+65536}else Q&&(E-=3)>-1&&X.push(239,191,189);if(Q=null,A<128){if((E-=1)<0)break;X.push(A)}else if(A<2048){if((E-=2)<0)break;X.push(A>>6|192,A&63|128)}else if(A<65536){if((E-=3)<0)break;X.push(A>>12|224,A>>6&63|128,A&63|128)}else if(A<1114112){if((E-=4)<0)break;X.push(A>>18|240,A>>12&63|128,A>>6&63|128,A&63|128)}else throw new Error("Invalid code point")}return X}function Ge(B){const E=[];for(let A=0;A<B.length;++A)E.push(B.charCodeAt(A)&255);return E}function Tt(B,E){let A,H,Q;const X=[];for(let re=0;re<B.length&&!((E-=2)<0);++re)A=B.charCodeAt(re),H=A>>8,Q=A%256,X.push(Q),X.push(H);return X}function $e(B){return t.toByteArray(Ae(B))}function Qe(B,E,A,H){let Q;for(Q=0;Q<H&&!(Q+A>=E.length||Q>=B.length);++Q)E[Q+A]=B[Q];return Q}function At(B,E){return B instanceof E||B!=null&&B.constructor!=null&&B.constructor.name!=null&&B.constructor.name===E.name}function Fe(B){return B!==B}const Xe=function(){const B="0123456789abcdef",E=new Array(256);for(let A=0;A<16;++A){const H=A*16;for(let Q=0;Q<16;++Q)E[H+Q]=B[A]+B[Q]}return E}();function Lt(B){return typeof BigInt>"u"?De:B}function De(){throw new Error("BigInt not supported")}})(ol);/*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */(function(e,t){var n=ol,r=n.Buffer;function i(o,a){for(var c in o)a[c]=o[c]}r.from&&r.alloc&&r.allocUnsafe&&r.allocUnsafeSlow?e.exports=n:(i(n,t),t.Buffer=s);function s(o,a,c){return r(o,a,c)}s.prototype=Object.create(r.prototype),i(r,s),s.from=function(o,a,c){if(typeof o=="number")throw new TypeError("Argument must not be a number");return r(o,a,c)},s.alloc=function(o,a,c){if(typeof o!="number")throw new TypeError("Argument must be a number");var u=r(o);return a!==void 0?typeof c=="string"?u.fill(a,c):u.fill(a):u.fill(0),u},s.allocUnsafe=function(o){if(typeof o!="number")throw new TypeError("Argument must be a number");return r(o)},s.allocUnsafeSlow=function(o){if(typeof o!="number")throw new TypeError("Argument must be a number");return n.SlowBuffer(o)}})(sb,sb.exports);var $i=sb.exports,bz={}.toString,wz=Array.isArray||function(e){return bz.call(e)=="[object Array]"},al=TypeError,NS=Object,vz=Error,_z=EvalError,Ez=RangeError,xz=ReferenceError,LS=SyntaxError,Sz=URIError,kz=Math.abs,Az=Math.floor,Iz=Math.max,Cz=Math.min,Pz=Math.pow,Rz=Math.round,Tz=Number.isNaN||function(t){return t!==t},Oz=Tz,Mz=function(t){return Oz(t)||t===0?t:t<0?-1:1},Bz=Object.getOwnPropertyDescriptor,wh=Bz;if(wh)try{wh([],"length")}catch{wh=null}var cl=wh,vh=Object.defineProperty||!1;if(vh)try{vh({},"a",{value:1})}catch{vh=!1}var _h=vh,cb,jS;function $S(){return jS||(jS=1,cb=function(){if(typeof Symbol!="function"||typeof Object.getOwnPropertySymbols!="function")return!1;if(typeof Symbol.iterator=="symbol")return!0;var t={},n=Symbol("test"),r=Object(n);if(typeof n=="string"||Object.prototype.toString.call(n)!=="[object Symbol]"||Object.prototype.toString.call(r)!=="[object Symbol]")return!1;var i=42;t[n]=i;for(var s in t)return!1;if(typeof Object.keys=="function"&&Object.keys(t).length!==0||typeof Object.getOwnPropertyNames=="function"&&Object.getOwnPropertyNames(t).length!==0)return!1;var o=Object.getOwnPropertySymbols(t);if(o.length!==1||o[0]!==n||!Object.prototype.propertyIsEnumerable.call(t,n))return!1;if(typeof Object.getOwnPropertyDescriptor=="function"){var a=Object.getOwnPropertyDescriptor(t,n);if(a.value!==i||a.enumerable!==!0)return!1}return!0}),cb}var ub,FS;function Nz(){if(FS)return ub;FS=1;var e=typeof Symbol<"u"&&Symbol,t=$S();return ub=function(){return typeof e!="function"||typeof Symbol!="function"||typeof e("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:t()},ub}var lb,DS;function US(){return DS||(DS=1,lb=typeof Reflect<"u"&&Reflect.getPrototypeOf||null),lb}var db,HS;function zS(){if(HS)return db;HS=1;var e=NS;return db=e.getPrototypeOf||null,db}var Lz="Function.prototype.bind called on incompatible ",jz=Object.prototype.toString,$z=Math.max,Fz="[object Function]",WS=function(t,n){for(var r=[],i=0;i<t.length;i+=1)r[i]=t[i];for(var s=0;s<n.length;s+=1)r[s+t.length]=n[s];return r},Dz=function(t,n){for(var r=[],i=n,s=0;i<t.length;i+=1,s+=1)r[s]=t[i];return r},Uz=function(e,t){for(var n="",r=0;r<e.length;r+=1)n+=e[r],r+1<e.length&&(n+=t);return n},Hz=function(t){var n=this;if(typeof n!="function"||jz.apply(n)!==Fz)throw new TypeError(Lz+n);for(var r=Dz(arguments,1),i,s=function(){if(this instanceof i){var l=n.apply(this,WS(r,arguments));return Object(l)===l?l:this}return n.apply(t,WS(r,arguments))},o=$z(0,n.length-r.length),a=[],c=0;c<o;c++)a[c]="$"+c;if(i=Function("binder","return function ("+Uz(a,",")+"){ return binder.apply(this,arguments); }")(s),n.prototype){var u=function(){};u.prototype=n.prototype,i.prototype=new u,u.prototype=null}return i},zz=Hz,ul=Function.prototype.bind||zz,fb=Function.prototype.call,hb,GS;function pb(){return GS||(GS=1,hb=Function.prototype.apply),hb}var Wz=typeof Reflect<"u"&&Reflect&&Reflect.apply,Gz=ul,qz=pb(),Vz=fb,Kz=Wz,qS=Kz||Gz.call(Vz,qz),Jz=ul,Zz=al,Yz=fb,Qz=qS,mb=function(t){if(t.length<1||typeof t[0]!="function")throw new Zz("a function is required");return Qz(Jz,Yz,t)},gb,VS;function Xz(){if(VS)return gb;VS=1;var e=mb,t=cl,n;try{n=[].__proto__===Array.prototype}catch(o){if(!o||typeof o!="object"||!("code"in o)||o.code!=="ERR_PROTO_ACCESS")throw o}var r=!!n&&t&&t(Object.prototype,"__proto__"),i=Object,s=i.getPrototypeOf;return gb=r&&typeof r.get=="function"?e([r.get]):typeof s=="function"?function(a){return s(a==null?a:i(a))}:!1,gb}var yb,KS;function JS(){if(KS)return yb;KS=1;var e=US(),t=zS(),n=Xz();return yb=e?function(i){return e(i)}:t?function(i){if(!i||typeof i!="object"&&typeof i!="function")throw new TypeError("getProto: not an object");return t(i)}:n?function(i){return n(i)}:null,yb}var bb,ZS;function eW(){if(ZS)return bb;ZS=1;var e=Function.prototype.call,t=Object.prototype.hasOwnProperty,n=ul;return bb=n.call(e,t),bb}var Ye,tW=NS,nW=vz,rW=_z,iW=Ez,sW=xz,Xa=LS,ec=al,oW=Sz,aW=kz,cW=Az,uW=Iz,lW=Cz,dW=Pz,fW=Rz,hW=Mz,YS=Function,wb=function(e){try{return YS('"use strict"; return ('+e+").constructor;")()}catch{}},ll=cl,pW=_h,vb=function(){throw new ec},mW=ll?function(){try{return arguments.callee,vb}catch{try{return ll(arguments,"callee").get}catch{return vb}}}():vb,tc=Nz()(),ln=JS(),gW=zS(),yW=US(),QS=pb(),dl=fb,nc={},bW=typeof Uint8Array>"u"||!ln?Ye:ln(Uint8Array),_o={__proto__:null,"%AggregateError%":typeof AggregateError>"u"?Ye:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?Ye:ArrayBuffer,"%ArrayIteratorPrototype%":tc&&ln?ln([][Symbol.iterator]()):Ye,"%AsyncFromSyncIteratorPrototype%":Ye,"%AsyncFunction%":nc,"%AsyncGenerator%":nc,"%AsyncGeneratorFunction%":nc,"%AsyncIteratorPrototype%":nc,"%Atomics%":typeof Atomics>"u"?Ye:Atomics,"%BigInt%":typeof BigInt>"u"?Ye:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?Ye:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?Ye:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?Ye:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":nW,"%eval%":eval,"%EvalError%":rW,"%Float16Array%":typeof Float16Array>"u"?Ye:Float16Array,"%Float32Array%":typeof Float32Array>"u"?Ye:Float32Array,"%Float64Array%":typeof Float64Array>"u"?Ye:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?Ye:FinalizationRegistry,"%Function%":YS,"%GeneratorFunction%":nc,"%Int8Array%":typeof Int8Array>"u"?Ye:Int8Array,"%Int16Array%":typeof Int16Array>"u"?Ye:Int16Array,"%Int32Array%":typeof Int32Array>"u"?Ye:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":tc&&ln?ln(ln([][Symbol.iterator]())):Ye,"%JSON%":typeof JSON=="object"?JSON:Ye,"%Map%":typeof Map>"u"?Ye:Map,"%MapIteratorPrototype%":typeof Map>"u"||!tc||!ln?Ye:ln(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":tW,"%Object.getOwnPropertyDescriptor%":ll,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?Ye:Promise,"%Proxy%":typeof Proxy>"u"?Ye:Proxy,"%RangeError%":iW,"%ReferenceError%":sW,"%Reflect%":typeof Reflect>"u"?Ye:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?Ye:Set,"%SetIteratorPrototype%":typeof Set>"u"||!tc||!ln?Ye:ln(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?Ye:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":tc&&ln?ln(""[Symbol.iterator]()):Ye,"%Symbol%":tc?Symbol:Ye,"%SyntaxError%":Xa,"%ThrowTypeError%":mW,"%TypedArray%":bW,"%TypeError%":ec,"%Uint8Array%":typeof Uint8Array>"u"?Ye:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?Ye:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?Ye:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?Ye:Uint32Array,"%URIError%":oW,"%WeakMap%":typeof WeakMap>"u"?Ye:WeakMap,"%WeakRef%":typeof WeakRef>"u"?Ye:WeakRef,"%WeakSet%":typeof WeakSet>"u"?Ye:WeakSet,"%Function.prototype.call%":dl,"%Function.prototype.apply%":QS,"%Object.defineProperty%":pW,"%Object.getPrototypeOf%":gW,"%Math.abs%":aW,"%Math.floor%":cW,"%Math.max%":uW,"%Math.min%":lW,"%Math.pow%":dW,"%Math.round%":fW,"%Math.sign%":hW,"%Reflect.getPrototypeOf%":yW};if(ln)try{null.error}catch(e){var wW=ln(ln(e));_o["%Error.prototype%"]=wW}var vW=function e(t){var n;if(t==="%AsyncFunction%")n=wb("async function () {}");else if(t==="%GeneratorFunction%")n=wb("function* () {}");else if(t==="%AsyncGeneratorFunction%")n=wb("async function* () {}");else if(t==="%AsyncGenerator%"){var r=e("%AsyncGeneratorFunction%");r&&(n=r.prototype)}else if(t==="%AsyncIteratorPrototype%"){var i=e("%AsyncGenerator%");i&&ln&&(n=ln(i.prototype))}return _o[t]=n,n},XS={__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"]},fl=ul,Eh=eW(),_W=fl.call(dl,Array.prototype.concat),EW=fl.call(QS,Array.prototype.splice),e4=fl.call(dl,String.prototype.replace),xh=fl.call(dl,String.prototype.slice),xW=fl.call(dl,RegExp.prototype.exec),SW=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,kW=/\\(\\)?/g,AW=function(t){var n=xh(t,0,1),r=xh(t,-1);if(n==="%"&&r!=="%")throw new Xa("invalid intrinsic syntax, expected closing `%`");if(r==="%"&&n!=="%")throw new Xa("invalid intrinsic syntax, expected opening `%`");var i=[];return e4(t,SW,function(s,o,a,c){i[i.length]=a?e4(c,kW,"$1"):o||s}),i},IW=function(t,n){var r=t,i;if(Eh(XS,r)&&(i=XS[r],r="%"+i[0]+"%"),Eh(_o,r)){var s=_o[r];if(s===nc&&(s=vW(r)),typeof s>"u"&&!n)throw new ec("intrinsic "+t+" exists, but is not available. Please file an issue!");return{alias:i,name:r,value:s}}throw new Xa("intrinsic "+t+" does not exist!")},t4=function(t,n){if(typeof t!="string"||t.length===0)throw new ec("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof n!="boolean")throw new ec('"allowMissing" argument must be a boolean');if(xW(/^%?[^%]*%?$/,t)===null)throw new Xa("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var r=AW(t),i=r.length>0?r[0]:"",s=IW("%"+i+"%",n),o=s.name,a=s.value,c=!1,u=s.alias;u&&(i=u[0],EW(r,_W([0,1],u)));for(var l=1,d=!0;l<r.length;l+=1){var f=r[l],h=xh(f,0,1),m=xh(f,-1);if((h==='"'||h==="'"||h==="`"||m==='"'||m==="'"||m==="`")&&h!==m)throw new Xa("property names with quotes must have matching quotes");if((f==="constructor"||!d)&&(c=!0),i+="."+f,o="%"+i+"%",Eh(_o,o))a=_o[o];else if(a!=null){if(!(f in a)){if(!n)throw new ec("base intrinsic for "+t+" exists, but the property is not available.");return}if(ll&&l+1>=r.length){var y=ll(a,f);d=!!y,d&&"get"in y&&!("originalValue"in y.get)?a=y.get:a=a[f]}else d=Eh(a,f),a=a[f];d&&!c&&(_o[o]=a)}}return a},n4=t4,r4=mb,CW=r4([n4("%String.prototype.indexOf%")]),i4=function(t,n){var r=n4(t,!!n);return typeof r=="function"&&CW(t,".prototype.")>-1?r4([r]):r},_b,s4;function PW(){if(s4)return _b;s4=1;var e=Function.prototype.toString,t=typeof Reflect=="object"&&Reflect!==null&&Reflect.apply,n,r;if(typeof t=="function"&&typeof Object.defineProperty=="function")try{n=Object.defineProperty({},"length",{get:function(){throw r}}),r={},t(function(){throw 42},null,n)}catch(x){x!==r&&(t=null)}else t=null;var i=/^\s*class\b/,s=function(v){try{var S=e.call(v);return i.test(S)}catch{return!1}},o=function(v){try{return s(v)?!1:(e.call(v),!0)}catch{return!1}},a=Object.prototype.toString,c="[object Object]",u="[object Function]",l="[object GeneratorFunction]",d="[object HTMLAllCollection]",f="[object HTML document.all class]",h="[object HTMLCollection]",m=typeof Symbol=="function"&&!!Symbol.toStringTag,y=!(0 in[,]),w=function(){return!1};if(typeof document=="object"){var b=document.all;a.call(b)===a.call(document.all)&&(w=function(v){if((y||!v)&&(typeof v>"u"||typeof v=="object"))try{var S=a.call(v);return(S===d||S===f||S===h||S===c)&&v("")==null}catch{}return!1})}return _b=t?function(v){if(w(v))return!0;if(!v||typeof v!="function"&&typeof v!="object")return!1;try{t(v,null,n)}catch(S){if(S!==r)return!1}return!s(v)&&o(v)}:function(v){if(w(v))return!0;if(!v||typeof v!="function"&&typeof v!="object")return!1;if(m)return o(v);if(s(v))return!1;var S=a.call(v);return S!==u&&S!==l&&!/^\[object HTML/.test(S)?!1:o(v)},_b}var Eb,o4;function RW(){if(o4)return Eb;o4=1;var e=PW(),t=Object.prototype.toString,n=Object.prototype.hasOwnProperty,r=function(c,u,l){for(var d=0,f=c.length;d<f;d++)n.call(c,d)&&(l==null?u(c[d],d,c):u.call(l,c[d],d,c))},i=function(c,u,l){for(var d=0,f=c.length;d<f;d++)l==null?u(c.charAt(d),d,c):u.call(l,c.charAt(d),d,c)},s=function(c,u,l){for(var d in c)n.call(c,d)&&(l==null?u(c[d],d,c):u.call(l,c[d],d,c))};function o(a){return t.call(a)==="[object Array]"}return Eb=function(c,u,l){if(!e(u))throw new TypeError("iterator must be a function");var d;arguments.length>=3&&(d=l),o(c)?r(c,u,d):typeof c=="string"?i(c,u,d):s(c,u,d)},Eb}var xb,a4;function TW(){return a4||(a4=1,xb=["Float16Array","Float32Array","Float64Array","Int8Array","Int16Array","Int32Array","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array"]),xb}var Sb,c4;function OW(){if(c4)return Sb;c4=1;var e=TW(),t=typeof globalThis>"u"?Pe:globalThis;return Sb=function(){for(var r=[],i=0;i<e.length;i++)typeof t[e[i]]=="function"&&(r[r.length]=e[i]);return r},Sb}var kb={exports:{}},Ab,u4;function MW(){if(u4)return Ab;u4=1;var e=_h,t=LS,n=al,r=cl;return Ab=function(s,o,a){if(!s||typeof s!="object"&&typeof s!="function")throw new n("`obj` must be an object or a function`");if(typeof o!="string"&&typeof o!="symbol")throw new n("`property` must be a string or a symbol`");if(arguments.length>3&&typeof arguments[3]!="boolean"&&arguments[3]!==null)throw new n("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&typeof arguments[4]!="boolean"&&arguments[4]!==null)throw new n("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&typeof arguments[5]!="boolean"&&arguments[5]!==null)throw new n("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&typeof arguments[6]!="boolean")throw new n("`loose`, if provided, must be a boolean");var c=arguments.length>3?arguments[3]:null,u=arguments.length>4?arguments[4]:null,l=arguments.length>5?arguments[5]:null,d=arguments.length>6?arguments[6]:!1,f=!!r&&r(s,o);if(e)e(s,o,{configurable:l===null&&f?f.configurable:!l,enumerable:c===null&&f?f.enumerable:!c,value:a,writable:u===null&&f?f.writable:!u});else if(d||!c&&!u&&!l)s[o]=a;else throw new t("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.")},Ab}var Ib,l4;function BW(){if(l4)return Ib;l4=1;var e=_h,t=function(){return!!e};return t.hasArrayLengthDefineBug=function(){if(!e)return null;try{return e([],"length",{value:1}).length!==1}catch{return!0}},Ib=t,Ib}var Cb,d4;function NW(){if(d4)return Cb;d4=1;var e=t4,t=MW(),n=BW()(),r=cl,i=al,s=e("%Math.floor%");return Cb=function(a,c){if(typeof a!="function")throw new i("`fn` is not a function");if(typeof c!="number"||c<0||c>4294967295||s(c)!==c)throw new i("`length` must be a positive 32-bit integer");var u=arguments.length>2&&!!arguments[2],l=!0,d=!0;if("length"in a&&r){var f=r(a,"length");f&&!f.configurable&&(l=!1),f&&!f.writable&&(d=!1)}return(l||d||!u)&&(n?t(a,"length",c,!0,!0):t(a,"length",c)),a},Cb}var Pb,f4;function LW(){if(f4)return Pb;f4=1;var e=ul,t=pb(),n=qS;return Pb=function(){return n(e,t,arguments)},Pb}var h4;function jW(){return h4||(h4=1,function(e){var t=NW(),n=_h,r=mb,i=LW();e.exports=function(o){var a=r(arguments),c=1+o.length-(arguments.length-1);return t(a,c>0?c:0,!0)},n?n(e.exports,"apply",{value:i}):e.exports.apply=i}(kb)),kb.exports}var Rb,p4;function $W(){if(p4)return Rb;p4=1;var e=$S();return Rb=function(){return e()&&!!Symbol.toStringTag},Rb}var Tb,m4;function FW(){if(m4)return Tb;m4=1;var e=RW(),t=OW(),n=jW(),r=i4,i=cl,s=JS(),o=r("Object.prototype.toString"),a=$W()(),c=typeof globalThis>"u"?Pe:globalThis,u=t(),l=r("String.prototype.slice"),d=r("Array.prototype.indexOf",!0)||function(w,b){for(var x=0;x<w.length;x+=1)if(w[x]===b)return x;return-1},f={__proto__:null};a&&i&&s?e(u,function(y){var w=new c[y];if(Symbol.toStringTag in w&&s){var b=s(w),x=i(b,Symbol.toStringTag);if(!x&&b){var v=s(b);x=i(v,Symbol.toStringTag)}if(x&&x.get){var S=n(x.get);f["$"+y]=S}}}):e(u,function(y){var w=new c[y],b=w.slice||w.set;if(b){var x=n(b);f["$"+y]=x}});var h=function(w){var b=!1;return e(f,function(x,v){if(!b)try{"$"+x(w)===v&&(b=l(v,1))}catch{}}),b},m=function(w){var b=!1;return e(f,function(x,v){if(!b)try{x(w),b=l(v,1)}catch{}}),b};return Tb=function(w){if(!w||typeof w!="object")return!1;if(!a){var b=l(o(w),8,-1);return d(u,b)>-1?b:b!=="Object"?!1:m(w)}return i?h(w):null},Tb}var Ob,g4;function DW(){if(g4)return Ob;g4=1;var e=FW();return Ob=function(n){return!!e(n)},Ob}var UW=al,HW=i4,zW=HW("TypedArray.prototype.buffer",!0),WW=DW(),GW=zW||function(t){if(!WW(t))throw new UW("Not a Typed Array");return t.buffer},Fr=$i.Buffer,qW=wz,VW=GW,KW=ArrayBuffer.isView||function(t){try{return VW(t),!0}catch{return!1}},JW=typeof Uint8Array<"u",y4=typeof ArrayBuffer<"u"&&typeof Uint8Array<"u",ZW=y4&&(Fr.prototype instanceof Uint8Array||Fr.TYPED_ARRAY_SUPPORT),YW=function(t,n){if(Fr.isBuffer(t))return t.constructor&&!("isBuffer"in t)?Fr.from(t):t;if(typeof t=="string")return Fr.from(t,n);if(y4&&KW(t)){if(t.byteLength===0)return Fr.alloc(0);if(ZW){var r=Fr.from(t.buffer,t.byteOffset,t.byteLength);if(r.byteLength===t.byteLength)return r}var i=t instanceof Uint8Array?t:new Uint8Array(t.buffer,t.byteOffset,t.byteLength),s=Fr.from(i);if(s.length===t.byteLength)return s}if(JW&&t instanceof Uint8Array)return Fr.from(t);var o=qW(t);if(o)for(var a=0;a<t.length;a+=1){var c=t[a];if(typeof c!="number"||c<0||c>255||~~c!==c)throw new RangeError("Array items must be numbers in the range 0-255.")}if(o||Fr.isBuffer(t)&&t.constructor&&typeof t.constructor.isBuffer=="function"&&t.constructor.isBuffer(t))return Fr.from(t);throw new TypeError('The "data" argument must be a string, an Array, a Buffer, a Uint8Array, or a DataView.')},QW=$i.Buffer,XW=YW;function Sh(e,t){this._block=QW.alloc(e),this._finalSize=t,this._blockSize=e,this._len=0}Sh.prototype.update=function(e,t){e=XW(e,t||"utf8");for(var n=this._block,r=this._blockSize,i=e.length,s=this._len,o=0;o<i;){for(var a=s%r,c=Math.min(i-o,r-a),u=0;u<c;u++)n[a+u]=e[o+u];s+=c,o+=c,s%r===0&&this._update(n)}return this._len+=i,this},Sh.prototype.digest=function(e){var t=this._len%this._blockSize;this._block[t]=128,this._block.fill(0,t+1),t>=this._finalSize&&(this._update(this._block),this._block.fill(0));var n=this._len*8;if(n<=4294967295)this._block.writeUInt32BE(n,this._blockSize-4);else{var r=(n&4294967295)>>>0,i=(n-r)/4294967296;this._block.writeUInt32BE(i,this._blockSize-8),this._block.writeUInt32BE(r,this._blockSize-4)}this._update(this._block);var s=this._hash();return e?s.toString(e):s},Sh.prototype._update=function(){throw new Error("_update must be implemented by subclass")};var rc=Sh,eG=$r,b4=rc,tG=$i.Buffer,nG=[1518500249,1859775393,-1894007588,-899497514],rG=new Array(80);function hl(){this.init(),this._w=rG,b4.call(this,64,56)}eG(hl,b4),hl.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this};function iG(e){return e<<5|e>>>27}function sG(e){return e<<30|e>>>2}function oG(e,t,n,r){return e===0?t&n|~t&r:e===2?t&n|t&r|n&r:t^n^r}hl.prototype._update=function(e){for(var t=this._w,n=this._a|0,r=this._b|0,i=this._c|0,s=this._d|0,o=this._e|0,a=0;a<16;++a)t[a]=e.readInt32BE(a*4);for(;a<80;++a)t[a]=t[a-3]^t[a-8]^t[a-14]^t[a-16];for(var c=0;c<80;++c){var u=~~(c/20),l=iG(n)+oG(u,r,i,s)+o+t[c]+nG[u]|0;o=s,s=i,i=sG(r),r=n,n=l}this._a=n+this._a|0,this._b=r+this._b|0,this._c=i+this._c|0,this._d=s+this._d|0,this._e=o+this._e|0},hl.prototype._hash=function(){var e=tG.allocUnsafe(20);return e.writeInt32BE(this._a|0,0),e.writeInt32BE(this._b|0,4),e.writeInt32BE(this._c|0,8),e.writeInt32BE(this._d|0,12),e.writeInt32BE(this._e|0,16),e};var aG=hl,cG=$r,w4=rc,uG=$i.Buffer,lG=[1518500249,1859775393,-1894007588,-899497514],dG=new Array(80);function pl(){this.init(),this._w=dG,w4.call(this,64,56)}cG(pl,w4),pl.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this};function fG(e){return e<<1|e>>>31}function hG(e){return e<<5|e>>>27}function pG(e){return e<<30|e>>>2}function mG(e,t,n,r){return e===0?t&n|~t&r:e===2?t&n|t&r|n&r:t^n^r}pl.prototype._update=function(e){for(var t=this._w,n=this._a|0,r=this._b|0,i=this._c|0,s=this._d|0,o=this._e|0,a=0;a<16;++a)t[a]=e.readInt32BE(a*4);for(;a<80;++a)t[a]=fG(t[a-3]^t[a-8]^t[a-14]^t[a-16]);for(var c=0;c<80;++c){var u=~~(c/20),l=hG(n)+mG(u,r,i,s)+o+t[c]+lG[u]|0;o=s,s=i,i=pG(r),r=n,n=l}this._a=n+this._a|0,this._b=r+this._b|0,this._c=i+this._c|0,this._d=s+this._d|0,this._e=o+this._e|0},pl.prototype._hash=function(){var e=uG.allocUnsafe(20);return e.writeInt32BE(this._a|0,0),e.writeInt32BE(this._b|0,4),e.writeInt32BE(this._c|0,8),e.writeInt32BE(this._d|0,12),e.writeInt32BE(this._e|0,16),e};var gG=pl,yG=$r,v4=rc,bG=$i.Buffer,wG=[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],vG=new Array(64);function ml(){this.init(),this._w=vG,v4.call(this,64,56)}yG(ml,v4),ml.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 _G(e,t,n){return n^e&(t^n)}function EG(e,t,n){return e&t|n&(e|t)}function xG(e){return(e>>>2|e<<30)^(e>>>13|e<<19)^(e>>>22|e<<10)}function SG(e){return(e>>>6|e<<26)^(e>>>11|e<<21)^(e>>>25|e<<7)}function kG(e){return(e>>>7|e<<25)^(e>>>18|e<<14)^e>>>3}function AG(e){return(e>>>17|e<<15)^(e>>>19|e<<13)^e>>>10}ml.prototype._update=function(e){for(var t=this._w,n=this._a|0,r=this._b|0,i=this._c|0,s=this._d|0,o=this._e|0,a=this._f|0,c=this._g|0,u=this._h|0,l=0;l<16;++l)t[l]=e.readInt32BE(l*4);for(;l<64;++l)t[l]=AG(t[l-2])+t[l-7]+kG(t[l-15])+t[l-16]|0;for(var d=0;d<64;++d){var f=u+SG(o)+_G(o,a,c)+wG[d]+t[d]|0,h=xG(n)+EG(n,r,i)|0;u=c,c=a,a=o,o=s+f|0,s=i,i=r,r=n,n=f+h|0}this._a=n+this._a|0,this._b=r+this._b|0,this._c=i+this._c|0,this._d=s+this._d|0,this._e=o+this._e|0,this._f=a+this._f|0,this._g=c+this._g|0,this._h=u+this._h|0},ml.prototype._hash=function(){var e=bG.allocUnsafe(32);return e.writeInt32BE(this._a,0),e.writeInt32BE(this._b,4),e.writeInt32BE(this._c,8),e.writeInt32BE(this._d,12),e.writeInt32BE(this._e,16),e.writeInt32BE(this._f,20),e.writeInt32BE(this._g,24),e.writeInt32BE(this._h,28),e};var _4=ml,IG=$r,CG=_4,PG=rc,RG=$i.Buffer,TG=new Array(64);function kh(){this.init(),this._w=TG,PG.call(this,64,56)}IG(kh,CG),kh.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},kh.prototype._hash=function(){var e=RG.allocUnsafe(28);return e.writeInt32BE(this._a,0),e.writeInt32BE(this._b,4),e.writeInt32BE(this._c,8),e.writeInt32BE(this._d,12),e.writeInt32BE(this._e,16),e.writeInt32BE(this._f,20),e.writeInt32BE(this._g,24),e};var OG=kh,MG=$r,E4=rc,BG=$i.Buffer,x4=[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],NG=new Array(160);function gl(){this.init(),this._w=NG,E4.call(this,128,112)}MG(gl,E4),gl.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 S4(e,t,n){return n^e&(t^n)}function k4(e,t,n){return e&t|n&(e|t)}function A4(e,t){return(e>>>28|t<<4)^(t>>>2|e<<30)^(t>>>7|e<<25)}function I4(e,t){return(e>>>14|t<<18)^(e>>>18|t<<14)^(t>>>9|e<<23)}function LG(e,t){return(e>>>1|t<<31)^(e>>>8|t<<24)^e>>>7}function jG(e,t){return(e>>>1|t<<31)^(e>>>8|t<<24)^(e>>>7|t<<25)}function $G(e,t){return(e>>>19|t<<13)^(t>>>29|e<<3)^e>>>6}function FG(e,t){return(e>>>19|t<<13)^(t>>>29|e<<3)^(e>>>6|t<<26)}function dn(e,t){return e>>>0<t>>>0?1:0}gl.prototype._update=function(e){for(var t=this._w,n=this._ah|0,r=this._bh|0,i=this._ch|0,s=this._dh|0,o=this._eh|0,a=this._fh|0,c=this._gh|0,u=this._hh|0,l=this._al|0,d=this._bl|0,f=this._cl|0,h=this._dl|0,m=this._el|0,y=this._fl|0,w=this._gl|0,b=this._hl|0,x=0;x<32;x+=2)t[x]=e.readInt32BE(x*4),t[x+1]=e.readInt32BE(x*4+4);for(;x<160;x+=2){var v=t[x-30],S=t[x-15*2+1],I=LG(v,S),N=jG(S,v);v=t[x-2*2],S=t[x-2*2+1];var j=$G(v,S),U=FG(S,v),L=t[x-7*2],Y=t[x-7*2+1],Z=t[x-16*2],G=t[x-16*2+1],C=N+Y|0,p=I+L+dn(C,N)|0;C=C+U|0,p=p+j+dn(C,U)|0,C=C+G|0,p=p+Z+dn(C,G)|0,t[x]=p,t[x+1]=C}for(var g=0;g<160;g+=2){p=t[g],C=t[g+1];var k=k4(n,r,i),R=k4(l,d,f),T=A4(n,l),M=A4(l,n),$=I4(o,m),O=I4(m,o),_=x4[g],F=x4[g+1],ue=S4(o,a,c),ne=S4(m,y,w),q=b+O|0,J=u+$+dn(q,b)|0;q=q+ne|0,J=J+ue+dn(q,ne)|0,q=q+F|0,J=J+_+dn(q,F)|0,q=q+C|0,J=J+p+dn(q,C)|0;var te=M+R|0,le=T+k+dn(te,M)|0;u=c,b=w,c=a,w=y,a=o,y=m,m=h+q|0,o=s+J+dn(m,h)|0,s=i,h=f,i=r,f=d,r=n,d=l,l=q+te|0,n=J+le+dn(l,q)|0}this._al=this._al+l|0,this._bl=this._bl+d|0,this._cl=this._cl+f|0,this._dl=this._dl+h|0,this._el=this._el+m|0,this._fl=this._fl+y|0,this._gl=this._gl+w|0,this._hl=this._hl+b|0,this._ah=this._ah+n+dn(this._al,l)|0,this._bh=this._bh+r+dn(this._bl,d)|0,this._ch=this._ch+i+dn(this._cl,f)|0,this._dh=this._dh+s+dn(this._dl,h)|0,this._eh=this._eh+o+dn(this._el,m)|0,this._fh=this._fh+a+dn(this._fl,y)|0,this._gh=this._gh+c+dn(this._gl,w)|0,this._hh=this._hh+u+dn(this._hl,b)|0},gl.prototype._hash=function(){var e=BG.allocUnsafe(64);function t(n,r,i){e.writeInt32BE(n,i),e.writeInt32BE(r,i+4)}return t(this._ah,this._al,0),t(this._bh,this._bl,8),t(this._ch,this._cl,16),t(this._dh,this._dl,24),t(this._eh,this._el,32),t(this._fh,this._fl,40),t(this._gh,this._gl,48),t(this._hh,this._hl,56),e};var C4=gl,DG=$r,UG=C4,HG=rc,zG=$i.Buffer,WG=new Array(160);function Ah(){this.init(),this._w=WG,HG.call(this,128,112)}DG(Ah,UG),Ah.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},Ah.prototype._hash=function(){var e=zG.allocUnsafe(48);function t(n,r,i){e.writeInt32BE(n,i),e.writeInt32BE(r,i+4)}return t(this._ah,this._al,0),t(this._bh,this._bl,8),t(this._ch,this._cl,16),t(this._dh,this._dl,24),t(this._eh,this._el,32),t(this._fh,this._fl,40),e};var GG=Ah;(function(e){e.exports=function(n){var r=n.toLowerCase(),i=e.exports[r];if(!i)throw new Error(r+" is not supported (we accept pull requests)");return new i},e.exports.sha=aG,e.exports.sha1=gG,e.exports.sha224=OG,e.exports.sha256=_4,e.exports.sha384=GG,e.exports.sha512=C4})(MS);var qG=MS.exports;Object.defineProperty(Ya,"__esModule",{value:!0}),Ya.Session=void 0;const P4=qG,R4=Ie,T4="session:id",O4="session:secret",M4="session:linked";class Mb{constructor(t,n,r,i){this._storage=t,this._id=n||(0,R4.randomBytesHex)(16),this._secret=r||(0,R4.randomBytesHex)(32),this._key=new P4.sha256().update(`${this._id}, ${this._secret} WalletLink`).digest("hex"),this._linked=!!i}static load(t){const n=t.getItem(T4),r=t.getItem(M4),i=t.getItem(O4);return n&&i?new Mb(t,n,i,r==="1"):null}static hash(t){return new P4.sha256().update(t).digest("hex")}get id(){return this._id}get secret(){return this._secret}get key(){return this._key}get linked(){return this._linked}set linked(t){this._linked=t,this.persistLinked()}save(){return this._storage.setItem(T4,this._id),this._storage.setItem(O4,this._secret),this.persistLinked(),this}persistLinked(){this._storage.setItem(M4,this._linked?"1":"0")}}Ya.Session=Mb;var Ih={},Ch={};Object.defineProperty(Ch,"__esModule",{value:!0}),Ch.Cipher=void 0;const Ph=Ie;class VG{constructor(t){this.secret=t}async encrypt(t){const n=this.secret;if(n.length!==64)throw Error("secret must be 256 bits");const r=crypto.getRandomValues(new Uint8Array(12)),i=await crypto.subtle.importKey("raw",(0,Ph.hexStringToUint8Array)(n),{name:"aes-gcm"},!1,["encrypt","decrypt"]),s=new TextEncoder,o=await window.crypto.subtle.encrypt({name:"AES-GCM",iv:r},i,s.encode(t)),a=16,c=o.slice(o.byteLength-a),u=o.slice(0,o.byteLength-a),l=new Uint8Array(c),d=new Uint8Array(u),f=new Uint8Array([...r,...l,...d]);return(0,Ph.uint8ArrayToHex)(f)}async decrypt(t){const n=this.secret;if(n.length!==64)throw Error("secret must be 256 bits");return new Promise((r,i)=>{(async function(){const s=await crypto.subtle.importKey("raw",(0,Ph.hexStringToUint8Array)(n),{name:"aes-gcm"},!1,["encrypt","decrypt"]),o=(0,Ph.hexStringToUint8Array)(t),a=o.slice(0,12),c=o.slice(12,28),u=o.slice(28),l=new Uint8Array([...u,...c]),d={name:"AES-GCM",iv:new Uint8Array(a)};try{const f=await window.crypto.subtle.decrypt(d,s,l),h=new TextDecoder;r(h.decode(f))}catch(f){i(f)}})()})}}Ch.Cipher=VG;var Rh={};Object.defineProperty(Rh,"__esModule",{value:!0}),Rh.WalletLinkHTTP=void 0;class KG{constructor(t,n,r){this.linkAPIUrl=t,this.sessionId=n;const i=`${n}:${r}`;this.auth=`Basic ${btoa(i)}`}async markUnseenEventsAsSeen(t){return Promise.all(t.map(n=>fetch(`${this.linkAPIUrl}/events/${n.eventId}/seen`,{method:"POST",headers:{Authorization:this.auth}}))).catch(n=>console.error("Unabled to mark event as failed:",n))}async fetchUnseenEvents(){var t;const n=await fetch(`${this.linkAPIUrl}/events?unseen=true`,{headers:{Authorization:this.auth}});if(n.ok){const{events:r,error:i}=await n.json();if(i)throw new Error(`Check unseen events failed: ${i}`);const s=(t=r==null?void 0:r.filter(o=>o.event==="Web3Response").map(o=>({type:"Event",sessionId:this.sessionId,eventId:o.id,event:o.event,data:o.data})))!==null&&t!==void 0?t:[];return this.markUnseenEventsAsSeen(s),s}throw new Error(`Check unseen events failed: ${n.status}`)}}Rh.WalletLinkHTTP=KG;var ic={};Object.defineProperty(ic,"__esModule",{value:!0}),ic.WalletLinkWebSocket=ic.ConnectionState=void 0;var sc;(function(e){e[e.DISCONNECTED=0]="DISCONNECTED",e[e.CONNECTING=1]="CONNECTING",e[e.CONNECTED=2]="CONNECTED"})(sc||(ic.ConnectionState=sc={}));class JG{setConnectionStateListener(t){this.connectionStateListener=t}setIncomingDataListener(t){this.incomingDataListener=t}constructor(t,n=WebSocket){this.WebSocketClass=n,this.webSocket=null,this.pendingData=[],this.url=t.replace(/^http/,"ws")}async connect(){if(this.webSocket)throw new Error("webSocket object is not null");return new Promise((t,n)=>{var r;let i;try{this.webSocket=i=new this.WebSocketClass(this.url)}catch(s){n(s);return}(r=this.connectionStateListener)===null||r===void 0||r.call(this,sc.CONNECTING),i.onclose=s=>{var o;this.clearWebSocket(),n(new Error(`websocket error ${s.code}: ${s.reason}`)),(o=this.connectionStateListener)===null||o===void 0||o.call(this,sc.DISCONNECTED)},i.onopen=s=>{var o;t(),(o=this.connectionStateListener)===null||o===void 0||o.call(this,sc.CONNECTED),this.pendingData.length>0&&([...this.pendingData].forEach(c=>this.sendData(c)),this.pendingData=[])},i.onmessage=s=>{var o,a;if(s.data==="h")(o=this.incomingDataListener)===null||o===void 0||o.call(this,{type:"Heartbeat"});else try{const c=JSON.parse(s.data);(a=this.incomingDataListener)===null||a===void 0||a.call(this,c)}catch{}}})}disconnect(){var t;const{webSocket:n}=this;if(n){this.clearWebSocket(),(t=this.connectionStateListener)===null||t===void 0||t.call(this,sc.DISCONNECTED),this.connectionStateListener=void 0,this.incomingDataListener=void 0;try{n.close()}catch{}}}sendData(t){const{webSocket:n}=this;if(!n){this.pendingData.push(t),this.connect();return}n.send(t)}clearWebSocket(){const{webSocket:t}=this;t&&(this.webSocket=null,t.onclose=null,t.onerror=null,t.onmessage=null,t.onopen=null)}}ic.WalletLinkWebSocket=JG,Object.defineProperty(Ih,"__esModule",{value:!0}),Ih.WalletLinkConnection=void 0;const oc=sn,ZG=Ch,ei=Za,B4=br,ac=Ya,YG=Rh,Th=ic,N4=1e4,QG=6e4;class XG{constructor({session:t,linkAPIUrl:n,listener:r,diagnostic:i,WebSocketClass:s=WebSocket}){this.destroyed=!1,this.lastHeartbeatResponse=0,this.nextReqId=(0,oc.IntNumber)(1),this._connected=!1,this._linked=!1,this.shouldFetchUnseenEventsOnConnect=!1,this.requestResolutions=new Map,this.handleSessionMetadataUpdated=a=>{if(!a)return;new Map([["__destroyed",this.handleDestroyed],["EthereumAddress",this.handleAccountUpdated],["WalletUsername",this.handleWalletUsernameUpdated],["AppVersion",this.handleAppVersionUpdated],["ChainId",u=>a.JsonRpcUrl&&this.handleChainUpdated(u,a.JsonRpcUrl)]]).forEach((u,l)=>{const d=a[l];d!==void 0&&u(d)})},this.handleDestroyed=a=>{var c,u;a==="1"&&((c=this.listener)===null||c===void 0||c.resetAndReload(),(u=this.diagnostic)===null||u===void 0||u.log(ei.EVENTS.METADATA_DESTROYED,{alreadyDestroyed:this.isDestroyed,sessionIdHash:ac.Session.hash(this.session.id)}))},this.handleAccountUpdated=async a=>{var c,u;try{const l=await this.cipher.decrypt(a);(c=this.listener)===null||c===void 0||c.accountUpdated(l)}catch{(u=this.diagnostic)===null||u===void 0||u.log(ei.EVENTS.GENERAL_ERROR,{message:"Had error decrypting",value:"selectedAddress"})}},this.handleMetadataUpdated=async(a,c)=>{var u,l;try{const d=await this.cipher.decrypt(c);(u=this.listener)===null||u===void 0||u.metadataUpdated(a,d)}catch{(l=this.diagnostic)===null||l===void 0||l.log(ei.EVENTS.GENERAL_ERROR,{message:"Had error decrypting",value:a})}},this.handleWalletUsernameUpdated=async a=>{this.handleMetadataUpdated(B4.WALLET_USER_NAME_KEY,a)},this.handleAppVersionUpdated=async a=>{this.handleMetadataUpdated(B4.APP_VERSION_KEY,a)},this.handleChainUpdated=async(a,c)=>{var u,l;try{const d=await this.cipher.decrypt(a),f=await this.cipher.decrypt(c);(u=this.listener)===null||u===void 0||u.chainUpdated(d,f)}catch{(l=this.diagnostic)===null||l===void 0||l.log(ei.EVENTS.GENERAL_ERROR,{message:"Had error decrypting",value:"chainId|jsonRpcUrl"})}},this.session=t,this.cipher=new ZG.Cipher(t.secret),this.diagnostic=i,this.listener=r;const o=new Th.WalletLinkWebSocket(`${n}/rpc`,s);o.setConnectionStateListener(async a=>{var c;(c=this.diagnostic)===null||c===void 0||c.log(ei.EVENTS.CONNECTED_STATE_CHANGE,{state:a,sessionIdHash:ac.Session.hash(t.id)});let u=!1;switch(a){case Th.ConnectionState.DISCONNECTED:if(!this.destroyed){const l=async()=>{await new Promise(d=>setTimeout(d,5e3)),this.destroyed||o.connect().catch(()=>{l()})};l()}break;case Th.ConnectionState.CONNECTED:try{await this.authenticate(),this.sendIsLinked(),this.sendGetSessionConfig(),u=!0}catch{}this.updateLastHeartbeat(),setInterval(()=>{this.heartbeat()},N4),this.shouldFetchUnseenEventsOnConnect&&this.fetchUnseenEventsAPI();break;case Th.ConnectionState.CONNECTING:break}this.connected!==u&&(this.connected=u)}),o.setIncomingDataListener(a=>{var c,u,l;switch(a.type){case"Heartbeat":this.updateLastHeartbeat();return;case"IsLinkedOK":case"Linked":{const d=a.type==="IsLinkedOK"?a.linked:void 0;(c=this.diagnostic)===null||c===void 0||c.log(ei.EVENTS.LINKED,{sessionIdHash:ac.Session.hash(t.id),linked:d,type:a.type,onlineGuests:a.onlineGuests}),this.linked=d||a.onlineGuests>0;break}case"GetSessionConfigOK":case"SessionConfigUpdated":{(u=this.diagnostic)===null||u===void 0||u.log(ei.EVENTS.SESSION_CONFIG_RECEIVED,{sessionIdHash:ac.Session.hash(t.id),metadata_keys:a&&a.metadata?Object.keys(a.metadata):void 0}),this.handleSessionMetadataUpdated(a.metadata);break}case"Event":{this.handleIncomingEvent(a);break}}a.id!==void 0&&((l=this.requestResolutions.get(a.id))===null||l===void 0||l(a))}),this.ws=o,this.http=new YG.WalletLinkHTTP(n,t.id,t.key)}connect(){var t;if(this.destroyed)throw new Error("instance is destroyed");(t=this.diagnostic)===null||t===void 0||t.log(ei.EVENTS.STARTED_CONNECTING,{sessionIdHash:ac.Session.hash(this.session.id)}),this.ws.connect()}destroy(){var t;this.destroyed=!0,this.ws.disconnect(),(t=this.diagnostic)===null||t===void 0||t.log(ei.EVENTS.DISCONNECTED,{sessionIdHash:ac.Session.hash(this.session.id)}),this.listener=void 0}get isDestroyed(){return this.destroyed}get connected(){return this._connected}set connected(t){var n,r;this._connected=t,t&&((n=this.onceConnected)===null||n===void 0||n.call(this)),(r=this.listener)===null||r===void 0||r.connectedUpdated(t)}setOnceConnected(t){return new Promise(n=>{this.connected?t().then(n):this.onceConnected=()=>{t().then(n),this.onceConnected=void 0}})}get linked(){return this._linked}set linked(t){var n,r;this._linked=t,t&&((n=this.onceLinked)===null||n===void 0||n.call(this)),(r=this.listener)===null||r===void 0||r.linkedUpdated(t)}setOnceLinked(t){return new Promise(n=>{this.linked?t().then(n):this.onceLinked=()=>{t().then(n),this.onceLinked=void 0}})}async handleIncomingEvent(t){var n,r;if(!(t.type!=="Event"||t.event!=="Web3Response"))try{const i=await this.cipher.decrypt(t.data),s=JSON.parse(i);if(s.type!=="WEB3_RESPONSE")return;(n=this.listener)===null||n===void 0||n.handleWeb3ResponseMessage(s)}catch{(r=this.diagnostic)===null||r===void 0||r.log(ei.EVENTS.GENERAL_ERROR,{message:"Had error decrypting",value:"incomingEvent"})}}async checkUnseenEvents(){if(!this.connected){this.shouldFetchUnseenEventsOnConnect=!0;return}await new Promise(t=>setTimeout(t,250));try{await this.fetchUnseenEventsAPI()}catch(t){console.error("Unable to check for unseen events",t)}}async fetchUnseenEventsAPI(){this.shouldFetchUnseenEventsOnConnect=!1,(await this.http.fetchUnseenEvents()).forEach(n=>this.handleIncomingEvent(n))}async setSessionMetadata(t,n){const r={type:"SetSessionConfig",id:(0,oc.IntNumber)(this.nextReqId++),sessionId:this.session.id,metadata:{[t]:n}};return this.setOnceConnected(async()=>{const i=await this.makeRequest(r);if(i.type==="Fail")throw new Error(i.error||"failed to set session metadata")})}async publishEvent(t,n,r=!1){const i=await this.cipher.encrypt(JSON.stringify(Object.assign(Object.assign({},n),{origin:location.origin,relaySource:window.coinbaseWalletExtension?"injected_sdk":"sdk"}))),s={type:"PublishEvent",id:(0,oc.IntNumber)(this.nextReqId++),sessionId:this.session.id,event:t,data:i,callWebhook:r};return this.setOnceLinked(async()=>{const o=await this.makeRequest(s);if(o.type==="Fail")throw new Error(o.error||"failed to publish event");return o.eventId})}sendData(t){this.ws.sendData(JSON.stringify(t))}updateLastHeartbeat(){this.lastHeartbeatResponse=Date.now()}heartbeat(){if(Date.now()-this.lastHeartbeatResponse>N4*2){this.ws.disconnect();return}try{this.ws.sendData("h")}catch{}}async makeRequest(t,n=QG){const r=t.id;this.sendData(t);let i;return Promise.race([new Promise((s,o)=>{i=window.setTimeout(()=>{o(new Error(`request ${r} timed out`))},n)}),new Promise(s=>{this.requestResolutions.set(r,o=>{clearTimeout(i),s(o),this.requestResolutions.delete(r)})})])}async authenticate(){const t={type:"HostSession",id:(0,oc.IntNumber)(this.nextReqId++),sessionId:this.session.id,sessionKey:this.session.key},n=await this.makeRequest(t);if(n.type==="Fail")throw new Error(n.error||"failed to authentcate")}sendIsLinked(){const t={type:"IsLinked",id:(0,oc.IntNumber)(this.nextReqId++),sessionId:this.session.id};this.sendData(t)}sendGetSessionConfig(){const t={type:"GetSessionConfig",id:(0,oc.IntNumber)(this.nextReqId++),sessionId:this.session.id};this.sendData(t)}}Ih.WalletLinkConnection=XG;var yl={},bl={},Bb={};Object.defineProperty(Bb,"__esModule",{value:!0}),Bb.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 eq=Pe&&Pe.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(bl,"__esModule",{value:!0}),bl.injectCssReset=void 0;const tq=eq(Bb);function nq(){const e=document.createElement("style");e.type="text/css",e.appendChild(document.createTextNode(tq.default)),document.documentElement.appendChild(e)}bl.injectCssReset=nq;var Oh={},wl,kt,L4,j4,Ss,$4,F4,D4,Nb,Mh,vl,U4,Lb,jb,$b,H4,Bh={},Nh=[],rq=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,_l=Array.isArray;function ti(e,t){for(var n in t)e[n]=t[n];return e}function Fb(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function Db(e,t,n){var r,i,s,o={};for(s in t)s=="key"?r=t[s]:s=="ref"?i=t[s]:o[s]=t[s];if(arguments.length>2&&(o.children=arguments.length>3?wl.call(arguments,2):n),typeof e=="function"&&e.defaultProps!=null)for(s in e.defaultProps)o[s]===void 0&&(o[s]=e.defaultProps[s]);return El(e,o,r,i,null)}function El(e,t,n,r,i){var s={type:e,props:t,key:n,ref:r,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:i??++L4,__i:-1,__u:0};return i==null&&kt.vnode!=null&&kt.vnode(s),s}function iq(){return{current:null}}function xl(e){return e.children}function Sl(e,t){this.props=e,this.context=t}function cc(e,t){if(t==null)return e.__?cc(e.__,e.__i+1):null;for(var n;t<e.__k.length;t++)if((n=e.__k[t])!=null&&n.__e!=null)return n.__e;return typeof e.type=="function"?cc(e):null}function sq(e){if(e.__P&&e.__d){var t=e.__v,n=t.__e,r=[],i=[],s=ti({},t);s.__v=t.__v+1,kt.vnode&&kt.vnode(s),Hb(e.__P,s,t,e.__n,e.__P.namespaceURI,32&t.__u?[n]:null,r,n??cc(t),!!(32&t.__u),i),s.__v=t.__v,s.__.__k[s.__i]=s,J4(r,s,i),t.__e=t.__=null,s.__e!=n&&z4(s)}}function z4(e){if((e=e.__)!=null&&e.__c!=null)return e.__e=e.__c.base=null,e.__k.some(function(t){if(t!=null&&t.__e!=null)return e.__e=e.__c.base=t.__e}),z4(e)}function Ub(e){(!e.__d&&(e.__d=!0)&&Ss.push(e)&&!Lh.__r++||$4!=kt.debounceRendering)&&(($4=kt.debounceRendering)||F4)(Lh)}function Lh(){try{for(var e,t=1;Ss.length;)Ss.length>t&&Ss.sort(D4),e=Ss.shift(),t=Ss.length,sq(e)}finally{Ss.length=Lh.__r=0}}function W4(e,t,n,r,i,s,o,a,c,u,l){var d,f,h,m,y,w,b,x=r&&r.__k||Nh,v=t.length;for(c=oq(n,t,x,c,v),d=0;d<v;d++)(h=n.__k[d])!=null&&(f=h.__i!=-1&&x[h.__i]||Bh,h.__i=d,w=Hb(e,h,f,i,s,o,a,c,u,l),m=h.__e,h.ref&&f.ref!=h.ref&&(f.ref&&Wb(f.ref,null,h),l.push(h.ref,h.__c||m,h)),y==null&&m!=null&&(y=m),(b=!!(4&h.__u))||f.__k===h.__k?(c=G4(h,c,e,b),b&&f.__e&&(f.__e=null)):typeof h.type=="function"&&w!==void 0?c=w:m&&(c=m.nextSibling),h.__u&=-7);return n.__e=y,c}function oq(e,t,n,r,i){var s,o,a,c,u,l=n.length,d=l,f=0;for(e.__k=new Array(i),s=0;s<i;s++)(o=t[s])!=null&&typeof o!="boolean"&&typeof o!="function"?(typeof o=="string"||typeof o=="number"||typeof o=="bigint"||o.constructor==String?o=e.__k[s]=El(null,o,null,null,null):_l(o)?o=e.__k[s]=El(xl,{children:o},null,null,null):o.constructor===void 0&&o.__b>0?o=e.__k[s]=El(o.type,o.props,o.key,o.ref?o.ref:null,o.__v):e.__k[s]=o,c=s+f,o.__=e,o.__b=e.__b+1,a=null,(u=o.__i=aq(o,n,c,d))!=-1&&(d--,(a=n[u])&&(a.__u|=2)),a==null||a.__v==null?(u==-1&&(i>l?f--:i<l&&f++),typeof o.type!="function"&&(o.__u|=4)):u!=c&&(u==c-1?f--:u==c+1?f++:(u>c?f--:f++,o.__u|=4))):e.__k[s]=null;if(d)for(s=0;s<l;s++)(a=n[s])!=null&&!(2&a.__u)&&(a.__e==r&&(r=cc(a)),Y4(a,a));return r}function G4(e,t,n,r){var i,s;if(typeof e.type=="function"){for(i=e.__k,s=0;i&&s<i.length;s++)i[s]&&(i[s].__=e,t=G4(i[s],t,n,r));return t}e.__e!=t&&(r&&(t&&e.type&&!t.parentNode&&(t=cc(e)),n.insertBefore(e.__e,t||null)),t=e.__e);do t=t&&t.nextSibling;while(t!=null&&t.nodeType==8);return t}function q4(e,t){return t=t||[],e==null||typeof e=="boolean"||(_l(e)?e.some(function(n){q4(n,t)}):t.push(e)),t}function aq(e,t,n,r){var i,s,o,a=e.key,c=e.type,u=t[n],l=u!=null&&(2&u.__u)==0;if(u===null&&a==null||l&&a==u.key&&c==u.type)return n;if(r>(l?1:0)){for(i=n-1,s=n+1;i>=0||s<t.length;)if((u=t[o=i>=0?i--:s++])!=null&&!(2&u.__u)&&a==u.key&&c==u.type)return o}return-1}function V4(e,t,n){t[0]=="-"?e.setProperty(t,n??""):e[t]=n==null?"":typeof n!="number"||rq.test(t)?n:n+"px"}function jh(e,t,n,r,i){var s,o;e:if(t=="style")if(typeof n=="string")e.style.cssText=n;else{if(typeof r=="string"&&(e.style.cssText=r=""),r)for(t in r)n&&t in n||V4(e.style,t,"");if(n)for(t in n)r&&n[t]==r[t]||V4(e.style,t,n[t])}else if(t[0]=="o"&&t[1]=="n")s=t!=(t=t.replace(U4,"$1")),o=t.toLowerCase(),t=o in e||t=="onFocusOut"||t=="onFocusIn"?o.slice(2):t.slice(2),e.l||(e.l={}),e.l[t+s]=n,n?r?n[vl]=r[vl]:(n[vl]=Lb,e.addEventListener(t,s?$b:jb,s)):e.removeEventListener(t,s?$b:jb,s);else{if(i=="http://www.w3.org/2000/svg")t=t.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if(t!="width"&&t!="height"&&t!="href"&&t!="list"&&t!="form"&&t!="tabIndex"&&t!="download"&&t!="rowSpan"&&t!="colSpan"&&t!="role"&&t!="popover"&&t in e)try{e[t]=n??"";break e}catch{}typeof n=="function"||(n==null||n===!1&&t[4]!="-"?e.removeAttribute(t):e.setAttribute(t,t=="popover"&&n==1?"":n))}}function K4(e){return function(t){if(this.l){var n=this.l[t.type+e];if(t[Mh]==null)t[Mh]=Lb++;else if(t[Mh]<n[vl])return;return n(kt.event?kt.event(t):t)}}}function Hb(e,t,n,r,i,s,o,a,c,u){var l,d,f,h,m,y,w,b,x,v,S,I,N,j,U,L=t.type;if(t.constructor!==void 0)return null;128&n.__u&&(c=!!(32&n.__u),s=[a=t.__e=n.__e]),(l=kt.__b)&&l(t);e:if(typeof L=="function")try{if(b=t.props,x=L.prototype&&L.prototype.render,v=(l=L.contextType)&&r[l.__c],S=l?v?v.props.value:l.__:r,n.__c?w=(d=t.__c=n.__c).__=d.__E:(x?t.__c=d=new L(b,S):(t.__c=d=new Sl(b,S),d.constructor=L,d.render=uq),v&&v.sub(d),d.state||(d.state={}),d.__n=r,f=d.__d=!0,d.__h=[],d._sb=[]),x&&d.__s==null&&(d.__s=d.state),x&&L.getDerivedStateFromProps!=null&&(d.__s==d.state&&(d.__s=ti({},d.__s)),ti(d.__s,L.getDerivedStateFromProps(b,d.__s))),h=d.props,m=d.state,d.__v=t,f)x&&L.getDerivedStateFromProps==null&&d.componentWillMount!=null&&d.componentWillMount(),x&&d.componentDidMount!=null&&d.__h.push(d.componentDidMount);else{if(x&&L.getDerivedStateFromProps==null&&b!==h&&d.componentWillReceiveProps!=null&&d.componentWillReceiveProps(b,S),t.__v==n.__v||!d.__e&&d.shouldComponentUpdate!=null&&d.shouldComponentUpdate(b,d.__s,S)===!1){t.__v!=n.__v&&(d.props=b,d.state=d.__s,d.__d=!1),t.__e=n.__e,t.__k=n.__k,t.__k.some(function(Y){Y&&(Y.__=t)}),Nh.push.apply(d.__h,d._sb),d._sb=[],d.__h.length&&o.push(d);break e}d.componentWillUpdate!=null&&d.componentWillUpdate(b,d.__s,S),x&&d.componentDidUpdate!=null&&d.__h.push(function(){d.componentDidUpdate(h,m,y)})}if(d.context=S,d.props=b,d.__P=e,d.__e=!1,I=kt.__r,N=0,x)d.state=d.__s,d.__d=!1,I&&I(t),l=d.render(d.props,d.state,d.context),Nh.push.apply(d.__h,d._sb),d._sb=[];else do d.__d=!1,I&&I(t),l=d.render(d.props,d.state,d.context),d.state=d.__s;while(d.__d&&++N<25);d.state=d.__s,d.getChildContext!=null&&(r=ti(ti({},r),d.getChildContext())),x&&!f&&d.getSnapshotBeforeUpdate!=null&&(y=d.getSnapshotBeforeUpdate(h,m)),j=l!=null&&l.type===xl&&l.key==null?Z4(l.props.children):l,a=W4(e,_l(j)?j:[j],t,n,r,i,s,o,a,c,u),d.base=t.__e,t.__u&=-161,d.__h.length&&o.push(d),w&&(d.__E=d.__=null)}catch(Y){if(t.__v=null,c||s!=null)if(Y.then){for(t.__u|=c?160:128;a&&a.nodeType==8&&a.nextSibling;)a=a.nextSibling;s[s.indexOf(a)]=null,t.__e=a}else{for(U=s.length;U--;)Fb(s[U]);zb(t)}else t.__e=n.__e,t.__k=n.__k,Y.then||zb(t);kt.__e(Y,t,n)}else s==null&&t.__v==n.__v?(t.__k=n.__k,t.__e=n.__e):a=t.__e=cq(n.__e,t,n,r,i,s,o,c,u);return(l=kt.diffed)&&l(t),128&t.__u?void 0:a}function zb(e){e&&(e.__c&&(e.__c.__e=!0),e.__k&&e.__k.some(zb))}function J4(e,t,n){for(var r=0;r<n.length;r++)Wb(n[r],n[++r],n[++r]);kt.__c&&kt.__c(t,e),e.some(function(i){try{e=i.__h,i.__h=[],e.some(function(s){s.call(i)})}catch(s){kt.__e(s,i.__v)}})}function Z4(e){return typeof e!="object"||e==null||e.__b>0?e:_l(e)?e.map(Z4):ti({},e)}function cq(e,t,n,r,i,s,o,a,c){var u,l,d,f,h,m,y,w=n.props||Bh,b=t.props,x=t.type;if(x=="svg"?i="http://www.w3.org/2000/svg":x=="math"?i="http://www.w3.org/1998/Math/MathML":i||(i="http://www.w3.org/1999/xhtml"),s!=null){for(u=0;u<s.length;u++)if((h=s[u])&&"setAttribute"in h==!!x&&(x?h.localName==x:h.nodeType==3)){e=h,s[u]=null;break}}if(e==null){if(x==null)return document.createTextNode(b);e=document.createElementNS(i,x,b.is&&b),a&&(kt.__m&&kt.__m(t,s),a=!1),s=null}if(x==null)w===b||a&&e.data==b||(e.data=b);else{if(s=s&&wl.call(e.childNodes),!a&&s!=null)for(w={},u=0;u<e.attributes.length;u++)w[(h=e.attributes[u]).name]=h.value;for(u in w)h=w[u],u=="dangerouslySetInnerHTML"?d=h:u=="children"||u in b||u=="value"&&"defaultValue"in b||u=="checked"&&"defaultChecked"in b||jh(e,u,null,h,i);for(u in b)h=b[u],u=="children"?f=h:u=="dangerouslySetInnerHTML"?l=h:u=="value"?m=h:u=="checked"?y=h:a&&typeof h!="function"||w[u]===h||jh(e,u,h,w[u],i);if(l)a||d&&(l.__html==d.__html||l.__html==e.innerHTML)||(e.innerHTML=l.__html),t.__k=[];else if(d&&(e.innerHTML=""),W4(t.type=="template"?e.content:e,_l(f)?f:[f],t,n,r,x=="foreignObject"?"http://www.w3.org/1999/xhtml":i,s,o,s?s[0]:n.__k&&cc(n,0),a,c),s!=null)for(u=s.length;u--;)Fb(s[u]);a||(u="value",x=="progress"&&m==null?e.removeAttribute("value"):m!=null&&(m!==e[u]||x=="progress"&&!m||x=="option"&&m!=w[u])&&jh(e,u,m,w[u],i),u="checked",y!=null&&y!=e[u]&&jh(e,u,y,w[u],i))}return e}function Wb(e,t,n){try{if(typeof e=="function"){var r=typeof e.__u=="function";r&&e.__u(),r&&t==null||(e.__u=e(t))}else e.current=t}catch(i){kt.__e(i,n)}}function Y4(e,t,n){var r,i;if(kt.unmount&&kt.unmount(e),(r=e.ref)&&(r.current&&r.current!=e.__e||Wb(r,null,t)),(r=e.__c)!=null){if(r.componentWillUnmount)try{r.componentWillUnmount()}catch(s){kt.__e(s,t)}r.base=r.__P=null}if(r=e.__k)for(i=0;i<r.length;i++)r[i]&&Y4(r[i],t,n||typeof e.type!="function");n||Fb(e.__e),e.__c=e.__=e.__e=void 0}function uq(e,t,n){return this.constructor(e,n)}function Q4(e,t,n){var r,i,s,o;t==document&&(t=document.documentElement),kt.__&&kt.__(e,t),i=(r=typeof n=="function")?null:n&&n.__k||t.__k,s=[],o=[],Hb(t,e=(!r&&n||t).__k=Db(xl,null,[e]),i||Bh,Bh,t.namespaceURI,!r&&n?[n]:i?null:t.firstChild?wl.call(t.childNodes):null,s,!r&&n?n:i?i.__e:t.firstChild,r,o),J4(s,e,o)}function X4(e,t){Q4(e,t,X4)}function lq(e,t,n){var r,i,s,o,a=ti({},e.props);for(s in e.type&&e.type.defaultProps&&(o=e.type.defaultProps),t)s=="key"?r=t[s]:s=="ref"?i=t[s]:a[s]=t[s]===void 0&&o!=null?o[s]:t[s];return arguments.length>2&&(a.children=arguments.length>3?wl.call(arguments,2):n),El(e.type,a,r||e.key,i||e.ref,null)}function dq(e){function t(n){var r,i;return this.getChildContext||(r=new Set,(i={})[t.__c]=this,this.getChildContext=function(){return i},this.componentWillUnmount=function(){r=null},this.shouldComponentUpdate=function(s){this.props.value!=s.value&&r.forEach(function(o){o.__e=!0,Ub(o)})},this.sub=function(s){r.add(s);var o=s.componentWillUnmount;s.componentWillUnmount=function(){r&&r.delete(s),o&&o.call(s)}}),n.children}return t.__c="__cC"+H4++,t.__=e,t.Provider=t.__l=(t.Consumer=function(n,r){return n.children(r)}).contextType=t,t}wl=Nh.slice,kt={__e:function(e,t,n,r){for(var i,s,o;t=t.__;)if((i=t.__c)&&!i.__)try{if((s=i.constructor)&&s.getDerivedStateFromError!=null&&(i.setState(s.getDerivedStateFromError(e)),o=i.__d),i.componentDidCatch!=null&&(i.componentDidCatch(e,r||{}),o=i.__d),o)return i.__E=i}catch(a){e=a}throw e}},L4=0,j4=function(e){return e!=null&&e.constructor===void 0},Sl.prototype.setState=function(e,t){var n;n=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=ti({},this.state),typeof e=="function"&&(e=e(ti({},n),this.props)),e&&ti(n,e),e!=null&&this.__v&&(t&&this._sb.push(t),Ub(this))},Sl.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),Ub(this))},Sl.prototype.render=xl,Ss=[],F4=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,D4=function(e,t){return e.__v.__b-t.__v.__b},Lh.__r=0,Nb=Math.random().toString(8),Mh="__d"+Nb,vl="__a"+Nb,U4=/(PointerCapture)$|Capture$/i,Lb=0,jb=K4(!1),$b=K4(!0),H4=0;const Zn=Zo(Object.freeze(Object.defineProperty({__proto__:null,Component:Sl,Fragment:xl,cloneElement:lq,createContext:dq,createElement:Db,createRef:iq,h:Db,hydrate:X4,get isValidElement(){return j4},get options(){return kt},render:Q4,toChildArray:q4},Symbol.toStringTag,{value:"Module"})));var $h={};const kl=Zo(lj);var Fi,_t,Gb,e8,uc=0,t8=[],Ot=kt,n8=Ot.__b,r8=Ot.__r,i8=Ot.diffed,s8=Ot.__c,o8=Ot.unmount,a8=Ot.__;function Eo(e,t){Ot.__h&&Ot.__h(_t,e,uc||t),uc=0;var n=_t.__H||(_t.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({}),n.__[e]}function c8(e){return uc=1,u8(f8,e)}function u8(e,t,n){var r=Eo(Fi++,2);if(r.t=e,!r.__c&&(r.__=[n?n(t):f8(void 0,t),function(a){var c=r.__N?r.__N[0]:r.__[0],u=r.t(c,a);c!==u&&(r.__N=[u,r.__[1]],r.__c.setState({}))}],r.__c=_t,!_t.__f)){var i=function(a,c,u){if(!r.__c.__H)return!0;var l=r.__c.__H.__.filter(function(f){return f.__c});if(l.every(function(f){return!f.__N}))return!s||s.call(this,a,c,u);var d=r.__c.props!==a;return l.some(function(f){if(f.__N){var h=f.__[0];f.__=f.__N,f.__N=void 0,h!==f.__[0]&&(d=!0)}}),s&&s.call(this,a,c,u)||d};_t.__f=!0;var s=_t.shouldComponentUpdate,o=_t.componentWillUpdate;_t.componentWillUpdate=function(a,c,u){if(this.__e){var l=s;s=void 0,i(a,c,u),s=l}o&&o.call(this,a,c,u)},_t.shouldComponentUpdate=i}return r.__N||r.__}function fq(e,t){var n=Eo(Fi++,3);!Ot.__s&&Kb(n.__H,t)&&(n.__=e,n.u=t,_t.__H.__h.push(n))}function l8(e,t){var n=Eo(Fi++,4);!Ot.__s&&Kb(n.__H,t)&&(n.__=e,n.u=t,_t.__h.push(n))}function hq(e){return uc=5,qb(function(){return{current:e}},[])}function pq(e,t,n){uc=6,l8(function(){if(typeof e=="function"){var r=e(t());return function(){e(null),r&&typeof r=="function"&&r()}}if(e)return e.current=t(),function(){return e.current=null}},n==null?n:n.concat(e))}function qb(e,t){var n=Eo(Fi++,7);return Kb(n.__H,t)&&(n.__=e(),n.__H=t,n.__h=e),n.__}function mq(e,t){return uc=8,qb(function(){return e},t)}function gq(e){var t=_t.context[e.__c],n=Eo(Fi++,9);return n.c=e,t?(n.__==null&&(n.__=!0,t.sub(_t)),t.props.value):e.__}function yq(e,t){Ot.useDebugValue&&Ot.useDebugValue(t?t(e):e)}function bq(e){var t=Eo(Fi++,10),n=c8();return t.__=e,_t.componentDidCatch||(_t.componentDidCatch=function(r,i){t.__&&t.__(r,i),n[1](r)}),[n[0],function(){n[1](void 0)}]}function wq(){var e=Eo(Fi++,11);if(!e.__){for(var t=_t.__v;t!==null&&!t.__m&&t.__!==null;)t=t.__;var n=t.__m||(t.__m=[0,0]);e.__="P"+n[0]+"-"+n[1]++}return e.__}function vq(){for(var e;e=t8.shift();){var t=e.__H;if(e.__P&&t)try{t.__h.some(Fh),t.__h.some(Vb),t.__h=[]}catch(n){t.__h=[],Ot.__e(n,e.__v)}}}Ot.__b=function(e){_t=null,n8&&n8(e)},Ot.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),a8&&a8(e,t)},Ot.__r=function(e){r8&&r8(e),Fi=0;var t=(_t=e.__c).__H;t&&(Gb===_t?(t.__h=[],_t.__h=[],t.__.some(function(n){n.__N&&(n.__=n.__N),n.u=n.__N=void 0})):(t.__h.some(Fh),t.__h.some(Vb),t.__h=[],Fi=0)),Gb=_t},Ot.diffed=function(e){i8&&i8(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(t8.push(t)!==1&&e8===Ot.requestAnimationFrame||((e8=Ot.requestAnimationFrame)||_q)(vq)),t.__H.__.some(function(n){n.u&&(n.__H=n.u),n.u=void 0})),Gb=_t=null},Ot.__c=function(e,t){t.some(function(n){try{n.__h.some(Fh),n.__h=n.__h.filter(function(r){return!r.__||Vb(r)})}catch(r){t.some(function(i){i.__h&&(i.__h=[])}),t=[],Ot.__e(r,n.__v)}}),s8&&s8(e,t)},Ot.unmount=function(e){o8&&o8(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.some(function(r){try{Fh(r)}catch(i){t=i}}),n.__H=void 0,t&&Ot.__e(t,n.__v))};var d8=typeof requestAnimationFrame=="function";function _q(e){var t,n=function(){clearTimeout(r),d8&&cancelAnimationFrame(t),setTimeout(e)},r=setTimeout(n,35);d8&&(t=requestAnimationFrame(n))}function Fh(e){var t=_t,n=e.__c;typeof n=="function"&&(e.__c=void 0,n()),_t=t}function Vb(e){var t=_t;e.__c=e.__(),_t=t}function Kb(e,t){return!e||e.length!==t.length||t.some(function(n,r){return n!==e[r]})}function f8(e,t){return typeof t=="function"?t(e):t}const Dh=Zo(Object.freeze(Object.defineProperty({__proto__:null,useCallback:mq,useContext:gq,useDebugValue:yq,useEffect:fq,useErrorBoundary:bq,useId:wq,useImperativeHandle:pq,useLayoutEffect:l8,useMemo:qb,useReducer:u8,useRef:hq,useState:c8},Symbol.toStringTag,{value:"Module"})));var lc={},Uh={};Object.defineProperty(Uh,"__esModule",{value:!0}),Uh.CloseIcon=void 0;const h8=Zn;function Eq(e){return(0,h8.h)("svg",Object.assign({width:"40",height:"40",viewBox:"0 0 40 40",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e),(0,h8.h)("path",{d:"M13.7677 13L12.3535 14.4142L18.3535 20.4142L12.3535 26.4142L13.7677 27.8284L19.7677 21.8284L25.7677 27.8284L27.1819 26.4142L21.1819 20.4142L27.1819 14.4142L25.7677 13L19.7677 19L13.7677 13Z"}))}Uh.CloseIcon=Eq;var Hh={};Object.defineProperty(Hh,"__esModule",{value:!0}),Hh.CoinbaseWalletRound=void 0;const zh=Zn;function xq(e){return(0,zh.h)("svg",Object.assign({width:"28",height:"28",viewBox:"0 0 28 28",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e),(0,zh.h)("circle",{cx:"14",cy:"14",r:"14",fill:"#0052FF"}),(0,zh.h)("path",{d:"M23.8521 14.0003C23.8521 19.455 19.455 23.8521 14.0003 23.8521C8.54559 23.8521 4.14844 19.455 4.14844 14.0003C4.14844 8.54559 8.54559 4.14844 14.0003 4.14844C19.455 4.14844 23.8521 8.54559 23.8521 14.0003Z",fill:"white"}),(0,zh.h)("path",{d:"M11.1855 12.5042C11.1855 12.0477 11.1855 11.7942 11.2835 11.642C11.3814 11.4899 11.4793 11.3377 11.6261 11.287C11.8219 11.1855 12.0178 11.1855 12.5073 11.1855H15.4934C15.983 11.1855 16.1788 11.1855 16.3746 11.287C16.5215 11.3884 16.6683 11.4899 16.7173 11.642C16.8152 11.8449 16.8152 12.0477 16.8152 12.5042V15.4965C16.8152 15.953 16.8152 16.2066 16.7173 16.3587C16.6194 16.5109 16.5215 16.663 16.3746 16.7137C16.1788 16.8152 15.983 16.8152 15.4934 16.8152H12.5073C12.0178 16.8152 11.8219 16.8152 11.6261 16.7137C11.4793 16.6123 11.3324 16.5109 11.2835 16.3587C11.1855 16.1558 11.1855 15.953 11.1855 15.4965V12.5042Z",fill:"#0052FF"}))}Hh.CoinbaseWalletRound=xq;var Wh={};Object.defineProperty(Wh,"__esModule",{value:!0}),Wh.QRCodeIcon=void 0;const Al=Zn;function Sq(e){return(0,Al.h)("svg",Object.assign({width:"18",height:"18",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},e),(0,Al.h)("path",{d:"M3 3V8.99939L5 8.99996V5H9V3H3Z"}),(0,Al.h)("path",{d:"M15 21L21 21V15.0006L19 15V19L15 19V21Z"}),(0,Al.h)("path",{d:"M21 9H19V5H15.0006L15 3H21V9Z"}),(0,Al.h)("path",{d:"M3 15V21H8.99939L8.99996 19H5L5 15H3Z"}))}Wh.QRCodeIcon=Sq;var Gh={};function p8(e){this.mode=or.MODE_8BIT_BYTE,this.data=e,this.parsedData=[];for(var t=0,n=this.data.length;t<n;t++){var r=[],i=this.data.charCodeAt(t);i>65536?(r[0]=240|(i&1835008)>>>18,r[1]=128|(i&258048)>>>12,r[2]=128|(i&4032)>>>6,r[3]=128|i&63):i>2048?(r[0]=224|(i&61440)>>>12,r[1]=128|(i&4032)>>>6,r[2]=128|i&63):i>128?(r[0]=192|(i&1984)>>>6,r[1]=128|i&63):r[0]=i,this.parsedData.push(r)}this.parsedData=Array.prototype.concat.apply([],this.parsedData),this.parsedData.length!=this.data.length&&(this.parsedData.unshift(191),this.parsedData.unshift(187),this.parsedData.unshift(239))}p8.prototype={getLength:function(e){return this.parsedData.length},write:function(e){for(var t=0,n=this.parsedData.length;t<n;t++)e.put(this.parsedData[t],8)}};function ni(e,t){this.typeNumber=e,this.errorCorrectLevel=t,this.modules=null,this.moduleCount=0,this.dataCache=null,this.dataList=[]}ni.prototype={addData:function(e){var t=new p8(e);this.dataList.push(t),this.dataCache=null},isDark:function(e,t){if(e<0||this.moduleCount<=e||t<0||this.moduleCount<=t)throw new Error(e+","+t);return this.modules[e][t]},getModuleCount:function(){return this.moduleCount},make:function(){this.makeImpl(!1,this.getBestMaskPattern())},makeImpl:function(e,t){this.moduleCount=this.typeNumber*4+17,this.modules=new Array(this.moduleCount);for(var n=0;n<this.moduleCount;n++){this.modules[n]=new Array(this.moduleCount);for(var r=0;r<this.moduleCount;r++)this.modules[n][r]=null}this.setupPositionProbePattern(0,0),this.setupPositionProbePattern(this.moduleCount-7,0),this.setupPositionProbePattern(0,this.moduleCount-7),this.setupPositionAdjustPattern(),this.setupTimingPattern(),this.setupTypeInfo(e,t),this.typeNumber>=7&&this.setupTypeNumber(e),this.dataCache==null&&(this.dataCache=ni.createData(this.typeNumber,this.errorCorrectLevel,this.dataList)),this.mapData(this.dataCache,t)},setupPositionProbePattern:function(e,t){for(var n=-1;n<=7;n++)if(!(e+n<=-1||this.moduleCount<=e+n))for(var r=-1;r<=7;r++)t+r<=-1||this.moduleCount<=t+r||(0<=n&&n<=6&&(r==0||r==6)||0<=r&&r<=6&&(n==0||n==6)||2<=n&&n<=4&&2<=r&&r<=4?this.modules[e+n][t+r]=!0:this.modules[e+n][t+r]=!1)},getBestMaskPattern:function(){for(var e=0,t=0,n=0;n<8;n++){this.makeImpl(!0,n);var r=Mt.getLostPoint(this);(n==0||e>r)&&(e=r,t=n)}return t},createMovieClip:function(e,t,n){var r=e.createEmptyMovieClip(t,n),i=1;this.make();for(var s=0;s<this.modules.length;s++)for(var o=s*i,a=0;a<this.modules[s].length;a++){var c=a*i,u=this.modules[s][a];u&&(r.beginFill(0,100),r.moveTo(c,o),r.lineTo(c+i,o),r.lineTo(c+i,o+i),r.lineTo(c,o+i),r.endFill())}return r},setupTimingPattern:function(){for(var e=8;e<this.moduleCount-8;e++)this.modules[e][6]==null&&(this.modules[e][6]=e%2==0);for(var t=8;t<this.moduleCount-8;t++)this.modules[6][t]==null&&(this.modules[6][t]=t%2==0)},setupPositionAdjustPattern:function(){for(var e=Mt.getPatternPosition(this.typeNumber),t=0;t<e.length;t++)for(var n=0;n<e.length;n++){var r=e[t],i=e[n];if(this.modules[r][i]==null)for(var s=-2;s<=2;s++)for(var o=-2;o<=2;o++)s==-2||s==2||o==-2||o==2||s==0&&o==0?this.modules[r+s][i+o]=!0:this.modules[r+s][i+o]=!1}},setupTypeNumber:function(e){for(var t=Mt.getBCHTypeNumber(this.typeNumber),n=0;n<18;n++){var r=!e&&(t>>n&1)==1;this.modules[Math.floor(n/3)][n%3+this.moduleCount-8-3]=r}for(var n=0;n<18;n++){var r=!e&&(t>>n&1)==1;this.modules[n%3+this.moduleCount-8-3][Math.floor(n/3)]=r}},setupTypeInfo:function(e,t){for(var n=this.errorCorrectLevel<<3|t,r=Mt.getBCHTypeInfo(n),i=0;i<15;i++){var s=!e&&(r>>i&1)==1;i<6?this.modules[i][8]=s:i<8?this.modules[i+1][8]=s:this.modules[this.moduleCount-15+i][8]=s}for(var i=0;i<15;i++){var s=!e&&(r>>i&1)==1;i<8?this.modules[8][this.moduleCount-i-1]=s:i<9?this.modules[8][15-i-1+1]=s:this.modules[8][15-i-1]=s}this.modules[this.moduleCount-8][8]=!e},mapData:function(e,t){for(var n=-1,r=this.moduleCount-1,i=7,s=0,o=this.moduleCount-1;o>0;o-=2)for(o==6&&o--;;){for(var a=0;a<2;a++)if(this.modules[r][o-a]==null){var c=!1;s<e.length&&(c=(e[s]>>>i&1)==1);var u=Mt.getMask(t,r,o-a);u&&(c=!c),this.modules[r][o-a]=c,i--,i==-1&&(s++,i=7)}if(r+=n,r<0||this.moduleCount<=r){r-=n,n=-n;break}}}},ni.PAD0=236,ni.PAD1=17,ni.createData=function(e,t,n){for(var r=ri.getRSBlocks(e,t),i=new m8,s=0;s<n.length;s++){var o=n[s];i.put(o.mode,4),i.put(o.getLength(),Mt.getLengthInBits(o.mode,e)),o.write(i)}for(var a=0,s=0;s<r.length;s++)a+=r[s].dataCount;if(i.getLengthInBits()>a*8)throw new Error("code length overflow. ("+i.getLengthInBits()+">"+a*8+")");for(i.getLengthInBits()+4<=a*8&&i.put(0,4);i.getLengthInBits()%8!=0;)i.putBit(!1);for(;!(i.getLengthInBits()>=a*8||(i.put(ni.PAD0,8),i.getLengthInBits()>=a*8));)i.put(ni.PAD1,8);return ni.createBytes(i,r)},ni.createBytes=function(e,t){for(var n=0,r=0,i=0,s=new Array(t.length),o=new Array(t.length),a=0;a<t.length;a++){var c=t[a].dataCount,u=t[a].totalCount-c;r=Math.max(r,c),i=Math.max(i,u),s[a]=new Array(c);for(var l=0;l<s[a].length;l++)s[a][l]=255&e.buffer[l+n];n+=c;var d=Mt.getErrorCorrectPolynomial(u),f=new dc(s[a],d.getLength()-1),h=f.mod(d);o[a]=new Array(d.getLength()-1);for(var l=0;l<o[a].length;l++){var m=l+h.getLength()-o[a].length;o[a][l]=m>=0?h.get(m):0}}for(var y=0,l=0;l<t.length;l++)y+=t[l].totalCount;for(var w=new Array(y),b=0,l=0;l<r;l++)for(var a=0;a<t.length;a++)l<s[a].length&&(w[b++]=s[a][l]);for(var l=0;l<i;l++)for(var a=0;a<t.length;a++)l<o[a].length&&(w[b++]=o[a][l]);return w};for(var or={MODE_NUMBER:1,MODE_ALPHA_NUM:2,MODE_8BIT_BYTE:4,MODE_KANJI:8},ks={L:1,M:0,Q:3,H:2},As={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7},Mt={PATTERN_POSITION_TABLE:[[],[6,18],[6,22],[6,26],[6,30],[6,34],[6,22,38],[6,24,42],[6,26,46],[6,28,50],[6,30,54],[6,32,58],[6,34,62],[6,26,46,66],[6,26,48,70],[6,26,50,74],[6,30,54,78],[6,30,56,82],[6,30,58,86],[6,34,62,90],[6,28,50,72,94],[6,26,50,74,98],[6,30,54,78,102],[6,28,54,80,106],[6,32,58,84,110],[6,30,58,86,114],[6,34,62,90,118],[6,26,50,74,98,122],[6,30,54,78,102,126],[6,26,52,78,104,130],[6,30,56,82,108,134],[6,34,60,86,112,138],[6,30,58,86,114,142],[6,34,62,90,118,146],[6,30,54,78,102,126,150],[6,24,50,76,102,128,154],[6,28,54,80,106,132,158],[6,32,58,84,110,136,162],[6,26,54,82,110,138,166],[6,30,58,86,114,142,170]],G15:1335,G18:7973,G15_MASK:21522,getBCHTypeInfo:function(e){for(var t=e<<10;Mt.getBCHDigit(t)-Mt.getBCHDigit(Mt.G15)>=0;)t^=Mt.G15<<Mt.getBCHDigit(t)-Mt.getBCHDigit(Mt.G15);return(e<<10|t)^Mt.G15_MASK},getBCHTypeNumber:function(e){for(var t=e<<12;Mt.getBCHDigit(t)-Mt.getBCHDigit(Mt.G18)>=0;)t^=Mt.G18<<Mt.getBCHDigit(t)-Mt.getBCHDigit(Mt.G18);return e<<12|t},getBCHDigit:function(e){for(var t=0;e!=0;)t++,e>>>=1;return t},getPatternPosition:function(e){return Mt.PATTERN_POSITION_TABLE[e-1]},getMask:function(e,t,n){switch(e){case As.PATTERN000:return(t+n)%2==0;case As.PATTERN001:return t%2==0;case As.PATTERN010:return n%3==0;case As.PATTERN011:return(t+n)%3==0;case As.PATTERN100:return(Math.floor(t/2)+Math.floor(n/3))%2==0;case As.PATTERN101:return t*n%2+t*n%3==0;case As.PATTERN110:return(t*n%2+t*n%3)%2==0;case As.PATTERN111:return(t*n%3+(t+n)%2)%2==0;default:throw new Error("bad maskPattern:"+e)}},getErrorCorrectPolynomial:function(e){for(var t=new dc([1],0),n=0;n<e;n++)t=t.multiply(new dc([1,fn.gexp(n)],0));return t},getLengthInBits:function(e,t){if(1<=t&&t<10)switch(e){case or.MODE_NUMBER:return 10;case or.MODE_ALPHA_NUM:return 9;case or.MODE_8BIT_BYTE:return 8;case or.MODE_KANJI:return 8;default:throw new Error("mode:"+e)}else if(t<27)switch(e){case or.MODE_NUMBER:return 12;case or.MODE_ALPHA_NUM:return 11;case or.MODE_8BIT_BYTE:return 16;case or.MODE_KANJI:return 10;default:throw new Error("mode:"+e)}else if(t<41)switch(e){case or.MODE_NUMBER:return 14;case or.MODE_ALPHA_NUM:return 13;case or.MODE_8BIT_BYTE:return 16;case or.MODE_KANJI:return 12;default:throw new Error("mode:"+e)}else throw new Error("type:"+t)},getLostPoint:function(e){for(var t=e.getModuleCount(),n=0,r=0;r<t;r++)for(var i=0;i<t;i++){for(var s=0,o=e.isDark(r,i),a=-1;a<=1;a++)if(!(r+a<0||t<=r+a))for(var c=-1;c<=1;c++)i+c<0||t<=i+c||a==0&&c==0||o==e.isDark(r+a,i+c)&&s++;s>5&&(n+=3+s-5)}for(var r=0;r<t-1;r++)for(var i=0;i<t-1;i++){var u=0;e.isDark(r,i)&&u++,e.isDark(r+1,i)&&u++,e.isDark(r,i+1)&&u++,e.isDark(r+1,i+1)&&u++,(u==0||u==4)&&(n+=3)}for(var r=0;r<t;r++)for(var i=0;i<t-6;i++)e.isDark(r,i)&&!e.isDark(r,i+1)&&e.isDark(r,i+2)&&e.isDark(r,i+3)&&e.isDark(r,i+4)&&!e.isDark(r,i+5)&&e.isDark(r,i+6)&&(n+=40);for(var i=0;i<t;i++)for(var r=0;r<t-6;r++)e.isDark(r,i)&&!e.isDark(r+1,i)&&e.isDark(r+2,i)&&e.isDark(r+3,i)&&e.isDark(r+4,i)&&!e.isDark(r+5,i)&&e.isDark(r+6,i)&&(n+=40);for(var l=0,i=0;i<t;i++)for(var r=0;r<t;r++)e.isDark(r,i)&&l++;var d=Math.abs(100*l/t/t-50)/5;return n+=d*10,n}},fn={glog:function(e){if(e<1)throw new Error("glog("+e+")");return fn.LOG_TABLE[e]},gexp:function(e){for(;e<0;)e+=255;for(;e>=256;)e-=255;return fn.EXP_TABLE[e]},EXP_TABLE:new Array(256),LOG_TABLE:new Array(256)},bn=0;bn<8;bn++)fn.EXP_TABLE[bn]=1<<bn;for(var bn=8;bn<256;bn++)fn.EXP_TABLE[bn]=fn.EXP_TABLE[bn-4]^fn.EXP_TABLE[bn-5]^fn.EXP_TABLE[bn-6]^fn.EXP_TABLE[bn-8];for(var bn=0;bn<255;bn++)fn.LOG_TABLE[fn.EXP_TABLE[bn]]=bn;function dc(e,t){if(e.length==null)throw new Error(e.length+"/"+t);for(var n=0;n<e.length&&e[n]==0;)n++;this.num=new Array(e.length-n+t);for(var r=0;r<e.length-n;r++)this.num[r]=e[r+n]}dc.prototype={get:function(e){return this.num[e]},getLength:function(){return this.num.length},multiply:function(e){for(var t=new Array(this.getLength()+e.getLength()-1),n=0;n<this.getLength();n++)for(var r=0;r<e.getLength();r++)t[n+r]^=fn.gexp(fn.glog(this.get(n))+fn.glog(e.get(r)));return new dc(t,0)},mod:function(e){if(this.getLength()-e.getLength()<0)return this;for(var t=fn.glog(this.get(0))-fn.glog(e.get(0)),n=new Array(this.getLength()),r=0;r<this.getLength();r++)n[r]=this.get(r);for(var r=0;r<e.getLength();r++)n[r]^=fn.gexp(fn.glog(e.get(r))+t);return new dc(n,0).mod(e)}};function ri(e,t){this.totalCount=e,this.dataCount=t}ri.RS_BLOCK_TABLE=[[1,26,19],[1,26,16],[1,26,13],[1,26,9],[1,44,34],[1,44,28],[1,44,22],[1,44,16],[1,70,55],[1,70,44],[2,35,17],[2,35,13],[1,100,80],[2,50,32],[2,50,24],[4,25,9],[1,134,108],[2,67,43],[2,33,15,2,34,16],[2,33,11,2,34,12],[2,86,68],[4,43,27],[4,43,19],[4,43,15],[2,98,78],[4,49,31],[2,32,14,4,33,15],[4,39,13,1,40,14],[2,121,97],[2,60,38,2,61,39],[4,40,18,2,41,19],[4,40,14,2,41,15],[2,146,116],[3,58,36,2,59,37],[4,36,16,4,37,17],[4,36,12,4,37,13],[2,86,68,2,87,69],[4,69,43,1,70,44],[6,43,19,2,44,20],[6,43,15,2,44,16],[4,101,81],[1,80,50,4,81,51],[4,50,22,4,51,23],[3,36,12,8,37,13],[2,116,92,2,117,93],[6,58,36,2,59,37],[4,46,20,6,47,21],[7,42,14,4,43,15],[4,133,107],[8,59,37,1,60,38],[8,44,20,4,45,21],[12,33,11,4,34,12],[3,145,115,1,146,116],[4,64,40,5,65,41],[11,36,16,5,37,17],[11,36,12,5,37,13],[5,109,87,1,110,88],[5,65,41,5,66,42],[5,54,24,7,55,25],[11,36,12],[5,122,98,1,123,99],[7,73,45,3,74,46],[15,43,19,2,44,20],[3,45,15,13,46,16],[1,135,107,5,136,108],[10,74,46,1,75,47],[1,50,22,15,51,23],[2,42,14,17,43,15],[5,150,120,1,151,121],[9,69,43,4,70,44],[17,50,22,1,51,23],[2,42,14,19,43,15],[3,141,113,4,142,114],[3,70,44,11,71,45],[17,47,21,4,48,22],[9,39,13,16,40,14],[3,135,107,5,136,108],[3,67,41,13,68,42],[15,54,24,5,55,25],[15,43,15,10,44,16],[4,144,116,4,145,117],[17,68,42],[17,50,22,6,51,23],[19,46,16,6,47,17],[2,139,111,7,140,112],[17,74,46],[7,54,24,16,55,25],[34,37,13],[4,151,121,5,152,122],[4,75,47,14,76,48],[11,54,24,14,55,25],[16,45,15,14,46,16],[6,147,117,4,148,118],[6,73,45,14,74,46],[11,54,24,16,55,25],[30,46,16,2,47,17],[8,132,106,4,133,107],[8,75,47,13,76,48],[7,54,24,22,55,25],[22,45,15,13,46,16],[10,142,114,2,143,115],[19,74,46,4,75,47],[28,50,22,6,51,23],[33,46,16,4,47,17],[8,152,122,4,153,123],[22,73,45,3,74,46],[8,53,23,26,54,24],[12,45,15,28,46,16],[3,147,117,10,148,118],[3,73,45,23,74,46],[4,54,24,31,55,25],[11,45,15,31,46,16],[7,146,116,7,147,117],[21,73,45,7,74,46],[1,53,23,37,54,24],[19,45,15,26,46,16],[5,145,115,10,146,116],[19,75,47,10,76,48],[15,54,24,25,55,25],[23,45,15,25,46,16],[13,145,115,3,146,116],[2,74,46,29,75,47],[42,54,24,1,55,25],[23,45,15,28,46,16],[17,145,115],[10,74,46,23,75,47],[10,54,24,35,55,25],[19,45,15,35,46,16],[17,145,115,1,146,116],[14,74,46,21,75,47],[29,54,24,19,55,25],[11,45,15,46,46,16],[13,145,115,6,146,116],[14,74,46,23,75,47],[44,54,24,7,55,25],[59,46,16,1,47,17],[12,151,121,7,152,122],[12,75,47,26,76,48],[39,54,24,14,55,25],[22,45,15,41,46,16],[6,151,121,14,152,122],[6,75,47,34,76,48],[46,54,24,10,55,25],[2,45,15,64,46,16],[17,152,122,4,153,123],[29,74,46,14,75,47],[49,54,24,10,55,25],[24,45,15,46,46,16],[4,152,122,18,153,123],[13,74,46,32,75,47],[48,54,24,14,55,25],[42,45,15,32,46,16],[20,147,117,4,148,118],[40,75,47,7,76,48],[43,54,24,22,55,25],[10,45,15,67,46,16],[19,148,118,6,149,119],[18,75,47,31,76,48],[34,54,24,34,55,25],[20,45,15,61,46,16]],ri.getRSBlocks=function(e,t){var n=ri.getRsBlockTable(e,t);if(n==null)throw new Error("bad rs block @ typeNumber:"+e+"/errorCorrectLevel:"+t);for(var r=n.length/3,i=[],s=0;s<r;s++)for(var o=n[s*3+0],a=n[s*3+1],c=n[s*3+2],u=0;u<o;u++)i.push(new ri(a,c));return i},ri.getRsBlockTable=function(e,t){switch(t){case ks.L:return ri.RS_BLOCK_TABLE[(e-1)*4+0];case ks.M:return ri.RS_BLOCK_TABLE[(e-1)*4+1];case ks.Q:return ri.RS_BLOCK_TABLE[(e-1)*4+2];case ks.H:return ri.RS_BLOCK_TABLE[(e-1)*4+3];default:return}};function m8(){this.buffer=[],this.length=0}m8.prototype={get:function(e){var t=Math.floor(e/8);return(this.buffer[t]>>>7-e%8&1)==1},put:function(e,t){for(var n=0;n<t;n++)this.putBit((e>>>t-n-1&1)==1)},getLengthInBits:function(){return this.length},putBit:function(e){var t=Math.floor(this.length/8);this.buffer.length<=t&&this.buffer.push(0),e&&(this.buffer[t]|=128>>>this.length%8),this.length++}};var Jb=[[17,14,11,7],[32,26,20,14],[53,42,32,24],[78,62,46,34],[106,84,60,44],[134,106,74,58],[154,122,86,64],[192,152,108,84],[230,180,130,98],[271,213,151,119],[321,251,177,137],[367,287,203,155],[425,331,241,177],[458,362,258,194],[520,412,292,220],[586,450,322,250],[644,504,364,280],[718,560,394,310],[792,624,442,338],[858,666,482,382],[929,711,509,403],[1003,779,565,439],[1091,857,611,461],[1171,911,661,511],[1273,997,715,535],[1367,1059,751,593],[1465,1125,805,625],[1528,1190,868,658],[1628,1264,908,698],[1732,1370,982,742],[1840,1452,1030,790],[1952,1538,1112,842],[2068,1628,1168,898],[2188,1722,1228,958],[2303,1809,1283,983],[2431,1911,1351,1051],[2563,1989,1423,1093],[2699,2099,1499,1139],[2809,2213,1579,1219],[2953,2331,1663,1273]];function g8(e){if(this.options={padding:4,width:256,height:256,typeNumber:4,color:"#000000",background:"#ffffff",ecl:"M",image:{svg:"",width:0,height:0}},typeof e=="string"&&(e={content:e}),e)for(var t in e)this.options[t]=e[t];if(typeof this.options.content!="string")throw new Error("Expected 'content' as string!");if(this.options.content.length===0)throw new Error("Expected 'content' to be non-empty!");if(!(this.options.padding>=0))throw new Error("Expected 'padding' value to be non-negative!");if(!(this.options.width>0)||!(this.options.height>0))throw new Error("Expected 'width' or 'height' value to be higher than zero!");function n(c){switch(c){case"L":return ks.L;case"M":return ks.M;case"Q":return ks.Q;case"H":return ks.H;default:throw new Error("Unknwon error correction level: "+c)}}function r(c,u){for(var l=i(c),d=1,f=0,h=0,m=Jb.length;h<=m;h++){var y=Jb[h];if(!y)throw new Error("Content too long: expected "+f+" but got "+l);switch(u){case"L":f=y[0];break;case"M":f=y[1];break;case"Q":f=y[2];break;case"H":f=y[3];break;default:throw new Error("Unknwon error correction level: "+u)}if(l<=f)break;d++}if(d>Jb.length)throw new Error("Content too long");return d}function i(c){var u=encodeURI(c).toString().replace(/\%[0-9a-fA-F]{2}/g,"a");return u.length+(u.length!=c?3:0)}var s=this.options.content,o=r(s,this.options.ecl),a=n(this.options.ecl);this.qrcode=new ni(o,a),this.qrcode.addData(s),this.qrcode.make()}g8.prototype.svg=function(e){var t=this.options||{},n=this.qrcode.modules;typeof e>"u"&&(e={container:t.container||"svg"});for(var r=typeof t.pretty<"u"?!!t.pretty:!0,i=r?" ":"",s=r?`\r
126
+ `:"",o=t.width,a=t.height,c=n.length,u=o/(c+2*t.padding),l=a/(c+2*t.padding),d=typeof t.join<"u"?!!t.join:!1,f=typeof t.swap<"u"?!!t.swap:!1,h=typeof t.xmlDeclaration<"u"?!!t.xmlDeclaration:!0,m=typeof t.predefined<"u"?!!t.predefined:!1,y=m?i+'<defs><path id="qrmodule" d="M0 0 h'+l+" v"+u+' H0 z" style="fill:'+t.color+';shape-rendering:crispEdges;" /></defs>'+s:"",w=i+'<rect x="0" y="0" width="'+o+'" height="'+a+'" style="fill:'+t.background+';shape-rendering:crispEdges;"/>'+s,b="",x="",v=0;v<c;v++)for(var S=0;S<c;S++){var I=n[S][v];if(I){var N=S*u+t.padding*u,j=v*l+t.padding*l;if(f){var U=N;N=j,j=U}if(d){var L=u+N,Y=l+j;N=Number.isInteger(N)?Number(N):N.toFixed(2),j=Number.isInteger(j)?Number(j):j.toFixed(2),L=Number.isInteger(L)?Number(L):L.toFixed(2),Y=Number.isInteger(Y)?Number(Y):Y.toFixed(2),x+="M"+N+","+j+" V"+Y+" H"+L+" V"+j+" H"+N+" Z "}else m?b+=i+'<use x="'+N.toString()+'" y="'+j.toString()+'" href="#qrmodule" />'+s:b+=i+'<rect x="'+N.toString()+'" y="'+j.toString()+'" width="'+u+'" height="'+l+'" style="fill:'+t.color+';shape-rendering:crispEdges;"/>'+s}}d&&(b=i+'<path x="0" y="0" style="fill:'+t.color+';shape-rendering:crispEdges;" d="'+x+'" />');let Z="";if(this.options.image!==void 0&&this.options.image.svg){const C=o*this.options.image.width/100,p=a*this.options.image.height/100,g=o/2-C/2,k=a/2-p/2;Z+=`<svg x="${g}" y="${k}" width="${C}" height="${p}" viewBox="0 0 100 100" preserveAspectRatio="xMinYMin meet">`,Z+=this.options.image.svg+s,Z+="</svg>"}var G="";switch(e.container){case"svg":h&&(G+='<?xml version="1.0" standalone="yes"?>'+s),G+='<svg xmlns="http://www.w3.org/2000/svg" version="1.1" width="'+o+'" height="'+a+'">'+s,G+=y+w+b,G+=Z,G+="</svg>";break;case"svg-viewbox":h&&(G+='<?xml version="1.0" standalone="yes"?>'+s),G+='<svg xmlns="http://www.w3.org/2000/svg" version="1.1" viewBox="0 0 '+o+" "+a+'">'+s,G+=y+w+b,G+=Z,G+="</svg>";break;case"g":G+='<g width="'+o+'" height="'+a+'">'+s,G+=y+w+b,G+=Z,G+="</g>";break;default:G+=(y+w+b+Z).replace(/^\s+/,"");break}return G};var kq=g8,Aq=Pe&&Pe.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Gh,"__esModule",{value:!0}),Gh.QRCode=void 0;const Iq=Zn,y8=Dh,Cq=Aq(kq),Pq=e=>{const[t,n]=(0,y8.useState)("");return(0,y8.useEffect)(()=>{var r,i;const s=new Cq.default({content:e.content,background:e.bgColor||"#ffffff",color:e.fgColor||"#000000",container:"svg",ecl:"M",width:(r=e.width)!==null&&r!==void 0?r:256,height:(i=e.height)!==null&&i!==void 0?i:256,padding:0,image:e.image}),o=Buffer.from(s.svg(),"utf8").toString("base64");n(`data:image/svg+xml;base64,${o}`)},[e.bgColor,e.content,e.fgColor,e.height,e.image,e.width]),t?(0,Iq.h)("img",{src:t,alt:"QR Code"}):null};Gh.QRCode=Pq;var qh={},Zb={};Object.defineProperty(Zb,"__esModule",{value:!0}),Zb.default=".-cbwsdk-css-reset .-cbwsdk-spinner{display:inline-block}.-cbwsdk-css-reset .-cbwsdk-spinner svg{display:inline-block;animation:2s linear infinite -cbwsdk-spinner-svg}.-cbwsdk-css-reset .-cbwsdk-spinner svg circle{animation:1.9s ease-in-out infinite both -cbwsdk-spinner-circle;display:block;fill:rgba(0,0,0,0);stroke-dasharray:283;stroke-dashoffset:280;stroke-linecap:round;stroke-width:10px;transform-origin:50% 50%}@keyframes -cbwsdk-spinner-svg{0%{transform:rotateZ(0deg)}100%{transform:rotateZ(360deg)}}@keyframes -cbwsdk-spinner-circle{0%,25%{stroke-dashoffset:280;transform:rotate(0)}50%,75%{stroke-dashoffset:75;transform:rotate(45deg)}100%{stroke-dashoffset:280;transform:rotate(360deg)}}";var Rq=Pe&&Pe.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(qh,"__esModule",{value:!0}),qh.Spinner=void 0;const Vh=Zn,Tq=Rq(Zb),Oq=e=>{var t;const n=(t=e.size)!==null&&t!==void 0?t:64,r=e.color||"#000";return(0,Vh.h)("div",{class:"-cbwsdk-spinner"},(0,Vh.h)("style",null,Tq.default),(0,Vh.h)("svg",{viewBox:"0 0 100 100",xmlns:"http://www.w3.org/2000/svg",style:{width:n,height:n}},(0,Vh.h)("circle",{style:{cx:50,cy:50,r:45,stroke:r}})))};qh.Spinner=Oq;var Yb={};Object.defineProperty(Yb,"__esModule",{value:!0}),Yb.default=".-cbwsdk-css-reset .-cbwsdk-connect-content{height:430px;width:700px;border-radius:12px;padding:30px}.-cbwsdk-css-reset .-cbwsdk-connect-content.light{background:#fff}.-cbwsdk-css-reset .-cbwsdk-connect-content.dark{background:#0a0b0d}.-cbwsdk-css-reset .-cbwsdk-connect-content-header{display:flex;align-items:center;justify-content:space-between;margin:0 0 30px}.-cbwsdk-css-reset .-cbwsdk-connect-content-heading{font-style:normal;font-weight:500;font-size:28px;line-height:36px;margin:0}.-cbwsdk-css-reset .-cbwsdk-connect-content-heading.light{color:#0a0b0d}.-cbwsdk-css-reset .-cbwsdk-connect-content-heading.dark{color:#fff}.-cbwsdk-css-reset .-cbwsdk-connect-content-layout{display:flex;flex-direction:row}.-cbwsdk-css-reset .-cbwsdk-connect-content-column-left{margin-right:30px;display:flex;flex-direction:column;justify-content:space-between}.-cbwsdk-css-reset .-cbwsdk-connect-content-column-right{flex:25%;margin-right:34px}.-cbwsdk-css-reset .-cbwsdk-connect-content-qr-wrapper{width:220px;height:220px;border-radius:12px;display:flex;justify-content:center;align-items:center;background:#fff}.-cbwsdk-css-reset .-cbwsdk-connect-content-qr-connecting{position:absolute;top:0;bottom:0;left:0;right:0;display:flex;flex-direction:column;align-items:center;justify-content:center}.-cbwsdk-css-reset .-cbwsdk-connect-content-qr-connecting.light{background-color:rgba(255,255,255,.95)}.-cbwsdk-css-reset .-cbwsdk-connect-content-qr-connecting.light>p{color:#0a0b0d}.-cbwsdk-css-reset .-cbwsdk-connect-content-qr-connecting.dark{background-color:rgba(10,11,13,.9)}.-cbwsdk-css-reset .-cbwsdk-connect-content-qr-connecting.dark>p{color:#fff}.-cbwsdk-css-reset .-cbwsdk-connect-content-qr-connecting>p{font-size:12px;font-weight:bold;margin-top:16px}.-cbwsdk-css-reset .-cbwsdk-connect-content-update-app{border-radius:8px;font-size:14px;line-height:20px;padding:12px;width:339px}.-cbwsdk-css-reset .-cbwsdk-connect-content-update-app.light{background:#eef0f3;color:#5b636e}.-cbwsdk-css-reset .-cbwsdk-connect-content-update-app.dark{background:#1e2025;color:#8a919e}.-cbwsdk-css-reset .-cbwsdk-cancel-button{-webkit-appearance:none;border:none;background:none;cursor:pointer;padding:0;margin:0}.-cbwsdk-css-reset .-cbwsdk-cancel-button-x{position:relative;display:block;cursor:pointer}.-cbwsdk-css-reset .-cbwsdk-wallet-steps{padding:0 0 0 16px;margin:0;width:100%;list-style:decimal}.-cbwsdk-css-reset .-cbwsdk-wallet-steps-item{list-style-type:decimal;display:list-item;font-style:normal;font-weight:400;font-size:16px;line-height:24px;margin-top:20px}.-cbwsdk-css-reset .-cbwsdk-wallet-steps-item.light{color:#0a0b0d}.-cbwsdk-css-reset .-cbwsdk-wallet-steps-item.dark{color:#fff}.-cbwsdk-css-reset .-cbwsdk-wallet-steps-item-wrapper{display:flex;align-items:center}.-cbwsdk-css-reset .-cbwsdk-wallet-steps-pad-left{margin-left:6px}.-cbwsdk-css-reset .-cbwsdk-wallet-steps-icon{display:flex;border-radius:50%;height:24px;width:24px}.-cbwsdk-css-reset .-cbwsdk-wallet-steps-icon svg{margin:auto;display:block}.-cbwsdk-css-reset .-cbwsdk-wallet-steps-icon.light{background:#0052ff}.-cbwsdk-css-reset .-cbwsdk-wallet-steps-icon.dark{background:#588af5}.-cbwsdk-css-reset .-cbwsdk-connect-item{align-items:center;display:flex;flex-direction:row;padding:16px 24px;gap:12px;cursor:pointer;border-radius:100px;font-weight:600}.-cbwsdk-css-reset .-cbwsdk-connect-item.light{background:#f5f8ff;color:#0052ff}.-cbwsdk-css-reset .-cbwsdk-connect-item.dark{background:#001033;color:#588af5}.-cbwsdk-css-reset .-cbwsdk-connect-item-copy-wrapper{margin:0 4px 0 8px}.-cbwsdk-css-reset .-cbwsdk-connect-item-title{margin:0 0 0;font-size:16px;line-height:24px;font-weight:500}.-cbwsdk-css-reset .-cbwsdk-connect-item-description{font-weight:400;font-size:14px;line-height:20px;margin:0}";var b8=Pe&&Pe.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(lc,"__esModule",{value:!0}),lc.CoinbaseWalletSteps=lc.ConnectContent=void 0;const xo=b8(kl),rt=Zn,Mq=Ie,Bq=Ka,Nq=Uh,Lq=Hh,jq=Wh,$q=Gh,Fq=qh,Dq=b8(Yb),Qb={title:"Coinbase Wallet app",description:"Connect with your self-custody wallet",steps:w8},Uq=e=>e==="light"?"#FFFFFF":"#0A0B0D";function Hq(e){const{theme:t}=e,n=(0,Mq.createQrUrl)(e.sessionId,e.sessionSecret,e.linkAPIUrl,e.isParentConnection,e.version,e.chainId),r=Qb.steps;return(0,rt.h)("div",{"data-testid":"connect-content",className:(0,xo.default)("-cbwsdk-connect-content",t)},(0,rt.h)("style",null,Dq.default),(0,rt.h)("div",{className:"-cbwsdk-connect-content-header"},(0,rt.h)("h2",{className:(0,xo.default)("-cbwsdk-connect-content-heading",t)},"Scan to connect with our mobile app"),e.onCancel&&(0,rt.h)("button",{type:"button",className:"-cbwsdk-cancel-button",onClick:e.onCancel},(0,rt.h)(Nq.CloseIcon,{fill:t==="light"?"#0A0B0D":"#FFFFFF"}))),(0,rt.h)("div",{className:"-cbwsdk-connect-content-layout"},(0,rt.h)("div",{className:"-cbwsdk-connect-content-column-left"},(0,rt.h)(zq,{title:Qb.title,description:Qb.description,theme:t})),(0,rt.h)("div",{className:"-cbwsdk-connect-content-column-right"},(0,rt.h)("div",{className:"-cbwsdk-connect-content-qr-wrapper"},(0,rt.h)($q.QRCode,{content:n,width:200,height:200,fgColor:"#000",bgColor:"transparent"}),(0,rt.h)("input",{type:"hidden",name:"cbw-cbwsdk-version",value:Bq.LIB_VERSION}),(0,rt.h)("input",{type:"hidden",value:n})),(0,rt.h)(r,{theme:t}),!e.isConnected&&(0,rt.h)("div",{"data-testid":"connecting-spinner",className:(0,xo.default)("-cbwsdk-connect-content-qr-connecting",t)},(0,rt.h)(Fq.Spinner,{size:36,color:t==="dark"?"#FFF":"#000"}),(0,rt.h)("p",null,"Connecting...")))))}lc.ConnectContent=Hq;function zq({title:e,description:t,theme:n}){return(0,rt.h)("div",{className:(0,xo.default)("-cbwsdk-connect-item",n)},(0,rt.h)("div",null,(0,rt.h)(Lq.CoinbaseWalletRound,null)),(0,rt.h)("div",{className:"-cbwsdk-connect-item-copy-wrapper"},(0,rt.h)("h3",{className:"-cbwsdk-connect-item-title"},e),(0,rt.h)("p",{className:"-cbwsdk-connect-item-description"},t)))}function w8({theme:e}){return(0,rt.h)("ol",{className:"-cbwsdk-wallet-steps"},(0,rt.h)("li",{className:(0,xo.default)("-cbwsdk-wallet-steps-item",e)},(0,rt.h)("div",{className:"-cbwsdk-wallet-steps-item-wrapper"},"Open Coinbase Wallet app")),(0,rt.h)("li",{className:(0,xo.default)("-cbwsdk-wallet-steps-item",e)},(0,rt.h)("div",{className:"-cbwsdk-wallet-steps-item-wrapper"},(0,rt.h)("span",null,"Tap ",(0,rt.h)("strong",null,"Scan")," "),(0,rt.h)("span",{className:(0,xo.default)("-cbwsdk-wallet-steps-pad-left","-cbwsdk-wallet-steps-icon",e)},(0,rt.h)(jq.QRCodeIcon,{fill:Uq(e)})))))}lc.CoinbaseWalletSteps=w8;var Kh={},Jh={};Object.defineProperty(Jh,"__esModule",{value:!0}),Jh.ArrowLeftIcon=void 0;const v8=Zn;function Wq(e){return(0,v8.h)("svg",Object.assign({width:"16",height:"16",viewBox:"0 0 16 16",xmlns:"http://www.w3.org/2000/svg"},e),(0,v8.h)("path",{d:"M8.60675 0.155884L7.37816 1.28209L12.7723 7.16662H0V8.83328H12.6548L6.82149 14.6666L8 15.8451L15.8201 8.02501L8.60675 0.155884Z"}))}Jh.ArrowLeftIcon=Wq;var Zh={};Object.defineProperty(Zh,"__esModule",{value:!0}),Zh.LaptopIcon=void 0;const Xb=Zn;function Gq(e){return(0,Xb.h)("svg",Object.assign({width:"14",height:"14",viewBox:"0 0 14 14",xmlns:"http://www.w3.org/2000/svg"},e),(0,Xb.h)("path",{d:"M1.8001 2.2002H12.2001V9.40019H1.8001V2.2002ZM3.4001 3.8002V7.80019H10.6001V3.8002H3.4001Z"}),(0,Xb.h)("path",{d:"M13.4001 10.2002H0.600098C0.600098 11.0838 1.31644 11.8002 2.2001 11.8002H11.8001C12.6838 11.8002 13.4001 11.0838 13.4001 10.2002Z"}))}Zh.LaptopIcon=Gq;var Yh={};Object.defineProperty(Yh,"__esModule",{value:!0}),Yh.SafeIcon=void 0;const _8=Zn;function qq(e){return(0,_8.h)("svg",Object.assign({width:"14",height:"14",viewBox:"0 0 14 14",xmlns:"http://www.w3.org/2000/svg"},e),(0,_8.h)("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M0.600098 0.600098V11.8001H13.4001V0.600098H0.600098ZM7.0001 9.2001C5.3441 9.2001 4.0001 7.8561 4.0001 6.2001C4.0001 4.5441 5.3441 3.2001 7.0001 3.2001C8.6561 3.2001 10.0001 4.5441 10.0001 6.2001C10.0001 7.8561 8.6561 9.2001 7.0001 9.2001ZM0.600098 12.6001H3.8001V13.4001H0.600098V12.6001ZM10.2001 12.6001H13.4001V13.4001H10.2001V12.6001ZM8.8001 6.2001C8.8001 7.19421 7.99421 8.0001 7.0001 8.0001C6.00598 8.0001 5.2001 7.19421 5.2001 6.2001C5.2001 5.20598 6.00598 4.4001 7.0001 4.4001C7.99421 4.4001 8.8001 5.20598 8.8001 6.2001Z"}))}Yh.SafeIcon=qq;var e1={};Object.defineProperty(e1,"__esModule",{value:!0}),e1.default=".-cbwsdk-css-reset .-cbwsdk-try-extension{display:flex;margin-top:12px;height:202px;width:700px;border-radius:12px;padding:30px}.-cbwsdk-css-reset .-cbwsdk-try-extension.light{background:#fff}.-cbwsdk-css-reset .-cbwsdk-try-extension.dark{background:#0a0b0d}.-cbwsdk-css-reset .-cbwsdk-try-extension-column-half{flex:50%}.-cbwsdk-css-reset .-cbwsdk-try-extension-heading{font-style:normal;font-weight:500;font-size:25px;line-height:32px;margin:0;max-width:204px}.-cbwsdk-css-reset .-cbwsdk-try-extension-heading.light{color:#0a0b0d}.-cbwsdk-css-reset .-cbwsdk-try-extension-heading.dark{color:#fff}.-cbwsdk-css-reset .-cbwsdk-try-extension-cta{appearance:none;border:none;background:none;color:#0052ff;cursor:pointer;padding:0;text-decoration:none;display:block;font-weight:600;font-size:16px;line-height:24px}.-cbwsdk-css-reset .-cbwsdk-try-extension-cta.light{color:#0052ff}.-cbwsdk-css-reset .-cbwsdk-try-extension-cta.dark{color:#588af5}.-cbwsdk-css-reset .-cbwsdk-try-extension-cta-wrapper{display:flex;align-items:center;margin-top:12px}.-cbwsdk-css-reset .-cbwsdk-try-extension-cta-icon{display:block;margin-left:4px;height:14px}.-cbwsdk-css-reset .-cbwsdk-try-extension-list{display:flex;flex-direction:column;justify-content:center;align-items:center;margin:0;padding:0;list-style:none;height:100%}.-cbwsdk-css-reset .-cbwsdk-try-extension-list-item{display:flex;align-items:center;flex-flow:nowrap;margin-top:24px}.-cbwsdk-css-reset .-cbwsdk-try-extension-list-item:first-of-type{margin-top:0}.-cbwsdk-css-reset .-cbwsdk-try-extension-list-item-icon-wrapper{display:block}.-cbwsdk-css-reset .-cbwsdk-try-extension-list-item-icon{display:flex;height:32px;width:32px;border-radius:50%}.-cbwsdk-css-reset .-cbwsdk-try-extension-list-item-icon svg{margin:auto;display:block}.-cbwsdk-css-reset .-cbwsdk-try-extension-list-item-icon.light{background:#eef0f3}.-cbwsdk-css-reset .-cbwsdk-try-extension-list-item-icon.dark{background:#1e2025}.-cbwsdk-css-reset .-cbwsdk-try-extension-list-item-copy{display:block;font-weight:400;font-size:14px;line-height:20px;padding-left:12px}.-cbwsdk-css-reset .-cbwsdk-try-extension-list-item-copy.light{color:#5b636e}.-cbwsdk-css-reset .-cbwsdk-try-extension-list-item-copy.dark{color:#8a919e}";var E8=Pe&&Pe.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Kh,"__esModule",{value:!0}),Kh.TryExtensionContent=void 0;const So=E8(kl),Qt=Zn,t1=Dh,Vq=Jh,Kq=Zh,Jq=Yh,Zq=E8(e1);function Yq({theme:e}){const[t,n]=(0,t1.useState)(!1),r=(0,t1.useCallback)(()=>{window.open("https://api.wallet.coinbase.com/rpc/v2/desktop/chrome","_blank")},[]),i=(0,t1.useCallback)(()=>{t?window.location.reload():(r(),n(!0))},[r,t]);return(0,Qt.h)("div",{class:(0,So.default)("-cbwsdk-try-extension",e)},(0,Qt.h)("style",null,Zq.default),(0,Qt.h)("div",{class:"-cbwsdk-try-extension-column-half"},(0,Qt.h)("h3",{class:(0,So.default)("-cbwsdk-try-extension-heading",e)},"Or try the Coinbase Wallet browser extension"),(0,Qt.h)("div",{class:"-cbwsdk-try-extension-cta-wrapper"},(0,Qt.h)("button",{class:(0,So.default)("-cbwsdk-try-extension-cta",e),onClick:i},t?"Refresh":"Install"),(0,Qt.h)("div",null,!t&&(0,Qt.h)(Vq.ArrowLeftIcon,{class:"-cbwsdk-try-extension-cta-icon",fill:e==="light"?"#0052FF":"#588AF5"})))),(0,Qt.h)("div",{class:"-cbwsdk-try-extension-column-half"},(0,Qt.h)("ul",{class:"-cbwsdk-try-extension-list"},(0,Qt.h)("li",{class:"-cbwsdk-try-extension-list-item"},(0,Qt.h)("div",{class:"-cbwsdk-try-extension-list-item-icon-wrapper"},(0,Qt.h)("span",{class:(0,So.default)("-cbwsdk-try-extension-list-item-icon",e)},(0,Qt.h)(Kq.LaptopIcon,{fill:e==="light"?"#0A0B0D":"#FFFFFF"}))),(0,Qt.h)("div",{class:(0,So.default)("-cbwsdk-try-extension-list-item-copy",e)},"Connect with dapps with just one click on your desktop browser")),(0,Qt.h)("li",{class:"-cbwsdk-try-extension-list-item"},(0,Qt.h)("div",{class:"-cbwsdk-try-extension-list-item-icon-wrapper"},(0,Qt.h)("span",{class:(0,So.default)("-cbwsdk-try-extension-list-item-icon",e)},(0,Qt.h)(Jq.SafeIcon,{fill:e==="light"?"#0A0B0D":"#FFFFFF"}))),(0,Qt.h)("div",{class:(0,So.default)("-cbwsdk-try-extension-list-item-copy",e)},"Add an additional layer of security by using a supported Ledger hardware wallet")))))}Kh.TryExtensionContent=Yq;var n1={};Object.defineProperty(n1,"__esModule",{value:!0}),n1.default=".-cbwsdk-css-reset .-cbwsdk-connect-dialog{z-index:2147483647;position:fixed;top:0;left:0;right:0;bottom:0;display:flex;align-items:center;justify-content:center}.-cbwsdk-css-reset .-cbwsdk-connect-dialog-backdrop{z-index:2147483647;position:fixed;top:0;left:0;right:0;bottom:0;transition:opacity .25s}.-cbwsdk-css-reset .-cbwsdk-connect-dialog-backdrop.light{background-color:rgba(0,0,0,.5)}.-cbwsdk-css-reset .-cbwsdk-connect-dialog-backdrop.dark{background-color:rgba(50,53,61,.4)}.-cbwsdk-css-reset .-cbwsdk-connect-dialog-backdrop-hidden{opacity:0}.-cbwsdk-css-reset .-cbwsdk-connect-dialog-box{display:flex;position:relative;flex-direction:column;transform:scale(1);transition:opacity .25s,transform .25s}.-cbwsdk-css-reset .-cbwsdk-connect-dialog-box-hidden{opacity:0;transform:scale(0.85)}.-cbwsdk-css-reset .-cbwsdk-connect-dialog-container{display:block}.-cbwsdk-css-reset .-cbwsdk-connect-dialog-container-hidden{display:none}";var x8=Pe&&Pe.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty($h,"__esModule",{value:!0}),$h.ConnectDialog=void 0;const r1=x8(kl),ko=Zn,i1=Dh,Qq=lc,Xq=Kh,eV=x8(n1),tV=e=>{const{isOpen:t,darkMode:n}=e,[r,i]=(0,i1.useState)(!t),[s,o]=(0,i1.useState)(!t);(0,i1.useEffect)(()=>{const c=[window.setTimeout(()=>{o(!t)},10)];return t?i(!1):c.push(window.setTimeout(()=>{i(!0)},360)),()=>{c.forEach(window.clearTimeout)}},[t]);const a=n?"dark":"light";return(0,ko.h)("div",{class:(0,r1.default)("-cbwsdk-connect-dialog-container",r&&"-cbwsdk-connect-dialog-container-hidden")},(0,ko.h)("style",null,eV.default),(0,ko.h)("div",{class:(0,r1.default)("-cbwsdk-connect-dialog-backdrop",a,s&&"-cbwsdk-connect-dialog-backdrop-hidden")}),(0,ko.h)("div",{class:"-cbwsdk-connect-dialog"},(0,ko.h)("div",{class:(0,r1.default)("-cbwsdk-connect-dialog-box",s&&"-cbwsdk-connect-dialog-box-hidden")},e.connectDisabled?null:(0,ko.h)(Qq.ConnectContent,{theme:a,version:e.version,sessionId:e.sessionId,sessionSecret:e.sessionSecret,linkAPIUrl:e.linkAPIUrl,isConnected:e.isConnected,isParentConnection:e.isParentConnection,chainId:e.chainId,onCancel:e.onCancel}),(0,ko.h)(Xq.TryExtensionContent,{theme:a}))))};$h.ConnectDialog=tV,Object.defineProperty(Oh,"__esModule",{value:!0}),Oh.LinkFlow=void 0;const s1=Zn,nV=$h;class rV{constructor(t){this.connected=!1,this.chainId=1,this.isOpen=!1,this.onCancel=null,this.root=null,this.connectDisabled=!1,this.darkMode=t.darkMode,this.version=t.version,this.sessionId=t.sessionId,this.sessionSecret=t.sessionSecret,this.linkAPIUrl=t.linkAPIUrl,this.isParentConnection=t.isParentConnection}attach(t){this.root=document.createElement("div"),this.root.className="-cbwsdk-link-flow-root",t.appendChild(this.root),this.render()}setConnected(t){this.connected!==t&&(this.connected=t,this.render())}setChainId(t){this.chainId!==t&&(this.chainId=t,this.render())}detach(){var t;this.root&&((0,s1.render)(null,this.root),(t=this.root.parentElement)===null||t===void 0||t.removeChild(this.root))}setConnectDisabled(t){this.connectDisabled=t}open(t){this.isOpen=!0,this.onCancel=t.onCancel,this.render()}close(){this.isOpen=!1,this.onCancel=null,this.render()}render(){this.root&&(0,s1.render)((0,s1.h)(nV.ConnectDialog,{darkMode:this.darkMode,version:this.version,sessionId:this.sessionId,sessionSecret:this.sessionSecret,linkAPIUrl:this.linkAPIUrl,isOpen:this.isOpen,isConnected:this.connected,isParentConnection:this.isParentConnection,chainId:this.chainId,onCancel:this.onCancel,connectDisabled:this.connectDisabled}),this.root)}}Oh.LinkFlow=rV;var o1={},a1={};Object.defineProperty(a1,"__esModule",{value:!0}),a1.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(e){var t=Pe&&Pe.__importDefault||function(d){return d&&d.__esModule?d:{default:d}};Object.defineProperty(e,"__esModule",{value:!0}),e.SnackbarInstance=e.SnackbarContainer=e.Snackbar=void 0;const n=t(kl),r=Zn,i=Dh,s=t(a1),o="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMzIiIGhlaWdodD0iMzIiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PHBhdGggZD0iTTEuNDkyIDEwLjQxOWE4LjkzIDguOTMgMCAwMTguOTMtOC45M2gxMS4xNjNhOC45MyA4LjkzIDAgMDE4LjkzIDguOTN2MTEuMTYzYTguOTMgOC45MyAwIDAxLTguOTMgOC45M0gxMC40MjJhOC45MyA4LjkzIDAgMDEtOC45My04LjkzVjEwLjQxOXoiIGZpbGw9IiMxNjUyRjAiLz48cGF0aCBmaWxsLXJ1bGU9ImV2ZW5vZGQiIGNsaXAtcnVsZT0iZXZlbm9kZCIgZD0iTTEwLjQxOSAwSDIxLjU4QzI3LjMzNSAwIDMyIDQuNjY1IDMyIDEwLjQxOVYyMS41OEMzMiAyNy4zMzUgMjcuMzM1IDMyIDIxLjU4MSAzMkgxMC40MkM0LjY2NSAzMiAwIDI3LjMzNSAwIDIxLjU4MVYxMC40MkMwIDQuNjY1IDQuNjY1IDAgMTAuNDE5IDB6bTAgMS40ODhhOC45MyA4LjkzIDAgMDAtOC45MyA4LjkzdjExLjE2M2E4LjkzIDguOTMgMCAwMDguOTMgOC45M0gyMS41OGE4LjkzIDguOTMgMCAwMDguOTMtOC45M1YxMC40MmE4LjkzIDguOTMgMCAwMC04LjkzLTguOTNIMTAuNDJ6IiBmaWxsPSIjZmZmIi8+PHBhdGggZmlsbC1ydWxlPSJldmVub2RkIiBjbGlwLXJ1bGU9ImV2ZW5vZGQiIGQ9Ik0xNS45OTggMjYuMDQ5Yy01LjU0OSAwLTEwLjA0Ny00LjQ5OC0xMC4wNDctMTAuMDQ3IDAtNS41NDggNC40OTgtMTAuMDQ2IDEwLjA0Ny0xMC4wNDYgNS41NDggMCAxMC4wNDYgNC40OTggMTAuMDQ2IDEwLjA0NiAwIDUuNTQ5LTQuNDk4IDEwLjA0Ny0xMC4wNDYgMTAuMDQ3eiIgZmlsbD0iI2ZmZiIvPjxwYXRoIGQ9Ik0xMi43NjIgMTQuMjU0YzAtLjgyMi42NjctMS40ODkgMS40ODktMS40ODloMy40OTdjLjgyMiAwIDEuNDg4LjY2NiAxLjQ4OCAxLjQ4OXYzLjQ5N2MwIC44MjItLjY2NiAxLjQ4OC0xLjQ4OCAxLjQ4OGgtMy40OTdhMS40ODggMS40ODggMCAwMS0xLjQ4OS0xLjQ4OHYtMy40OTh6IiBmaWxsPSIjMTY1MkYwIi8+PC9zdmc+",a="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTIiIGhlaWdodD0iMTIiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PHBhdGggZD0iTTEyIDYuNzV2LTEuNWwtMS43Mi0uNTdjLS4wOC0uMjctLjE5LS41Mi0uMzItLjc3bC44MS0xLjYyLTEuMDYtMS4wNi0xLjYyLjgxYy0uMjQtLjEzLS41LS4yNC0uNzctLjMyTDYuNzUgMGgtMS41bC0uNTcgMS43MmMtLjI3LjA4LS41My4xOS0uNzcuMzJsLTEuNjItLjgxLTEuMDYgMS4wNi44MSAxLjYyYy0uMTMuMjQtLjI0LjUtLjMyLjc3TDAgNS4yNXYxLjVsMS43Mi41N2MuMDguMjcuMTkuNTMuMzIuNzdsLS44MSAxLjYyIDEuMDYgMS4wNiAxLjYyLS44MWMuMjQuMTMuNS4yMy43Ny4zMkw1LjI1IDEyaDEuNWwuNTctMS43MmMuMjctLjA4LjUyLS4xOS43Ny0uMzJsMS42Mi44MSAxLjA2LTEuMDYtLjgxLTEuNjJjLjEzLS4yNC4yMy0uNS4zMi0uNzdMMTIgNi43NXpNNiA4LjVhMi41IDIuNSAwIDAxMC01IDIuNSAyLjUgMCAwMTAgNXoiIGZpbGw9IiMwNTBGMTkiLz48L3N2Zz4=";class c{constructor(f){this.items=new Map,this.nextItemKey=0,this.root=null,this.darkMode=f.darkMode}attach(f){this.root=document.createElement("div"),this.root.className="-cbwsdk-snackbar-root",f.appendChild(this.root),this.render()}presentItem(f){const h=this.nextItemKey++;return this.items.set(h,f),this.render(),()=>{this.items.delete(h),this.render()}}clear(){this.items.clear(),this.render()}render(){this.root&&(0,r.render)((0,r.h)("div",null,(0,r.h)(e.SnackbarContainer,{darkMode:this.darkMode},Array.from(this.items.entries()).map(([f,h])=>(0,r.h)(e.SnackbarInstance,Object.assign({},h,{key:f}))))),this.root)}}e.Snackbar=c;const u=d=>(0,r.h)("div",{class:(0,n.default)("-cbwsdk-snackbar-container")},(0,r.h)("style",null,s.default),(0,r.h)("div",{class:"-cbwsdk-snackbar"},d.children));e.SnackbarContainer=u;const l=({autoExpand:d,message:f,menuItems:h})=>{const[m,y]=(0,i.useState)(!0),[w,b]=(0,i.useState)(d??!1);(0,i.useEffect)(()=>{const v=[window.setTimeout(()=>{y(!1)},1),window.setTimeout(()=>{b(!0)},1e4)];return()=>{v.forEach(window.clearTimeout)}});const x=()=>{b(!w)};return(0,r.h)("div",{class:(0,n.default)("-cbwsdk-snackbar-instance",m&&"-cbwsdk-snackbar-instance-hidden",w&&"-cbwsdk-snackbar-instance-expanded")},(0,r.h)("div",{class:"-cbwsdk-snackbar-instance-header",onClick:x},(0,r.h)("img",{src:o,class:"-cbwsdk-snackbar-instance-header-cblogo"})," ",(0,r.h)("div",{class:"-cbwsdk-snackbar-instance-header-message"},f),(0,r.h)("div",{class:"-gear-container"},!w&&(0,r.h)("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},(0,r.h)("circle",{cx:"12",cy:"12",r:"12",fill:"#F5F7F8"})),(0,r.h)("img",{src:a,class:"-gear-icon",title:"Expand"}))),h&&h.length>0&&(0,r.h)("div",{class:"-cbwsdk-snackbar-instance-menu"},h.map((v,S)=>(0,r.h)("div",{class:(0,n.default)("-cbwsdk-snackbar-instance-menu-item",v.isRed&&"-cbwsdk-snackbar-instance-menu-item-is-red"),onClick:v.onClick,key:S},(0,r.h)("svg",{width:v.svgWidth,height:v.svgHeight,viewBox:"0 0 10 11",fill:"none",xmlns:"http://www.w3.org/2000/svg"},(0,r.h)("path",{"fill-rule":v.defaultFillRule,"clip-rule":v.defaultClipRule,d:v.path,fill:"#AAAAAA"})),(0,r.h)("span",{class:(0,n.default)("-cbwsdk-snackbar-instance-menu-item-info",v.isRed&&"-cbwsdk-snackbar-instance-menu-item-info-is-red")},v.info)))))};e.SnackbarInstance=l}(o1),Object.defineProperty(yl,"__esModule",{value:!0}),yl.WalletLinkRelayUI=void 0;const iV=bl,sV=Oh,oV=o1;class aV{constructor(t){this.standalone=null,this.attached=!1,this.snackbar=new oV.Snackbar({darkMode:t.darkMode}),this.linkFlow=new sV.LinkFlow({darkMode:t.darkMode,version:t.version,sessionId:t.session.id,sessionSecret:t.session.secret,linkAPIUrl:t.linkAPIUrl,isParentConnection:!1})}attach(){if(this.attached)throw new Error("Coinbase Wallet SDK UI is already attached");const t=document.documentElement,n=document.createElement("div");n.className="-cbwsdk-css-reset",t.appendChild(n),this.linkFlow.attach(n),this.snackbar.attach(n),this.attached=!0,(0,iV.injectCssReset)()}setConnected(t){this.linkFlow.setConnected(t)}setChainId(t){this.linkFlow.setChainId(t)}setConnectDisabled(t){this.linkFlow.setConnectDisabled(t)}addEthereumChain(){}watchAsset(){}switchEthereumChain(){}requestEthereumAccounts(t){this.linkFlow.open({onCancel:t.onCancel})}hideRequestEthereumAccounts(){this.linkFlow.close()}signEthereumMessage(){}signEthereumTransaction(){}submitEthereumTransaction(){}ethereumAddressFromSignedMessage(){}showConnecting(t){let n;return t.isUnlinkedErrorState?n={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:t.onResetConnection}]}:n={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:t.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:t.onResetConnection}]},this.snackbar.presentItem(n)}reloadUI(){document.location.reload()}inlineAccountsResponse(){return!1}inlineAddEthereumChain(){return!1}inlineWatchAsset(){return!1}inlineSwitchEthereumChain(){return!1}setStandalone(t){this.standalone=t}isStandalone(){var t;return(t=this.standalone)!==null&&t!==void 0?t:!1}}yl.WalletLinkRelayUI=aV,Object.defineProperty(sl,"__esModule",{value:!0}),sl.WalletLinkRelay=void 0;const fc=el,cV=sn,Bt=Ie,Ao=Za,S8=br,Is=Ya,uV=Ih,Io=Va,lV=yl;class Di extends S8.RelayAbstract{constructor(t){var n;super(),this.accountsCallback=null,this.chainCallbackParams={chainId:"",jsonRpcUrl:""},this.chainCallback=null,this.dappDefaultChain=1,this.appName="",this.appLogoUrl=null,this.linkedUpdated=o=>{var a;this.isLinked=o;const c=this.storage.getItem(S8.LOCAL_STORAGE_ADDRESSES_KEY);if(o&&(this.session.linked=o),this.isUnlinkedErrorState=!1,c){const u=c.split(" "),l=this.storage.getItem("IsStandaloneSigning")==="true";if(u[0]!==""&&!o&&this.session.linked&&!l){this.isUnlinkedErrorState=!0;const d=this.getSessionIdHash();(a=this.diagnostic)===null||a===void 0||a.log(Ao.EVENTS.UNLINKED_ERROR_STATE,{sessionIdHash:d})}}},this.metadataUpdated=(o,a)=>{this.storage.setItem(o,a)},this.chainUpdated=(o,a)=>{this.chainCallbackParams.chainId===o&&this.chainCallbackParams.jsonRpcUrl===a||(this.chainCallbackParams={chainId:o,jsonRpcUrl:a},this.chainCallback&&this.chainCallback(o,a))},this.accountUpdated=o=>{this.accountsCallback&&this.accountsCallback([o]),Di.accountRequestCallbackIds.size>0&&(Array.from(Di.accountRequestCallbackIds.values()).forEach(a=>{const c={type:"WEB3_RESPONSE",id:a,response:{method:"requestEthereumAccounts",result:[o]}};this.invokeCallback(Object.assign(Object.assign({},c),{id:a}))}),Di.accountRequestCallbackIds.clear())},this.connectedUpdated=o=>{this.ui.setConnected(o)},this.resetAndReload=this.resetAndReload.bind(this),this.linkAPIUrl=t.linkAPIUrl,this.storage=t.storage,this.options=t;const{session:r,ui:i,connection:s}=this.subscribe();this._session=r,this.connection=s,this.relayEventManager=t.relayEventManager,this.diagnostic=t.diagnosticLogger,this._reloadOnDisconnect=(n=t.reloadOnDisconnect)!==null&&n!==void 0?n:!0,this.ui=i}subscribe(){const t=Is.Session.load(this.storage)||new Is.Session(this.storage).save(),{linkAPIUrl:n,diagnostic:r}=this,i=new uV.WalletLinkConnection({session:t,linkAPIUrl:n,diagnostic:r,listener:this}),{version:s,darkMode:o}=this.options,a=this.options.uiConstructor({linkAPIUrl:n,version:s,darkMode:o,session:t});return i.connect(),{session:t,ui:a,connection:i}}attachUI(){this.ui.attach()}resetAndReload(){Promise.race([this.connection.setSessionMetadata("__destroyed","1"),new Promise(t=>setTimeout(()=>t(null),1e3))]).then(()=>{var t,n;const r=this.ui.isStandalone();(t=this.diagnostic)===null||t===void 0||t.log(Ao.EVENTS.SESSION_STATE_CHANGE,{method:"relay::resetAndReload",sessionMetadataChange:"__destroyed, 1",sessionIdHash:this.getSessionIdHash()}),this.connection.destroy();const i=Is.Session.load(this.storage);if((i==null?void 0:i.id)===this._session.id?this.storage.clear():i&&((n=this.diagnostic)===null||n===void 0||n.log(Ao.EVENTS.SKIPPED_CLEARING_SESSION,{sessionIdHash:this.getSessionIdHash(),storedSessionIdHash:Is.Session.hash(i.id)})),this._reloadOnDisconnect){this.ui.reloadUI();return}this.accountsCallback&&this.accountsCallback([],!0);const{session:s,ui:o,connection:a}=this.subscribe();this._session=s,this.connection=a,this.ui=o,r&&this.ui.setStandalone&&this.ui.setStandalone(!0),this.options.headlessMode||this.attachUI()}).catch(t=>{var n;(n=this.diagnostic)===null||n===void 0||n.log(Ao.EVENTS.FAILURE,{method:"relay::resetAndReload",message:`failed to reset and reload with ${t}`,sessionIdHash:this.getSessionIdHash()})})}setAppInfo(t,n){this.appName=t,this.appLogoUrl=n}getStorageItem(t){return this.storage.getItem(t)}get session(){return this._session}setStorageItem(t,n){this.storage.setItem(t,n)}signEthereumMessage(t,n,r,i){return this.sendRequest({method:"signEthereumMessage",params:{message:(0,Bt.hexStringFromBuffer)(t,!0),address:n,addPrefix:r,typedDataJson:i||null}})}ethereumAddressFromSignedMessage(t,n,r){return this.sendRequest({method:"ethereumAddressFromSignedMessage",params:{message:(0,Bt.hexStringFromBuffer)(t,!0),signature:(0,Bt.hexStringFromBuffer)(n,!0),addPrefix:r}})}signEthereumTransaction(t){return this.sendRequest({method:"signEthereumTransaction",params:{fromAddress:t.fromAddress,toAddress:t.toAddress,weiValue:(0,Bt.bigIntStringFromBN)(t.weiValue),data:(0,Bt.hexStringFromBuffer)(t.data,!0),nonce:t.nonce,gasPriceInWei:t.gasPriceInWei?(0,Bt.bigIntStringFromBN)(t.gasPriceInWei):null,maxFeePerGas:t.gasPriceInWei?(0,Bt.bigIntStringFromBN)(t.gasPriceInWei):null,maxPriorityFeePerGas:t.gasPriceInWei?(0,Bt.bigIntStringFromBN)(t.gasPriceInWei):null,gasLimit:t.gasLimit?(0,Bt.bigIntStringFromBN)(t.gasLimit):null,chainId:t.chainId,shouldSubmit:!1}})}signAndSubmitEthereumTransaction(t){return this.sendRequest({method:"signEthereumTransaction",params:{fromAddress:t.fromAddress,toAddress:t.toAddress,weiValue:(0,Bt.bigIntStringFromBN)(t.weiValue),data:(0,Bt.hexStringFromBuffer)(t.data,!0),nonce:t.nonce,gasPriceInWei:t.gasPriceInWei?(0,Bt.bigIntStringFromBN)(t.gasPriceInWei):null,maxFeePerGas:t.maxFeePerGas?(0,Bt.bigIntStringFromBN)(t.maxFeePerGas):null,maxPriorityFeePerGas:t.maxPriorityFeePerGas?(0,Bt.bigIntStringFromBN)(t.maxPriorityFeePerGas):null,gasLimit:t.gasLimit?(0,Bt.bigIntStringFromBN)(t.gasLimit):null,chainId:t.chainId,shouldSubmit:!0}})}submitEthereumTransaction(t,n){return this.sendRequest({method:"submitEthereumTransaction",params:{signedTransaction:(0,Bt.hexStringFromBuffer)(t,!0),chainId:n}})}scanQRCode(t){return this.sendRequest({method:"scanQRCode",params:{regExp:t}})}getQRCodeUrl(){return(0,Bt.createQrUrl)(this._session.id,this._session.secret,this.linkAPIUrl,!1,this.options.version,this.dappDefaultChain)}genericRequest(t,n){return this.sendRequest({method:"generic",params:{action:n,data:t}})}sendGenericMessage(t){return this.sendRequest(t)}sendRequest(t){let n=null;const r=(0,Bt.randomBytesHex)(8),i=o=>{this.publishWeb3RequestCanceledEvent(r),this.handleErrorResponse(r,t.method,o),n==null||n()};return{promise:new Promise((o,a)=>{this.ui.isStandalone()||(n=this.ui.showConnecting({isUnlinkedErrorState:this.isUnlinkedErrorState,onCancel:i,onResetConnection:this.resetAndReload})),this.relayEventManager.callbacks.set(r,c=>{if(n==null||n(),(0,Io.isErrorResponse)(c))return a(new Error(c.errorMessage));o(c)}),this.ui.isStandalone()?this.sendRequestStandalone(r,t):this.publishWeb3RequestEvent(r,t)}),cancel:i}}setConnectDisabled(t){this.ui.setConnectDisabled(t)}setAccountsCallback(t){this.accountsCallback=t}setChainCallback(t){this.chainCallback=t}setDappDefaultChainCallback(t){this.dappDefaultChain=t,this.ui instanceof lV.WalletLinkRelayUI&&this.ui.setChainId(t)}publishWeb3RequestEvent(t,n){var r;const i={type:"WEB3_REQUEST",id:t,request:n},s=Is.Session.load(this.storage);(r=this.diagnostic)===null||r===void 0||r.log(Ao.EVENTS.WEB3_REQUEST,{eventId:i.id,method:`relay::${n.method}`,sessionIdHash:this.getSessionIdHash(),storedSessionIdHash:s?Is.Session.hash(s.id):"",isSessionMismatched:((s==null?void 0:s.id)!==this._session.id).toString()}),this.publishEvent("Web3Request",i,!0).then(o=>{var a;(a=this.diagnostic)===null||a===void 0||a.log(Ao.EVENTS.WEB3_REQUEST_PUBLISHED,{eventId:i.id,method:`relay::${n.method}`,sessionIdHash:this.getSessionIdHash(),storedSessionIdHash:s?Is.Session.hash(s.id):"",isSessionMismatched:((s==null?void 0:s.id)!==this._session.id).toString()})}).catch(o=>{this.handleWeb3ResponseMessage({type:"WEB3_RESPONSE",id:i.id,response:{method:n.method,errorMessage:o.message}})})}publishWeb3RequestCanceledEvent(t){const n={type:"WEB3_REQUEST_CANCELED",id:t};this.publishEvent("Web3RequestCanceled",n,!1).then()}publishEvent(t,n,r){return this.connection.publishEvent(t,n,r)}handleWeb3ResponseMessage(t){var n;const{response:r}=t;if((n=this.diagnostic)===null||n===void 0||n.log(Ao.EVENTS.WEB3_RESPONSE,{eventId:t.id,method:`relay::${r.method}`,sessionIdHash:this.getSessionIdHash()}),r.method==="requestEthereumAccounts"){Di.accountRequestCallbackIds.forEach(i=>this.invokeCallback(Object.assign(Object.assign({},t),{id:i}))),Di.accountRequestCallbackIds.clear();return}this.invokeCallback(t)}handleErrorResponse(t,n,r,i){var s;const o=(s=r==null?void 0:r.message)!==null&&s!==void 0?s:(0,fc.getMessageFromCode)(i);this.handleWeb3ResponseMessage({type:"WEB3_RESPONSE",id:t,response:{method:n,errorMessage:o,errorCode:i}})}invokeCallback(t){const n=this.relayEventManager.callbacks.get(t.id);n&&(n(t.response),this.relayEventManager.callbacks.delete(t.id))}requestEthereumAccounts(){const t={method:"requestEthereumAccounts",params:{appName:this.appName,appLogoUrl:this.appLogoUrl||null}},n=(0,Bt.randomBytesHex)(8),r=s=>{this.publishWeb3RequestCanceledEvent(n),this.handleErrorResponse(n,t.method,s)};return{promise:new Promise((s,o)=>{if(this.relayEventManager.callbacks.set(n,a=>{if(this.ui.hideRequestEthereumAccounts(),(0,Io.isErrorResponse)(a))return o(new Error(a.errorMessage));s(a)}),this.ui.inlineAccountsResponse()){const a=c=>{this.handleWeb3ResponseMessage({type:"WEB3_RESPONSE",id:n,response:{method:"requestEthereumAccounts",result:c}})};this.ui.requestEthereumAccounts({onCancel:r,onAccounts:a})}else{const a=fc.standardErrors.provider.userRejectedRequest("User denied account authorization");this.ui.requestEthereumAccounts({onCancel:()=>r(a)})}Di.accountRequestCallbackIds.add(n),!this.ui.inlineAccountsResponse()&&!this.ui.isStandalone()&&this.publishWeb3RequestEvent(n,t)}),cancel:r}}selectProvider(t){const n={method:"selectProvider"},r=(0,Bt.randomBytesHex)(8),i=o=>{this.publishWeb3RequestCanceledEvent(r),this.handleErrorResponse(r,n.method,o)},s=new Promise((o,a)=>{this.relayEventManager.callbacks.set(r,l=>{if((0,Io.isErrorResponse)(l))return a(new Error(l.errorMessage));o(l)});const c=l=>{this.handleWeb3ResponseMessage({type:"WEB3_RESPONSE",id:r,response:{method:"selectProvider",result:cV.ProviderType.Unselected}})},u=l=>{this.handleWeb3ResponseMessage({type:"WEB3_RESPONSE",id:r,response:{method:"selectProvider",result:l}})};this.ui.selectProvider&&this.ui.selectProvider({onApprove:u,onCancel:c,providerOptions:t})});return{cancel:i,promise:s}}watchAsset(t,n,r,i,s,o){const a={method:"watchAsset",params:{type:t,options:{address:n,symbol:r,decimals:i,image:s},chainId:o}};let c=null;const u=(0,Bt.randomBytesHex)(8),l=f=>{this.publishWeb3RequestCanceledEvent(u),this.handleErrorResponse(u,a.method,f),c==null||c()};this.ui.inlineWatchAsset()||(c=this.ui.showConnecting({isUnlinkedErrorState:this.isUnlinkedErrorState,onCancel:l,onResetConnection:this.resetAndReload}));const d=new Promise((f,h)=>{this.relayEventManager.callbacks.set(u,w=>{if(c==null||c(),(0,Io.isErrorResponse)(w))return h(new Error(w.errorMessage));f(w)});const m=w=>{this.handleWeb3ResponseMessage({type:"WEB3_RESPONSE",id:u,response:{method:"watchAsset",result:!1}})},y=()=>{this.handleWeb3ResponseMessage({type:"WEB3_RESPONSE",id:u,response:{method:"watchAsset",result:!0}})};this.ui.inlineWatchAsset()&&this.ui.watchAsset({onApprove:y,onCancel:m,type:t,address:n,symbol:r,decimals:i,image:s,chainId:o}),!this.ui.inlineWatchAsset()&&!this.ui.isStandalone()&&this.publishWeb3RequestEvent(u,a)});return{cancel:l,promise:d}}addEthereumChain(t,n,r,i,s,o){const a={method:"addEthereumChain",params:{chainId:t,rpcUrls:n,blockExplorerUrls:i,chainName:s,iconUrls:r,nativeCurrency:o}};let c=null;const u=(0,Bt.randomBytesHex)(8),l=f=>{this.publishWeb3RequestCanceledEvent(u),this.handleErrorResponse(u,a.method,f),c==null||c()};return this.ui.inlineAddEthereumChain(t)||(c=this.ui.showConnecting({isUnlinkedErrorState:this.isUnlinkedErrorState,onCancel:l,onResetConnection:this.resetAndReload})),{promise:new Promise((f,h)=>{this.relayEventManager.callbacks.set(u,w=>{if(c==null||c(),(0,Io.isErrorResponse)(w))return h(new Error(w.errorMessage));f(w)});const m=w=>{this.handleWeb3ResponseMessage({type:"WEB3_RESPONSE",id:u,response:{method:"addEthereumChain",result:{isApproved:!1,rpcUrl:""}}})},y=w=>{this.handleWeb3ResponseMessage({type:"WEB3_RESPONSE",id:u,response:{method:"addEthereumChain",result:{isApproved:!0,rpcUrl:w}}})};this.ui.inlineAddEthereumChain(t)&&this.ui.addEthereumChain({onCancel:m,onApprove:y,chainId:a.params.chainId,rpcUrls:a.params.rpcUrls,blockExplorerUrls:a.params.blockExplorerUrls,chainName:a.params.chainName,iconUrls:a.params.iconUrls,nativeCurrency:a.params.nativeCurrency}),!this.ui.inlineAddEthereumChain(t)&&!this.ui.isStandalone()&&this.publishWeb3RequestEvent(u,a)}),cancel:l}}switchEthereumChain(t,n){const r={method:"switchEthereumChain",params:Object.assign({chainId:t},{address:n})},i=(0,Bt.randomBytesHex)(8),s=a=>{this.publishWeb3RequestCanceledEvent(i),this.handleErrorResponse(i,r.method,a)};return{promise:new Promise((a,c)=>{this.relayEventManager.callbacks.set(i,d=>{if((0,Io.isErrorResponse)(d)&&d.errorCode)return c(fc.standardErrors.provider.custom({code:d.errorCode,message:"Unrecognized chain ID. Try adding the chain using addEthereumChain first."}));if((0,Io.isErrorResponse)(d))return c(new Error(d.errorMessage));a(d)});const u=d=>{var f;if(d){const h=(f=(0,fc.getErrorCode)(d))!==null&&f!==void 0?f:fc.standardErrorCodes.provider.unsupportedChain;this.handleErrorResponse(i,"switchEthereumChain",d instanceof Error?d:fc.standardErrors.provider.unsupportedChain(t),h)}else this.handleWeb3ResponseMessage({type:"WEB3_RESPONSE",id:i,response:{method:"switchEthereumChain",result:{isApproved:!1,rpcUrl:""}}})},l=d=>{this.handleWeb3ResponseMessage({type:"WEB3_RESPONSE",id:i,response:{method:"switchEthereumChain",result:{isApproved:!0,rpcUrl:d}}})};this.ui.switchEthereumChain({onCancel:u,onApprove:l,chainId:r.params.chainId,address:r.params.address}),!this.ui.inlineSwitchEthereumChain()&&!this.ui.isStandalone()&&this.publishWeb3RequestEvent(i,r)}),cancel:s}}inlineAddEthereumChain(t){return this.ui.inlineAddEthereumChain(t)}getSessionIdHash(){return Is.Session.hash(this._session.id)}sendRequestStandalone(t,n){const r=s=>{this.handleErrorResponse(t,n.method,s)},i=s=>{this.handleWeb3ResponseMessage({type:"WEB3_RESPONSE",id:t,response:s})};switch(n.method){case"signEthereumMessage":this.ui.signEthereumMessage({request:n,onSuccess:i,onCancel:r});break;case"signEthereumTransaction":this.ui.signEthereumTransaction({request:n,onSuccess:i,onCancel:r});break;case"submitEthereumTransaction":this.ui.submitEthereumTransaction({request:n,onSuccess:i,onCancel:r});break;case"ethereumAddressFromSignedMessage":this.ui.ethereumAddressFromSignedMessage({request:n,onSuccess:i});break;default:r();break}}}sl.WalletLinkRelay=Di,Di.accountRequestCallbackIds=new Set;var Il={},Qh={},k8={};(function(e){var t=Pe&&Pe.__createBinding||(Object.create?function(r,i,s,o){o===void 0&&(o=s);var a=Object.getOwnPropertyDescriptor(i,s);(!a||("get"in a?!i.__esModule:a.writable||a.configurable))&&(a={enumerable:!0,get:function(){return i[s]}}),Object.defineProperty(r,o,a)}:function(r,i,s,o){o===void 0&&(o=s),r[o]=i[s]}),n=Pe&&Pe.__exportStar||function(r,i){for(var s in r)s!=="default"&&!Object.prototype.hasOwnProperty.call(i,s)&&t(i,r,s)};Object.defineProperty(e,"__esModule",{value:!0}),n(o1,e)})(k8);var c1={};Object.defineProperty(c1,"__esModule",{value:!0}),c1.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 A8=Pe&&Pe.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Qh,"__esModule",{value:!0}),Qh.RedirectDialog=void 0;const dV=A8(kl),ii=Zn,fV=bl,hV=k8,pV=A8(c1);class mV{constructor(){this.root=null}attach(){const t=document.documentElement;this.root=document.createElement("div"),this.root.className="-cbwsdk-css-reset",t.appendChild(this.root),(0,fV.injectCssReset)()}present(t){this.render(t)}clear(){this.render(null)}render(t){this.root&&((0,ii.render)(null,this.root),t&&(0,ii.render)((0,ii.h)(gV,Object.assign({},t,{onDismiss:()=>{this.clear()}})),this.root))}}Qh.RedirectDialog=mV;const gV=({title:e,buttonText:t,darkMode:n,onButtonClick:r,onDismiss:i})=>{const s=n?"dark":"light";return(0,ii.h)(hV.SnackbarContainer,{darkMode:n},(0,ii.h)("div",{class:"-cbwsdk-redirect-dialog"},(0,ii.h)("style",null,pV.default),(0,ii.h)("div",{class:"-cbwsdk-redirect-dialog-backdrop",onClick:i}),(0,ii.h)("div",{class:(0,dV.default)("-cbwsdk-redirect-dialog-box",s)},(0,ii.h)("p",null,e),(0,ii.h)("button",{onClick:r},t))))};Object.defineProperty(Il,"__esModule",{value:!0}),Il.MobileRelayUI=void 0;const yV=Qh;class bV{constructor(t){this.attached=!1,this.darkMode=!1,this.redirectDialog=new yV.RedirectDialog,this.darkMode=t.darkMode}attach(){if(this.attached)throw new Error("Coinbase Wallet SDK UI is already attached");this.redirectDialog.attach(),this.attached=!0}setConnected(t){}redirectToCoinbaseWallet(t){const n=new URL("https://go.cb-w.com/walletlink");n.searchParams.append("redirect_url",window.location.href),t&&n.searchParams.append("wl_url",t);const r=document.createElement("a");r.target="cbw-opener",r.href=n.href,r.rel="noreferrer noopener",r.click()}openCoinbaseWalletDeeplink(t){this.redirectDialog.present({title:"Redirecting to Coinbase Wallet...",buttonText:"Open",darkMode:this.darkMode,onButtonClick:()=>{this.redirectToCoinbaseWallet(t)}}),setTimeout(()=>{this.redirectToCoinbaseWallet(t)},99)}showConnecting(t){return()=>{this.redirectDialog.clear()}}hideRequestEthereumAccounts(){this.redirectDialog.clear()}requestEthereumAccounts(){}addEthereumChain(){}watchAsset(){}selectProvider(){}switchEthereumChain(){}signEthereumMessage(){}signEthereumTransaction(){}submitEthereumTransaction(){}ethereumAddressFromSignedMessage(){}reloadUI(){}setStandalone(){}setConnectDisabled(){}inlineAccountsResponse(){return!1}inlineAddEthereumChain(){return!1}inlineWatchAsset(){return!1}inlineSwitchEthereumChain(){return!1}isStandalone(){return!1}}Il.MobileRelayUI=bV,Object.defineProperty(il,"__esModule",{value:!0}),il.MobileRelay=void 0;const wV=Ie,vV=sl,_V=Il;class EV extends vV.WalletLinkRelay{constructor(t){var n;super(t),this._enableMobileWalletLink=(n=t.enableMobileWalletLink)!==null&&n!==void 0?n:!1}requestEthereumAccounts(){return this._enableMobileWalletLink?super.requestEthereumAccounts():{promise:new Promise(()=>{const t=(0,wV.getLocation)();t.href=`https://go.cb-w.com/dapp?cb_url=${encodeURIComponent(t.href)}`}),cancel:()=>{}}}publishWeb3RequestEvent(t,n){if(super.publishWeb3RequestEvent(t,n),!(this._enableMobileWalletLink&&this.ui instanceof _V.MobileRelayUI))return;let r=!1;switch(n.method){case"requestEthereumAccounts":case"connectAndSignIn":r=!0,this.ui.openCoinbaseWalletDeeplink(this.getQRCodeUrl());break;case"switchEthereumChain":return;default:r=!0,this.ui.openCoinbaseWalletDeeplink();break}r&&window.addEventListener("blur",()=>{window.addEventListener("focus",()=>{this.connection.checkUnseenEvents()},{once:!0})},{once:!0})}handleWeb3ResponseMessage(t){super.handleWeb3ResponseMessage(t)}connectAndSignIn(t){if(!this._enableMobileWalletLink)throw new Error("connectAndSignIn is supported only when enableMobileWalletLink is on");return this.sendRequest({method:"connectAndSignIn",params:{appName:this.appName,appLogoUrl:this.appLogoUrl,domain:window.location.hostname,aud:window.location.href,version:"1",type:"eip4361",nonce:t.nonce,iat:new Date().toISOString(),chainId:`eip155:${this.dappDefaultChain}`,statement:t.statement,resources:t.resources}})}}il.MobileRelay=EV;var u1={exports:{}},l1={exports:{}},hc=typeof Reflect=="object"?Reflect:null,I8=hc&&typeof hc.apply=="function"?hc.apply:function(t,n,r){return Function.prototype.apply.call(t,n,r)},Xh;hc&&typeof hc.ownKeys=="function"?Xh=hc.ownKeys:Object.getOwnPropertySymbols?Xh=function(t){return Object.getOwnPropertyNames(t).concat(Object.getOwnPropertySymbols(t))}:Xh=function(t){return Object.getOwnPropertyNames(t)};function xV(e){console&&console.warn&&console.warn(e)}var C8=Number.isNaN||function(t){return t!==t};function yt(){yt.init.call(this)}l1.exports=yt,l1.exports.once=IV,yt.EventEmitter=yt,yt.prototype._events=void 0,yt.prototype._eventsCount=0,yt.prototype._maxListeners=void 0;var P8=10;function e0(e){if(typeof e!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}Object.defineProperty(yt,"defaultMaxListeners",{enumerable:!0,get:function(){return P8},set:function(e){if(typeof e!="number"||e<0||C8(e))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+e+".");P8=e}}),yt.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},yt.prototype.setMaxListeners=function(t){if(typeof t!="number"||t<0||C8(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 R8(e){return e._maxListeners===void 0?yt.defaultMaxListeners:e._maxListeners}yt.prototype.getMaxListeners=function(){return R8(this)},yt.prototype.emit=function(t){for(var n=[],r=1;r<arguments.length;r++)n.push(arguments[r]);var i=t==="error",s=this._events;if(s!==void 0)i=i&&s.error===void 0;else if(!i)return!1;if(i){var o;if(n.length>0&&(o=n[0]),o instanceof Error)throw o;var a=new Error("Unhandled error."+(o?" ("+o.message+")":""));throw a.context=o,a}var c=s[t];if(c===void 0)return!1;if(typeof c=="function")I8(c,this,n);else for(var u=c.length,l=N8(c,u),r=0;r<u;++r)I8(l[r],this,n);return!0};function T8(e,t,n,r){var i,s,o;if(e0(n),s=e._events,s===void 0?(s=e._events=Object.create(null),e._eventsCount=0):(s.newListener!==void 0&&(e.emit("newListener",t,n.listener?n.listener:n),s=e._events),o=s[t]),o===void 0)o=s[t]=n,++e._eventsCount;else if(typeof o=="function"?o=s[t]=r?[n,o]:[o,n]:r?o.unshift(n):o.push(n),i=R8(e),i>0&&o.length>i&&!o.warned){o.warned=!0;var a=new Error("Possible EventEmitter memory leak detected. "+o.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");a.name="MaxListenersExceededWarning",a.emitter=e,a.type=t,a.count=o.length,xV(a)}return e}yt.prototype.addListener=function(t,n){return T8(this,t,n,!1)},yt.prototype.on=yt.prototype.addListener,yt.prototype.prependListener=function(t,n){return T8(this,t,n,!0)};function SV(){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 O8(e,t,n){var r={fired:!1,wrapFn:void 0,target:e,type:t,listener:n},i=SV.bind(r);return i.listener=n,r.wrapFn=i,i}yt.prototype.once=function(t,n){return e0(n),this.on(t,O8(this,t,n)),this},yt.prototype.prependOnceListener=function(t,n){return e0(n),this.prependListener(t,O8(this,t,n)),this},yt.prototype.removeListener=function(t,n){var r,i,s,o,a;if(e0(n),i=this._events,i===void 0)return this;if(r=i[t],r===void 0)return this;if(r===n||r.listener===n)--this._eventsCount===0?this._events=Object.create(null):(delete i[t],i.removeListener&&this.emit("removeListener",t,r.listener||n));else if(typeof r!="function"){for(s=-1,o=r.length-1;o>=0;o--)if(r[o]===n||r[o].listener===n){a=r[o].listener,s=o;break}if(s<0)return this;s===0?r.shift():kV(r,s),r.length===1&&(i[t]=r[0]),i.removeListener!==void 0&&this.emit("removeListener",t,a||n)}return this},yt.prototype.off=yt.prototype.removeListener,yt.prototype.removeAllListeners=function(t){var n,r,i;if(r=this._events,r===void 0)return this;if(r.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):r[t]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete r[t]),this;if(arguments.length===0){var s=Object.keys(r),o;for(i=0;i<s.length;++i)o=s[i],o!=="removeListener"&&this.removeAllListeners(o);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(n=r[t],typeof n=="function")this.removeListener(t,n);else if(n!==void 0)for(i=n.length-1;i>=0;i--)this.removeListener(t,n[i]);return this};function M8(e,t,n){var r=e._events;if(r===void 0)return[];var i=r[t];return i===void 0?[]:typeof i=="function"?n?[i.listener||i]:[i]:n?AV(i):N8(i,i.length)}yt.prototype.listeners=function(t){return M8(this,t,!0)},yt.prototype.rawListeners=function(t){return M8(this,t,!1)},yt.listenerCount=function(e,t){return typeof e.listenerCount=="function"?e.listenerCount(t):B8.call(e,t)},yt.prototype.listenerCount=B8;function B8(e){var t=this._events;if(t!==void 0){var n=t[e];if(typeof n=="function")return 1;if(n!==void 0)return n.length}return 0}yt.prototype.eventNames=function(){return this._eventsCount>0?Xh(this._events):[]};function N8(e,t){for(var n=new Array(t),r=0;r<t;++r)n[r]=e[r];return n}function kV(e,t){for(;t+1<e.length;t++)e[t]=e[t+1];e.pop()}function AV(e){for(var t=new Array(e.length),n=0;n<t.length;++n)t[n]=e[n].listener||e[n];return t}function IV(e,t){return new Promise(function(n,r){function i(o){e.removeListener(t,s),r(o)}function s(){typeof e.removeListener=="function"&&e.removeListener("error",i),n([].slice.call(arguments))}L8(e,t,s,{once:!0}),t!=="error"&&CV(e,i,{once:!0})})}function CV(e,t,n){typeof e.on=="function"&&L8(e,"error",t,n)}function L8(e,t,n,r){if(typeof e.on=="function")r.once?e.once(t,n):e.on(t,n);else if(typeof e.addEventListener=="function")e.addEventListener(t,function i(s){r.once&&e.removeEventListener(t,i),n(s)});else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof e)}var t0=l1.exports,j8=t0.EventEmitter,d1,$8;function PV(){if($8)return d1;$8=1;function e(m,y){var w=Object.keys(m);if(Object.getOwnPropertySymbols){var b=Object.getOwnPropertySymbols(m);y&&(b=b.filter(function(x){return Object.getOwnPropertyDescriptor(m,x).enumerable})),w.push.apply(w,b)}return w}function t(m){for(var y=1;y<arguments.length;y++){var w=arguments[y]!=null?arguments[y]:{};y%2?e(Object(w),!0).forEach(function(b){n(m,b,w[b])}):Object.getOwnPropertyDescriptors?Object.defineProperties(m,Object.getOwnPropertyDescriptors(w)):e(Object(w)).forEach(function(b){Object.defineProperty(m,b,Object.getOwnPropertyDescriptor(w,b))})}return m}function n(m,y,w){return y=o(y),y in m?Object.defineProperty(m,y,{value:w,enumerable:!0,configurable:!0,writable:!0}):m[y]=w,m}function r(m,y){if(!(m instanceof y))throw new TypeError("Cannot call a class as a function")}function i(m,y){for(var w=0;w<y.length;w++){var b=y[w];b.enumerable=b.enumerable||!1,b.configurable=!0,"value"in b&&(b.writable=!0),Object.defineProperty(m,o(b.key),b)}}function s(m,y,w){return y&&i(m.prototype,y),Object.defineProperty(m,"prototype",{writable:!1}),m}function o(m){var y=a(m,"string");return typeof y=="symbol"?y:String(y)}function a(m,y){if(typeof m!="object"||m===null)return m;var w=m[Symbol.toPrimitive];if(w!==void 0){var b=w.call(m,y);if(typeof b!="object")return b;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(m)}var c=ol,u=c.Buffer,l=nb,d=l.inspect,f=d&&d.custom||"inspect";function h(m,y,w){u.prototype.copy.call(m,y,w)}return d1=function(){function m(){r(this,m),this.head=null,this.tail=null,this.length=0}return s(m,[{key:"push",value:function(w){var b={data:w,next:null};this.length>0?this.tail.next=b:this.head=b,this.tail=b,++this.length}},{key:"unshift",value:function(w){var b={data:w,next:this.head};this.length===0&&(this.tail=b),this.head=b,++this.length}},{key:"shift",value:function(){if(this.length!==0){var w=this.head.data;return this.length===1?this.head=this.tail=null:this.head=this.head.next,--this.length,w}}},{key:"clear",value:function(){this.head=this.tail=null,this.length=0}},{key:"join",value:function(w){if(this.length===0)return"";for(var b=this.head,x=""+b.data;b=b.next;)x+=w+b.data;return x}},{key:"concat",value:function(w){if(this.length===0)return u.alloc(0);for(var b=u.allocUnsafe(w>>>0),x=this.head,v=0;x;)h(x.data,b,v),v+=x.data.length,x=x.next;return b}},{key:"consume",value:function(w,b){var x;return w<this.head.data.length?(x=this.head.data.slice(0,w),this.head.data=this.head.data.slice(w)):w===this.head.data.length?x=this.shift():x=b?this._getString(w):this._getBuffer(w),x}},{key:"first",value:function(){return this.head.data}},{key:"_getString",value:function(w){var b=this.head,x=1,v=b.data;for(w-=v.length;b=b.next;){var S=b.data,I=w>S.length?S.length:w;if(I===S.length?v+=S:v+=S.slice(0,w),w-=I,w===0){I===S.length?(++x,b.next?this.head=b.next:this.head=this.tail=null):(this.head=b,b.data=S.slice(I));break}++x}return this.length-=x,v}},{key:"_getBuffer",value:function(w){var b=u.allocUnsafe(w),x=this.head,v=1;for(x.data.copy(b),w-=x.data.length;x=x.next;){var S=x.data,I=w>S.length?S.length:w;if(S.copy(b,b.length-w,0,I),w-=I,w===0){I===S.length?(++v,x.next?this.head=x.next:this.head=this.tail=null):(this.head=x,x.data=S.slice(I));break}++v}return this.length-=v,b}},{key:f,value:function(w,b){return d(this,t(t({},b),{},{depth:0,customInspect:!1}))}}]),m}(),d1}function RV(e,t){var n=this,r=this._readableState&&this._readableState.destroyed,i=this._writableState&&this._writableState.destroyed;return r||i?(t?t(e):e&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,process.nextTick(f1,this,e)):process.nextTick(f1,this,e)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(e||null,function(s){!t&&s?n._writableState?n._writableState.errorEmitted?process.nextTick(n0,n):(n._writableState.errorEmitted=!0,process.nextTick(F8,n,s)):process.nextTick(F8,n,s):t?(process.nextTick(n0,n),t(s)):process.nextTick(n0,n)}),this)}function F8(e,t){f1(e,t),n0(e)}function n0(e){e._writableState&&!e._writableState.emitClose||e._readableState&&!e._readableState.emitClose||e.emit("close")}function TV(){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 f1(e,t){e.emit("error",t)}function OV(e,t){var n=e._readableState,r=e._writableState;n&&n.autoDestroy||r&&r.autoDestroy?e.destroy(t):e.emit("error",t)}var D8={destroy:RV,undestroy:TV,errorOrDestroy:OV},Co={};function MV(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,e.__proto__=t}var U8={};function vr(e,t,n){n||(n=Error);function r(s,o,a){return typeof t=="string"?t:t(s,o,a)}var i=function(s){MV(o,s);function o(a,c,u){return s.call(this,r(a,c,u))||this}return o}(n);i.prototype.name=n.name,i.prototype.code=e,U8[e]=i}function H8(e,t){if(Array.isArray(e)){var n=e.length;return e=e.map(function(r){return String(r)}),n>2?"one of ".concat(t," ").concat(e.slice(0,n-1).join(", "),", or ")+e[n-1]:n===2?"one of ".concat(t," ").concat(e[0]," or ").concat(e[1]):"of ".concat(t," ").concat(e[0])}else return"of ".concat(t," ").concat(String(e))}function BV(e,t,n){return e.substr(0,t.length)===t}function NV(e,t,n){return(n===void 0||n>e.length)&&(n=e.length),e.substring(n-t.length,n)===t}function LV(e,t,n){return typeof n!="number"&&(n=0),n+t.length>e.length?!1:e.indexOf(t,n)!==-1}vr("ERR_INVALID_OPT_VALUE",function(e,t){return'The value "'+t+'" is invalid for option "'+e+'"'},TypeError),vr("ERR_INVALID_ARG_TYPE",function(e,t,n){var r;typeof t=="string"&&BV(t,"not ")?(r="must not be",t=t.replace(/^not /,"")):r="must be";var i;if(NV(e," argument"))i="The ".concat(e," ").concat(r," ").concat(H8(t,"type"));else{var s=LV(e,".")?"property":"argument";i='The "'.concat(e,'" ').concat(s," ").concat(r," ").concat(H8(t,"type"))}return i+=". Received type ".concat(typeof n),i},TypeError),vr("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),vr("ERR_METHOD_NOT_IMPLEMENTED",function(e){return"The "+e+" method is not implemented"}),vr("ERR_STREAM_PREMATURE_CLOSE","Premature close"),vr("ERR_STREAM_DESTROYED",function(e){return"Cannot call "+e+" after a stream was destroyed"}),vr("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),vr("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),vr("ERR_STREAM_WRITE_AFTER_END","write after end"),vr("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),vr("ERR_UNKNOWN_ENCODING",function(e){return"Unknown encoding: "+e},TypeError),vr("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),Co.codes=U8;var jV=Co.codes.ERR_INVALID_OPT_VALUE;function $V(e,t,n){return e.highWaterMark!=null?e.highWaterMark:t?e[n]:null}function FV(e,t,n,r){var i=$V(t,r,n);if(i!=null){if(!(isFinite(i)&&Math.floor(i)===i)||i<0){var s=r?n:"highWaterMark";throw new jV(s,i)}return Math.floor(i)}return e.objectMode?16:16*1024}var z8={getHighWaterMark:FV},DV=UV;function UV(e,t){if(h1("noDeprecation"))return e;var n=!1;function r(){if(!n){if(h1("throwDeprecation"))throw new Error(t);h1("traceDeprecation")?console.trace(t):console.warn(t),n=!0}return e.apply(this,arguments)}return r}function h1(e){try{if(!Pe.localStorage)return!1}catch{return!1}var t=Pe.localStorage[e];return t==null?!1:String(t).toLowerCase()==="true"}var p1,W8;function G8(){if(W8)return p1;W8=1,p1=U;function e(q){var J=this;this.next=null,this.entry=null,this.finish=function(){ne(J,q)}}var t;U.WritableState=N;var n={deprecate:DV},r=j8,i=ol.Buffer,s=(typeof Pe<"u"?Pe:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){};function o(q){return i.from(q)}function a(q){return i.isBuffer(q)||q instanceof s}var c=D8,u=z8,l=u.getHighWaterMark,d=Co.codes,f=d.ERR_INVALID_ARG_TYPE,h=d.ERR_METHOD_NOT_IMPLEMENTED,m=d.ERR_MULTIPLE_CALLBACK,y=d.ERR_STREAM_CANNOT_PIPE,w=d.ERR_STREAM_DESTROYED,b=d.ERR_STREAM_NULL_VALUES,x=d.ERR_STREAM_WRITE_AFTER_END,v=d.ERR_UNKNOWN_ENCODING,S=c.errorOrDestroy;$r(U,r);function I(){}function N(q,J,te){t=t||pc(),q=q||{},typeof te!="boolean"&&(te=J instanceof t),this.objectMode=!!q.objectMode,te&&(this.objectMode=this.objectMode||!!q.writableObjectMode),this.highWaterMark=l(this,q,"writableHighWaterMark",te),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var le=q.decodeStrings===!1;this.decodeStrings=!le,this.defaultEncoding=q.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(pe){k(J,pe)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=q.emitClose!==!1,this.autoDestroy=!!q.autoDestroy,this.bufferedRequestCount=0,this.corkedRequestsFree=new e(this)}N.prototype.getBuffer=function(){for(var J=this.bufferedRequest,te=[];J;)te.push(J),J=J.next;return te},function(){try{Object.defineProperty(N.prototype,"buffer",{get:n.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch{}}();var j;typeof Symbol=="function"&&Symbol.hasInstance&&typeof Function.prototype[Symbol.hasInstance]=="function"?(j=Function.prototype[Symbol.hasInstance],Object.defineProperty(U,Symbol.hasInstance,{value:function(J){return j.call(this,J)?!0:this!==U?!1:J&&J._writableState instanceof N}})):j=function(J){return J instanceof this};function U(q){t=t||pc();var J=this instanceof t;if(!J&&!j.call(U,this))return new U(q);this._writableState=new N(q,this,J),this.writable=!0,q&&(typeof q.write=="function"&&(this._write=q.write),typeof q.writev=="function"&&(this._writev=q.writev),typeof q.destroy=="function"&&(this._destroy=q.destroy),typeof q.final=="function"&&(this._final=q.final)),r.call(this)}U.prototype.pipe=function(){S(this,new y)};function L(q,J){var te=new x;S(q,te),process.nextTick(J,te)}function Y(q,J,te,le){var pe;return te===null?pe=new b:typeof te!="string"&&!J.objectMode&&(pe=new f("chunk",["string","Buffer"],te)),pe?(S(q,pe),process.nextTick(le,pe),!1):!0}U.prototype.write=function(q,J,te){var le=this._writableState,pe=!1,z=!le.objectMode&&a(q);return z&&!i.isBuffer(q)&&(q=o(q)),typeof J=="function"&&(te=J,J=null),z?J="buffer":J||(J=le.defaultEncoding),typeof te!="function"&&(te=I),le.ending?L(this,te):(z||Y(this,le,q,te))&&(le.pendingcb++,pe=G(this,le,z,q,J,te)),pe},U.prototype.cork=function(){this._writableState.corked++},U.prototype.uncork=function(){var q=this._writableState;q.corked&&(q.corked--,!q.writing&&!q.corked&&!q.bufferProcessing&&q.bufferedRequest&&M(this,q))},U.prototype.setDefaultEncoding=function(J){if(typeof J=="string"&&(J=J.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((J+"").toLowerCase())>-1))throw new v(J);return this._writableState.defaultEncoding=J,this},Object.defineProperty(U.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}});function Z(q,J,te){return!q.objectMode&&q.decodeStrings!==!1&&typeof J=="string"&&(J=i.from(J,te)),J}Object.defineProperty(U.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}});function G(q,J,te,le,pe,z){if(!te){var D=Z(J,le,pe);le!==D&&(te=!0,pe="buffer",le=D)}var ie=J.objectMode?1:le.length;J.length+=ie;var de=J.length<J.highWaterMark;if(de||(J.needDrain=!0),J.writing||J.corked){var _e=J.lastBufferedRequest;J.lastBufferedRequest={chunk:le,encoding:pe,isBuf:te,callback:z,next:null},_e?_e.next=J.lastBufferedRequest:J.bufferedRequest=J.lastBufferedRequest,J.bufferedRequestCount+=1}else C(q,J,!1,ie,le,pe,z);return de}function C(q,J,te,le,pe,z,D){J.writelen=le,J.writecb=D,J.writing=!0,J.sync=!0,J.destroyed?J.onwrite(new w("write")):te?q._writev(pe,J.onwrite):q._write(pe,z,J.onwrite),J.sync=!1}function p(q,J,te,le,pe){--J.pendingcb,te?(process.nextTick(pe,le),process.nextTick(F,q,J),q._writableState.errorEmitted=!0,S(q,le)):(pe(le),q._writableState.errorEmitted=!0,S(q,le),F(q,J))}function g(q){q.writing=!1,q.writecb=null,q.length-=q.writelen,q.writelen=0}function k(q,J){var te=q._writableState,le=te.sync,pe=te.writecb;if(typeof pe!="function")throw new m;if(g(te),J)p(q,te,le,J,pe);else{var z=$(te)||q.destroyed;!z&&!te.corked&&!te.bufferProcessing&&te.bufferedRequest&&M(q,te),le?process.nextTick(R,q,te,z,pe):R(q,te,z,pe)}}function R(q,J,te,le){te||T(q,J),J.pendingcb--,le(),F(q,J)}function T(q,J){J.length===0&&J.needDrain&&(J.needDrain=!1,q.emit("drain"))}function M(q,J){J.bufferProcessing=!0;var te=J.bufferedRequest;if(q._writev&&te&&te.next){var le=J.bufferedRequestCount,pe=new Array(le),z=J.corkedRequestsFree;z.entry=te;for(var D=0,ie=!0;te;)pe[D]=te,te.isBuf||(ie=!1),te=te.next,D+=1;pe.allBuffers=ie,C(q,J,!0,J.length,pe,"",z.finish),J.pendingcb++,J.lastBufferedRequest=null,z.next?(J.corkedRequestsFree=z.next,z.next=null):J.corkedRequestsFree=new e(J),J.bufferedRequestCount=0}else{for(;te;){var de=te.chunk,_e=te.encoding,Ae=te.callback,xe=J.objectMode?1:de.length;if(C(q,J,!1,xe,de,_e,Ae),te=te.next,J.bufferedRequestCount--,J.writing)break}te===null&&(J.lastBufferedRequest=null)}J.bufferedRequest=te,J.bufferProcessing=!1}U.prototype._write=function(q,J,te){te(new h("_write()"))},U.prototype._writev=null,U.prototype.end=function(q,J,te){var le=this._writableState;return typeof q=="function"?(te=q,q=null,J=null):typeof J=="function"&&(te=J,J=null),q!=null&&this.write(q,J),le.corked&&(le.corked=1,this.uncork()),le.ending||ue(this,le,te),this},Object.defineProperty(U.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}});function $(q){return q.ending&&q.length===0&&q.bufferedRequest===null&&!q.finished&&!q.writing}function O(q,J){q._final(function(te){J.pendingcb--,te&&S(q,te),J.prefinished=!0,q.emit("prefinish"),F(q,J)})}function _(q,J){!J.prefinished&&!J.finalCalled&&(typeof q._final=="function"&&!J.destroyed?(J.pendingcb++,J.finalCalled=!0,process.nextTick(O,q,J)):(J.prefinished=!0,q.emit("prefinish")))}function F(q,J){var te=$(J);if(te&&(_(q,J),J.pendingcb===0&&(J.finished=!0,q.emit("finish"),J.autoDestroy))){var le=q._readableState;(!le||le.autoDestroy&&le.endEmitted)&&q.destroy()}return te}function ue(q,J,te){J.ending=!0,F(q,J),te&&(J.finished?process.nextTick(te):q.once("finish",te)),J.ended=!0,q.writable=!1}function ne(q,J,te){var le=q.entry;for(q.entry=null;le;){var pe=le.callback;J.pendingcb--,pe(te),le=le.next}J.corkedRequestsFree.next=q}return Object.defineProperty(U.prototype,"destroyed",{enumerable:!1,get:function(){return this._writableState===void 0?!1:this._writableState.destroyed},set:function(J){this._writableState&&(this._writableState.destroyed=J)}}),U.prototype.destroy=c.destroy,U.prototype._undestroy=c.undestroy,U.prototype._destroy=function(q,J){J(q)},p1}var m1,q8;function pc(){if(q8)return m1;q8=1;var e=Object.keys||function(u){var l=[];for(var d in u)l.push(d);return l};m1=o;var t=ek(),n=G8();$r(o,t);for(var r=e(n.prototype),i=0;i<r.length;i++){var s=r[i];o.prototype[s]||(o.prototype[s]=n.prototype[s])}function o(u){if(!(this instanceof o))return new o(u);t.call(this,u),n.call(this,u),this.allowHalfOpen=!0,u&&(u.readable===!1&&(this.readable=!1),u.writable===!1&&(this.writable=!1),u.allowHalfOpen===!1&&(this.allowHalfOpen=!1,this.once("end",a)))}Object.defineProperty(o.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),Object.defineProperty(o.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(o.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}});function a(){this._writableState.ended||process.nextTick(c,this)}function c(u){u.end()}return Object.defineProperty(o.prototype,"destroyed",{enumerable:!1,get:function(){return this._readableState===void 0||this._writableState===void 0?!1:this._readableState.destroyed&&this._writableState.destroyed},set:function(l){this._readableState===void 0||this._writableState===void 0||(this._readableState.destroyed=l,this._writableState.destroyed=l)}}),m1}var g1={},V8;function K8(){if(V8)return g1;V8=1;var e=$i.Buffer,t=e.isEncoding||function(b){switch(b=""+b,b&&b.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function n(b){if(!b)return"utf8";for(var x;;)switch(b){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return b;default:if(x)return;b=(""+b).toLowerCase(),x=!0}}function r(b){var x=n(b);if(typeof x!="string"&&(e.isEncoding===t||!t(b)))throw new Error("Unknown encoding: "+b);return x||b}g1.StringDecoder=i;function i(b){this.encoding=r(b);var x;switch(this.encoding){case"utf16le":this.text=d,this.end=f,x=4;break;case"utf8":this.fillLast=c,x=4;break;case"base64":this.text=h,this.end=m,x=3;break;default:this.write=y,this.end=w;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=e.allocUnsafe(x)}i.prototype.write=function(b){if(b.length===0)return"";var x,v;if(this.lastNeed){if(x=this.fillLast(b),x===void 0)return"";v=this.lastNeed,this.lastNeed=0}else v=0;return v<b.length?x?x+this.text(b,v):this.text(b,v):x||""},i.prototype.end=l,i.prototype.text=u,i.prototype.fillLast=function(b){if(this.lastNeed<=b.length)return b.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);b.copy(this.lastChar,this.lastTotal-this.lastNeed,0,b.length),this.lastNeed-=b.length};function s(b){return b<=127?0:b>>5===6?2:b>>4===14?3:b>>3===30?4:b>>6===2?-1:-2}function o(b,x,v){var S=x.length-1;if(S<v)return 0;var I=s(x[S]);return I>=0?(I>0&&(b.lastNeed=I-1),I):--S<v||I===-2?0:(I=s(x[S]),I>=0?(I>0&&(b.lastNeed=I-2),I):--S<v||I===-2?0:(I=s(x[S]),I>=0?(I>0&&(I===2?I=0:b.lastNeed=I-3),I):0))}function a(b,x,v){if((x[0]&192)!==128)return b.lastNeed=0,"�";if(b.lastNeed>1&&x.length>1){if((x[1]&192)!==128)return b.lastNeed=1,"�";if(b.lastNeed>2&&x.length>2&&(x[2]&192)!==128)return b.lastNeed=2,"�"}}function c(b){var x=this.lastTotal-this.lastNeed,v=a(this,b);if(v!==void 0)return v;if(this.lastNeed<=b.length)return b.copy(this.lastChar,x,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);b.copy(this.lastChar,x,0,b.length),this.lastNeed-=b.length}function u(b,x){var v=o(this,b,x);if(!this.lastNeed)return b.toString("utf8",x);this.lastTotal=v;var S=b.length-(v-this.lastNeed);return b.copy(this.lastChar,0,S),b.toString("utf8",x,S)}function l(b){var x=b&&b.length?this.write(b):"";return this.lastNeed?x+"�":x}function d(b,x){if((b.length-x)%2===0){var v=b.toString("utf16le",x);if(v){var S=v.charCodeAt(v.length-1);if(S>=55296&&S<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=b[b.length-2],this.lastChar[1]=b[b.length-1],v.slice(0,-1)}return v}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=b[b.length-1],b.toString("utf16le",x,b.length-1)}function f(b){var x=b&&b.length?this.write(b):"";if(this.lastNeed){var v=this.lastTotal-this.lastNeed;return x+this.lastChar.toString("utf16le",0,v)}return x}function h(b,x){var v=(b.length-x)%3;return v===0?b.toString("base64",x):(this.lastNeed=3-v,this.lastTotal=3,v===1?this.lastChar[0]=b[b.length-1]:(this.lastChar[0]=b[b.length-2],this.lastChar[1]=b[b.length-1]),b.toString("base64",x,b.length-v))}function m(b){var x=b&&b.length?this.write(b):"";return this.lastNeed?x+this.lastChar.toString("base64",0,3-this.lastNeed):x}function y(b){return b.toString(this.encoding)}function w(b){return b&&b.length?this.write(b):""}return g1}var J8=Co.codes.ERR_STREAM_PREMATURE_CLOSE;function HV(e){var t=!1;return function(){if(!t){t=!0;for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];e.apply(this,r)}}}function zV(){}function WV(e){return e.setHeader&&typeof e.abort=="function"}function Z8(e,t,n){if(typeof t=="function")return Z8(e,null,t);t||(t={}),n=HV(n||zV);var r=t.readable||t.readable!==!1&&e.readable,i=t.writable||t.writable!==!1&&e.writable,s=function(){e.writable||a()},o=e._writableState&&e._writableState.finished,a=function(){i=!1,o=!0,r||n.call(e)},c=e._readableState&&e._readableState.endEmitted,u=function(){r=!1,c=!0,i||n.call(e)},l=function(m){n.call(e,m)},d=function(){var m;if(r&&!c)return(!e._readableState||!e._readableState.ended)&&(m=new J8),n.call(e,m);if(i&&!o)return(!e._writableState||!e._writableState.ended)&&(m=new J8),n.call(e,m)},f=function(){e.req.on("finish",a)};return WV(e)?(e.on("complete",a),e.on("abort",d),e.req?f():e.on("request",f)):i&&!e._writableState&&(e.on("end",s),e.on("close",s)),e.on("end",u),e.on("finish",a),t.error!==!1&&e.on("error",l),e.on("close",d),function(){e.removeListener("complete",a),e.removeListener("abort",d),e.removeListener("request",f),e.req&&e.req.removeListener("finish",a),e.removeListener("end",s),e.removeListener("close",s),e.removeListener("finish",a),e.removeListener("end",u),e.removeListener("error",l),e.removeListener("close",d)}}var y1=Z8,b1,Y8;function GV(){if(Y8)return b1;Y8=1;var e;function t(v,S,I){return S=n(S),S in v?Object.defineProperty(v,S,{value:I,enumerable:!0,configurable:!0,writable:!0}):v[S]=I,v}function n(v){var S=r(v,"string");return typeof S=="symbol"?S:String(S)}function r(v,S){if(typeof v!="object"||v===null)return v;var I=v[Symbol.toPrimitive];if(I!==void 0){var N=I.call(v,S);if(typeof N!="object")return N;throw new TypeError("@@toPrimitive must return a primitive value.")}return(S==="string"?String:Number)(v)}var i=y1,s=Symbol("lastResolve"),o=Symbol("lastReject"),a=Symbol("error"),c=Symbol("ended"),u=Symbol("lastPromise"),l=Symbol("handlePromise"),d=Symbol("stream");function f(v,S){return{value:v,done:S}}function h(v){var S=v[s];if(S!==null){var I=v[d].read();I!==null&&(v[u]=null,v[s]=null,v[o]=null,S(f(I,!1)))}}function m(v){process.nextTick(h,v)}function y(v,S){return function(I,N){v.then(function(){if(S[c]){I(f(void 0,!0));return}S[l](I,N)},N)}}var w=Object.getPrototypeOf(function(){}),b=Object.setPrototypeOf((e={get stream(){return this[d]},next:function(){var S=this,I=this[a];if(I!==null)return Promise.reject(I);if(this[c])return Promise.resolve(f(void 0,!0));if(this[d].destroyed)return new Promise(function(L,Y){process.nextTick(function(){S[a]?Y(S[a]):L(f(void 0,!0))})});var N=this[u],j;if(N)j=new Promise(y(N,this));else{var U=this[d].read();if(U!==null)return Promise.resolve(f(U,!1));j=new Promise(this[l])}return this[u]=j,j}},t(e,Symbol.asyncIterator,function(){return this}),t(e,"return",function(){var S=this;return new Promise(function(I,N){S[d].destroy(null,function(j){if(j){N(j);return}I(f(void 0,!0))})})}),e),w),x=function(S){var I,N=Object.create(b,(I={},t(I,d,{value:S,writable:!0}),t(I,s,{value:null,writable:!0}),t(I,o,{value:null,writable:!0}),t(I,a,{value:null,writable:!0}),t(I,c,{value:S._readableState.endEmitted,writable:!0}),t(I,l,{value:function(U,L){var Y=N[d].read();Y?(N[u]=null,N[s]=null,N[o]=null,U(f(Y,!1))):(N[s]=U,N[o]=L)},writable:!0}),I));return N[u]=null,i(S,function(j){if(j&&j.code!=="ERR_STREAM_PREMATURE_CLOSE"){var U=N[o];U!==null&&(N[u]=null,N[s]=null,N[o]=null,U(j)),N[a]=j;return}var L=N[s];L!==null&&(N[u]=null,N[s]=null,N[o]=null,L(f(void 0,!0))),N[c]=!0}),S.on("readable",m.bind(null,N)),N};return b1=x,b1}var w1,Q8;function qV(){return Q8||(Q8=1,w1=function(){throw new Error("Readable.from is not available in the browser")}),w1}var v1,X8;function ek(){if(X8)return v1;X8=1,v1=L;var e;L.ReadableState=U,t0.EventEmitter;var t=function(D,ie){return D.listeners(ie).length},n=j8,r=ol.Buffer,i=(typeof Pe<"u"?Pe:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){};function s(z){return r.from(z)}function o(z){return r.isBuffer(z)||z instanceof i}var a=nb,c;a&&a.debuglog?c=a.debuglog("stream"):c=function(){};var u=PV(),l=D8,d=z8,f=d.getHighWaterMark,h=Co.codes,m=h.ERR_INVALID_ARG_TYPE,y=h.ERR_STREAM_PUSH_AFTER_EOF,w=h.ERR_METHOD_NOT_IMPLEMENTED,b=h.ERR_STREAM_UNSHIFT_AFTER_END_EVENT,x,v,S;$r(L,n);var I=l.errorOrDestroy,N=["error","close","destroy","pause","resume"];function j(z,D,ie){if(typeof z.prependListener=="function")return z.prependListener(D,ie);!z._events||!z._events[D]?z.on(D,ie):Array.isArray(z._events[D])?z._events[D].unshift(ie):z._events[D]=[ie,z._events[D]]}function U(z,D,ie){e=e||pc(),z=z||{},typeof ie!="boolean"&&(ie=D instanceof e),this.objectMode=!!z.objectMode,ie&&(this.objectMode=this.objectMode||!!z.readableObjectMode),this.highWaterMark=f(this,z,"readableHighWaterMark",ie),this.buffer=new u,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.paused=!0,this.emitClose=z.emitClose!==!1,this.autoDestroy=!!z.autoDestroy,this.destroyed=!1,this.defaultEncoding=z.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,z.encoding&&(x||(x=K8().StringDecoder),this.decoder=new x(z.encoding),this.encoding=z.encoding)}function L(z){if(e=e||pc(),!(this instanceof L))return new L(z);var D=this instanceof e;this._readableState=new U(z,this,D),this.readable=!0,z&&(typeof z.read=="function"&&(this._read=z.read),typeof z.destroy=="function"&&(this._destroy=z.destroy)),n.call(this)}Object.defineProperty(L.prototype,"destroyed",{enumerable:!1,get:function(){return this._readableState===void 0?!1:this._readableState.destroyed},set:function(D){this._readableState&&(this._readableState.destroyed=D)}}),L.prototype.destroy=l.destroy,L.prototype._undestroy=l.undestroy,L.prototype._destroy=function(z,D){D(z)},L.prototype.push=function(z,D){var ie=this._readableState,de;return ie.objectMode?de=!0:typeof z=="string"&&(D=D||ie.defaultEncoding,D!==ie.encoding&&(z=r.from(z,D),D=""),de=!0),Y(this,z,D,!1,de)},L.prototype.unshift=function(z){return Y(this,z,null,!0,!1)};function Y(z,D,ie,de,_e){c("readableAddChunk",D);var Ae=z._readableState;if(D===null)Ae.reading=!1,k(z,Ae);else{var xe;if(_e||(xe=G(Ae,D)),xe)I(z,xe);else if(Ae.objectMode||D&&D.length>0)if(typeof D!="string"&&!Ae.objectMode&&Object.getPrototypeOf(D)!==r.prototype&&(D=s(D)),de)Ae.endEmitted?I(z,new b):Z(z,Ae,D,!0);else if(Ae.ended)I(z,new y);else{if(Ae.destroyed)return!1;Ae.reading=!1,Ae.decoder&&!ie?(D=Ae.decoder.write(D),Ae.objectMode||D.length!==0?Z(z,Ae,D,!1):M(z,Ae)):Z(z,Ae,D,!1)}else de||(Ae.reading=!1,M(z,Ae))}return!Ae.ended&&(Ae.length<Ae.highWaterMark||Ae.length===0)}function Z(z,D,ie,de){D.flowing&&D.length===0&&!D.sync?(D.awaitDrain=0,z.emit("data",ie)):(D.length+=D.objectMode?1:ie.length,de?D.buffer.unshift(ie):D.buffer.push(ie),D.needReadable&&R(z)),M(z,D)}function G(z,D){var ie;return!o(D)&&typeof D!="string"&&D!==void 0&&!z.objectMode&&(ie=new m("chunk",["string","Buffer","Uint8Array"],D)),ie}L.prototype.isPaused=function(){return this._readableState.flowing===!1},L.prototype.setEncoding=function(z){x||(x=K8().StringDecoder);var D=new x(z);this._readableState.decoder=D,this._readableState.encoding=this._readableState.decoder.encoding;for(var ie=this._readableState.buffer.head,de="";ie!==null;)de+=D.write(ie.data),ie=ie.next;return this._readableState.buffer.clear(),de!==""&&this._readableState.buffer.push(de),this._readableState.length=de.length,this};var C=1073741824;function p(z){return z>=C?z=C:(z--,z|=z>>>1,z|=z>>>2,z|=z>>>4,z|=z>>>8,z|=z>>>16,z++),z}function g(z,D){return z<=0||D.length===0&&D.ended?0:D.objectMode?1:z!==z?D.flowing&&D.length?D.buffer.head.data.length:D.length:(z>D.highWaterMark&&(D.highWaterMark=p(z)),z<=D.length?z:D.ended?D.length:(D.needReadable=!0,0))}L.prototype.read=function(z){c("read",z),z=parseInt(z,10);var D=this._readableState,ie=z;if(z!==0&&(D.emittedReadable=!1),z===0&&D.needReadable&&((D.highWaterMark!==0?D.length>=D.highWaterMark:D.length>0)||D.ended))return c("read: emitReadable",D.length,D.ended),D.length===0&&D.ended?te(this):R(this),null;if(z=g(z,D),z===0&&D.ended)return D.length===0&&te(this),null;var de=D.needReadable;c("need readable",de),(D.length===0||D.length-z<D.highWaterMark)&&(de=!0,c("length less than watermark",de)),D.ended||D.reading?(de=!1,c("reading or ended",de)):de&&(c("do read"),D.reading=!0,D.sync=!0,D.length===0&&(D.needReadable=!0),this._read(D.highWaterMark),D.sync=!1,D.reading||(z=g(ie,D)));var _e;return z>0?_e=J(z,D):_e=null,_e===null?(D.needReadable=D.length<=D.highWaterMark,z=0):(D.length-=z,D.awaitDrain=0),D.length===0&&(D.ended||(D.needReadable=!0),ie!==z&&D.ended&&te(this)),_e!==null&&this.emit("data",_e),_e};function k(z,D){if(c("onEofChunk"),!D.ended){if(D.decoder){var ie=D.decoder.end();ie&&ie.length&&(D.buffer.push(ie),D.length+=D.objectMode?1:ie.length)}D.ended=!0,D.sync?R(z):(D.needReadable=!1,D.emittedReadable||(D.emittedReadable=!0,T(z)))}}function R(z){var D=z._readableState;c("emitReadable",D.needReadable,D.emittedReadable),D.needReadable=!1,D.emittedReadable||(c("emitReadable",D.flowing),D.emittedReadable=!0,process.nextTick(T,z))}function T(z){var D=z._readableState;c("emitReadable_",D.destroyed,D.length,D.ended),!D.destroyed&&(D.length||D.ended)&&(z.emit("readable"),D.emittedReadable=!1),D.needReadable=!D.flowing&&!D.ended&&D.length<=D.highWaterMark,q(z)}function M(z,D){D.readingMore||(D.readingMore=!0,process.nextTick($,z,D))}function $(z,D){for(;!D.reading&&!D.ended&&(D.length<D.highWaterMark||D.flowing&&D.length===0);){var ie=D.length;if(c("maybeReadMore read 0"),z.read(0),ie===D.length)break}D.readingMore=!1}L.prototype._read=function(z){I(this,new w("_read()"))},L.prototype.pipe=function(z,D){var ie=this,de=this._readableState;switch(de.pipesCount){case 0:de.pipes=z;break;case 1:de.pipes=[de.pipes,z];break;default:de.pipes.push(z);break}de.pipesCount+=1,c("pipe count=%d opts=%j",de.pipesCount,D);var _e=(!D||D.end!==!1)&&z!==process.stdout&&z!==process.stderr,Ae=_e?Ge:De;de.endEmitted?process.nextTick(Ae):ie.once("end",Ae),z.on("unpipe",xe);function xe(B,E){c("onunpipe"),B===ie&&E&&E.hasUnpiped===!1&&(E.hasUnpiped=!0,Qe())}function Ge(){c("onend"),z.end()}var Tt=O(ie);z.on("drain",Tt);var $e=!1;function Qe(){c("cleanup"),z.removeListener("close",Xe),z.removeListener("finish",Lt),z.removeListener("drain",Tt),z.removeListener("error",Fe),z.removeListener("unpipe",xe),ie.removeListener("end",Ge),ie.removeListener("end",De),ie.removeListener("data",At),$e=!0,de.awaitDrain&&(!z._writableState||z._writableState.needDrain)&&Tt()}ie.on("data",At);function At(B){c("ondata");var E=z.write(B);c("dest.write",E),E===!1&&((de.pipesCount===1&&de.pipes===z||de.pipesCount>1&&pe(de.pipes,z)!==-1)&&!$e&&(c("false write response, pause",de.awaitDrain),de.awaitDrain++),ie.pause())}function Fe(B){c("onerror",B),De(),z.removeListener("error",Fe),t(z,"error")===0&&I(z,B)}j(z,"error",Fe);function Xe(){z.removeListener("finish",Lt),De()}z.once("close",Xe);function Lt(){c("onfinish"),z.removeListener("close",Xe),De()}z.once("finish",Lt);function De(){c("unpipe"),ie.unpipe(z)}return z.emit("pipe",ie),de.flowing||(c("pipe resume"),ie.resume()),z};function O(z){return function(){var ie=z._readableState;c("pipeOnDrain",ie.awaitDrain),ie.awaitDrain&&ie.awaitDrain--,ie.awaitDrain===0&&t(z,"data")&&(ie.flowing=!0,q(z))}}L.prototype.unpipe=function(z){var D=this._readableState,ie={hasUnpiped:!1};if(D.pipesCount===0)return this;if(D.pipesCount===1)return z&&z!==D.pipes?this:(z||(z=D.pipes),D.pipes=null,D.pipesCount=0,D.flowing=!1,z&&z.emit("unpipe",this,ie),this);if(!z){var de=D.pipes,_e=D.pipesCount;D.pipes=null,D.pipesCount=0,D.flowing=!1;for(var Ae=0;Ae<_e;Ae++)de[Ae].emit("unpipe",this,{hasUnpiped:!1});return this}var xe=pe(D.pipes,z);return xe===-1?this:(D.pipes.splice(xe,1),D.pipesCount-=1,D.pipesCount===1&&(D.pipes=D.pipes[0]),z.emit("unpipe",this,ie),this)},L.prototype.on=function(z,D){var ie=n.prototype.on.call(this,z,D),de=this._readableState;return z==="data"?(de.readableListening=this.listenerCount("readable")>0,de.flowing!==!1&&this.resume()):z==="readable"&&!de.endEmitted&&!de.readableListening&&(de.readableListening=de.needReadable=!0,de.flowing=!1,de.emittedReadable=!1,c("on readable",de.length,de.reading),de.length?R(this):de.reading||process.nextTick(F,this)),ie},L.prototype.addListener=L.prototype.on,L.prototype.removeListener=function(z,D){var ie=n.prototype.removeListener.call(this,z,D);return z==="readable"&&process.nextTick(_,this),ie},L.prototype.removeAllListeners=function(z){var D=n.prototype.removeAllListeners.apply(this,arguments);return(z==="readable"||z===void 0)&&process.nextTick(_,this),D};function _(z){var D=z._readableState;D.readableListening=z.listenerCount("readable")>0,D.resumeScheduled&&!D.paused?D.flowing=!0:z.listenerCount("data")>0&&z.resume()}function F(z){c("readable nexttick read 0"),z.read(0)}L.prototype.resume=function(){var z=this._readableState;return z.flowing||(c("resume"),z.flowing=!z.readableListening,ue(this,z)),z.paused=!1,this};function ue(z,D){D.resumeScheduled||(D.resumeScheduled=!0,process.nextTick(ne,z,D))}function ne(z,D){c("resume",D.reading),D.reading||z.read(0),D.resumeScheduled=!1,z.emit("resume"),q(z),D.flowing&&!D.reading&&z.read(0)}L.prototype.pause=function(){return c("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1&&(c("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this};function q(z){var D=z._readableState;for(c("flow",D.flowing);D.flowing&&z.read()!==null;);}L.prototype.wrap=function(z){var D=this,ie=this._readableState,de=!1;z.on("end",function(){if(c("wrapped end"),ie.decoder&&!ie.ended){var xe=ie.decoder.end();xe&&xe.length&&D.push(xe)}D.push(null)}),z.on("data",function(xe){if(c("wrapped data"),ie.decoder&&(xe=ie.decoder.write(xe)),!(ie.objectMode&&xe==null)&&!(!ie.objectMode&&(!xe||!xe.length))){var Ge=D.push(xe);Ge||(de=!0,z.pause())}});for(var _e in z)this[_e]===void 0&&typeof z[_e]=="function"&&(this[_e]=function(Ge){return function(){return z[Ge].apply(z,arguments)}}(_e));for(var Ae=0;Ae<N.length;Ae++)z.on(N[Ae],this.emit.bind(this,N[Ae]));return this._read=function(xe){c("wrapped _read",xe),de&&(de=!1,z.resume())},this},typeof Symbol=="function"&&(L.prototype[Symbol.asyncIterator]=function(){return v===void 0&&(v=GV()),v(this)}),Object.defineProperty(L.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}}),Object.defineProperty(L.prototype,"readableBuffer",{enumerable:!1,get:function(){return this._readableState&&this._readableState.buffer}}),Object.defineProperty(L.prototype,"readableFlowing",{enumerable:!1,get:function(){return this._readableState.flowing},set:function(D){this._readableState&&(this._readableState.flowing=D)}}),L._fromList=J,Object.defineProperty(L.prototype,"readableLength",{enumerable:!1,get:function(){return this._readableState.length}});function J(z,D){if(D.length===0)return null;var ie;return D.objectMode?ie=D.buffer.shift():!z||z>=D.length?(D.decoder?ie=D.buffer.join(""):D.buffer.length===1?ie=D.buffer.first():ie=D.buffer.concat(D.length),D.buffer.clear()):ie=D.buffer.consume(z,D.decoder),ie}function te(z){var D=z._readableState;c("endReadable",D.endEmitted),D.endEmitted||(D.ended=!0,process.nextTick(le,D,z))}function le(z,D){if(c("endReadableNT",z.endEmitted,z.length),!z.endEmitted&&z.length===0&&(z.endEmitted=!0,D.readable=!1,D.emit("end"),z.autoDestroy)){var ie=D._writableState;(!ie||ie.autoDestroy&&ie.finished)&&D.destroy()}}typeof Symbol=="function"&&(L.from=function(z,D){return S===void 0&&(S=qV()),S(L,z,D)});function pe(z,D){for(var ie=0,de=z.length;ie<de;ie++)if(z[ie]===D)return ie;return-1}return v1}var tk=Ui,r0=Co.codes,VV=r0.ERR_METHOD_NOT_IMPLEMENTED,KV=r0.ERR_MULTIPLE_CALLBACK,JV=r0.ERR_TRANSFORM_ALREADY_TRANSFORMING,ZV=r0.ERR_TRANSFORM_WITH_LENGTH_0,i0=pc();$r(Ui,i0);function YV(e,t){var n=this._transformState;n.transforming=!1;var r=n.writecb;if(r===null)return this.emit("error",new KV);n.writechunk=null,n.writecb=null,t!=null&&this.push(t),r(e);var i=this._readableState;i.reading=!1,(i.needReadable||i.length<i.highWaterMark)&&this._read(i.highWaterMark)}function Ui(e){if(!(this instanceof Ui))return new Ui(e);i0.call(this,e),this._transformState={afterTransform:YV.bind(this),needTransform:!1,transforming:!1,writecb:null,writechunk:null,writeencoding:null},this._readableState.needReadable=!0,this._readableState.sync=!1,e&&(typeof e.transform=="function"&&(this._transform=e.transform),typeof e.flush=="function"&&(this._flush=e.flush)),this.on("prefinish",QV)}function QV(){var e=this;typeof this._flush=="function"&&!this._readableState.destroyed?this._flush(function(t,n){nk(e,t,n)}):nk(this,null,null)}Ui.prototype.push=function(e,t){return this._transformState.needTransform=!1,i0.prototype.push.call(this,e,t)},Ui.prototype._transform=function(e,t,n){n(new VV("_transform()"))},Ui.prototype._write=function(e,t,n){var r=this._transformState;if(r.writecb=n,r.writechunk=e,r.writeencoding=t,!r.transforming){var i=this._readableState;(r.needTransform||i.needReadable||i.length<i.highWaterMark)&&this._read(i.highWaterMark)}},Ui.prototype._read=function(e){var t=this._transformState;t.writechunk!==null&&!t.transforming?(t.transforming=!0,this._transform(t.writechunk,t.writeencoding,t.afterTransform)):t.needTransform=!0},Ui.prototype._destroy=function(e,t){i0.prototype._destroy.call(this,e,function(n){t(n)})};function nk(e,t,n){if(t)return e.emit("error",t);if(n!=null&&e.push(n),e._writableState.length)throw new ZV;if(e._transformState.transforming)throw new JV;return e.push(null)}var XV=Cl,rk=tk;$r(Cl,rk);function Cl(e){if(!(this instanceof Cl))return new Cl(e);rk.call(this,e)}Cl.prototype._transform=function(e,t,n){n(null,e)};var _1;function eK(e){var t=!1;return function(){t||(t=!0,e.apply(void 0,arguments))}}var ik=Co.codes,tK=ik.ERR_MISSING_ARGS,nK=ik.ERR_STREAM_DESTROYED;function sk(e){if(e)throw e}function rK(e){return e.setHeader&&typeof e.abort=="function"}function iK(e,t,n,r){r=eK(r);var i=!1;e.on("close",function(){i=!0}),_1===void 0&&(_1=y1),_1(e,{readable:t,writable:n},function(o){if(o)return r(o);i=!0,r()});var s=!1;return function(o){if(!i&&!s){if(s=!0,rK(e))return e.abort();if(typeof e.destroy=="function")return e.destroy();r(o||new nK("pipe"))}}}function ok(e){e()}function sK(e,t){return e.pipe(t)}function oK(e){return!e.length||typeof e[e.length-1]!="function"?sk:e.pop()}function aK(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];var r=oK(t);if(Array.isArray(t[0])&&(t=t[0]),t.length<2)throw new tK("streams");var i,s=t.map(function(o,a){var c=a<t.length-1,u=a>0;return iK(o,c,u,function(l){i||(i=l),l&&s.forEach(ok),!c&&(s.forEach(ok),r(i))})});return t.reduce(sK)}var cK=aK;(function(e,t){t=e.exports=ek(),t.Stream=t,t.Readable=t,t.Writable=G8(),t.Duplex=pc(),t.Transform=tk,t.PassThrough=XV,t.finished=y1,t.pipeline=cK})(u1,u1.exports);var ak=u1.exports;const{Transform:uK}=ak;var lK=e=>class SI extends uK{constructor(n,r,i,s,o){super(o),this._rate=n,this._capacity=r,this._delimitedSuffix=i,this._hashBitLength=s,this._options=o,this._state=new e,this._state.initialize(n,r),this._finalized=!1}_transform(n,r,i){let s=null;try{this.update(n,r)}catch(o){s=o}i(s)}_flush(n){let r=null;try{this.push(this.digest())}catch(i){r=i}n(r)}update(n,r){if(!Buffer.isBuffer(n)&&typeof n!="string")throw new TypeError("Data must be a string or a buffer");if(this._finalized)throw new Error("Digest already called");return Buffer.isBuffer(n)||(n=Buffer.from(n,r)),this._state.absorb(n),this}digest(n){if(this._finalized)throw new Error("Digest already called");this._finalized=!0,this._delimitedSuffix&&this._state.absorbLastFewBits(this._delimitedSuffix);let r=this._state.squeeze(this._hashBitLength/8);return n!==void 0&&(r=r.toString(n)),this._resetState(),r}_resetState(){return this._state.initialize(this._rate,this._capacity),this}_clone(){const n=new SI(this._rate,this._capacity,this._delimitedSuffix,this._hashBitLength,this._options);return this._state.copy(n._state),n._finalized=this._finalized,n}};const{Transform:dK}=ak;var fK=e=>class kI extends dK{constructor(n,r,i,s){super(s),this._rate=n,this._capacity=r,this._delimitedSuffix=i,this._options=s,this._state=new e,this._state.initialize(n,r),this._finalized=!1}_transform(n,r,i){let s=null;try{this.update(n,r)}catch(o){s=o}i(s)}_flush(){}_read(n){this.push(this.squeeze(n))}update(n,r){if(!Buffer.isBuffer(n)&&typeof n!="string")throw new TypeError("Data must be a string or a buffer");if(this._finalized)throw new Error("Squeeze already called");return Buffer.isBuffer(n)||(n=Buffer.from(n,r)),this._state.absorb(n),this}squeeze(n,r){this._finalized||(this._finalized=!0,this._state.absorbLastFewBits(this._delimitedSuffix));let i=this._state.squeeze(n);return r!==void 0&&(i=i.toString(r)),i}_resetState(){return this._state.initialize(this._rate,this._capacity),this}_clone(){const n=new kI(this._rate,this._capacity,this._delimitedSuffix,this._options);return this._state.copy(n._state),n._finalized=this._finalized,n}};const hK=lK,pK=fK;var mK=function(e){const t=hK(e),n=pK(e);return function(r,i){switch(typeof r=="string"?r.toLowerCase():r){case"keccak224":return new t(1152,448,null,224,i);case"keccak256":return new t(1088,512,null,256,i);case"keccak384":return new t(832,768,null,384,i);case"keccak512":return new t(576,1024,null,512,i);case"sha3-224":return new t(1152,448,6,224,i);case"sha3-256":return new t(1088,512,6,256,i);case"sha3-384":return new t(832,768,6,384,i);case"sha3-512":return new t(576,1024,6,512,i);case"shake128":return new n(1344,256,31,i);case"shake256":return new n(1088,512,31,i);default:throw new Error("Invald algorithm: "+r)}}},ck={};const uk=[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];ck.p1600=function(e){for(let t=0;t<24;++t){const n=e[0]^e[10]^e[20]^e[30]^e[40],r=e[1]^e[11]^e[21]^e[31]^e[41],i=e[2]^e[12]^e[22]^e[32]^e[42],s=e[3]^e[13]^e[23]^e[33]^e[43],o=e[4]^e[14]^e[24]^e[34]^e[44],a=e[5]^e[15]^e[25]^e[35]^e[45],c=e[6]^e[16]^e[26]^e[36]^e[46],u=e[7]^e[17]^e[27]^e[37]^e[47],l=e[8]^e[18]^e[28]^e[38]^e[48],d=e[9]^e[19]^e[29]^e[39]^e[49];let f=l^(i<<1|s>>>31),h=d^(s<<1|i>>>31);const m=e[0]^f,y=e[1]^h,w=e[10]^f,b=e[11]^h,x=e[20]^f,v=e[21]^h,S=e[30]^f,I=e[31]^h,N=e[40]^f,j=e[41]^h;f=n^(o<<1|a>>>31),h=r^(a<<1|o>>>31);const U=e[2]^f,L=e[3]^h,Y=e[12]^f,Z=e[13]^h,G=e[22]^f,C=e[23]^h,p=e[32]^f,g=e[33]^h,k=e[42]^f,R=e[43]^h;f=i^(c<<1|u>>>31),h=s^(u<<1|c>>>31);const T=e[4]^f,M=e[5]^h,$=e[14]^f,O=e[15]^h,_=e[24]^f,F=e[25]^h,ue=e[34]^f,ne=e[35]^h,q=e[44]^f,J=e[45]^h;f=o^(l<<1|d>>>31),h=a^(d<<1|l>>>31);const te=e[6]^f,le=e[7]^h,pe=e[16]^f,z=e[17]^h,D=e[26]^f,ie=e[27]^h,de=e[36]^f,_e=e[37]^h,Ae=e[46]^f,xe=e[47]^h;f=c^(n<<1|r>>>31),h=u^(r<<1|n>>>31);const Ge=e[8]^f,Tt=e[9]^h,$e=e[18]^f,Qe=e[19]^h,At=e[28]^f,Fe=e[29]^h,Xe=e[38]^f,Lt=e[39]^h,De=e[48]^f,B=e[49]^h,E=m,A=y,H=b<<4|w>>>28,Q=w<<4|b>>>28,X=x<<3|v>>>29,re=v<<3|x>>>29,Me=I<<9|S>>>23,Oe=S<<9|I>>>23,Te=N<<18|j>>>14,ot=j<<18|N>>>14,Ce=U<<1|L>>>31,Ue=L<<1|U>>>31,Dn=Z<<12|Y>>>20,qe=Y<<12|Z>>>20,ut=G<<10|C>>>22,zr=C<<10|G>>>22,bt=g<<13|p>>>19,ht=p<<13|g>>>19,Cn=k<<2|R>>>30,lt=R<<2|k>>>30,pt=M<<30|T>>>2,Wr=T<<30|M>>>2,dt=$<<6|O>>>26,at=O<<6|$>>>26,er=F<<11|_>>>21,wt=_<<11|F>>>21,vt=ue<<15|ne>>>17,hi=ne<<15|ue>>>17,be=J<<29|q>>>3,W=q<<29|J>>>3,se=te<<28|le>>>4,ae=le<<28|te>>>4,fe=z<<23|pe>>>9,Se=pe<<23|z>>>9,Ee=D<<25|ie>>>7,ye=ie<<25|D>>>7,ke=de<<21|_e>>>11,He=_e<<21|de>>>11,Ve=xe<<24|Ae>>>8,mt=Ae<<24|xe>>>8,Xt=Ge<<27|Tt>>>5,tr=Tt<<27|Ge>>>5,Un=$e<<20|Qe>>>12,Ft=Qe<<20|$e>>>12,Gr=Fe<<7|At>>>25,Ki=At<<7|Fe>>>25,Ji=Xe<<8|Lt>>>24,Go=Lt<<8|Xe>>>24,qo=De<<14|B>>>18,Vo=B<<14|De>>>18;e[0]=E^~Dn&er,e[1]=A^~qe&wt,e[10]=se^~Un&X,e[11]=ae^~Ft&re,e[20]=Ce^~dt&Ee,e[21]=Ue^~at&ye,e[30]=Xt^~H&ut,e[31]=tr^~Q&zr,e[40]=pt^~fe&Gr,e[41]=Wr^~Se&Ki,e[2]=Dn^~er&ke,e[3]=qe^~wt&He,e[12]=Un^~X&bt,e[13]=Ft^~re&ht,e[22]=dt^~Ee&Ji,e[23]=at^~ye&Go,e[32]=H^~ut&vt,e[33]=Q^~zr&hi,e[42]=fe^~Gr&Me,e[43]=Se^~Ki&Oe,e[4]=er^~ke&qo,e[5]=wt^~He&Vo,e[14]=X^~bt&be,e[15]=re^~ht&W,e[24]=Ee^~Ji&Te,e[25]=ye^~Go&ot,e[34]=ut^~vt&Ve,e[35]=zr^~hi&mt,e[44]=Gr^~Me&Cn,e[45]=Ki^~Oe&lt,e[6]=ke^~qo&E,e[7]=He^~Vo&A,e[16]=bt^~be&se,e[17]=ht^~W&ae,e[26]=Ji^~Te&Ce,e[27]=Go^~ot&Ue,e[36]=vt^~Ve&Xt,e[37]=hi^~mt&tr,e[46]=Me^~Cn&pt,e[47]=Oe^~lt&Wr,e[8]=qo^~E&Dn,e[9]=Vo^~A&qe,e[18]=be^~se&Un,e[19]=W^~ae&Ft,e[28]=Te^~Ce&dt,e[29]=ot^~Ue&at,e[38]=Ve^~Xt&H,e[39]=mt^~tr&Q,e[48]=Cn^~pt&fe,e[49]=lt^~Wr&Se,e[0]^=uk[t*2],e[1]^=uk[t*2+1]}};const s0=ck;function mc(){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}mc.prototype.initialize=function(e,t){for(let n=0;n<50;++n)this.state[n]=0;this.blockSize=e/8,this.count=0,this.squeezing=!1},mc.prototype.absorb=function(e){for(let t=0;t<e.length;++t)this.state[~~(this.count/4)]^=e[t]<<8*(this.count%4),this.count+=1,this.count===this.blockSize&&(s0.p1600(this.state),this.count=0)},mc.prototype.absorbLastFewBits=function(e){this.state[~~(this.count/4)]^=e<<8*(this.count%4),e&128&&this.count===this.blockSize-1&&s0.p1600(this.state),this.state[~~((this.blockSize-1)/4)]^=128<<8*((this.blockSize-1)%4),s0.p1600(this.state),this.count=0,this.squeezing=!0},mc.prototype.squeeze=function(e){this.squeezing||this.absorbLastFewBits(1);const t=Buffer.alloc(e);for(let n=0;n<e;++n)t[n]=this.state[~~(this.count/4)]>>>8*(this.count%4)&255,this.count+=1,this.count===this.blockSize&&(s0.p1600(this.state),this.count=0);return t},mc.prototype.copy=function(e){for(let t=0;t<50;++t)e.state[t]=this.state[t];e.blockSize=this.blockSize,e.count=this.count,e.squeezing=this.squeezing};var gK=mc,yK=mK(gK);const bK=yK,wK=fh;function lk(e){return Buffer.allocUnsafe(e).fill(0)}function dk(e,t,n){const r=lk(t);return e=o0(e),n?e.length<t?(e.copy(r),r):e.slice(0,t):e.length<t?(e.copy(r,t-e.length),r):e.slice(-t)}function vK(e,t){return dk(e,t,!0)}function o0(e){if(!Buffer.isBuffer(e))if(Array.isArray(e))e=Buffer.from(e);else if(typeof e=="string")fk(e)?e=Buffer.from(xK(hk(e)),"hex"):e=Buffer.from(e);else if(typeof e=="number")e=intToBuffer(e);else if(e==null)e=Buffer.allocUnsafe(0);else if(wK.isBN(e))e=e.toArrayLike(Buffer);else if(e.toArray)e=Buffer.from(e.toArray());else throw new Error("invalid type");return e}function _K(e){return e=o0(e),"0x"+e.toString("hex")}function EK(e,t){return e=o0(e),t||(t=256),bK("keccak"+t).update(e).digest()}function xK(e){return e.length%2?"0"+e:e}function fk(e){return typeof e=="string"&&e.match(/^0x[0-9A-Fa-f]*$/)}function hk(e){return typeof e=="string"&&e.startsWith("0x")?e.slice(2):e}var pk={zeros:lk,setLength:dk,setLengthRight:vK,isHexString:fk,stripHexPrefix:hk,toBuffer:o0,bufferToHex:_K,keccak:EK};const Po=pk,Ro=fh;function mk(e){return e.startsWith("int[")?"int256"+e.slice(3):e==="int"?"int256":e.startsWith("uint[")?"uint256"+e.slice(4):e==="uint"?"uint256":e.startsWith("fixed[")?"fixed128x128"+e.slice(5):e==="fixed"?"fixed128x128":e.startsWith("ufixed[")?"ufixed128x128"+e.slice(6):e==="ufixed"?"ufixed128x128":e}function gc(e){return parseInt(/^\D+(\d+)$/.exec(e)[1],10)}function gk(e){var t=/^\D+(\d+)x(\d+)$/.exec(e);return[parseInt(t[1],10),parseInt(t[2],10)]}function yk(e){var t=e.match(/(.*)\[(.*?)\]$/);return t?t[2]===""?"dynamic":parseInt(t[2],10):null}function To(e){var t=typeof e;if(t==="string")return Po.isHexString(e)?new Ro(Po.stripHexPrefix(e),16):new Ro(e,10);if(t==="number")return new Ro(e);if(e.toArray)return e;throw new Error("Argument is not a number")}function si(e,t){var n,r,i,s;if(e==="address")return si("uint160",To(t));if(e==="bool")return si("uint8",t?1:0);if(e==="string")return si("bytes",new Buffer(t,"utf8"));if(kK(e)){if(typeof t.length>"u")throw new Error("Not an array?");if(n=yk(e),n!=="dynamic"&&n!==0&&t.length>n)throw new Error("Elements exceed array size: "+n);i=[],e=e.slice(0,e.lastIndexOf("[")),typeof t=="string"&&(t=JSON.parse(t));for(s in t)i.push(si(e,t[s]));if(n==="dynamic"){var o=si("uint256",t.length);i.unshift(o)}return Buffer.concat(i)}else{if(e==="bytes")return t=new Buffer(t),i=Buffer.concat([si("uint256",t.length),t]),t.length%32!==0&&(i=Buffer.concat([i,Po.zeros(32-t.length%32)])),i;if(e.startsWith("bytes")){if(n=gc(e),n<1||n>32)throw new Error("Invalid bytes<N> width: "+n);return Po.setLengthRight(t,32)}else if(e.startsWith("uint")){if(n=gc(e),n%8||n<8||n>256)throw new Error("Invalid uint<N> width: "+n);if(r=To(t),r.bitLength()>n)throw new Error("Supplied uint exceeds width: "+n+" vs "+r.bitLength());if(r<0)throw new Error("Supplied uint is negative");return r.toArrayLike(Buffer,"be",32)}else if(e.startsWith("int")){if(n=gc(e),n%8||n<8||n>256)throw new Error("Invalid int<N> width: "+n);if(r=To(t),r.bitLength()>n)throw new Error("Supplied int exceeds width: "+n+" vs "+r.bitLength());return r.toTwos(256).toArrayLike(Buffer,"be",32)}else if(e.startsWith("ufixed")){if(n=gk(e),r=To(t),r<0)throw new Error("Supplied ufixed is negative");return si("uint256",r.mul(new Ro(2).pow(new Ro(n[1]))))}else if(e.startsWith("fixed"))return n=gk(e),si("int256",To(t).mul(new Ro(2).pow(new Ro(n[1]))))}throw new Error("Unsupported or invalid type: "+e)}function SK(e){return e==="string"||e==="bytes"||yk(e)==="dynamic"}function kK(e){return e.lastIndexOf("]")===e.length-1}function AK(e,t){var n=[],r=[],i=32*e.length;for(var s in e){var o=mk(e[s]),a=t[s],c=si(o,a);SK(o)?(n.push(si("uint256",i)),r.push(c),i+=c.length):n.push(c)}return Buffer.concat(n.concat(r))}function bk(e,t){if(e.length!==t.length)throw new Error("Number of types are not matching the values");for(var n,r,i=[],s=0;s<e.length;s++){var o=mk(e[s]),a=t[s];if(o==="bytes")i.push(a);else if(o==="string")i.push(new Buffer(a,"utf8"));else if(o==="bool")i.push(new Buffer(a?"01":"00","hex"));else if(o==="address")i.push(Po.setLength(a,20));else if(o.startsWith("bytes")){if(n=gc(o),n<1||n>32)throw new Error("Invalid bytes<N> width: "+n);i.push(Po.setLengthRight(a,n))}else if(o.startsWith("uint")){if(n=gc(o),n%8||n<8||n>256)throw new Error("Invalid uint<N> width: "+n);if(r=To(a),r.bitLength()>n)throw new Error("Supplied uint exceeds width: "+n+" vs "+r.bitLength());i.push(r.toArrayLike(Buffer,"be",n/8))}else if(o.startsWith("int")){if(n=gc(o),n%8||n<8||n>256)throw new Error("Invalid int<N> width: "+n);if(r=To(a),r.bitLength()>n)throw new Error("Supplied int exceeds width: "+n+" vs "+r.bitLength());i.push(r.toTwos(n).toArrayLike(Buffer,"be",n/8))}else throw new Error("Unsupported or invalid type: "+o)}return Buffer.concat(i)}function IK(e,t){return Po.keccak(bk(e,t))}var CK={rawEncode:AK,solidityPack:bk,soliditySHA3:IK};const Dr=pk,Pl=CK,wk={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"]},E1={encodeData(e,t,n,r=!0){const i=["bytes32"],s=[this.hashType(e,n)];if(r){const o=(a,c,u)=>{if(n[c]!==void 0)return["bytes32",u==null?"0x0000000000000000000000000000000000000000000000000000000000000000":Dr.keccak(this.encodeData(c,u,n,r))];if(u===void 0)throw new Error(`missing value for field ${a} of type ${c}`);if(c==="bytes")return["bytes32",Dr.keccak(u)];if(c==="string")return typeof u=="string"&&(u=Buffer.from(u,"utf8")),["bytes32",Dr.keccak(u)];if(c.lastIndexOf("]")===c.length-1){const l=c.slice(0,c.lastIndexOf("[")),d=u.map(f=>o(a,l,f));return["bytes32",Dr.keccak(Pl.rawEncode(d.map(([f])=>f),d.map(([,f])=>f)))]}return[c,u]};for(const a of n[e]){const[c,u]=o(a.name,a.type,t[a.name]);i.push(c),s.push(u)}}else for(const o of n[e]){let a=t[o.name];if(a!==void 0)if(o.type==="bytes")i.push("bytes32"),a=Dr.keccak(a),s.push(a);else if(o.type==="string")i.push("bytes32"),typeof a=="string"&&(a=Buffer.from(a,"utf8")),a=Dr.keccak(a),s.push(a);else if(n[o.type]!==void 0)i.push("bytes32"),a=Dr.keccak(this.encodeData(o.type,a,n,r)),s.push(a);else{if(o.type.lastIndexOf("]")===o.type.length-1)throw new Error("Arrays currently unimplemented in encodeData");i.push(o.type),s.push(a)}}return Pl.rawEncode(i,s)},encodeType(e,t){let n="",r=this.findTypeDependencies(e,t).filter(i=>i!==e);r=[e].concat(r.sort());for(const i of r){if(!t[i])throw new Error("No type definition specified: "+i);n+=i+"("+t[i].map(({name:o,type:a})=>a+" "+o).join(",")+")"}return n},findTypeDependencies(e,t,n=[]){if(e=e.match(/^\w*/)[0],n.includes(e)||t[e]===void 0)return n;n.push(e);for(const r of t[e])for(const i of this.findTypeDependencies(r.type,t,n))!n.includes(i)&&n.push(i);return n},hashStruct(e,t,n,r=!0){return Dr.keccak(this.encodeData(e,t,n,r))},hashType(e,t){return Dr.keccak(this.encodeType(e,t))},sanitizeData(e){const t={};for(const n in wk.properties)e[n]&&(t[n]=e[n]);return t.types&&(t.types=Object.assign({EIP712Domain:[]},t.types)),t},hash(e,t=!0){const n=this.sanitizeData(e),r=[Buffer.from("1901","hex")];return r.push(this.hashStruct("EIP712Domain",n.domain,n.types,t)),n.primaryType!=="EIP712Domain"&&r.push(this.hashStruct(n.primaryType,n.message,n.types,t)),Dr.keccak(Buffer.concat(r))}};var PK={TYPED_MESSAGE_SCHEMA:wk,TypedDataUtils:E1,hashForSignTypedDataLegacy:function(e){return RK(e.data)},hashForSignTypedData_v3:function(e){return E1.hash(e.data,!1)},hashForSignTypedData_v4:function(e){return E1.hash(e.data)}};function RK(e){const t=new Error("Expect argument to be non-empty array");if(typeof e!="object"||!e.length)throw t;const n=e.map(function(s){return s.type==="bytes"?Dr.toBuffer(s.value):s.value}),r=e.map(function(s){return s.type}),i=e.map(function(s){if(!s.name)throw t;return s.type+" "+s.name});return Pl.soliditySHA3(["bytes32","bytes32"],[Pl.soliditySHA3(new Array(e.length).fill("string"),i),Pl.soliditySHA3(r,n)])}var yc={};Object.defineProperty(yc,"__esModule",{value:!0}),yc.filterFromParam=yc.FilterPolyfill=void 0;const bc=sn,jn=Ie,TK=5*60*1e3,Oo={jsonrpc:"2.0",id:0};class OK{constructor(t){this.logFilters=new Map,this.blockFilters=new Set,this.pendingTransactionFilters=new Set,this.cursors=new Map,this.timeouts=new Map,this.nextFilterId=(0,bc.IntNumber)(1),this.REQUEST_THROTTLE_INTERVAL=1e3,this.lastFetchTimestamp=new Date(0),this.resolvers=[],this.provider=t}async newFilter(t){const n=vk(t),r=this.makeFilterId(),i=await this.setInitialCursorPosition(r,n.fromBlock);return console.info(`Installing new log filter(${r}):`,n,"initial cursor position:",i),this.logFilters.set(r,n),this.setFilterTimeout(r),(0,jn.hexStringFromIntNumber)(r)}async newBlockFilter(){const t=this.makeFilterId(),n=await this.setInitialCursorPosition(t,"latest");return console.info(`Installing new block filter (${t}) with initial cursor position:`,n),this.blockFilters.add(t),this.setFilterTimeout(t),(0,jn.hexStringFromIntNumber)(t)}async newPendingTransactionFilter(){const t=this.makeFilterId(),n=await this.setInitialCursorPosition(t,"latest");return console.info(`Installing new block filter (${t}) with initial cursor position:`,n),this.pendingTransactionFilters.add(t),this.setFilterTimeout(t),(0,jn.hexStringFromIntNumber)(t)}uninstallFilter(t){const n=(0,jn.intNumberFromHexString)(t);return console.info(`Uninstalling filter (${n})`),this.deleteFilter(n),!0}getFilterChanges(t){const n=(0,jn.intNumberFromHexString)(t);return this.timeouts.has(n)&&this.setFilterTimeout(n),this.logFilters.has(n)?this.getLogFilterChanges(n):this.blockFilters.has(n)?this.getBlockFilterChanges(n):this.pendingTransactionFilters.has(n)?this.getPendingTransactionFilterChanges(n):Promise.resolve(a0())}async getFilterLogs(t){const n=(0,jn.intNumberFromHexString)(t),r=this.logFilters.get(n);return r?this.sendAsyncPromise(Object.assign(Object.assign({},Oo),{method:"eth_getLogs",params:[_k(r)]})):a0()}makeFilterId(){return(0,bc.IntNumber)(++this.nextFilterId)}sendAsyncPromise(t){return new Promise((n,r)=>{this.provider.sendAsync(t,(i,s)=>{if(i)return r(i);if(Array.isArray(s)||s==null)return r(new Error(`unexpected response received: ${JSON.stringify(s)}`));n(s)})})}deleteFilter(t){console.info(`Deleting filter (${t})`),this.logFilters.delete(t),this.blockFilters.delete(t),this.pendingTransactionFilters.delete(t),this.cursors.delete(t),this.timeouts.delete(t)}async getLogFilterChanges(t){const n=this.logFilters.get(t),r=this.cursors.get(t);if(!r||!n)return a0();const i=await this.getCurrentBlockHeight(),s=n.toBlock==="latest"?i:n.toBlock;if(r>i||r>Number(n.toBlock))return c0();console.info(`Fetching logs from ${r} to ${s} for filter ${t}`);const o=await this.sendAsyncPromise(Object.assign(Object.assign({},Oo),{method:"eth_getLogs",params:[_k(Object.assign(Object.assign({},n),{fromBlock:r,toBlock:s}))]}));if(Array.isArray(o.result)){const a=o.result.map(u=>(0,jn.intNumberFromHexString)(u.blockNumber||"0x0")),c=Math.max(...a);if(c&&c>r){const u=(0,bc.IntNumber)(c+1);console.info(`Moving cursor position for filter (${t}) from ${r} to ${u}`),this.cursors.set(t,u)}}return o}async getBlockFilterChanges(t){const n=this.cursors.get(t);if(!n)return a0();const r=await this.getCurrentBlockHeight();if(n>r)return c0();console.info(`Fetching blocks from ${n} to ${r} for filter (${t})`);const i=(await Promise.all((0,jn.range)(n,r+1).map(o=>this.getBlockHashByNumber((0,bc.IntNumber)(o))))).filter(o=>!!o),s=(0,bc.IntNumber)(n+i.length);return console.info(`Moving cursor position for filter (${t}) from ${n} to ${s}`),this.cursors.set(t,s),Object.assign(Object.assign({},Oo),{result:i})}async getPendingTransactionFilterChanges(t){return Promise.resolve(c0())}async setInitialCursorPosition(t,n){const r=await this.getCurrentBlockHeight(),i=typeof n=="number"&&n>r?n:r;return this.cursors.set(t,i),i}setFilterTimeout(t){const n=this.timeouts.get(t);n&&window.clearTimeout(n);const r=window.setTimeout(()=>{console.info(`Filter (${t}) timed out`),this.deleteFilter(t)},TK);this.timeouts.set(t,r)}async getCurrentBlockHeight(){const t=new Date;if(t.getTime()-this.lastFetchTimestamp.getTime()>this.REQUEST_THROTTLE_INTERVAL){this.lastFetchTimestamp=t;const n=await this._getCurrentBlockHeight();this.currentBlockHeight=n,this.resolvers.forEach(r=>r(n)),this.resolvers=[]}return this.currentBlockHeight?this.currentBlockHeight:new Promise(n=>this.resolvers.push(n))}async _getCurrentBlockHeight(){const{result:t}=await this.sendAsyncPromise(Object.assign(Object.assign({},Oo),{method:"eth_blockNumber",params:[]}));return(0,jn.intNumberFromHexString)((0,jn.ensureHexString)(t))}async getBlockHashByNumber(t){const n=await this.sendAsyncPromise(Object.assign(Object.assign({},Oo),{method:"eth_getBlockByNumber",params:[(0,jn.hexStringFromIntNumber)(t),!1]}));return n.result&&typeof n.result.hash=="string"?(0,jn.ensureHexString)(n.result.hash):null}}yc.FilterPolyfill=OK;function vk(e){return{fromBlock:Ek(e.fromBlock),toBlock:Ek(e.toBlock),addresses:e.address===void 0?null:Array.isArray(e.address)?e.address:[e.address],topics:e.topics||[]}}yc.filterFromParam=vk;function _k(e){const t={fromBlock:xk(e.fromBlock),toBlock:xk(e.toBlock),topics:e.topics};return e.addresses!==null&&(t.address=e.addresses),t}function Ek(e){if(e===void 0||e==="latest"||e==="pending")return"latest";if(e==="earliest")return(0,bc.IntNumber)(0);if((0,jn.isHexString)(e))return(0,jn.intNumberFromHexString)(e);throw new Error(`Invalid block option: ${String(e)}`)}function xk(e){return e==="latest"?e:(0,jn.hexStringFromIntNumber)(e)}function a0(){return Object.assign(Object.assign({},Oo),{error:{code:-32e3,message:"filter not found"}})}function c0(){return Object.assign(Object.assign({},Oo),{result:[]})}var u0={},Sk={},l0={},x1=MK;function MK(e){e=e||{};var t=e.max||Number.MAX_SAFE_INTEGER,n=typeof e.start<"u"?e.start:Math.floor(Math.random()*t);return function(){return n=n%t,n++}}const kk=(e,t)=>function(){const n=t.promiseModule,r=new Array(arguments.length);for(let i=0;i<arguments.length;i++)r[i]=arguments[i];return new n((i,s)=>{t.errorFirst?r.push(function(o,a){if(t.multiArgs){const c=new Array(arguments.length-1);for(let u=1;u<arguments.length;u++)c[u-1]=arguments[u];o?(c.unshift(o),s(c)):i(c)}else o?s(o):i(a)}):r.push(function(o){if(t.multiArgs){const a=new Array(arguments.length-1);for(let c=0;c<arguments.length;c++)a[c]=arguments[c];i(a)}else i(o)}),e.apply(this,r)})};var BK=(e,t)=>{t=Object.assign({exclude:[/.+(Sync|Stream)$/],errorFirst:!0,promiseModule:Promise},t);const n=i=>{const s=o=>typeof o=="string"?i===o:o.test(i);return t.include?t.include.some(s):!t.exclude.some(s)};let r;typeof e=="function"?r=function(){return t.excludeMain?e.apply(this,arguments):kk(e,t).apply(this,arguments)}:r=Object.create(Object.getPrototypeOf(e));for(const i in e){const s=e[i];r[i]=typeof s=="function"&&n(i)?kk(s,t):s}return r},Rl={},Tl={};Object.defineProperty(Tl,"__esModule",{value:!0});const NK=t0;function Ak(e,t,n){try{Reflect.apply(e,t,n)}catch(r){setTimeout(()=>{throw r})}}function LK(e){const t=e.length,n=new Array(t);for(let r=0;r<t;r+=1)n[r]=e[r];return n}let jK=class extends NK.EventEmitter{emit(t,...n){let r=t==="error";const i=this._events;if(i!==void 0)r=r&&i.error===void 0;else if(!r)return!1;if(r){let o;if(n.length>0&&([o]=n),o instanceof Error)throw o;const a=new Error(`Unhandled error.${o?` (${o.message})`:""}`);throw a.context=o,a}const s=i[t];if(s===void 0)return!1;if(typeof s=="function")Ak(s,this,n);else{const o=s.length,a=LK(s);for(let c=0;c<o;c+=1)Ak(a[c],this,n)}return!0}};Tl.default=jK;var $K=Pe&&Pe.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Rl,"__esModule",{value:!0}),Rl.BaseBlockTracker=void 0;const FK=$K(Tl),DK=1e3,UK=(e,t)=>e+t,Ik=["sync","latest"];class HK extends FK.default{constructor(t){super(),this._blockResetDuration=t.blockResetDuration||20*DK,this._usePastBlocks=t.usePastBlocks||!1,this._currentBlock=null,this._isRunning=!1,this._onNewListener=this._onNewListener.bind(this),this._onRemoveListener=this._onRemoveListener.bind(this),this._resetCurrentBlock=this._resetCurrentBlock.bind(this),this._setupInternalEvents()}async destroy(){this._cancelBlockResetTimeout(),await this._maybeEnd(),super.removeAllListeners()}isRunning(){return this._isRunning}getCurrentBlock(){return this._currentBlock}async getLatestBlock(){return this._currentBlock?this._currentBlock:await new Promise(n=>this.once("latest",n))}removeAllListeners(t){return t?super.removeAllListeners(t):super.removeAllListeners(),this._setupInternalEvents(),this._onRemoveListener(),this}_setupInternalEvents(){this.removeListener("newListener",this._onNewListener),this.removeListener("removeListener",this._onRemoveListener),this.on("newListener",this._onNewListener),this.on("removeListener",this._onRemoveListener)}_onNewListener(t){Ik.includes(t)&&this._maybeStart()}_onRemoveListener(){this._getBlockTrackerEventCount()>0||this._maybeEnd()}async _maybeStart(){this._isRunning||(this._isRunning=!0,this._cancelBlockResetTimeout(),await this._start(),this.emit("_started"))}async _maybeEnd(){this._isRunning&&(this._isRunning=!1,this._setupBlockResetTimeout(),await this._end(),this.emit("_ended"))}_getBlockTrackerEventCount(){return Ik.map(t=>this.listenerCount(t)).reduce(UK)}_shouldUseNewBlock(t){const n=this._currentBlock;if(!n)return!0;const r=Ck(t),i=Ck(n);return this._usePastBlocks&&r<i||r>i}_newPotentialLatest(t){this._shouldUseNewBlock(t)&&this._setCurrentBlock(t)}_setCurrentBlock(t){const n=this._currentBlock;this._currentBlock=t,this.emit("latest",t),this.emit("sync",{oldBlock:n,newBlock:t})}_setupBlockResetTimeout(){this._cancelBlockResetTimeout(),this._blockResetTimeout=setTimeout(this._resetCurrentBlock,this._blockResetDuration),this._blockResetTimeout.unref&&this._blockResetTimeout.unref()}_cancelBlockResetTimeout(){this._blockResetTimeout&&clearTimeout(this._blockResetTimeout)}_resetCurrentBlock(){this._currentBlock=null}}Rl.BaseBlockTracker=HK;function Ck(e){return Number.parseInt(e,16)}var Pk={},Rk={},wn={};class Tk extends TypeError{constructor(t,n){let r;const{message:i,explanation:s,...o}=t,{path:a}=t,c=a.length===0?i:`At path: ${a.join(".")} -- ${i}`;super(s??c),s!=null&&(this.cause=c),Object.assign(this,o),this.name=this.constructor.name,this.failures=()=>r??(r=[t,...n()])}}function zK(e){return _r(e)&&typeof e[Symbol.iterator]=="function"}function _r(e){return typeof e=="object"&&e!=null}function Ok(e){if(Object.prototype.toString.call(e)!=="[object Object]")return!1;const t=Object.getPrototypeOf(e);return t===null||t===Object.prototype}function on(e){return typeof e=="symbol"?e.toString():typeof e=="string"?JSON.stringify(e):`${e}`}function WK(e){const{done:t,value:n}=e.next();return t?void 0:n}function GK(e,t,n,r){if(e===!0)return;e===!1?e={}:typeof e=="string"&&(e={message:e});const{path:i,branch:s}=t,{type:o}=n,{refinement:a,message:c=`Expected a value of type \`${o}\`${a?` with refinement \`${a}\``:""}, but received: \`${on(r)}\``}=e;return{value:r,type:o,refinement:a,key:i[i.length-1],path:i,branch:s,...e,message:c}}function*S1(e,t,n,r){zK(e)||(e=[e]);for(const i of e){const s=GK(i,t,n,r);s&&(yield s)}}function*k1(e,t,n={}){const{path:r=[],branch:i=[e],coerce:s=!1,mask:o=!1}=n,a={path:r,branch:i};if(s&&(e=t.coercer(e,a),o&&t.type!=="type"&&_r(t.schema)&&_r(e)&&!Array.isArray(e)))for(const u in e)t.schema[u]===void 0&&delete e[u];let c="valid";for(const u of t.validator(e,a))u.explanation=n.message,c="not_valid",yield[u,void 0];for(let[u,l,d]of t.entries(e,a)){const f=k1(l,d,{path:u===void 0?r:[...r,u],branch:u===void 0?i:[...i,l],coerce:s,mask:o,message:n.message});for(const h of f)h[0]?(c=h[0].refinement!=null?"not_refined":"not_valid",yield[h[0],void 0]):s&&(l=h[1],u===void 0?e=l:e instanceof Map?e.set(u,l):e instanceof Set?e.add(l):_r(e)&&(l!==void 0||u in e)&&(e[u]=l))}if(c!=="not_valid")for(const u of t.refiner(e,a))u.explanation=n.message,c="not_refined",yield[u,void 0];c==="valid"&&(yield[void 0,e])}class Vt{constructor(t){const{type:n,schema:r,validator:i,refiner:s,coercer:o=c=>c,entries:a=function*(){}}=t;this.type=n,this.schema=r,this.entries=a,this.coercer=o,i?this.validator=(c,u)=>{const l=i(c,u);return S1(l,u,this,c)}:this.validator=()=>[],s?this.refiner=(c,u)=>{const l=s(c,u);return S1(l,u,this,c)}:this.refiner=()=>[]}assert(t,n){return Mk(t,this,n)}create(t,n){return Bk(t,this,n)}is(t){return A1(t,this)}mask(t,n){return Nk(t,this,n)}validate(t,n={}){return wc(t,this,n)}}function Mk(e,t,n){const r=wc(e,t,{message:n});if(r[0])throw r[0]}function Bk(e,t,n){const r=wc(e,t,{coerce:!0,message:n});if(r[0])throw r[0];return r[1]}function Nk(e,t,n){const r=wc(e,t,{coerce:!0,mask:!0,message:n});if(r[0])throw r[0];return r[1]}function A1(e,t){return!wc(e,t)[0]}function wc(e,t,n={}){const r=k1(e,t,n),i=WK(r);return i[0]?[new Tk(i[0],function*(){for(const o of r)o[0]&&(yield o[0])}),void 0]:[void 0,i[1]]}function qK(...e){const t=e[0].type==="type",n=e.map(i=>i.schema),r=Object.assign({},...n);return t?Ml(r):Ol(r)}function Yn(e,t){return new Vt({type:e,schema:null,validator:t})}function VK(e,t){return new Vt({...e,refiner:(n,r)=>n===void 0||e.refiner(n,r),validator(n,r){return n===void 0?!0:(t(n,r),e.validator(n,r))}})}function KK(e){return new Vt({type:"dynamic",schema:null,*entries(t,n){yield*e(t,n).entries(t,n)},validator(t,n){return e(t,n).validator(t,n)},coercer(t,n){return e(t,n).coercer(t,n)},refiner(t,n){return e(t,n).refiner(t,n)}})}function JK(e){let t;return new Vt({type:"lazy",schema:null,*entries(n,r){t??(t=e()),yield*t.entries(n,r)},validator(n,r){return t??(t=e()),t.validator(n,r)},coercer(n,r){return t??(t=e()),t.coercer(n,r)},refiner(n,r){return t??(t=e()),t.refiner(n,r)}})}function ZK(e,t){const{schema:n}=e,r={...n};for(const i of t)delete r[i];switch(e.type){case"type":return Ml(r);default:return Ol(r)}}function YK(e){const t=e instanceof Vt,n=t?{...e.schema}:{...e};for(const r in n)n[r]=Lk(n[r]);return t&&e.type==="type"?Ml(n):Ol(n)}function QK(e,t){const{schema:n}=e,r={};for(const i of t)r[i]=n[i];switch(e.type){case"type":return Ml(r);default:return Ol(r)}}function XK(e,t){return console.warn("superstruct@0.11 - The `struct` helper has been renamed to `define`."),Yn(e,t)}function eJ(){return Yn("any",()=>!0)}function tJ(e){return new Vt({type:"array",schema:e,*entries(t){if(e&&Array.isArray(t))for(const[n,r]of t.entries())yield[n,r,e]},coercer(t){return Array.isArray(t)?t.slice():t},validator(t){return Array.isArray(t)||`Expected an array value, but received: ${on(t)}`}})}function nJ(){return Yn("bigint",e=>typeof e=="bigint")}function rJ(){return Yn("boolean",e=>typeof e=="boolean")}function iJ(){return Yn("date",e=>e instanceof Date&&!isNaN(e.getTime())||`Expected a valid \`Date\` object, but received: ${on(e)}`)}function sJ(e){const t={},n=e.map(r=>on(r)).join();for(const r of e)t[r]=r;return new Vt({type:"enums",schema:t,validator(r){return e.includes(r)||`Expected one of \`${n}\`, but received: ${on(r)}`}})}function oJ(){return Yn("func",e=>typeof e=="function"||`Expected a function, but received: ${on(e)}`)}function aJ(e){return Yn("instance",t=>t instanceof e||`Expected a \`${e.name}\` instance, but received: ${on(t)}`)}function cJ(){return Yn("integer",e=>typeof e=="number"&&!isNaN(e)&&Number.isInteger(e)||`Expected an integer, but received: ${on(e)}`)}function uJ(e){return new Vt({type:"intersection",schema:null,*entries(t,n){for(const r of e)yield*r.entries(t,n)},*validator(t,n){for(const r of e)yield*r.validator(t,n)},*refiner(t,n){for(const r of e)yield*r.refiner(t,n)}})}function lJ(e){const t=on(e),n=typeof e;return new Vt({type:"literal",schema:n==="string"||n==="number"||n==="boolean"?e:null,validator(r){return r===e||`Expected the literal \`${t}\`, but received: ${on(r)}`}})}function dJ(e,t){return new Vt({type:"map",schema:null,*entries(n){if(e&&t&&n instanceof Map)for(const[r,i]of n.entries())yield[r,r,e],yield[r,i,t]},coercer(n){return n instanceof Map?new Map(n):n},validator(n){return n instanceof Map||`Expected a \`Map\` object, but received: ${on(n)}`}})}function I1(){return Yn("never",()=>!1)}function fJ(e){return new Vt({...e,validator:(t,n)=>t===null||e.validator(t,n),refiner:(t,n)=>t===null||e.refiner(t,n)})}function hJ(){return Yn("number",e=>typeof e=="number"&&!isNaN(e)||`Expected a number, but received: ${on(e)}`)}function Ol(e){const t=e?Object.keys(e):[],n=I1();return new Vt({type:"object",schema:e||null,*entries(r){if(e&&_r(r)){const i=new Set(Object.keys(r));for(const s of t)i.delete(s),yield[s,r[s],e[s]];for(const s of i)yield[s,r[s],n]}},validator(r){return _r(r)||`Expected an object, but received: ${on(r)}`},coercer(r){return _r(r)?{...r}:r}})}function Lk(e){return new Vt({...e,validator:(t,n)=>t===void 0||e.validator(t,n),refiner:(t,n)=>t===void 0||e.refiner(t,n)})}function pJ(e,t){return new Vt({type:"record",schema:null,*entries(n){if(_r(n))for(const r in n){const i=n[r];yield[r,r,e],yield[r,i,t]}},validator(n){return _r(n)||`Expected an object, but received: ${on(n)}`}})}function mJ(){return Yn("regexp",e=>e instanceof RegExp)}function gJ(e){return new Vt({type:"set",schema:null,*entries(t){if(e&&t instanceof Set)for(const n of t)yield[n,n,e]},coercer(t){return t instanceof Set?new Set(t):t},validator(t){return t instanceof Set||`Expected a \`Set\` object, but received: ${on(t)}`}})}function jk(){return Yn("string",e=>typeof e=="string"||`Expected a string, but received: ${on(e)}`)}function yJ(e){const t=I1();return new Vt({type:"tuple",schema:null,*entries(n){if(Array.isArray(n)){const r=Math.max(e.length,n.length);for(let i=0;i<r;i++)yield[i,n[i],e[i]||t]}},validator(n){return Array.isArray(n)||`Expected an array, but received: ${on(n)}`}})}function Ml(e){const t=Object.keys(e);return new Vt({type:"type",schema:e,*entries(n){if(_r(n))for(const r of t)yield[r,n[r],e[r]]},validator(n){return _r(n)||`Expected an object, but received: ${on(n)}`},coercer(n){return _r(n)?{...n}:n}})}function bJ(e){const t=e.map(n=>n.type).join(" | ");return new Vt({type:"union",schema:null,coercer(n){for(const r of e){const[i,s]=r.validate(n,{coerce:!0});if(!i)return s}return n},validator(n,r){const i=[];for(const s of e){const[...o]=k1(n,s,r),[a]=o;if(a[0])for(const[c]of o)c&&i.push(c);else return[]}return[`Expected the value to satisfy a union of \`${t}\`, but received: ${on(n)}`,...i]}})}function $k(){return Yn("unknown",()=>!0)}function C1(e,t,n){return new Vt({...e,coercer:(r,i)=>A1(r,t)?e.coercer(n(r,i),i):e.coercer(r,i)})}function wJ(e,t,n={}){return C1(e,$k(),r=>{const i=typeof t=="function"?t():t;if(r===void 0)return i;if(!n.strict&&Ok(r)&&Ok(i)){const s={...r};let o=!1;for(const a in i)s[a]===void 0&&(s[a]=i[a],o=!0);if(o)return s}return r})}function vJ(e){return C1(e,jk(),t=>t.trim())}function _J(e){return Mo(e,"empty",t=>{const n=Fk(t);return n===0||`Expected an empty ${e.type} but received one with a size of \`${n}\``})}function Fk(e){return e instanceof Map||e instanceof Set?e.size:e.length}function EJ(e,t,n={}){const{exclusive:r}=n;return Mo(e,"max",i=>r?i<t:i<=t||`Expected a ${e.type} less than ${r?"":"or equal to "}${t} but received \`${i}\``)}function xJ(e,t,n={}){const{exclusive:r}=n;return Mo(e,"min",i=>r?i>t:i>=t||`Expected a ${e.type} greater than ${r?"":"or equal to "}${t} but received \`${i}\``)}function SJ(e){return Mo(e,"nonempty",t=>Fk(t)>0||`Expected a nonempty ${e.type} but received an empty one`)}function kJ(e,t){return Mo(e,"pattern",n=>t.test(n)||`Expected a ${e.type} matching \`/${t.source}/\` but received "${n}"`)}function AJ(e,t,n=t){const r=`Expected a ${e.type}`,i=t===n?`of \`${t}\``:`between \`${t}\` and \`${n}\``;return Mo(e,"size",s=>{if(typeof s=="number"||s instanceof Date)return t<=s&&s<=n||`${r} ${i} but received \`${s}\``;if(s instanceof Map||s instanceof Set){const{size:o}=s;return t<=o&&o<=n||`${r} with a size ${i} but received one with a size of \`${o}\``}else{const{length:o}=s;return t<=o&&o<=n||`${r} with a length ${i} but received one with a length of \`${o}\``}})}function Mo(e,t,n){return new Vt({...e,*refiner(r,i){yield*e.refiner(r,i);const s=n(r,i),o=S1(s,i,e,r);for(const a of o)yield{...a,refinement:t}}})}const Bo=Zo(Object.freeze(Object.defineProperty({__proto__:null,Struct:Vt,StructError:Tk,any:eJ,array:tJ,assert:Mk,assign:qK,bigint:nJ,boolean:rJ,coerce:C1,create:Bk,date:iJ,defaulted:wJ,define:Yn,deprecated:VK,dynamic:KK,empty:_J,enums:sJ,func:oJ,instance:aJ,integer:cJ,intersection:uJ,is:A1,lazy:JK,literal:lJ,map:dJ,mask:Nk,max:EJ,min:xJ,never:I1,nonempty:SJ,nullable:fJ,number:hJ,object:Ol,omit:ZK,optional:Lk,partial:YK,pattern:kJ,pick:QK,record:pJ,refine:Mo,regexp:mJ,set:gJ,size:AJ,string:jk,struct:XK,trimmed:vJ,tuple:yJ,type:Ml,union:bJ,unknown:$k,validate:wc},Symbol.toStringTag,{value:"Module"})));Object.defineProperty(wn,"__esModule",{value:!0}),wn.assertExhaustive=wn.assertStruct=wn.assert=wn.AssertionError=void 0;const IJ=Bo;function CJ(e){return typeof e=="object"&&e!==null&&"message"in e}function PJ(e){var t,n;return typeof((n=(t=e==null?void 0:e.prototype)===null||t===void 0?void 0:t.constructor)===null||n===void 0?void 0:n.name)=="string"}function RJ(e){const t=CJ(e)?e.message:String(e);return t.endsWith(".")?t.slice(0,-1):t}function Dk(e,t){return PJ(e)?new e({message:t}):e({message:t})}class P1 extends Error{constructor(t){super(t.message),this.code="ERR_ASSERTION"}}wn.AssertionError=P1;function TJ(e,t="Assertion failed.",n=P1){if(!e)throw t instanceof Error?t:Dk(n,t)}wn.assert=TJ;function OJ(e,t,n="Assertion failed",r=P1){try{(0,IJ.assert)(e,t)}catch(i){throw Dk(r,`${n}: ${RJ(i)}.`)}}wn.assertStruct=OJ;function MJ(e){throw new Error("Invalid branch reached. Should be detected during compilation.")}wn.assertExhaustive=MJ;var Bl={};Object.defineProperty(Bl,"__esModule",{value:!0}),Bl.base64=void 0;const BJ=Bo,NJ=wn,LJ=(e,t={})=>{var n,r;const i=(n=t.paddingRequired)!==null&&n!==void 0?n:!1,s=(r=t.characterSet)!==null&&r!==void 0?r:"base64";let o;s==="base64"?o=String.raw`[A-Za-z0-9+\/]`:((0,NJ.assert)(s==="base64url"),o=String.raw`[-_A-Za-z0-9]`);let a;return i?a=new RegExp(`^(?:${o}{4})*(?:${o}{3}=|${o}{2}==)?$`,"u"):a=new RegExp(`^(?:${o}{4})*(?:${o}{2,3}|${o}{3}=|${o}{2}==)?$`,"u"),(0,BJ.pattern)(e,a)};Bl.base64=LJ;var it={},Nl={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.remove0x=e.add0x=e.assertIsStrictHexString=e.assertIsHexString=e.isStrictHexString=e.isHexString=e.StrictHexStruct=e.HexStruct=void 0;const t=Bo,n=wn;e.HexStruct=(0,t.pattern)((0,t.string)(),/^(?:0x)?[0-9a-f]+$/iu),e.StrictHexStruct=(0,t.pattern)((0,t.string)(),/^0x[0-9a-f]+$/iu);function r(u){return(0,t.is)(u,e.HexStruct)}e.isHexString=r;function i(u){return(0,t.is)(u,e.StrictHexStruct)}e.isStrictHexString=i;function s(u){(0,n.assert)(r(u),"Value must be a hexadecimal string.")}e.assertIsHexString=s;function o(u){(0,n.assert)(i(u),'Value must be a hexadecimal string, starting with "0x".')}e.assertIsStrictHexString=o;function a(u){return u.startsWith("0x")?u:u.startsWith("0X")?`0x${u.substring(2)}`:`0x${u}`}e.add0x=a;function c(u){return u.startsWith("0x")||u.startsWith("0X")?u.substring(2):u}e.remove0x=c})(Nl),Object.defineProperty(it,"__esModule",{value:!0}),it.createDataView=it.concatBytes=it.valueToBytes=it.stringToBytes=it.numberToBytes=it.signedBigIntToBytes=it.bigIntToBytes=it.hexToBytes=it.bytesToString=it.bytesToNumber=it.bytesToSignedBigInt=it.bytesToBigInt=it.bytesToHex=it.assertIsBytes=it.isBytes=void 0;const ar=wn,R1=Nl,Uk=48,Hk=58,zk=87;function jJ(){const e=[];return()=>{if(e.length===0)for(let t=0;t<256;t++)e.push(t.toString(16).padStart(2,"0"));return e}}const $J=jJ();function T1(e){return e instanceof Uint8Array}it.isBytes=T1;function vc(e){(0,ar.assert)(T1(e),"Value must be a Uint8Array.")}it.assertIsBytes=vc;function Wk(e){if(vc(e),e.length===0)return"0x";const t=$J(),n=new Array(e.length);for(let r=0;r<e.length;r++)n[r]=t[e[r]];return(0,R1.add0x)(n.join(""))}it.bytesToHex=Wk;function Gk(e){vc(e);const t=Wk(e);return BigInt(t)}it.bytesToBigInt=Gk;function FJ(e){vc(e);let t=BigInt(0);for(const n of e)t=(t<<BigInt(8))+BigInt(n);return BigInt.asIntN(e.length*8,t)}it.bytesToSignedBigInt=FJ;function DJ(e){vc(e);const t=Gk(e);return(0,ar.assert)(t<=BigInt(Number.MAX_SAFE_INTEGER),"Number is not a safe integer. Use `bytesToBigInt` instead."),Number(t)}it.bytesToNumber=DJ;function UJ(e){return vc(e),new TextDecoder().decode(e)}it.bytesToString=UJ;function d0(e){var t;if(((t=e==null?void 0:e.toLowerCase)===null||t===void 0?void 0:t.call(e))==="0x")return new Uint8Array;(0,R1.assertIsHexString)(e);const n=(0,R1.remove0x)(e).toLowerCase(),r=n.length%2===0?n:`0${n}`,i=new Uint8Array(r.length/2);for(let s=0;s<i.length;s++){const o=r.charCodeAt(s*2),a=r.charCodeAt(s*2+1),c=o-(o<Hk?Uk:zk),u=a-(a<Hk?Uk:zk);i[s]=c*16+u}return i}it.hexToBytes=d0;function qk(e){(0,ar.assert)(typeof e=="bigint","Value must be a bigint."),(0,ar.assert)(e>=BigInt(0),"Value must be a non-negative bigint.");const t=e.toString(16);return d0(t)}it.bigIntToBytes=qk;function HJ(e,t){(0,ar.assert)(t>0);const n=e>>BigInt(31);return!((~e&n)+(e&~n)>>BigInt(t*8+-1))}function zJ(e,t){(0,ar.assert)(typeof e=="bigint","Value must be a bigint."),(0,ar.assert)(typeof t=="number","Byte length must be a number."),(0,ar.assert)(t>0,"Byte length must be greater than 0."),(0,ar.assert)(HJ(e,t),"Byte length is too small to represent the given value.");let n=e;const r=new Uint8Array(t);for(let i=0;i<r.length;i++)r[i]=Number(BigInt.asUintN(8,n)),n>>=BigInt(8);return r.reverse()}it.signedBigIntToBytes=zJ;function Vk(e){(0,ar.assert)(typeof e=="number","Value must be a number."),(0,ar.assert)(e>=0,"Value must be a non-negative number."),(0,ar.assert)(Number.isSafeInteger(e),"Value is not a safe integer. Use `bigIntToBytes` instead.");const t=e.toString(16);return d0(t)}it.numberToBytes=Vk;function Kk(e){return(0,ar.assert)(typeof e=="string","Value must be a string."),new TextEncoder().encode(e)}it.stringToBytes=Kk;function Jk(e){if(typeof e=="bigint")return qk(e);if(typeof e=="number")return Vk(e);if(typeof e=="string")return e.startsWith("0x")?d0(e):Kk(e);if(T1(e))return e;throw new TypeError(`Unsupported value type: "${typeof e}".`)}it.valueToBytes=Jk;function WJ(e){const t=new Array(e.length);let n=0;for(let i=0;i<e.length;i++){const s=Jk(e[i]);t[i]=s,n+=s.length}const r=new Uint8Array(n);for(let i=0,s=0;i<t.length;i++)r.set(t[i],s),s+=t[i].length;return r}it.concatBytes=WJ;function GJ(e){if(typeof Buffer<"u"&&e instanceof Buffer){const t=e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength);return new DataView(t)}return new DataView(e.buffer,e.byteOffset,e.byteLength)}it.createDataView=GJ;var f0={};Object.defineProperty(f0,"__esModule",{value:!0}),f0.ChecksumStruct=void 0;const Zk=Bo,qJ=Bl;f0.ChecksumStruct=(0,Zk.size)((0,qJ.base64)((0,Zk.string)(),{paddingRequired:!0}),44,44);var oi={};Object.defineProperty(oi,"__esModule",{value:!0}),oi.createHex=oi.createBytes=oi.createBigInt=oi.createNumber=void 0;const Nt=Bo,VJ=wn,Yk=it,h0=Nl,Qk=(0,Nt.union)([(0,Nt.number)(),(0,Nt.bigint)(),(0,Nt.string)(),h0.StrictHexStruct]),KJ=(0,Nt.coerce)((0,Nt.number)(),Qk,Number),JJ=(0,Nt.coerce)((0,Nt.bigint)(),Qk,BigInt);(0,Nt.union)([h0.StrictHexStruct,(0,Nt.instance)(Uint8Array)]);const ZJ=(0,Nt.coerce)((0,Nt.instance)(Uint8Array),(0,Nt.union)([h0.StrictHexStruct]),Yk.hexToBytes),YJ=(0,Nt.coerce)(h0.StrictHexStruct,(0,Nt.instance)(Uint8Array),Yk.bytesToHex);function QJ(e){try{const t=(0,Nt.create)(e,KJ);return(0,VJ.assert)(Number.isFinite(t),`Expected a number-like value, got "${e}".`),t}catch(t){throw t instanceof Nt.StructError?new Error(`Expected a number-like value, got "${e}".`):t}}oi.createNumber=QJ;function XJ(e){try{return(0,Nt.create)(e,JJ)}catch(t){throw t instanceof Nt.StructError?new Error(`Expected a number-like value, got "${String(t.value)}".`):t}}oi.createBigInt=XJ;function eZ(e){if(typeof e=="string"&&e.toLowerCase()==="0x")return new Uint8Array;try{return(0,Nt.create)(e,ZJ)}catch(t){throw t instanceof Nt.StructError?new Error(`Expected a bytes-like value, got "${String(t.value)}".`):t}}oi.createBytes=eZ;function tZ(e){if(e instanceof Uint8Array&&e.length===0||typeof e=="string"&&e.toLowerCase()==="0x")return"0x";try{return(0,Nt.create)(e,YJ)}catch(t){throw t instanceof Nt.StructError?new Error(`Expected a bytes-like value, got "${String(t.value)}".`):t}}oi.createHex=tZ;var _c={},Xk=Pe&&Pe.__classPrivateFieldSet||function(e,t,n,r,i){if(r==="m")throw new TypeError("Private method is not writable");if(r==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof t=="function"?e!==t||!i:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return r==="a"?i.call(e,n):i?i.value=n:t.set(e,n),n},$n=Pe&&Pe.__classPrivateFieldGet||function(e,t,n,r){if(n==="a"&&!r)throw new TypeError("Private accessor was defined without a getter");if(typeof t=="function"?e!==t||!r:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return n==="m"?r:n==="a"?r.call(e):r?r.value:t.get(e)},Ur,ai;Object.defineProperty(_c,"__esModule",{value:!0}),_c.FrozenSet=_c.FrozenMap=void 0;class O1{constructor(t){Ur.set(this,void 0),Xk(this,Ur,new Map(t),"f"),Object.freeze(this)}get size(){return $n(this,Ur,"f").size}[(Ur=new WeakMap,Symbol.iterator)](){return $n(this,Ur,"f")[Symbol.iterator]()}entries(){return $n(this,Ur,"f").entries()}forEach(t,n){return $n(this,Ur,"f").forEach((r,i,s)=>t.call(n,r,i,this))}get(t){return $n(this,Ur,"f").get(t)}has(t){return $n(this,Ur,"f").has(t)}keys(){return $n(this,Ur,"f").keys()}values(){return $n(this,Ur,"f").values()}toString(){return`FrozenMap(${this.size}) {${this.size>0?` ${[...this.entries()].map(([t,n])=>`${String(t)} => ${String(n)}`).join(", ")} `:""}}`}}_c.FrozenMap=O1;class M1{constructor(t){ai.set(this,void 0),Xk(this,ai,new Set(t),"f"),Object.freeze(this)}get size(){return $n(this,ai,"f").size}[(ai=new WeakMap,Symbol.iterator)](){return $n(this,ai,"f")[Symbol.iterator]()}entries(){return $n(this,ai,"f").entries()}forEach(t,n){return $n(this,ai,"f").forEach((r,i,s)=>t.call(n,r,i,this))}has(t){return $n(this,ai,"f").has(t)}keys(){return $n(this,ai,"f").keys()}values(){return $n(this,ai,"f").values()}toString(){return`FrozenSet(${this.size}) {${this.size>0?` ${[...this.values()].map(t=>String(t)).join(", ")} `:""}}`}}_c.FrozenSet=M1,Object.freeze(O1),Object.freeze(O1.prototype),Object.freeze(M1),Object.freeze(M1.prototype);var eA={};Object.defineProperty(eA,"__esModule",{value:!0});var tA={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.getJsonRpcIdValidator=e.assertIsJsonRpcError=e.isJsonRpcError=e.assertIsJsonRpcFailure=e.isJsonRpcFailure=e.assertIsJsonRpcSuccess=e.isJsonRpcSuccess=e.assertIsJsonRpcResponse=e.isJsonRpcResponse=e.assertIsPendingJsonRpcResponse=e.isPendingJsonRpcResponse=e.JsonRpcResponseStruct=e.JsonRpcFailureStruct=e.JsonRpcSuccessStruct=e.PendingJsonRpcResponseStruct=e.assertIsJsonRpcRequest=e.isJsonRpcRequest=e.assertIsJsonRpcNotification=e.isJsonRpcNotification=e.JsonRpcNotificationStruct=e.JsonRpcRequestStruct=e.JsonRpcParamsStruct=e.JsonRpcErrorStruct=e.JsonRpcIdStruct=e.JsonRpcVersionStruct=e.jsonrpc2=e.getJsonSize=e.isValidJson=e.JsonStruct=e.UnsafeJsonStruct=void 0;const t=Bo,n=wn,r=()=>(0,t.define)("finite number",I=>(0,t.is)(I,(0,t.number)())&&Number.isFinite(I));e.UnsafeJsonStruct=(0,t.union)([(0,t.literal)(null),(0,t.boolean)(),r(),(0,t.string)(),(0,t.array)((0,t.lazy)(()=>e.UnsafeJsonStruct)),(0,t.record)((0,t.string)(),(0,t.lazy)(()=>e.UnsafeJsonStruct))]),e.JsonStruct=(0,t.define)("Json",(I,N)=>{function j(U,L){const Z=[...L.validator(U,N)];return Z.length>0?Z:!0}try{const U=j(I,e.UnsafeJsonStruct);return U!==!0?U:j(JSON.parse(JSON.stringify(I)),e.UnsafeJsonStruct)}catch(U){return U instanceof RangeError?"Circular reference detected":!1}});function i(I){return(0,t.is)(I,e.JsonStruct)}e.isValidJson=i;function s(I){(0,n.assertStruct)(I,e.JsonStruct,"Invalid JSON value");const N=JSON.stringify(I);return new TextEncoder().encode(N).byteLength}e.getJsonSize=s,e.jsonrpc2="2.0",e.JsonRpcVersionStruct=(0,t.literal)(e.jsonrpc2),e.JsonRpcIdStruct=(0,t.nullable)((0,t.union)([(0,t.number)(),(0,t.string)()])),e.JsonRpcErrorStruct=(0,t.object)({code:(0,t.integer)(),message:(0,t.string)(),data:(0,t.optional)(e.JsonStruct),stack:(0,t.optional)((0,t.string)())}),e.JsonRpcParamsStruct=(0,t.optional)((0,t.union)([(0,t.record)((0,t.string)(),e.JsonStruct),(0,t.array)(e.JsonStruct)])),e.JsonRpcRequestStruct=(0,t.object)({id:e.JsonRpcIdStruct,jsonrpc:e.JsonRpcVersionStruct,method:(0,t.string)(),params:e.JsonRpcParamsStruct}),e.JsonRpcNotificationStruct=(0,t.omit)(e.JsonRpcRequestStruct,["id"]);function o(I){return(0,t.is)(I,e.JsonRpcNotificationStruct)}e.isJsonRpcNotification=o;function a(I,N){(0,n.assertStruct)(I,e.JsonRpcNotificationStruct,"Invalid JSON-RPC notification",N)}e.assertIsJsonRpcNotification=a;function c(I){return(0,t.is)(I,e.JsonRpcRequestStruct)}e.isJsonRpcRequest=c;function u(I,N){(0,n.assertStruct)(I,e.JsonRpcRequestStruct,"Invalid JSON-RPC request",N)}e.assertIsJsonRpcRequest=u,e.PendingJsonRpcResponseStruct=(0,t.object)({id:e.JsonRpcIdStruct,jsonrpc:e.JsonRpcVersionStruct,result:(0,t.optional)((0,t.unknown)()),error:(0,t.optional)(e.JsonRpcErrorStruct)}),e.JsonRpcSuccessStruct=(0,t.object)({id:e.JsonRpcIdStruct,jsonrpc:e.JsonRpcVersionStruct,result:e.JsonStruct}),e.JsonRpcFailureStruct=(0,t.object)({id:e.JsonRpcIdStruct,jsonrpc:e.JsonRpcVersionStruct,error:e.JsonRpcErrorStruct}),e.JsonRpcResponseStruct=(0,t.union)([e.JsonRpcSuccessStruct,e.JsonRpcFailureStruct]);function l(I){return(0,t.is)(I,e.PendingJsonRpcResponseStruct)}e.isPendingJsonRpcResponse=l;function d(I,N){(0,n.assertStruct)(I,e.PendingJsonRpcResponseStruct,"Invalid pending JSON-RPC response",N)}e.assertIsPendingJsonRpcResponse=d;function f(I){return(0,t.is)(I,e.JsonRpcResponseStruct)}e.isJsonRpcResponse=f;function h(I,N){(0,n.assertStruct)(I,e.JsonRpcResponseStruct,"Invalid JSON-RPC response",N)}e.assertIsJsonRpcResponse=h;function m(I){return(0,t.is)(I,e.JsonRpcSuccessStruct)}e.isJsonRpcSuccess=m;function y(I,N){(0,n.assertStruct)(I,e.JsonRpcSuccessStruct,"Invalid JSON-RPC success response",N)}e.assertIsJsonRpcSuccess=y;function w(I){return(0,t.is)(I,e.JsonRpcFailureStruct)}e.isJsonRpcFailure=w;function b(I,N){(0,n.assertStruct)(I,e.JsonRpcFailureStruct,"Invalid JSON-RPC failure response",N)}e.assertIsJsonRpcFailure=b;function x(I){return(0,t.is)(I,e.JsonRpcErrorStruct)}e.isJsonRpcError=x;function v(I,N){(0,n.assertStruct)(I,e.JsonRpcErrorStruct,"Invalid JSON-RPC error",N)}e.assertIsJsonRpcError=v;function S(I){const{permitEmptyString:N,permitFractions:j,permitNull:U}=Object.assign({permitEmptyString:!0,permitFractions:!1,permitNull:!0},I);return Y=>!!(typeof Y=="number"&&(j||Number.isInteger(Y))||typeof Y=="string"&&(N||Y.length>0)||U&&Y===null)}e.getJsonRpcIdValidator=S})(tA);var nA={};Object.defineProperty(nA,"__esModule",{value:!0});var Ec={},nZ=Pe&&Pe.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Ec,"__esModule",{value:!0}),Ec.createModuleLogger=Ec.createProjectLogger=void 0;const rZ=(0,nZ(SN).default)("metamask");function iZ(e){return rZ.extend(e)}Ec.createProjectLogger=iZ;function sZ(e,t){return e.extend(t)}Ec.createModuleLogger=sZ;var rA={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.calculateNumberSize=e.calculateStringSize=e.isASCII=e.isPlainObject=e.ESCAPE_CHARACTERS_REGEXP=e.JsonSize=e.hasProperty=e.isObject=e.isNullOrUndefined=e.isNonEmptyArray=void 0;function t(u){return Array.isArray(u)&&u.length>0}e.isNonEmptyArray=t;function n(u){return u==null}e.isNullOrUndefined=n;function r(u){return!!u&&typeof u=="object"&&!Array.isArray(u)}e.isObject=r;const i=(u,l)=>Object.hasOwnProperty.call(u,l);e.hasProperty=i,function(u){u[u.Null=4]="Null",u[u.Comma=1]="Comma",u[u.Wrapper=1]="Wrapper",u[u.True=4]="True",u[u.False=5]="False",u[u.Quote=1]="Quote",u[u.Colon=1]="Colon",u[u.Date=24]="Date"}(e.JsonSize||(e.JsonSize={})),e.ESCAPE_CHARACTERS_REGEXP=/"|\\|\n|\r|\t/gu;function s(u){if(typeof u!="object"||u===null)return!1;try{let l=u;for(;Object.getPrototypeOf(l)!==null;)l=Object.getPrototypeOf(l);return Object.getPrototypeOf(u)===l}catch{return!1}}e.isPlainObject=s;function o(u){return u.charCodeAt(0)<=127}e.isASCII=o;function a(u){var l;return u.split("").reduce((f,h)=>o(h)?f+1:f+2,0)+((l=u.match(e.ESCAPE_CHARACTERS_REGEXP))!==null&&l!==void 0?l:[]).length}e.calculateStringSize=a;function c(u){return u.toString().length}e.calculateNumberSize=c})(rA);var ci={};Object.defineProperty(ci,"__esModule",{value:!0}),ci.hexToBigInt=ci.hexToNumber=ci.bigIntToHex=ci.numberToHex=void 0;const xc=wn,Ll=Nl,oZ=e=>((0,xc.assert)(typeof e=="number","Value must be a number."),(0,xc.assert)(e>=0,"Value must be a non-negative number."),(0,xc.assert)(Number.isSafeInteger(e),"Value is not a safe integer. Use `bigIntToHex` instead."),(0,Ll.add0x)(e.toString(16)));ci.numberToHex=oZ;const aZ=e=>((0,xc.assert)(typeof e=="bigint","Value must be a bigint."),(0,xc.assert)(e>=0,"Value must be a non-negative bigint."),(0,Ll.add0x)(e.toString(16)));ci.bigIntToHex=aZ;const cZ=e=>{(0,Ll.assertIsHexString)(e);const t=parseInt(e,16);return(0,xc.assert)(Number.isSafeInteger(t),"Value is not a safe integer. Use `hexToBigInt` instead."),t};ci.hexToNumber=cZ;const uZ=e=>((0,Ll.assertIsHexString)(e),BigInt((0,Ll.add0x)(e)));ci.hexToBigInt=uZ;var iA={};Object.defineProperty(iA,"__esModule",{value:!0});var sA={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.timeSince=e.inMilliseconds=e.Duration=void 0,function(s){s[s.Millisecond=1]="Millisecond",s[s.Second=1e3]="Second",s[s.Minute=6e4]="Minute",s[s.Hour=36e5]="Hour",s[s.Day=864e5]="Day",s[s.Week=6048e5]="Week",s[s.Year=31536e6]="Year"}(e.Duration||(e.Duration={}));const t=s=>Number.isInteger(s)&&s>=0,n=(s,o)=>{if(!t(s))throw new Error(`"${o}" must be a non-negative integer. Received: "${s}".`)};function r(s,o){return n(s,"count"),s*o}e.inMilliseconds=r;function i(s){return n(s,"timestamp"),Date.now()-s}e.timeSince=i})(sA);var oA={};Object.defineProperty(oA,"__esModule",{value:!0});var aA={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.satisfiesVersionRange=e.gtRange=e.gtVersion=e.assertIsSemVerRange=e.assertIsSemVerVersion=e.isValidSemVerRange=e.isValidSemVerVersion=e.VersionRangeStruct=e.VersionStruct=void 0;const t=fL,n=Bo,r=wn;e.VersionStruct=(0,n.refine)((0,n.string)(),"Version",d=>(0,t.valid)(d)===null?`Expected SemVer version, got "${d}"`:!0),e.VersionRangeStruct=(0,n.refine)((0,n.string)(),"Version range",d=>(0,t.validRange)(d)===null?`Expected SemVer range, got "${d}"`:!0);function i(d){return(0,n.is)(d,e.VersionStruct)}e.isValidSemVerVersion=i;function s(d){return(0,n.is)(d,e.VersionRangeStruct)}e.isValidSemVerRange=s;function o(d){(0,r.assertStruct)(d,e.VersionStruct)}e.assertIsSemVerVersion=o;function a(d){(0,r.assertStruct)(d,e.VersionRangeStruct)}e.assertIsSemVerRange=a;function c(d,f){return(0,t.gt)(d,f)}e.gtVersion=c;function u(d,f){return(0,t.gtr)(d,f)}e.gtRange=u;function l(d,f){return(0,t.satisfies)(d,f,{includePrerelease:!0})}e.satisfiesVersionRange=l})(aA),function(e){var t=Pe&&Pe.__createBinding||(Object.create?function(r,i,s,o){o===void 0&&(o=s);var a=Object.getOwnPropertyDescriptor(i,s);(!a||("get"in a?!i.__esModule:a.writable||a.configurable))&&(a={enumerable:!0,get:function(){return i[s]}}),Object.defineProperty(r,o,a)}:function(r,i,s,o){o===void 0&&(o=s),r[o]=i[s]}),n=Pe&&Pe.__exportStar||function(r,i){for(var s in r)s!=="default"&&!Object.prototype.hasOwnProperty.call(i,s)&&t(i,r,s)};Object.defineProperty(e,"__esModule",{value:!0}),n(wn,e),n(Bl,e),n(it,e),n(f0,e),n(oi,e),n(_c,e),n(eA,e),n(Nl,e),n(tA,e),n(nA,e),n(Ec,e),n(rA,e),n(ci,e),n(iA,e),n(sA,e),n(oA,e),n(aA,e)}(Rk),function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.createModuleLogger=e.projectLogger=void 0;const t=Rk;Object.defineProperty(e,"createModuleLogger",{enumerable:!0,get:function(){return t.createModuleLogger}}),e.projectLogger=(0,t.createProjectLogger)("eth-block-tracker")}(Pk);var cA=Pe&&Pe.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(l0,"__esModule",{value:!0}),l0.PollingBlockTracker=void 0;const lZ=cA(x1),dZ=cA(BK),fZ=Rl,uA=Pk,lA=(0,uA.createModuleLogger)(uA.projectLogger,"polling-block-tracker"),hZ=(0,lZ.default)(),pZ=1e3;class mZ extends fZ.BaseBlockTracker{constructor(t={}){var n;if(!t.provider)throw new Error("PollingBlockTracker - no provider specified.");super(Object.assign(Object.assign({},t),{blockResetDuration:(n=t.blockResetDuration)!==null&&n!==void 0?n:t.pollingInterval})),this._provider=t.provider,this._pollingInterval=t.pollingInterval||20*pZ,this._retryTimeout=t.retryTimeout||this._pollingInterval/10,this._keepEventLoopActive=t.keepEventLoopActive===void 0?!0:t.keepEventLoopActive,this._setSkipCacheFlag=t.setSkipCacheFlag||!1}async checkForLatestBlock(){return await this._updateLatestBlock(),await this.getLatestBlock()}async _start(){this._synchronize()}async _end(){}async _synchronize(){for(var t;this._isRunning;)try{await this._updateLatestBlock();const n=dA(this._pollingInterval,!this._keepEventLoopActive);this.emit("_waitingForNextIteration"),await n}catch(n){const r=new Error(`PollingBlockTracker - encountered an error while attempting to update latest block:
127
+ ${(t=n.stack)!==null&&t!==void 0?t:n}`);try{this.emit("error",r)}catch{console.error(r)}const i=dA(this._retryTimeout,!this._keepEventLoopActive);this.emit("_waitingForNextIteration"),await i}}async _updateLatestBlock(){const t=await this._fetchLatestBlock();this._newPotentialLatest(t)}async _fetchLatestBlock(){const t={jsonrpc:"2.0",id:hZ(),method:"eth_blockNumber",params:[]};this._setSkipCacheFlag&&(t.skipCache=!0),lA("Making request",t);const n=await(0,dZ.default)(r=>this._provider.sendAsync(t,r))();if(lA("Got response",n),n.error)throw new Error(`PollingBlockTracker - encountered error fetching block:
128
+ ${n.error.message}`);return n.result}}l0.PollingBlockTracker=mZ;function dA(e,t){return new Promise(n=>{const r=setTimeout(n,e);r.unref&&t&&r.unref()})}var p0={},gZ=Pe&&Pe.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(p0,"__esModule",{value:!0}),p0.SubscribeBlockTracker=void 0;const yZ=gZ(x1),bZ=Rl,wZ=(0,yZ.default)();class vZ extends bZ.BaseBlockTracker{constructor(t={}){if(!t.provider)throw new Error("SubscribeBlockTracker - no provider specified.");super(t),this._provider=t.provider,this._subscriptionId=null}async checkForLatestBlock(){return await this.getLatestBlock()}async _start(){if(this._subscriptionId===void 0||this._subscriptionId===null)try{const t=await this._call("eth_blockNumber");this._subscriptionId=await this._call("eth_subscribe","newHeads"),this._provider.on("data",this._handleSubData.bind(this)),this._newPotentialLatest(t)}catch(t){this.emit("error",t)}}async _end(){if(this._subscriptionId!==null&&this._subscriptionId!==void 0)try{await this._call("eth_unsubscribe",this._subscriptionId),this._subscriptionId=null}catch(t){this.emit("error",t)}}_call(t,...n){return new Promise((r,i)=>{this._provider.sendAsync({id:wZ(),method:t,params:n,jsonrpc:"2.0"},(s,o)=>{s?i(s):r(o.result)})})}_handleSubData(t,n){var r;n.method==="eth_subscription"&&((r=n.params)===null||r===void 0?void 0:r.subscription)===this._subscriptionId&&this._newPotentialLatest(n.params.result.number)}}p0.SubscribeBlockTracker=vZ,function(e){var t=Pe&&Pe.__createBinding||(Object.create?function(r,i,s,o){o===void 0&&(o=s),Object.defineProperty(r,o,{enumerable:!0,get:function(){return i[s]}})}:function(r,i,s,o){o===void 0&&(o=s),r[o]=i[s]}),n=Pe&&Pe.__exportStar||function(r,i){for(var s in r)s!=="default"&&!Object.prototype.hasOwnProperty.call(i,s)&&t(i,r,s)};Object.defineProperty(e,"__esModule",{value:!0}),n(l0,e),n(p0,e)}(Sk);var B1={},m0={},jl={};Object.defineProperty(jl,"__esModule",{value:!0}),jl.getUniqueId=void 0;const fA=4294967295;let N1=Math.floor(Math.random()*fA);function _Z(){return N1=(N1+1)%fA,N1}jl.getUniqueId=_Z,Object.defineProperty(m0,"__esModule",{value:!0}),m0.createIdRemapMiddleware=void 0;const EZ=jl;function xZ(){return(e,t,n,r)=>{const i=e.id,s=EZ.getUniqueId();e.id=s,t.id=s,n(o=>{e.id=i,t.id=i,o()})}}m0.createIdRemapMiddleware=xZ;var g0={};Object.defineProperty(g0,"__esModule",{value:!0}),g0.createAsyncMiddleware=void 0;function SZ(e){return async(t,n,r,i)=>{let s;const o=new Promise(l=>{s=l});let a=null,c=!1;const u=async()=>{c=!0,r(l=>{a=l,s()}),await o};try{await e(t,n,u),c?(await o,a(null)):i(null)}catch(l){a?a(l):i(l)}}}g0.createAsyncMiddleware=SZ;var y0={};Object.defineProperty(y0,"__esModule",{value:!0}),y0.createScaffoldMiddleware=void 0;function kZ(e){return(t,n,r,i)=>{const s=e[t.method];return s===void 0?r():typeof s=="function"?s(t,n,r,i):(n.result=s,i())}}y0.createScaffoldMiddleware=kZ;var $l={},L1={};Object.defineProperty(L1,"__esModule",{value:!0});const AZ=t0;function hA(e,t,n){try{Reflect.apply(e,t,n)}catch(r){setTimeout(()=>{throw r})}}function IZ(e){const t=e.length,n=new Array(t);for(let r=0;r<t;r+=1)n[r]=e[r];return n}let CZ=class extends AZ.EventEmitter{emit(t,...n){let r=t==="error";const i=this._events;if(i!==void 0)r=r&&i.error===void 0;else if(!r)return!1;if(r){let o;if(n.length>0&&([o]=n),o instanceof Error)throw o;const a=new Error(`Unhandled error.${o?` (${o.message})`:""}`);throw a.context=o,a}const s=i[t];if(s===void 0)return!1;if(typeof s=="function")hA(s,this,n);else{const o=s.length,a=IZ(s);for(let c=0;c<o;c+=1)hA(a[c],this,n)}return!0}};L1.default=CZ;var pA={},Cs={};Object.defineProperty(Cs,"__esModule",{value:!0}),Cs.EthereumProviderError=Cs.EthereumRpcError=void 0;const PZ=hL;class mA extends Error{constructor(t,n,r){if(!Number.isInteger(t))throw new Error('"code" must be an integer.');if(!n||typeof n!="string")throw new Error('"message" must be a nonempty string.');super(n),this.code=t,r!==void 0&&(this.data=r)}serialize(){const t={code:this.code,message:this.message};return this.data!==void 0&&(t.data=this.data),this.stack&&(t.stack=this.stack),t}toString(){return PZ.default(this.serialize(),OZ,2)}}Cs.EthereumRpcError=mA;class RZ extends mA{constructor(t,n,r){if(!TZ(t))throw new Error('"code" must be an integer such that: 1000 <= code <= 4999');super(t,n,r)}}Cs.EthereumProviderError=RZ;function TZ(e){return Number.isInteger(e)&&e>=1e3&&e<=4999}function OZ(e,t){if(t!=="[Circular]")return t}var j1={},Ps={};Object.defineProperty(Ps,"__esModule",{value:!0}),Ps.errorValues=Ps.errorCodes=void 0,Ps.errorCodes={rpc:{invalidInput:-32e3,resourceNotFound:-32001,resourceUnavailable:-32002,transactionRejected:-32003,methodNotSupported:-32004,limitExceeded:-32005,parse:-32700,invalidRequest:-32600,methodNotFound:-32601,invalidParams:-32602,internal:-32603},provider:{userRejectedRequest:4001,unauthorized:4100,unsupportedMethod:4200,disconnected:4900,chainDisconnected:4901}},Ps.errorValues={"-32700":{standard:"JSON RPC 2.0",message:"Invalid JSON was received by the server. An error occurred on the server while parsing the JSON text."},"-32600":{standard:"JSON RPC 2.0",message:"The JSON sent is not a valid Request object."},"-32601":{standard:"JSON RPC 2.0",message:"The method does not exist / is not available."},"-32602":{standard:"JSON RPC 2.0",message:"Invalid method parameter(s)."},"-32603":{standard:"JSON RPC 2.0",message:"Internal JSON-RPC error."},"-32000":{standard:"EIP-1474",message:"Invalid input."},"-32001":{standard:"EIP-1474",message:"Resource not found."},"-32002":{standard:"EIP-1474",message:"Resource unavailable."},"-32003":{standard:"EIP-1474",message:"Transaction rejected."},"-32004":{standard:"EIP-1474",message:"Method not supported."},"-32005":{standard:"EIP-1474",message:"Request limit exceeded."},4001:{standard:"EIP-1193",message:"User rejected the request."},4100:{standard:"EIP-1193",message:"The requested account and/or method has not been authorized by the user."},4200:{standard:"EIP-1193",message:"The requested method is not supported by this Ethereum provider."},4900:{standard:"EIP-1193",message:"The provider is disconnected from all chains."},4901:{standard:"EIP-1193",message:"The provider is disconnected from the specified chain."}},function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.serializeError=e.isValidCode=e.getMessageFromCode=e.JSON_RPC_SERVER_ERROR_MESSAGE=void 0;const t=Ps,n=Cs,r=t.errorCodes.rpc.internal,i="Unspecified error message. This is a bug, please report it.",s={code:r,message:o(r)};e.JSON_RPC_SERVER_ERROR_MESSAGE="Unspecified server error.";function o(f,h=i){if(Number.isInteger(f)){const m=f.toString();if(d(t.errorValues,m))return t.errorValues[m].message;if(u(f))return e.JSON_RPC_SERVER_ERROR_MESSAGE}return h}e.getMessageFromCode=o;function a(f){if(!Number.isInteger(f))return!1;const h=f.toString();return!!(t.errorValues[h]||u(f))}e.isValidCode=a;function c(f,{fallbackError:h=s,shouldIncludeStack:m=!1}={}){var y,w;if(!h||!Number.isInteger(h.code)||typeof h.message!="string")throw new Error("Must provide fallback error with integer number code and string message.");if(f instanceof n.EthereumRpcError)return f.serialize();const b={};if(f&&typeof f=="object"&&!Array.isArray(f)&&d(f,"code")&&a(f.code)){const v=f;b.code=v.code,v.message&&typeof v.message=="string"?(b.message=v.message,d(v,"data")&&(b.data=v.data)):(b.message=o(b.code),b.data={originalError:l(f)})}else{b.code=h.code;const v=(y=f)===null||y===void 0?void 0:y.message;b.message=v&&typeof v=="string"?v:h.message,b.data={originalError:l(f)}}const x=(w=f)===null||w===void 0?void 0:w.stack;return m&&f&&x&&typeof x=="string"&&(b.stack=x),b}e.serializeError=c;function u(f){return f>=-32099&&f<=-32e3}function l(f){return f&&typeof f=="object"&&!Array.isArray(f)?Object.assign({},f):f}function d(f,h){return Object.prototype.hasOwnProperty.call(f,h)}}(j1);var b0={};Object.defineProperty(b0,"__esModule",{value:!0}),b0.ethErrors=void 0;const $1=Cs,gA=j1,An=Ps;b0.ethErrors={rpc:{parse:e=>Er(An.errorCodes.rpc.parse,e),invalidRequest:e=>Er(An.errorCodes.rpc.invalidRequest,e),invalidParams:e=>Er(An.errorCodes.rpc.invalidParams,e),methodNotFound:e=>Er(An.errorCodes.rpc.methodNotFound,e),internal:e=>Er(An.errorCodes.rpc.internal,e),server:e=>{if(!e||typeof e!="object"||Array.isArray(e))throw new Error("Ethereum RPC Server errors must provide single object argument.");const{code:t}=e;if(!Number.isInteger(t)||t>-32005||t<-32099)throw new Error('"code" must be an integer such that: -32099 <= code <= -32005');return Er(t,e)},invalidInput:e=>Er(An.errorCodes.rpc.invalidInput,e),resourceNotFound:e=>Er(An.errorCodes.rpc.resourceNotFound,e),resourceUnavailable:e=>Er(An.errorCodes.rpc.resourceUnavailable,e),transactionRejected:e=>Er(An.errorCodes.rpc.transactionRejected,e),methodNotSupported:e=>Er(An.errorCodes.rpc.methodNotSupported,e),limitExceeded:e=>Er(An.errorCodes.rpc.limitExceeded,e)},provider:{userRejectedRequest:e=>Fl(An.errorCodes.provider.userRejectedRequest,e),unauthorized:e=>Fl(An.errorCodes.provider.unauthorized,e),unsupportedMethod:e=>Fl(An.errorCodes.provider.unsupportedMethod,e),disconnected:e=>Fl(An.errorCodes.provider.disconnected,e),chainDisconnected:e=>Fl(An.errorCodes.provider.chainDisconnected,e),custom:e=>{if(!e||typeof e!="object"||Array.isArray(e))throw new Error("Ethereum Provider custom errors must provide single object argument.");const{code:t,message:n,data:r}=e;if(!n||typeof n!="string")throw new Error('"message" must be a nonempty string');return new $1.EthereumProviderError(t,n,r)}}};function Er(e,t){const[n,r]=yA(t);return new $1.EthereumRpcError(e,n||gA.getMessageFromCode(e),r)}function Fl(e,t){const[n,r]=yA(t);return new $1.EthereumProviderError(e,n||gA.getMessageFromCode(e),r)}function yA(e){if(e){if(typeof e=="string")return[e];if(typeof e=="object"&&!Array.isArray(e)){const{message:t,data:n}=e;if(t&&typeof t!="string")throw new Error("Must specify string message.");return[t||void 0,n]}}return[]}(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.getMessageFromCode=e.serializeError=e.EthereumProviderError=e.EthereumRpcError=e.ethErrors=e.errorCodes=void 0;const t=Cs;Object.defineProperty(e,"EthereumRpcError",{enumerable:!0,get:function(){return t.EthereumRpcError}}),Object.defineProperty(e,"EthereumProviderError",{enumerable:!0,get:function(){return t.EthereumProviderError}});const n=j1;Object.defineProperty(e,"serializeError",{enumerable:!0,get:function(){return n.serializeError}}),Object.defineProperty(e,"getMessageFromCode",{enumerable:!0,get:function(){return n.getMessageFromCode}});const r=b0;Object.defineProperty(e,"ethErrors",{enumerable:!0,get:function(){return r.ethErrors}});const i=Ps;Object.defineProperty(e,"errorCodes",{enumerable:!0,get:function(){return i.errorCodes}})})(pA);var MZ=Pe&&Pe.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty($l,"__esModule",{value:!0}),$l.JsonRpcEngine=void 0;const BZ=MZ(L1),xr=pA;class Hi extends BZ.default{constructor(){super(),this._middleware=[]}push(t){this._middleware.push(t)}handle(t,n){if(n&&typeof n!="function")throw new Error('"callback" must be a function if provided.');return Array.isArray(t)?n?this._handleBatch(t,n):this._handleBatch(t):n?this._handle(t,n):this._promiseHandle(t)}asMiddleware(){return async(t,n,r,i)=>{try{const[s,o,a]=await Hi._runAllMiddleware(t,n,this._middleware);return o?(await Hi._runReturnHandlers(a),i(s)):r(async c=>{try{await Hi._runReturnHandlers(a)}catch(u){return c(u)}return c()})}catch(s){return i(s)}}}async _handleBatch(t,n){try{const r=await Promise.all(t.map(this._promiseHandle.bind(this)));return n?n(null,r):r}catch(r){if(n)return n(r);throw r}}_promiseHandle(t){return new Promise(n=>{this._handle(t,(r,i)=>{n(i)})})}async _handle(t,n){if(!t||Array.isArray(t)||typeof t!="object"){const o=new xr.EthereumRpcError(xr.errorCodes.rpc.invalidRequest,`Requests must be plain objects. Received: ${typeof t}`,{request:t});return n(o,{id:void 0,jsonrpc:"2.0",error:o})}if(typeof t.method!="string"){const o=new xr.EthereumRpcError(xr.errorCodes.rpc.invalidRequest,`Must specify a string method. Received: ${typeof t.method}`,{request:t});return n(o,{id:t.id,jsonrpc:"2.0",error:o})}const r=Object.assign({},t),i={id:r.id,jsonrpc:r.jsonrpc};let s=null;try{await this._processRequest(r,i)}catch(o){s=o}return s&&(delete i.result,i.error||(i.error=xr.serializeError(s))),n(s,i)}async _processRequest(t,n){const[r,i,s]=await Hi._runAllMiddleware(t,n,this._middleware);if(Hi._checkForCompletion(t,n,i),await Hi._runReturnHandlers(s),r)throw r}static async _runAllMiddleware(t,n,r){const i=[];let s=null,o=!1;for(const a of r)if([s,o]=await Hi._runMiddleware(t,n,a,i),o)break;return[s,o,i.reverse()]}static _runMiddleware(t,n,r,i){return new Promise(s=>{const o=c=>{const u=c||n.error;u&&(n.error=xr.serializeError(u)),s([u,!0])},a=c=>{n.error?o(n.error):(c&&(typeof c!="function"&&o(new xr.EthereumRpcError(xr.errorCodes.rpc.internal,`JsonRpcEngine: "next" return handlers must be functions. Received "${typeof c}" for request:
129
+ ${F1(t)}`,{request:t})),i.push(c)),s([null,!1]))};try{r(t,n,a,o)}catch(c){o(c)}})}static async _runReturnHandlers(t){for(const n of t)await new Promise((r,i)=>{n(s=>s?i(s):r())})}static _checkForCompletion(t,n,r){if(!("result"in n)&&!("error"in n))throw new xr.EthereumRpcError(xr.errorCodes.rpc.internal,`JsonRpcEngine: Response has no error or result for request:
130
+ ${F1(t)}`,{request:t});if(!r)throw new xr.EthereumRpcError(xr.errorCodes.rpc.internal,`JsonRpcEngine: Nothing ended request:
131
+ ${F1(t)}`,{request:t})}}$l.JsonRpcEngine=Hi;function F1(e){return JSON.stringify(e,null,2)}var w0={};Object.defineProperty(w0,"__esModule",{value:!0}),w0.mergeMiddleware=void 0;const NZ=$l;function LZ(e){const t=new NZ.JsonRpcEngine;return e.forEach(n=>t.push(n)),t.asMiddleware()}w0.mergeMiddleware=LZ,function(e){var t=Pe&&Pe.__createBinding||(Object.create?function(r,i,s,o){o===void 0&&(o=s),Object.defineProperty(r,o,{enumerable:!0,get:function(){return i[s]}})}:function(r,i,s,o){o===void 0&&(o=s),r[o]=i[s]}),n=Pe&&Pe.__exportStar||function(r,i){for(var s in r)s!=="default"&&!Object.prototype.hasOwnProperty.call(i,s)&&t(i,r,s)};Object.defineProperty(e,"__esModule",{value:!0}),n(m0,e),n(g0,e),n(y0,e),n(jl,e),n($l,e),n(w0,e)}(B1);var bA={},D1={},U1=function(e,t){return U1=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,r){n.__proto__=r}||function(n,r){for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(n[i]=r[i])},U1(e,t)};function wA(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");U1(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}var v0=function(){return v0=Object.assign||function(t){for(var n,r=1,i=arguments.length;r<i;r++){n=arguments[r];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(t[s]=n[s])}return t},v0.apply(this,arguments)};function vA(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n}function _A(e,t,n,r){var i=arguments.length,s=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(e,t,n,r);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(s=(i<3?o(s):i>3?o(t,n,s):o(t,n))||s);return i>3&&s&&Object.defineProperty(t,n,s),s}function EA(e,t){return function(n,r){t(n,r,e)}}function xA(e,t,n,r,i,s){function o(b){if(b!==void 0&&typeof b!="function")throw new TypeError("Function expected");return b}for(var a=r.kind,c=a==="getter"?"get":a==="setter"?"set":"value",u=!t&&e?r.static?e:e.prototype:null,l=t||(u?Object.getOwnPropertyDescriptor(u,r.name):{}),d,f=!1,h=n.length-1;h>=0;h--){var m={};for(var y in r)m[y]=y==="access"?{}:r[y];for(var y in r.access)m.access[y]=r.access[y];m.addInitializer=function(b){if(f)throw new TypeError("Cannot add initializers after decoration has completed");s.push(o(b||null))};var w=(0,n[h])(a==="accessor"?{get:l.get,set:l.set}:l[c],m);if(a==="accessor"){if(w===void 0)continue;if(w===null||typeof w!="object")throw new TypeError("Object expected");(d=o(w.get))&&(l.get=d),(d=o(w.set))&&(l.set=d),(d=o(w.init))&&i.unshift(d)}else(d=o(w))&&(a==="field"?i.unshift(d):l[c]=d)}u&&Object.defineProperty(u,r.name,l),f=!0}function SA(e,t,n){for(var r=arguments.length>2,i=0;i<t.length;i++)n=r?t[i].call(e,n):t[i].call(e);return r?n:void 0}function kA(e){return typeof e=="symbol"?e:"".concat(e)}function AA(e,t,n){return typeof t=="symbol"&&(t=t.description?"[".concat(t.description,"]"):""),Object.defineProperty(e,"name",{configurable:!0,value:n?"".concat(n," ",t):t})}function IA(e,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(e,t)}function CA(e,t,n,r){function i(s){return s instanceof n?s:new n(function(o){o(s)})}return new(n||(n=Promise))(function(s,o){function a(l){try{u(r.next(l))}catch(d){o(d)}}function c(l){try{u(r.throw(l))}catch(d){o(d)}}function u(l){l.done?s(l.value):i(l.value).then(a,c)}u((r=r.apply(e,t||[])).next())})}function PA(e,t){var n={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},r,i,s,o=Object.create((typeof Iterator=="function"?Iterator:Object).prototype);return o.next=a(0),o.throw=a(1),o.return=a(2),typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function a(u){return function(l){return c([u,l])}}function c(u){if(r)throw new TypeError("Generator is already executing.");for(;o&&(o=0,u[0]&&(n=0)),n;)try{if(r=1,i&&(s=u[0]&2?i.return:u[0]?i.throw||((s=i.return)&&s.call(i),0):i.next)&&!(s=s.call(i,u[1])).done)return s;switch(i=0,s&&(u=[u[0]&2,s.value]),u[0]){case 0:case 1:s=u;break;case 4:return n.label++,{value:u[1],done:!1};case 5:n.label++,i=u[1],u=[0];continue;case 7:u=n.ops.pop(),n.trys.pop();continue;default:if(s=n.trys,!(s=s.length>0&&s[s.length-1])&&(u[0]===6||u[0]===2)){n=0;continue}if(u[0]===3&&(!s||u[1]>s[0]&&u[1]<s[3])){n.label=u[1];break}if(u[0]===6&&n.label<s[1]){n.label=s[1],s=u;break}if(s&&n.label<s[2]){n.label=s[2],n.ops.push(u);break}s[2]&&n.ops.pop(),n.trys.pop();continue}u=t.call(e,n)}catch(l){u=[6,l],i=0}finally{r=s=0}if(u[0]&5)throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}}var _0=Object.create?function(e,t,n,r){r===void 0&&(r=n);var i=Object.getOwnPropertyDescriptor(t,n);(!i||("get"in i?!t.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,i)}:function(e,t,n,r){r===void 0&&(r=n),e[r]=t[n]};function RA(e,t){for(var n in e)n!=="default"&&!Object.prototype.hasOwnProperty.call(t,n)&&_0(t,e,n)}function E0(e){var t=typeof Symbol=="function"&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&typeof e.length=="number")return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function H1(e,t){var n=typeof Symbol=="function"&&e[Symbol.iterator];if(!n)return e;var r=n.call(e),i,s=[],o;try{for(;(t===void 0||t-- >0)&&!(i=r.next()).done;)s.push(i.value)}catch(a){o={error:a}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(o)throw o.error}}return s}function TA(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(H1(arguments[t]));return e}function OA(){for(var e=0,t=0,n=arguments.length;t<n;t++)e+=arguments[t].length;for(var r=Array(e),i=0,t=0;t<n;t++)for(var s=arguments[t],o=0,a=s.length;o<a;o++,i++)r[i]=s[o];return r}function MA(e,t,n){if(n||arguments.length===2)for(var r=0,i=t.length,s;r<i;r++)(s||!(r in t))&&(s||(s=Array.prototype.slice.call(t,0,r)),s[r]=t[r]);return e.concat(s||Array.prototype.slice.call(t))}function Sc(e){return this instanceof Sc?(this.v=e,this):new Sc(e)}function BA(e,t,n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r=n.apply(e,t||[]),i,s=[];return i=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),a("next"),a("throw"),a("return",o),i[Symbol.asyncIterator]=function(){return this},i;function o(h){return function(m){return Promise.resolve(m).then(h,d)}}function a(h,m){r[h]&&(i[h]=function(y){return new Promise(function(w,b){s.push([h,y,w,b])>1||c(h,y)})},m&&(i[h]=m(i[h])))}function c(h,m){try{u(r[h](m))}catch(y){f(s[0][3],y)}}function u(h){h.value instanceof Sc?Promise.resolve(h.value.v).then(l,d):f(s[0][2],h)}function l(h){c("next",h)}function d(h){c("throw",h)}function f(h,m){h(m),s.shift(),s.length&&c(s[0][0],s[0][1])}}function NA(e){var t,n;return t={},r("next"),r("throw",function(i){throw i}),r("return"),t[Symbol.iterator]=function(){return this},t;function r(i,s){t[i]=e[i]?function(o){return(n=!n)?{value:Sc(e[i](o)),done:!1}:s?s(o):o}:s}}function LA(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t=e[Symbol.asyncIterator],n;return t?t.call(e):(e=typeof E0=="function"?E0(e):e[Symbol.iterator](),n={},r("next"),r("throw"),r("return"),n[Symbol.asyncIterator]=function(){return this},n);function r(s){n[s]=e[s]&&function(o){return new Promise(function(a,c){o=e[s](o),i(a,c,o.done,o.value)})}}function i(s,o,a,c){Promise.resolve(c).then(function(u){s({value:u,done:a})},o)}}function jA(e,t){return Object.defineProperty?Object.defineProperty(e,"raw",{value:t}):e.raw=t,e}var jZ=Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t},z1=function(e){return z1=Object.getOwnPropertyNames||function(t){var n=[];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[n.length]=r);return n},z1(e)};function $A(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n=z1(e),r=0;r<n.length;r++)n[r]!=="default"&&_0(t,e,n[r]);return jZ(t,e),t}function FA(e){return e&&e.__esModule?e:{default:e}}function DA(e,t,n,r){if(n==="a"&&!r)throw new TypeError("Private accessor was defined without a getter");if(typeof t=="function"?e!==t||!r:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return n==="m"?r:n==="a"?r.call(e):r?r.value:t.get(e)}function UA(e,t,n,r,i){if(r==="m")throw new TypeError("Private method is not writable");if(r==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof t=="function"?e!==t||!i:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return r==="a"?i.call(e,n):i?i.value=n:t.set(e,n),n}function HA(e,t){if(t===null||typeof t!="object"&&typeof t!="function")throw new TypeError("Cannot use 'in' operator on non-object");return typeof e=="function"?t===e:e.has(t)}function zA(e,t,n){if(t!=null){if(typeof t!="object"&&typeof t!="function")throw new TypeError("Object expected.");var r,i;if(n){if(!Symbol.asyncDispose)throw new TypeError("Symbol.asyncDispose is not defined.");r=t[Symbol.asyncDispose]}if(r===void 0){if(!Symbol.dispose)throw new TypeError("Symbol.dispose is not defined.");r=t[Symbol.dispose],n&&(i=r)}if(typeof r!="function")throw new TypeError("Object not disposable.");i&&(r=function(){try{i.call(this)}catch(s){return Promise.reject(s)}}),e.stack.push({value:t,dispose:r,async:n})}else n&&e.stack.push({async:!0});return t}var $Z=typeof SuppressedError=="function"?SuppressedError:function(e,t,n){var r=new Error(n);return r.name="SuppressedError",r.error=e,r.suppressed=t,r};function WA(e){function t(s){e.error=e.hasError?new $Z(s,e.error,"An error was suppressed during disposal."):s,e.hasError=!0}var n,r=0;function i(){for(;n=e.stack.pop();)try{if(!n.async&&r===1)return r=0,e.stack.push(n),Promise.resolve().then(i);if(n.dispose){var s=n.dispose.call(n.value);if(n.async)return r|=2,Promise.resolve(s).then(i,function(o){return t(o),i()})}else r|=1}catch(o){t(o)}if(r===1)return e.hasError?Promise.reject(e.error):Promise.resolve();if(e.hasError)throw e.error}return i()}function GA(e,t){return typeof e=="string"&&/^\.\.?\//.test(e)?e.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i,function(n,r,i,s,o){return r?t?".jsx":".js":i&&(!s||!o)?n:i+s+"."+o.toLowerCase()+"js"}):e}const W1=Zo(Object.freeze(Object.defineProperty({__proto__:null,__addDisposableResource:zA,get __assign(){return v0},__asyncDelegator:NA,__asyncGenerator:BA,__asyncValues:LA,__await:Sc,__awaiter:CA,__classPrivateFieldGet:DA,__classPrivateFieldIn:HA,__classPrivateFieldSet:UA,__createBinding:_0,__decorate:_A,__disposeResources:WA,__esDecorate:xA,__exportStar:RA,__extends:wA,__generator:PA,__importDefault:FA,__importStar:$A,__makeTemplateObject:jA,__metadata:IA,__param:EA,__propKey:kA,__read:H1,__rest:vA,__rewriteRelativeImportExtension:GA,__runInitializers:SA,__setFunctionName:AA,__spread:TA,__spreadArray:MA,__spreadArrays:OA,__values:E0,default:{__extends:wA,__assign:v0,__rest:vA,__decorate:_A,__param:EA,__esDecorate:xA,__runInitializers:SA,__propKey:kA,__setFunctionName:AA,__metadata:IA,__awaiter:CA,__generator:PA,__createBinding:_0,__exportStar:RA,__values:E0,__read:H1,__spread:TA,__spreadArrays:OA,__spreadArray:MA,__await:Sc,__asyncGenerator:BA,__asyncDelegator:NA,__asyncValues:LA,__makeTemplateObject:jA,__importStar:$A,__importDefault:FA,__classPrivateFieldGet:DA,__classPrivateFieldSet:UA,__classPrivateFieldIn:HA,__addDisposableResource:zA,__disposeResources:WA,__rewriteRelativeImportExtension:GA}},Symbol.toStringTag,{value:"Module"})));var x0={};Object.defineProperty(x0,"__esModule",{value:!0});var qA=W1,FZ=function(){function e(t){if(this._maxConcurrency=t,this._queue=[],t<=0)throw new Error("semaphore must be initialized to a positive value");this._value=t}return e.prototype.acquire=function(){var t=this,n=this.isLocked(),r=new Promise(function(i){return t._queue.push(i)});return n||this._dispatch(),r},e.prototype.runExclusive=function(t){return qA.__awaiter(this,void 0,void 0,function(){var n,r,i;return qA.__generator(this,function(s){switch(s.label){case 0:return[4,this.acquire()];case 1:n=s.sent(),r=n[0],i=n[1],s.label=2;case 2:return s.trys.push([2,,4,5]),[4,t(r)];case 3:return[2,s.sent()];case 4:return i(),[7];case 5:return[2]}})})},e.prototype.isLocked=function(){return this._value<=0},e.prototype.release=function(){if(this._maxConcurrency>1)throw new Error("this method is unavailabel on semaphores with concurrency > 1; use the scoped release returned by acquire instead");if(this._currentReleaser){var t=this._currentReleaser;this._currentReleaser=void 0,t()}},e.prototype._dispatch=function(){var t=this,n=this._queue.shift();if(n){var r=!1;this._currentReleaser=function(){r||(r=!0,t._value++,t._dispatch())},n([this._value--,this._currentReleaser])}},e}();x0.default=FZ,Object.defineProperty(D1,"__esModule",{value:!0});var VA=W1,DZ=x0,UZ=function(){function e(){this._semaphore=new DZ.default(1)}return e.prototype.acquire=function(){return VA.__awaiter(this,void 0,void 0,function(){var t,n;return VA.__generator(this,function(r){switch(r.label){case 0:return[4,this._semaphore.acquire()];case 1:return t=r.sent(),n=t[1],[2,n]}})})},e.prototype.runExclusive=function(t){return this._semaphore.runExclusive(function(){return t()})},e.prototype.isLocked=function(){return this._semaphore.isLocked()},e.prototype.release=function(){this._semaphore.release()},e}();D1.default=UZ;var S0={};Object.defineProperty(S0,"__esModule",{value:!0}),S0.withTimeout=void 0;var k0=W1;function HZ(e,t,n){var r=this;return n===void 0&&(n=new Error("timeout")),{acquire:function(){return new Promise(function(i,s){return k0.__awaiter(r,void 0,void 0,function(){var o,a,c;return k0.__generator(this,function(u){switch(u.label){case 0:return o=!1,setTimeout(function(){o=!0,s(n)},t),[4,e.acquire()];case 1:return a=u.sent(),o?(c=Array.isArray(a)?a[1]:a,c()):i(a),[2]}})})})},runExclusive:function(i){return k0.__awaiter(this,void 0,void 0,function(){var s,o;return k0.__generator(this,function(a){switch(a.label){case 0:s=function(){},a.label=1;case 1:return a.trys.push([1,,7,8]),[4,this.acquire()];case 2:return o=a.sent(),Array.isArray(o)?(s=o[1],[4,i(o[0])]):[3,4];case 3:return[2,a.sent()];case 4:return s=o,[4,i()];case 5:return[2,a.sent()];case 6:return[3,8];case 7:return s(),[7];case 8:return[2]}})})},release:function(){e.release()},isLocked:function(){return e.isLocked()}}}S0.withTimeout=HZ,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.withTimeout=e.Semaphore=e.Mutex=void 0;var t=D1;Object.defineProperty(e,"Mutex",{enumerable:!0,get:function(){return t.default}});var n=x0;Object.defineProperty(e,"Semaphore",{enumerable:!0,get:function(){return n.default}});var r=S0;Object.defineProperty(e,"withTimeout",{enumerable:!0,get:function(){return r.withTimeout}})}(bA);var zZ=GZ,WZ=Object.prototype.hasOwnProperty;function GZ(){for(var e={},t=0;t<arguments.length;t++){var n=arguments[t];for(var r in n)WZ.call(n,r)&&(e[r]=n[r])}return e}const qZ=zZ,VZ=x1();var KZ=Ne;function Ne(e){const t=this;t.currentProvider=e}Ne.prototype.getBalance=Dl(2,"eth_getBalance"),Ne.prototype.getCode=Dl(2,"eth_getCode"),Ne.prototype.getTransactionCount=Dl(2,"eth_getTransactionCount"),Ne.prototype.getStorageAt=Dl(3,"eth_getStorageAt"),Ne.prototype.call=Dl(2,"eth_call"),Ne.prototype.protocolVersion=We("eth_protocolVersion"),Ne.prototype.syncing=We("eth_syncing"),Ne.prototype.coinbase=We("eth_coinbase"),Ne.prototype.mining=We("eth_mining"),Ne.prototype.hashrate=We("eth_hashrate"),Ne.prototype.gasPrice=We("eth_gasPrice"),Ne.prototype.accounts=We("eth_accounts"),Ne.prototype.blockNumber=We("eth_blockNumber"),Ne.prototype.getBlockTransactionCountByHash=We("eth_getBlockTransactionCountByHash"),Ne.prototype.getBlockTransactionCountByNumber=We("eth_getBlockTransactionCountByNumber"),Ne.prototype.getUncleCountByBlockHash=We("eth_getUncleCountByBlockHash"),Ne.prototype.getUncleCountByBlockNumber=We("eth_getUncleCountByBlockNumber"),Ne.prototype.sign=We("eth_sign"),Ne.prototype.sendTransaction=We("eth_sendTransaction"),Ne.prototype.sendRawTransaction=We("eth_sendRawTransaction"),Ne.prototype.estimateGas=We("eth_estimateGas"),Ne.prototype.getBlockByHash=We("eth_getBlockByHash"),Ne.prototype.getBlockByNumber=We("eth_getBlockByNumber"),Ne.prototype.getTransactionByHash=We("eth_getTransactionByHash"),Ne.prototype.getTransactionByBlockHashAndIndex=We("eth_getTransactionByBlockHashAndIndex"),Ne.prototype.getTransactionByBlockNumberAndIndex=We("eth_getTransactionByBlockNumberAndIndex"),Ne.prototype.getTransactionReceipt=We("eth_getTransactionReceipt"),Ne.prototype.getUncleByBlockHashAndIndex=We("eth_getUncleByBlockHashAndIndex"),Ne.prototype.getUncleByBlockNumberAndIndex=We("eth_getUncleByBlockNumberAndIndex"),Ne.prototype.getCompilers=We("eth_getCompilers"),Ne.prototype.compileLLL=We("eth_compileLLL"),Ne.prototype.compileSolidity=We("eth_compileSolidity"),Ne.prototype.compileSerpent=We("eth_compileSerpent"),Ne.prototype.newFilter=We("eth_newFilter"),Ne.prototype.newBlockFilter=We("eth_newBlockFilter"),Ne.prototype.newPendingTransactionFilter=We("eth_newPendingTransactionFilter"),Ne.prototype.uninstallFilter=We("eth_uninstallFilter"),Ne.prototype.getFilterChanges=We("eth_getFilterChanges"),Ne.prototype.getFilterLogs=We("eth_getFilterLogs"),Ne.prototype.getLogs=We("eth_getLogs"),Ne.prototype.getWork=We("eth_getWork"),Ne.prototype.submitWork=We("eth_submitWork"),Ne.prototype.submitHashrate=We("eth_submitHashrate"),Ne.prototype.sendAsync=function(e,t){this.currentProvider.sendAsync(JZ(e),function(r,i){if(!r&&i.error&&(r=new Error("EthQuery - RPC Error - "+i.error.message)),r)return t(r);t(null,i.result)})};function We(e){return function(){const t=this;var n=[].slice.call(arguments),r=n.pop();t.sendAsync({method:e,params:n},r)}}function Dl(e,t){return function(){const n=this;var r=[].slice.call(arguments),i=r.pop();r.length<e&&r.push("latest"),n.sendAsync({method:t,params:r},i)}}function JZ(e){return qZ({id:VZ(),jsonrpc:"2.0",params:[]},e)}const KA=(e,t,n,r)=>function(...i){const s=t.promiseModule;return new s((o,a)=>{t.multiArgs?i.push((...u)=>{t.errorFirst?u[0]?a(u):(u.shift(),o(u)):o(u)}):t.errorFirst?i.push((u,l)=>{u?a(u):o(l)}):i.push(o),Reflect.apply(e,this===n?r:this,i)})},JA=new WeakMap;var ZZ=(e,t)=>{t={exclude:[/.+(?:Sync|Stream)$/],errorFirst:!0,promiseModule:Promise,...t};const n=typeof e;if(!(e!==null&&(n==="object"||n==="function")))throw new TypeError(`Expected \`input\` to be a \`Function\` or \`Object\`, got \`${e===null?"null":n}\``);const r=(o,a)=>{let c=JA.get(o);if(c||(c={},JA.set(o,c)),a in c)return c[a];const u=m=>typeof m=="string"||typeof a=="symbol"?a===m:m.test(a),l=Reflect.getOwnPropertyDescriptor(o,a),d=l===void 0||l.writable||l.configurable,h=(t.include?t.include.some(u):!t.exclude.some(u))&&d;return c[a]=h,h},i=new WeakMap,s=new Proxy(e,{apply(o,a,c){const u=i.get(o);if(u)return Reflect.apply(u,a,c);const l=t.excludeMain?o:KA(o,t,s,o);return i.set(o,l),Reflect.apply(l,a,c)},get(o,a){const c=o[a];if(!r(o,a)||c===Function.prototype[a])return c;const u=i.get(c);if(u)return u;if(typeof c=="function"){const l=KA(c,t,s,o);return i.set(c,l),l}return c}});return s};const YZ=Tl.default;var G1=class extends YZ{constructor(){super(),this.updates=[]}async initialize(){}async update(){throw new Error("BaseFilter - no update method specified")}addResults(t){this.updates=this.updates.concat(t),t.forEach(n=>this.emit("update",n))}addInitialResults(t){}getChangesAndClear(){const t=this.updates;return this.updates=[],t}};const QZ=G1;var XZ=class extends QZ{constructor(){super(),this.allResults=[]}async update(){throw new Error("BaseFilterWithHistory - no update method specified")}addResults(t){this.allResults=this.allResults.concat(t),super.addResults(t)}addInitialResults(t){this.allResults=this.allResults.concat(t),super.addInitialResults(t)}getAllResults(){return this.allResults}},Ul={minBlockRef:eY,bnToHex:nY,blockRefIsNumber:rY,hexToInt:A0,incrementHexInt:iY,intToHex:ZA,unsafeRandomBytes:sY};function eY(...e){return tY(e)[0]}function tY(e){return e.sort((t,n)=>t==="latest"||n==="earliest"?1:n==="latest"||t==="earliest"?-1:A0(t)-A0(n))}function nY(e){return"0x"+e.toString(16)}function rY(e){return e&&!["earliest","latest","pending"].includes(e)}function A0(e){return e==null?e:Number.parseInt(e,16)}function iY(e){if(e==null)return e;const t=A0(e);return ZA(t+1)}function ZA(e){if(e==null)return e;let t=e.toString(16);return t.length%2&&(t="0"+t),"0x"+t}function sY(e){let t="0x";for(let n=0;n<e;n++)t+=YA(),t+=YA();return t}function YA(){return Math.floor(Math.random()*16).toString(16)}const oY=KZ,aY=ZZ,cY=XZ,{bnToHex:YQ,hexToInt:I0,incrementHexInt:uY,minBlockRef:lY,blockRefIsNumber:dY}=Ul;var fY=class extends cY{constructor({provider:t,params:n}){super(),this.type="log",this.ethQuery=new oY(t),this.params=Object.assign({fromBlock:"latest",toBlock:"latest",address:void 0,topics:[]},n),this.params.address&&(Array.isArray(this.params.address)||(this.params.address=[this.params.address]),this.params.address=this.params.address.map(r=>r.toLowerCase()))}async initialize({currentBlock:t}){let n=this.params.fromBlock;["latest","pending"].includes(n)&&(n=t),n==="earliest"&&(n="0x0"),this.params.fromBlock=n;const r=lY(this.params.toBlock,t),i=Object.assign({},this.params,{toBlock:r}),s=await this._fetchLogs(i);this.addInitialResults(s)}async update({oldBlock:t,newBlock:n}){const r=n;let i;t?i=uY(t):i=n;const s=Object.assign({},this.params,{fromBlock:i,toBlock:r}),a=(await this._fetchLogs(s)).filter(c=>this.matchLog(c));this.addResults(a)}async _fetchLogs(t){return await aY(r=>this.ethQuery.getLogs(t,r))()}matchLog(t){if(I0(this.params.fromBlock)>=I0(t.blockNumber)||dY(this.params.toBlock)&&I0(this.params.toBlock)<=I0(t.blockNumber))return!1;const n=t.address&&t.address.toLowerCase();return this.params.address&&n&&!this.params.address.includes(n)?!1:this.params.topics.every((i,s)=>{let o=t.topics[s];if(!o)return!1;o=o.toLowerCase();let a=Array.isArray(i)?i:[i];return a.includes(null)?!0:(a=a.map(l=>l.toLowerCase()),a.includes(o))})}},q1=hY;async function hY({provider:e,fromBlock:t,toBlock:n}){t||(t=n);const r=QA(t),s=QA(n)-r+1,o=Array(s).fill().map((c,u)=>r+u).map(pY);let a=await Promise.all(o.map(c=>gY(e,"eth_getBlockByNumber",[c,!1])));return a=a.filter(c=>c!==null),a}function QA(e){return e==null?e:Number.parseInt(e,16)}function pY(e){return e==null?e:"0x"+e.toString(16)}function mY(e,t){return new Promise((n,r)=>{e.sendAsync(t,(i,s)=>{i?r(i):s.error?r(s.error):s.result?n(s.result):r(new Error("Result was empty"))})})}async function gY(e,t,n){for(let r=0;r<3;r++)try{return await mY(e,{id:1,jsonrpc:"2.0",method:t,params:n})}catch(i){console.error(`provider.sendAsync failed: ${i.stack||i.message||i}`)}return null}const yY=G1,bY=q1,{incrementHexInt:wY}=Ul;var vY=class extends yY{constructor({provider:t,params:n}){super(),this.type="block",this.provider=t}async update({oldBlock:t,newBlock:n}){const r=n,i=wY(t),o=(await bY({provider:this.provider,fromBlock:i,toBlock:r})).map(a=>a.hash);this.addResults(o)}};const _Y=G1,EY=q1,{incrementHexInt:xY}=Ul;var SY=class extends _Y{constructor({provider:t}){super(),this.type="tx",this.provider=t}async update({oldBlock:t}){const n=t,r=xY(t),i=await EY({provider:this.provider,fromBlock:r,toBlock:n}),s=[];for(const o of i)s.push(...o.transactions);this.addResults(s)}};const kY=bA.Mutex,{createAsyncMiddleware:AY,createScaffoldMiddleware:IY}=B1,CY=fY,PY=vY,RY=SY,{intToHex:XA,hexToInt:V1}=Ul;var TY=OY;function OY({blockTracker:e,provider:t}){let n=0,r={};const i=new kY,s=MY({mutex:i}),o=IY({eth_newFilter:s(K1(c)),eth_newBlockFilter:s(K1(u)),eth_newPendingTransactionFilter:s(K1(l)),eth_uninstallFilter:s(C0(h)),eth_getFilterChanges:s(C0(d)),eth_getFilterLogs:s(C0(f))}),a=async({oldBlock:x,newBlock:v})=>{if(r.length===0)return;const S=await i.acquire();try{await Promise.all(kc(r).map(async I=>{try{await I.update({oldBlock:x,newBlock:v})}catch(N){console.error(N)}}))}catch(I){console.error(I)}S()};return o.newLogFilter=c,o.newBlockFilter=u,o.newPendingTransactionFilter=l,o.uninstallFilter=h,o.getFilterChanges=d,o.getFilterLogs=f,o.destroy=()=>{w()},o;async function c(x){const v=new CY({provider:t,params:x});return await m(v),v}async function u(){const x=new PY({provider:t});return await m(x),x}async function l(){const x=new RY({provider:t});return await m(x),x}async function d(x){const v=V1(x),S=r[v];if(!S)throw new Error(`No filter for index "${v}"`);return S.getChangesAndClear()}async function f(x){const v=V1(x),S=r[v];if(!S)throw new Error(`No filter for index "${v}"`);let I=[];return S.type==="log"&&(I=S.getAllResults()),I}async function h(x){const v=V1(x),I=!!r[v];return I&&await y(v),I}async function m(x){const v=kc(r).length,S=await e.getLatestBlock();await x.initialize({currentBlock:S}),n++,r[n]=x,x.id=n,x.idHex=XA(n);const I=kc(r).length;return b({prevFilterCount:v,newFilterCount:I}),n}async function y(x){const v=kc(r).length;delete r[x];const S=kc(r).length;b({prevFilterCount:v,newFilterCount:S})}async function w(){const x=kc(r).length;r={},b({prevFilterCount:x,newFilterCount:0})}function b({prevFilterCount:x,newFilterCount:v}){if(x===0&&v>0){e.on("sync",a);return}if(x>0&&v===0){e.removeListener("sync",a);return}}}function K1(e){return C0(async(...t)=>{const n=await e(...t);return XA(n.id)})}function C0(e){return AY(async(t,n)=>{const r=await e.apply(null,t.params);n.result=r})}function MY({mutex:e}){return t=>async(n,r,i,s)=>{(await e.acquire())(),t(n,r,i,s)}}function kc(e,t){const n=[];for(let r in e)n.push(e[r]);return n}const BY=Tl.default,{createAsyncMiddleware:eI,createScaffoldMiddleware:NY}=B1,LY=TY,{unsafeRandomBytes:jY,incrementHexInt:$Y}=Ul,FY=q1;var DY=UY;function UY({blockTracker:e,provider:t}){const n={},r=LY({blockTracker:e,provider:t});let i=!1;const s=new BY,o=NY({eth_subscribe:eI(a),eth_unsubscribe:eI(c)});return o.destroy=l,{events:s,middleware:o};async function a(d,f){if(i)throw new Error("SubscriptionManager - attempting to use after destroying");const h=d.params[0],m=jY(16);let y;switch(h){case"newHeads":y=w({subId:m});break;case"logs":const x=d.params[1],v=await r.newLogFilter(x);y=b({subId:m,filter:v});break;default:throw new Error(`SubscriptionManager - unsupported subscription type "${h}"`)}n[m]=y,f.result=m;return;function w({subId:x}){const v={type:h,destroy:async()=>{e.removeListener("sync",v.update)},update:async({oldBlock:S,newBlock:I})=>{const N=I,j=$Y(S);(await FY({provider:t,fromBlock:j,toBlock:N})).map(HY).filter(Y=>Y!==null).forEach(Y=>{u(x,Y)})}};return e.on("sync",v.update),v}function b({subId:x,filter:v}){return v.on("update",I=>u(x,I)),{type:h,destroy:async()=>await r.uninstallFilter(v.idHex)}}}async function c(d,f){if(i)throw new Error("SubscriptionManager - attempting to use after destroying");const h=d.params[0],m=n[h];if(!m){f.result=!1;return}delete n[h],await m.destroy(),f.result=!0}function u(d,f){s.emit("notification",{jsonrpc:"2.0",method:"eth_subscription",params:{subscription:d,result:f}})}function l(){s.removeAllListeners();for(const d in n)n[d].destroy(),delete n[d];i=!0}}function HY(e){return e==null?null:{hash:e.hash,parentHash:e.parentHash,sha3Uncles:e.sha3Uncles,miner:e.miner,stateRoot:e.stateRoot,transactionsRoot:e.transactionsRoot,receiptsRoot:e.receiptsRoot,logsBloom:e.logsBloom,difficulty:e.difficulty,number:e.number,gasLimit:e.gasLimit,gasUsed:e.gasUsed,nonce:e.nonce,mixHash:e.mixHash,timestamp:e.timestamp,extraData:e.extraData}}Object.defineProperty(u0,"__esModule",{value:!0}),u0.SubscriptionManager=void 0;const zY=Sk,WY=DY,tI=()=>{};class GY{constructor(t){const n=new zY.PollingBlockTracker({provider:t,pollingInterval:15e3,setSkipCacheFlag:!0}),{events:r,middleware:i}=WY({blockTracker:n,provider:t});this.events=r,this.subscriptionMiddleware=i}async handleRequest(t){const n={};return await this.subscriptionMiddleware(t,n,tI,tI),n}destroy(){this.subscriptionMiddleware.destroy()}}u0.SubscriptionManager=GY;var nI=Pe&&Pe.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Ja,"__esModule",{value:!0}),Ja.CoinbaseWalletProvider=void 0;const qY=nI(fh),VY=cz,st=el,je=Ie,KY=il,rI=br,P0=Ya,cr=Va,J1=nI(PK),Hl=Za,JY=yc,ZY=u0,iI="DefaultChainId",sI="DefaultJsonRpcUrl";class YY extends VY.EventEmitter{constructor(t){var n,r;super(),this._filterPolyfill=new JY.FilterPolyfill(this),this._subscriptionManager=new ZY.SubscriptionManager(this),this._relay=null,this._addresses=[],this.hasMadeFirstChainChangedEmission=!1,this.setProviderInfo=this.setProviderInfo.bind(this),this.updateProviderInfo=this.updateProviderInfo.bind(this),this.getChainId=this.getChainId.bind(this),this.setAppInfo=this.setAppInfo.bind(this),this.enable=this.enable.bind(this),this.close=this.close.bind(this),this.send=this.send.bind(this),this.sendAsync=this.sendAsync.bind(this),this.request=this.request.bind(this),this._setAddresses=this._setAddresses.bind(this),this.scanQRCode=this.scanQRCode.bind(this),this.genericRequest=this.genericRequest.bind(this),this._chainIdFromOpts=t.chainId,this._jsonRpcUrlFromOpts=t.jsonRpcUrl,this._overrideIsMetaMask=t.overrideIsMetaMask,this._relayProvider=t.relayProvider,this._storage=t.storage,this._relayEventManager=t.relayEventManager,this.diagnostic=t.diagnosticLogger,this.reloadOnDisconnect=!0,this.isCoinbaseWallet=(n=t.overrideIsCoinbaseWallet)!==null&&n!==void 0?n:!0,this.isCoinbaseBrowser=(r=t.overrideIsCoinbaseBrowser)!==null&&r!==void 0?r:!1,this.qrUrl=t.qrUrl;const i=this.getChainId(),s=(0,je.prepend0x)(i.toString(16));this.emit("connect",{chainIdStr:s});const o=this._storage.getItem(rI.LOCAL_STORAGE_ADDRESSES_KEY);if(o){const a=o.split(" ");a[0]!==""&&(this._addresses=a.map(c=>(0,je.ensureAddressString)(c)),this.emit("accountsChanged",a))}this._subscriptionManager.events.on("notification",a=>{this.emit("message",{type:a.method,data:a.params})}),this._isAuthorized()&&this.initializeRelay(),window.addEventListener("message",a=>{var c;if(!(a.origin!==location.origin||a.source!==window)&&a.data.type==="walletLinkMessage"&&a.data.data.action==="dappChainSwitched"){const u=a.data.data.chainId,l=(c=a.data.data.jsonRpcUrl)!==null&&c!==void 0?c:this.jsonRpcUrl;this.updateProviderInfo(l,Number(u))}})}get selectedAddress(){return this._addresses[0]||void 0}get networkVersion(){return this.getChainId().toString(10)}get chainId(){return(0,je.prepend0x)(this.getChainId().toString(16))}get isWalletLink(){return!0}get isMetaMask(){return this._overrideIsMetaMask}get host(){return this.jsonRpcUrl}get connected(){return!0}isConnected(){return!0}get jsonRpcUrl(){var t;return(t=this._storage.getItem(sI))!==null&&t!==void 0?t:this._jsonRpcUrlFromOpts}set jsonRpcUrl(t){this._storage.setItem(sI,t)}disableReloadOnDisconnect(){this.reloadOnDisconnect=!1}setProviderInfo(t,n){this.isCoinbaseBrowser||(this._chainIdFromOpts=n,this._jsonRpcUrlFromOpts=t),this.updateProviderInfo(this.jsonRpcUrl,this.getChainId())}updateProviderInfo(t,n){this.jsonRpcUrl=t;const r=this.getChainId();this._storage.setItem(iI,n.toString(10)),((0,je.ensureIntNumber)(n)!==r||!this.hasMadeFirstChainChangedEmission)&&(this.emit("chainChanged",this.getChainId()),this.hasMadeFirstChainChangedEmission=!0)}async watchAsset(t,n,r,i,s,o){const c=await(await this.initializeRelay()).watchAsset(t,n,r,i,s,o==null?void 0:o.toString()).promise;return(0,cr.isErrorResponse)(c)?!1:!!c.result}async addEthereumChain(t,n,r,i,s,o){var a,c;if((0,je.ensureIntNumber)(t)===this.getChainId())return!1;const u=await this.initializeRelay(),l=u.inlineAddEthereumChain(t.toString());!this._isAuthorized()&&!l&&await u.requestEthereumAccounts().promise;const d=await u.addEthereumChain(t.toString(),n,s,r,i,o).promise;return(0,cr.isErrorResponse)(d)?!1:(((a=d.result)===null||a===void 0?void 0:a.isApproved)===!0&&this.updateProviderInfo(n[0],t),((c=d.result)===null||c===void 0?void 0:c.isApproved)===!0)}async switchEthereumChain(t){const r=await(await this.initializeRelay()).switchEthereumChain(t.toString(10),this.selectedAddress||void 0).promise;if((0,cr.isErrorResponse)(r)){if(!r.errorCode)return;throw r.errorCode===st.standardErrorCodes.provider.unsupportedChain?st.standardErrors.provider.unsupportedChain():st.standardErrors.provider.custom({message:r.errorMessage,code:r.errorCode})}const i=r.result;i.isApproved&&i.rpcUrl.length>0&&this.updateProviderInfo(i.rpcUrl,t)}setAppInfo(t,n){this.initializeRelay().then(r=>r.setAppInfo(t,n))}async enable(){var t;return(t=this.diagnostic)===null||t===void 0||t.log(Hl.EVENTS.ETH_ACCOUNTS_STATE,{method:"provider::enable",addresses_length:this._addresses.length,sessionIdHash:this._relay?P0.Session.hash(this._relay.session.id):void 0}),this._isAuthorized()?[...this._addresses]:await this.send("eth_requestAccounts")}async close(){(await this.initializeRelay()).resetAndReload()}send(t,n){try{const r=this._send(t,n);if(r instanceof Promise)return r.catch(i=>{throw(0,st.serializeError)(i,t)})}catch(r){throw(0,st.serializeError)(r,t)}}_send(t,n){if(typeof t=="string"){const i=t,s=Array.isArray(n)?n:n!==void 0?[n]:[],o={jsonrpc:"2.0",id:0,method:i,params:s};return this._sendRequestAsync(o).then(a=>a.result)}if(typeof n=="function"){const i=t,s=n;return this._sendAsync(i,s)}if(Array.isArray(t))return t.map(s=>this._sendRequest(s));const r=t;return this._sendRequest(r)}async sendAsync(t,n){try{return this._sendAsync(t,n).catch(r=>{throw(0,st.serializeError)(r,t)})}catch(r){return Promise.reject((0,st.serializeError)(r,t))}}async _sendAsync(t,n){if(typeof n!="function")throw new Error("callback is required");if(Array.isArray(t)){const i=n;this._sendMultipleRequestsAsync(t).then(s=>i(null,s)).catch(s=>i(s,null));return}const r=n;return this._sendRequestAsync(t).then(i=>r(null,i)).catch(i=>r(i,null))}async request(t){try{return this._request(t).catch(n=>{throw(0,st.serializeError)(n,t.method)})}catch(n){return Promise.reject((0,st.serializeError)(n,t.method))}}async _request(t){if(!t||typeof t!="object"||Array.isArray(t))throw st.standardErrors.rpc.invalidRequest({message:"Expected a single, non-array, object argument.",data:t});const{method:n,params:r}=t;if(typeof n!="string"||n.length===0)throw st.standardErrors.rpc.invalidRequest({message:"'args.method' must be a non-empty string.",data:t});if(r!==void 0&&!Array.isArray(r)&&(typeof r!="object"||r===null))throw st.standardErrors.rpc.invalidRequest({message:"'args.params' must be an object or array if provided.",data:t});const i=r===void 0?[]:r,s=this._relayEventManager.makeRequestId();return(await this._sendRequestAsync({method:n,params:i,jsonrpc:"2.0",id:s})).result}async scanQRCode(t){const r=await(await this.initializeRelay()).scanQRCode((0,je.ensureRegExpString)(t)).promise;if((0,cr.isErrorResponse)(r))throw(0,st.serializeError)(r.errorMessage,"scanQRCode");if(typeof r.result!="string")throw(0,st.serializeError)("result was not a string","scanQRCode");return r.result}async genericRequest(t,n){const i=await(await this.initializeRelay()).genericRequest(t,n).promise;if((0,cr.isErrorResponse)(i))throw(0,st.serializeError)(i.errorMessage,"generic");if(typeof i.result!="string")throw(0,st.serializeError)("result was not a string","generic");return i.result}async connectAndSignIn(t){var n;(n=this.diagnostic)===null||n===void 0||n.log(Hl.EVENTS.ETH_ACCOUNTS_STATE,{method:"provider::connectAndSignIn",sessionIdHash:this._relay?P0.Session.hash(this._relay.session.id):void 0});let r;try{const s=await this.initializeRelay();if(!(s instanceof KY.MobileRelay))throw new Error("connectAndSignIn is only supported on mobile");if(r=await s.connectAndSignIn(t).promise,(0,cr.isErrorResponse)(r))throw new Error(r.errorMessage)}catch(s){throw typeof s.message=="string"&&s.message.match(/(denied|rejected)/i)?st.standardErrors.provider.userRejectedRequest("User denied account authorization"):s}if(!r.result)throw new Error("accounts received is empty");const{accounts:i}=r.result;return this._setAddresses(i),this.isCoinbaseBrowser||await this.switchEthereumChain(this.getChainId()),r.result}async selectProvider(t){const r=await(await this.initializeRelay()).selectProvider(t).promise;if((0,cr.isErrorResponse)(r))throw(0,st.serializeError)(r.errorMessage,"selectProvider");if(typeof r.result!="string")throw(0,st.serializeError)("result was not a string","selectProvider");return r.result}supportsSubscriptions(){return!1}subscribe(){throw new Error("Subscriptions are not supported")}unsubscribe(){throw new Error("Subscriptions are not supported")}disconnect(){return!0}_sendRequest(t){const n={jsonrpc:"2.0",id:t.id},{method:r}=t;if(n.result=this._handleSynchronousMethods(t),n.result===void 0)throw new Error(`Coinbase Wallet does not support calling ${r} synchronously without a callback. Please provide a callback parameter to call ${r} asynchronously.`);return n}_setAddresses(t,n){if(!Array.isArray(t))throw new Error("addresses is not an array");const r=t.map(i=>(0,je.ensureAddressString)(i));JSON.stringify(r)!==JSON.stringify(this._addresses)&&(this._addresses=r,this.emit("accountsChanged",this._addresses),this._storage.setItem(rI.LOCAL_STORAGE_ADDRESSES_KEY,r.join(" ")))}_sendRequestAsync(t){return new Promise((n,r)=>{try{const i=this._handleSynchronousMethods(t);if(i!==void 0)return n({jsonrpc:"2.0",id:t.id,result:i});const s=this._handleAsynchronousFilterMethods(t);if(s!==void 0){s.then(a=>n(Object.assign(Object.assign({},a),{id:t.id}))).catch(a=>r(a));return}const o=this._handleSubscriptionMethods(t);if(o!==void 0){o.then(a=>n({jsonrpc:"2.0",id:t.id,result:a.result})).catch(a=>r(a));return}}catch(i){return r(i)}this._handleAsynchronousMethods(t).then(i=>i&&n(Object.assign(Object.assign({},i),{id:t.id}))).catch(i=>r(i))})}_sendMultipleRequestsAsync(t){return Promise.all(t.map(n=>this._sendRequestAsync(n)))}_handleSynchronousMethods(t){const{method:n}=t,r=t.params||[];switch(n){case"eth_accounts":return this._eth_accounts();case"eth_coinbase":return this._eth_coinbase();case"eth_uninstallFilter":return this._eth_uninstallFilter(r);case"net_version":return this._net_version();case"eth_chainId":return this._eth_chainId();default:return}}async _handleAsynchronousMethods(t){const{method:n}=t,r=t.params||[];switch(n){case"eth_requestAccounts":return this._eth_requestAccounts();case"eth_sign":return this._eth_sign(r);case"eth_ecRecover":return this._eth_ecRecover(r);case"personal_sign":return this._personal_sign(r);case"personal_ecRecover":return this._personal_ecRecover(r);case"eth_signTransaction":return this._eth_signTransaction(r);case"eth_sendRawTransaction":return this._eth_sendRawTransaction(r);case"eth_sendTransaction":return this._eth_sendTransaction(r);case"eth_signTypedData_v1":return this._eth_signTypedData_v1(r);case"eth_signTypedData_v2":return this._throwUnsupportedMethodError();case"eth_signTypedData_v3":return this._eth_signTypedData_v3(r);case"eth_signTypedData_v4":case"eth_signTypedData":return this._eth_signTypedData_v4(r);case"cbWallet_arbitrary":return this._cbwallet_arbitrary(r);case"wallet_addEthereumChain":return this._wallet_addEthereumChain(r);case"wallet_switchEthereumChain":return this._wallet_switchEthereumChain(r);case"wallet_watchAsset":return this._wallet_watchAsset(r)}return(await this.initializeRelay()).makeEthereumJSONRPCRequest(t,this.jsonRpcUrl).catch(s=>{var o;throw(s.code===st.standardErrorCodes.rpc.methodNotFound||s.code===st.standardErrorCodes.rpc.methodNotSupported)&&((o=this.diagnostic)===null||o===void 0||o.log(Hl.EVENTS.METHOD_NOT_IMPLEMENTED,{method:t.method,sessionIdHash:this._relay?P0.Session.hash(this._relay.session.id):void 0})),s})}_handleAsynchronousFilterMethods(t){const{method:n}=t,r=t.params||[];switch(n){case"eth_newFilter":return this._eth_newFilter(r);case"eth_newBlockFilter":return this._eth_newBlockFilter();case"eth_newPendingTransactionFilter":return this._eth_newPendingTransactionFilter();case"eth_getFilterChanges":return this._eth_getFilterChanges(r);case"eth_getFilterLogs":return this._eth_getFilterLogs(r)}}_handleSubscriptionMethods(t){switch(t.method){case"eth_subscribe":case"eth_unsubscribe":return this._subscriptionManager.handleRequest(t)}}_isKnownAddress(t){try{const n=(0,je.ensureAddressString)(t);return this._addresses.map(i=>(0,je.ensureAddressString)(i)).includes(n)}catch{}return!1}_ensureKnownAddress(t){var n;if(!this._isKnownAddress(t))throw(n=this.diagnostic)===null||n===void 0||n.log(Hl.EVENTS.UNKNOWN_ADDRESS_ENCOUNTERED),new Error("Unknown Ethereum address")}_prepareTransactionParams(t){const n=t.from?(0,je.ensureAddressString)(t.from):this.selectedAddress;if(!n)throw new Error("Ethereum address is unavailable");this._ensureKnownAddress(n);const r=t.to?(0,je.ensureAddressString)(t.to):null,i=t.value!=null?(0,je.ensureBN)(t.value):new qY.default(0),s=t.data?(0,je.ensureBuffer)(t.data):Buffer.alloc(0),o=t.nonce!=null?(0,je.ensureIntNumber)(t.nonce):null,a=t.gasPrice!=null?(0,je.ensureBN)(t.gasPrice):null,c=t.maxFeePerGas!=null?(0,je.ensureBN)(t.maxFeePerGas):null,u=t.maxPriorityFeePerGas!=null?(0,je.ensureBN)(t.maxPriorityFeePerGas):null,l=t.gas!=null?(0,je.ensureBN)(t.gas):null,d=t.chainId?(0,je.ensureIntNumber)(t.chainId):this.getChainId();return{fromAddress:n,toAddress:r,weiValue:i,data:s,nonce:o,gasPriceInWei:a,maxFeePerGas:c,maxPriorityFeePerGas:u,gasLimit:l,chainId:d}}_isAuthorized(){return this._addresses.length>0}_requireAuthorization(){if(!this._isAuthorized())throw st.standardErrors.provider.unauthorized({})}_throwUnsupportedMethodError(){throw st.standardErrors.provider.unsupportedMethod({})}async _signEthereumMessage(t,n,r,i){this._ensureKnownAddress(n);try{const o=await(await this.initializeRelay()).signEthereumMessage(t,n,r,i).promise;if((0,cr.isErrorResponse)(o))throw new Error(o.errorMessage);return{jsonrpc:"2.0",id:0,result:o.result}}catch(s){throw typeof s.message=="string"&&s.message.match(/(denied|rejected)/i)?st.standardErrors.provider.userRejectedRequest("User denied message signature"):s}}async _ethereumAddressFromSignedMessage(t,n,r){const s=await(await this.initializeRelay()).ethereumAddressFromSignedMessage(t,n,r).promise;if((0,cr.isErrorResponse)(s))throw new Error(s.errorMessage);return{jsonrpc:"2.0",id:0,result:s.result}}_eth_accounts(){return[...this._addresses]}_eth_coinbase(){return this.selectedAddress||null}_net_version(){return this.getChainId().toString(10)}_eth_chainId(){return(0,je.hexStringFromIntNumber)(this.getChainId())}getChainId(){const t=this._storage.getItem(iI);if(!t)return(0,je.ensureIntNumber)(this._chainIdFromOpts);const n=parseInt(t,10);return(0,je.ensureIntNumber)(n)}async _eth_requestAccounts(){var t;if((t=this.diagnostic)===null||t===void 0||t.log(Hl.EVENTS.ETH_ACCOUNTS_STATE,{method:"provider::_eth_requestAccounts",addresses_length:this._addresses.length,sessionIdHash:this._relay?P0.Session.hash(this._relay.session.id):void 0}),this._isAuthorized())return Promise.resolve({jsonrpc:"2.0",id:0,result:this._addresses});let n;try{if(n=await(await this.initializeRelay()).requestEthereumAccounts().promise,(0,cr.isErrorResponse)(n))throw new Error(n.errorMessage)}catch(r){throw typeof r.message=="string"&&r.message.match(/(denied|rejected)/i)?st.standardErrors.provider.userRejectedRequest("User denied account authorization"):r}if(!n.result)throw new Error("accounts received is empty");return this._setAddresses(n.result),this.isCoinbaseBrowser||await this.switchEthereumChain(this.getChainId()),{jsonrpc:"2.0",id:0,result:this._addresses}}_eth_sign(t){this._requireAuthorization();const n=(0,je.ensureAddressString)(t[0]),r=(0,je.ensureBuffer)(t[1]);return this._signEthereumMessage(r,n,!1)}_eth_ecRecover(t){const n=(0,je.ensureBuffer)(t[0]),r=(0,je.ensureBuffer)(t[1]);return this._ethereumAddressFromSignedMessage(n,r,!1)}_personal_sign(t){this._requireAuthorization();const n=(0,je.ensureBuffer)(t[0]),r=(0,je.ensureAddressString)(t[1]);return this._signEthereumMessage(n,r,!0)}_personal_ecRecover(t){const n=(0,je.ensureBuffer)(t[0]),r=(0,je.ensureBuffer)(t[1]);return this._ethereumAddressFromSignedMessage(n,r,!0)}async _eth_signTransaction(t){this._requireAuthorization();const n=this._prepareTransactionParams(t[0]||{});try{const i=await(await this.initializeRelay()).signEthereumTransaction(n).promise;if((0,cr.isErrorResponse)(i))throw new Error(i.errorMessage);return{jsonrpc:"2.0",id:0,result:i.result}}catch(r){throw typeof r.message=="string"&&r.message.match(/(denied|rejected)/i)?st.standardErrors.provider.userRejectedRequest("User denied transaction signature"):r}}async _eth_sendRawTransaction(t){const n=(0,je.ensureBuffer)(t[0]),i=await(await this.initializeRelay()).submitEthereumTransaction(n,this.getChainId()).promise;if((0,cr.isErrorResponse)(i))throw new Error(i.errorMessage);return{jsonrpc:"2.0",id:0,result:i.result}}async _eth_sendTransaction(t){this._requireAuthorization();const n=this._prepareTransactionParams(t[0]||{});try{const i=await(await this.initializeRelay()).signAndSubmitEthereumTransaction(n).promise;if((0,cr.isErrorResponse)(i))throw new Error(i.errorMessage);return{jsonrpc:"2.0",id:0,result:i.result}}catch(r){throw typeof r.message=="string"&&r.message.match(/(denied|rejected)/i)?st.standardErrors.provider.userRejectedRequest("User denied transaction signature"):r}}async _eth_signTypedData_v1(t){this._requireAuthorization();const n=(0,je.ensureParsedJSONObject)(t[0]),r=(0,je.ensureAddressString)(t[1]);this._ensureKnownAddress(r);const i=J1.default.hashForSignTypedDataLegacy({data:n}),s=JSON.stringify(n,null,2);return this._signEthereumMessage(i,r,!1,s)}async _eth_signTypedData_v3(t){this._requireAuthorization();const n=(0,je.ensureAddressString)(t[0]),r=(0,je.ensureParsedJSONObject)(t[1]);this._ensureKnownAddress(n);const i=J1.default.hashForSignTypedData_v3({data:r}),s=JSON.stringify(r,null,2);return this._signEthereumMessage(i,n,!1,s)}async _eth_signTypedData_v4(t){this._requireAuthorization();const n=(0,je.ensureAddressString)(t[0]),r=(0,je.ensureParsedJSONObject)(t[1]);this._ensureKnownAddress(n);const i=J1.default.hashForSignTypedData_v4({data:r}),s=JSON.stringify(r,null,2);return this._signEthereumMessage(i,n,!1,s)}async _cbwallet_arbitrary(t){const n=t[0],r=t[1];if(typeof r!="string")throw new Error("parameter must be a string");if(typeof n!="object"||n===null)throw new Error("parameter must be an object");return{jsonrpc:"2.0",id:0,result:await this.genericRequest(n,r)}}async _wallet_addEthereumChain(t){var n,r,i,s;const o=t[0];if(((n=o.rpcUrls)===null||n===void 0?void 0:n.length)===0)return{jsonrpc:"2.0",id:0,error:{code:2,message:"please pass in at least 1 rpcUrl"}};if(!o.chainName||o.chainName.trim()==="")throw st.standardErrors.rpc.invalidParams("chainName is a required field");if(!o.nativeCurrency)throw st.standardErrors.rpc.invalidParams("nativeCurrency is a required field");const a=parseInt(o.chainId,16);return await this.addEthereumChain(a,(r=o.rpcUrls)!==null&&r!==void 0?r:[],(i=o.blockExplorerUrls)!==null&&i!==void 0?i:[],o.chainName,(s=o.iconUrls)!==null&&s!==void 0?s:[],o.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(t){const n=t[0];return await this.switchEthereumChain(parseInt(n.chainId,16)),{jsonrpc:"2.0",id:0,result:null}}async _wallet_watchAsset(t){const n=Array.isArray(t)?t[0]:t;if(!n.type)throw st.standardErrors.rpc.invalidParams("Type is required");if((n==null?void 0:n.type)!=="ERC20")throw st.standardErrors.rpc.invalidParams(`Asset of type '${n.type}' is not supported`);if(!(n!=null&&n.options))throw st.standardErrors.rpc.invalidParams("Options are required");if(!(n!=null&&n.options.address))throw st.standardErrors.rpc.invalidParams("Address is required");const r=this.getChainId(),{address:i,symbol:s,image:o,decimals:a}=n.options;return{jsonrpc:"2.0",id:0,result:await this.watchAsset(n.type,i,s,a,o,r)}}_eth_uninstallFilter(t){const n=(0,je.ensureHexString)(t[0]);return this._filterPolyfill.uninstallFilter(n)}async _eth_newFilter(t){const n=t[0];return{jsonrpc:"2.0",id:0,result:await this._filterPolyfill.newFilter(n)}}async _eth_newBlockFilter(){return{jsonrpc:"2.0",id:0,result:await this._filterPolyfill.newBlockFilter()}}async _eth_newPendingTransactionFilter(){return{jsonrpc:"2.0",id:0,result:await this._filterPolyfill.newPendingTransactionFilter()}}_eth_getFilterChanges(t){const n=(0,je.ensureHexString)(t[0]);return this._filterPolyfill.getFilterChanges(n)}_eth_getFilterLogs(t){const n=(0,je.ensureHexString)(t[0]);return this._filterPolyfill.getFilterLogs(n)}initializeRelay(){return this._relay?Promise.resolve(this._relay):this._relayProvider().then(t=>(t.setAccountsCallback((n,r)=>this._setAddresses(n,r)),t.setChainCallback((n,r)=>{this.updateProviderInfo(r,parseInt(n,10))}),t.setDappDefaultChainCallback(this._chainIdFromOpts),this._relay=t,t))}}Ja.CoinbaseWalletProvider=YY;var R0={};Object.defineProperty(R0,"__esModule",{value:!0}),R0.RelayEventManager=void 0;const QY=Ie;class XY{constructor(){this._nextRequestId=0,this.callbacks=new Map}makeRequestId(){this._nextRequestId=(this._nextRequestId+1)%2147483647;const t=this._nextRequestId,n=(0,QY.prepend0x)(t.toString(16));return this.callbacks.get(n)&&this.callbacks.delete(n),t}}R0.RelayEventManager=XY,Object.defineProperty(Xu,"__esModule",{value:!0}),Xu.CoinbaseWalletSDK=void 0;const eQ=lh,tQ=dh,oI=Ie,nQ=yh,rQ=Ja,iQ=il,sQ=Il,oQ=R0,aQ=yl,cQ=sl,aI=Ka;class T0{constructor(t){var n,r,i;this._appName="",this._appLogoUrl=null,this._relay=null,this._relayEventManager=null;const s=t.linkAPIUrl||tQ.LINK_API_URL;typeof t.overrideIsMetaMask>"u"?this._overrideIsMetaMask=!1:this._overrideIsMetaMask=t.overrideIsMetaMask,this._overrideIsCoinbaseWallet=(n=t.overrideIsCoinbaseWallet)!==null&&n!==void 0?n:!0,this._overrideIsCoinbaseBrowser=(r=t.overrideIsCoinbaseBrowser)!==null&&r!==void 0?r:!1,this._diagnosticLogger=t.diagnosticLogger,this._reloadOnDisconnect=(i=t.reloadOnDisconnect)!==null&&i!==void 0?i:!0;const o=new URL(s),a=`${o.protocol}//${o.host}`;if(this._storage=new nQ.ScopedLocalStorage(`-walletlink:${a}`),this._storage.setItem("version",T0.VERSION),this.walletExtension||this.coinbaseBrowser)return;this._relayEventManager=new oQ.RelayEventManager;const c=(0,oI.isMobileWeb)(),u=t.uiConstructor||(d=>c?new sQ.MobileRelayUI(d):new aQ.WalletLinkRelayUI(d)),l={linkAPIUrl:s,version:aI.LIB_VERSION,darkMode:!!t.darkMode,headlessMode:!!t.headlessMode,uiConstructor:u,storage:this._storage,relayEventManager:this._relayEventManager,diagnosticLogger:this._diagnosticLogger,reloadOnDisconnect:this._reloadOnDisconnect,enableMobileWalletLink:t.enableMobileWalletLink};this._relay=c?new iQ.MobileRelay(l):new cQ.WalletLinkRelay(l),this.setAppInfo(t.appName,t.appLogoUrl),!t.headlessMode&&this._relay.attachUI()}makeWeb3Provider(t="",n=1){const r=this.walletExtension;if(r)return this.isCipherProvider(r)||r.setProviderInfo(t,n),this._reloadOnDisconnect===!1&&typeof r.disableReloadOnDisconnect=="function"&&r.disableReloadOnDisconnect(),r;const i=this.coinbaseBrowser;if(i)return i;const s=this._relay;if(!s||!this._relayEventManager||!this._storage)throw new Error("Relay not initialized, should never happen");return t||s.setConnectDisabled(!0),new rQ.CoinbaseWalletProvider({relayProvider:()=>Promise.resolve(s),relayEventManager:this._relayEventManager,storage:this._storage,jsonRpcUrl:t,chainId:n,qrUrl:this.getQrUrl(),diagnosticLogger:this._diagnosticLogger,overrideIsMetaMask:this._overrideIsMetaMask,overrideIsCoinbaseWallet:this._overrideIsCoinbaseWallet,overrideIsCoinbaseBrowser:this._overrideIsCoinbaseBrowser})}setAppInfo(t,n){var r;this._appName=t||"DApp",this._appLogoUrl=n||(0,oI.getFavicon)();const i=this.walletExtension;i?this.isCipherProvider(i)||i.setAppInfo(this._appName,this._appLogoUrl):(r=this._relay)===null||r===void 0||r.setAppInfo(this._appName,this._appLogoUrl)}disconnect(){var t;const n=this===null||this===void 0?void 0:this.walletExtension;n?n.close():(t=this._relay)===null||t===void 0||t.resetAndReload()}getQrUrl(){var t,n;return(n=(t=this._relay)===null||t===void 0?void 0:t.getQRCodeUrl())!==null&&n!==void 0?n:null}getCoinbaseWalletLogo(t,n=240){return(0,eQ.walletLogo)(t,n)}get walletExtension(){var t;return(t=window.coinbaseWalletExtension)!==null&&t!==void 0?t:window.walletLinkExtension}get coinbaseBrowser(){var t,n;try{const r=(t=window.ethereum)!==null&&t!==void 0?t:(n=window.top)===null||n===void 0?void 0:n.ethereum;return r&&"isCoinbaseBrowser"in r&&r.isCoinbaseBrowser?r:void 0}catch{return}}isCipherProvider(t){return typeof t.isCipher=="boolean"&&t.isCipher}}Xu.CoinbaseWalletSDK=T0,T0.VERSION=aI.LIB_VERSION,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.CoinbaseWalletProvider=e.CoinbaseWalletSDK=void 0;const t=Xu,n=Ja;var r=Xu;Object.defineProperty(e,"CoinbaseWalletSDK",{enumerable:!0,get:function(){return r.CoinbaseWalletSDK}});var i=Ja;Object.defineProperty(e,"CoinbaseWalletProvider",{enumerable:!0,get:function(){return i.CoinbaseWalletProvider}}),e.default=t.CoinbaseWalletSDK,typeof window<"u"&&(window.CoinbaseWalletSDK=t.CoinbaseWalletSDK,window.CoinbaseWalletProvider=n.CoinbaseWalletProvider,window.WalletLink=t.CoinbaseWalletSDK,window.WalletLinkProvider=n.CoinbaseWalletProvider)}(eb);const uQ=Jo({__proto__:null,default:B0(eb)},[eb]);ft.MerchantBackdrop=rj,ft.WeaveCheckout=tj,Object.defineProperty(ft,Symbol.toStringTag,{value:"Module"})});