@edgex-web/components 0.2.0-beta.6 → 1.0.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +26 -3
- package/dist/{ccip-DGLIdqJC.mjs → ccip-CjT7UK5P.mjs} +2 -2
- package/dist/{ccip-DGLIdqJC.mjs.map → ccip-CjT7UK5P.mjs.map} +1 -1
- package/dist/components/Deposit/src/DepositManager.d.ts.map +1 -1
- package/dist/components/Deposit/src/components/evm/hooks/useDepositButtonState.d.ts.map +1 -1
- package/dist/components/Deposit/src/components/evm/index.d.ts.map +1 -1
- package/dist/components/Deposit/src/components/evm/types/index.d.ts +3 -1
- package/dist/components/Deposit/src/components/evm/types/index.d.ts.map +1 -1
- package/dist/components/Deposit/src/components/evm/utils/index.d.ts +1 -1
- package/dist/components/Deposit/src/components/evm/utils/index.d.ts.map +1 -1
- package/dist/components/Deposit/src/components/mpc/index.d.ts.map +1 -1
- package/dist/components/Deposit/src/components/mpc/types/index.d.ts +6 -1
- package/dist/components/Deposit/src/components/mpc/types/index.d.ts.map +1 -1
- package/dist/components/Deposit/src/constants/index.d.ts.map +1 -1
- package/dist/components/Deposit/src/index.d.ts.map +1 -1
- package/dist/components/Deposit/types/index.d.ts +21 -18
- package/dist/components/Deposit/types/index.d.ts.map +1 -1
- package/dist/components/Tooltip/src/Tooltip.d.ts.map +1 -1
- package/dist/components/Withdraw/src/WithdrawManager.d.ts.map +1 -1
- package/dist/components/Withdraw/src/evm/WalletView.d.ts +1 -1
- package/dist/components/Withdraw/src/evm/WalletView.d.ts.map +1 -1
- package/dist/components/Withdraw/src/evm/index.d.ts +6 -11
- package/dist/components/Withdraw/src/evm/index.d.ts.map +1 -1
- package/dist/components/Withdraw/src/index.d.ts.map +1 -1
- package/dist/components/Withdraw/types/index.d.ts +14 -19
- package/dist/components/Withdraw/types/index.d.ts.map +1 -1
- package/dist/components/shared/components/selector/Account.d.ts.map +1 -1
- package/dist/components/shared/components/selector/Asset.d.ts.map +1 -1
- package/dist/components/shared/components/selector/index.d.ts.map +1 -1
- package/dist/components/shared/components/selector/types/index.d.ts +8 -0
- package/dist/components/shared/components/selector/types/index.d.ts.map +1 -1
- package/dist/components/shared/constants/index.d.ts +8 -0
- package/dist/components/shared/constants/index.d.ts.map +1 -1
- package/dist/components/shared/utils/index.d.ts +1 -0
- package/dist/components/shared/utils/index.d.ts.map +1 -1
- package/dist/hooks/useTranslation.d.ts +27 -3
- package/dist/hooks/useTranslation.d.ts.map +1 -1
- package/dist/index-DAlfS9rk.mjs +21979 -0
- package/dist/index-DAlfS9rk.mjs.map +1 -0
- package/dist/index.esm.js +1 -1
- package/dist/index.umd.js +92 -82
- package/dist/index.umd.js.map +1 -1
- package/dist/locales/de-DE.d.ts +77 -0
- package/dist/locales/de-DE.d.ts.map +1 -0
- package/dist/locales/en-US.d.ts +13 -1
- package/dist/locales/en-US.d.ts.map +1 -1
- package/dist/locales/es-LA.d.ts +77 -0
- package/dist/locales/es-LA.d.ts.map +1 -0
- package/dist/locales/fr-FR.d.ts +77 -0
- package/dist/locales/fr-FR.d.ts.map +1 -0
- package/dist/locales/index.d.ts +7 -3
- package/dist/locales/index.d.ts.map +1 -1
- package/dist/locales/it-IT.d.ts +77 -0
- package/dist/locales/it-IT.d.ts.map +1 -0
- package/dist/locales/ja-JP.d.ts +13 -1
- package/dist/locales/ja-JP.d.ts.map +1 -1
- package/dist/locales/ru-RU.d.ts +13 -1
- package/dist/locales/ru-RU.d.ts.map +1 -1
- package/dist/locales/zh-CN.d.ts +13 -1
- package/dist/locales/zh-CN.d.ts.map +1 -1
- package/dist/locales/zh-TW.d.ts +13 -1
- package/dist/locales/zh-TW.d.ts.map +1 -1
- package/package.json +1 -1
- package/dist/index-C2V944VK.mjs +0 -20451
- package/dist/index-C2V944VK.mjs.map +0 -1
package/dist/index.umd.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(ce,v){typeof exports=="object"&&typeof module<"u"?v(exports,require("react"),require("react-dom")):typeof define=="function"&&define.amd?define(["exports","react","react-dom"],v):(ce=typeof globalThis<"u"?globalThis:ce||self,v(ce.EdgeXComponents={},ce.React,ce.ReactDOM))})(this,function(ce,v,Ue){"use strict";var mP=Object.defineProperty;var bP=(ce,v,Ue)=>v in ce?mP(ce,v,{enumerable:!0,configurable:!0,writable:!0,value:Ue}):ce[v]=Ue;var Xo=(ce,v,Ue)=>bP(ce,typeof v!="symbol"?v+"":v,Ue);function Bl(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)}const z=Bl(v),jr=Bl(Ue);function zm(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Ei={exports:{}},zr={};/**
|
|
2
2
|
* @license React
|
|
3
3
|
* react-jsx-runtime.production.min.js
|
|
4
4
|
*
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*
|
|
7
7
|
* This source code is licensed under the MIT license found in the
|
|
8
8
|
* LICENSE file in the root directory of this source tree.
|
|
9
|
-
*/var
|
|
9
|
+
*/var Ll;function Um(){if(Ll)return zr;Ll=1;var e=v,t=Symbol.for("react.element"),n=Symbol.for("react.fragment"),r=Object.prototype.hasOwnProperty,o=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,s={key:!0,ref:!0,__self:!0,__source:!0};function i(c,a,l){var u,f={},p=null,d=null;l!==void 0&&(p=""+l),a.key!==void 0&&(p=""+a.key),a.ref!==void 0&&(d=a.ref);for(u in a)r.call(a,u)&&!s.hasOwnProperty(u)&&(f[u]=a[u]);if(c&&c.defaultProps)for(u in a=c.defaultProps,a)f[u]===void 0&&(f[u]=a[u]);return{$$typeof:t,type:c,key:p,ref:d,props:f,_owner:o.current}}return zr.Fragment=n,zr.jsx=i,zr.jsxs=i,zr}var Ur={};/**
|
|
10
10
|
* @license React
|
|
11
11
|
* react-jsx-runtime.development.js
|
|
12
12
|
*
|
|
@@ -14,100 +14,109 @@
|
|
|
14
14
|
*
|
|
15
15
|
* This source code is licensed under the MIT license found in the
|
|
16
16
|
* LICENSE file in the root directory of this source tree.
|
|
17
|
-
*/var
|
|
18
|
-
`+
|
|
19
|
-
`),
|
|
20
|
-
`),
|
|
21
|
-
`+
|
|
17
|
+
*/var Fl;function _m(){return Fl||(Fl=1,process.env.NODE_ENV!=="production"&&function(){var e=v,t=Symbol.for("react.element"),n=Symbol.for("react.portal"),r=Symbol.for("react.fragment"),o=Symbol.for("react.strict_mode"),s=Symbol.for("react.profiler"),i=Symbol.for("react.provider"),c=Symbol.for("react.context"),a=Symbol.for("react.forward_ref"),l=Symbol.for("react.suspense"),u=Symbol.for("react.suspense_list"),f=Symbol.for("react.memo"),p=Symbol.for("react.lazy"),d=Symbol.for("react.offscreen"),h=Symbol.iterator,m="@@iterator";function x(R){if(R===null||typeof R!="object")return null;var G=h&&R[h]||R[m];return typeof G=="function"?G:null}var P=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function E(R){{for(var G=arguments.length,X=new Array(G>1?G-1:0),se=1;se<G;se++)X[se-1]=arguments[se];T("error",R,X)}}function T(R,G,X){{var se=P.ReactDebugCurrentFrame,ge=se.getStackAddendum();ge!==""&&(G+="%s",X=X.concat([ge]));var ye=X.map(function(he){return String(he)});ye.unshift("Warning: "+G),Function.prototype.apply.call(console[R],console,ye)}}var N=!1,M=!1,F=!1,L=!1,b=!1,g;g=Symbol.for("react.module.reference");function w(R){return!!(typeof R=="string"||typeof R=="function"||R===r||R===s||b||R===o||R===l||R===u||L||R===d||N||M||F||typeof R=="object"&&R!==null&&(R.$$typeof===p||R.$$typeof===f||R.$$typeof===i||R.$$typeof===c||R.$$typeof===a||R.$$typeof===g||R.getModuleId!==void 0))}function O(R,G,X){var se=R.displayName;if(se)return se;var ge=G.displayName||G.name||"";return ge!==""?X+"("+ge+")":X}function C(R){return R.displayName||"Context"}function I(R){if(R==null)return null;if(typeof R.tag=="number"&&E("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),typeof R=="function")return R.displayName||R.name||null;if(typeof R=="string")return R;switch(R){case r:return"Fragment";case n:return"Portal";case s:return"Profiler";case o:return"StrictMode";case l:return"Suspense";case u:return"SuspenseList"}if(typeof R=="object")switch(R.$$typeof){case c:var G=R;return C(G)+".Consumer";case i:var X=R;return C(X._context)+".Provider";case a:return O(R,R.render,"ForwardRef");case f:var se=R.displayName||null;return se!==null?se:I(R.type)||"Memo";case p:{var ge=R,ye=ge._payload,he=ge._init;try{return I(he(ye))}catch{return null}}}return null}var k=Object.assign,y=0,A,D,S,B,j,_,W;function q(){}q.__reactDisabledLog=!0;function Z(){{if(y===0){A=console.log,D=console.info,S=console.warn,B=console.error,j=console.group,_=console.groupCollapsed,W=console.groupEnd;var R={configurable:!0,enumerable:!0,value:q,writable:!0};Object.defineProperties(console,{info:R,log:R,warn:R,error:R,group:R,groupCollapsed:R,groupEnd:R})}y++}}function H(){{if(y--,y===0){var R={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:k({},R,{value:A}),info:k({},R,{value:D}),warn:k({},R,{value:S}),error:k({},R,{value:B}),group:k({},R,{value:j}),groupCollapsed:k({},R,{value:_}),groupEnd:k({},R,{value:W})})}y<0&&E("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var U=P.ReactCurrentDispatcher,J;function K(R,G,X){{if(J===void 0)try{throw Error()}catch(ge){var se=ge.stack.trim().match(/\n( *(at )?)/);J=se&&se[1]||""}return`
|
|
18
|
+
`+J+R}}var ee=!1,ie;{var Y=typeof WeakMap=="function"?WeakMap:Map;ie=new Y}function ne(R,G){if(!R||ee)return"";{var X=ie.get(R);if(X!==void 0)return X}var se;ee=!0;var ge=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var ye;ye=U.current,U.current=null,Z();try{if(G){var he=function(){throw Error()};if(Object.defineProperty(he.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(he,[])}catch(et){se=et}Reflect.construct(R,[],he)}else{try{he.call()}catch(et){se=et}R.call(he.prototype)}}else{try{throw Error()}catch(et){se=et}R()}}catch(et){if(et&&se&&typeof et.stack=="string"){for(var de=et.stack.split(`
|
|
19
|
+
`),ze=se.stack.split(`
|
|
20
|
+
`),Ae=de.length-1,Ne=ze.length-1;Ae>=1&&Ne>=0&&de[Ae]!==ze[Ne];)Ne--;for(;Ae>=1&&Ne>=0;Ae--,Ne--)if(de[Ae]!==ze[Ne]){if(Ae!==1||Ne!==1)do if(Ae--,Ne--,Ne<0||de[Ae]!==ze[Ne]){var Et=`
|
|
21
|
+
`+de[Ae].replace(" at new "," at ");return R.displayName&&Et.includes("<anonymous>")&&(Et=Et.replace("<anonymous>",R.displayName)),typeof R=="function"&&ie.set(R,Et),Et}while(Ae>=1&&Ne>=0);break}}}finally{ee=!1,U.current=ye,H(),Error.prepareStackTrace=ge}var Rr=R?R.displayName||R.name:"",or=Rr?K(Rr):"";return typeof R=="function"&&ie.set(R,or),or}function Q(R,G,X){return ne(R,!1)}function le(R){var G=R.prototype;return!!(G&&G.isReactComponent)}function re(R,G,X){if(R==null)return"";if(typeof R=="function")return ne(R,le(R));if(typeof R=="string")return K(R);switch(R){case l:return K("Suspense");case u:return K("SuspenseList")}if(typeof R=="object")switch(R.$$typeof){case a:return Q(R.render);case f:return re(R.type,G,X);case p:{var se=R,ge=se._payload,ye=se._init;try{return re(ye(ge),G,X)}catch{}}}return""}var pe=Object.prototype.hasOwnProperty,ve={},Qe=P.ReactDebugCurrentFrame;function we(R){if(R){var G=R._owner,X=re(R.type,R._source,G?G.type:null);Qe.setExtraStackFrame(X)}else Qe.setExtraStackFrame(null)}function Zt(R,G,X,se,ge){{var ye=Function.call.bind(pe);for(var he in R)if(ye(R,he)){var de=void 0;try{if(typeof R[he]!="function"){var ze=Error((se||"React class")+": "+X+" type `"+he+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof R[he]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw ze.name="Invariant Violation",ze}de=R[he](G,he,se,X,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(Ae){de=Ae}de&&!(de instanceof Error)&&(we(ge),E("%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).",se||"React class",X,he,typeof de),we(null)),de instanceof Error&&!(de.message in ve)&&(ve[de.message]=!0,we(ge),E("Failed %s type: %s",X,de.message),we(null))}}}var rr=Array.isArray;function ct(R){return rr(R)}function ZS(R){{var G=typeof Symbol=="function"&&Symbol.toStringTag,X=G&&R[Symbol.toStringTag]||R.constructor.name||"Object";return X}}function YS(R){try{return Nm(R),!1}catch{return!0}}function Nm(R){return""+R}function Cm(R){if(YS(R))return E("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",ZS(R)),Nm(R)}var Om=P.ReactCurrentOwner,XS={key:!0,ref:!0,__self:!0,__source:!0},Im,$m;function JS(R){if(pe.call(R,"ref")){var G=Object.getOwnPropertyDescriptor(R,"ref").get;if(G&&G.isReactWarning)return!1}return R.ref!==void 0}function QS(R){if(pe.call(R,"key")){var G=Object.getOwnPropertyDescriptor(R,"key").get;if(G&&G.isReactWarning)return!1}return R.key!==void 0}function eP(R,G){typeof R.ref=="string"&&Om.current}function tP(R,G){{var X=function(){Im||(Im=!0,E("%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)",G))};X.isReactWarning=!0,Object.defineProperty(R,"key",{get:X,configurable:!0})}}function nP(R,G){{var X=function(){$m||($m=!0,E("%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)",G))};X.isReactWarning=!0,Object.defineProperty(R,"ref",{get:X,configurable:!0})}}var rP=function(R,G,X,se,ge,ye,he){var de={$$typeof:t,type:R,key:G,ref:X,props:he,_owner:ye};return de._store={},Object.defineProperty(de._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(de,"_self",{configurable:!1,enumerable:!1,writable:!1,value:se}),Object.defineProperty(de,"_source",{configurable:!1,enumerable:!1,writable:!1,value:ge}),Object.freeze&&(Object.freeze(de.props),Object.freeze(de)),de};function oP(R,G,X,se,ge){{var ye,he={},de=null,ze=null;X!==void 0&&(Cm(X),de=""+X),QS(G)&&(Cm(G.key),de=""+G.key),JS(G)&&(ze=G.ref,eP(G,ge));for(ye in G)pe.call(G,ye)&&!XS.hasOwnProperty(ye)&&(he[ye]=G[ye]);if(R&&R.defaultProps){var Ae=R.defaultProps;for(ye in Ae)he[ye]===void 0&&(he[ye]=Ae[ye])}if(de||ze){var Ne=typeof R=="function"?R.displayName||R.name||"Unknown":R;de&&tP(he,Ne),ze&&nP(he,Ne)}return rP(R,de,ze,ge,se,Om.current,he)}}var Ol=P.ReactCurrentOwner,km=P.ReactDebugCurrentFrame;function Fr(R){if(R){var G=R._owner,X=re(R.type,R._source,G?G.type:null);km.setExtraStackFrame(X)}else km.setExtraStackFrame(null)}var Il;Il=!1;function $l(R){return typeof R=="object"&&R!==null&&R.$$typeof===t}function Dm(){{if(Ol.current){var R=I(Ol.current.type);if(R)return`
|
|
22
22
|
|
|
23
|
-
Check the render method of \``+
|
|
23
|
+
Check the render method of \``+R+"`."}return""}}function sP(R){return""}var Mm={};function iP(R){{var G=Dm();if(!G){var X=typeof R=="string"?R:R.displayName||R.name;X&&(G=`
|
|
24
24
|
|
|
25
|
-
Check the top-level render call using <`+
|
|
25
|
+
Check the top-level render call using <`+X+">.")}return G}}function Bm(R,G){{if(!R._store||R._store.validated||R.key!=null)return;R._store.validated=!0;var X=iP(G);if(Mm[X])return;Mm[X]=!0;var se="";R&&R._owner&&R._owner!==Ol.current&&(se=" It was passed a child from "+I(R._owner.type)+"."),Fr(R),E('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',X,se),Fr(null)}}function Lm(R,G){{if(typeof R!="object")return;if(ct(R))for(var X=0;X<R.length;X++){var se=R[X];$l(se)&&Bm(se,G)}else if($l(R))R._store&&(R._store.validated=!0);else if(R){var ge=x(R);if(typeof ge=="function"&&ge!==R.entries)for(var ye=ge.call(R),he;!(he=ye.next()).done;)$l(he.value)&&Bm(he.value,G)}}}function aP(R){{var G=R.type;if(G==null||typeof G=="string")return;var X;if(typeof G=="function")X=G.propTypes;else if(typeof G=="object"&&(G.$$typeof===a||G.$$typeof===f))X=G.propTypes;else return;if(X){var se=I(G);Zt(X,R.props,"prop",se,R)}else if(G.PropTypes!==void 0&&!Il){Il=!0;var ge=I(G);E("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",ge||"Unknown")}typeof G.getDefaultProps=="function"&&!G.getDefaultProps.isReactClassApproved&&E("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function cP(R){{for(var G=Object.keys(R.props),X=0;X<G.length;X++){var se=G[X];if(se!=="children"&&se!=="key"){Fr(R),E("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",se),Fr(null);break}}R.ref!==null&&(Fr(R),E("Invalid attribute `ref` supplied to `React.Fragment`."),Fr(null))}}var Fm={};function Rm(R,G,X,se,ge,ye){{var he=w(R);if(!he){var de="";(R===void 0||typeof R=="object"&&R!==null&&Object.keys(R).length===0)&&(de+=" 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 ze=sP();ze?de+=ze:de+=Dm();var Ae;R===null?Ae="null":ct(R)?Ae="array":R!==void 0&&R.$$typeof===t?(Ae="<"+(I(R.type)||"Unknown")+" />",de=" Did you accidentally export a JSX literal instead of a component?"):Ae=typeof R,E("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",Ae,de)}var Ne=oP(R,G,X,ge,ye);if(Ne==null)return Ne;if(he){var Et=G.children;if(Et!==void 0)if(se)if(ct(Et)){for(var Rr=0;Rr<Et.length;Rr++)Lm(Et[Rr],R);Object.freeze&&Object.freeze(Et)}else E("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 Lm(Et,R)}if(pe.call(G,"key")){var or=I(R),et=Object.keys(G).filter(function(hP){return hP!=="key"}),kl=et.length>0?"{key: someKey, "+et.join(": ..., ")+": ...}":"{key: someKey}";if(!Fm[or+kl]){var pP=et.length>0?"{"+et.join(": ..., ")+": ...}":"{}";E(`A props object containing a "key" prop is being spread into JSX:
|
|
26
26
|
let props = %s;
|
|
27
27
|
<%s {...props} />
|
|
28
28
|
React keys must be passed directly to JSX without using spread:
|
|
29
29
|
let props = %s;
|
|
30
|
-
<%s key={someKey} {...props} />`,
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
If the deposit amount exceeds 200,000, there may be a delay in the arrival time. Please be patient.`,crossChainDepositFeeTip:`Only {{coin}} ({{v}}) is supported for deposits to this address.
|
|
34
|
-
Cross-chain deposits require you to pay the Edge gas fee. The credited amount will be slightly less than your deposit amount.`,enableSystemProWithToken:"Enable {{token}} on {{network}}",enableTokenDesc:"You must enable {{token}} the first time you deposit on {{network}}.",enableWithToken:"Enable {{token}}",arrivaltimeTooltip1:"The funds will arrive in approximately {{v}} minutes (after reaching {{v1}} block confirmations).",arrivaltimeTooltip2:"Estimated time is calculated based on historical data and is for reference only. Network congestion may result in longer actual arrival times.",arrivalEstimated:"≈ {{v}} minutes",availableDesc:"The maximum amount you can deposit. When the available balance is 0 or negative, deposits cannot be made.",noPrivateKeyWalletWarning:"Do not use keyless wallets to make deposits. Depositing with a keyless wallet may result in irreversible loss of funds.",layerZeroDepositTip:"The system will complete your deposit via LayerZero based on the actual deposit conditions.",layerZeroDepositTipExceedPool:"Since the deposit amount exceeds the pool, your deposit will be completed via LayerZero.",layerZeroDepositTipGte200k:"Since the deposit amount is greater than or equal to 200,000 USDT, your deposit will be completed via LayerZero.",layerZeroDepositButton:"Deposit with LayerZero"},withdraw:{noticeDesc:"Normal withdrawals are a two-step process. The current step initiates your withdrawal request and will be processed on Layer 2. Once your funds are ready (can take up to 4 hours), you will receive a notification to withdraw funds to your wallet. Due to chain synchronization and other factors, the duration may take up to 48 hours. You are responsible for any transaction gas fees.",crossChainTips:"Cross-chain withdrawals require verification at L2 (via ZK proofs) and the withdrawal process may take up to 2 hours. Sufficient funds in the corresponding chain's asset pool are required to process cross-chain withdrawals. Gas fees will also be incurred. edgeX will charge a fee to cover this.",commonWithdraw:"Withdrawal FAQ",withdraw:"Withdraw",speed:"Speed",confirmWithdraw:"Confirm Withdrawal",speedNote:"Processing Times:",speedNoteSpeed1:"Approx. 8 Minutes",speedNoteSpeed2:"Approx. 2-4 Hours",speedNoteSpeed3:"Approx. 4 Hours",receiverAddress:"Receiver Address",fee:"Fee",feeRate:"Fee Rate",withdrawlAmount:"Withdrawal amount",amountToReceive:"Amount to Receive",minWithdraw:"Minimum Withdrawal Amount",minWithdrawParsed:"Min. Withdrawal {{amount}} {{token}}",invalidReceiverAddress:"Address cannot be empty",availableDesc:"The maximum amount you can withdraw. When the available balance is 0 or negative, withdrawals cannot be made.",feeCalculationTip:"Withdrawal fees are calculated by multiplying the withdrawal amount by the fee rate, with a minimum of 1 USDT/USDC. The fee rate may be adjusted based on actual on-chain conditions.",crossChainPoolBalance:"Cross-chain pool balance",poolBalance:"Pool balance",poolBalanceInsufficientTip:"The withdrawal amount exceeds the fund pool balance, and the withdrawal cannot be processed. Please select an option with a sufficient fund pool balance."},account:{title:"Account",
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
跨鏈充值需由您承擔 Edge 網路手續費。到帳金額會略小於您的充值金額。`,enableSystemProWithToken:"在{{network}}上啓用{{token}}",enableTokenDesc:"您首次在{{network}}上存款時必須啓用{{token}}。",enableWithToken:"啓用 {{token}}",arrivaltimeTooltip1:"資金約在 {{v}} 分鐘內(達到 {{v1}} 個區塊確認後)到賬。",arrivaltimeTooltip2:"預計時間是根據歷史資料計算所得,僅供參考。網路壅塞可能會導致實際到帳時間變長。",arrivalEstimated:"≈ {{v}}分鐘",availableDesc:"您可以充值的最大金額。當可用餘額為0或負數時,無法進行充值。",noPrivateKeyWalletWarning:"請勿使用無私鑰錢包進行充值,無私鑰錢包充值會導致資金損失且無法追回。",layerZeroDepositTip:"系統會根據充值資金的實際情況,通過 LayerZero 完成您的充值。",layerZeroDepositTipExceedPool:"由於充值資金大於資金池,將透過 LayerZero 完成您的充值。",layerZeroDepositTipGte200k:"由於充值資金大於等於 200,000 USDT,將透過 LayerZero 完成您的充值。",layerZeroDepositButton:"使用LayerZero充值"},withdraw:{noticeDesc:"普通提現是一個兩步過程。此步驟將發起您的提現請求,並將在 Layer2 進行處理。一旦資金準備就緒(可能需要最多 4 小時),您將收到一條將資金提現到錢包的通知。受鏈同步等情況影響下,時長可能需要長達 48 小時。您需要自行承擔交易 gas 費用。",crossChainTips:"跨鏈提幣需在 L2(通過零知識證明)進行驗證。提幣過程最多約需2小時。相關鏈的資產池中需有充足的資金來處理跨鏈提幣,其間還將產生礦工費。 edgeX 將收取一定的手續費作爲礦工費。",commonWithdraw:"提現說明",withdraw:"提現",speed:"速度",confirmWithdraw:"提現確認",speedNote:"處理時間:",speedNoteSpeed1:"用時約8分鐘",speedNoteSpeed2:"用時約 2-4 小時",speedNoteSpeed3:"用時約4小時",receiverAddress:"接收地址",fee:"手續費",feeRate:"費率",withdrawlAmount:"提現金額",amountToReceive:"到账金額",minWithdraw:"最小提現金額",minWithdrawParsed:"最小提現 {{amount}} {{token}}",invalidReceiverAddress:"接收地址不能為空",availableDesc:"您可以提現的最大金額。當可用餘額為0或負數時,無法進行提現。",feeCalculationTip:"提現手續費按照提現金額乘以費率計算,最低為 1 USDT/USDC。費率會根據鏈上實際情況進行調整。",crossChainPoolBalance:"跨鏈資金池餘額",poolBalance:"資金池餘額",poolBalanceInsufficientTip:"提現金額大於資金池餘額,無法進行提現。請選擇資金池餘額充足的選項。"},account:{title:"帳戶",perpetual:"合約帳戶",spot:"現貨帳戶"}},ti=["en-US","ja-JP","ru-RU","zh-CN","zh-TW"],lu={"en-US":nm,"ja-JP":rm,"ru-RU":om,"zh-CN":tm,"zh-TW":sm},Lo="en-US",im={"en-US":"English","zh-CN":"简体中文","zh-TW":"繁體中文","ja-JP":"日本語","ru-RU":"Русский"},am=e=>ti.includes(e)?lu[e]:lu[Lo],cm=e=>ti.includes(e),fu=x.createContext(null),um=({config:e,children:t})=>{const n=x.useMemo(()=>{const r=e.locale||Lo,o=cm(r)?r:Lo,s=am(o);return{...e,currentLocale:o,translations:s}},[e]);return I.jsx(fu.Provider,{value:n,children:t})},du=()=>{const e=x.useContext(fu);if(!e)throw new Error("useComponentConfig must be used within ComponentProvider");return e};var lm=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,ni=Math.ceil,Xe=Math.floor,Re="[BigNumber Error] ",pu=Re+"Number primitive has more than 15 significant digits: ",pt=1e14,ne=14,ri=9007199254740991,oi=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],ln=1e7,Ae=1e9;function hu(e){var t,n,r,o=w.prototype={constructor:w,toString:null,valueOf:null},s=new w(1),i=20,c=4,a=-7,u=21,l=-1e7,f=1e7,p=!1,d=1,h=0,m={prefix:"",groupSize:3,secondaryGroupSize:0,groupSeparator:",",decimalSeparator:".",fractionGroupSize:0,fractionGroupSeparator:" ",suffix:""},v="0123456789abcdefghijklmnopqrstuvwxyz",A=!0;function w(g,y){var $,k,N,P,S,E,C,O,b=this;if(!(b instanceof w))return new w(g,y);if(y==null){if(g&&g._isBigNumber===!0){b.s=g.s,!g.c||g.e>f?b.c=b.e=null:g.e<l?b.c=[b.e=0]:(b.e=g.e,b.c=g.c.slice());return}if((E=typeof g=="number")&&g*0==0){if(b.s=1/g<0?(g=-g,-1):1,g===~~g){for(P=0,S=g;S>=10;S/=10,P++);P>f?b.c=b.e=null:(b.e=P,b.c=[g]);return}O=String(g)}else{if(!lm.test(O=String(g)))return r(b,O,E);b.s=O.charCodeAt(0)==45?(O=O.slice(1),-1):1}(P=O.indexOf("."))>-1&&(O=O.replace(".","")),(S=O.search(/e/i))>0?(P<0&&(P=S),P+=+O.slice(S+1),O=O.substring(0,S)):P<0&&(P=O.length)}else{if(we(y,2,v.length,"Base"),y==10&&A)return b=new w(g),R(b,i+b.e+1,c);if(O=String(g),E=typeof g=="number"){if(g*0!=0)return r(b,O,E,y);if(b.s=1/g<0?(O=O.slice(1),-1):1,w.DEBUG&&O.replace(/^0\.0*|\./,"").length>15)throw Error(pu+g)}else b.s=O.charCodeAt(0)===45?(O=O.slice(1),-1):1;for($=v.slice(0,y),P=S=0,C=O.length;S<C;S++)if($.indexOf(k=O.charAt(S))<0){if(k=="."){if(S>P){P=C;continue}}else if(!N&&(O==O.toUpperCase()&&(O=O.toLowerCase())||O==O.toLowerCase()&&(O=O.toUpperCase()))){N=!0,S=-1,P=0;continue}return r(b,String(g),E,y)}E=!1,O=n(O,y,10,b.s),(P=O.indexOf("."))>-1?O=O.replace(".",""):P=O.length}for(S=0;O.charCodeAt(S)===48;S++);for(C=O.length;O.charCodeAt(--C)===48;);if(O=O.slice(S,++C)){if(C-=S,E&&w.DEBUG&&C>15&&(g>ri||g!==Xe(g)))throw Error(pu+b.s*g);if((P=P-S-1)>f)b.c=b.e=null;else if(P<l)b.c=[b.e=0];else{if(b.e=P,b.c=[],S=(P+1)%ne,P<0&&(S+=ne),S<C){for(S&&b.c.push(+O.slice(0,S)),C-=ne;S<C;)b.c.push(+O.slice(S,S+=ne));S=ne-(O=O.slice(S)).length}else S-=C;for(;S--;O+="0");b.c.push(+O)}}else b.c=[b.e=0]}w.clone=hu,w.ROUND_UP=0,w.ROUND_DOWN=1,w.ROUND_CEIL=2,w.ROUND_FLOOR=3,w.ROUND_HALF_UP=4,w.ROUND_HALF_DOWN=5,w.ROUND_HALF_EVEN=6,w.ROUND_HALF_CEIL=7,w.ROUND_HALF_FLOOR=8,w.EUCLID=9,w.config=w.set=function(g){var y,$;if(g!=null)if(typeof g=="object"){if(g.hasOwnProperty(y="DECIMAL_PLACES")&&($=g[y],we($,0,Ae,y),i=$),g.hasOwnProperty(y="ROUNDING_MODE")&&($=g[y],we($,0,8,y),c=$),g.hasOwnProperty(y="EXPONENTIAL_AT")&&($=g[y],$&&$.pop?(we($[0],-Ae,0,y),we($[1],0,Ae,y),a=$[0],u=$[1]):(we($,-Ae,Ae,y),a=-(u=$<0?-$:$))),g.hasOwnProperty(y="RANGE"))if($=g[y],$&&$.pop)we($[0],-Ae,-1,y),we($[1],1,Ae,y),l=$[0],f=$[1];else if(we($,-Ae,Ae,y),$)l=-(f=$<0?-$:$);else throw Error(Re+y+" cannot be zero: "+$);if(g.hasOwnProperty(y="CRYPTO"))if($=g[y],$===!!$)if($)if(typeof crypto<"u"&&crypto&&(crypto.getRandomValues||crypto.randomBytes))p=$;else throw p=!$,Error(Re+"crypto unavailable");else p=$;else throw Error(Re+y+" not true or false: "+$);if(g.hasOwnProperty(y="MODULO_MODE")&&($=g[y],we($,0,9,y),d=$),g.hasOwnProperty(y="POW_PRECISION")&&($=g[y],we($,0,Ae,y),h=$),g.hasOwnProperty(y="FORMAT"))if($=g[y],typeof $=="object")m=$;else throw Error(Re+y+" not an object: "+$);if(g.hasOwnProperty(y="ALPHABET"))if($=g[y],typeof $=="string"&&!/^.?$|[+\-.\s]|(.).*\1/.test($))A=$.slice(0,10)=="0123456789",v=$;else throw Error(Re+y+" invalid: "+$)}else throw Error(Re+"Object expected: "+g);return{DECIMAL_PLACES:i,ROUNDING_MODE:c,EXPONENTIAL_AT:[a,u],RANGE:[l,f],CRYPTO:p,MODULO_MODE:d,POW_PRECISION:h,FORMAT:m,ALPHABET:v}},w.isBigNumber=function(g){if(!g||g._isBigNumber!==!0)return!1;if(!w.DEBUG)return!0;var y,$,k=g.c,N=g.e,P=g.s;e:if({}.toString.call(k)=="[object Array]"){if((P===1||P===-1)&&N>=-Ae&&N<=Ae&&N===Xe(N)){if(k[0]===0){if(N===0&&k.length===1)return!0;break e}if(y=(N+1)%ne,y<1&&(y+=ne),String(k[0]).length==y){for(y=0;y<k.length;y++)if($=k[y],$<0||$>=pt||$!==Xe($))break e;if($!==0)return!0}}}else if(k===null&&N===null&&(P===null||P===1||P===-1))return!0;throw Error(Re+"Invalid BigNumber: "+g)},w.maximum=w.max=function(){return B(arguments,-1)},w.minimum=w.min=function(){return B(arguments,1)},w.random=function(){var g=9007199254740992,y=Math.random()*g&2097151?function(){return Xe(Math.random()*g)}:function(){return(Math.random()*1073741824|0)*8388608+(Math.random()*8388608|0)};return function($){var k,N,P,S,E,C=0,O=[],b=new w(s);if($==null?$=i:we($,0,Ae),S=ni($/ne),p)if(crypto.getRandomValues){for(k=crypto.getRandomValues(new Uint32Array(S*=2));C<S;)E=k[C]*131072+(k[C+1]>>>11),E>=9e15?(N=crypto.getRandomValues(new Uint32Array(2)),k[C]=N[0],k[C+1]=N[1]):(O.push(E%1e14),C+=2);C=S/2}else if(crypto.randomBytes){for(k=crypto.randomBytes(S*=7);C<S;)E=(k[C]&31)*281474976710656+k[C+1]*1099511627776+k[C+2]*4294967296+k[C+3]*16777216+(k[C+4]<<16)+(k[C+5]<<8)+k[C+6],E>=9e15?crypto.randomBytes(7).copy(k,C):(O.push(E%1e14),C+=7);C=S/7}else throw p=!1,Error(Re+"crypto unavailable");if(!p)for(;C<S;)E=y(),E<9e15&&(O[C++]=E%1e14);for(S=O[--C],$%=ne,S&&$&&(E=oi[ne-$],O[C]=Xe(S/E)*E);O[C]===0;O.pop(),C--);if(C<0)O=[P=0];else{for(P=-1;O[0]===0;O.splice(0,1),P-=ne);for(C=1,E=O[0];E>=10;E/=10,C++);C<ne&&(P-=ne-C)}return b.e=P,b.c=O,b}}(),w.sum=function(){for(var g=1,y=arguments,$=new w(y[0]);g<y.length;)$=$.plus(y[g++]);return $},n=function(){var g="0123456789";function y($,k,N,P){for(var S,E=[0],C,O=0,b=$.length;O<b;){for(C=E.length;C--;E[C]*=k);for(E[0]+=P.indexOf($.charAt(O++)),S=0;S<E.length;S++)E[S]>N-1&&(E[S+1]==null&&(E[S+1]=0),E[S+1]+=E[S]/N|0,E[S]%=N)}return E.reverse()}return function($,k,N,P,S){var E,C,O,b,M,D,_,U,W=$.indexOf("."),K=i,V=c;for(W>=0&&(b=h,h=0,$=$.replace(".",""),U=new w(k),D=U.pow($.length-W),h=b,U.c=y(zt(Je(D.c),D.e,"0"),10,N,g),U.e=U.c.length),_=y($,k,N,S?(E=v,g):(E=g,v)),O=b=_.length;_[--b]==0;_.pop());if(!_[0])return E.charAt(0);if(W<0?--O:(D.c=_,D.e=O,D.s=P,D=t(D,U,K,V,N),_=D.c,M=D.r,O=D.e),C=O+K+1,W=_[C],b=N/2,M=M||C<0||_[C+1]!=null,M=V<4?(W!=null||M)&&(V==0||V==(D.s<0?3:2)):W>b||W==b&&(V==4||M||V==6&&_[C-1]&1||V==(D.s<0?8:7)),C<1||!_[0])$=M?zt(E.charAt(1),-K,E.charAt(0)):E.charAt(0);else{if(_.length=C,M)for(--N;++_[--C]>N;)_[C]=0,C||(++O,_=[1].concat(_));for(b=_.length;!_[--b];);for(W=0,$="";W<=b;$+=E.charAt(_[W++]));$=zt($,O,E.charAt(0))}return $}}(),t=function(){function g(k,N,P){var S,E,C,O,b=0,M=k.length,D=N%ln,_=N/ln|0;for(k=k.slice();M--;)C=k[M]%ln,O=k[M]/ln|0,S=_*C+O*D,E=D*C+S%ln*ln+b,b=(E/P|0)+(S/ln|0)+_*O,k[M]=E%P;return b&&(k=[b].concat(k)),k}function y(k,N,P,S){var E,C;if(P!=S)C=P>S?1:-1;else for(E=C=0;E<P;E++)if(k[E]!=N[E]){C=k[E]>N[E]?1:-1;break}return C}function $(k,N,P,S){for(var E=0;P--;)k[P]-=E,E=k[P]<N[P]?1:0,k[P]=E*S+k[P]-N[P];for(;!k[0]&&k.length>1;k.splice(0,1));}return function(k,N,P,S,E){var C,O,b,M,D,_,U,W,K,V,Z,H,Q,X,se,me,pe,ue=k.s==N.s?1:-1,ge=k.c,oe=N.c;if(!ge||!ge[0]||!oe||!oe[0])return new w(!k.s||!N.s||(ge?oe&&ge[0]==oe[0]:!oe)?NaN:ge&&ge[0]==0||!oe?ue*0:ue/0);for(W=new w(ue),K=W.c=[],O=k.e-N.e,ue=P+O+1,E||(E=pt,O=Qe(k.e/ne)-Qe(N.e/ne),ue=ue/ne|0),b=0;oe[b]==(ge[b]||0);b++);if(oe[b]>(ge[b]||0)&&O--,ue<0)K.push(1),M=!0;else{for(X=ge.length,me=oe.length,b=0,ue+=2,D=Xe(E/(oe[0]+1)),D>1&&(oe=g(oe,D,E),ge=g(ge,D,E),me=oe.length,X=ge.length),Q=me,V=ge.slice(0,me),Z=V.length;Z<me;V[Z++]=0);pe=oe.slice(),pe=[0].concat(pe),se=oe[0],oe[1]>=E/2&&se++;do{if(D=0,C=y(oe,V,me,Z),C<0){if(H=V[0],me!=Z&&(H=H*E+(V[1]||0)),D=Xe(H/se),D>1)for(D>=E&&(D=E-1),_=g(oe,D,E),U=_.length,Z=V.length;y(_,V,U,Z)==1;)D--,$(_,me<U?pe:oe,U,E),U=_.length,C=1;else D==0&&(C=D=1),_=oe.slice(),U=_.length;if(U<Z&&(_=[0].concat(_)),$(V,_,Z,E),Z=V.length,C==-1)for(;y(oe,V,me,Z)<1;)D++,$(V,me<Z?pe:oe,Z,E),Z=V.length}else C===0&&(D++,V=[0]);K[b++]=D,V[0]?V[Z++]=ge[Q]||0:(V=[ge[Q]],Z=1)}while((Q++<X||V[0]!=null)&&ue--);M=V[0]!=null,K[0]||K.splice(0,1)}if(E==pt){for(b=1,ue=K[0];ue>=10;ue/=10,b++);R(W,P+(W.e=b+O*ne-1)+1,S,M)}else W.e=O,W.r=+M;return W}}();function T(g,y,$,k){var N,P,S,E,C;if($==null?$=c:we($,0,8),!g.c)return g.toString();if(N=g.c[0],S=g.e,y==null)C=Je(g.c),C=k==1||k==2&&(S<=a||S>=u)?Do(C,S):zt(C,S,"0");else if(g=R(new w(g),y,$),P=g.e,C=Je(g.c),E=C.length,k==1||k==2&&(y<=P||P<=a)){for(;E<y;C+="0",E++);C=Do(C,P)}else if(y-=S+(k===2&&P>S),C=zt(C,P,"0"),P+1>E){if(--y>0)for(C+=".";y--;C+="0");}else if(y+=P-E,y>0)for(P+1==E&&(C+=".");y--;C+="0");return g.s<0&&N?"-"+C:C}function B(g,y){for(var $,k,N=1,P=new w(g[0]);N<g.length;N++)k=new w(g[N]),(!k.s||($=Sn(P,k))===y||$===0&&P.s===y)&&(P=k);return P}function F(g,y,$){for(var k=1,N=y.length;!y[--N];y.pop());for(N=y[0];N>=10;N/=10,k++);return($=k+$*ne-1)>f?g.c=g.e=null:$<l?g.c=[g.e=0]:(g.e=$,g.c=y),g}r=function(){var g=/^(-?)0([xbo])(?=\w[\w.]*$)/i,y=/^([^.]+)\.$/,$=/^\.([^.]+)$/,k=/^-?(Infinity|NaN)$/,N=/^\s*\+(?=[\w.])|^\s+|\s+$/g;return function(P,S,E,C){var O,b=E?S:S.replace(N,"");if(k.test(b))P.s=isNaN(b)?null:b<0?-1:1;else{if(!E&&(b=b.replace(g,function(M,D,_){return O=(_=_.toLowerCase())=="x"?16:_=="b"?2:8,!C||C==O?D:M}),C&&(O=C,b=b.replace(y,"$1").replace($,"0.$1")),S!=b))return new w(b,O);if(w.DEBUG)throw Error(Re+"Not a"+(C?" base "+C:"")+" number: "+S);P.s=null}P.c=P.e=null}}();function R(g,y,$,k){var N,P,S,E,C,O,b,M=g.c,D=oi;if(M){e:{for(N=1,E=M[0];E>=10;E/=10,N++);if(P=y-N,P<0)P+=ne,S=y,C=M[O=0],b=Xe(C/D[N-S-1]%10);else if(O=ni((P+1)/ne),O>=M.length)if(k){for(;M.length<=O;M.push(0));C=b=0,N=1,P%=ne,S=P-ne+1}else break e;else{for(C=E=M[O],N=1;E>=10;E/=10,N++);P%=ne,S=P-ne+N,b=S<0?0:Xe(C/D[N-S-1]%10)}if(k=k||y<0||M[O+1]!=null||(S<0?C:C%D[N-S-1]),k=$<4?(b||k)&&($==0||$==(g.s<0?3:2)):b>5||b==5&&($==4||k||$==6&&(P>0?S>0?C/D[N-S]:0:M[O-1])%10&1||$==(g.s<0?8:7)),y<1||!M[0])return M.length=0,k?(y-=g.e+1,M[0]=D[(ne-y%ne)%ne],g.e=-y||0):M[0]=g.e=0,g;if(P==0?(M.length=O,E=1,O--):(M.length=O+1,E=D[ne-P],M[O]=S>0?Xe(C/D[N-S]%D[S])*E:0),k)for(;;)if(O==0){for(P=1,S=M[0];S>=10;S/=10,P++);for(S=M[0]+=E,E=1;S>=10;S/=10,E++);P!=E&&(g.e++,M[0]==pt&&(M[0]=1));break}else{if(M[O]+=E,M[O]!=pt)break;M[O--]=0,E=1}for(P=M.length;M[--P]===0;M.pop());}g.e>f?g.c=g.e=null:g.e<l&&(g.c=[g.e=0])}return g}function j(g){var y,$=g.e;return $===null?g.toString():(y=Je(g.c),y=$<=a||$>=u?Do(y,$):zt(y,$,"0"),g.s<0?"-"+y:y)}return o.absoluteValue=o.abs=function(){var g=new w(this);return g.s<0&&(g.s=1),g},o.comparedTo=function(g,y){return Sn(this,new w(g,y))},o.decimalPlaces=o.dp=function(g,y){var $,k,N,P=this;if(g!=null)return we(g,0,Ae),y==null?y=c:we(y,0,8),R(new w(P),g+P.e+1,y);if(!($=P.c))return null;if(k=((N=$.length-1)-Qe(this.e/ne))*ne,N=$[N])for(;N%10==0;N/=10,k--);return k<0&&(k=0),k},o.dividedBy=o.div=function(g,y){return t(this,new w(g,y),i,c)},o.dividedToIntegerBy=o.idiv=function(g,y){return t(this,new w(g,y),0,1)},o.exponentiatedBy=o.pow=function(g,y){var $,k,N,P,S,E,C,O,b,M=this;if(g=new w(g),g.c&&!g.isInteger())throw Error(Re+"Exponent not an integer: "+j(g));if(y!=null&&(y=new w(y)),E=g.e>14,!M.c||!M.c[0]||M.c[0]==1&&!M.e&&M.c.length==1||!g.c||!g.c[0])return b=new w(Math.pow(+j(M),E?g.s*(2-Fo(g)):+j(g))),y?b.mod(y):b;if(C=g.s<0,y){if(y.c?!y.c[0]:!y.s)return new w(NaN);k=!C&&M.isInteger()&&y.isInteger(),k&&(M=M.mod(y))}else{if(g.e>9&&(M.e>0||M.e<-1||(M.e==0?M.c[0]>1||E&&M.c[1]>=24e7:M.c[0]<8e13||E&&M.c[0]<=9999975e7)))return P=M.s<0&&Fo(g)?-0:0,M.e>-1&&(P=1/P),new w(C?1/P:P);h&&(P=ni(h/ne+2))}for(E?($=new w(.5),C&&(g.s=1),O=Fo(g)):(N=Math.abs(+j(g)),O=N%2),b=new w(s);;){if(O){if(b=b.times(M),!b.c)break;P?b.c.length>P&&(b.c.length=P):k&&(b=b.mod(y))}if(N){if(N=Xe(N/2),N===0)break;O=N%2}else if(g=g.times($),R(g,g.e+1,1),g.e>14)O=Fo(g);else{if(N=+j(g),N===0)break;O=N%2}M=M.times(M),P?M.c&&M.c.length>P&&(M.c.length=P):k&&(M=M.mod(y))}return k?b:(C&&(b=s.div(b)),y?b.mod(y):P?R(b,h,c,S):b)},o.integerValue=function(g){var y=new w(this);return g==null?g=c:we(g,0,8),R(y,y.e+1,g)},o.isEqualTo=o.eq=function(g,y){return Sn(this,new w(g,y))===0},o.isFinite=function(){return!!this.c},o.isGreaterThan=o.gt=function(g,y){return Sn(this,new w(g,y))>0},o.isGreaterThanOrEqualTo=o.gte=function(g,y){return(y=Sn(this,new w(g,y)))===1||y===0},o.isInteger=function(){return!!this.c&&Qe(this.e/ne)>this.c.length-2},o.isLessThan=o.lt=function(g,y){return Sn(this,new w(g,y))<0},o.isLessThanOrEqualTo=o.lte=function(g,y){return(y=Sn(this,new w(g,y)))===-1||y===0},o.isNaN=function(){return!this.s},o.isNegative=function(){return this.s<0},o.isPositive=function(){return this.s>0},o.isZero=function(){return!!this.c&&this.c[0]==0},o.minus=function(g,y){var $,k,N,P,S=this,E=S.s;if(g=new w(g,y),y=g.s,!E||!y)return new w(NaN);if(E!=y)return g.s=-y,S.plus(g);var C=S.e/ne,O=g.e/ne,b=S.c,M=g.c;if(!C||!O){if(!b||!M)return b?(g.s=-y,g):new w(M?S:NaN);if(!b[0]||!M[0])return M[0]?(g.s=-y,g):new w(b[0]?S:c==3?-0:0)}if(C=Qe(C),O=Qe(O),b=b.slice(),E=C-O){for((P=E<0)?(E=-E,N=b):(O=C,N=M),N.reverse(),y=E;y--;N.push(0));N.reverse()}else for(k=(P=(E=b.length)<(y=M.length))?E:y,E=y=0;y<k;y++)if(b[y]!=M[y]){P=b[y]<M[y];break}if(P&&(N=b,b=M,M=N,g.s=-g.s),y=(k=M.length)-($=b.length),y>0)for(;y--;b[$++]=0);for(y=pt-1;k>E;){if(b[--k]<M[k]){for($=k;$&&!b[--$];b[$]=y);--b[$],b[k]+=pt}b[k]-=M[k]}for(;b[0]==0;b.splice(0,1),--O);return b[0]?F(g,b,O):(g.s=c==3?-1:1,g.c=[g.e=0],g)},o.modulo=o.mod=function(g,y){var $,k,N=this;return g=new w(g,y),!N.c||!g.s||g.c&&!g.c[0]?new w(NaN):!g.c||N.c&&!N.c[0]?new w(N):(d==9?(k=g.s,g.s=1,$=t(N,g,0,3),g.s=k,$.s*=k):$=t(N,g,0,d),g=N.minus($.times(g)),!g.c[0]&&d==1&&(g.s=N.s),g)},o.multipliedBy=o.times=function(g,y){var $,k,N,P,S,E,C,O,b,M,D,_,U,W,K,V=this,Z=V.c,H=(g=new w(g,y)).c;if(!Z||!H||!Z[0]||!H[0])return!V.s||!g.s||Z&&!Z[0]&&!H||H&&!H[0]&&!Z?g.c=g.e=g.s=null:(g.s*=V.s,!Z||!H?g.c=g.e=null:(g.c=[0],g.e=0)),g;for(k=Qe(V.e/ne)+Qe(g.e/ne),g.s*=V.s,C=Z.length,M=H.length,C<M&&(U=Z,Z=H,H=U,N=C,C=M,M=N),N=C+M,U=[];N--;U.push(0));for(W=pt,K=ln,N=M;--N>=0;){for($=0,D=H[N]%K,_=H[N]/K|0,S=C,P=N+S;P>N;)O=Z[--S]%K,b=Z[S]/K|0,E=_*O+b*D,O=D*O+E%K*K+U[P]+$,$=(O/W|0)+(E/K|0)+_*b,U[P--]=O%W;U[P]=$}return $?++k:U.splice(0,1),F(g,U,k)},o.negated=function(){var g=new w(this);return g.s=-g.s||null,g},o.plus=function(g,y){var $,k=this,N=k.s;if(g=new w(g,y),y=g.s,!N||!y)return new w(NaN);if(N!=y)return g.s=-y,k.minus(g);var P=k.e/ne,S=g.e/ne,E=k.c,C=g.c;if(!P||!S){if(!E||!C)return new w(N/0);if(!E[0]||!C[0])return C[0]?g:new w(E[0]?k:N*0)}if(P=Qe(P),S=Qe(S),E=E.slice(),N=P-S){for(N>0?(S=P,$=C):(N=-N,$=E),$.reverse();N--;$.push(0));$.reverse()}for(N=E.length,y=C.length,N-y<0&&($=C,C=E,E=$,y=N),N=0;y;)N=(E[--y]=E[y]+C[y]+N)/pt|0,E[y]=pt===E[y]?0:E[y]%pt;return N&&(E=[N].concat(E),++S),F(g,E,S)},o.precision=o.sd=function(g,y){var $,k,N,P=this;if(g!=null&&g!==!!g)return we(g,1,Ae),y==null?y=c:we(y,0,8),R(new w(P),g,y);if(!($=P.c))return null;if(N=$.length-1,k=N*ne+1,N=$[N]){for(;N%10==0;N/=10,k--);for(N=$[0];N>=10;N/=10,k++);}return g&&P.e+1>k&&(k=P.e+1),k},o.shiftedBy=function(g){return we(g,-ri,ri),this.times("1e"+g)},o.squareRoot=o.sqrt=function(){var g,y,$,k,N,P=this,S=P.c,E=P.s,C=P.e,O=i+4,b=new w("0.5");if(E!==1||!S||!S[0])return new w(!E||E<0&&(!S||S[0])?NaN:S?P:1/0);if(E=Math.sqrt(+j(P)),E==0||E==1/0?(y=Je(S),(y.length+C)%2==0&&(y+="0"),E=Math.sqrt(+y),C=Qe((C+1)/2)-(C<0||C%2),E==1/0?y="5e"+C:(y=E.toExponential(),y=y.slice(0,y.indexOf("e")+1)+C),$=new w(y)):$=new w(E+""),$.c[0]){for(C=$.e,E=C+O,E<3&&(E=0);;)if(N=$,$=b.times(N.plus(t(P,N,O,1))),Je(N.c).slice(0,E)===(y=Je($.c)).slice(0,E))if($.e<C&&--E,y=y.slice(E-3,E+1),y=="9999"||!k&&y=="4999"){if(!k&&(R(N,N.e+i+2,0),N.times(N).eq(P))){$=N;break}O+=4,E+=4,k=1}else{(!+y||!+y.slice(1)&&y.charAt(0)=="5")&&(R($,$.e+i+2,1),g=!$.times($).eq(P));break}}return R($,$.e+i+1,c,g)},o.toExponential=function(g,y){return g!=null&&(we(g,0,Ae),g++),T(this,g,y,1)},o.toFixed=function(g,y){return g!=null&&(we(g,0,Ae),g=g+this.e+1),T(this,g,y)},o.toFormat=function(g,y,$){var k,N=this;if($==null)g!=null&&y&&typeof y=="object"?($=y,y=null):g&&typeof g=="object"?($=g,g=y=null):$=m;else if(typeof $!="object")throw Error(Re+"Argument not an object: "+$);if(k=N.toFixed(g,y),N.c){var P,S=k.split("."),E=+$.groupSize,C=+$.secondaryGroupSize,O=$.groupSeparator||"",b=S[0],M=S[1],D=N.s<0,_=D?b.slice(1):b,U=_.length;if(C&&(P=E,E=C,C=P,U-=P),E>0&&U>0){for(P=U%E||E,b=_.substr(0,P);P<U;P+=E)b+=O+_.substr(P,E);C>0&&(b+=O+_.slice(P)),D&&(b="-"+b)}k=M?b+($.decimalSeparator||"")+((C=+$.fractionGroupSize)?M.replace(new RegExp("\\d{"+C+"}\\B","g"),"$&"+($.fractionGroupSeparator||"")):M):b}return($.prefix||"")+k+($.suffix||"")},o.toFraction=function(g){var y,$,k,N,P,S,E,C,O,b,M,D,_=this,U=_.c;if(g!=null&&(E=new w(g),!E.isInteger()&&(E.c||E.s!==1)||E.lt(s)))throw Error(Re+"Argument "+(E.isInteger()?"out of range: ":"not an integer: ")+j(E));if(!U)return new w(_);for(y=new w(s),O=$=new w(s),k=C=new w(s),D=Je(U),P=y.e=D.length-_.e-1,y.c[0]=oi[(S=P%ne)<0?ne+S:S],g=!g||E.comparedTo(y)>0?P>0?y:O:E,S=f,f=1/0,E=new w(D),C.c[0]=0;b=t(E,y,0,1),N=$.plus(b.times(k)),N.comparedTo(g)!=1;)$=k,k=N,O=C.plus(b.times(N=O)),C=N,y=E.minus(b.times(N=y)),E=N;return N=t(g.minus($),k,0,1),C=C.plus(N.times(O)),$=$.plus(N.times(k)),C.s=O.s=_.s,P=P*2,M=t(O,k,P,c).minus(_).abs().comparedTo(t(C,$,P,c).minus(_).abs())<1?[O,k]:[C,$],f=S,M},o.toNumber=function(){return+j(this)},o.toPrecision=function(g,y){return g!=null&&we(g,1,Ae),T(this,g,y,2)},o.toString=function(g){var y,$=this,k=$.s,N=$.e;return N===null?k?(y="Infinity",k<0&&(y="-"+y)):y="NaN":(g==null?y=N<=a||N>=u?Do(Je($.c),N):zt(Je($.c),N,"0"):g===10&&A?($=R(new w($),i+N+1,c),y=zt(Je($.c),$.e,"0")):(we(g,2,v.length,"Base"),y=n(zt(Je($.c),N,"0"),10,g,k,!0)),k<0&&$.c[0]&&(y="-"+y)),y},o.valueOf=o.toJSON=function(){return j(this)},o._isBigNumber=!0,o[Symbol.toStringTag]="BigNumber",o[Symbol.for("nodejs.util.inspect.custom")]=o.valueOf,e!=null&&w.set(e),w}function Qe(e){var t=e|0;return e>0||e===t?t:t-1}function Je(e){for(var t,n,r=1,o=e.length,s=e[0]+"";r<o;){for(t=e[r++]+"",n=ne-t.length;n--;t="0"+t);s+=t}for(o=s.length;s.charCodeAt(--o)===48;);return s.slice(0,o+1||1)}function Sn(e,t){var n,r,o=e.c,s=t.c,i=e.s,c=t.s,a=e.e,u=t.e;if(!i||!c)return null;if(n=o&&!o[0],r=s&&!s[0],n||r)return n?r?0:-c:i;if(i!=c)return i;if(n=i<0,r=a==u,!o||!s)return r?0:!o^n?1:-1;if(!r)return a>u^n?1:-1;for(c=(a=o.length)<(u=s.length)?a:u,i=0;i<c;i++)if(o[i]!=s[i])return o[i]>s[i]^n?1:-1;return a==u?0:a>u^n?1:-1}function we(e,t,n,r){if(e<t||e>n||e!==Xe(e))throw Error(Re+(r||"Argument")+(typeof e=="number"?e<t||e>n?" out of range: ":" not an integer: ":" not a primitive number: ")+String(e))}function Fo(e){var t=e.c.length-1;return Qe(e.e/ne)==t&&e.c[t]%2!=0}function Do(e,t){return(e.length>1?e.charAt(0)+"."+e.slice(1):e)+(t<0?"e":"e+")+t}function zt(e,t,n){var r,o;if(t<0){for(o=n+".";++t;o+=n);e=o+e}else if(r=e.length,++t>r){for(o=n,t-=r;--t;o+=n);e+=o}else t<r&&(e=e.slice(0,t)+"."+e.slice(t));return e}var Ne=hu();const fm=(e,t=6)=>{try{const n=new Ne(e||"0");if(n.isNaN())return"0";const r=n.decimalPlaces(t,Ne.ROUND_DOWN),[o,s=""]=r.toString().split("."),i=o.replace(/\B(?=(\d{3})+(?!\d))/g,",");if(t>0){const c=(s||"").padEnd(t,"0");return`${i}.${c}`}return i}catch(n){return console.warn("formatThousands error:",n),"0"}},ht=()=>{const{translations:e,currentLocale:t}=du();return{t:(s,i)=>{try{const c=s.split(".");let a=e;for(const l of c)if(a&&typeof a=="object"&&l in a)a=a[l];else return s;let u=typeof a=="string"?a:s;return i&&typeof u=="string"&&Object.keys(i).forEach(l=>{const f=`{{${l}}}`;u=u.replace(new RegExp(f,"g"),String(i[l]))}),u}catch(c){return console.warn(`Translation error for key "${s}":`,c),s}},translations:e,locale:t,getTranslationObject:s=>{try{const i=s.split(".");let c=e;for(const a of i)if(c&&typeof c=="object"&&a in c)c=c[a];else return{};return typeof c=="object"?c:{}}catch(i){return console.warn(`Translation object error for key "${s}":`,i),{}}},hasTranslation:s=>{try{const i=s.split(".");let c=e;for(const a of i)if(c&&typeof c=="object"&&a in c)c=c[a];else return!1;return typeof c=="string"}catch{return!1}}}},dm="1.0.8";let Ze=class su extends Error{constructor(t,n={}){var i;const r=n.cause instanceof su?n.cause.details:(i=n.cause)!=null&&i.message?n.cause.message:n.details,o=n.cause instanceof su&&n.cause.docsPath||n.docsPath,s=[t||"An error occurred.","",...n.metaMessages?[...n.metaMessages,""]:[],...o?[`Docs: https://abitype.dev${o}`]:[],...r?[`Details: ${r}`]:[],`Version: abitype@${dm}`].join(`
|
|
41
|
-
`);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=o,this.metaMessages=n.metaMessages,this.shortMessage=t}};function Ht(e,t){const n=e.exec(t);return n==null?void 0:n.groups}const mu=/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/,gu=/^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)?$/,bu=/^\(.+?\).*?$/,yu=/^tuple(?<array>(\[(\d*)\])*)$/;function si(e){let t=e.type;if(yu.test(e.type)&&"components"in e){t="(";const n=e.components.length;for(let o=0;o<n;o++){const s=e.components[o];t+=si(s),o<n-1&&(t+=", ")}const r=Ht(yu,e.type);return t+=`)${(r==null?void 0:r.array)??""}`,si({...e,type:t})}return"indexed"in e&&e.indexed&&(t=`${t} indexed`),e.name?`${t} ${e.name}`:t}function Mr(e){let t="";const n=e.length;for(let r=0;r<n;r++){const o=e[r];t+=si(o),r!==n-1&&(t+=", ")}return t}function Ro(e){var t;return e.type==="function"?`function ${e.name}(${Mr(e.inputs)})${e.stateMutability&&e.stateMutability!=="nonpayable"?` ${e.stateMutability}`:""}${(t=e.outputs)!=null&&t.length?` returns (${Mr(e.outputs)})`:""}`:e.type==="event"?`event ${e.name}(${Mr(e.inputs)})`:e.type==="error"?`error ${e.name}(${Mr(e.inputs)})`:e.type==="constructor"?`constructor(${Mr(e.inputs)})${e.stateMutability==="payable"?" payable":""}`:e.type==="fallback"?`fallback() external${e.stateMutability==="payable"?" payable":""}`:"receive() external payable"}const wu=/^error (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*)\((?<parameters>.*?)\)$/;function pm(e){return wu.test(e)}function hm(e){return Ht(wu,e)}const vu=/^event (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*)\((?<parameters>.*?)\)$/;function mm(e){return vu.test(e)}function gm(e){return Ht(vu,e)}const xu=/^function (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*)\((?<parameters>.*?)\)(?: (?<scope>external|public{1}))?(?: (?<stateMutability>pure|view|nonpayable|payable{1}))?(?: returns\s?\((?<returns>.*?)\))?$/;function bm(e){return xu.test(e)}function ym(e){return Ht(xu,e)}const Eu=/^struct (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*) \{(?<properties>.*?)\}$/;function ii(e){return Eu.test(e)}function wm(e){return Ht(Eu,e)}const Su=/^constructor\((?<parameters>.*?)\)(?:\s(?<stateMutability>payable{1}))?$/;function vm(e){return Su.test(e)}function xm(e){return Ht(Su,e)}const Pu=/^fallback\(\) external(?:\s(?<stateMutability>payable{1}))?$/;function Em(e){return Pu.test(e)}function Sm(e){return Ht(Pu,e)}const Pm=/^receive\(\) external payable$/;function $m(e){return Pm.test(e)}const Tm=new Set(["indexed"]),ai=new Set(["calldata","memory","storage"]);class Am extends Ze{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 Om extends Ze{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 Cm extends Ze{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 Nm extends Ze{constructor({param:t}){super("Invalid ABI parameter.",{details:t}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidParameterError"})}}class Im extends Ze{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 Mm extends Ze{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 km extends Ze{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 Bm extends Ze{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 Kn extends Ze{constructor({signature:t,type:n}){super(`Invalid ${n} signature.`,{details:t}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidSignatureError"})}}class Lm extends Ze{constructor({signature:t}){super("Unknown signature.",{details:t}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"UnknownSignatureError"})}}class Fm extends Ze{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 Dm extends Ze{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 Rm extends Ze{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 jm(e,t,n){let r="";if(n)for(const o of Object.entries(n)){if(!o)continue;let s="";for(const i of o[1])s+=`[${i.type}${i.name?`:${i.name}`:""}]`;r+=`(${o[0]}{${s}})`}return t?`${t}:${e}${r}`:e}const ci=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 ui(e,t={}){if(bm(e))return _m(e,t);if(mm(e))return Um(e,t);if(pm(e))return zm(e,t);if(vm(e))return Hm(e,t);if(Em(e))return Wm(e);if($m(e))return{type:"receive",stateMutability:"payable"};throw new Lm({signature:e})}function _m(e,t={}){const n=ym(e);if(!n)throw new Kn({signature:e,type:"function"});const r=mt(n.parameters),o=[],s=r.length;for(let c=0;c<s;c++)o.push(Pn(r[c],{modifiers:ai,structs:t,type:"function"}));const i=[];if(n.returns){const c=mt(n.returns),a=c.length;for(let u=0;u<a;u++)i.push(Pn(c[u],{modifiers:ai,structs:t,type:"function"}))}return{name:n.name,type:"function",stateMutability:n.stateMutability??"nonpayable",inputs:o,outputs:i}}function Um(e,t={}){const n=gm(e);if(!n)throw new Kn({signature:e,type:"event"});const r=mt(n.parameters),o=[],s=r.length;for(let i=0;i<s;i++)o.push(Pn(r[i],{modifiers:Tm,structs:t,type:"event"}));return{name:n.name,type:"event",inputs:o}}function zm(e,t={}){const n=hm(e);if(!n)throw new Kn({signature:e,type:"error"});const r=mt(n.parameters),o=[],s=r.length;for(let i=0;i<s;i++)o.push(Pn(r[i],{structs:t,type:"error"}));return{name:n.name,type:"error",inputs:o}}function Hm(e,t={}){const n=xm(e);if(!n)throw new Kn({signature:e,type:"constructor"});const r=mt(n.parameters),o=[],s=r.length;for(let i=0;i<s;i++)o.push(Pn(r[i],{structs:t,type:"constructor"}));return{type:"constructor",stateMutability:n.stateMutability??"nonpayable",inputs:o}}function Wm(e){const t=Sm(e);if(!t)throw new Kn({signature:e,type:"fallback"});return{type:"fallback",stateMutability:t.stateMutability??"nonpayable"}}const Vm=/^(?<type>[a-zA-Z$_][a-zA-Z0-9$_]*)(?<array>(?:\[\d*?\])+?)?(?:\s(?<modifier>calldata|indexed|memory|storage{1}))?(?:\s(?<name>[a-zA-Z$_][a-zA-Z0-9$_]*))?$/,Gm=/^\((?<type>.+?)\)(?<array>(?:\[\d*?\])+?)?(?:\s(?<modifier>calldata|indexed|memory|storage{1}))?(?:\s(?<name>[a-zA-Z$_][a-zA-Z0-9$_]*))?$/,qm=/^u?int$/;function Pn(e,t){var f,p;const n=jm(e,t==null?void 0:t.type,t==null?void 0:t.structs);if(ci.has(n))return ci.get(n);const r=bu.test(e),o=Ht(r?Gm:Vm,e);if(!o)throw new Nm({param:e});if(o.name&&Km(o.name))throw new Im({param:e,name:o.name});const s=o.name?{name:o.name}:{},i=o.modifier==="indexed"?{indexed:!0}:{},c=(t==null?void 0:t.structs)??{};let a,u={};if(r){a="tuple";const d=mt(o.type),h=[],m=d.length;for(let v=0;v<m;v++)h.push(Pn(d[v],{structs:c}));u={components:h}}else if(o.type in c)a="tuple",u={components:c[o.type]};else if(qm.test(o.type))a=`${o.type}256`;else if(a=o.type,(t==null?void 0:t.type)!=="struct"&&!$u(a))throw new Cm({type:a});if(o.modifier){if(!((p=(f=t==null?void 0:t.modifiers)==null?void 0:f.has)!=null&&p.call(f,o.modifier)))throw new Mm({param:e,type:t==null?void 0:t.type,modifier:o.modifier});if(ai.has(o.modifier)&&!Ym(a,!!o.array))throw new km({param:e,type:t==null?void 0:t.type,modifier:o.modifier})}const l={type:`${a}${o.array??""}`,...s,...i,...u};return ci.set(n,l),l}function mt(e,t=[],n="",r=0){const o=e.trim().length;for(let s=0;s<o;s++){const i=e[s],c=e.slice(s+1);switch(i){case",":return r===0?mt(c,[...t,n.trim()]):mt(c,t,`${n}${i}`,r);case"(":return mt(c,t,`${n}${i}`,r+1);case")":return mt(c,t,`${n}${i}`,r-1);default:return mt(c,t,`${n}${i}`,r)}}if(n==="")return t;if(r!==0)throw new Rm({current:n,depth:r});return t.push(n.trim()),t}function $u(e){return e==="address"||e==="bool"||e==="function"||e==="string"||mu.test(e)||gu.test(e)}const Zm=/^(?: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 Km(e){return e==="address"||e==="bool"||e==="function"||e==="string"||e==="tuple"||mu.test(e)||gu.test(e)||Zm.test(e)}function Ym(e,t){return t||e==="bytes"||e==="string"||e==="tuple"}function Tu(e){const t={},n=e.length;for(let i=0;i<n;i++){const c=e[i];if(!ii(c))continue;const a=wm(c);if(!a)throw new Kn({signature:c,type:"struct"});const u=a.properties.split(";"),l=[],f=u.length;for(let p=0;p<f;p++){const h=u[p].trim();if(!h)continue;const m=Pn(h,{type:"struct"});l.push(m)}if(!l.length)throw new Fm({signature:c});t[a.name]=l}const r={},o=Object.entries(t),s=o.length;for(let i=0;i<s;i++){const[c,a]=o[i];r[c]=Au(a,t)}return r}const Xm=/^(?<type>[a-zA-Z$_][a-zA-Z0-9$_]*)(?<array>(?:\[\d*?\])+?)?$/;function Au(e,t,n=new Set){const r=[],o=e.length;for(let s=0;s<o;s++){const i=e[s];if(bu.test(i.type))r.push(i);else{const a=Ht(Xm,i.type);if(!(a!=null&&a.type))throw new Bm({abiParameter:i});const{array:u,type:l}=a;if(l in t){if(n.has(l))throw new Dm({type:l});r.push({...i,type:`tuple${u??""}`,components:Au(t[l]??[],t,new Set([...n,l]))})}else if($u(l))r.push(i);else throw new Om({type:l})}}return r}function Ou(e){const t=Tu(e),n=[],r=e.length;for(let o=0;o<r;o++){const s=e[o];ii(s)||n.push(ui(s,t))}return n}function Cu(e){let t;if(typeof e=="string")t=ui(e);else{const n=Tu(e),r=e.length;for(let o=0;o<r;o++){const s=e[o];if(!ii(s)){t=ui(s,n);break}}}if(!t)throw new Am({signature:e});return t}function ee(e,t,n){const r=e[t.name];if(typeof r=="function")return r;const o=e[n];return typeof o=="function"?o:s=>t(e,s)}function gt(e,{includeName:t=!1}={}){if(e.type!=="function"&&e.type!=="event"&&e.type!=="error")throw new lg(e.type);return`${e.name}(${jo(e.inputs,{includeName:t})})`}function jo(e,{includeName:t=!1}={}){return e?e.map(n=>Qm(n,{includeName:t})).join(t?", ":","):""}function Qm(e,{includeName:t}){return e.type.startsWith("tuple")?`(${jo(e.components,{includeName:t})})${e.type.slice(5)}`:e.type+(t&&e.name?` ${e.name}`:"")}function bt(e,{strict:t=!0}={}){return!e||typeof e!="string"?!1:t?/^0x[0-9a-fA-F]*$/.test(e):e.startsWith("0x")}function xe(e){return bt(e,{strict:!1})?Math.ceil((e.length-2)/2):e.length}const Nu="2.34.0";let kr={getDocsUrl:({docsBaseUrl:e,docsPath:t="",docsSlug:n})=>t?`${e??"https://viem.sh"}${t}${n?`#${n}`:""}`:void 0,version:`viem@${Nu}`},G=class iu extends Error{constructor(t,n={}){var c;const r=(()=>{var a;return n.cause instanceof iu?n.cause.details:(a=n.cause)!=null&&a.message?n.cause.message:n.details})(),o=n.cause instanceof iu&&n.cause.docsPath||n.docsPath,s=(c=kr.getDocsUrl)==null?void 0:c.call(kr,{...n,docsPath:o}),i=[t||"An error occurred.","",...n.metaMessages?[...n.metaMessages,""]:[],...s?[`Docs: ${s}`]:[],...r?[`Details: ${r}`]:[],...kr.version?[`Version: ${kr.version}`]:[]].join(`
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
`),{docsPath:n,name:"AbiErrorSignatureNotFoundError"}),Object.defineProperty(this,"signature",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.signature=t}}class og extends G{constructor({docsPath:t}){super("Cannot extract event signature from empty topics.",{docsPath:t,name:"AbiEventSignatureEmptyTopicsError"})}}class Fu extends G{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://openchain.xyz/signatures?query=${t}.`].join(`
|
|
51
|
-
`),{docsPath:n,name:"AbiEventSignatureNotFoundError"})}}class Du extends G{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(`
|
|
52
|
-
`),{
|
|
53
|
-
`),{docsPath:
|
|
54
|
-
`),{docsPath:
|
|
55
|
-
`),{
|
|
56
|
-
`),{
|
|
57
|
-
`),{name:"
|
|
58
|
-
`),{docsPath:n,name:"
|
|
59
|
-
`),{docsPath:n,name:"
|
|
60
|
-
`),{name:"
|
|
61
|
-
`),{name:"InvalidDefinitionTypeError"})}}class fg extends G{constructor(t){super(`Filter type "${t}" is not supported.`,{name:"FilterTypeNotSupportedError"})}}let _u=class extends G{constructor({offset:t,position:n,size:r}){super(`Slice ${n==="start"?"starting":"ending"} at offset "${t}" is out-of-bounds (size: ${r}).`,{name:"SliceOffsetOutOfBoundsError"})}},Uu=class extends G{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 zu extends G{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 Xn(e,{dir:t,size:n=32}={}){return typeof e=="string"?fn(e,{dir:t,size:n}):dg(e,{dir:t,size:n})}function fn(e,{dir:t,size:n=32}={}){if(n===null)return e;const r=e.replace("0x","");if(r.length>n*2)throw new Uu({size:Math.ceil(r.length/2),targetSize:n,type:"hex"});return`0x${r[t==="right"?"padEnd":"padStart"](n*2,"0")}`}function dg(e,{dir:t,size:n=32}={}){if(n===null)return e;if(e.length>n)throw new Uu({size:e.length,targetSize:n,type:"bytes"});const r=new Uint8Array(n);for(let o=0;o<n;o++){const s=t==="right";r[s?o:n-o-1]=e[s?o:e.length-o-1]}return r}let Hu=class extends G{constructor({max:t,min:n,signed:r,size:o,value:s}){super(`Number "${s}" is not in safe ${o?`${o*8}-bit ${r?"signed":"unsigned"} `:""}integer range ${t?`(${n} to ${t})`:`(above ${n})`}`,{name:"IntegerOutOfRangeError"})}};class pg extends G{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 hg extends G{constructor(t){super(`Hex value "${t}" is not a valid boolean. The hex value must be "0x0" (false) or "0x1" (true).`,{name:"InvalidHexBooleanError"})}}let mg=class extends G{constructor({givenSize:t,maxSize:n}){super(`Size cannot exceed ${n} bytes. Given size: ${t} bytes.`,{name:"SizeOverflowError"})}};function $n(e,{dir:t="left"}={}){let n=typeof e=="string"?e.replace("0x",""):e,r=0;for(let o=0;o<n.length-1&&n[t==="left"?o:n.length-o-1].toString()==="0";o++)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 yt(e,{size:t}){if(xe(e)>t)throw new mg({givenSize:xe(e),maxSize:t})}function Ot(e,t={}){const{signed:n}=t;t.size&&yt(e,{size:t.size});const r=BigInt(e);if(!n)return r;const o=(e.length-2)/2,s=(1n<<BigInt(o)*8n-1n)-1n;return r<=s?r:r-BigInt(`0x${"f".padStart(o*2,"f")}`)-1n}function gg(e,t={}){let n=e;if(t.size&&(yt(n,{size:t.size}),n=$n(n)),$n(n)==="0x00")return!1;if($n(n)==="0x01")return!0;throw new hg(n)}function Wt(e,t={}){return Number(Ot(e,t))}const bg=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function Vt(e,t={}){return typeof e=="number"||typeof e=="bigint"?J(e,t):typeof e=="string"?Fr(e,t):typeof e=="boolean"?Wu(e,t):$e(e,t)}function Wu(e,t={}){const n=`0x${Number(e)}`;return typeof t.size=="number"?(yt(n,{size:t.size}),Xn(n,{size:t.size})):n}function $e(e,t={}){let n="";for(let o=0;o<e.length;o++)n+=bg[e[o]];const r=`0x${n}`;return typeof t.size=="number"?(yt(r,{size:t.size}),Xn(r,{dir:"right",size:t.size})):r}function J(e,t={}){const{signed:n,size:r}=t,o=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 i=typeof s=="bigint"&&n?-s-1n:0;if(s&&o>s||o<i){const a=typeof e=="bigint"?"n":"";throw new Hu({max:s?`${s}${a}`:void 0,min:`${i}${a}`,signed:n,size:r,value:`${e}${a}`})}const c=`0x${(n&&o<0?(1n<<BigInt(r*8))+BigInt(o):o).toString(16)}`;return r?Xn(c,{size:r}):c}const yg=new TextEncoder;function Fr(e,t={}){const n=yg.encode(e);return $e(n,t)}const wg=new TextEncoder;function Qn(e,t={}){return typeof e=="number"||typeof e=="bigint"?xg(e,t):typeof e=="boolean"?vg(e,t):bt(e)?wt(e,t):Tn(e,t)}function vg(e,t={}){const n=new Uint8Array(1);return n[0]=Number(e),typeof t.size=="number"?(yt(n,{size:t.size}),Xn(n,{size:t.size})):n}const Gt={zero:48,nine:57,A:65,F:70,a:97,f:102};function Vu(e){if(e>=Gt.zero&&e<=Gt.nine)return e-Gt.zero;if(e>=Gt.A&&e<=Gt.F)return e-(Gt.A-10);if(e>=Gt.a&&e<=Gt.f)return e-(Gt.a-10)}function wt(e,t={}){let n=e;t.size&&(yt(n,{size:t.size}),n=Xn(n,{dir:"right",size:t.size}));let r=n.slice(2);r.length%2&&(r=`0${r}`);const o=r.length/2,s=new Uint8Array(o);for(let i=0,c=0;i<o;i++){const a=Vu(r.charCodeAt(c++)),u=Vu(r.charCodeAt(c++));if(a===void 0||u===void 0)throw new G(`Invalid byte sequence ("${r[c-2]}${r[c-1]}" in "${r}").`);s[i]=a*16+u}return s}function xg(e,t){const n=J(e,t);return wt(n)}function Tn(e,t={}){const n=wg.encode(e);return typeof t.size=="number"?(yt(n,{size:t.size}),Xn(n,{dir:"right",size:t.size})):n}const Uo=BigInt(2**32-1),Gu=BigInt(32);function Eg(e,t=!1){return t?{h:Number(e&Uo),l:Number(e>>Gu&Uo)}:{h:Number(e>>Gu&Uo)|0,l:Number(e&Uo)|0}}function Sg(e,t=!1){const n=e.length;let r=new Uint32Array(n),o=new Uint32Array(n);for(let s=0;s<n;s++){const{h:i,l:c}=Eg(e[s],t);[r[s],o[s]]=[i,c]}return[r,o]}const Pg=(e,t,n)=>e<<n|t>>>32-n,$g=(e,t,n)=>t<<n|e>>>32-n,Tg=(e,t,n)=>t<<n-32|e>>>64-n,Ag=(e,t,n)=>e<<n-32|t>>>64-n,Jn=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0;/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */function zo(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array"}function Dr(e){if(!Number.isSafeInteger(e)||e<0)throw new Error("positive integer expected, got "+e)}function qt(e,...t){if(!zo(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 qu(e){if(typeof e!="function"||typeof e.create!="function")throw new Error("Hash should be wrapped by utils.createHasher");Dr(e.outputLen),Dr(e.blockLen)}function er(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 Zu(e,t){qt(e);const n=t.outputLen;if(e.length<n)throw new Error("digestInto() expects output buffer of length at least "+n)}function Og(e){return new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4))}function tr(...e){for(let t=0;t<e.length;t++)e[t].fill(0)}function li(e){return new DataView(e.buffer,e.byteOffset,e.byteLength)}function Ct(e,t){return e<<32-t|e>>>t}const Cg=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;function Ng(e){return e<<24&4278190080|e<<8&16711680|e>>>8&65280|e>>>24&255}function Ig(e){for(let t=0;t<e.length;t++)e[t]=Ng(e[t]);return e}const Ku=Cg?e=>e:Ig,Yu=typeof Uint8Array.from([]).toHex=="function"&&typeof Uint8Array.fromHex=="function",Mg=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function nr(e){if(qt(e),Yu)return e.toHex();let t="";for(let n=0;n<e.length;n++)t+=Mg[e[n]];return t}const Zt={_0:48,_9:57,A:65,F:70,a:97,f:102};function Xu(e){if(e>=Zt._0&&e<=Zt._9)return e-Zt._0;if(e>=Zt.A&&e<=Zt.F)return e-(Zt.A-10);if(e>=Zt.a&&e<=Zt.f)return e-(Zt.a-10)}function Ho(e){if(typeof e!="string")throw new Error("hex string expected, got "+typeof e);if(Yu)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 o=0,s=0;o<n;o++,s+=2){const i=Xu(e.charCodeAt(s)),c=Xu(e.charCodeAt(s+1));if(i===void 0||c===void 0){const a=e[s]+e[s+1];throw new Error('hex string expected, got non-hex character "'+a+'" at index '+s)}r[o]=i*16+c}return r}function kg(e){if(typeof e!="string")throw new Error("string expected");return new Uint8Array(new TextEncoder().encode(e))}function Wo(e){return typeof e=="string"&&(e=kg(e)),qt(e),e}function dn(...e){let t=0;for(let r=0;r<e.length;r++){const o=e[r];qt(o),t+=o.length}const n=new Uint8Array(t);for(let r=0,o=0;r<e.length;r++){const s=e[r];n.set(s,o),o+=s.length}return n}class fi{}function Qu(e){const t=r=>e().update(Wo(r)).digest(),n=e();return t.outputLen=n.outputLen,t.blockLen=n.blockLen,t.create=()=>e(),t}function Ju(e=32){if(Jn&&typeof Jn.getRandomValues=="function")return Jn.getRandomValues(new Uint8Array(e));if(Jn&&typeof Jn.randomBytes=="function")return Uint8Array.from(Jn.randomBytes(e));throw new Error("crypto.getRandomValues must be defined")}const Bg=BigInt(0),Rr=BigInt(1),Lg=BigInt(2),Fg=BigInt(7),Dg=BigInt(256),Rg=BigInt(113),el=[],tl=[],nl=[];for(let e=0,t=Rr,n=1,r=0;e<24;e++){[n,r]=[r,(2*n+3*r)%5],el.push(2*(5*r+n)),tl.push((e+1)*(e+2)/2%64);let o=Bg;for(let s=0;s<7;s++)t=(t<<Rr^(t>>Fg)*Rg)%Dg,t&Lg&&(o^=Rr<<(Rr<<BigInt(s))-Rr);nl.push(o)}const rl=Sg(nl,!0),jg=rl[0],_g=rl[1],ol=(e,t,n)=>n>32?Tg(e,t,n):Pg(e,t,n),sl=(e,t,n)=>n>32?Ag(e,t,n):$g(e,t,n);function Ug(e,t=24){const n=new Uint32Array(10);for(let r=24-t;r<24;r++){for(let i=0;i<10;i++)n[i]=e[i]^e[i+10]^e[i+20]^e[i+30]^e[i+40];for(let i=0;i<10;i+=2){const c=(i+8)%10,a=(i+2)%10,u=n[a],l=n[a+1],f=ol(u,l,1)^n[c],p=sl(u,l,1)^n[c+1];for(let d=0;d<50;d+=10)e[i+d]^=f,e[i+d+1]^=p}let o=e[2],s=e[3];for(let i=0;i<24;i++){const c=tl[i],a=ol(o,s,c),u=sl(o,s,c),l=el[i];o=e[l],s=e[l+1],e[l]=a,e[l+1]=u}for(let i=0;i<50;i+=10){for(let c=0;c<10;c++)n[c]=e[i+c];for(let c=0;c<10;c++)e[i+c]^=~n[(c+2)%10]&n[(c+4)%10]}e[0]^=jg[r],e[1]^=_g[r]}tr(n)}class di extends fi{constructor(t,n,r,o=!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=o,this.rounds=s,Dr(r),!(0<t&&t<200))throw new Error("only keccak-f1600 function is supported");this.state=new Uint8Array(200),this.state32=Og(this.state)}clone(){return this._cloneInto()}keccak(){Ku(this.state32),Ug(this.state32,this.rounds),Ku(this.state32),this.posOut=0,this.pos=0}update(t){er(this),t=Wo(t),qt(t);const{blockLen:n,state:r}=this,o=t.length;for(let s=0;s<o;){const i=Math.min(n-this.pos,o-s);for(let c=0;c<i;c++)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:o}=this;t[r]^=n,n&128&&r===o-1&&this.keccak(),t[o-1]^=128,this.keccak()}writeInto(t){er(this,!1),qt(t),this.finish();const n=this.state,{blockLen:r}=this;for(let o=0,s=t.length;o<s;){this.posOut>=r&&this.keccak();const i=Math.min(r-this.posOut,s-o);t.set(n.subarray(this.posOut,this.posOut+i),o),this.posOut+=i,o+=i}return t}xofInto(t){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(t)}xof(t){return Dr(t),this.xofInto(new Uint8Array(t))}digestInto(t){if(Zu(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,tr(this.state)}_cloneInto(t){const{blockLen:n,suffix:r,outputLen:o,rounds:s,enableXOF:i}=this;return t||(t=new di(n,r,o,i,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=o,t.enableXOF=i,t.destroyed=this.destroyed,t}}const zg=(e,t,n)=>Qu(()=>new di(t,e,n)),il=zg(1,136,256/8);function Ie(e,t){const n=t||"hex",r=il(bt(e,{strict:!1})?Qn(e):e);return n==="bytes"?r:Vt(r)}const Hg=e=>Ie(Qn(e));function Wg(e){return Hg(e)}function Vg(e){let t=!0,n="",r=0,o="",s=!1;for(let i=0;i<e.length;i++){const c=e[i];if(["(",")",","].includes(c)&&(t=!0),c==="("&&r++,c===")"&&r--,!!t){if(r===0){if(c===" "&&["event","function",""].includes(o))o="";else if(o+=c,c===")"){s=!0;break}continue}if(c===" "){e[i-1]!==","&&n!==","&&n!==",("&&(n="",t=!1);continue}o+=c,n+=c}}if(!s)throw new G("Unable to normalize signature.");return o}const Gg=e=>{const t=typeof e=="string"?e:Ro(e);return Vg(t)};function al(e){return Wg(Gg(e))}const Vo=al;let pn=class extends G{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"})}},pi=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)&&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 hi=new pi(8192);function Go(e,t){if(hi.has(`${e}.${t}`))return hi.get(`${e}.${t}`);const n=e.substring(2).toLowerCase(),r=Ie(Tn(n),"bytes"),o=n.split("");for(let i=0;i<40;i+=2)r[i>>1]>>4>=8&&o[i]&&(o[i]=o[i].toUpperCase()),(r[i>>1]&15)>=8&&o[i+1]&&(o[i+1]=o[i+1].toUpperCase());const s=`0x${o.join("")}`;return hi.set(`${e}.${t}`,s),s}function An(e,t){if(!et(e,{strict:!1}))throw new pn({address:e});return Go(e,t)}const qg=/^0x[a-fA-F0-9]{40}$/,mi=new pi(8192);function et(e,t){const{strict:n=!0}=t??{},r=`${e}.${n}`;if(mi.has(r))return mi.get(r);const o=qg.test(e)?e.toLowerCase()===e?!0:n?Go(e)===e:!0:!1;return mi.set(r,o),o}function vt(e){return typeof e[0]=="string"?rr(e):Zg(e)}function Zg(e){let t=0;for(const o of e)t+=o.length;const n=new Uint8Array(t);let r=0;for(const o of e)n.set(o,r),r+=o.length;return n}function rr(e){return`0x${e.reduce((t,n)=>t+n.replace("0x",""),"")}`}function or(e,t,n,{strict:r}={}){return bt(e,{strict:!1})?fl(e,t,n,{strict:r}):ll(e,t,n,{strict:r})}function cl(e,t){if(typeof t=="number"&&t>0&&t>xe(e)-1)throw new _u({offset:t,position:"start",size:xe(e)})}function ul(e,t,n){if(typeof t=="number"&&typeof n=="number"&&xe(e)!==n-t)throw new _u({offset:n,position:"end",size:xe(e)})}function ll(e,t,n,{strict:r}={}){cl(e,t);const o=e.slice(t,n);return r&&ul(o,t,n),o}function fl(e,t,n,{strict:r}={}){cl(e,t);const o=`0x${e.replace("0x","").slice((t??0)*2,(n??e.length)*2)}`;return r&&ul(o,t,n),o}const Kg=/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/,dl=/^(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 Kt(e,t){if(e.length!==t.length)throw new ng({expectedLength:e.length,givenLength:t.length});const n=Yg({params:e,values:t}),r=bi(n);return r.length===0?"0x":r}function Yg({params:e,values:t}){const n=[];for(let r=0;r<e.length;r++)n.push(gi({param:e[r],value:t[r]}));return n}function gi({param:e,value:t}){const n=yi(e.type);if(n){const[r,o]=n;return Qg(t,{length:r,param:{...e,type:o}})}if(e.type==="tuple")return rb(t,{param:e});if(e.type==="address")return Xg(t);if(e.type==="bool")return eb(t);if(e.type.startsWith("uint")||e.type.startsWith("int")){const r=e.type.startsWith("int"),[,,o="256"]=dl.exec(e.type)??[];return tb(t,{signed:r,size:Number(o)})}if(e.type.startsWith("bytes"))return Jg(t,{param:e});if(e.type==="string")return nb(t);throw new cg(e.type,{docsPath:"/docs/contract/encodeAbiParameters"})}function bi(e){let t=0;for(let s=0;s<e.length;s++){const{dynamic:i,encoded:c}=e[s];i?t+=32:t+=xe(c)}const n=[],r=[];let o=0;for(let s=0;s<e.length;s++){const{dynamic:i,encoded:c}=e[s];i?(n.push(J(t+o,{size:32})),r.push(c),o+=xe(c)):n.push(c)}return vt([...n,...r])}function Xg(e){if(!et(e))throw new pn({address:e});return{dynamic:!1,encoded:fn(e.toLowerCase())}}function Qg(e,{length:t,param:n}){const r=t===null;if(!Array.isArray(e))throw new ju(e);if(!r&&e.length!==t)throw new eg({expectedLength:t,givenLength:e.length,type:`${n.type}[${t}]`});let o=!1;const s=[];for(let i=0;i<e.length;i++){const c=gi({param:n,value:e[i]});c.dynamic&&(o=!0),s.push(c)}if(r||o){const i=bi(s);if(r){const c=J(s.length,{size:32});return{dynamic:!0,encoded:s.length>0?vt([c,i]):c}}if(o)return{dynamic:!0,encoded:i}}return{dynamic:!1,encoded:vt(s.map(({encoded:i})=>i))}}function Jg(e,{param:t}){const[,n]=t.type.split("bytes"),r=xe(e);if(!n){let o=e;return r%32!==0&&(o=fn(o,{dir:"right",size:Math.ceil((e.length-2)/2/32)*32})),{dynamic:!0,encoded:vt([fn(J(r,{size:32})),o])}}if(r!==Number.parseInt(n))throw new tg({expectedSize:Number.parseInt(n),value:e});return{dynamic:!1,encoded:fn(e,{dir:"right"})}}function eb(e){if(typeof e!="boolean")throw new G(`Invalid boolean value: "${e}" (type: ${typeof e}). Expected: \`true\` or \`false\`.`);return{dynamic:!1,encoded:fn(Wu(e))}}function tb(e,{signed:t,size:n=256}){if(typeof n=="number"){const r=2n**(BigInt(n)-(t?1n:0n))-1n,o=t?-r-1n:0n;if(e>r||e<o)throw new Hu({max:r.toString(),min:o.toString(),signed:t,size:n/8,value:e.toString()})}return{dynamic:!1,encoded:J(e,{size:32,signed:t})}}function nb(e){const t=Fr(e),n=Math.ceil(xe(t)/32),r=[];for(let o=0;o<n;o++)r.push(fn(or(t,o*32,(o+1)*32),{dir:"right"}));return{dynamic:!0,encoded:vt([fn(J(xe(t),{size:32})),...r])}}function rb(e,{param:t}){let n=!1;const r=[];for(let o=0;o<t.components.length;o++){const s=t.components[o],i=Array.isArray(e)?o:s.name,c=gi({param:s,value:e[i]});r.push(c),c.dynamic&&(n=!0)}return{dynamic:n,encoded:n?bi(r):vt(r.map(({encoded:o})=>o))}}function yi(e){const t=e.match(/^(.*)\[(\d+)?\]$/);return t?[t[2]?Number(t[2]):null,t[1]]:void 0}const jr=e=>or(al(e),0,4);function On(e){const{abi:t,args:n=[],name:r}=e,o=bt(r,{strict:!1}),s=t.filter(c=>o?c.type==="function"?jr(c)===r:c.type==="event"?Vo(c)===r:!1:"name"in c&&c.name===r);if(s.length===0)return;if(s.length===1)return s[0];let i;for(const c of s){if(!("inputs"in c))continue;if(!n||n.length===0){if(!c.inputs||c.inputs.length===0)return c;continue}if(!c.inputs||c.inputs.length===0||c.inputs.length!==n.length)continue;if(n.every((u,l)=>{const f="inputs"in c&&c.inputs[l];return f?wi(u,f):!1})){if(i&&"inputs"in i&&i.inputs){const u=pl(c.inputs,i.inputs,n);if(u)throw new ig({abiItem:c,type:u[0]},{abiItem:i,type:u[1]})}i=c}}return i||s[0]}function wi(e,t){const n=typeof e,r=t.type;switch(r){case"address":return et(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((o,s)=>wi(Object.values(e)[s],o)):/^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(o=>wi(o,{...t,type:r.replace(/(\[[0-9]{0,}\])$/,"")})):!1}}function pl(e,t,n){for(const r in e){const o=e[r],s=t[r];if(o.type==="tuple"&&s.type==="tuple"&&"components"in o&&"components"in s)return pl(o.components,s.components,n[r]);const i=[o.type,s.type];if(i.includes("address")&&i.includes("bytes20")?!0:i.includes("address")&&i.includes("string")?et(n[r],{strict:!1}):i.includes("address")&&i.includes("bytes")?et(n[r],{strict:!1}):!1)return i}}const hl="/docs/contract/encodeEventTopics";function _r(e){var a;const{abi:t,eventName:n,args:r}=e;let o=t[0];if(n){const u=On({abi:t,name:n});if(!u)throw new Du(n,{docsPath:hl});o=u}if(o.type!=="event")throw new Du(void 0,{docsPath:hl});const s=gt(o),i=Vo(s);let c=[];if(r&&"inputs"in o){const u=(a=o.inputs)==null?void 0:a.filter(f=>"indexed"in f&&f.indexed),l=Array.isArray(r)?r:Object.values(r).length>0?(u==null?void 0:u.map(f=>r[f.name]))??[]:[];l.length>0&&(c=(u==null?void 0:u.map((f,p)=>Array.isArray(l[p])?l[p].map((d,h)=>ml({param:f,value:l[p][h]})):typeof l[p]<"u"&&l[p]!==null?ml({param:f,value:l[p]}):null))??[])}return[i,...c]}function ml({param:e,value:t}){if(e.type==="string"||e.type==="bytes")return Ie(Qn(t));if(e.type==="tuple"||e.type.match(/^(.*)\[(\d+)?\]$/))throw new fg(e.type);return Kt([e],[t])}function qo(e,{method:t}){var r,o;const n={};return e.transport.type==="fallback"&&((o=(r=e.transport).onResponse)==null||o.call(r,({method:s,response:i,status:c,transport:a})=>{c==="success"&&t===s&&(n[i]=a.request)})),s=>n[s]||e.request}async function gl(e,t){const{address:n,abi:r,args:o,eventName:s,fromBlock:i,strict:c,toBlock:a}=t,u=qo(e,{method:"eth_newFilter"}),l=s?_r({abi:r,args:o,eventName:s}):void 0,f=await e.request({method:"eth_newFilter",params:[{address:n,fromBlock:typeof i=="bigint"?J(i):i,toBlock:typeof a=="bigint"?J(a):a,topics:l}]});return{abi:r,args:o,eventName:s,id:f,request:u(f),strict:!!c,type:"event"}}function xt(e){return typeof e=="string"?{address:e,type:"json-rpc"}:e}const bl="/docs/contract/encodeFunctionData";function ob(e){const{abi:t,args:n,functionName:r}=e;let o=t[0];if(r){const s=On({abi:t,args:n,name:r});if(!s)throw new Yn(r,{docsPath:bl});o=s}if(o.type!=="function")throw new Yn(void 0,{docsPath:bl});return{abi:[o],functionName:jr(gt(o))}}function Nt(e){const{args:t}=e,{abi:n,functionName:r}=(()=>{var c;return e.abi.length===1&&((c=e.functionName)!=null&&c.startsWith("0x"))?e:ob(e)})(),o=n[0],s=r,i="inputs"in o&&o.inputs?Kt(o.inputs,t??[]):void 0;return rr([s,i??"0x"])}const yl={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."},wl={inputs:[{name:"message",type:"string"}],name:"Error",type:"error"},sb={inputs:[{name:"reason",type:"uint256"}],name:"Panic",type:"error"};class vl extends G{constructor({offset:t}){super(`Offset \`${t}\` cannot be negative.`,{name:"NegativeOffsetError"})}}class xl extends G{constructor({length:t,position:n}){super(`Position \`${n}\` is out of bounds (\`0 < position < ${t}\`).`,{name:"PositionOutOfBoundsError"})}}class ib extends G{constructor({count:t,limit:n}){super(`Recursive read limit of \`${n}\` exceeded (recursive read count: \`${t}\`).`,{name:"RecursiveReadLimitExceededError"})}}const ab={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 ib({count:this.recursiveReadCount+1,limit:this.recursiveReadLimit})},assertPosition(e){if(e<0||e>this.bytes.length-1)throw new xl({length:this.bytes.length,position:e})},decrementPosition(e){if(e<0)throw new vl({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 vl({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 vi(e,{recursiveReadLimit:t=8192}={}){const n=Object.create(ab);return n.bytes=e,n.dataView=new DataView(e.buffer,e.byteOffset,e.byteLength),n.positionReadCount=new Map,n.recursiveReadLimit=t,n}function cb(e,t={}){typeof t.size<"u"&&yt(e,{size:t.size});const n=$e(e,t);return Ot(n,t)}function ub(e,t={}){let n=e;if(typeof t.size<"u"&&(yt(n,{size:t.size}),n=$n(n)),n.length>1||n[0]>1)throw new pg(n);return!!n[0]}function Yt(e,t={}){typeof t.size<"u"&&yt(e,{size:t.size});const n=$e(e,t);return Wt(n,t)}function lb(e,t={}){let n=e;return typeof t.size<"u"&&(yt(n,{size:t.size}),n=$n(n,{dir:"right"})),new TextDecoder().decode(n)}function Ur(e,t){const n=typeof t=="string"?wt(t):t,r=vi(n);if(xe(n)===0&&e.length>0)throw new Br;if(xe(t)&&xe(t)<32)throw new ku({data:typeof t=="string"?t:$e(t),params:e,size:xe(t)});let o=0;const s=[];for(let i=0;i<e.length;++i){const c=e[i];r.setPosition(o);const[a,u]=sr(r,c,{staticPosition:0});o+=u,s.push(a)}return s}function sr(e,t,{staticPosition:n}){const r=yi(t.type);if(r){const[o,s]=r;return db(e,{...t,type:s},{length:o,staticPosition:n})}if(t.type==="tuple")return gb(e,t,{staticPosition:n});if(t.type==="address")return fb(e);if(t.type==="bool")return pb(e);if(t.type.startsWith("bytes"))return hb(e,t,{staticPosition:n});if(t.type.startsWith("uint")||t.type.startsWith("int"))return mb(e,t);if(t.type==="string")return bb(e,{staticPosition:n});throw new ug(t.type,{docsPath:"/docs/contract/decodeAbiParameters"})}const El=32,xi=32;function fb(e){const t=e.readBytes(32);return[Go($e(ll(t,-20))),32]}function db(e,t,{length:n,staticPosition:r}){if(!n){const i=Yt(e.readBytes(xi)),c=r+i,a=c+El;e.setPosition(c);const u=Yt(e.readBytes(El)),l=zr(t);let f=0;const p=[];for(let d=0;d<u;++d){e.setPosition(a+(l?d*32:f));const[h,m]=sr(e,t,{staticPosition:a});f+=m,p.push(h)}return e.setPosition(r+32),[p,32]}if(zr(t)){const i=Yt(e.readBytes(xi)),c=r+i,a=[];for(let u=0;u<n;++u){e.setPosition(c+u*32);const[l]=sr(e,t,{staticPosition:c});a.push(l)}return e.setPosition(r+32),[a,32]}let o=0;const s=[];for(let i=0;i<n;++i){const[c,a]=sr(e,t,{staticPosition:r+o});o+=a,s.push(c)}return[s,o]}function pb(e){return[ub(e.readBytes(32),{size:32}),32]}function hb(e,t,{staticPosition:n}){const[r,o]=t.type.split("bytes");if(!o){const i=Yt(e.readBytes(32));e.setPosition(n+i);const c=Yt(e.readBytes(32));if(c===0)return e.setPosition(n+32),["0x",32];const a=e.readBytes(c);return e.setPosition(n+32),[$e(a),32]}return[$e(e.readBytes(Number.parseInt(o),32)),32]}function mb(e,t){const n=t.type.startsWith("int"),r=Number.parseInt(t.type.split("int")[1]||"256"),o=e.readBytes(32);return[r>48?cb(o,{signed:n}):Yt(o,{signed:n}),32]}function gb(e,t,{staticPosition:n}){const r=t.components.length===0||t.components.some(({name:i})=>!i),o=r?[]:{};let s=0;if(zr(t)){const i=Yt(e.readBytes(xi)),c=n+i;for(let a=0;a<t.components.length;++a){const u=t.components[a];e.setPosition(c+s);const[l,f]=sr(e,u,{staticPosition:c});s+=f,o[r?a:u==null?void 0:u.name]=l}return e.setPosition(n+32),[o,32]}for(let i=0;i<t.components.length;++i){const c=t.components[i],[a,u]=sr(e,c,{staticPosition:n});o[r?i:c==null?void 0:c.name]=a,s+=u}return[o,s]}function bb(e,{staticPosition:t}){const n=Yt(e.readBytes(32)),r=t+n;e.setPosition(r);const o=Yt(e.readBytes(32));if(o===0)return e.setPosition(t+32),["",32];const s=e.readBytes(o,32),i=lb($n(s));return e.setPosition(t+32),[i,32]}function zr(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(zr);const n=yi(e.type);return!!(n&&zr({...e,type:n[1]}))}function Sl(e){const{abi:t,data:n}=e,r=or(n,0,4);if(r==="0x")throw new Br;const s=[...t||[],wl,sb].find(i=>i.type==="error"&&r===jr(gt(i)));if(!s)throw new Lu(r,{docsPath:"/docs/contract/decodeErrorResult"});return{abiItem:s,args:"inputs"in s&&s.inputs&&s.inputs.length>0?Ur(s.inputs,or(n,4)):void 0,errorName:s.name}}const Te=(e,t,n)=>JSON.stringify(e,(r,o)=>typeof o=="bigint"?o.toString():o,n);function Pl({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((o,s)=>`${r&&o.name?`${o.name}: `:""}${typeof t[s]=="object"?Te(t[s]):t[s]}`).join(", ")})`}const yb={gwei:9,wei:18},wb={ether:-9,wei:9};function Ei(e,t){let n=e.toString();const r=n.startsWith("-");r&&(n=n.slice(1)),n=n.padStart(t,"0");let[o,s]=[n.slice(0,n.length-t),n.slice(n.length-t)];return s=s.replace(/(0+)$/,""),`${r?"-":""}${o||"0"}${s?`.${s}`:""}`}function $l(e,t="wei"){return Ei(e,yb[t])}function Et(e,t="wei"){return Ei(e,wb[t])}class vb extends G{constructor({address:t}){super(`State for account "${t}" is set multiple times.`,{name:"AccountStateConflictError"})}}class xb extends G{constructor(){super("state and stateDiff are set on the same account.",{name:"StateAssignmentConflictError"})}}function Tl(e){return e.reduce((t,{slot:n,value:r})=>`${t} ${n}: ${r}
|
|
62
|
-
|
|
30
|
+
<%s key={someKey} {...props} />`,kl,or,pP,or),Fm[or+kl]=!0}}return R===r?cP(Ne):aP(Ne),Ne}}function lP(R,G,X){return Rm(R,G,X,!0)}function uP(R,G,X){return Rm(R,G,X,!1)}var fP=uP,dP=lP;Ur.Fragment=r,Ur.jsx=fP,Ur.jsxs=dP}()),Ur}process.env.NODE_ENV==="production"?Ei.exports=Um():Ei.exports=_m();var $=Ei.exports;const Wm={deposit:{title:"Einzahlen",chain:"Chain",asset:"Asset",amount:"Betrag",available:"Verfügbar",equity:"Eigenkapital",confirmDeposit:"Einzahlung bestätigen",switchNetwork:"Netzwerk wechseln",max:"Max.",arrivalTime:"Ankunftszeit",ethCrossChainDepositInitiated:"ETH-Cross-Chain-Einzahlung initiiert. Voraussichtliche Ankunft in 2 bis 5 Minuten.",minDeposit:"Mindestbetrag der Einzahlung",minDepositParsed:"Min. {{amount}} {{token}} einzahlen",maxDeposit:"Maximaler Einzahlungsbetrag",depositTipFor25w:"Der Höchstbetrag pro Einzahlung beträgt 200.000. Wenn deine Einzahlung 200.000 übersteigt, verwende bitte die Ethereum-Chain.",depositAllTip:`Für Einzahlungen an diese Adresse wird nur {{coin}} ({{v}}) unterstützt.
|
|
31
|
+
Wenn der Einzahlungsbetrag 200.000 übersteigt, kann es zu einer Verzögerung der Ankunftszeit kommen. Bitte hab etwas Geduld.`,maxDepositSplitTip:"Der Höchstbetrag pro Einzahlung beträgt 200.000. Falls du mehr als 200.000 einzahlen musst, teile den Betrag bitte in mehrere Einzahlungen auf.",spotDepositNotSupportedTip:"Einzahlungen werden nicht unterstützt. Bitte zahle auf das Perpetual-Konto ein und überweise den Betrag anschließend.",crossChainDepositFeeTip:`Für Einzahlungen an diese Adresse wird nur {{coin}} ({{v}}) unterstützt.
|
|
32
|
+
Bei Chain-übergreifenden Einzahlungen musst du die Edge-Gas-Gebühr zahlen. Der gutgeschriebene Betrag wird etwas geringer sein als dein Einzahlungsbetrag.`,addressUpdatedNotice:"Hinweis: Deine Einzahlungsadresse wurde aktualisiert. Verwende die neue Adresse. Die alte Adresse funktioniert nur während der Übergangszeit und wird dann deaktiviert. Wenn sie an einem anderen Ort gespeichert wurde, aktualisiere sie umgehend.",enableSystemProWithToken:"{{token}} auf {{network}} aktivieren",enableTokenDesc:"Bei der ersten Einzahlung auf {{network}} musst du {{token}} aktivieren.",enableWithToken:"{{token}} aktivieren",arrivaltimeTooltip1:"Die Gelder kommen in etwa {{v}} Minuten an (nach Erreichen von {{v1}} Blockbestätigungen).",arrivaltimeTooltip2:"Die geschätzte Zeit wird auf der Grundlage historischer Daten berechnet und dient nur als Referenz. Eine Überlastung des Netzwerks kann zu längeren tatsächlichen Ankunftszeiten führen.",arrivalEstimated:"≈ {{v}} Minuten",availableDesc:"Der maximale Betrag, den du einzahlen kannst. Wenn das verfügbare Guthaben 0 oder negativ ist, können keine Einzahlungen vorgenommen werden.",noPrivateKeyWalletWarning:"Verwende für Einzahlungen keine schlüssellosen Wallets. Einzahlungen mit einer schlüssellosen Wallet können zu einem unwiderruflichen Verlust der Gelder führen.",layerZeroDepositTip:"Das System wird deine Einzahlung über LayerZero auf Basis der tatsächlichen Einzahlungsbedingungen abschließen.",layerZeroDepositTipExceedPool:"Da der Einzahlungsbetrag den Pool übersteigt, wird deine Einzahlung über LayerZero abgewickelt.",layerZeroDepositTipGte200k:"Da der Einzahlungsbetrag größer als oder gleich 200.000 USDT ist, wird deine Einzahlung über LayerZero abgewickelt.",layerZeroDepositButton:"Mit LayerZero einzahlen",defaultSpotNotice:"Standardeinzahlungen werden dem Spot-Konto gutgeschrieben.",defaultSpotToPerpNotice:"Für Einzahlungen an diese Adresse wird nur {{coin}} ({{v}}) unterstützt. Standardeinzahlungen werden dem Spot-Konto gutgeschrieben. Überweise Gelder vom Spot-Konto auf das Futures-Konto, um das Futures-Konto zu finanzieren.",connectedWalletTitle:"Deposit from connected wallet",connectedWalletDesc:"Use MetaMask, WalletConnect, or another provider to deposit funds from your crypto wallet.",externalWalletTitle:"Deposit from external account",externalWalletDesc:"Transfer funds from Binance or other exchanges, chains like Solana, and other wallets.",or:"OR"},withdraw:{noticeDesc:"Normale Auszahlungen erfolgen in zwei Schritten. Im aktuellen Schritt wird dein Auszahlungsantrag eingeleitet und auf Layer 2 bearbeitet. Sobald deine Gelder zur Verfügung stehen (dies kann bis zu 4 Stunden dauern), erhältst du eine Benachrichtigung, um deine Gelder in deine Wallet auszuzahlen. Aufgrund der Chain-Synchronisierung und anderer Faktoren kann die Dauer bis zu 48 Stunden betragen. Du bist für alle Gas-Gebühren der Transaktion verantwortlich.",crossChainTips:"Bei Chain-übergreifenden Auszahlungen ist eine Verifizierung über L2 (über ZK-Proofs) erforderlich. Die Auszahlung kann bis zu 2 Stunden dauern. Für die Abwicklung von Chain-übergreifenden Auszahlungen sind ausreichende Mittel im Asset-Pool der entsprechenden Chain erforderlich. Außerdem fallen Gas-Gebühren an. edgeX erhebt eine Gebühr zur Deckung dieser Kosten.",commonWithdraw:"FAQ zu Auszahlungen",withdraw:"Auszahlen",speed:"Geschwindigkeit",confirmWithdraw:"Auszahlung bestätigen",speedNote:"Bearbeitungszeiten:",speedNoteSpeed1:"Ca. 8 Minuten",speedNoteSpeed2:"Ca. 2-4 Stunden",speedNoteSpeed3:"Ca. 4 Stunden",receiverAddress:"Empfängeradresse",fee:"Gebühr",feeRate:"Gebührensatz",withdrawlAmount:"Auszahlungsbetrag",amountToReceive:"Zu erhaltender Betrag",minWithdraw:"Mindestauszahlungsbetrag",minWithdrawParsed:"Min. Auszahlung {{amount}} {{token}}",invalidReceiverAddress:"Die Adresse darf nicht leer sein.",availableDesc:"Der maximale Betrag, den du auszahlen kannst. Wenn das verfügbare Guthaben 0 oder negativ ist, können keine Auszahlungen vorgenommen werden.",feeCalculationTip:"Die Auszahlungsgebühren werden berechnet, indem der Auszahlungsbetrag mit dem Gebührensatz multipliziert wird. Der Mindestbetrag liegt bei 1 USDT/USDC. Der Gebührensatz kann auf Basis der tatsächlichen On-chain-Bedingungen angepasst werden.",crossChainPoolBalance:"Guthaben des Cross-Chain-Pools",poolBalance:"Pool-Guthaben",poolBalanceInsufficientTip:"Da der Auszahlungsbetrag das Pool-Guthaben übersteigt, kann die Auszahlung nicht bearbeitet werden. Bitte wähle eine Option mit ausreichendem Pool-Guthaben."},account:{title:"Konto",perp:"Perpetual-Konto","perpetual-v1":"Perpetuals-V1-Konto","perpetual-v2":"Perpetuals-V2-Konto",spot:"Spot-Konto"}},Vm={deposit:{title:"Deposit",chain:"Chain",asset:"Asset",amount:"Amount",available:"Available",equity:"Equity",confirmDeposit:"Confirm Deposit",switchNetwork:"Switch Network",max:"Max",arrivalTime:"Arrival Time",ethCrossChainDepositInitiated:"ETH cross-chain deposit initiated. Estimated arrival in 2–5 minutes.",minDeposit:"Minimum Deposit Amount",minDepositParsed:"Min. Deposit {{amount}} {{token}}",maxDeposit:"Maximum Deposit Amount",depositTipFor25w:"The maximum amount per deposit is 200,000. If your deposit exceeds 200,000, please use the Ethereum chain.",depositAllTip:`Only {{coin}} ({{v}}) is supported for deposits to this address.
|
|
33
|
+
If the deposit amount exceeds 200,000, there may be a delay in the arrival time. Please be patient.`,maxDepositSplitTip:"The maximum amount per deposit is 200,000. If you need to deposit more than 200,000, please split it into multiple deposits.",spotDepositNotSupportedTip:"Deposits aren't supported. Please deposit to perpetual account, then transfer.",crossChainDepositFeeTip:`Only {{coin}} ({{v}}) is supported for deposits to this address.
|
|
34
|
+
Cross-chain deposits require you to pay the Edge gas fee. The credited amount will be slightly less than your deposit amount.`,addressUpdatedNotice:"Notice: Your deposit address has been updated. Use the new address. The old one works only during the transition and will be disabled. If saved elsewhere, update it promptly.",enableSystemProWithToken:"Enable {{token}} on {{network}}",enableTokenDesc:"You must enable {{token}} the first time you deposit on {{network}}.",enableWithToken:"Enable {{token}}",arrivaltimeTooltip1:"The funds will arrive in approximately {{v}} minutes (after reaching {{v1}} block confirmations).",arrivaltimeTooltip2:"Estimated time is calculated based on historical data and is for reference only. Network congestion may result in longer actual arrival times.",arrivalEstimated:"≈ {{v}} minutes",availableDesc:"The maximum amount you can deposit. When the available balance is 0 or negative, deposits cannot be made.",noPrivateKeyWalletWarning:"Do not use keyless wallets to make deposits. Depositing with a keyless wallet may result in irreversible loss of funds.",layerZeroDepositTip:"The system will complete your deposit via LayerZero based on the actual deposit conditions.",layerZeroDepositTipExceedPool:"Since the deposit amount exceeds the pool, your deposit will be completed via LayerZero.",layerZeroDepositTipGte200k:"Since the deposit amount is greater than or equal to 200,000 USDT, your deposit will be completed via LayerZero.",layerZeroDepositButton:"Deposit with LayerZero",defaultSpotNotice:"Default deposits go to the spot account.",defaultSpotToPerpNotice:"Only {{coin}} ({{v}}) is supported for deposits to this address. Default deposits go to the spot account. To fund the futures account, transfer from the spot account to the futures account.",connectedWalletTitle:"Deposit from connected wallet",connectedWalletDesc:"Use MetaMask, WalletConnect, or another provider to deposit funds from your crypto wallet.",externalWalletTitle:"Deposit from external account",externalWalletDesc:"Transfer funds from Binance or other exchanges, chains like Solana, and other wallets.",or:"OR"},withdraw:{noticeDesc:"Normal withdrawals are a two-step process. The current step initiates your withdrawal request and will be processed on Layer 2. Once your funds are ready (can take up to 4 hours), you will receive a notification to withdraw funds to your wallet. Due to chain synchronization and other factors, the duration may take up to 48 hours. You are responsible for any transaction gas fees.",crossChainTips:"Cross-chain withdrawals require verification at L2 (via ZK proofs) and the withdrawal process may take up to 2 hours. Sufficient funds in the corresponding chain's asset pool are required to process cross-chain withdrawals. Gas fees will also be incurred. edgeX will charge a fee to cover this.",commonWithdraw:"Withdrawal FAQ",withdraw:"Withdraw",speed:"Speed",confirmWithdraw:"Confirm Withdrawal",speedNote:"Processing Times:",speedNoteSpeed1:"Approx. 8 Minutes",speedNoteSpeed2:"Approx. 2-4 Hours",speedNoteSpeed3:"Approx. 4 Hours",receiverAddress:"Receiver Address",fee:"Fee",feeRate:"Fee Rate",withdrawlAmount:"Withdrawal amount",amountToReceive:"Amount to Receive",minWithdraw:"Minimum Withdrawal Amount",minWithdrawParsed:"Min. Withdrawal {{amount}} {{token}}",invalidReceiverAddress:"Address cannot be empty",availableDesc:"The maximum amount you can withdraw. When the available balance is 0 or negative, withdrawals cannot be made.",feeCalculationTip:"Withdrawal fees are calculated by multiplying the withdrawal amount by the fee rate, with a minimum of 1 USDT/USDC. The fee rate may be adjusted based on actual on-chain conditions.",crossChainPoolBalance:"Cross-chain pool balance",poolBalance:"Pool balance",poolBalanceInsufficientTip:"The withdrawal amount exceeds the fund pool balance, and the withdrawal cannot be processed. Please select an option with a sufficient fund pool balance."},account:{title:"Account",perp:"Perpetual Account","perpetual-v1":"Perpetuals V1 Account","perpetual-v2":"Perpetuals V2 Account",spot:"Spot Account"}},Hm={deposit:{title:"Depósito",chain:"Cadena",asset:"Activo",amount:"Monto",available:"Disponible",equity:"Capital",confirmDeposit:"Confirmar depósito",switchNetwork:"Cambiar de red",max:"Máx.",arrivalTime:"Hora de llegada",ethCrossChainDepositInitiated:"Se inició el depósito entre cadenas de ETH. Llegada estimada en 2 a 5 minutos.",minDeposit:"Monto mínimo de depósito",minDepositParsed:"Mín. de depósito: {{amount}} {{token}}",maxDeposit:"Monto máximo de depósito",depositTipFor25w:"El monto máximo por depósito es de 200,000. Si tu depósito supera los 200,000, usa la cadena Ethereum.",depositAllTip:`Esta dirección solo admite depósitos en {{coin}} ({{v}})
|
|
35
|
+
Si el monto del depósito supera los 200,000, puede haber un retraso en la hora de llegada. Ten paciencia.`,maxDepositSplitTip:"El monto máximo por depósito es de 200,000. Si necesitas depositar más de 200,000, divídelo en varios depósitos.",spotDepositNotSupportedTip:"No se admiten depósitos. Deposita en la cuenta de perpetuos y luego haz la transferencia.",crossChainDepositFeeTip:`Esta dirección solo admite depósitos en {{coin}} ({{v}})
|
|
36
|
+
Los depósitos entre cadenas requieren el pago de la comisión de gas de Edge. El monto acreditado será ligeramente inferior al monto depositado.`,addressUpdatedNotice:"Aviso: Se actualizó tu dirección de depósito. Usa esta nueva dirección. La anterior solo funciona durante la transición y pronto se desactivará. Si la tienes guardada en otros dispositivos, actualízala lo antes posible.",enableSystemProWithToken:"Habilitar {{token}} en {{network}}",enableTokenDesc:"Debes habilitar {{token}} la primera vez que deposites en {{network}}.",enableWithToken:"Habilitar {{token}}",arrivaltimeTooltip1:"Los fondos se acreditarán en aproximadamente {{v}} minutos (tras obtener {{v1}} confirmaciones de bloque).",arrivaltimeTooltip2:"El tiempo estimado se calcula a partir de datos históricos y es solo de referencia. La congestión de la red puede ocasionar tiempos de acreditación más largos.",arrivalEstimated:"Aprox. {{v}} minutos",availableDesc:"Lo máximo que puedes depositar. Si el saldo disponible es 0 o negativo, los depósitos no están permitidos.",noPrivateKeyWalletWarning:"No uses billeteras sin clave para realizar depósitos. Existe el riesgo de una pérdida irreversible de los fondos.",layerZeroDepositTip:"El sistema completará tu depósito a través de LayerZero según las condiciones de depósito reales.",layerZeroDepositTipExceedPool:"Dado que el importe del depósito supera el pool, tu depósito se completará a través de LayerZero.",layerZeroDepositTipGte200k:"El depósito es de 200,000 USDT o más. Se completará a través de LayerZero.",layerZeroDepositButton:"Depositar con LayerZero",defaultSpotNotice:"Los depósitos predeterminados van a la cuenta spot.",defaultSpotToPerpNotice:"Esta dirección solo admite depósitos en {{coin}} ({{v}}) Los depósitos predeterminados van a la cuenta spot. Para agregar fondos a la cuenta de futuros, transfiere desde la cuenta spot a la cuenta de futuros.",connectedWalletTitle:"Deposit from connected wallet",connectedWalletDesc:"Use MetaMask, WalletConnect, or another provider to deposit funds from your crypto wallet.",externalWalletTitle:"Deposit from external account",externalWalletDesc:"Transfer funds from Binance or other exchanges, chains like Solana, and other wallets.",or:"OR"},withdraw:{noticeDesc:"Los retiros normales son un proceso de dos pasos. Este paso inicia tu solicitud de retiro, que se procesará en la capa 2. Una vez que tus fondos estén listos (puede tardar hasta 4 horas), recibirás una notificación para retirar fondos a tu billetera. Debido a la sincronización de la cadena y a otros factores, el proceso puede llevar hasta 48 horas. Las comisiones de gas de las transacciones corren por tu cuenta.",crossChainTips:"Los retiros entre cadenas requieren verificación en la capa 2 (mediante pruebas ZK) y el proceso de retiro puede tardar hasta 2 horas. Para procesar retiros entre cadenas, se requieren fondos suficientes en el pool de activos de la cadena correspondiente. También se incurrirá en comisiones de gas. edgeX cobrará una tarifa para cubrirlos.",commonWithdraw:"Preguntas frecuentes sobre los retiros",withdraw:"Retirar",speed:"Velocidad",confirmWithdraw:"Confirmar el retiro",speedNote:"Plazos de procesamiento:",speedNoteSpeed1:"Aprox. 8 minutos",speedNoteSpeed2:"Aprox. 2-4 horas",speedNoteSpeed3:"Aprox. 4 horas",receiverAddress:"Dirección del destinatario",fee:"Comisión",feeRate:"Tasa de comisión",withdrawlAmount:"Monto del retiro",amountToReceive:"Monto a recibir",minWithdraw:"Monto mínimo de retiro",minWithdrawParsed:"Min. de retiro: {{amount}} {{token}}",invalidReceiverAddress:"La dirección no puede estar vacía",availableDesc:"Lo máximo que puedes retirar. Si el saldo disponible es 0 o negativo, los retiros no están permitidos.",feeCalculationTip:"Las comisiones de retiro se calculan multiplicando el monto de retiro por la tasa de comisión, con un mínimo de 1 USDT/USDC. La tasa de la comisión puede modificarse en función de las condiciones reales de la cadena.",crossChainPoolBalance:"Saldo del pool cross-chain",poolBalance:"Saldo del pool",poolBalanceInsufficientTip:"El monto a retirar excede el saldo del pool. El retiro no se puede procesar. Selecciona una opción con un saldo suficiente en el pool."},account:{title:"Cuenta",perp:"Cuenta de perpetuos","perpetual-v1":"Cuenta de perpetuos V1","perpetual-v2":"Cuenta de perpetuos V2",spot:"Cuenta spot"}},Gm={deposit:{title:"Dépôt",chain:"Blockchain",asset:"Actif",amount:"Montant",available:"Disponible",equity:"Actif net",confirmDeposit:"Confirmer le dépôt",switchNetwork:"Changer de réseau",max:"Max.",arrivalTime:"Heure d’arrivée",ethCrossChainDepositInitiated:"Dépôt ETH inter-blockchains initié. Arrivée estimée dans 2 à 5 minutes.",minDeposit:"Montant minimum de dépôt",minDepositParsed:"Dépôt min. {{amount}} {{token}}",maxDeposit:"Montant maximum de dépôt",depositTipFor25w:"Le montant maximum par dépôt est de 200 000. Si votre dépôt dépasse 200 000, utilisez la blockchain Ethereum.",depositAllTip:`Seuls les dépôts en {{coin}} ({{v}}) sont pris en charge pour cette adresse.
|
|
37
|
+
Si le montant du dépôt dépasse 200 000, l’heure d’arrivée peut être retardée. Merci de patienter.`,maxDepositSplitTip:"Le montant maximum par dépôt est de 200 000. Si vous devez déposer plus de 200 000, veuillez effectuer plusieurs dépôts.",spotDepositNotSupportedTip:"Les dépôts ne sont pas pris en charge. Veuillez effectuer le dépôt sur le compte perpétuel, puis transférer les fonds.",crossChainDepositFeeTip:`Seuls les dépôts en {{coin}} ({{v}}) sont pris en charge pour cette adresse.
|
|
38
|
+
Les dépôts inter-blockchains nécessitent le paiement des frais de gas Edge. Le montant crédité sera légèrement inférieur au montant déposé.`,addressUpdatedNotice:"Avis : Votre adresse de dépôt a été mise à jour. Utilisez la nouvelle adresse. L’ancienne ne fonctionne que pendant la transition et sera désactivée. Si vous l’avez enregistrée ailleurs, modifiez-la sans tarder.",enableSystemProWithToken:"Activer {{token}} sur {{network}}",enableTokenDesc:"Vous devez activer {{token}} lors de votre premier dépôt sur {{network}}.",enableWithToken:"Activer {{token}}",arrivaltimeTooltip1:"Les fonds arriveront dans environ {{v}} minutes (après {{v1}} confirmations de bloc).",arrivaltimeTooltip2:"La durée estimée est calculée sur la base de données historiques et n’est donnée qu’à titre indicatif. L’encombrement du réseau peut rallonger l’heure d’arrivée réelle.",arrivalEstimated:"≈ {{v}} minutes",availableDesc:"Montant maximal que vous pouvez déposer. Lorsque le solde disponible est nul ou négatif, aucun dépôt ne peut être effectué.",noPrivateKeyWalletWarning:"N’utilisez pas de wallets sans clé pour effectuer des dépôts. Un dépôt effectué depuis un wallet sans clé peut entraîner une perte irréversible des fonds.",layerZeroDepositTip:"Le système effectuera votre dépôt via LayerZero en fonction des conditions réelles du dépôt.",layerZeroDepositTipExceedPool:"Comme le montant du dépôt est supérieur au pool, votre dépôt sera effectué via LayerZero.",layerZeroDepositTipGte200k:"Comme le montant du dépôt est supérieur ou égal à 200 000 USDT, votre dépôt sera effectué via LayerZero.",layerZeroDepositButton:"Déposer via LayerZero",defaultSpotNotice:"Par défaut, les dépôts sont crédités sur le compte spot.",defaultSpotToPerpNotice:"Seuls les dépôts en {{coin}} ({{v}}) sont pris en charge pour cette adresse. Par défaut, les dépôts sont crédités sur le compte spot. Pour alimenter le compte futures, transférez des fonds du compte spot vers le compte futures.",connectedWalletTitle:"Deposit from connected wallet",connectedWalletDesc:"Use MetaMask, WalletConnect, or another provider to deposit funds from your crypto wallet.",externalWalletTitle:"Deposit from external account",externalWalletDesc:"Transfer funds from Binance or other exchanges, chains like Solana, and other wallets.",or:"OR"},withdraw:{noticeDesc:"Les retraits classiques s’effectuent en deux étapes. Cette étape initie votre demande de retrait et sera traitée sur la Layer 2. Une fois vos fonds prêts (cela peut prendre jusqu’à 4 heures), vous recevrez une notification pour retirer les fonds vers votre wallet. En raison de la synchronisation de la chaîne et d’autres facteurs, le délai peut atteindre 48 heures. Vous êtes responsable de tous les frais de gas liés aux transactions.",crossChainTips:"Les retraits inter-blockchains nécessitent une vérification sur L2 (via des preuves ZK) et le processus de retrait peut prendre jusqu’à 2 heures. Des fonds suffisants dans le pool d’actifs de la chaîne concernée sont nécessaires pour traiter les retraits inter-blockchains. Des frais de gas seront également appliqués. edgeX facturera des frais pour les couvrir.",commonWithdraw:"FAQ sur les retraits",withdraw:"Retrait",speed:"Vitesse",confirmWithdraw:"Confirmer le retrait",speedNote:"Délais de traitement :",speedNoteSpeed1:"Env. 8 minutes",speedNoteSpeed2:"Env. 2 à 4 heures",speedNoteSpeed3:"Env. 4 heures",receiverAddress:"Adresse de réception",fee:"Frais",feeRate:"Taux de frais",withdrawlAmount:"Montant du retrait",amountToReceive:"Montant à recevoir",minWithdraw:"Montant minimum de retrait",minWithdrawParsed:"Retrait min. {{amount}} {{token}}",invalidReceiverAddress:"L’adresse ne peut pas être vide",availableDesc:"Montant maximal que vous pouvez retirer. Lorsque le solde disponible est nul ou négatif, aucun retrait ne peut être effectué.",feeCalculationTip:"Les frais de retrait sont calculés en multipliant le montant du retrait par le taux de frais, avec un minimum de 1 USDT/USDC. Le taux de frais peut être ajusté en fonction des conditions réelles on-chain.",crossChainPoolBalance:"Solde du pool inter-blockchains",poolBalance:"Solde du pool",poolBalanceInsufficientTip:"Le montant du retrait dépasse le solde du pool de fonds ; le retrait ne peut pas être traité. Sélectionnez une option disposant d’un solde de pool de fonds suffisant."},account:{title:"Compte",perp:"Compte perpétuel","perpetual-v1":"Compte Perpétuels V1","perpetual-v2":"Compte Perpétuels V2",spot:"Compte spot"}},qm={deposit:{title:"Deposita",chain:"Blockchain",asset:"Asset",amount:"Importo",available:"Disponibile",equity:"Equity",confirmDeposit:"Conferma il deposito",switchNetwork:"Cambia rete",max:"Max",arrivalTime:"Orario di arrivo",ethCrossChainDepositInitiated:"Deposito cross-chain di ETH avviato. Il deposito arriverà tra 2-5 minuti.",minDeposit:"Importo minimo del deposito",minDepositParsed:"Deposito min. {{amount}} {{token}}",maxDeposit:"Importo massimo del deposito",depositTipFor25w:"L'importo massimo per deposito è 200.000. Se il tuo deposito supera i 200.000, utilizza la catena Ethereum.",depositAllTip:`I depositi a questo indirizzo supportano solo {{coin}} ({{v}}).
|
|
39
|
+
Se l'importo del deposito supera i 200.000, l'orario di arrivo potrebbe subire ritardi. Sii paziente.`,maxDepositSplitTip:"L'importo massimo per deposito è 200.000. Se devi depositare più di 200.000, dividi l'importo in più depositi.",spotDepositNotSupportedTip:"I depositi non sono supportati. Prima deposita sul conto perpetuo, quindi effettua il trasferimento.",crossChainDepositFeeTip:`I depositi a questo indirizzo supportano solo {{coin}} ({{v}}).
|
|
40
|
+
Per i depositi cross-chain è necessario pagare la gas fee Edge. L'importo accreditato sarà leggermente inferiore all'importo del deposito.`,addressUpdatedNotice:"Avviso: il tuo indirizzo di deposito è stato aggiornato. Utilizza il nuovo indirizzo. L'indirizzo precedente funzionerà solo durante la transizione, quindi verrà disattivato. Se l'hai salvato altrove, aggiornarlo il prima possibile.",enableSystemProWithToken:"Abilita {{token}} su {{network}}",enableTokenDesc:"Devi abilitare {{token}} la prima volta che depositi su {{network}}.",enableWithToken:"Abilita {{token}}",arrivaltimeTooltip1:"I fondi arriveranno entro circa {{v}} minuti (dopo{{v1}} conferme di blocco).",arrivaltimeTooltip2:"Il tempo stimato è calcolato in base ai dati storici ed solo per riferimento. Se la rete è congestionata, potrebbero esserci dei ritardi.",arrivalEstimated:"≈ {{v}} minuti",availableDesc:"L'importo massimo che puoi depositare. Se il saldo disponibile è pari a 0 o negativo, non sarà possibile effettuare depositi.",noPrivateKeyWalletWarning:"Non effettuare depositi con wallet senza chiavi. Se effettui un deposito tramite un wallet senza chiave rischi di perdere i tuoi fondi per sempre.",layerZeroDepositTip:"Il sistema completerà il tuo deposito tramite LayerZero in base alle condizioni effettive di deposito.",layerZeroDepositTipExceedPool:"Poiché l'importo del deposito supera il pool, il deposito sarà completato tramite LayerZero.",layerZeroDepositTipGte200k:"Poiché l'importo del deposito è maggiore o uguale a 200.000 USDT, il deposito verrà completato tramite LayerZero.",layerZeroDepositButton:"Deposita con LayerZero",defaultSpotNotice:"I depositi predefiniti vanno sul conto spot.",defaultSpotToPerpNotice:"I depositi a questo indirizzo supportano solo {{coin}} ({{v}}). I depositi predefiniti vanno sul conto spot. Per finanziare il conto futures, effettua un trasferimento dal conto spot al conto futures.",connectedWalletTitle:"Deposit from connected wallet",connectedWalletDesc:"Use MetaMask, WalletConnect, or another provider to deposit funds from your crypto wallet.",externalWalletTitle:"Deposit from external account",externalWalletDesc:"Transfer funds from Binance or other exchanges, chains like Solana, and other wallets.",or:"OR"},withdraw:{noticeDesc:"I prelievi normali avvengono in due fasi. La fase attuale dà il via alla richiesta di prelievo, che verrà elaborata nel Layer 2. Non appena i fondi saranno pronti (possono volerci fino a 4 ore), riceverai una notifica per prelevarli nel tuo portafoglio. A causa della sincronizzazione della blockchain e di altri fattori, l'operazione potrebbe richiedere fino a 48 ore. Sei responsabile di eventuali gas fee per la transazione.",crossChainTips:"I prelievi cross-chain richiedono una verifica sul L2 (tramite prove ZK) e l'elaborazione del prelievo può richiedere fino a 2 ore. Per elaborare i prelievi cross-chain, il pool degli asset della blockchain corrispondente deve disporre di fondi a sufficienza. Inoltre, è necessario pagare delle gas fee. edgeX addebiterà una commissione per coprire tale costo.",commonWithdraw:"Domande frequenti sui prelievi",withdraw:"Preleva",speed:"Velocità",confirmWithdraw:"Conferma prelievo",speedNote:"Tempi di elaborazione:",speedNoteSpeed1:"Circa 8 minuti",speedNoteSpeed2:"Circa 2-4 ore",speedNoteSpeed3:"Circa 4 ore",receiverAddress:"Indirizzo del destinatario",fee:"Commissione",feeRate:"Tariffa",withdrawlAmount:"Importo del prelievo",amountToReceive:"Importo da ricevere",minWithdraw:"Importo minimo di prelievo",minWithdrawParsed:"Prelievo min. {{amount}} {{token}}",invalidReceiverAddress:"L'indirizzo non può essere vuoto",availableDesc:"L'importo massimo che puoi prelevare. Se il saldo disponibile è pari a 0 o negativo, non sarà possibile effettuare prelievi.",feeCalculationTip:"Le commissioni di prelievo vengono calcolate moltiplicando l'importo del prelievo per il tasso di commissione, con un minimo di 1 USDT/USDC. La tariffa può essere modificata in base alle condizioni effettive on-chain.",crossChainPoolBalance:"Equilibrio del pool cross-chain",poolBalance:"Equilibrio della piscina",poolBalanceInsufficientTip:"L'importo del prelievo supera il saldo del fondo e il prelievo non può essere elaborato. Selezionare un'opzione con un saldo di fondi sufficiente."},account:{title:"Account",perp:"Conto perpetuo","perpetual-v1":"Conto perpetuo V1","perpetual-v2":"Conto perpetuo V2",spot:"Conto Spot"}},Km={deposit:{title:"入金",chain:"チェーン",asset:"資産",amount:"数量",available:"利用可能",equity:"総資産",confirmDeposit:"入金確認",switchNetwork:"ネットワークを切り替え",max:"最大",arrivalTime:"着金予定時間",ethCrossChainDepositInitiated:"ETH のクロスチェーン入金を開始しました。到着まで約2〜5分です。",minDeposit:"最低入金額",minDepositParsed:"最低入金額 {{amount}} {{token}}",maxDeposit:"最大入金額",depositTipFor25w:"1回の入金上限額は200,000です。200,000を超える場合は、Ethereumチェーンでの入金をご利用ください。",depositAllTip:`このアドレスは{{coin}}({{v}})専用です。他通貨は送金しないでください。
|
|
41
|
+
入金金額が 200,000 を超える場合、反映までに時間がかかることがあります。しばらくお待ちください。`,maxDepositSplitTip:"1回の入金上限は200,000です。200,000を超える金額を入金する場合は、複数回に分けて行ってください。",spotDepositNotSupportedTip:"入金非対応。先に契約アカウント入金後、振替。",crossChainDepositFeeTip:`このアドレスは{{coin}}({{v}})専用です。他通貨は送金しないでください。
|
|
42
|
+
クロスチェーン入金では Edge ネットワーク手数料はお客様負担となります。入金額はご入金額よりわずかに少なくなります。`,addressUpdatedNotice:"注意:入金アドレスが更新されました。新しいアドレスをご利用ください。旧アドレスは移行期間のみ有効で、その後無効になります。他のサービスに保存している場合は早急に更新してください。",enableSystemProWithToken:"{{network}} 上で {{token}} を有効化",enableTokenDesc:"初めて {{network}} に入金する際は、{{token}} の有効化が必要です。",enableWithToken:"{{token}} を有効化",arrivaltimeTooltip1:"資金は約 {{v}} 分以内({{v1}} 回のブロック確認が完了後)に到账します。",arrivaltimeTooltip2:"着金時間は過去データに基づいた目安であり、ネットワーク状況により遅延する場合があります。",arrivalEstimated:"≈ {{v}}分",availableDesc:"入金可能な最大金額。利用可能残高が0または負の数の場合、入金はできません。",noPrivateKeyWalletWarning:"秘密鍵のないウォレットでの入金は行わないでください。そのような入金は資金を失い、取り戻すことができません。",layerZeroDepositTip:"システムは入金資金の実際の状況に基づき、LayerZeroを通じて入金を完了します。",layerZeroDepositTipExceedPool:"入金額がプールを超えているため、LayerZero を通じて入金が完了します。",layerZeroDepositTipGte200k:"入金額が 200,000 USDT 以上のため、LayerZero を通じて入金が完了します。",layerZeroDepositButton:"LayerZeroで入金",defaultSpotNotice:"デフォルトでは現物口座に入金されます",defaultSpotToPerpNotice:"このアドレスは {{coin}} ({{v}}) 専用です。 デフォルトでは現物口座に入金されます。先物口座に入金する場合は、現物口座から先物口座へ振替してください。",connectedWalletTitle:"Deposit from connected wallet",connectedWalletDesc:"Use MetaMask, WalletConnect, or another provider to deposit funds from your crypto wallet.",externalWalletTitle:"Deposit from external account",externalWalletDesc:"Transfer funds from Binance or other exchanges, chains like Solana, and other wallets.",or:"OR"},withdraw:{noticeDesc:"通常出金は2ステップで行われます。このステップで出金リクエストを送信し、Layer2で処理されます。資金の準備が完了すると(最大4時間かかる場合があります)、出金の通知が届きます。チェーンの同期などの影響により、所要時間は最長で48時間かかる場合があります。ガス代はユーザー負担です。",crossChainTips:"クロスチェーン出金はL2上(ゼロ知識証明経由)で検証が必要です。出金処理には最大2時間ほどかかる場合があります。対応するチェーンの資産プールに十分な流動性が必要であり、ガス代も発生します。edgeXはそのコストを補うため、一定の手数料を徴収します。",commonWithdraw:"出金ガイド",withdraw:"出金",speed:"出金時間",confirmWithdraw:"出金確認",speedNote:"処理時間:",speedNoteSpeed1:"約8分",speedNoteSpeed2:"約2~4時間",speedNoteSpeed3:"約4時間",receiverAddress:"受取アドレス",fee:"手数料",feeRate:"手数料率",withdrawlAmount:"出金額",amountToReceive:"受け取り金額",minWithdraw:"最低出金額",minWithdrawParsed:"最低出金 {{amount}} {{token}}",invalidReceiverAddress:"ウォレットアドレスは必須です",availableDesc:"引き出し可能な最大金額。利用可能残高が0または負の数の場合、引き出しはできません。",feeCalculationTip:"出金手数料は、出金金額に料率を乗じて計算され、最低1 USDT/USDCとなります。料率は、ブロックチェーンの実際の状況に基づいて調整される場合があります。",crossChainPoolBalance:"クロスチェーンプール残高",poolBalance:"プール残高",poolBalanceInsufficientTip:"出金額が資金プールの残高を上回っているため、出金は処理できません。資金プールの残高が十分にあるオプションを選択してください。"},account:{title:"アカウント",perp:"パーペチュアルアカウント","perpetual-v1":"先物V1アカウント","perpetual-v2":"先物V2アカウント",spot:"スポットアカウント"}},Zm={deposit:{title:"Депозит",chain:"Сеть",asset:"Актив",amount:"Сумма",available:"Доступно",equity:"Капитал",confirmDeposit:"Подтвердить депозит",switchNetwork:"Сменить сеть",max:"Максимум",arrivalTime:"Время поступления",ethCrossChainDepositInitiated:"Кроссчейн‑депозит ETH запущен. Ожидаемое зачисление: 2–5 минут.",minDeposit:"Минимальная сумма депозита",minDepositParsed:"Мин. депозит {{amount}} {{token}}",maxDeposit:"Максимальная сумма депозита",depositTipFor25w:"Максимальная сумма одного пополнения — 200 000. Если сумма превышает 200 000, пожалуйста, используйте сеть Ethereum для пополнения.",depositAllTip:`На этот адрес можно внести только {{coin}} ({{v}}).
|
|
43
|
+
Если сумма депозита превышает 200 000, время поступления может быть увеличено. Пожалуйста, ожидайте.`,maxDepositSplitTip:"Максимальная сумма одного пополнения — 200 000. Если вам нужно пополнить на сумму более 200 000, выполните несколько пополнений.",spotDepositNotSupportedTip:"Пополнение недоступно. Сначала контрактный счёт, затем перевод.",crossChainDepositFeeTip:`На этот адрес можно внести только {{coin}} ({{v}}).
|
|
44
|
+
За кроссчейн‑депозит вы оплачиваете комиссию сети Edge. Зачисленная сумма будет немного меньше суммы вашего депозита.`,addressUpdatedNotice:"Внимание: ваш адрес пополнения обновлён. Используйте новый адрес. Старый действует только в переходный период и будет отключён. Если он сохранён где‑то ещё, срочно обновите.",enableSystemProWithToken:"Включить {{token}} в сети {{network}}",enableTokenDesc:"При первом депозите в сети {{network}} необходимо включить {{token}}.",enableWithToken:"Включить {{token}}",arrivaltimeTooltip1:"Средства поступят в течение примерно {{v}} минут (после достижения {{v1}} подтверждений блоков).",arrivaltimeTooltip2:"Оценка времени основана на истории и дана только для справки. Задержки сети могут увеличить фактическое время поступления.",arrivalEstimated:"≈ {{v}} минут",availableDesc:"Максимальная сумма, которую вы можете пополнить. Если доступный баланс равен 0 или отрицательный, пополнение невозможно.",noPrivateKeyWalletWarning:`Не используйте кошельки без приватных ключей для пополнения. Пополнение с такого кошелька может привести к безвозвратной потере средств.
|
|
45
|
+
|
|
46
|
+
Tangem не подключаем, это кошелек без приватного ключа`,layerZeroDepositTip:"Система завершит ваше пополнение через LayerZero в зависимости от фактических условий депозита.",layerZeroDepositTipExceedPool:"Поскольку сумма пополнения превышает пул, ваше пополнение будет выполнено через LayerZero.",layerZeroDepositTipGte200k:"Поскольку сумма пополнения больше либо равна 200,000 USDT, ваше пополнение будет выполнено через LayerZero.",layerZeroDepositButton:"Пополнение через LayerZero",defaultSpotNotice:"По умолчанию — на спотовый счёт",defaultSpotToPerpNotice:"На этот адрес можно внести только {{coin}} ({{v}}). Пополнение по умолчанию зачисляется на спотовый счёт. Чтобы пополнить фьючерсный счёт, переведите средства со спотового на фьючерсный.",connectedWalletTitle:"Deposit from connected wallet",connectedWalletDesc:"Use MetaMask, WalletConnect, or another provider to deposit funds from your crypto wallet.",externalWalletTitle:"Deposit from external account",externalWalletDesc:"Transfer funds from Binance or other exchanges, chains like Solana, and other wallets.",or:"OR"},withdraw:{noticeDesc:"Вывод средств происходит в два этапа: сначала подаётся заявка на вывод (обрабатывается на Layer 2), затем - перевод на кошелёк после подготовки средств (до 14 часов). Из-за синхронизации цепочки и других факторов процесс может занять до 48 часов. За gas-комиссии отвечает пользователь.",crossChainTips:"• Кроссчейн выводы требуют проверки на L2 (через ZK доказательства) и могут занять до 2 часов. Для вывода нужны средства в пуле соответствующей цепи. Также взимается комиссия за газ. edgeX взимает плату за обслуживание.",commonWithdraw:"Часто задаваемые вопросы по выводу",withdraw:"Вывод",speed:"Скорость",confirmWithdraw:"Подтвердить вывод",speedNote:"Время обработки:",speedNoteSpeed1:"Прибл. 8 минут",speedNoteSpeed2:"Прибл. 2-4 часа",speedNoteSpeed3:"Прибл. 4 часа",receiverAddress:"Адрес получателя",fee:"Комиссия",feeRate:"Тариф",withdrawlAmount:"Сумма вывода",amountToReceive:"Сумма к получению",minWithdraw:"Минимальная сумма вывода",minWithdrawParsed:"Мин. вывод {{amount}} {{token}}",invalidReceiverAddress:"Укажите адрес кошелька",availableDesc:"Максимальная сумма, которую вы можете вывести. Если доступный баланс равен 0 или отрицательный, вывод средств невозможен.",feeCalculationTip:"Комиссия за вывод средств рассчитывается путем умножения суммы вывода на ставку комиссии, минимальная комиссия составляет 1 USDT/USDC. Ставка комиссии может быть скорректирована в зависимости от фактической ситуации в сети блокчейн.",crossChainPoolBalance:"Баланс кросс-чейн пула",poolBalance:"Баланс пула",poolBalanceInsufficientTip:"Сумма вывода превышает баланс пула средств, и операция не может быть выполнена. Пожалуйста, выберите опцию с достаточным балансом пула средств."},account:{title:"Аккаунт",perp:"Перпетуальный счет","perpetual-v1":"Перпетуальный счёт V1","perpetual-v2":"Перпетуальный счёт V2",spot:"Спотовый счет"}},Ym={deposit:{title:"充值",chain:"链",asset:"资产",amount:"数量",available:"可用",equity:"总资产",confirmDeposit:"充值确认",switchNetwork:"切换网络",max:"最大",arrivalTime:"到账时间",ethCrossChainDepositInitiated:"ETH 跨链充值已发起,预计 2–5 分钟到账。",minDeposit:"最小充值金额",minDepositParsed:"最少充值 {{amount}} {{token}}",maxDeposit:"最大充值金额",depositTipFor25w:"单笔充值金额上限为 200,000。若充值金额大于200,000,请使用Ethereum链充值。",depositAllTip:`仅支持发送 {{coin}} ({{v}}) 资产到此地址。
|
|
47
|
+
充值金额大于 200,000 时,到账时间存在一定延迟,请耐心等待。`,maxDepositSplitTip:"单笔充值金额上限为200,000。若需要充值金额大于200,000,请分多笔进行操作。",spotDepositNotSupportedTip:"不支持充值,请先充入合约账户再划转。",crossChainDepositFeeTip:`仅支持发送 {{coin}} ({{v}}) 资产到此地址。
|
|
48
|
+
跨链充值需由您承担 Edge 网络手续费。到账金额会略小于您的充值金额。`,addressUpdatedNotice:"注意:充值地址已更新,请改用新地址。原地址仅在过渡期可用,随后停用。若旧地址已存于其他平台,请尽快更新。",enableSystemProWithToken:"在{{network}}上启用{{token}}",enableTokenDesc:"您首次在{{network}}上存款时必须启用{{token}}。",enableWithToken:"启用 {{token}}",arrivaltimeTooltip1:"资金约在 {{v}} 分钟 内 (达到 {{v1}} 个区块确认后) 到账。",arrivaltimeTooltip2:"预计时间是根据历史数据计算所得,仅供参考。网络拥堵可能会导致实际到账时间变长。",arrivalEstimated:"≈ {{v}}分钟",availableDesc:"您可以充值的最大金额。当可用为0或负数时,无法进行充值。",noPrivateKeyWalletWarning:"请勿使用无私钥钱包进行充值,无私钥钱包充值会导致资金损失且无法追回。",layerZeroDepositTip:"系统会根据充值资金实际情况,将您的充值通过LayerZero完成。",layerZeroDepositTipExceedPool:"由于充值资金大于资金池,将通过LayerZero完成您的充值。",layerZeroDepositTipGte200k:"由于充值资金大于等于200,000 USDT,将通过LayerZero完成您的充值。",layerZeroDepositButton:"使用LayerZero充值",defaultSpotNotice:"默认充值至现货账户",defaultSpotToPerpNotice:"仅支持发送 {{coin}} ({{v}}) 资产到此地址。默认充值至现货账户。若需充入合约账户,请从现货账户划转至合约账户。",connectedWalletTitle:"从已连接钱包充值",connectedWalletDesc:"使用 MetaMask、WalletConnect 或其他钱包进行充值",externalWalletTitle:"从外部钱包充值",externalWalletDesc:"从 Binance 或其他交易所、Solana 等链或其他钱包转账",or:"或"},withdraw:{noticeDesc:"普通提现是一个两步过程。 此步骤将发起您的提现请求,并将在 Layer2 进行处理。 一旦资金准备就绪(可能需要最多 4 小时),您将收到一条将资金提现到钱包的通知。受链同步等情况影响下,时长可能到 48 小时。您需要自行承担交易 gas 费用。",crossChainTips:"跨链提币需在 L2(通过零知识证明)进行验证。提币过程最多约需2小时。相关链的资产池中需有充足的资金来处理跨链提币,其间还将产生矿工费。 edgeX 将收取一定的手续费作为矿工费。",commonWithdraw:"提现说明",withdraw:"提现",speed:"速度",confirmWithdraw:"提现确认",speedNote:"处理时间:",speedNoteSpeed1:"用时约8分钟",speedNoteSpeed2:"用时约 2-4 小时",speedNoteSpeed3:"用时约4小时",receiverAddress:"接收地址",fee:"手续费",feeRate:"费率",withdrawlAmount:"提现金额",amountToReceive:"到账金额",minWithdraw:"最小提现金额",minWithdrawParsed:"最小提现 {{amount}} {{token}}",invalidReceiverAddress:"接收地址不能为空",availableDesc:"您可以提现的最大金额。当可用为0或负数时,无法进行提现。",feeCalculationTip:"提现手续费按照提现金额乘以费率计算,最低为1 USDT/USDC。费率会根据链上实际情况进行调整。",crossChainPoolBalance:"跨链资金池余额",poolBalance:"资金池余额",poolBalanceInsufficientTip:"提现金额大于资金池余额,无法进行提现。请选择资金池余额充足的选项。"},account:{title:"账户",perp:"合约账户","perpetual-v1":"合约V1账户","perpetual-v2":"合约V2账户",spot:"现货账户"}},Xm={deposit:{title:"充值",chain:"鏈",asset:"資產",amount:"數量",available:"可用",equity:"總資產",confirmDeposit:"充值確認",switchNetwork:"切換網絡",max:"最大",arrivalTime:"到帳時間",ethCrossChainDepositInitiated:"ETH 跨鏈充值已發起 ,預計 2–5 分鐘到賬。",minDeposit:"最小儲值金額",minDepositParsed:"最少充值 {{amount}} {{token}}",maxDeposit:"最大儲值金額",depositTipFor25w:"單筆充值金額上限為 200,000。若充值金額大於 200,000,請使用 Ethereum 鏈充值。",depositAllTip:`僅支援發送 {{coin}} ({{v}}) 資產到此位址。
|
|
49
|
+
充值金額大於 200,000 時,到账時間可能會有延遲,請耐心等待。`,maxDepositSplitTip:"單筆充值金額上限為 200,000。若需要充值金額大於 200,000,請分多筆進行操作。",spotDepositNotSupportedTip:"不支援充值,請先充入合約帳戶再劃轉。",crossChainDepositFeeTip:`僅支援發送 {{coin}} ({{v}}) 資產到此位址。
|
|
50
|
+
跨鏈充值需由您承擔 Edge 網路手續費。到帳金額會略小於您的充值金額。`,addressUpdatedNotice:"注意:充值地址已更新,請改用新地址。原地址僅在過渡期內有效,之後將停用。若已在其他平台儲存,請儘速更新。",enableSystemProWithToken:"在{{network}}上啓用{{token}}",enableTokenDesc:"您首次在{{network}}上存款時必須啓用{{token}}。",enableWithToken:"啓用 {{token}}",arrivaltimeTooltip1:"資金約在 {{v}} 分鐘內(達到 {{v1}} 個區塊確認後)到賬。",arrivaltimeTooltip2:"預計時間是根據歷史資料計算所得,僅供參考。網路壅塞可能會導致實際到帳時間變長。",arrivalEstimated:"≈ {{v}}分鐘",availableDesc:"您可以充值的最大金額。當可用餘額為0或負數時,無法進行充值。",noPrivateKeyWalletWarning:"請勿使用無私鑰錢包進行充值,無私鑰錢包充值會導致資金損失且無法追回。",layerZeroDepositTip:"系統會根據充值資金的實際情況,通過 LayerZero 完成您的充值。",layerZeroDepositTipExceedPool:"由於充值資金大於資金池,將透過 LayerZero 完成您的充值。",layerZeroDepositTipGte200k:"由於充值資金大於等於 200,000 USDT,將透過 LayerZero 完成您的充值。",layerZeroDepositButton:"使用LayerZero充值",defaultSpotNotice:"預設充值至現貨帳戶",defaultSpotToPerpNotice:"僅支援發送 {{coin}} ({{v}}) 資產到此位址。預設充值至現貨帳戶。若需充入合約帳戶,請自現貨帳戶劃轉至合約帳戶。",connectedWalletTitle:"從已連接錢包充值",connectedWalletDesc:"使用 MetaMask、WalletConnect 或其他錢包進行充值",externalWalletTitle:"從外部錢包充值",externalWalletDesc:"從 Binance 或其他交易所、Solana 等鏈或其他錢包轉帳",or:"或"},withdraw:{noticeDesc:"普通提現是一個兩步過程。此步驟將發起您的提現請求,並將在 Layer2 進行處理。一旦資金準備就緒(可能需要最多 4 小時),您將收到一條將資金提現到錢包的通知。受鏈同步等情況影響下,時長可能需要長達 48 小時。您需要自行承擔交易 gas 費用。",crossChainTips:"跨鏈提幣需在 L2(通過零知識證明)進行驗證。提幣過程最多約需2小時。相關鏈的資產池中需有充足的資金來處理跨鏈提幣,其間還將產生礦工費。 edgeX 將收取一定的手續費作爲礦工費。",commonWithdraw:"提現說明",withdraw:"提現",speed:"速度",confirmWithdraw:"提現確認",speedNote:"處理時間:",speedNoteSpeed1:"用時約8分鐘",speedNoteSpeed2:"用時約 2-4 小時",speedNoteSpeed3:"用時約4小時",receiverAddress:"接收地址",fee:"手續費",feeRate:"費率",withdrawlAmount:"提現金額",amountToReceive:"到账金額",minWithdraw:"最小提現金額",minWithdrawParsed:"最小提現 {{amount}} {{token}}",invalidReceiverAddress:"接收地址不能為空",availableDesc:"您可以提現的最大金額。當可用餘額為0或負數時,無法進行提現。",feeCalculationTip:"提現手續費按照提現金額乘以費率計算,最低為 1 USDT/USDC。費率會根據鏈上實際情況進行調整。",crossChainPoolBalance:"跨鏈資金池餘額",poolBalance:"資金池餘額",poolBalanceInsufficientTip:"提現金額大於資金池餘額,無法進行提現。請選擇資金池餘額充足的選項。"},account:{title:"帳戶",perp:"合約帳戶","perpetual-v1":"合約V1賬戶","perpetual-v2":"合約V2賬戶",spot:"現貨帳戶"}},Si=["en-US","ja-JP","ru-RU","zh-CN","zh-TW","de-DE","es-LA","fr-FR","it-IT"],Rl={"en-US":Vm,"ja-JP":Km,"ru-RU":Zm,"zh-CN":Ym,"zh-TW":Xm,"de-DE":Wm,"es-LA":Hm,"fr-FR":Gm,"it-IT":qm},Jo="en-US",Jm={"en-US":"English","zh-CN":"简体中文","zh-TW":"繁體中文","ja-JP":"日本語","ru-RU":"Русский","de-DE":"Deutsch","es-LA":"Español (Latinoamérica)","fr-FR":"Français","it-IT":"Italiano"},Qm=e=>Si.includes(e)?Rl[e]:Rl[Jo],eb=e=>Si.includes(e),jl=v.createContext(null),tb=({config:e,children:t})=>{const n=v.useMemo(()=>{const r=e.locale||Jo,o=eb(r)?r:Jo,s=Qm(o);return{...e,currentLocale:o,translations:s}},[e]);return $.jsx(jl.Provider,{value:n,children:t})},zl=()=>{const e=v.useContext(jl);if(!e)throw new Error("useComponentConfig must be used within ComponentProvider");return e};var nb=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,Pi=Math.ceil,lt=Math.floor,_e="[BigNumber Error] ",Ul=_e+"Number primitive has more than 15 significant digits: ",St=1e14,ae=14,Ti=9007199254740991,Ai=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],gn=1e7,Ie=1e9;function _l(e){var t,n,r,o=E.prototype={constructor:E,toString:null,valueOf:null},s=new E(1),i=20,c=4,a=-7,l=21,u=-1e7,f=1e7,p=!1,d=1,h=0,m={prefix:"",groupSize:3,secondaryGroupSize:0,groupSeparator:",",decimalSeparator:".",fractionGroupSize:0,fractionGroupSeparator:" ",suffix:""},x="0123456789abcdefghijklmnopqrstuvwxyz",P=!0;function E(b,g){var w,O,C,I,k,y,A,D,S=this;if(!(S instanceof E))return new E(b,g);if(g==null){if(b&&b._isBigNumber===!0){S.s=b.s,!b.c||b.e>f?S.c=S.e=null:b.e<u?S.c=[S.e=0]:(S.e=b.e,S.c=b.c.slice());return}if((y=typeof b=="number")&&b*0==0){if(S.s=1/b<0?(b=-b,-1):1,b===~~b){for(I=0,k=b;k>=10;k/=10,I++);I>f?S.c=S.e=null:(S.e=I,S.c=[b]);return}D=String(b)}else{if(!nb.test(D=String(b)))return r(S,D,y);S.s=D.charCodeAt(0)==45?(D=D.slice(1),-1):1}(I=D.indexOf("."))>-1&&(D=D.replace(".","")),(k=D.search(/e/i))>0?(I<0&&(I=k),I+=+D.slice(k+1),D=D.substring(0,k)):I<0&&(I=D.length)}else{if(xe(g,2,x.length,"Base"),g==10&&P)return S=new E(b),F(S,i+S.e+1,c);if(D=String(b),y=typeof b=="number"){if(b*0!=0)return r(S,D,y,g);if(S.s=1/b<0?(D=D.slice(1),-1):1,E.DEBUG&&D.replace(/^0\.0*|\./,"").length>15)throw Error(Ul+b)}else S.s=D.charCodeAt(0)===45?(D=D.slice(1),-1):1;for(w=x.slice(0,g),I=k=0,A=D.length;k<A;k++)if(w.indexOf(O=D.charAt(k))<0){if(O=="."){if(k>I){I=A;continue}}else if(!C&&(D==D.toUpperCase()&&(D=D.toLowerCase())||D==D.toLowerCase()&&(D=D.toUpperCase()))){C=!0,k=-1,I=0;continue}return r(S,String(b),y,g)}y=!1,D=n(D,g,10,S.s),(I=D.indexOf("."))>-1?D=D.replace(".",""):I=D.length}for(k=0;D.charCodeAt(k)===48;k++);for(A=D.length;D.charCodeAt(--A)===48;);if(D=D.slice(k,++A)){if(A-=k,y&&E.DEBUG&&A>15&&(b>Ti||b!==lt(b)))throw Error(Ul+S.s*b);if((I=I-k-1)>f)S.c=S.e=null;else if(I<u)S.c=[S.e=0];else{if(S.e=I,S.c=[],k=(I+1)%ae,I<0&&(k+=ae),k<A){for(k&&S.c.push(+D.slice(0,k)),A-=ae;k<A;)S.c.push(+D.slice(k,k+=ae));k=ae-(D=D.slice(k)).length}else k-=A;for(;k--;D+="0");S.c.push(+D)}}else S.c=[S.e=0]}E.clone=_l,E.ROUND_UP=0,E.ROUND_DOWN=1,E.ROUND_CEIL=2,E.ROUND_FLOOR=3,E.ROUND_HALF_UP=4,E.ROUND_HALF_DOWN=5,E.ROUND_HALF_EVEN=6,E.ROUND_HALF_CEIL=7,E.ROUND_HALF_FLOOR=8,E.EUCLID=9,E.config=E.set=function(b){var g,w;if(b!=null)if(typeof b=="object"){if(b.hasOwnProperty(g="DECIMAL_PLACES")&&(w=b[g],xe(w,0,Ie,g),i=w),b.hasOwnProperty(g="ROUNDING_MODE")&&(w=b[g],xe(w,0,8,g),c=w),b.hasOwnProperty(g="EXPONENTIAL_AT")&&(w=b[g],w&&w.pop?(xe(w[0],-Ie,0,g),xe(w[1],0,Ie,g),a=w[0],l=w[1]):(xe(w,-Ie,Ie,g),a=-(l=w<0?-w:w))),b.hasOwnProperty(g="RANGE"))if(w=b[g],w&&w.pop)xe(w[0],-Ie,-1,g),xe(w[1],1,Ie,g),u=w[0],f=w[1];else if(xe(w,-Ie,Ie,g),w)u=-(f=w<0?-w:w);else throw Error(_e+g+" cannot be zero: "+w);if(b.hasOwnProperty(g="CRYPTO"))if(w=b[g],w===!!w)if(w)if(typeof crypto<"u"&&crypto&&(crypto.getRandomValues||crypto.randomBytes))p=w;else throw p=!w,Error(_e+"crypto unavailable");else p=w;else throw Error(_e+g+" not true or false: "+w);if(b.hasOwnProperty(g="MODULO_MODE")&&(w=b[g],xe(w,0,9,g),d=w),b.hasOwnProperty(g="POW_PRECISION")&&(w=b[g],xe(w,0,Ie,g),h=w),b.hasOwnProperty(g="FORMAT"))if(w=b[g],typeof w=="object")m=w;else throw Error(_e+g+" not an object: "+w);if(b.hasOwnProperty(g="ALPHABET"))if(w=b[g],typeof w=="string"&&!/^.?$|[+\-.\s]|(.).*\1/.test(w))P=w.slice(0,10)=="0123456789",x=w;else throw Error(_e+g+" invalid: "+w)}else throw Error(_e+"Object expected: "+b);return{DECIMAL_PLACES:i,ROUNDING_MODE:c,EXPONENTIAL_AT:[a,l],RANGE:[u,f],CRYPTO:p,MODULO_MODE:d,POW_PRECISION:h,FORMAT:m,ALPHABET:x}},E.isBigNumber=function(b){if(!b||b._isBigNumber!==!0)return!1;if(!E.DEBUG)return!0;var g,w,O=b.c,C=b.e,I=b.s;e:if({}.toString.call(O)=="[object Array]"){if((I===1||I===-1)&&C>=-Ie&&C<=Ie&&C===lt(C)){if(O[0]===0){if(C===0&&O.length===1)return!0;break e}if(g=(C+1)%ae,g<1&&(g+=ae),String(O[0]).length==g){for(g=0;g<O.length;g++)if(w=O[g],w<0||w>=St||w!==lt(w))break e;if(w!==0)return!0}}}else if(O===null&&C===null&&(I===null||I===1||I===-1))return!0;throw Error(_e+"Invalid BigNumber: "+b)},E.maximum=E.max=function(){return N(arguments,-1)},E.minimum=E.min=function(){return N(arguments,1)},E.random=function(){var b=9007199254740992,g=Math.random()*b&2097151?function(){return lt(Math.random()*b)}:function(){return(Math.random()*1073741824|0)*8388608+(Math.random()*8388608|0)};return function(w){var O,C,I,k,y,A=0,D=[],S=new E(s);if(w==null?w=i:xe(w,0,Ie),k=Pi(w/ae),p)if(crypto.getRandomValues){for(O=crypto.getRandomValues(new Uint32Array(k*=2));A<k;)y=O[A]*131072+(O[A+1]>>>11),y>=9e15?(C=crypto.getRandomValues(new Uint32Array(2)),O[A]=C[0],O[A+1]=C[1]):(D.push(y%1e14),A+=2);A=k/2}else if(crypto.randomBytes){for(O=crypto.randomBytes(k*=7);A<k;)y=(O[A]&31)*281474976710656+O[A+1]*1099511627776+O[A+2]*4294967296+O[A+3]*16777216+(O[A+4]<<16)+(O[A+5]<<8)+O[A+6],y>=9e15?crypto.randomBytes(7).copy(O,A):(D.push(y%1e14),A+=7);A=k/7}else throw p=!1,Error(_e+"crypto unavailable");if(!p)for(;A<k;)y=g(),y<9e15&&(D[A++]=y%1e14);for(k=D[--A],w%=ae,k&&w&&(y=Ai[ae-w],D[A]=lt(k/y)*y);D[A]===0;D.pop(),A--);if(A<0)D=[I=0];else{for(I=-1;D[0]===0;D.splice(0,1),I-=ae);for(A=1,y=D[0];y>=10;y/=10,A++);A<ae&&(I-=ae-A)}return S.e=I,S.c=D,S}}(),E.sum=function(){for(var b=1,g=arguments,w=new E(g[0]);b<g.length;)w=w.plus(g[b++]);return w},n=function(){var b="0123456789";function g(w,O,C,I){for(var k,y=[0],A,D=0,S=w.length;D<S;){for(A=y.length;A--;y[A]*=O);for(y[0]+=I.indexOf(w.charAt(D++)),k=0;k<y.length;k++)y[k]>C-1&&(y[k+1]==null&&(y[k+1]=0),y[k+1]+=y[k]/C|0,y[k]%=C)}return y.reverse()}return function(w,O,C,I,k){var y,A,D,S,B,j,_,W,q=w.indexOf("."),Z=i,H=c;for(q>=0&&(S=h,h=0,w=w.replace(".",""),W=new E(O),j=W.pow(w.length-q),h=S,W.c=g(Yt(ft(j.c),j.e,"0"),10,C,b),W.e=W.c.length),_=g(w,O,C,k?(y=x,b):(y=b,x)),D=S=_.length;_[--S]==0;_.pop());if(!_[0])return y.charAt(0);if(q<0?--D:(j.c=_,j.e=D,j.s=I,j=t(j,W,Z,H,C),_=j.c,B=j.r,D=j.e),A=D+Z+1,q=_[A],S=C/2,B=B||A<0||_[A+1]!=null,B=H<4?(q!=null||B)&&(H==0||H==(j.s<0?3:2)):q>S||q==S&&(H==4||B||H==6&&_[A-1]&1||H==(j.s<0?8:7)),A<1||!_[0])w=B?Yt(y.charAt(1),-Z,y.charAt(0)):y.charAt(0);else{if(_.length=A,B)for(--C;++_[--A]>C;)_[A]=0,A||(++D,_=[1].concat(_));for(S=_.length;!_[--S];);for(q=0,w="";q<=S;w+=y.charAt(_[q++]));w=Yt(w,D,y.charAt(0))}return w}}(),t=function(){function b(O,C,I){var k,y,A,D,S=0,B=O.length,j=C%gn,_=C/gn|0;for(O=O.slice();B--;)A=O[B]%gn,D=O[B]/gn|0,k=_*A+D*j,y=j*A+k%gn*gn+S,S=(y/I|0)+(k/gn|0)+_*D,O[B]=y%I;return S&&(O=[S].concat(O)),O}function g(O,C,I,k){var y,A;if(I!=k)A=I>k?1:-1;else for(y=A=0;y<I;y++)if(O[y]!=C[y]){A=O[y]>C[y]?1:-1;break}return A}function w(O,C,I,k){for(var y=0;I--;)O[I]-=y,y=O[I]<C[I]?1:0,O[I]=y*k+O[I]-C[I];for(;!O[0]&&O.length>1;O.splice(0,1));}return function(O,C,I,k,y){var A,D,S,B,j,_,W,q,Z,H,U,J,K,ee,ie,Y,ne,Q=O.s==C.s?1:-1,le=O.c,re=C.c;if(!le||!le[0]||!re||!re[0])return new E(!O.s||!C.s||(le?re&&le[0]==re[0]:!re)?NaN:le&&le[0]==0||!re?Q*0:Q/0);for(q=new E(Q),Z=q.c=[],D=O.e-C.e,Q=I+D+1,y||(y=St,D=ut(O.e/ae)-ut(C.e/ae),Q=Q/ae|0),S=0;re[S]==(le[S]||0);S++);if(re[S]>(le[S]||0)&&D--,Q<0)Z.push(1),B=!0;else{for(ee=le.length,Y=re.length,S=0,Q+=2,j=lt(y/(re[0]+1)),j>1&&(re=b(re,j,y),le=b(le,j,y),Y=re.length,ee=le.length),K=Y,H=le.slice(0,Y),U=H.length;U<Y;H[U++]=0);ne=re.slice(),ne=[0].concat(ne),ie=re[0],re[1]>=y/2&&ie++;do{if(j=0,A=g(re,H,Y,U),A<0){if(J=H[0],Y!=U&&(J=J*y+(H[1]||0)),j=lt(J/ie),j>1)for(j>=y&&(j=y-1),_=b(re,j,y),W=_.length,U=H.length;g(_,H,W,U)==1;)j--,w(_,Y<W?ne:re,W,y),W=_.length,A=1;else j==0&&(A=j=1),_=re.slice(),W=_.length;if(W<U&&(_=[0].concat(_)),w(H,_,U,y),U=H.length,A==-1)for(;g(re,H,Y,U)<1;)j++,w(H,Y<U?ne:re,U,y),U=H.length}else A===0&&(j++,H=[0]);Z[S++]=j,H[0]?H[U++]=le[K]||0:(H=[le[K]],U=1)}while((K++<ee||H[0]!=null)&&Q--);B=H[0]!=null,Z[0]||Z.splice(0,1)}if(y==St){for(S=1,Q=Z[0];Q>=10;Q/=10,S++);F(q,I+(q.e=S+D*ae-1)+1,k,B)}else q.e=D,q.r=+B;return q}}();function T(b,g,w,O){var C,I,k,y,A;if(w==null?w=c:xe(w,0,8),!b.c)return b.toString();if(C=b.c[0],k=b.e,g==null)A=ft(b.c),A=O==1||O==2&&(k<=a||k>=l)?es(A,k):Yt(A,k,"0");else if(b=F(new E(b),g,w),I=b.e,A=ft(b.c),y=A.length,O==1||O==2&&(g<=I||I<=a)){for(;y<g;A+="0",y++);A=es(A,I)}else if(g-=k+(O===2&&I>k),A=Yt(A,I,"0"),I+1>y){if(--g>0)for(A+=".";g--;A+="0");}else if(g+=I-y,g>0)for(I+1==y&&(A+=".");g--;A+="0");return b.s<0&&C?"-"+A:A}function N(b,g){for(var w,O,C=1,I=new E(b[0]);C<b.length;C++)O=new E(b[C]),(!O.s||(w=Mn(I,O))===g||w===0&&I.s===g)&&(I=O);return I}function M(b,g,w){for(var O=1,C=g.length;!g[--C];g.pop());for(C=g[0];C>=10;C/=10,O++);return(w=O+w*ae-1)>f?b.c=b.e=null:w<u?b.c=[b.e=0]:(b.e=w,b.c=g),b}r=function(){var b=/^(-?)0([xbo])(?=\w[\w.]*$)/i,g=/^([^.]+)\.$/,w=/^\.([^.]+)$/,O=/^-?(Infinity|NaN)$/,C=/^\s*\+(?=[\w.])|^\s+|\s+$/g;return function(I,k,y,A){var D,S=y?k:k.replace(C,"");if(O.test(S))I.s=isNaN(S)?null:S<0?-1:1;else{if(!y&&(S=S.replace(b,function(B,j,_){return D=(_=_.toLowerCase())=="x"?16:_=="b"?2:8,!A||A==D?j:B}),A&&(D=A,S=S.replace(g,"$1").replace(w,"0.$1")),k!=S))return new E(S,D);if(E.DEBUG)throw Error(_e+"Not a"+(A?" base "+A:"")+" number: "+k);I.s=null}I.c=I.e=null}}();function F(b,g,w,O){var C,I,k,y,A,D,S,B=b.c,j=Ai;if(B){e:{for(C=1,y=B[0];y>=10;y/=10,C++);if(I=g-C,I<0)I+=ae,k=g,A=B[D=0],S=lt(A/j[C-k-1]%10);else if(D=Pi((I+1)/ae),D>=B.length)if(O){for(;B.length<=D;B.push(0));A=S=0,C=1,I%=ae,k=I-ae+1}else break e;else{for(A=y=B[D],C=1;y>=10;y/=10,C++);I%=ae,k=I-ae+C,S=k<0?0:lt(A/j[C-k-1]%10)}if(O=O||g<0||B[D+1]!=null||(k<0?A:A%j[C-k-1]),O=w<4?(S||O)&&(w==0||w==(b.s<0?3:2)):S>5||S==5&&(w==4||O||w==6&&(I>0?k>0?A/j[C-k]:0:B[D-1])%10&1||w==(b.s<0?8:7)),g<1||!B[0])return B.length=0,O?(g-=b.e+1,B[0]=j[(ae-g%ae)%ae],b.e=-g||0):B[0]=b.e=0,b;if(I==0?(B.length=D,y=1,D--):(B.length=D+1,y=j[ae-I],B[D]=k>0?lt(A/j[C-k]%j[k])*y:0),O)for(;;)if(D==0){for(I=1,k=B[0];k>=10;k/=10,I++);for(k=B[0]+=y,y=1;k>=10;k/=10,y++);I!=y&&(b.e++,B[0]==St&&(B[0]=1));break}else{if(B[D]+=y,B[D]!=St)break;B[D--]=0,y=1}for(I=B.length;B[--I]===0;B.pop());}b.e>f?b.c=b.e=null:b.e<u&&(b.c=[b.e=0])}return b}function L(b){var g,w=b.e;return w===null?b.toString():(g=ft(b.c),g=w<=a||w>=l?es(g,w):Yt(g,w,"0"),b.s<0?"-"+g:g)}return o.absoluteValue=o.abs=function(){var b=new E(this);return b.s<0&&(b.s=1),b},o.comparedTo=function(b,g){return Mn(this,new E(b,g))},o.decimalPlaces=o.dp=function(b,g){var w,O,C,I=this;if(b!=null)return xe(b,0,Ie),g==null?g=c:xe(g,0,8),F(new E(I),b+I.e+1,g);if(!(w=I.c))return null;if(O=((C=w.length-1)-ut(this.e/ae))*ae,C=w[C])for(;C%10==0;C/=10,O--);return O<0&&(O=0),O},o.dividedBy=o.div=function(b,g){return t(this,new E(b,g),i,c)},o.dividedToIntegerBy=o.idiv=function(b,g){return t(this,new E(b,g),0,1)},o.exponentiatedBy=o.pow=function(b,g){var w,O,C,I,k,y,A,D,S,B=this;if(b=new E(b),b.c&&!b.isInteger())throw Error(_e+"Exponent not an integer: "+L(b));if(g!=null&&(g=new E(g)),y=b.e>14,!B.c||!B.c[0]||B.c[0]==1&&!B.e&&B.c.length==1||!b.c||!b.c[0])return S=new E(Math.pow(+L(B),y?b.s*(2-Qo(b)):+L(b))),g?S.mod(g):S;if(A=b.s<0,g){if(g.c?!g.c[0]:!g.s)return new E(NaN);O=!A&&B.isInteger()&&g.isInteger(),O&&(B=B.mod(g))}else{if(b.e>9&&(B.e>0||B.e<-1||(B.e==0?B.c[0]>1||y&&B.c[1]>=24e7:B.c[0]<8e13||y&&B.c[0]<=9999975e7)))return I=B.s<0&&Qo(b)?-0:0,B.e>-1&&(I=1/I),new E(A?1/I:I);h&&(I=Pi(h/ae+2))}for(y?(w=new E(.5),A&&(b.s=1),D=Qo(b)):(C=Math.abs(+L(b)),D=C%2),S=new E(s);;){if(D){if(S=S.times(B),!S.c)break;I?S.c.length>I&&(S.c.length=I):O&&(S=S.mod(g))}if(C){if(C=lt(C/2),C===0)break;D=C%2}else if(b=b.times(w),F(b,b.e+1,1),b.e>14)D=Qo(b);else{if(C=+L(b),C===0)break;D=C%2}B=B.times(B),I?B.c&&B.c.length>I&&(B.c.length=I):O&&(B=B.mod(g))}return O?S:(A&&(S=s.div(S)),g?S.mod(g):I?F(S,h,c,k):S)},o.integerValue=function(b){var g=new E(this);return b==null?b=c:xe(b,0,8),F(g,g.e+1,b)},o.isEqualTo=o.eq=function(b,g){return Mn(this,new E(b,g))===0},o.isFinite=function(){return!!this.c},o.isGreaterThan=o.gt=function(b,g){return Mn(this,new E(b,g))>0},o.isGreaterThanOrEqualTo=o.gte=function(b,g){return(g=Mn(this,new E(b,g)))===1||g===0},o.isInteger=function(){return!!this.c&&ut(this.e/ae)>this.c.length-2},o.isLessThan=o.lt=function(b,g){return Mn(this,new E(b,g))<0},o.isLessThanOrEqualTo=o.lte=function(b,g){return(g=Mn(this,new E(b,g)))===-1||g===0},o.isNaN=function(){return!this.s},o.isNegative=function(){return this.s<0},o.isPositive=function(){return this.s>0},o.isZero=function(){return!!this.c&&this.c[0]==0},o.minus=function(b,g){var w,O,C,I,k=this,y=k.s;if(b=new E(b,g),g=b.s,!y||!g)return new E(NaN);if(y!=g)return b.s=-g,k.plus(b);var A=k.e/ae,D=b.e/ae,S=k.c,B=b.c;if(!A||!D){if(!S||!B)return S?(b.s=-g,b):new E(B?k:NaN);if(!S[0]||!B[0])return B[0]?(b.s=-g,b):new E(S[0]?k:c==3?-0:0)}if(A=ut(A),D=ut(D),S=S.slice(),y=A-D){for((I=y<0)?(y=-y,C=S):(D=A,C=B),C.reverse(),g=y;g--;C.push(0));C.reverse()}else for(O=(I=(y=S.length)<(g=B.length))?y:g,y=g=0;g<O;g++)if(S[g]!=B[g]){I=S[g]<B[g];break}if(I&&(C=S,S=B,B=C,b.s=-b.s),g=(O=B.length)-(w=S.length),g>0)for(;g--;S[w++]=0);for(g=St-1;O>y;){if(S[--O]<B[O]){for(w=O;w&&!S[--w];S[w]=g);--S[w],S[O]+=St}S[O]-=B[O]}for(;S[0]==0;S.splice(0,1),--D);return S[0]?M(b,S,D):(b.s=c==3?-1:1,b.c=[b.e=0],b)},o.modulo=o.mod=function(b,g){var w,O,C=this;return b=new E(b,g),!C.c||!b.s||b.c&&!b.c[0]?new E(NaN):!b.c||C.c&&!C.c[0]?new E(C):(d==9?(O=b.s,b.s=1,w=t(C,b,0,3),b.s=O,w.s*=O):w=t(C,b,0,d),b=C.minus(w.times(b)),!b.c[0]&&d==1&&(b.s=C.s),b)},o.multipliedBy=o.times=function(b,g){var w,O,C,I,k,y,A,D,S,B,j,_,W,q,Z,H=this,U=H.c,J=(b=new E(b,g)).c;if(!U||!J||!U[0]||!J[0])return!H.s||!b.s||U&&!U[0]&&!J||J&&!J[0]&&!U?b.c=b.e=b.s=null:(b.s*=H.s,!U||!J?b.c=b.e=null:(b.c=[0],b.e=0)),b;for(O=ut(H.e/ae)+ut(b.e/ae),b.s*=H.s,A=U.length,B=J.length,A<B&&(W=U,U=J,J=W,C=A,A=B,B=C),C=A+B,W=[];C--;W.push(0));for(q=St,Z=gn,C=B;--C>=0;){for(w=0,j=J[C]%Z,_=J[C]/Z|0,k=A,I=C+k;I>C;)D=U[--k]%Z,S=U[k]/Z|0,y=_*D+S*j,D=j*D+y%Z*Z+W[I]+w,w=(D/q|0)+(y/Z|0)+_*S,W[I--]=D%q;W[I]=w}return w?++O:W.splice(0,1),M(b,W,O)},o.negated=function(){var b=new E(this);return b.s=-b.s||null,b},o.plus=function(b,g){var w,O=this,C=O.s;if(b=new E(b,g),g=b.s,!C||!g)return new E(NaN);if(C!=g)return b.s=-g,O.minus(b);var I=O.e/ae,k=b.e/ae,y=O.c,A=b.c;if(!I||!k){if(!y||!A)return new E(C/0);if(!y[0]||!A[0])return A[0]?b:new E(y[0]?O:C*0)}if(I=ut(I),k=ut(k),y=y.slice(),C=I-k){for(C>0?(k=I,w=A):(C=-C,w=y),w.reverse();C--;w.push(0));w.reverse()}for(C=y.length,g=A.length,C-g<0&&(w=A,A=y,y=w,g=C),C=0;g;)C=(y[--g]=y[g]+A[g]+C)/St|0,y[g]=St===y[g]?0:y[g]%St;return C&&(y=[C].concat(y),++k),M(b,y,k)},o.precision=o.sd=function(b,g){var w,O,C,I=this;if(b!=null&&b!==!!b)return xe(b,1,Ie),g==null?g=c:xe(g,0,8),F(new E(I),b,g);if(!(w=I.c))return null;if(C=w.length-1,O=C*ae+1,C=w[C]){for(;C%10==0;C/=10,O--);for(C=w[0];C>=10;C/=10,O++);}return b&&I.e+1>O&&(O=I.e+1),O},o.shiftedBy=function(b){return xe(b,-Ti,Ti),this.times("1e"+b)},o.squareRoot=o.sqrt=function(){var b,g,w,O,C,I=this,k=I.c,y=I.s,A=I.e,D=i+4,S=new E("0.5");if(y!==1||!k||!k[0])return new E(!y||y<0&&(!k||k[0])?NaN:k?I:1/0);if(y=Math.sqrt(+L(I)),y==0||y==1/0?(g=ft(k),(g.length+A)%2==0&&(g+="0"),y=Math.sqrt(+g),A=ut((A+1)/2)-(A<0||A%2),y==1/0?g="5e"+A:(g=y.toExponential(),g=g.slice(0,g.indexOf("e")+1)+A),w=new E(g)):w=new E(y+""),w.c[0]){for(A=w.e,y=A+D,y<3&&(y=0);;)if(C=w,w=S.times(C.plus(t(I,C,D,1))),ft(C.c).slice(0,y)===(g=ft(w.c)).slice(0,y))if(w.e<A&&--y,g=g.slice(y-3,y+1),g=="9999"||!O&&g=="4999"){if(!O&&(F(C,C.e+i+2,0),C.times(C).eq(I))){w=C;break}D+=4,y+=4,O=1}else{(!+g||!+g.slice(1)&&g.charAt(0)=="5")&&(F(w,w.e+i+2,1),b=!w.times(w).eq(I));break}}return F(w,w.e+i+1,c,b)},o.toExponential=function(b,g){return b!=null&&(xe(b,0,Ie),b++),T(this,b,g,1)},o.toFixed=function(b,g){return b!=null&&(xe(b,0,Ie),b=b+this.e+1),T(this,b,g)},o.toFormat=function(b,g,w){var O,C=this;if(w==null)b!=null&&g&&typeof g=="object"?(w=g,g=null):b&&typeof b=="object"?(w=b,b=g=null):w=m;else if(typeof w!="object")throw Error(_e+"Argument not an object: "+w);if(O=C.toFixed(b,g),C.c){var I,k=O.split("."),y=+w.groupSize,A=+w.secondaryGroupSize,D=w.groupSeparator||"",S=k[0],B=k[1],j=C.s<0,_=j?S.slice(1):S,W=_.length;if(A&&(I=y,y=A,A=I,W-=I),y>0&&W>0){for(I=W%y||y,S=_.substr(0,I);I<W;I+=y)S+=D+_.substr(I,y);A>0&&(S+=D+_.slice(I)),j&&(S="-"+S)}O=B?S+(w.decimalSeparator||"")+((A=+w.fractionGroupSize)?B.replace(new RegExp("\\d{"+A+"}\\B","g"),"$&"+(w.fractionGroupSeparator||"")):B):S}return(w.prefix||"")+O+(w.suffix||"")},o.toFraction=function(b){var g,w,O,C,I,k,y,A,D,S,B,j,_=this,W=_.c;if(b!=null&&(y=new E(b),!y.isInteger()&&(y.c||y.s!==1)||y.lt(s)))throw Error(_e+"Argument "+(y.isInteger()?"out of range: ":"not an integer: ")+L(y));if(!W)return new E(_);for(g=new E(s),D=w=new E(s),O=A=new E(s),j=ft(W),I=g.e=j.length-_.e-1,g.c[0]=Ai[(k=I%ae)<0?ae+k:k],b=!b||y.comparedTo(g)>0?I>0?g:D:y,k=f,f=1/0,y=new E(j),A.c[0]=0;S=t(y,g,0,1),C=w.plus(S.times(O)),C.comparedTo(b)!=1;)w=O,O=C,D=A.plus(S.times(C=D)),A=C,g=y.minus(S.times(C=g)),y=C;return C=t(b.minus(w),O,0,1),A=A.plus(C.times(D)),w=w.plus(C.times(O)),A.s=D.s=_.s,I=I*2,B=t(D,O,I,c).minus(_).abs().comparedTo(t(A,w,I,c).minus(_).abs())<1?[D,O]:[A,w],f=k,B},o.toNumber=function(){return+L(this)},o.toPrecision=function(b,g){return b!=null&&xe(b,1,Ie),T(this,b,g,2)},o.toString=function(b){var g,w=this,O=w.s,C=w.e;return C===null?O?(g="Infinity",O<0&&(g="-"+g)):g="NaN":(b==null?g=C<=a||C>=l?es(ft(w.c),C):Yt(ft(w.c),C,"0"):b===10&&P?(w=F(new E(w),i+C+1,c),g=Yt(ft(w.c),w.e,"0")):(xe(b,2,x.length,"Base"),g=n(Yt(ft(w.c),C,"0"),10,b,O,!0)),O<0&&w.c[0]&&(g="-"+g)),g},o.valueOf=o.toJSON=function(){return L(this)},o._isBigNumber=!0,o[Symbol.toStringTag]="BigNumber",o[Symbol.for("nodejs.util.inspect.custom")]=o.valueOf,e!=null&&E.set(e),E}function ut(e){var t=e|0;return e>0||e===t?t:t-1}function ft(e){for(var t,n,r=1,o=e.length,s=e[0]+"";r<o;){for(t=e[r++]+"",n=ae-t.length;n--;t="0"+t);s+=t}for(o=s.length;s.charCodeAt(--o)===48;);return s.slice(0,o+1||1)}function Mn(e,t){var n,r,o=e.c,s=t.c,i=e.s,c=t.s,a=e.e,l=t.e;if(!i||!c)return null;if(n=o&&!o[0],r=s&&!s[0],n||r)return n?r?0:-c:i;if(i!=c)return i;if(n=i<0,r=a==l,!o||!s)return r?0:!o^n?1:-1;if(!r)return a>l^n?1:-1;for(c=(a=o.length)<(l=s.length)?a:l,i=0;i<c;i++)if(o[i]!=s[i])return o[i]>s[i]^n?1:-1;return a==l?0:a>l^n?1:-1}function xe(e,t,n,r){if(e<t||e>n||e!==lt(e))throw Error(_e+(r||"Argument")+(typeof e=="number"?e<t||e>n?" out of range: ":" not an integer: ":" not a primitive number: ")+String(e))}function Qo(e){var t=e.c.length-1;return ut(e.e/ae)==t&&e.c[t]%2!=0}function es(e,t){return(e.length>1?e.charAt(0)+"."+e.slice(1):e)+(t<0?"e":"e+")+t}function Yt(e,t,n){var r,o;if(t<0){for(o=n+".";++t;o+=n);e=o+e}else if(r=e.length,++t>r){for(o=n,t-=r;--t;o+=n);e+=o}else t<r&&(e=e.slice(0,t)+"."+e.slice(t));return e}var De=_l();const rb=(e,t=6)=>{try{const n=new De(e||"0");if(n.isNaN())return"0";const r=n.decimalPlaces(t,De.ROUND_DOWN),[o,s=""]=r.toString().split("."),i=o.replace(/\B(?=(\d{3})+(?!\d))/g,",");if(t>0){const c=(s||"").padEnd(t,"0");return`${i}.${c}`}return i}catch(n){return console.warn("formatThousands error:",n),"0"}},Pt=()=>{const{translations:e,currentLocale:t}=zl();return{t:(s,i)=>{try{const c=s.split(".");let a=e;for(const u of c)if(a&&typeof a=="object"&&u in a)a=a[u];else return s;let l=typeof a=="string"?a:s;return i&&typeof l=="string"&&Object.keys(i).forEach(u=>{const f=`{{${u}}}`;l=l.replace(new RegExp(f,"g"),String(i[u]))}),l}catch(c){return console.warn(`Translation error for key "${s}":`,c),s}},translations:e,locale:t,getTranslationObject:s=>{try{const i=s.split(".");let c=e;for(const a of i)if(c&&typeof c=="object"&&a in c)c=c[a];else return{};return typeof c=="object"?c:{}}catch(i){return console.warn(`Translation object error for key "${s}":`,i),{}}},hasTranslation:s=>{try{const i=s.split(".");let c=e;for(const a of i)if(c&&typeof c=="object"&&a in c)c=c[a];else return!1;return typeof c=="string"}catch{return!1}}}},ob="1.1.0";let We=class Dl extends Error{constructor(t,n={}){var i;const r=n.cause instanceof Dl?n.cause.details:(i=n.cause)!=null&&i.message?n.cause.message:n.details,o=n.cause instanceof Dl&&n.cause.docsPath||n.docsPath,s=[t||"An error occurred.","",...n.metaMessages?[...n.metaMessages,""]:[],...o?[`Docs: https://abitype.dev${o}`]:[],...r?[`Details: ${r}`]:[],`Version: abitype@${ob}`].join(`
|
|
51
|
+
`);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=o,this.metaMessages=n.metaMessages,this.shortMessage=t}};function Xt(e,t){const n=e.exec(t);return n==null?void 0:n.groups}const Wl=/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/,Vl=/^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)?$/,Hl=/^\(.+?\).*?$/,Gl=/^tuple(?<array>(\[(\d*)\])*)$/;function Ni(e){let t=e.type;if(Gl.test(e.type)&&"components"in e){t="(";const n=e.components.length;for(let o=0;o<n;o++){const s=e.components[o];t+=Ni(s),o<n-1&&(t+=", ")}const r=Xt(Gl,e.type);return t+=`)${(r==null?void 0:r.array)??""}`,Ni({...e,type:t})}return"indexed"in e&&e.indexed&&(t=`${t} indexed`),e.name?`${t} ${e.name}`:t}function sr(e){let t="";const n=e.length;for(let r=0;r<n;r++){const o=e[r];t+=Ni(o),r!==n-1&&(t+=", ")}return t}function ts(e){var t;return e.type==="function"?`function ${e.name}(${sr(e.inputs)})${e.stateMutability&&e.stateMutability!=="nonpayable"?` ${e.stateMutability}`:""}${(t=e.outputs)!=null&&t.length?` returns (${sr(e.outputs)})`:""}`:e.type==="event"?`event ${e.name}(${sr(e.inputs)})`:e.type==="error"?`error ${e.name}(${sr(e.inputs)})`:e.type==="constructor"?`constructor(${sr(e.inputs)})${e.stateMutability==="payable"?" payable":""}`:e.type==="fallback"?`fallback() external${e.stateMutability==="payable"?" payable":""}`:"receive() external payable"}const ql=/^error (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*)\((?<parameters>.*?)\)$/;function sb(e){return ql.test(e)}function ib(e){return Xt(ql,e)}const Kl=/^event (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*)\((?<parameters>.*?)\)$/;function ab(e){return Kl.test(e)}function cb(e){return Xt(Kl,e)}const Zl=/^function (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*)\((?<parameters>.*?)\)(?: (?<scope>external|public{1}))?(?: (?<stateMutability>pure|view|nonpayable|payable{1}))?(?: returns\s?\((?<returns>.*?)\))?$/;function lb(e){return Zl.test(e)}function ub(e){return Xt(Zl,e)}const Yl=/^struct (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*) \{(?<properties>.*?)\}$/;function ns(e){return Yl.test(e)}function fb(e){return Xt(Yl,e)}const Xl=/^constructor\((?<parameters>.*?)\)(?:\s(?<stateMutability>payable{1}))?$/;function db(e){return Xl.test(e)}function pb(e){return Xt(Xl,e)}const Jl=/^fallback\(\) external(?:\s(?<stateMutability>payable{1}))?$/;function hb(e){return Jl.test(e)}function mb(e){return Xt(Jl,e)}const bb=/^receive\(\) external payable$/;function gb(e){return bb.test(e)}const Ql=new Set(["memory","indexed","storage","calldata"]),yb=new Set(["indexed"]),Ci=new Set(["calldata","memory","storage"]);class vb extends We{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 wb extends We{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 xb extends We{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 Eb extends We{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 Sb extends We{constructor({param:t}){super("Invalid ABI parameter.",{details:t}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidParameterError"})}}class Pb extends We{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 Tb extends We{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 Ab extends We{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 Nb extends We{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 ir extends We{constructor({signature:t,type:n}){super(`Invalid ${n} signature.`,{details:t}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidSignatureError"})}}class Cb extends We{constructor({signature:t}){super("Unknown signature.",{details:t}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"UnknownSignatureError"})}}class Ob extends We{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 Ib extends We{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 $b extends We{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 kb(e,t,n){let r="";if(n)for(const o of Object.entries(n)){if(!o)continue;let s="";for(const i of o[1])s+=`[${i.type}${i.name?`:${i.name}`:""}]`;r+=`(${o[0]}{${s}})`}return t?`${t}:${e}${r}`:e}const Oi=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 Ii(e,t={}){if(lb(e))return Db(e,t);if(ab(e))return Mb(e,t);if(sb(e))return Bb(e,t);if(db(e))return Lb(e,t);if(hb(e))return Fb(e);if(gb(e))return{type:"receive",stateMutability:"payable"};throw new Cb({signature:e})}function Db(e,t={}){const n=ub(e);if(!n)throw new ir({signature:e,type:"function"});const r=tt(n.parameters),o=[],s=r.length;for(let c=0;c<s;c++)o.push(Jt(r[c],{modifiers:Ci,structs:t,type:"function"}));const i=[];if(n.returns){const c=tt(n.returns),a=c.length;for(let l=0;l<a;l++)i.push(Jt(c[l],{modifiers:Ci,structs:t,type:"function"}))}return{name:n.name,type:"function",stateMutability:n.stateMutability??"nonpayable",inputs:o,outputs:i}}function Mb(e,t={}){const n=cb(e);if(!n)throw new ir({signature:e,type:"event"});const r=tt(n.parameters),o=[],s=r.length;for(let i=0;i<s;i++)o.push(Jt(r[i],{modifiers:yb,structs:t,type:"event"}));return{name:n.name,type:"event",inputs:o}}function Bb(e,t={}){const n=ib(e);if(!n)throw new ir({signature:e,type:"error"});const r=tt(n.parameters),o=[],s=r.length;for(let i=0;i<s;i++)o.push(Jt(r[i],{structs:t,type:"error"}));return{name:n.name,type:"error",inputs:o}}function Lb(e,t={}){const n=pb(e);if(!n)throw new ir({signature:e,type:"constructor"});const r=tt(n.parameters),o=[],s=r.length;for(let i=0;i<s;i++)o.push(Jt(r[i],{structs:t,type:"constructor"}));return{type:"constructor",stateMutability:n.stateMutability??"nonpayable",inputs:o}}function Fb(e){const t=mb(e);if(!t)throw new ir({signature:e,type:"fallback"});return{type:"fallback",stateMutability:t.stateMutability??"nonpayable"}}const Rb=/^(?<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$_]*))?$/,jb=/^\((?<type>.+?)\)(?<array>(?:\[\d*?\])+?)?(?:\s(?<modifier>calldata|indexed|memory|storage{1}))?(?:\s(?<name>[a-zA-Z$_][a-zA-Z0-9$_]*))?$/,zb=/^u?int$/;function Jt(e,t){var f,p;const n=kb(e,t==null?void 0:t.type,t==null?void 0:t.structs);if(Oi.has(n))return Oi.get(n);const r=Hl.test(e),o=Xt(r?jb:Rb,e);if(!o)throw new Sb({param:e});if(o.name&&_b(o.name))throw new Pb({param:e,name:o.name});const s=o.name?{name:o.name}:{},i=o.modifier==="indexed"?{indexed:!0}:{},c=(t==null?void 0:t.structs)??{};let a,l={};if(r){a="tuple";const d=tt(o.type),h=[],m=d.length;for(let x=0;x<m;x++)h.push(Jt(d[x],{structs:c}));l={components:h}}else if(o.type in c)a="tuple",l={components:c[o.type]};else if(zb.test(o.type))a=`${o.type}256`;else if(o.type==="address payable")a="address";else if(a=o.type,(t==null?void 0:t.type)!=="struct"&&!eu(a))throw new xb({type:a});if(o.modifier){if(!((p=(f=t==null?void 0:t.modifiers)==null?void 0:f.has)!=null&&p.call(f,o.modifier)))throw new Tb({param:e,type:t==null?void 0:t.type,modifier:o.modifier});if(Ci.has(o.modifier)&&!Wb(a,!!o.array))throw new Ab({param:e,type:t==null?void 0:t.type,modifier:o.modifier})}const u={type:`${a}${o.array??""}`,...s,...i,...l};return Oi.set(n,u),u}function tt(e,t=[],n="",r=0){const o=e.trim().length;for(let s=0;s<o;s++){const i=e[s],c=e.slice(s+1);switch(i){case",":return r===0?tt(c,[...t,n.trim()]):tt(c,t,`${n}${i}`,r);case"(":return tt(c,t,`${n}${i}`,r+1);case")":return tt(c,t,`${n}${i}`,r-1);default:return tt(c,t,`${n}${i}`,r)}}if(n==="")return t;if(r!==0)throw new $b({current:n,depth:r});return t.push(n.trim()),t}function eu(e){return e==="address"||e==="bool"||e==="function"||e==="string"||Wl.test(e)||Vl.test(e)}const Ub=/^(?: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 _b(e){return e==="address"||e==="bool"||e==="function"||e==="string"||e==="tuple"||Wl.test(e)||Vl.test(e)||Ub.test(e)}function Wb(e,t){return t||e==="bytes"||e==="string"||e==="tuple"}function $i(e){const t={},n=e.length;for(let i=0;i<n;i++){const c=e[i];if(!ns(c))continue;const a=fb(c);if(!a)throw new ir({signature:c,type:"struct"});const l=a.properties.split(";"),u=[],f=l.length;for(let p=0;p<f;p++){const h=l[p].trim();if(!h)continue;const m=Jt(h,{type:"struct"});u.push(m)}if(!u.length)throw new Ob({signature:c});t[a.name]=u}const r={},o=Object.entries(t),s=o.length;for(let i=0;i<s;i++){const[c,a]=o[i];r[c]=tu(a,t)}return r}const Vb=/^(?<type>[a-zA-Z$_][a-zA-Z0-9$_]*)(?<array>(?:\[\d*?\])+?)?$/;function tu(e,t,n=new Set){const r=[],o=e.length;for(let s=0;s<o;s++){const i=e[s];if(Hl.test(i.type))r.push(i);else{const a=Xt(Vb,i.type);if(!(a!=null&&a.type))throw new Nb({abiParameter:i});const{array:l,type:u}=a;if(u in t){if(n.has(u))throw new Ib({type:u});r.push({...i,type:`tuple${l??""}`,components:tu(t[u]??[],t,new Set([...n,u]))})}else if(eu(u))r.push(i);else throw new wb({type:u})}}return r}function nu(e){const t=$i(e),n=[],r=e.length;for(let o=0;o<r;o++){const s=e[o];ns(s)||n.push(Ii(s,t))}return n}function ru(e){let t;if(typeof e=="string")t=Ii(e);else{const n=$i(e),r=e.length;for(let o=0;o<r;o++){const s=e[o];if(!ns(s)){t=Ii(s,n);break}}}if(!t)throw new vb({signature:e});return t}function ou(e){const t=[];if(typeof e=="string"){const n=tt(e),r=n.length;for(let o=0;o<r;o++)t.push(Jt(n[o],{modifiers:Ql}))}else{const n=$i(e),r=e.length;for(let o=0;o<r;o++){const s=e[o];if(ns(s))continue;const i=tt(s),c=i.length;for(let a=0;a<c;a++)t.push(Jt(i[a],{modifiers:Ql,structs:n}))}}if(t.length===0)throw new Eb({params:e});return t}function te(e,t,n){const r=e[t.name];if(typeof r=="function")return r;const o=e[n];return typeof o=="function"?o:s=>t(e,s)}function Tt(e,{includeName:t=!1}={}){if(e.type!=="function"&&e.type!=="event"&&e.type!=="error")throw new o1(e.type);return`${e.name}(${rs(e.inputs,{includeName:t})})`}function rs(e,{includeName:t=!1}={}){return e?e.map(n=>Hb(n,{includeName:t})).join(t?", ":","):""}function Hb(e,{includeName:t}){return e.type.startsWith("tuple")?`(${rs(e.components,{includeName:t})})${e.type.slice(5)}`:e.type+(t&&e.name?` ${e.name}`:"")}function At(e,{strict:t=!0}={}){return!e||typeof e!="string"?!1:t?/^0x[0-9a-fA-F]*$/.test(e):e.startsWith("0x")}function Ee(e){return At(e,{strict:!1})?Math.ceil((e.length-2)/2):e.length}const su="2.42.1";let _r={getDocsUrl:({docsBaseUrl:e,docsPath:t="",docsSlug:n})=>t?`${e??"https://viem.sh"}${t}${n?`#${n}`:""}`:void 0,version:`viem@${su}`},V=class Ml extends Error{constructor(t,n={}){var c;const r=(()=>{var a;return n.cause instanceof Ml?n.cause.details:(a=n.cause)!=null&&a.message?n.cause.message:n.details})(),o=n.cause instanceof Ml&&n.cause.docsPath||n.docsPath,s=(c=_r.getDocsUrl)==null?void 0:c.call(_r,{...n,docsPath:o}),i=[t||"An error occurred.","",...n.metaMessages?[...n.metaMessages,""]:[],...s?[`Docs: ${s}`]:[],...r?[`Details: ${r}`]:[],..._r.version?[`Version: ${_r.version}`]:[]].join(`
|
|
52
|
+
`);super(i,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=o,this.metaMessages=n.metaMessages,this.name=n.name??this.name,this.shortMessage=t,this.version=su}walk(t){return iu(this,t)}};function iu(e,t){return t!=null&&t(e)?e:e&&typeof e=="object"&&"cause"in e&&e.cause!==void 0?iu(e.cause,t):t?null:e}class Gb extends V{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(`
|
|
53
|
+
`),{docsPath:t,name:"AbiConstructorNotFoundError"})}}class au extends V{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(`
|
|
54
|
+
`),{docsPath:t,name:"AbiConstructorParamsNotFoundError"})}}class cu extends V{constructor({data:t,params:n,size:r}){super([`Data size of ${r} bytes is too small for given parameters.`].join(`
|
|
55
|
+
`),{metaMessages:[`Params: (${rs(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 Wr extends V{constructor(){super('Cannot decode zero data ("0x") with ABI parameters.',{name:"AbiDecodingZeroDataError"})}}class qb extends V{constructor({expectedLength:t,givenLength:n,type:r}){super([`ABI encoding array length mismatch for type ${r}.`,`Expected length: ${t}`,`Given length: ${n}`].join(`
|
|
56
|
+
`),{name:"AbiEncodingArrayLengthMismatchError"})}}class Kb extends V{constructor({expectedSize:t,value:n}){super(`Size of bytes "${n}" (bytes${Ee(n)}) does not match expected size (bytes${t}).`,{name:"AbiEncodingBytesSizeMismatchError"})}}class Zb extends V{constructor({expectedLength:t,givenLength:n}){super(["ABI encoding params/values length mismatch.",`Expected length (params): ${t}`,`Given length (values): ${n}`].join(`
|
|
57
|
+
`),{name:"AbiEncodingLengthMismatchError"})}}class Yb extends V{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(`
|
|
58
|
+
`),{docsPath:n,name:"AbiErrorInputsNotFoundError"})}}class lu extends V{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(`
|
|
59
|
+
`),{docsPath:n,name:"AbiErrorNotFoundError"})}}class uu extends V{constructor(t,{docsPath:n}){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://openchain.xyz/signatures?query=${t}.`].join(`
|
|
60
|
+
`),{docsPath:n,name:"AbiErrorSignatureNotFoundError"}),Object.defineProperty(this,"signature",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.signature=t}}class Xb extends V{constructor({docsPath:t}){super("Cannot extract event signature from empty topics.",{docsPath:t,name:"AbiEventSignatureEmptyTopicsError"})}}class Jb extends V{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://openchain.xyz/signatures?query=${t}.`].join(`
|
|
61
|
+
`),{docsPath:n,name:"AbiEventSignatureNotFoundError"})}}class fu extends V{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(`
|
|
62
|
+
`),{docsPath:n,name:"AbiEventNotFoundError"})}}class ar extends V{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(`
|
|
63
|
+
`),{docsPath:n,name:"AbiFunctionNotFoundError"})}}class du extends V{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(`
|
|
64
|
+
`),{docsPath:n,name:"AbiFunctionOutputsNotFoundError"})}}class Qb extends V{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://openchain.xyz/signatures?query=${t}.`].join(`
|
|
65
|
+
`),{docsPath:n,name:"AbiFunctionSignatureNotFoundError"})}}class e1 extends V{constructor(t,n){super("Found ambiguous types in overloaded ABI items.",{metaMessages:[`\`${t.type}\` in \`${Tt(t.abiItem)}\`, and`,`\`${n.type}\` in \`${Tt(n.abiItem)}\``,"","These types encode differently and cannot be distinguished at runtime.","Remove one of the ambiguous items in the ABI."],name:"AbiItemAmbiguityError"})}}let t1=class extends V{constructor({expectedSize:t,givenSize:n}){super(`Expected bytes${t}, got bytes${n}.`,{name:"BytesSizeMismatchError"})}};class os extends V{constructor({abiItem:t,data:n,params:r,size:o}){super([`Data size of ${o} bytes is too small for non-indexed event parameters.`].join(`
|
|
66
|
+
`),{metaMessages:[`Params: (${rs(r,{includeName:!0})})`,`Data: ${n} (${o} 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=o}}class ki extends V{constructor({abiItem:t,param:n}){super([`Expected a topic for indexed event parameter${n.name?` "${n.name}"`:""} on event "${Tt(t,{includeName:!0})}".`].join(`
|
|
67
|
+
`),{name:"DecodeLogTopicsMismatch"}),Object.defineProperty(this,"abiItem",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.abiItem=t}}class n1 extends V{constructor(t,{docsPath:n}){super([`Type "${t}" is not a valid encoding type.`,"Please provide a valid ABI type."].join(`
|
|
68
|
+
`),{docsPath:n,name:"InvalidAbiEncodingType"})}}class r1 extends V{constructor(t,{docsPath:n}){super([`Type "${t}" is not a valid decoding type.`,"Please provide a valid ABI type."].join(`
|
|
69
|
+
`),{docsPath:n,name:"InvalidAbiDecodingType"})}}let pu=class extends V{constructor(t){super([`Value "${t}" is not a valid array.`].join(`
|
|
70
|
+
`),{name:"InvalidArrayError"})}};class o1 extends V{constructor(t){super([`"${t}" is not a valid definition type.`,'Valid types: "function", "event", "error"'].join(`
|
|
71
|
+
`),{name:"InvalidDefinitionTypeError"})}}class s1 extends V{constructor(t){super(`Filter type "${t}" is not supported.`,{name:"FilterTypeNotSupportedError"})}}let hu=class extends V{constructor({offset:t,position:n,size:r}){super(`Slice ${n==="start"?"starting":"ending"} at offset "${t}" is out-of-bounds (size: ${r}).`,{name:"SliceOffsetOutOfBoundsError"})}},mu=class extends V{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 bu extends V{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 cr(e,{dir:t,size:n=32}={}){return typeof e=="string"?yn(e,{dir:t,size:n}):i1(e,{dir:t,size:n})}function yn(e,{dir:t,size:n=32}={}){if(n===null)return e;const r=e.replace("0x","");if(r.length>n*2)throw new mu({size:Math.ceil(r.length/2),targetSize:n,type:"hex"});return`0x${r[t==="right"?"padEnd":"padStart"](n*2,"0")}`}function i1(e,{dir:t,size:n=32}={}){if(n===null)return e;if(e.length>n)throw new mu({size:e.length,targetSize:n,type:"bytes"});const r=new Uint8Array(n);for(let o=0;o<n;o++){const s=t==="right";r[s?o:n-o-1]=e[s?o:e.length-o-1]}return r}let gu=class extends V{constructor({max:t,min:n,signed:r,size:o,value:s}){super(`Number "${s}" is not in safe ${o?`${o*8}-bit ${r?"signed":"unsigned"} `:""}integer range ${t?`(${n} to ${t})`:`(above ${n})`}`,{name:"IntegerOutOfRangeError"})}},a1=class extends V{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 c1 extends V{constructor(t){super(`Hex value "${t}" is not a valid boolean. The hex value must be "0x0" (false) or "0x1" (true).`,{name:"InvalidHexBooleanError"})}}let l1=class extends V{constructor({givenSize:t,maxSize:n}){super(`Size cannot exceed ${n} bytes. Given size: ${t} bytes.`,{name:"SizeOverflowError"})}};function Bn(e,{dir:t="left"}={}){let n=typeof e=="string"?e.replace("0x",""):e,r=0;for(let o=0;o<n.length-1&&n[t==="left"?o:n.length-o-1].toString()==="0";o++)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 Nt(e,{size:t}){if(Ee(e)>t)throw new l1({givenSize:Ee(e),maxSize:t})}function Ft(e,t={}){const{signed:n}=t;t.size&&Nt(e,{size:t.size});const r=BigInt(e);if(!n)return r;const o=(e.length-2)/2,s=(1n<<BigInt(o)*8n-1n)-1n;return r<=s?r:r-BigInt(`0x${"f".padStart(o*2,"f")}`)-1n}function u1(e,t={}){let n=e;if(t.size&&(Nt(n,{size:t.size}),n=Bn(n)),Bn(n)==="0x00")return!1;if(Bn(n)==="0x01")return!0;throw new c1(n)}function Qt(e,t={}){return Number(Ft(e,t))}const f1=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function vn(e,t={}){return typeof e=="number"||typeof e=="bigint"?oe(e,t):typeof e=="string"?Vr(e,t):typeof e=="boolean"?yu(e,t):Ce(e,t)}function yu(e,t={}){const n=`0x${Number(e)}`;return typeof t.size=="number"?(Nt(n,{size:t.size}),cr(n,{size:t.size})):n}function Ce(e,t={}){let n="";for(let o=0;o<e.length;o++)n+=f1[e[o]];const r=`0x${n}`;return typeof t.size=="number"?(Nt(r,{size:t.size}),cr(r,{dir:"right",size:t.size})):r}function oe(e,t={}){const{signed:n,size:r}=t,o=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 i=typeof s=="bigint"&&n?-s-1n:0;if(s&&o>s||o<i){const a=typeof e=="bigint"?"n":"";throw new gu({max:s?`${s}${a}`:void 0,min:`${i}${a}`,signed:n,size:r,value:`${e}${a}`})}const c=`0x${(n&&o<0?(1n<<BigInt(r*8))+BigInt(o):o).toString(16)}`;return r?cr(c,{size:r}):c}const d1=new TextEncoder;function Vr(e,t={}){const n=d1.encode(e);return Ce(n,t)}const p1=new TextEncoder;function lr(e,t={}){return typeof e=="number"||typeof e=="bigint"?m1(e,t):typeof e=="boolean"?h1(e,t):At(e)?Rt(e,t):Ln(e,t)}function h1(e,t={}){const n=new Uint8Array(1);return n[0]=Number(e),typeof t.size=="number"?(Nt(n,{size:t.size}),cr(n,{size:t.size})):n}const en={zero:48,nine:57,A:65,F:70,a:97,f:102};function vu(e){if(e>=en.zero&&e<=en.nine)return e-en.zero;if(e>=en.A&&e<=en.F)return e-(en.A-10);if(e>=en.a&&e<=en.f)return e-(en.a-10)}function Rt(e,t={}){let n=e;t.size&&(Nt(n,{size:t.size}),n=cr(n,{dir:"right",size:t.size}));let r=n.slice(2);r.length%2&&(r=`0${r}`);const o=r.length/2,s=new Uint8Array(o);for(let i=0,c=0;i<o;i++){const a=vu(r.charCodeAt(c++)),l=vu(r.charCodeAt(c++));if(a===void 0||l===void 0)throw new V(`Invalid byte sequence ("${r[c-2]}${r[c-1]}" in "${r}").`);s[i]=a*16+l}return s}function m1(e,t){const n=oe(e,t);return Rt(n)}function Ln(e,t={}){const n=p1.encode(e);return typeof t.size=="number"?(Nt(n,{size:t.size}),cr(n,{dir:"right",size:t.size})):n}const ss=BigInt(2**32-1),wu=BigInt(32);function b1(e,t=!1){return t?{h:Number(e&ss),l:Number(e>>wu&ss)}:{h:Number(e>>wu&ss)|0,l:Number(e&ss)|0}}function g1(e,t=!1){const n=e.length;let r=new Uint32Array(n),o=new Uint32Array(n);for(let s=0;s<n;s++){const{h:i,l:c}=b1(e[s],t);[r[s],o[s]]=[i,c]}return[r,o]}const y1=(e,t,n)=>e<<n|t>>>32-n,v1=(e,t,n)=>t<<n|e>>>32-n,w1=(e,t,n)=>t<<n-32|e>>>64-n,x1=(e,t,n)=>e<<n-32|t>>>64-n,ur=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0;/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */function E1(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array"}function Hr(e){if(!Number.isSafeInteger(e)||e<0)throw new Error("positive integer expected, got "+e)}function Fn(e,...t){if(!E1(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 S1(e){if(typeof e!="function"||typeof e.create!="function")throw new Error("Hash should be wrapped by utils.createHasher");Hr(e.outputLen),Hr(e.blockLen)}function fr(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 xu(e,t){Fn(e);const n=t.outputLen;if(e.length<n)throw new Error("digestInto() expects output buffer of length at least "+n)}function P1(e){return new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4))}function dr(...e){for(let t=0;t<e.length;t++)e[t].fill(0)}function Di(e){return new DataView(e.buffer,e.byteOffset,e.byteLength)}function jt(e,t){return e<<32-t|e>>>t}const T1=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;function A1(e){return e<<24&4278190080|e<<8&16711680|e>>>8&65280|e>>>24&255}function N1(e){for(let t=0;t<e.length;t++)e[t]=A1(e[t]);return e}const Eu=T1?e=>e:N1;function C1(e){if(typeof e!="string")throw new Error("string expected");return new Uint8Array(new TextEncoder().encode(e))}function is(e){return typeof e=="string"&&(e=C1(e)),Fn(e),e}function O1(...e){let t=0;for(let r=0;r<e.length;r++){const o=e[r];Fn(o),t+=o.length}const n=new Uint8Array(t);for(let r=0,o=0;r<e.length;r++){const s=e[r];n.set(s,o),o+=s.length}return n}class Mi{}function Su(e){const t=r=>e().update(is(r)).digest(),n=e();return t.outputLen=n.outputLen,t.blockLen=n.blockLen,t.create=()=>e(),t}function I1(e=32){if(ur&&typeof ur.getRandomValues=="function")return ur.getRandomValues(new Uint8Array(e));if(ur&&typeof ur.randomBytes=="function")return Uint8Array.from(ur.randomBytes(e));throw new Error("crypto.getRandomValues must be defined")}const $1=BigInt(0),Gr=BigInt(1),k1=BigInt(2),D1=BigInt(7),M1=BigInt(256),B1=BigInt(113),Pu=[],Tu=[],Au=[];for(let e=0,t=Gr,n=1,r=0;e<24;e++){[n,r]=[r,(2*n+3*r)%5],Pu.push(2*(5*r+n)),Tu.push((e+1)*(e+2)/2%64);let o=$1;for(let s=0;s<7;s++)t=(t<<Gr^(t>>D1)*B1)%M1,t&k1&&(o^=Gr<<(Gr<<BigInt(s))-Gr);Au.push(o)}const Nu=g1(Au,!0),L1=Nu[0],F1=Nu[1],Cu=(e,t,n)=>n>32?w1(e,t,n):y1(e,t,n),Ou=(e,t,n)=>n>32?x1(e,t,n):v1(e,t,n);function R1(e,t=24){const n=new Uint32Array(10);for(let r=24-t;r<24;r++){for(let i=0;i<10;i++)n[i]=e[i]^e[i+10]^e[i+20]^e[i+30]^e[i+40];for(let i=0;i<10;i+=2){const c=(i+8)%10,a=(i+2)%10,l=n[a],u=n[a+1],f=Cu(l,u,1)^n[c],p=Ou(l,u,1)^n[c+1];for(let d=0;d<50;d+=10)e[i+d]^=f,e[i+d+1]^=p}let o=e[2],s=e[3];for(let i=0;i<24;i++){const c=Tu[i],a=Cu(o,s,c),l=Ou(o,s,c),u=Pu[i];o=e[u],s=e[u+1],e[u]=a,e[u+1]=l}for(let i=0;i<50;i+=10){for(let c=0;c<10;c++)n[c]=e[i+c];for(let c=0;c<10;c++)e[i+c]^=~n[(c+2)%10]&n[(c+4)%10]}e[0]^=L1[r],e[1]^=F1[r]}dr(n)}class Bi extends Mi{constructor(t,n,r,o=!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=o,this.rounds=s,Hr(r),!(0<t&&t<200))throw new Error("only keccak-f1600 function is supported");this.state=new Uint8Array(200),this.state32=P1(this.state)}clone(){return this._cloneInto()}keccak(){Eu(this.state32),R1(this.state32,this.rounds),Eu(this.state32),this.posOut=0,this.pos=0}update(t){fr(this),t=is(t),Fn(t);const{blockLen:n,state:r}=this,o=t.length;for(let s=0;s<o;){const i=Math.min(n-this.pos,o-s);for(let c=0;c<i;c++)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:o}=this;t[r]^=n,n&128&&r===o-1&&this.keccak(),t[o-1]^=128,this.keccak()}writeInto(t){fr(this,!1),Fn(t),this.finish();const n=this.state,{blockLen:r}=this;for(let o=0,s=t.length;o<s;){this.posOut>=r&&this.keccak();const i=Math.min(r-this.posOut,s-o);t.set(n.subarray(this.posOut,this.posOut+i),o),this.posOut+=i,o+=i}return t}xofInto(t){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(t)}xof(t){return Hr(t),this.xofInto(new Uint8Array(t))}digestInto(t){if(xu(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,dr(this.state)}_cloneInto(t){const{blockLen:n,suffix:r,outputLen:o,rounds:s,enableXOF:i}=this;return t||(t=new Bi(n,r,o,i,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=o,t.enableXOF=i,t.destroyed=this.destroyed,t}}const j1=(e,t,n)=>Su(()=>new Bi(t,e,n)),Iu=j1(1,136,256/8);function Me(e,t){const n=t||"hex",r=Iu(At(e,{strict:!1})?lr(e):e);return n==="bytes"?r:vn(r)}const z1=e=>Me(lr(e));function U1(e){return z1(e)}function _1(e){let t=!0,n="",r=0,o="",s=!1;for(let i=0;i<e.length;i++){const c=e[i];if(["(",")",","].includes(c)&&(t=!0),c==="("&&r++,c===")"&&r--,!!t){if(r===0){if(c===" "&&["event","function",""].includes(o))o="";else if(o+=c,c===")"){s=!0;break}continue}if(c===" "){e[i-1]!==","&&n!==","&&n!==",("&&(n="",t=!1);continue}o+=c,n+=c}}if(!s)throw new V("Unable to normalize signature.");return o}const W1=e=>{const t=typeof e=="string"?e:ts(e);return _1(t)};function $u(e){return U1(W1(e))}const as=$u;let wn=class extends V{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"})}},cs=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)&&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 Li=new cs(8192);function ls(e,t){if(Li.has(`${e}.${t}`))return Li.get(`${e}.${t}`);const n=e.substring(2).toLowerCase(),r=Me(Ln(n),"bytes"),o=n.split("");for(let i=0;i<40;i+=2)r[i>>1]>>4>=8&&o[i]&&(o[i]=o[i].toUpperCase()),(r[i>>1]&15)>=8&&o[i+1]&&(o[i+1]=o[i+1].toUpperCase());const s=`0x${o.join("")}`;return Li.set(`${e}.${t}`,s),s}function xn(e,t){if(!dt(e,{strict:!1}))throw new wn({address:e});return ls(e,t)}const V1=/^0x[a-fA-F0-9]{40}$/,Fi=new cs(8192);function dt(e,t){const{strict:n=!0}=t??{},r=`${e}.${n}`;if(Fi.has(r))return Fi.get(r);const o=V1.test(e)?e.toLowerCase()===e?!0:n?ls(e)===e:!0:!1;return Fi.set(r,o),o}function Ct(e){return typeof e[0]=="string"?pr(e):H1(e)}function H1(e){let t=0;for(const o of e)t+=o.length;const n=new Uint8Array(t);let r=0;for(const o of e)n.set(o,r),r+=o.length;return n}function pr(e){return`0x${e.reduce((t,n)=>t+n.replace("0x",""),"")}`}function hr(e,t,n,{strict:r}={}){return At(e,{strict:!1})?G1(e,t,n,{strict:r}):Mu(e,t,n,{strict:r})}function ku(e,t){if(typeof t=="number"&&t>0&&t>Ee(e)-1)throw new hu({offset:t,position:"start",size:Ee(e)})}function Du(e,t,n){if(typeof t=="number"&&typeof n=="number"&&Ee(e)!==n-t)throw new hu({offset:n,position:"end",size:Ee(e)})}function Mu(e,t,n,{strict:r}={}){ku(e,t);const o=e.slice(t,n);return r&&Du(o,t,n),o}function G1(e,t,n,{strict:r}={}){ku(e,t);const o=`0x${e.replace("0x","").slice((t??0)*2,(n??e.length)*2)}`;return r&&Du(o,t,n),o}const q1=/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/,Bu=/^(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 En(e,t){if(e.length!==t.length)throw new Zb({expectedLength:e.length,givenLength:t.length});const n=K1({params:e,values:t}),r=ji(n);return r.length===0?"0x":r}function K1({params:e,values:t}){const n=[];for(let r=0;r<e.length;r++)n.push(Ri({param:e[r],value:t[r]}));return n}function Ri({param:e,value:t}){const n=zi(e.type);if(n){const[r,o]=n;return Y1(t,{length:r,param:{...e,type:o}})}if(e.type==="tuple")return tg(t,{param:e});if(e.type==="address")return Z1(t);if(e.type==="bool")return J1(t);if(e.type.startsWith("uint")||e.type.startsWith("int")){const r=e.type.startsWith("int"),[,,o="256"]=Bu.exec(e.type)??[];return Q1(t,{signed:r,size:Number(o)})}if(e.type.startsWith("bytes"))return X1(t,{param:e});if(e.type==="string")return eg(t);throw new n1(e.type,{docsPath:"/docs/contract/encodeAbiParameters"})}function ji(e){let t=0;for(let s=0;s<e.length;s++){const{dynamic:i,encoded:c}=e[s];i?t+=32:t+=Ee(c)}const n=[],r=[];let o=0;for(let s=0;s<e.length;s++){const{dynamic:i,encoded:c}=e[s];i?(n.push(oe(t+o,{size:32})),r.push(c),o+=Ee(c)):n.push(c)}return Ct([...n,...r])}function Z1(e){if(!dt(e))throw new wn({address:e});return{dynamic:!1,encoded:yn(e.toLowerCase())}}function Y1(e,{length:t,param:n}){const r=t===null;if(!Array.isArray(e))throw new pu(e);if(!r&&e.length!==t)throw new qb({expectedLength:t,givenLength:e.length,type:`${n.type}[${t}]`});let o=!1;const s=[];for(let i=0;i<e.length;i++){const c=Ri({param:n,value:e[i]});c.dynamic&&(o=!0),s.push(c)}if(r||o){const i=ji(s);if(r){const c=oe(s.length,{size:32});return{dynamic:!0,encoded:s.length>0?Ct([c,i]):c}}if(o)return{dynamic:!0,encoded:i}}return{dynamic:!1,encoded:Ct(s.map(({encoded:i})=>i))}}function X1(e,{param:t}){const[,n]=t.type.split("bytes"),r=Ee(e);if(!n){let o=e;return r%32!==0&&(o=yn(o,{dir:"right",size:Math.ceil((e.length-2)/2/32)*32})),{dynamic:!0,encoded:Ct([yn(oe(r,{size:32})),o])}}if(r!==Number.parseInt(n,10))throw new Kb({expectedSize:Number.parseInt(n,10),value:e});return{dynamic:!1,encoded:yn(e,{dir:"right"})}}function J1(e){if(typeof e!="boolean")throw new V(`Invalid boolean value: "${e}" (type: ${typeof e}). Expected: \`true\` or \`false\`.`);return{dynamic:!1,encoded:yn(yu(e))}}function Q1(e,{signed:t,size:n=256}){if(typeof n=="number"){const r=2n**(BigInt(n)-(t?1n:0n))-1n,o=t?-r-1n:0n;if(e>r||e<o)throw new gu({max:r.toString(),min:o.toString(),signed:t,size:n/8,value:e.toString()})}return{dynamic:!1,encoded:oe(e,{size:32,signed:t})}}function eg(e){const t=Vr(e),n=Math.ceil(Ee(t)/32),r=[];for(let o=0;o<n;o++)r.push(yn(hr(t,o*32,(o+1)*32),{dir:"right"}));return{dynamic:!0,encoded:Ct([yn(oe(Ee(t),{size:32})),...r])}}function tg(e,{param:t}){let n=!1;const r=[];for(let o=0;o<t.components.length;o++){const s=t.components[o],i=Array.isArray(e)?o:s.name,c=Ri({param:s,value:e[i]});r.push(c),c.dynamic&&(n=!0)}return{dynamic:n,encoded:n?ji(r):Ct(r.map(({encoded:o})=>o))}}function zi(e){const t=e.match(/^(.*)\[(\d+)?\]$/);return t?[t[2]?Number(t[2]):null,t[1]]:void 0}const qr=e=>hr($u(e),0,4);function Rn(e){const{abi:t,args:n=[],name:r}=e,o=At(r,{strict:!1}),s=t.filter(c=>o?c.type==="function"?qr(c)===r:c.type==="event"?as(c)===r:!1:"name"in c&&c.name===r);if(s.length===0)return;if(s.length===1)return s[0];let i;for(const c of s){if(!("inputs"in c))continue;if(!n||n.length===0){if(!c.inputs||c.inputs.length===0)return c;continue}if(!c.inputs||c.inputs.length===0||c.inputs.length!==n.length)continue;if(n.every((l,u)=>{const f="inputs"in c&&c.inputs[u];return f?Ui(l,f):!1})){if(i&&"inputs"in i&&i.inputs){const l=Lu(c.inputs,i.inputs,n);if(l)throw new e1({abiItem:c,type:l[0]},{abiItem:i,type:l[1]})}i=c}}return i||s[0]}function Ui(e,t){const n=typeof e,r=t.type;switch(r){case"address":return dt(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((o,s)=>Ui(Object.values(e)[s],o)):/^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(o=>Ui(o,{...t,type:r.replace(/(\[[0-9]{0,}\])$/,"")})):!1}}function Lu(e,t,n){for(const r in e){const o=e[r],s=t[r];if(o.type==="tuple"&&s.type==="tuple"&&"components"in o&&"components"in s)return Lu(o.components,s.components,n[r]);const i=[o.type,s.type];if(i.includes("address")&&i.includes("bytes20")?!0:i.includes("address")&&i.includes("string")?dt(n[r],{strict:!1}):i.includes("address")&&i.includes("bytes")?dt(n[r],{strict:!1}):!1)return i}}const Fu="/docs/contract/encodeEventTopics";function Kr(e){var a;const{abi:t,eventName:n,args:r}=e;let o=t[0];if(n){const l=Rn({abi:t,name:n});if(!l)throw new fu(n,{docsPath:Fu});o=l}if(o.type!=="event")throw new fu(void 0,{docsPath:Fu});const s=Tt(o),i=as(s);let c=[];if(r&&"inputs"in o){const l=(a=o.inputs)==null?void 0:a.filter(f=>"indexed"in f&&f.indexed),u=Array.isArray(r)?r:Object.values(r).length>0?(l==null?void 0:l.map(f=>r[f.name]))??[]:[];u.length>0&&(c=(l==null?void 0:l.map((f,p)=>Array.isArray(u[p])?u[p].map((d,h)=>Ru({param:f,value:u[p][h]})):typeof u[p]<"u"&&u[p]!==null?Ru({param:f,value:u[p]}):null))??[])}return[i,...c]}function Ru({param:e,value:t}){if(e.type==="string"||e.type==="bytes")return Me(lr(t));if(e.type==="tuple"||e.type.match(/^(.*)\[(\d+)?\]$/))throw new s1(e.type);return En([e],[t])}function us(e,{method:t}){var r,o;const n={};return e.transport.type==="fallback"&&((o=(r=e.transport).onResponse)==null||o.call(r,({method:s,response:i,status:c,transport:a})=>{c==="success"&&t===s&&(n[i]=a.request)})),s=>n[s]||e.request}async function ju(e,t){const{address:n,abi:r,args:o,eventName:s,fromBlock:i,strict:c,toBlock:a}=t,l=us(e,{method:"eth_newFilter"}),u=s?Kr({abi:r,args:o,eventName:s}):void 0,f=await e.request({method:"eth_newFilter",params:[{address:n,fromBlock:typeof i=="bigint"?oe(i):i,toBlock:typeof a=="bigint"?oe(a):a,topics:u}]});return{abi:r,args:o,eventName:s,id:f,request:l(f),strict:!!c,type:"event"}}function nt(e){return typeof e=="string"?{address:e,type:"json-rpc"}:e}const zu="/docs/contract/encodeFunctionData";function ng(e){const{abi:t,args:n,functionName:r}=e;let o=t[0];if(r){const s=Rn({abi:t,args:n,name:r});if(!s)throw new ar(r,{docsPath:zu});o=s}if(o.type!=="function")throw new ar(void 0,{docsPath:zu});return{abi:[o],functionName:qr(Tt(o))}}function Ot(e){const{args:t}=e,{abi:n,functionName:r}=(()=>{var c;return e.abi.length===1&&((c=e.functionName)!=null&&c.startsWith("0x"))?e:ng(e)})(),o=n[0],s=r,i="inputs"in o&&o.inputs?En(o.inputs,t??[]):void 0;return pr([s,i??"0x"])}const rg={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."},Uu={inputs:[{name:"message",type:"string"}],name:"Error",type:"error"},og={inputs:[{name:"reason",type:"uint256"}],name:"Panic",type:"error"};let _u=class extends V{constructor({offset:t}){super(`Offset \`${t}\` cannot be negative.`,{name:"NegativeOffsetError"})}},Wu=class extends V{constructor({length:t,position:n}){super(`Position \`${n}\` is out of bounds (\`0 < position < ${t}\`).`,{name:"PositionOutOfBoundsError"})}},sg=class extends V{constructor({count:t,limit:n}){super(`Recursive read limit of \`${n}\` exceeded (recursive read count: \`${t}\`).`,{name:"RecursiveReadLimitExceededError"})}};const ig={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 sg({count:this.recursiveReadCount+1,limit:this.recursiveReadLimit})},assertPosition(e){if(e<0||e>this.bytes.length-1)throw new Wu({length:this.bytes.length,position:e})},decrementPosition(e){if(e<0)throw new _u({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 _u({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 _i(e,{recursiveReadLimit:t=8192}={}){const n=Object.create(ig);return n.bytes=e,n.dataView=new DataView(e.buffer??e,e.byteOffset,e.byteLength),n.positionReadCount=new Map,n.recursiveReadLimit=t,n}function ag(e,t={}){typeof t.size<"u"&&Nt(e,{size:t.size});const n=Ce(e,t);return Ft(n,t)}function cg(e,t={}){let n=e;if(typeof t.size<"u"&&(Nt(n,{size:t.size}),n=Bn(n)),n.length>1||n[0]>1)throw new a1(n);return!!n[0]}function tn(e,t={}){typeof t.size<"u"&&Nt(e,{size:t.size});const n=Ce(e,t);return Qt(n,t)}function lg(e,t={}){let n=e;return typeof t.size<"u"&&(Nt(n,{size:t.size}),n=Bn(n,{dir:"right"})),new TextDecoder().decode(n)}function Zr(e,t){const n=typeof t=="string"?Rt(t):t,r=_i(n);if(Ee(n)===0&&e.length>0)throw new Wr;if(Ee(t)&&Ee(t)<32)throw new cu({data:typeof t=="string"?t:Ce(t),params:e,size:Ee(t)});let o=0;const s=[];for(let i=0;i<e.length;++i){const c=e[i];r.setPosition(o);const[a,l]=mr(r,c,{staticPosition:0});o+=l,s.push(a)}return s}function mr(e,t,{staticPosition:n}){const r=zi(t.type);if(r){const[o,s]=r;return fg(e,{...t,type:s},{length:o,staticPosition:n})}if(t.type==="tuple")return mg(e,t,{staticPosition:n});if(t.type==="address")return ug(e);if(t.type==="bool")return dg(e);if(t.type.startsWith("bytes"))return pg(e,t,{staticPosition:n});if(t.type.startsWith("uint")||t.type.startsWith("int"))return hg(e,t);if(t.type==="string")return bg(e,{staticPosition:n});throw new r1(t.type,{docsPath:"/docs/contract/decodeAbiParameters"})}const Vu=32,Wi=32;function ug(e){const t=e.readBytes(32);return[ls(Ce(Mu(t,-20))),32]}function fg(e,t,{length:n,staticPosition:r}){if(!n){const i=tn(e.readBytes(Wi)),c=r+i,a=c+Vu;e.setPosition(c);const l=tn(e.readBytes(Vu)),u=Yr(t);let f=0;const p=[];for(let d=0;d<l;++d){e.setPosition(a+(u?d*32:f));const[h,m]=mr(e,t,{staticPosition:a});f+=m,p.push(h)}return e.setPosition(r+32),[p,32]}if(Yr(t)){const i=tn(e.readBytes(Wi)),c=r+i,a=[];for(let l=0;l<n;++l){e.setPosition(c+l*32);const[u]=mr(e,t,{staticPosition:c});a.push(u)}return e.setPosition(r+32),[a,32]}let o=0;const s=[];for(let i=0;i<n;++i){const[c,a]=mr(e,t,{staticPosition:r+o});o+=a,s.push(c)}return[s,o]}function dg(e){return[cg(e.readBytes(32),{size:32}),32]}function pg(e,t,{staticPosition:n}){const[r,o]=t.type.split("bytes");if(!o){const i=tn(e.readBytes(32));e.setPosition(n+i);const c=tn(e.readBytes(32));if(c===0)return e.setPosition(n+32),["0x",32];const a=e.readBytes(c);return e.setPosition(n+32),[Ce(a),32]}return[Ce(e.readBytes(Number.parseInt(o,10),32)),32]}function hg(e,t){const n=t.type.startsWith("int"),r=Number.parseInt(t.type.split("int")[1]||"256",10),o=e.readBytes(32);return[r>48?ag(o,{signed:n}):tn(o,{signed:n}),32]}function mg(e,t,{staticPosition:n}){const r=t.components.length===0||t.components.some(({name:i})=>!i),o=r?[]:{};let s=0;if(Yr(t)){const i=tn(e.readBytes(Wi)),c=n+i;for(let a=0;a<t.components.length;++a){const l=t.components[a];e.setPosition(c+s);const[u,f]=mr(e,l,{staticPosition:c});s+=f,o[r?a:l==null?void 0:l.name]=u}return e.setPosition(n+32),[o,32]}for(let i=0;i<t.components.length;++i){const c=t.components[i],[a,l]=mr(e,c,{staticPosition:n});o[r?i:c==null?void 0:c.name]=a,s+=l}return[o,s]}function bg(e,{staticPosition:t}){const n=tn(e.readBytes(32)),r=t+n;e.setPosition(r);const o=tn(e.readBytes(32));if(o===0)return e.setPosition(t+32),["",32];const s=e.readBytes(o,32),i=lg(Bn(s));return e.setPosition(t+32),[i,32]}function Yr(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(Yr);const n=zi(e.type);return!!(n&&Yr({...e,type:n[1]}))}function Hu(e){const{abi:t,data:n}=e,r=hr(n,0,4);if(r==="0x")throw new Wr;const s=[...t||[],Uu,og].find(i=>i.type==="error"&&r===qr(Tt(i)));if(!s)throw new uu(r,{docsPath:"/docs/contract/decodeErrorResult"});return{abiItem:s,args:"inputs"in s&&s.inputs&&s.inputs.length>0?Zr(s.inputs,hr(n,4)):void 0,errorName:s.name}}const Oe=(e,t,n)=>JSON.stringify(e,(r,o)=>typeof o=="bigint"?o.toString():o,n);function Gu({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((o,s)=>`${r&&o.name?`${o.name}: `:""}${typeof t[s]=="object"?Oe(t[s]):t[s]}`).join(", ")})`}const gg={gwei:9,wei:18},yg={ether:-9,wei:9};function Vi(e,t){let n=e.toString();const r=n.startsWith("-");r&&(n=n.slice(1)),n=n.padStart(t,"0");let[o,s]=[n.slice(0,n.length-t),n.slice(n.length-t)];return s=s.replace(/(0+)$/,""),`${r?"-":""}${o||"0"}${s?`.${s}`:""}`}function Hi(e,t="wei"){return Vi(e,gg[t])}function Ve(e,t="wei"){return Vi(e,yg[t])}class vg extends V{constructor({address:t}){super(`State for account "${t}" is set multiple times.`,{name:"AccountStateConflictError"})}}class wg extends V{constructor(){super("state and stateDiff are set on the same account.",{name:"StateAssignmentConflictError"})}}function qu(e){return e.reduce((t,{slot:n,value:r})=>`${t} ${n}: ${r}
|
|
72
|
+
`,"")}function xg(e){return e.reduce((t,{address:n,...r})=>{let o=`${t} ${n}:
|
|
63
73
|
`;return r.nonce&&(o+=` nonce: ${r.nonce}
|
|
64
74
|
`),r.balance&&(o+=` balance: ${r.balance}
|
|
65
75
|
`),r.code&&(o+=` code: ${r.code}
|
|
66
76
|
`),r.state&&(o+=` state:
|
|
67
|
-
`,o+=
|
|
68
|
-
`,o+=
|
|
69
|
-
`).slice(0,-1)}function
|
|
70
|
-
`)}class
|
|
71
|
-
|
|
72
|
-
${
|
|
73
|
-
`)
|
|
74
|
-
`)})}}Object.defineProperty(qr,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32602});class Nn extends je{constructor(t){super(t,{code:Nn.code,name:"InternalRpcError",shortMessage:"An internal error was received."})}}Object.defineProperty(Nn,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32603});class In extends je{constructor(t){super(t,{code:In.code,name:"InvalidInputRpcError",shortMessage:["Missing or invalid parameters.","Double check you have provided the correct parameters."].join(`
|
|
75
|
-
`)})}}Object.defineProperty(In,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32e3});class Zr extends je{constructor(t){super(t,{code:Zr.code,name:"ResourceNotFoundRpcError",shortMessage:"Requested resource not found."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ResourceNotFoundRpcError"})}}Object.defineProperty(Zr,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32001});class Kr extends je{constructor(t){super(t,{code:Kr.code,name:"ResourceUnavailableRpcError",shortMessage:"Requested resource not available."})}}Object.defineProperty(Kr,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32002});class Yr extends je{constructor(t){super(t,{code:Yr.code,name:"TransactionRejectedRpcError",shortMessage:"Transaction creation failed."})}}Object.defineProperty(Yr,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32003});class Mn extends je{constructor(t,{method:n}={}){super(t,{code:Mn.code,name:"MethodNotSupportedRpcError",shortMessage:`Method${n?` "${n}"`:""} is not supported.`})}}Object.defineProperty(Mn,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32004});class ir extends je{constructor(t){super(t,{code:ir.code,name:"LimitExceededRpcError",shortMessage:"Request exceeds defined limit."})}}Object.defineProperty(ir,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32005});class Xr extends je{constructor(t){super(t,{code:Xr.code,name:"JsonRpcVersionUnsupportedError",shortMessage:"Version of JSON-RPC protocol is not supported."})}}Object.defineProperty(Xr,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32006});class ar extends Ke{constructor(t){super(t,{code:ar.code,name:"UserRejectedRequestError",shortMessage:"User rejected the request."})}}Object.defineProperty(ar,"code",{enumerable:!0,configurable:!0,writable:!0,value:4001});class Qr extends Ke{constructor(t){super(t,{code:Qr.code,name:"UnauthorizedProviderError",shortMessage:"The requested method and/or account has not been authorized by the user."})}}Object.defineProperty(Qr,"code",{enumerable:!0,configurable:!0,writable:!0,value:4100});class Jr extends Ke{constructor(t,{method:n}={}){super(t,{code:Jr.code,name:"UnsupportedProviderMethodError",shortMessage:`The Provider does not support the requested method${n?` " ${n}"`:""}.`})}}Object.defineProperty(Jr,"code",{enumerable:!0,configurable:!0,writable:!0,value:4200});class eo extends Ke{constructor(t){super(t,{code:eo.code,name:"ProviderDisconnectedError",shortMessage:"The Provider is disconnected from all chains."})}}Object.defineProperty(eo,"code",{enumerable:!0,configurable:!0,writable:!0,value:4900});class to extends Ke{constructor(t){super(t,{code:to.code,name:"ChainDisconnectedError",shortMessage:"The Provider is not connected to the requested chain."})}}Object.defineProperty(to,"code",{enumerable:!0,configurable:!0,writable:!0,value:4901});class no extends Ke{constructor(t){super(t,{code:no.code,name:"SwitchChainError",shortMessage:"An error occurred when attempting to switch chain."})}}Object.defineProperty(no,"code",{enumerable:!0,configurable:!0,writable:!0,value:4902});class ro extends Ke{constructor(t){super(t,{code:ro.code,name:"UnsupportedNonOptionalCapabilityError",shortMessage:"This Wallet does not support a capability that was not marked as optional."})}}Object.defineProperty(ro,"code",{enumerable:!0,configurable:!0,writable:!0,value:5700});class oo extends Ke{constructor(t){super(t,{code:oo.code,name:"UnsupportedChainIdError",shortMessage:"This Wallet does not support the requested chain ID."})}}Object.defineProperty(oo,"code",{enumerable:!0,configurable:!0,writable:!0,value:5710});class so extends Ke{constructor(t){super(t,{code:so.code,name:"DuplicateIdError",shortMessage:"There is already a bundle submitted with this ID."})}}Object.defineProperty(so,"code",{enumerable:!0,configurable:!0,writable:!0,value:5720});class io extends Ke{constructor(t){super(t,{code:io.code,name:"UnknownBundleIdError",shortMessage:"This bundle id is unknown / has not been submitted"})}}Object.defineProperty(io,"code",{enumerable:!0,configurable:!0,writable:!0,value:5730});class ao extends Ke{constructor(t){super(t,{code:ao.code,name:"BundleTooLargeError",shortMessage:"The call bundle is too large for the Wallet to process."})}}Object.defineProperty(ao,"code",{enumerable:!0,configurable:!0,writable:!0,value:5740});class co extends Ke{constructor(t){super(t,{code:co.code,name:"AtomicReadyWalletRejectedUpgradeError",shortMessage:"The Wallet can support atomicity after an upgrade, but the user rejected the upgrade."})}}Object.defineProperty(co,"code",{enumerable:!0,configurable:!0,writable:!0,value:5750});class uo extends Ke{constructor(t){super(t,{code:uo.code,name:"AtomicityNotSupportedError",shortMessage:"The wallet does not support atomic execution but the request requires it."})}}Object.defineProperty(uo,"code",{enumerable:!0,configurable:!0,writable:!0,value:5760});class Ib extends je{constructor(t){super(t,{name:"UnknownRpcError",shortMessage:"An unknown RPC error occurred."})}}const Mb=3;function cr(e,{abi:t,address:n,args:r,docsPath:o,functionName:s,sender:i}){const c=e instanceof Ko?e:e instanceof G?e.walk(h=>"data"in h)||e.walk():{},{code:a,data:u,details:l,message:f,shortMessage:p}=c,d=e instanceof Br?new Ob({functionName:s}):[Mb,Nn.code].includes(a)&&(u||l||f||p)?new Si({abi:t,data:typeof u=="object"?u.data:u,functionName:s,message:c instanceof Pi?l:p??f}):e;return new Ab(d,{abi:t,args:r,contractAddress:n,docsPath:o,functionName:s,sender:i})}function kb(e){const t=Ie(`0x${e.substring(4)}`).substring(26);return Go(`0x${t}`)}async function Bb({hash:e,signature:t}){const n=bt(e)?e:Vt(e),{secp256k1:r}=await Promise.resolve().then(()=>$v);return`0x${(()=>{if(typeof t=="object"&&"r"in t&&"s"in t){const{r:u,s:l,v:f,yParity:p}=t,d=Number(p??f),h=Il(d);return new r.Signature(Ot(u),Ot(l)).addRecoveryBit(h)}const i=bt(t)?t:Vt(t);if(xe(i)!==65)throw new Error("invalid signature length");const c=Wt(`0x${i.slice(130)}`),a=Il(c);return r.Signature.fromCompact(i.substring(2,130)).addRecoveryBit(a)})().recoverPublicKey(n.substring(2)).toHex(!1)}`}function Il(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 Ml({hash:e,signature:t}){return kb(await Bb({hash:e,signature:t}))}function Lb(e,t="hex"){const n=kl(e),r=vi(new Uint8Array(n.length));return n.encode(r),t==="hex"?$e(r.bytes):r.bytes}function kl(e){return Array.isArray(e)?Fb(e.map(t=>kl(t))):Db(e)}function Fb(e){const t=e.reduce((o,s)=>o+s.length,0),n=Bl(t);return{length:t<=55?1+t:1+n+t,encode(o){t<=55?o.pushByte(192+t):(o.pushByte(247+n),n===1?o.pushUint8(t):n===2?o.pushUint16(t):n===3?o.pushUint24(t):o.pushUint32(t));for(const{encode:s}of e)s(o)}}}function Db(e){const t=typeof e=="string"?wt(e):e,n=Bl(t.length);return{length:t.length===1&&t[0]<128?1:t.length<=55?1+t.length:1+n+t.length,encode(o){t.length===1&&t[0]<128?o.pushBytes(t):t.length<=55?(o.pushByte(128+t.length),o.pushBytes(t)):(o.pushByte(183+n),n===1?o.pushUint8(t.length):n===2?o.pushUint16(t.length):n===3?o.pushUint24(t.length):o.pushUint32(t.length),o.pushBytes(t))}}}function Bl(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 G("Length is too large.")}function Rb(e){const{chainId:t,nonce:n,to:r}=e,o=e.contractAddress??e.address,s=Ie(rr(["0x05",Lb([t?J(t):"0x",o,n?J(n):"0x"])]));return r==="bytes"?wt(s):s}async function jb(e){const{authorization:t,signature:n}=e;return Ml({hash:Rb(t),signature:n??t})}class _b extends G{constructor(t,{account:n,docsPath:r,chain:o,data:s,gas:i,gasPrice:c,maxFeePerGas:a,maxPriorityFeePerGas:u,nonce:l,to:f,value:p}){var h;const d=Zo({from:n==null?void 0:n.address,to:f,value:typeof p<"u"&&`${$l(p)} ${((h=o==null?void 0:o.nativeCurrency)==null?void 0:h.symbol)||"ETH"}`,data:s,gas:i,gasPrice:typeof c<"u"&&`${Et(c)} gwei`,maxFeePerGas:typeof a<"u"&&`${Et(a)} gwei`,maxPriorityFeePerGas:typeof u<"u"&&`${Et(u)} gwei`,nonce:l});super(t.shortMessage,{cause:t,docsPath:r,metaMessages:[...t.metaMessages?[...t.metaMessages," "]:[],"Estimate Gas Arguments:",d].filter(Boolean),name:"EstimateGasExecutionError"}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.cause=t}}class ur extends G{constructor({cause:t,message:n}={}){var o;const r=(o=n==null?void 0:n.replace("execution reverted: ",""))==null?void 0:o.replace("execution reverted","");super(`Execution reverted ${r?`with reason: ${r}`:"for an unknown reason"}.`,{cause:t,name:"ExecutionRevertedError"})}}Object.defineProperty(ur,"code",{enumerable:!0,configurable:!0,writable:!0,value:3}),Object.defineProperty(ur,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/execution reverted/});class Yo extends G{constructor({cause:t,maxFeePerGas:n}={}){super(`The fee cap (\`maxFeePerGas\`${n?` = ${Et(n)} gwei`:""}) cannot be higher than the maximum allowed value (2^256-1).`,{cause:t,name:"FeeCapTooHighError"})}}Object.defineProperty(Yo,"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 $i extends G{constructor({cause:t,maxFeePerGas:n}={}){super(`The fee cap (\`maxFeePerGas\`${n?` = ${Et(n)}`:""} gwei) cannot be lower than the block base fee.`,{cause:t,name:"FeeCapTooLowError"})}}Object.defineProperty($i,"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 Ti extends G{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(Ti,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/nonce too high/});class Ai extends G{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(`
|
|
76
|
-
`),{cause:t,name:"
|
|
77
|
-
`),{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(Ci,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/insufficient funds|exceeds transaction sender account balance/});class Ni extends G{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(Ni,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/intrinsic gas too high|gas limit reached/});class Ii extends G{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(Ii,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/intrinsic gas too low/});class Mi extends G{constructor({cause:t}){super("The transaction type is not supported for this chain.",{cause:t,name:"TransactionTypeNotSupportedError"})}}Object.defineProperty(Mi,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/transaction type not valid/});class Xo extends G{constructor({cause:t,maxPriorityFeePerGas:n,maxFeePerGas:r}={}){super([`The provided tip (\`maxPriorityFeePerGas\`${n?` = ${Et(n)} gwei`:""}) cannot be higher than the fee cap (\`maxFeePerGas\`${r?` = ${Et(r)} gwei`:""}).`].join(`
|
|
78
|
-
`),{cause:t,name:"TipAboveFeeCapError"})}}Object.defineProperty(Xo,"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 Qo extends G{constructor({cause:t}){super(`An error occurred while executing: ${t==null?void 0:t.shortMessage}`,{cause:t,name:"UnknownNodeError"})}}function ki(e,t){const n=(e.details||"").toLowerCase(),r=e instanceof G?e.walk(o=>(o==null?void 0:o.code)===ur.code):e;return r instanceof G?new ur({cause:e,message:r.details}):ur.nodeMessage.test(n)?new ur({cause:e,message:e.details}):Yo.nodeMessage.test(n)?new Yo({cause:e,maxFeePerGas:t==null?void 0:t.maxFeePerGas}):$i.nodeMessage.test(n)?new $i({cause:e,maxFeePerGas:t==null?void 0:t.maxFeePerGas}):Ti.nodeMessage.test(n)?new Ti({cause:e,nonce:t==null?void 0:t.nonce}):Ai.nodeMessage.test(n)?new Ai({cause:e,nonce:t==null?void 0:t.nonce}):Oi.nodeMessage.test(n)?new Oi({cause:e,nonce:t==null?void 0:t.nonce}):Ci.nodeMessage.test(n)?new Ci({cause:e}):Ni.nodeMessage.test(n)?new Ni({cause:e,gas:t==null?void 0:t.gas}):Ii.nodeMessage.test(n)?new Ii({cause:e,gas:t==null?void 0:t.gas}):Mi.nodeMessage.test(n)?new Mi({cause:e}):Xo.nodeMessage.test(n)?new Xo({cause:e,maxFeePerGas:t==null?void 0:t.maxFeePerGas,maxPriorityFeePerGas:t==null?void 0:t.maxPriorityFeePerGas}):new Qo({cause:e})}function Ub(e,{docsPath:t,...n}){const r=(()=>{const o=ki(e,n);return o instanceof Qo?e:o})();return new _b(r,{docsPath:t,...n})}function Bi(e,{format:t}){if(!t)return{};const n={};function r(s){const i=Object.keys(s);for(const c of i)c in e&&(n[c]=e[c]),s[c]&&typeof s[c]=="object"&&!Array.isArray(s[c])&&r(s[c])}const o=t(e||{});return r(o),n}const zb={legacy:"0x0",eip2930:"0x1",eip1559:"0x2",eip4844:"0x3",eip7702:"0x4"};function Jo(e){const t={};return typeof e.authorizationList<"u"&&(t.authorizationList=Hb(e.authorizationList)),typeof e.accessList<"u"&&(t.accessList=e.accessList),typeof e.blobVersionedHashes<"u"&&(t.blobVersionedHashes=e.blobVersionedHashes),typeof e.blobs<"u"&&(typeof e.blobs[0]!="string"?t.blobs=e.blobs.map(n=>$e(n)):t.blobs=e.blobs),typeof e.data<"u"&&(t.data=e.data),typeof e.from<"u"&&(t.from=e.from),typeof e.gas<"u"&&(t.gas=J(e.gas)),typeof e.gasPrice<"u"&&(t.gasPrice=J(e.gasPrice)),typeof e.maxFeePerBlobGas<"u"&&(t.maxFeePerBlobGas=J(e.maxFeePerBlobGas)),typeof e.maxFeePerGas<"u"&&(t.maxFeePerGas=J(e.maxFeePerGas)),typeof e.maxPriorityFeePerGas<"u"&&(t.maxPriorityFeePerGas=J(e.maxPriorityFeePerGas)),typeof e.nonce<"u"&&(t.nonce=J(e.nonce)),typeof e.to<"u"&&(t.to=e.to),typeof e.type<"u"&&(t.type=zb[e.type]),typeof e.value<"u"&&(t.value=J(e.value)),t}function Hb(e){return e.map(t=>({address:t.address,r:t.r?J(BigInt(t.r)):t.r,s:t.s?J(BigInt(t.s)):t.s,chainId:J(t.chainId),nonce:J(t.nonce),...typeof t.yParity<"u"?{yParity:J(t.yParity)}:{},...typeof t.v<"u"&&typeof t.yParity>"u"?{v:J(t.v)}:{}}))}function Ll(e){if(!(!e||e.length===0))return e.reduce((t,{slot:n,value:r})=>{if(n.length!==66)throw new zu({size:n.length,targetSize:66,type:"hex"});if(r.length!==66)throw new zu({size:r.length,targetSize:66,type:"hex"});return t[n]=r,t},{})}function Wb(e){const{balance:t,nonce:n,state:r,stateDiff:o,code:s}=e,i={};if(s!==void 0&&(i.code=s),t!==void 0&&(i.balance=J(t)),n!==void 0&&(i.nonce=J(n)),r!==void 0&&(i.state=Ll(r)),o!==void 0){if(i.state)throw new xb;i.stateDiff=Ll(o)}return i}function Li(e){if(!e)return;const t={};for(const{address:n,...r}of e){if(!et(n,{strict:!1}))throw new pn({address:n});if(t[n])throw new vb({address:n});t[n]=Wb(r)}return t}const Fl=2n**256n-1n;function lo(e){const{account:t,gasPrice:n,maxFeePerGas:r,maxPriorityFeePerGas:o,to:s}=e,i=t?xt(t):void 0;if(i&&!et(i.address))throw new pn({address:i.address});if(s&&!et(s))throw new pn({address:s});if(typeof n<"u"&&(typeof r<"u"||typeof o<"u"))throw new Sb;if(r&&r>Fl)throw new Yo({maxFeePerGas:r});if(o&&r&&o>r)throw new Xo({maxFeePerGas:r,maxPriorityFeePerGas:o})}class Vb extends G{constructor(){super("`baseFeeMultiplier` must be greater than 1.",{name:"BaseFeeScalarError"})}}class Fi extends G{constructor(){super("Chain does not support EIP-1559 fees.",{name:"Eip1559FeesNotSupportedError"})}}class Gb extends G{constructor({maxPriorityFeePerGas:t}){super(`\`maxFeePerGas\` cannot be less than the \`maxPriorityFeePerGas\` (${Et(t)} gwei).`,{name:"MaxFeePerGasTooLowError"})}}class Dl extends G{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 Rl={"0x0":"legacy","0x1":"eip2930","0x2":"eip1559","0x3":"eip4844","0x4":"eip7702"};function jl(e){const t={...e,blockHash:e.blockHash?e.blockHash:null,blockNumber:e.blockNumber?BigInt(e.blockNumber):null,chainId:e.chainId?Wt(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?Wt(e.nonce):void 0,to:e.to?e.to:null,transactionIndex:e.transactionIndex?Number(e.transactionIndex):null,type:e.type?Rl[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&&(t.authorizationList=qb(e.authorizationList)),t.yParity=(()=>{if(e.yParity)return Number(e.yParity);if(typeof t.v=="bigint"){if(t.v===0n||t.v===27n)return 0;if(t.v===1n||t.v===28n)return 1;if(t.v>=35n)return t.v%2n===0n?1:0}})(),t.type==="legacy"&&(delete t.accessList,delete t.maxFeePerBlobGas,delete t.maxFeePerGas,delete t.maxPriorityFeePerGas,delete t.yParity),t.type==="eip2930"&&(delete t.maxFeePerBlobGas,delete t.maxFeePerGas,delete t.maxPriorityFeePerGas),t.type==="eip1559"&&delete t.maxFeePerBlobGas,t}function qb(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 _l(e){const t=(e.transactions??[]).map(n=>typeof n=="string"?n:jl(n));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:t,totalDifficulty:e.totalDifficulty?BigInt(e.totalDifficulty):null}}async function It(e,{blockHash:t,blockNumber:n,blockTag:r=e.experimental_blockTag??"latest",includeTransactions:o}={}){var u,l,f;const s=o??!1,i=n!==void 0?J(n):void 0;let c=null;if(t?c=await e.request({method:"eth_getBlockByHash",params:[t,s]},{dedupe:!0}):c=await e.request({method:"eth_getBlockByNumber",params:[i||r,s]},{dedupe:!!i}),!c)throw new Dl({blockHash:t,blockNumber:n});return(((f=(l=(u=e.chain)==null?void 0:u.formatters)==null?void 0:l.block)==null?void 0:f.format)||_l)(c)}async function Di(e){const t=await e.request({method:"eth_gasPrice"});return BigInt(t)}async function Zb(e,t){return Ul(e,t)}async function Ul(e,t){var s,i;const{block:n,chain:r=e.chain,request:o}=t||{};try{const c=((s=r==null?void 0:r.fees)==null?void 0:s.maxPriorityFeePerGas)??((i=r==null?void 0:r.fees)==null?void 0:i.defaultPriorityFee);if(typeof c=="function"){const u=n||await ee(e,It,"getBlock")({}),l=await c({block:u,client:e,request:o});if(l===null)throw new Error;return l}if(typeof c<"u")return c;const a=await e.request({method:"eth_maxPriorityFeePerGas"});return Ot(a)}catch{const[c,a]=await Promise.all([n?Promise.resolve(n):ee(e,It,"getBlock")({}),ee(e,Di,"getGasPrice")({})]);if(typeof c.baseFeePerGas!="bigint")throw new Fi;const u=a-c.baseFeePerGas;return u<0n?0n:u}}async function Kb(e,t){return Ri(e,t)}async function Ri(e,t){var p,d;const{block:n,chain:r=e.chain,request:o,type:s="eip1559"}=t||{},i=await(async()=>{var h,m;return typeof((h=r==null?void 0:r.fees)==null?void 0:h.baseFeeMultiplier)=="function"?r.fees.baseFeeMultiplier({block:n,client:e,request:o}):((m=r==null?void 0:r.fees)==null?void 0:m.baseFeeMultiplier)??1.2})();if(i<1)throw new Vb;const a=10**(((p=i.toString().split(".")[1])==null?void 0:p.length)??0),u=h=>h*BigInt(Math.ceil(i*a))/BigInt(a),l=n||await ee(e,It,"getBlock")({});if(typeof((d=r==null?void 0:r.fees)==null?void 0:d.estimateFeesPerGas)=="function"){const h=await r.fees.estimateFeesPerGas({block:n,client:e,multiply:u,request:o,type:s});if(h!==null)return h}if(s==="eip1559"){if(typeof l.baseFeePerGas!="bigint")throw new Fi;const h=typeof(o==null?void 0:o.maxPriorityFeePerGas)=="bigint"?o.maxPriorityFeePerGas:await Ul(e,{block:l,chain:r,request:o}),m=u(l.baseFeePerGas);return{maxFeePerGas:(o==null?void 0:o.maxFeePerGas)??m+h,maxPriorityFeePerGas:h}}return{gasPrice:(o==null?void 0:o.gasPrice)??u(await ee(e,Di,"getGasPrice")({}))}}async function zl(e,{address:t,blockTag:n="latest",blockNumber:r}){const o=await e.request({method:"eth_getTransactionCount",params:[t,typeof r=="bigint"?J(r):n]},{dedupe:!!r});return Wt(o)}function Hl(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=>wt(s)):e.blobs,o=[];for(const s of r)o.push(Uint8Array.from(t.blobToKzgCommitment(s)));return n==="bytes"?o:o.map(s=>$e(s))}function Wl(e){const{kzg:t}=e,n=e.to??(typeof e.blobs[0]=="string"?"hex":"bytes"),r=typeof e.blobs[0]=="string"?e.blobs.map(i=>wt(i)):e.blobs,o=typeof e.commitments[0]=="string"?e.commitments.map(i=>wt(i)):e.commitments,s=[];for(let i=0;i<r.length;i++){const c=r[i],a=o[i];s.push(Uint8Array.from(t.computeBlobKzgProof(c,a)))}return n==="bytes"?s:s.map(i=>$e(i))}function Yb(e,t,n,r){if(typeof e.setBigUint64=="function")return e.setBigUint64(t,n,r);const o=BigInt(32),s=BigInt(4294967295),i=Number(n>>o&s),c=Number(n&s),a=r?4:0,u=r?0:4;e.setUint32(t+a,i,r),e.setUint32(t+u,c,r)}function Xb(e,t,n){return e&t^~e&n}function Qb(e,t,n){return e&t^e&n^t&n}class Jb extends fi{constructor(t,n,r,o){super(),this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.blockLen=t,this.outputLen=n,this.padOffset=r,this.isLE=o,this.buffer=new Uint8Array(t),this.view=li(this.buffer)}update(t){er(this),t=Wo(t),qt(t);const{view:n,buffer:r,blockLen:o}=this,s=t.length;for(let i=0;i<s;){const c=Math.min(o-this.pos,s-i);if(c===o){const a=li(t);for(;o<=s-i;i+=o)this.process(a,i);continue}r.set(t.subarray(i,i+c),this.pos),this.pos+=c,i+=c,this.pos===o&&(this.process(n,0),this.pos=0)}return this.length+=t.length,this.roundClean(),this}digestInto(t){er(this),Zu(t,this),this.finished=!0;const{buffer:n,view:r,blockLen:o,isLE:s}=this;let{pos:i}=this;n[i++]=128,tr(this.buffer.subarray(i)),this.padOffset>o-i&&(this.process(r,0),i=0);for(let f=i;f<o;f++)n[f]=0;Yb(r,o-8,BigInt(this.length*8),s),this.process(r,0);const c=li(t),a=this.outputLen;if(a%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const u=a/4,l=this.get();if(u>l.length)throw new Error("_sha2: outputLen bigger than state");for(let f=0;f<u;f++)c.setUint32(4*f,l[f],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:o,finished:s,destroyed:i,pos:c}=this;return t.destroyed=i,t.finished=s,t.length=o,t.pos=c,o%n&&t.buffer.set(r),t}clone(){return this._cloneInto()}}const hn=Uint32Array.from([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),ey=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]),mn=new Uint32Array(64);class ty extends Jb{constructor(t=32){super(64,t,8,!1),this.A=hn[0]|0,this.B=hn[1]|0,this.C=hn[2]|0,this.D=hn[3]|0,this.E=hn[4]|0,this.F=hn[5]|0,this.G=hn[6]|0,this.H=hn[7]|0}get(){const{A:t,B:n,C:r,D:o,E:s,F:i,G:c,H:a}=this;return[t,n,r,o,s,i,c,a]}set(t,n,r,o,s,i,c,a){this.A=t|0,this.B=n|0,this.C=r|0,this.D=o|0,this.E=s|0,this.F=i|0,this.G=c|0,this.H=a|0}process(t,n){for(let f=0;f<16;f++,n+=4)mn[f]=t.getUint32(n,!1);for(let f=16;f<64;f++){const p=mn[f-15],d=mn[f-2],h=Ct(p,7)^Ct(p,18)^p>>>3,m=Ct(d,17)^Ct(d,19)^d>>>10;mn[f]=m+mn[f-7]+h+mn[f-16]|0}let{A:r,B:o,C:s,D:i,E:c,F:a,G:u,H:l}=this;for(let f=0;f<64;f++){const p=Ct(c,6)^Ct(c,11)^Ct(c,25),d=l+p+Xb(c,a,u)+ey[f]+mn[f]|0,m=(Ct(r,2)^Ct(r,13)^Ct(r,22))+Qb(r,o,s)|0;l=u,u=a,a=c,c=i+d|0,i=s,s=o,o=r,r=d+m|0}r=r+this.A|0,o=o+this.B|0,s=s+this.C|0,i=i+this.D|0,c=c+this.E|0,a=a+this.F|0,u=u+this.G|0,l=l+this.H|0,this.set(r,o,s,i,c,a,u,l)}roundClean(){tr(mn)}destroy(){this.set(0,0,0,0,0,0,0,0),tr(this.buffer)}}const Vl=Qu(()=>new ty),ny=Vl;function ry(e,t){return ny(bt(e,{strict:!1})?Qn(e):e)}function oy(e){const{commitment:t,version:n=1}=e,r=e.to??(typeof t=="string"?"hex":"bytes"),o=ry(t);return o.set([n],0),r==="bytes"?o:$e(o)}function sy(e){const{commitments:t,version:n}=e,r=e.to,o=[];for(const s of t)o.push(oy({commitment:s,to:r,version:n}));return o}const Gl=6,ql=32,ji=4096,Zl=ql*ji,Kl=Zl*Gl-1-1*ji*Gl;class iy extends G{constructor({maxSize:t,size:n}){super("Blob size is too large.",{metaMessages:[`Max: ${t} bytes`,`Given: ${n} bytes`],name:"BlobSizeTooLargeError"})}}class ay extends G{constructor(){super("Blob data must not be empty.",{name:"EmptyBlobError"})}}function cy(e){const t=typeof e.data=="string"?wt(e.data):e.data,n=xe(t);if(!n)throw new ay;if(n>Kl)throw new iy({maxSize:Kl,size:n});const r=[];let o=!0,s=0;for(;o;){const i=vi(new Uint8Array(Zl));let c=0;for(;c<ji;){const a=t.slice(s,s+(ql-1));if(i.pushByte(0),i.pushBytes(a),a.length<31){i.pushByte(128),o=!1;break}c++,s+=31}r.push(i)}return r.map(i=>$e(i.bytes))}function uy(e){const{data:t,kzg:n,to:r}=e,o=e.blobs??cy({data:t}),s=e.commitments??Hl({blobs:o,kzg:n,to:r}),i=e.proofs??Wl({blobs:o,commitments:s,kzg:n,to:r}),c=[];for(let a=0;a<o.length;a++)c.push({blob:o[a],commitment:s[a],proof:i[a]});return c}function ly(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 Pb({transaction:e})}async function Yl(e){const t=await e.request({method:"eth_chainId"},{dedupe:!0});return Wt(t)}const fy=["blobVersionedHashes","chainId","fees","gas","nonce","type"],Xl=new Map;async function Ql(e,t){const{account:n=e.account,blobs:r,chain:o,gas:s,kzg:i,nonce:c,nonceManager:a,parameters:u=fy,type:l}=t,f=n&&xt(n),p={...t,...f?{from:f==null?void 0:f.address}:{}};let d;async function h(){return d||(d=await ee(e,It,"getBlock")({blockTag:"latest"}),d)}let m;async function v(){return m||(o?o.id:typeof t.chainId<"u"?t.chainId:(m=await ee(e,Yl,"getChainId")({}),m))}if(u.includes("nonce")&&typeof c>"u"&&f)if(a){const A=await v();p.nonce=await a.consume({address:f.address,chainId:A,client:e})}else p.nonce=await ee(e,zl,"getTransactionCount")({address:f.address,blockTag:"pending"});if((u.includes("blobVersionedHashes")||u.includes("sidecars"))&&r&&i){const A=Hl({blobs:r,kzg:i});if(u.includes("blobVersionedHashes")){const w=sy({commitments:A,to:"hex"});p.blobVersionedHashes=w}if(u.includes("sidecars")){const w=Wl({blobs:r,commitments:A,kzg:i}),T=uy({blobs:r,commitments:A,proofs:w,to:"hex"});p.sidecars=T}}if(u.includes("chainId")&&(p.chainId=await v()),(u.includes("fees")||u.includes("type"))&&typeof l>"u")try{p.type=ly(p)}catch{let A=Xl.get(e.uid);if(typeof A>"u"){const w=await h();A=typeof(w==null?void 0:w.baseFeePerGas)=="bigint",Xl.set(e.uid,A)}p.type=A?"eip1559":"legacy"}if(u.includes("fees"))if(p.type!=="legacy"&&p.type!=="eip2930"){if(typeof p.maxFeePerGas>"u"||typeof p.maxPriorityFeePerGas>"u"){const A=await h(),{maxFeePerGas:w,maxPriorityFeePerGas:T}=await Ri(e,{block:A,chain:o,request:p});if(typeof t.maxPriorityFeePerGas>"u"&&t.maxFeePerGas&&t.maxFeePerGas<T)throw new Gb({maxPriorityFeePerGas:T});p.maxPriorityFeePerGas=T,p.maxFeePerGas=w}}else{if(typeof t.maxFeePerGas<"u"||typeof t.maxPriorityFeePerGas<"u")throw new Fi;if(typeof t.gasPrice>"u"){const A=await h(),{gasPrice:w}=await Ri(e,{block:A,chain:o,request:p,type:"legacy"});p.gasPrice=w}}return u.includes("gas")&&typeof s>"u"&&(p.gas=await ee(e,_i,"estimateGas")({...p,account:f&&{address:f.address,type:"json-rpc"}})),lo(p),delete p.parameters,p}async function Jl(e,{address:t,blockNumber:n,blockTag:r=e.experimental_blockTag??"latest"}){const o=typeof n=="bigint"?J(n):void 0,s=await e.request({method:"eth_getBalance",params:[t,o||r]});return BigInt(s)}async function _i(e,t){var o,s,i;const{account:n=e.account}=t,r=n?xt(n):void 0;try{let S=function(C){const{block:O,request:b,rpcStateOverride:M}=C;return e.request({method:"eth_estimateGas",params:M?[b,O??e.experimental_blockTag??"latest",M]:O?[b,O]:[b]})};const{accessList:c,authorizationList:a,blobs:u,blobVersionedHashes:l,blockNumber:f,blockTag:p,data:d,gas:h,gasPrice:m,maxFeePerBlobGas:v,maxFeePerGas:A,maxPriorityFeePerGas:w,nonce:T,value:B,stateOverride:F,...R}=await Ql(e,{...t,parameters:(r==null?void 0:r.type)==="local"?void 0:["blobVersionedHashes"]}),g=(typeof f=="bigint"?J(f):void 0)||p,y=Li(F),$=await(async()=>{if(R.to)return R.to;if(a&&a.length>0)return await jb({authorization:a[0]}).catch(()=>{throw new G("`to` is required. Could not infer from `authorizationList`")})})();lo(t);const k=(i=(s=(o=e.chain)==null?void 0:o.formatters)==null?void 0:s.transactionRequest)==null?void 0:i.format,P=(k||Jo)({...Bi(R,{format:k}),from:r==null?void 0:r.address,accessList:c,authorizationList:a,blobs:u,blobVersionedHashes:l,data:d,gas:h,gasPrice:m,maxFeePerBlobGas:v,maxFeePerGas:A,maxPriorityFeePerGas:w,nonce:T,to:$,value:B});let E=BigInt(await S({block:g,request:P,rpcStateOverride:y}));if(a){const C=await Jl(e,{address:P.from}),O=await Promise.all(a.map(async b=>{const{address:M}=b,D=await S({block:g,request:{authorizationList:void 0,data:d,from:r==null?void 0:r.address,to:M,value:J(C)},rpcStateOverride:y}).catch(()=>100000n);return 2n*BigInt(D)}));E+=O.reduce((b,M)=>b+M,0n)}return E}catch(c){throw Ub(c,{...t,account:r,chain:e.chain})}}async function dy(e,t){const{abi:n,address:r,args:o,functionName:s,dataSuffix:i,...c}=t,a=Nt({abi:n,args:o,functionName:s});try{return await ee(e,_i,"estimateGas")({data:`${a}${i?i.replace("0x",""):""}`,to:r,...c})}catch(u){const l=c.account?xt(c.account):void 0;throw cr(u,{abi:n,address:r,args:o,docsPath:"/docs/contract/estimateContractGas",functionName:s,sender:l==null?void 0:l.address})}}function es(e,t){if(!et(e,{strict:!1}))throw new pn({address:e});if(!et(t,{strict:!1}))throw new pn({address:t});return e.toLowerCase()===t.toLowerCase()}const ef="/docs/contract/decodeEventLog";function Ui(e){const{abi:t,data:n,strict:r,topics:o}=e,s=r??!0,[i,...c]=o;if(!i)throw new og({docsPath:ef});const a=t.find(m=>m.type==="event"&&i===Vo(gt(m)));if(!(a&&"name"in a)||a.type!=="event")throw new Fu(i,{docsPath:ef});const{name:u,inputs:l}=a,f=l==null?void 0:l.some(m=>!("name"in m&&m.name)),p=f?[]:{},d=l.map((m,v)=>[m,v]).filter(([m])=>"indexed"in m&&m.indexed);for(let m=0;m<d.length;m++){const[v,A]=d[m],w=c[m];if(!w)throw new _o({abiItem:a,param:v});p[f?A:v.name||A]=py({param:v,value:w})}const h=l.filter(m=>!("indexed"in m&&m.indexed));if(h.length>0){if(n&&n!=="0x")try{const m=Ur(h,n);if(m)if(f)for(let v=0;v<l.length;v++)p[v]=p[v]??m.shift();else for(let v=0;v<h.length;v++)p[h[v].name]=m[v]}catch(m){if(s)throw m instanceof ku||m instanceof xl?new Lr({abiItem:a,data:n,params:h,size:xe(n)}):m}else if(s)throw new Lr({abiItem:a,data:"0x",params:h,size:0})}return{eventName:u,args:Object.values(p).length>0?p:void 0}}function py({param:e,value:t}){return e.type==="string"||e.type==="bytes"||e.type==="tuple"||e.type.match(/^(.*)\[(\d+)?\]$/)?t:(Ur([e],t)||[])[0]}function zi(e){const{abi:t,args:n,logs:r,strict:o=!0}=e,s=(()=>{if(e.eventName)return Array.isArray(e.eventName)?e.eventName:[e.eventName]})();return r.map(i=>{var c;try{const a=t.find(l=>l.type==="event"&&i.topics[0]===Vo(l));if(!a)return null;const u=Ui({...i,abi:[a],strict:o});return s&&!s.includes(u.eventName)||!hy({args:u.args,inputs:a.inputs,matchArgs:n})?null:{...u,...i}}catch(a){let u,l;if(a instanceof Fu)return null;if(a instanceof Lr||a instanceof _o){if(o)return null;u=a.abiItem.name,l=(c=a.abiItem.inputs)==null?void 0:c.some(f=>!("name"in f&&f.name))}return{...i,args:l?[]:{},eventName:u}}}).filter(Boolean)}function hy(e){const{args:t,inputs:n,matchArgs:r}=e;if(!r)return!0;if(!t)return!1;function o(s,i,c){try{return s.type==="address"?es(i,c):s.type==="string"||s.type==="bytes"?Ie(Qn(i))===c:i===c}catch{return!1}}return Array.isArray(t)&&Array.isArray(r)?r.every((s,i)=>{if(s==null)return!0;const c=n[i];return c?(Array.isArray(s)?s:[s]).some(u=>o(c,u,t[i])):!1}):typeof t=="object"&&!Array.isArray(t)&&typeof r=="object"&&!Array.isArray(r)?Object.entries(r).every(([s,i])=>{if(i==null)return!0;const c=n.find(u=>u.name===s);return c?(Array.isArray(i)?i:[i]).some(u=>o(c,u,t[s])):!1}):!1}function Xt(e,{args:t,eventName:n}={}){return{...e,blockHash:e.blockHash?e.blockHash:null,blockNumber:e.blockNumber?BigInt(e.blockNumber):null,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}:{}}}async function Hi(e,{address:t,blockHash:n,fromBlock:r,toBlock:o,event:s,events:i,args:c,strict:a}={}){const u=a??!1,l=i??(s?[s]:void 0);let f=[];l&&(f=[l.flatMap(m=>_r({abi:[m],eventName:m.name,args:i?void 0:c}))],s&&(f=f[0]));let p;n?p=await e.request({method:"eth_getLogs",params:[{address:t,topics:f,blockHash:n}]}):p=await e.request({method:"eth_getLogs",params:[{address:t,topics:f,fromBlock:typeof r=="bigint"?J(r):r,toBlock:typeof o=="bigint"?J(o):o}]});const d=p.map(h=>Xt(h));return l?zi({abi:l,args:c,logs:d,strict:u}):d}async function tf(e,t){const{abi:n,address:r,args:o,blockHash:s,eventName:i,fromBlock:c,toBlock:a,strict:u}=t,l=i?On({abi:n,name:i}):void 0,f=l?void 0:n.filter(p=>p.type==="event");return ee(e,Hi,"getLogs")({address:r,args:o,blockHash:s,event:l,events:f,fromBlock:c,toBlock:a,strict:u})}const Wi="/docs/contract/decodeFunctionResult";function kn(e){const{abi:t,args:n,functionName:r,data:o}=e;let s=t[0];if(r){const c=On({abi:t,args:n,name:r});if(!c)throw new Yn(r,{docsPath:Wi});s=c}if(s.type!=="function")throw new Yn(void 0,{docsPath:Wi});if(!s.outputs)throw new Ru(s.name,{docsPath:Wi});const i=Ur(s.outputs,o);if(i&&i.length>1)return i;if(i&&i.length===1)return i[0]}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const Vi=BigInt(0),Gi=BigInt(1);function ts(e,t=""){if(typeof e!="boolean"){const n=t&&`"${t}"`;throw new Error(n+"expected boolean, got type="+typeof e)}return e}function Bn(e,t,n=""){const r=zo(e),o=e==null?void 0:e.length,s=t!==void 0;if(!r||s&&o!==t){const i=n&&`"${n}" `,c=s?` of length ${t}`:"",a=r?`length=${o}`:`type=${typeof e}`;throw new Error(i+"expected Uint8Array"+c+", got "+a)}return e}function ns(e){const t=e.toString(16);return t.length&1?"0"+t:t}function nf(e){if(typeof e!="string")throw new Error("hex string expected, got "+typeof e);return e===""?Vi:BigInt("0x"+e)}function rs(e){return nf(nr(e))}function rf(e){return qt(e),nf(nr(Uint8Array.from(e).reverse()))}function qi(e,t){return Ho(e.toString(16).padStart(t*2,"0"))}function of(e,t){return qi(e,t).reverse()}function _e(e,t,n){let r;if(typeof t=="string")try{r=Ho(t)}catch(o){throw new Error(e+" must be hex string or Uint8Array, cause: "+o)}else if(zo(t))r=Uint8Array.from(t);else throw new Error(e+" must be hex string or Uint8Array");return r.length,r}const Zi=e=>typeof e=="bigint"&&Vi<=e;function my(e,t,n){return Zi(e)&&Zi(t)&&Zi(n)&&t<=e&&e<n}function gy(e,t,n,r){if(!my(t,n,r))throw new Error("expected valid "+e+": "+n+" <= n < "+r+", got "+t)}function sf(e){let t;for(t=0;e>Vi;e>>=Gi,t+=1);return t}const fo=e=>(Gi<<BigInt(e))-Gi;function by(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=d=>new Uint8Array(d),o=d=>Uint8Array.of(d);let s=r(e),i=r(e),c=0;const a=()=>{s.fill(1),i.fill(0),c=0},u=(...d)=>n(i,s,...d),l=(d=r(0))=>{i=u(o(0),d),s=u(),d.length!==0&&(i=u(o(1),d),s=u())},f=()=>{if(c++>=1e3)throw new Error("drbg: tried 1000 values");let d=0;const h=[];for(;d<t;){s=u();const m=s.slice();h.push(m),d+=s.length}return dn(...h)};return(d,h)=>{a(),l(d);let m;for(;!(m=h(f()));)l();return a(),m}}function Ki(e,t,n={}){if(!e||typeof e!="object")throw new Error("expected valid options object");function r(o,s,i){const c=e[o];if(i&&c===void 0)return;const a=typeof c;if(a!==s||c===null)throw new Error(`param "${o}" is invalid: expected ${s}, got ${a}`)}Object.entries(t).forEach(([o,s])=>r(o,s,!1)),Object.entries(n).forEach(([o,s])=>r(o,s,!0))}function af(e){const t=new WeakMap;return(n,...r)=>{const o=t.get(n);if(o!==void 0)return o;const s=e(n,...r);return t.set(n,s),s}}const yy="0.1.1";function wy(){return yy}class be extends Error{constructor(t,n={}){const r=(()=>{var a;if(n.cause instanceof be){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:(a=n.cause)!=null&&a.message?n.cause.message:n.details})(),o=n.cause instanceof be&&n.cause.docsPath||n.docsPath,i=`https://oxlib.sh${o??""}`,c=[t||"An error occurred.",...n.metaMessages?["",...n.metaMessages]:[],...r||o?["",r?`Details: ${r}`:void 0,o?`See: ${i}`:void 0]:[]].filter(a=>typeof a=="string").join(`
|
|
79
|
-
`);super(c,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@${wy()}`}),this.cause=n.cause,this.details=r,this.docs=i,this.docsPath=o,this.shortMessage=t}walk(t){return cf(this,t)}}function cf(e,t){return t!=null&&t(e)?e:e&&typeof e=="object"&&"cause"in e&&e.cause?cf(e.cause,t):t?null:e}const vy="#__bigint";function xy(e,t,n){return JSON.stringify(e,(r,o)=>typeof o=="bigint"?o.toString()+vy:o,n)}function Ey(e,t){if(ff(e)>t)throw new My({givenSize:ff(e),maxSize:t})}const Qt={zero:48,nine:57,A:65,F:70,a:97,f:102};function uf(e){if(e>=Qt.zero&&e<=Qt.nine)return e-Qt.zero;if(e>=Qt.A&&e<=Qt.F)return e-(Qt.A-10);if(e>=Qt.a&&e<=Qt.f)return e-(Qt.a-10)}function Sy(e,t={}){const{dir:n,size:r=32}=t;if(r===0)return e;if(e.length>r)throw new ky({size:e.length,targetSize:r,type:"Bytes"});const o=new Uint8Array(r);for(let s=0;s<r;s++){const i=n==="right";o[i?s:r-s-1]=e[i?s:e.length-s-1]}return o}function Yi(e,t){if(tt(e)>t)throw new Ry({givenSize:tt(e),maxSize:t})}function Py(e,t){if(typeof t=="number"&&t>0&&t>tt(e)-1)throw new bf({offset:t,position:"start",size:tt(e)})}function $y(e,t,n){if(typeof t=="number"&&typeof n=="number"&&tt(e)!==n-t)throw new bf({offset:n,position:"end",size:tt(e)})}function lf(e,t={}){const{dir:n,size:r=32}=t;if(r===0)return e;const o=e.replace("0x","");if(o.length>r*2)throw new jy({size:Math.ceil(o.length/2),targetSize:r,type:"Hex"});return`0x${o[n==="right"?"padEnd":"padStart"](r*2,"0")}`}const Ty=new TextEncoder;function Ay(e){return e instanceof Uint8Array?e:typeof e=="string"?Cy(e):Oy(e)}function Oy(e){return e instanceof Uint8Array?e:new Uint8Array(e)}function Cy(e,t={}){const{size:n}=t;let r=e;n&&(Yi(e,n),r=Fn(e,n));let o=r.slice(2);o.length%2&&(o=`0${o}`);const s=o.length/2,i=new Uint8Array(s);for(let c=0,a=0;c<s;c++){const u=uf(o.charCodeAt(a++)),l=uf(o.charCodeAt(a++));if(u===void 0||l===void 0)throw new be(`Invalid byte sequence ("${o[a-2]}${o[a-1]}" in "${o}").`);i[c]=u*16+l}return i}function Ny(e,t={}){const{size:n}=t,r=Ty.encode(e);return typeof n=="number"?(Ey(r,n),Iy(r,n)):r}function Iy(e,t){return Sy(e,{dir:"right",size:t})}function ff(e){return e.length}let My=class extends be{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"})}},ky=class extends be{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 By=new TextEncoder,Ly=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function Fy(e,t={}){const{strict:n=!1}=t;if(!e)throw new mf(e);if(typeof e!="string")throw new mf(e);if(n&&!/^0x[0-9a-fA-F]*$/.test(e))throw new gf(e);if(!e.startsWith("0x"))throw new gf(e)}function Mt(...e){return`0x${e.reduce((t,n)=>t+n.replace("0x",""),"")}`}function df(e,t={}){const n=`0x${Number(e)}`;return typeof t.size=="number"?(Yi(n,t.size),Ln(n,t.size)):n}function pf(e,t={}){let n="";for(let o=0;o<e.length;o++)n+=Ly[e[o]];const r=`0x${n}`;return typeof t.size=="number"?(Yi(r,t.size),Fn(r,t.size)):r}function Be(e,t={}){const{signed:n,size:r}=t,o=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 i=typeof s=="bigint"&&n?-s-1n:0;if(s&&o>s||o<i){const u=typeof e=="bigint"?"n":"";throw new hf({max:s?`${s}${u}`:void 0,min:`${i}${u}`,signed:n,size:r,value:`${e}${u}`})}const a=`0x${(n&&o<0?(1n<<BigInt(r*8))+BigInt(o):o).toString(16)}`;return r?Ln(a,r):a}function Xi(e,t={}){return pf(By.encode(e),t)}function Ln(e,t){return lf(e,{dir:"left",size:t})}function Fn(e,t){return lf(e,{dir:"right",size:t})}function Qi(e,t,n,r={}){const{strict:o}=r;Py(e,t);const s=`0x${e.replace("0x","").slice((t??0)*2,(n??e.length)*2)}`;return o&&$y(s,t,n),s}function tt(e){return Math.ceil((e.length-2)/2)}function Dy(e,t={}){const{strict:n=!1}=t;try{return Fy(e,{strict:n}),!0}catch{return!1}}class hf extends be{constructor({max:t,min:n,signed:r,size:o,value:s}){super(`Number \`${s}\` is not in safe${o?` ${o*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 mf extends be{constructor(t){super(`Value \`${typeof t=="object"?xy(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 gf extends be{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"})}}class Ry extends be{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"})}}class bf extends be{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 jy extends be{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 _y(e){return{address:e.address,amount:Be(e.amount),index:Be(e.index),validatorIndex:Be(e.validatorIndex)}}function yf(e){return{...typeof e.baseFeePerGas=="bigint"&&{baseFeePerGas:Be(e.baseFeePerGas)},...typeof e.blobBaseFee=="bigint"&&{blobBaseFee:Be(e.blobBaseFee)},...typeof e.feeRecipient=="string"&&{feeRecipient:e.feeRecipient},...typeof e.gasLimit=="bigint"&&{gasLimit:Be(e.gasLimit)},...typeof e.number=="bigint"&&{number:Be(e.number)},...typeof e.prevRandao=="bigint"&&{prevRandao:Be(e.prevRandao)},...typeof e.time=="bigint"&&{time:Be(e.time)},...e.withdrawals&&{withdrawals:e.withdrawals.map(_y)}}}const Ji=[{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"}],ea=[{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"}]}],wf=[{inputs:[],name:"ResolverNotFound",type:"error"},{inputs:[],name:"ResolverWildcardNotSupported",type:"error"},{inputs:[],name:"ResolverNotContract",type:"error"},{inputs:[{name:"returnData",type:"bytes"}],name:"ResolverError",type:"error"},{inputs:[{components:[{name:"status",type:"uint16"},{name:"message",type:"string"}],name:"errors",type:"tuple[]"}],name:"HttpError",type:"error"}],vf=[...wf,{name:"resolve",type:"function",stateMutability:"view",inputs:[{name:"name",type:"bytes"},{name:"data",type:"bytes"}],outputs:[{name:"",type:"bytes"},{name:"address",type:"address"}]},{name:"resolve",type:"function",stateMutability:"view",inputs:[{name:"name",type:"bytes"},{name:"data",type:"bytes"},{name:"gateways",type:"string[]"}],outputs:[{name:"",type:"bytes"},{name:"address",type:"address"}]}],Uy=[...wf,{name:"reverse",type:"function",stateMutability:"view",inputs:[{type:"bytes",name:"reverseName"}],outputs:[{type:"string",name:"resolvedName"},{type:"address",name:"resolvedAddress"},{type:"address",name:"reverseResolver"},{type:"address",name:"resolver"}]},{name:"reverse",type:"function",stateMutability:"view",inputs:[{type:"bytes",name:"reverseName"},{type:"string[]",name:"gateways"}],outputs:[{type:"string",name:"resolvedName"},{type:"address",name:"resolvedAddress"},{type:"address",name:"reverseResolver"},{type:"address",name:"resolver"}]}],xf=[{name:"text",type:"function",stateMutability:"view",inputs:[{name:"name",type:"bytes32"},{name:"key",type:"string"}],outputs:[{name:"",type:"string"}]}],Ef=[{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"}]}],Sf=[{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"}],lr=[{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"}]}],zy="0x82ad56cb",Pf="0x608060405234801561001057600080fd5b5060405161018e38038061018e83398101604081905261002f91610124565b6000808351602085016000f59050803b61004857600080fd5b6000808351602085016000855af16040513d6000823e81610067573d81fd5b3d81f35b634e487b7160e01b600052604160045260246000fd5b600082601f83011261009257600080fd5b81516001600160401b038111156100ab576100ab61006b565b604051601f8201601f19908116603f011681016001600160401b03811182821017156100d9576100d961006b565b6040528181528382016020018510156100f157600080fd5b60005b82811015610110576020818601810151838301820152016100f4565b506000918101602001919091529392505050565b6000806040838503121561013757600080fd5b82516001600160401b0381111561014d57600080fd5b61015985828601610081565b602085015190935090506001600160401b0381111561017757600080fd5b61018385828601610081565b915050925092905056fe",Hy="0x608060405234801561001057600080fd5b506040516102c03803806102c083398101604081905261002f916101e6565b836001600160a01b03163b6000036100e457600080836001600160a01b03168360405161005c9190610270565b6000604051808303816000865af19150503d8060008114610099576040519150601f19603f3d011682016040523d82523d6000602084013e61009e565b606091505b50915091508115806100b857506001600160a01b0386163b155b156100e1578060405163101bb98d60e01b81526004016100d8919061028c565b60405180910390fd5b50505b6000808451602086016000885af16040513d6000823e81610103573d81fd5b3d81f35b80516001600160a01b038116811461011e57600080fd5b919050565b634e487b7160e01b600052604160045260246000fd5b60005b8381101561015457818101518382015260200161013c565b50506000910152565b600082601f83011261016e57600080fd5b81516001600160401b0381111561018757610187610123565b604051601f8201601f19908116603f011681016001600160401b03811182821017156101b5576101b5610123565b6040528181528382016020018510156101cd57600080fd5b6101de826020830160208701610139565b949350505050565b600080600080608085870312156101fc57600080fd5b61020585610107565b60208601519094506001600160401b0381111561022157600080fd5b61022d8782880161015d565b93505061023c60408601610107565b60608601519092506001600160401b0381111561025857600080fd5b6102648782880161015d565b91505092959194509250565b60008251610282818460208701610139565b9190910192915050565b60208152600082518060208401526102ab816040850160208701610139565b601f01601f1916919091016040019291505056fe",Wy="0x608060405234801561001057600080fd5b5060405161069438038061069483398101604081905261002f9161051e565b600061003c848484610048565b9050806000526001601ff35b60007f64926492649264926492649264926492649264926492649264926492649264926100748361040c565b036101e7576000606080848060200190518101906100929190610577565b60405192955090935091506000906001600160a01b038516906100b69085906105dd565b6000604051808303816000865af19150503d80600081146100f3576040519150601f19603f3d011682016040523d82523d6000602084013e6100f8565b606091505b50509050876001600160a01b03163b60000361016057806101605760405162461bcd60e51b815260206004820152601e60248201527f5369676e617475726556616c696461746f723a206465706c6f796d656e74000060448201526064015b60405180910390fd5b604051630b135d3f60e11b808252906001600160a01b038a1690631626ba7e90610190908b9087906004016105f9565b602060405180830381865afa1580156101ad573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101d19190610633565b6001600160e01b03191614945050505050610405565b6001600160a01b0384163b1561027a57604051630b135d3f60e11b808252906001600160a01b03861690631626ba7e9061022790879087906004016105f9565b602060405180830381865afa158015610244573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102689190610633565b6001600160e01b031916149050610405565b81516041146102df5760405162461bcd60e51b815260206004820152603a602482015260008051602061067483398151915260448201527f3a20696e76616c6964207369676e6174757265206c656e6774680000000000006064820152608401610157565b6102e7610425565b5060208201516040808401518451859392600091859190811061030c5761030c61065d565b016020015160f81c9050601b811480159061032b57508060ff16601c14155b1561038c5760405162461bcd60e51b815260206004820152603b602482015260008051602061067483398151915260448201527f3a20696e76616c6964207369676e617475726520762076616c756500000000006064820152608401610157565b60408051600081526020810180835289905260ff83169181019190915260608101849052608081018390526001600160a01b0389169060019060a0016020604051602081039080840390855afa1580156103ea573d6000803e3d6000fd5b505050602060405103516001600160a01b0316149450505050505b9392505050565b600060208251101561041d57600080fd5b508051015190565b60405180606001604052806003906020820280368337509192915050565b6001600160a01b038116811461045857600080fd5b50565b634e487b7160e01b600052604160045260246000fd5b60005b8381101561048c578181015183820152602001610474565b50506000910152565b600082601f8301126104a657600080fd5b81516001600160401b038111156104bf576104bf61045b565b604051601f8201601f19908116603f011681016001600160401b03811182821017156104ed576104ed61045b565b60405281815283820160200185101561050557600080fd5b610516826020830160208701610471565b949350505050565b60008060006060848603121561053357600080fd5b835161053e81610443565b6020850151604086015191945092506001600160401b0381111561056157600080fd5b61056d86828701610495565b9150509250925092565b60008060006060848603121561058c57600080fd5b835161059781610443565b60208501519093506001600160401b038111156105b357600080fd5b6105bf86828701610495565b604086015190935090506001600160401b0381111561056157600080fd5b600082516105ef818460208701610471565b9190910192915050565b828152604060208201526000825180604084015261061e816060850160208701610471565b601f01601f1916919091016060019392505050565b60006020828403121561064557600080fd5b81516001600160e01b03198116811461040557600080fd5b634e487b7160e01b600052603260045260246000fdfe5369676e617475726556616c696461746f72237265636f7665725369676e6572";class ta extends G{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 $f extends G{constructor(){super("No chain was provided to the Client.",{name:"ClientChainNotConfiguredError"})}}const na="/docs/contract/encodeDeployData";function ra(e){const{abi:t,args:n,bytecode:r}=e;if(!n||n.length===0)return r;const o=t.find(i=>"type"in i&&i.type==="constructor");if(!o)throw new Jm({docsPath:na});if(!("inputs"in o))throw new Mu({docsPath:na});if(!o.inputs||o.inputs.length===0)throw new Mu({docsPath:na});const s=Kt(o.inputs,n);return rr([r,s])}function fr({blockNumber:e,chain:t,contract:n}){var o;const r=(o=t==null?void 0:t.contracts)==null?void 0:o[n];if(!r)throw new ta({chain:t,contract:{name:n}});if(e&&r.blockCreated&&r.blockCreated>e)throw new ta({blockNumber:e,chain:t,contract:{name:n,blockCreated:r.blockCreated}});return r.address}function Tf(e,{docsPath:t,...n}){const r=(()=>{const o=ki(e,n);return o instanceof Qo?e:o})();return new Cl(r,{docsPath:t,...n})}function Af(){let e=()=>{},t=()=>{};return{promise:new Promise((r,o)=>{e=r,t=o}),resolve:e,reject:t}}const oa=new Map;function Of({fn:e,id:t,shouldSplitBatch:n,wait:r=0,sort:o}){const s=async()=>{const l=a();i();const f=l.map(({args:p})=>p);f.length!==0&&e(f).then(p=>{o&&Array.isArray(p)&&p.sort(o);for(let d=0;d<l.length;d++){const{resolve:h}=l[d];h==null||h([p[d],p])}}).catch(p=>{for(let d=0;d<l.length;d++){const{reject:h}=l[d];h==null||h(p)}})},i=()=>oa.delete(t),c=()=>a().map(({args:l})=>l),a=()=>oa.get(t)||[],u=l=>oa.set(t,[...a(),l]);return{flush:i,async schedule(l){const{promise:f,resolve:p,reject:d}=Af();return(n==null?void 0:n([...c(),l]))&&s(),a().length>0?(u({args:l,resolve:p,reject:d}),f):(u({args:l,resolve:p,reject:d}),setTimeout(s,r),f)}}}async function po(e,t){var P,S,E,C;const{account:n=e.account,authorizationList:r,batch:o=!!((P=e.batch)!=null&&P.multicall),blockNumber:s,blockTag:i=e.experimental_blockTag??"latest",accessList:c,blobs:a,blockOverrides:u,code:l,data:f,factory:p,factoryData:d,gas:h,gasPrice:m,maxFeePerBlobGas:v,maxFeePerGas:A,maxPriorityFeePerGas:w,nonce:T,to:B,value:F,stateOverride:R,...j}=t,g=n?xt(n):void 0;if(l&&(p||d))throw new G("Cannot provide both `code` & `factory`/`factoryData` as parameters.");if(l&&B)throw new G("Cannot provide both `code` & `to` as parameters.");const y=l&&f,$=p&&d&&B&&f,k=y||$,N=y?qy({code:l,data:f}):$?Zy({data:f,factory:p,factoryData:d,to:B}):f;try{lo(t);const b=(typeof s=="bigint"?J(s):void 0)||i,M=u?yf(u):void 0,D=Li(R),_=(C=(E=(S=e.chain)==null?void 0:S.formatters)==null?void 0:E.transactionRequest)==null?void 0:C.format,W=(_||Jo)({...Bi(j,{format:_}),from:g==null?void 0:g.address,accessList:c,authorizationList:r,blobs:a,data:N,gas:h,gasPrice:m,maxFeePerBlobGas:v,maxFeePerGas:A,maxPriorityFeePerGas:w,nonce:T,to:k?void 0:B,value:F});if(o&&Vy({request:W})&&!D&&!M)try{return await Gy(e,{...W,blockNumber:s,blockTag:i})}catch(Z){if(!(Z instanceof $f)&&!(Z instanceof ta))throw Z}const K=(()=>{const Z=[W,b];return D&&M?[...Z,D,M]:D?[...Z,D]:M?[...Z,{},M]:Z})(),V=await e.request({method:"eth_call",params:K});return V==="0x"?{data:void 0}:{data:V}}catch(O){const b=Ky(O),{offchainLookup:M,offchainLookupSignature:D}=await Promise.resolve().then(()=>Q1);if(e.ccipRead!==!1&&(b==null?void 0:b.slice(0,10))===D&&B)return{data:await M(e,{data:b,to:B})};throw k&&(b==null?void 0:b.slice(0,10))==="0x101bb98d"?new Cb({factory:p}):Tf(O,{...t,account:g,chain:e.chain})}}function Vy({request:e}){const{data:t,to:n,...r}=e;return!(!t||t.startsWith(zy)||!n||Object.values(r).filter(o=>typeof o<"u").length>0)}async function Gy(e,t){var m;const{batchSize:n=1024,wait:r=0}=typeof((m=e.batch)==null?void 0:m.multicall)=="object"?e.batch.multicall:{},{blockNumber:o,blockTag:s=e.experimental_blockTag??"latest",data:i,multicallAddress:c,to:a}=t;let u=c;if(!u){if(!e.chain)throw new $f;u=fr({blockNumber:o,chain:e.chain,contract:"multicall3"})}const f=(typeof o=="bigint"?J(o):void 0)||s,{schedule:p}=Of({id:`${e.uid}.${f}`,wait:r,shouldSplitBatch(v){return v.reduce((w,{data:T})=>w+(T.length-2),0)>n*2},fn:async v=>{const A=v.map(B=>({allowFailure:!0,callData:B.data,target:B.to})),w=Nt({abi:Ji,args:[A],functionName:"aggregate3"}),T=await e.request({method:"eth_call",params:[{data:w,to:u},f]});return kn({abi:Ji,args:[A],functionName:"aggregate3",data:T||"0x"})}}),[{returnData:d,success:h}]=await p({data:i,to:a});if(!h)throw new Ko({data:d});return d==="0x"?{data:void 0}:{data:d}}function qy(e){const{code:t,data:n}=e;return ra({abi:Ou(["constructor(bytes, bytes)"]),bytecode:Pf,args:[t,n]})}function Zy(e){const{data:t,factory:n,factoryData:r,to:o}=e;return ra({abi:Ou(["constructor(address, bytes, address, bytes)"]),bytecode:Hy,args:[o,t,n,r]})}function Ky(e){var n;if(!(e instanceof G))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 Jt(e,t){const{abi:n,address:r,args:o,functionName:s,...i}=t,c=Nt({abi:n,args:o,functionName:s});try{const{data:a}=await ee(e,po,"call")({...i,data:c,to:r});return kn({abi:n,args:o,functionName:s,data:a||"0x"})}catch(a){throw cr(a,{abi:n,address:r,args:o,docsPath:"/docs/contract/readContract",functionName:s})}}async function Yy(e,t){const{abi:n,address:r,args:o,dataSuffix:s,functionName:i,...c}=t,a=c.account?xt(c.account):e.account,u=Nt({abi:n,args:o,functionName:i});try{const{data:l}=await ee(e,po,"call")({batch:!1,data:`${u}${s?s.replace("0x",""):""}`,to:r,...c,account:a}),f=kn({abi:n,args:o,functionName:i,data:l||"0x"}),p=n.filter(d=>"name"in d&&d.name===t.functionName);return{result:f,request:{abi:p,address:r,args:o,dataSuffix:s,functionName:i,...c,account:a}}}catch(l){throw cr(l,{abi:n,address:r,args:o,docsPath:"/docs/contract/simulateContract",functionName:i,sender:a==null?void 0:a.address})}}const sa=new Map,Cf=new Map;let Xy=0;function gn(e,t,n){const r=++Xy,o=()=>sa.get(e)||[],s=()=>{const l=o();sa.set(e,l.filter(f=>f.id!==r))},i=()=>{const l=o();if(!l.some(p=>p.id===r))return;const f=Cf.get(e);if(l.length===1&&f){const p=f();p instanceof Promise&&p.catch(()=>{})}s()},c=o();if(sa.set(e,[...c,{id:r,fns:t}]),c&&c.length>0)return i;const a={};for(const l in t)a[l]=(...f)=>{var d,h;const p=o();if(p.length!==0)for(const m of p)(h=(d=m.fns)[l])==null||h.call(d,...f)};const u=n(a);return typeof u=="function"&&Cf.set(e,u),i}async function ia(e){return new Promise(t=>setTimeout(t,e))}function ho(e,{emitOnBegin:t,initialWaitTime:n,interval:r}){let o=!0;const s=()=>o=!1;return(async()=>{let c;t&&(c=await e({unpoll:s}));const a=await(n==null?void 0:n(c))??r;await ia(a);const u=async()=>{o&&(await e({unpoll:s}),await ia(r),u())};u()})(),s}const Qy=new Map,Jy=new Map;function e1(e){const t=(o,s)=>({clear:()=>s.delete(o),get:()=>s.get(o),set:i=>s.set(o,i)}),n=t(e,Qy),r=t(e,Jy);return{clear:()=>{n.clear(),r.clear()},promise:n,response:r}}async function t1(e,{cacheKey:t,cacheTime:n=Number.POSITIVE_INFINITY}){const r=e1(t),o=r.response.get();if(o&&n>0&&new Date().getTime()-o.created.getTime()<n)return o.data;let s=r.promise.get();s||(s=e(),r.promise.set(s));try{const i=await s;return r.response.set({created:new Date,data:i}),i}finally{r.promise.clear()}}const n1=e=>`blockNumber.${e}`;async function mo(e,{cacheTime:t=e.cacheTime}={}){const n=await t1(()=>e.request({method:"eth_blockNumber"}),{cacheKey:n1(e.uid),cacheTime:t});return BigInt(n)}async function os(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 o=r.map(s=>Xt(s));return!("abi"in t)||!t.abi?o:zi({abi:t.abi,logs:o,strict:n})}async function ss(e,{filter:t}){return t.request({method:"eth_uninstallFilter",params:[t.id]})}function r1(e,t){const{abi:n,address:r,args:o,batch:s=!0,eventName:i,fromBlock:c,onError:a,onLogs:u,poll:l,pollingInterval:f=e.pollingInterval,strict:p}=t;return(typeof l<"u"?l:typeof c=="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 v=p??!1,A=Te(["watchContractEvent",r,o,s,e.uid,i,f,v,c]);return gn(A,{onLogs:u,onError:a},w=>{let T;c!==void 0&&(T=c-1n);let B,F=!1;const R=ho(async()=>{var j;if(!F){try{B=await ee(e,gl,"createContractEventFilter")({abi:n,address:r,args:o,eventName:i,strict:v,fromBlock:c})}catch{}F=!0;return}try{let g;if(B)g=await ee(e,os,"getFilterChanges")({filter:B});else{const y=await ee(e,mo,"getBlockNumber")({});T&&T<y?g=await ee(e,tf,"getContractEvents")({abi:n,address:r,args:o,eventName:i,fromBlock:T+1n,toBlock:y,strict:v}):g=[],T=y}if(g.length===0)return;if(s)w.onLogs(g);else for(const y of g)w.onLogs([y])}catch(g){B&&g instanceof In&&(F=!1),(j=w.onError)==null||j.call(w,g)}},{emitOnBegin:!0,interval:f});return async()=>{B&&await ee(e,ss,"uninstallFilter")({filter:B}),R()}})})():(()=>{const v=p??!1,A=Te(["watchContractEvent",r,o,s,e.uid,i,f,v]);let w=!0,T=()=>w=!1;return gn(A,{onLogs:u,onError:a},B=>((async()=>{try{const F=(()=>{if(e.transport.type==="fallback"){const g=e.transport.transports.find(y=>y.config.type==="webSocket"||y.config.type==="ipc");return g?g.value:e.transport}return e.transport})(),R=i?_r({abi:n,eventName:i,args:o}):[],{unsubscribe:j}=await F.subscribe({params:["logs",{address:r,topics:R}],onData(g){var $;if(!w)return;const y=g.result;try{const{eventName:k,args:N}=Ui({abi:n,data:y.data,topics:y.topics,strict:p}),P=Xt(y,{args:N,eventName:k});B.onLogs([P])}catch(k){let N,P;if(k instanceof Lr||k instanceof _o){if(p)return;N=k.abiItem.name,P=($=k.abiItem.inputs)==null?void 0:$.some(E=>!("name"in E&&E.name))}const S=Xt(y,{args:P?[]:{},eventName:N});B.onLogs([S])}},onError(g){var y;(y=B.onError)==null||y.call(B,g)}});T=j,w||T()}catch(F){a==null||a(F)}})(),()=>T()))})()}async function o1(e,{serializedTransaction:t}){return e.request({method:"eth_sendRawTransaction",params:[t]},{retryCount:0})}function aa(e,{delay:t=100,retryCount:n=2,shouldRetry:r=()=>!0}={}){return new Promise((o,s)=>{const i=async({count:c=0}={})=>{const a=async({error:u})=>{const l=typeof t=="function"?t({count:c,error:u}):t;l&&await ia(l),i({count:c+1})};try{const u=await e();o(u)}catch(u){if(c<n&&await r({count:c,error:u}))return a({error:u});s(u)}};i()})}const s1={"0x0":"reverted","0x1":"success"};function i1(e){const t={...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(n=>Xt(n)):null,to:e.to?e.to:null,transactionIndex:e.transactionIndex?Wt(e.transactionIndex):null,status:e.status?s1[e.status]:null,type:e.type?Rl[e.type]||e.type:null};return e.blobGasPrice&&(t.blobGasPrice=BigInt(e.blobGasPrice)),e.blobGasUsed&&(t.blobGasUsed=BigInt(e.blobGasUsed)),t}const ca=256;let is=ca,as;function Nf(e=11){if(!as||is+e>ca*2){as="",is=0;for(let t=0;t<ca;t++)as+=(256+Math.random()*256|0).toString(16).substring(1)}return as.substring(is,is+++e)}function a1(e){const{batch:t,chain:n,ccipRead:r,key:o="base",name:s="Base Client",type:i="base"}=e,c=e.experimental_blockTag??(typeof(n==null?void 0:n.experimental_preconfirmationTime)=="number"?"pending":void 0),a=(n==null?void 0:n.blockTime)??12e3,u=Math.min(Math.max(Math.floor(a/2),500),4e3),l=e.pollingInterval??u,f=e.cacheTime??l,p=e.account?xt(e.account):void 0,{config:d,request:h,value:m}=e.transport({chain:n,pollingInterval:l}),v={...d,...m},A={account:p,batch:t,cacheTime:f,ccipRead:r,chain:n,key:o,name:s,pollingInterval:l,request:h,transport:v,type:i,uid:Nf(),...c?{experimental_blockTag:c}:{}};function w(T){return B=>{const F=B(T);for(const j in A)delete F[j];const R={...T,...F};return Object.assign(R,{extend:w(R)})}}return Object.assign(A,{extend:w(A)})}const cs=new pi(8192);function c1(e,{enabled:t=!0,id:n}){if(!t||!n)return e();if(cs.get(n))return cs.get(n);const r=e().finally(()=>cs.delete(n));return cs.set(n,r),r}function u1(e,t={}){return async(n,r={})=>{var f;const{dedupe:o=!1,methods:s,retryDelay:i=150,retryCount:c=3,uid:a}={...t,...r},{method:u}=n;if((f=s==null?void 0:s.exclude)!=null&&f.includes(u))throw new Mn(new Error("method not supported"),{method:u});if(s!=null&&s.include&&!s.include.includes(u))throw new Mn(new Error("method not supported"),{method:u});const l=o?Fr(`${a}.${Te(n)}`):void 0;return c1(()=>aa(async()=>{try{return await e(n)}catch(p){const d=p;switch(d.code){case Wr.code:throw new Wr(d);case Vr.code:throw new Vr(d);case Gr.code:throw new Gr(d,{method:n.method});case qr.code:throw new qr(d);case Nn.code:throw new Nn(d);case In.code:throw new In(d);case Zr.code:throw new Zr(d);case Kr.code:throw new Kr(d);case Yr.code:throw new Yr(d);case Mn.code:throw new Mn(d,{method:n.method});case ir.code:throw new ir(d);case Xr.code:throw new Xr(d);case ar.code:throw new ar(d);case Qr.code:throw new Qr(d);case Jr.code:throw new Jr(d);case eo.code:throw new eo(d);case to.code:throw new to(d);case no.code:throw new no(d);case ro.code:throw new ro(d);case oo.code:throw new oo(d);case so.code:throw new so(d);case io.code:throw new io(d);case ao.code:throw new ao(d);case co.code:throw new co(d);case uo.code:throw new uo(d);case 5e3:throw new ar(d);default:throw p instanceof G?p:new Ib(d)}}},{delay:({count:p,error:d})=>{var h;if(d&&d instanceof Cn){const m=(h=d==null?void 0:d.headers)==null?void 0:h.get("Retry-After");if(m!=null&&m.match(/\d/))return Number.parseInt(m)*1e3}return~~(1<<p)*i},retryCount:c,shouldRetry:({error:p})=>l1(p)}),{enabled:o,id:l})}}function l1(e){return"code"in e&&typeof e.code=="number"?e.code===-1||e.code===ir.code||e.code===Nn.code:e instanceof Cn&&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}function f1({key:e,methods:t,name:n,request:r,retryCount:o=3,retryDelay:s=150,timeout:i,type:c},a){const u=Nf();return{config:{key:e,methods:t,name:n,request:r,retryCount:o,retryDelay:s,timeout:i,type:c},request:u1(r,{methods:t,retryCount:o,retryDelay:s,uid:u}),value:a}}class d1 extends G{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 p1(e,{errorInstance:t=new Error("timed out"),timeout:n,signal:r}){return new Promise((o,s)=>{(async()=>{let i;try{const c=new AbortController;n>0&&(i=setTimeout(()=>{r&&c.abort()},n)),o(await e({signal:(c==null?void 0:c.signal)||null}))}catch(c){(c==null?void 0:c.name)==="AbortError"&&s(t),s(c)}finally{clearTimeout(i)}})()})}function h1(){return{current:0,take(){return this.current++},reset(){this.current=0}}}const If=h1();function m1(e,t={}){return{async request(n){var f;const{body:r,onRequest:o=t.onRequest,onResponse:s=t.onResponse,timeout:i=t.timeout??1e4}=n,c={...t.fetchOptions??{},...n.fetchOptions??{}},{headers:a,method:u,signal:l}=c;try{const p=await p1(async({signal:h})=>{const m={...c,body:Array.isArray(r)?Te(r.map(T=>({jsonrpc:"2.0",id:T.id??If.take(),...T}))):Te({jsonrpc:"2.0",id:r.id??If.take(),...r}),headers:{"Content-Type":"application/json",...a},method:u||"POST",signal:l||(i>0?h:null)},v=new Request(e,m),A=await(o==null?void 0:o(v,m))??{...m,url:e};return await fetch(A.url??e,A)},{errorInstance:new Nl({body:r,url:e}),timeout:i,signal:!0});s&&await s(p);let d;if((f=p.headers.get("Content-Type"))!=null&&f.startsWith("application/json"))d=await p.json();else{d=await p.text();try{d=JSON.parse(d||"{}")}catch(h){if(p.ok)throw h;d={error:d}}}if(!p.ok)throw new Cn({body:r,details:Te(d.error)||p.statusText,headers:p.headers,status:p.status,url:e});return d}catch(p){throw p instanceof Cn||p instanceof Nl?p:new Cn({body:r,cause:p,url:e})}}}}function g1(e,t={}){const{batch:n,fetchOptions:r,key:o="http",methods:s,name:i="HTTP JSON-RPC",onFetchRequest:c,onFetchResponse:a,retryDelay:u,raw:l}=t;return({chain:f,retryCount:p,timeout:d})=>{const{batchSize:h=1e3,wait:m=0}=typeof n=="object"?n:{},v=t.retryCount??p,A=d??t.timeout??1e4,w=e||(f==null?void 0:f.rpcUrls.default.http[0]);if(!w)throw new d1;const T=m1(w,{fetchOptions:r,onRequest:c,onResponse:a,timeout:A});return f1({key:o,methods:s,name:i,async request({method:B,params:F}){const R={method:B,params:F},{schedule:j}=Of({id:w,wait:m,shouldSplitBatch(k){return k.length>h},fn:k=>T.request({body:k}),sort:(k,N)=>k.id-N.id}),g=async k=>n?j(k):[await T.request({body:k})],[{error:y,result:$}]=await g(R);if(l)return{error:y,result:$};if(y)throw new Pi({body:R,error:y,url:w});return $},retryCount:v,retryDelay:u,timeout:A,type:"http"},{fetchOptions:r,url:w})}}function ua(e,t){var r,o,s,i,c,a;if(!(e instanceof G))return!1;const n=e.walk(u=>u instanceof Si);return n instanceof Si?!!(((r=n.data)==null?void 0:r.errorName)==="ResolverNotFound"||((o=n.data)==null?void 0:o.errorName)==="ResolverWildcardNotSupported"||((s=n.data)==null?void 0:s.errorName)==="ResolverNotContract"||((i=n.data)==null?void 0:i.errorName)==="ResolverError"||((c=n.data)==null?void 0:c.errorName)==="HttpError"||(a=n.reason)!=null&&a.includes("Wildcard on non-extended resolvers is not supported")||t==="reverse"&&n.reason===yl[50]):!1}function b1(e){const{abi:t,data:n}=e,r=or(n,0,4),o=t.find(s=>s.type==="function"&&r===jr(gt(s)));if(!o)throw new sg(r,{docsPath:"/docs/contract/decodeFunctionData"});return{functionName:o.name,args:"inputs"in o&&o.inputs&&o.inputs.length>0?Ur(o.inputs,or(n,4)):void 0}}const la="/docs/contract/encodeErrorResult";function Mf(e){const{abi:t,errorName:n,args:r}=e;let o=t[0];if(n){const a=On({abi:t,args:r,name:n});if(!a)throw new Bu(n,{docsPath:la});o=a}if(o.type!=="error")throw new Bu(void 0,{docsPath:la});const s=gt(o),i=jr(s);let c="0x";if(r&&r.length>0){if(!o.inputs)throw new rg(o.name,{docsPath:la});c=Kt(o.inputs,r)}return rr([i,c])}const fa="/docs/contract/encodeFunctionResult";function y1(e){const{abi:t,functionName:n,result:r}=e;let o=t[0];if(n){const i=On({abi:t,name:n});if(!i)throw new Yn(n,{docsPath:fa});o=i}if(o.type!=="function")throw new Yn(void 0,{docsPath:fa});if(!o.outputs)throw new Ru(o.name,{docsPath:fa});const s=(()=>{if(o.outputs.length===0)return[];if(o.outputs.length===1)return[r];if(Array.isArray(r))return r;throw new ju(r)})();return Kt(o.outputs,s)}const us="x-batch-gateway:true";async function kf(e){const{data:t,ccipRequest:n}=e,{args:[r]}=b1({abi:ea,data:t}),o=[],s=[];return await Promise.all(r.map(async(i,c)=>{try{s[c]=i.urls.includes(us)?await kf({data:i.data,ccipRequest:n}):await n(i),o[c]=!1}catch(a){o[c]=!0,s[c]=w1(a)}})),y1({abi:ea,functionName:"query",result:[o,s]})}function w1(e){return e.name==="HttpRequestError"&&e.status?Mf({abi:ea,errorName:"HttpError",args:[e.status,e.shortMessage]}):Mf({abi:[wl],errorName:"Error",args:["shortMessage"in e?e.shortMessage:e.message]})}function Bf(e){if(e.length!==66||e.indexOf("[")!==0||e.indexOf("]")!==65)return null;const t=`0x${e.slice(1,65)}`;return bt(t)?t:null}function ls(e){let t=new Uint8Array(32).fill(0);if(!e)return $e(t);const n=e.split(".");for(let r=n.length-1;r>=0;r-=1){const o=Bf(n[r]),s=o?Qn(o):Ie(Tn(n[r]),"bytes");t=Ie(vt([t,s]),"bytes")}return $e(t)}function v1(e){return`[${e.slice(2)}]`}function x1(e){const t=new Uint8Array(32).fill(0);return e?Bf(e)||Ie(Tn(e)):$e(t)}function fs(e){const t=e.replace(/^\.|\.$/gm,"");if(t.length===0)return new Uint8Array(1);const n=new Uint8Array(Tn(t).byteLength+2);let r=0;const o=t.split(".");for(let s=0;s<o.length;s++){let i=Tn(o[s]);i.byteLength>255&&(i=Tn(v1(x1(o[s])))),n[r]=i.length,n.set(i,r+1),r+=i.length+1}return n.byteLength!==r+1?n.slice(0,r+1):n}async function E1(e,t){const{blockNumber:n,blockTag:r,coinType:o,name:s,gatewayUrls:i,strict:c}=t,{chain:a}=e,u=(()=>{if(t.universalResolverAddress)return t.universalResolverAddress;if(!a)throw new Error("client chain not configured. universalResolverAddress is required.");return fr({blockNumber:n,chain:a,contract:"ensUniversalResolver"})})(),l=a==null?void 0:a.ensTlds;if(l&&!l.some(f=>s.endsWith(f)))return null;try{const f=Nt({abi:Ef,functionName:"addr",...o!=null?{args:[ls(s),BigInt(o)]}:{args:[ls(s)]}}),p={address:u,abi:vf,functionName:"resolve",args:[Vt(fs(s)),f,i??[us]],blockNumber:n,blockTag:r},h=await ee(e,Jt,"readContract")(p);if(h[0]==="0x")return null;const m=kn({abi:Ef,args:o!=null?[ls(s),BigInt(o)]:void 0,functionName:"addr",data:h[0]});return m==="0x"||$n(m)==="0x00"?null:m}catch(f){if(c)throw f;if(ua(f,"resolve"))return null;throw f}}class S1 extends G{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 go extends G{constructor({reason:t}){super(`ENS NFT avatar URI is invalid. ${t}`,{name:"EnsAvatarInvalidNftUriError"})}}class da extends G{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 P1 extends G{constructor({namespace:t}){super(`ENS NFT avatar namespace "${t}" is not supported. Must be "erc721" or "erc1155".`,{name:"EnsAvatarUnsupportedNamespaceError"})}}const $1=/(?<protocol>https?:\/\/[^\/]*|ipfs:\/|ipns:\/|ar:\/)?(?<root>\/)?(?<subpath>ipfs\/|ipns\/)?(?<target>[\w\-.]+)(?<subtarget>\/.*)?/,T1=/^(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>\/.*)?$/,A1=/^data:([a-zA-Z\-/+]*);base64,([^"].*)/,O1=/^data:([a-zA-Z\-/+]*)?(;[a-zA-Z0-9].*?)?(,)/;async function C1(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"||!globalThis.hasOwnProperty("Image")?!1:new Promise(n=>{const r=new Image;r.onload=()=>{n(!0)},r.onerror=()=>{n(!1)},r.src=e})}}function Lf(e,t){return e?e.endsWith("/")?e.slice(0,-1):e:t}function Ff({uri:e,gatewayUrls:t}){const n=A1.test(e);if(n)return{uri:e,isOnChain:!0,isEncoded:n};const r=Lf(t==null?void 0:t.ipfs,"https://ipfs.io"),o=Lf(t==null?void 0:t.arweave,"https://arweave.net"),s=e.match($1),{protocol:i,subpath:c,target:a,subtarget:u=""}=(s==null?void 0:s.groups)||{},l=i==="ipns:/"||c==="ipns/",f=i==="ipfs:/"||c==="ipfs/"||T1.test(e);if(e.startsWith("http")&&!l&&!f){let d=e;return t!=null&&t.arweave&&(d=e.replace(/https:\/\/arweave.net/g,t==null?void 0:t.arweave)),{uri:d,isOnChain:!1,isEncoded:!1}}if((l||f)&&a)return{uri:`${r}/${l?"ipns":"ipfs"}/${a}${u}`,isOnChain:!1,isEncoded:!1};if(i==="ar:/"&&a)return{uri:`${o}/${a}${u||""}`,isOnChain:!1,isEncoded:!1};let p=e.replace(O1,"");if(p.startsWith("<svg")&&(p=`data:image/svg+xml;base64,${btoa(p)}`),p.startsWith("data:")||p.startsWith("{"))return{uri:p,isOnChain:!0,isEncoded:!1};throw new da({uri:e})}function Df(e){if(typeof e!="object"||!("image"in e)&&!("image_url"in e)&&!("image_data"in e))throw new S1({data:e});return e.image||e.image_url||e.image_data}async function N1({gatewayUrls:e,uri:t}){try{const n=await fetch(t).then(o=>o.json());return await pa({gatewayUrls:e,uri:Df(n)})}catch{throw new da({uri:t})}}async function pa({gatewayUrls:e,uri:t}){const{uri:n,isOnChain:r}=Ff({uri:t,gatewayUrls:e});if(r||await C1(n))return n;throw new da({uri:t})}function I1(e){let t=e;t.startsWith("did:nft:")&&(t=t.replace("did:nft:","").replace(/_/g,"/"));const[n,r,o]=t.split("/"),[s,i]=n.split(":"),[c,a]=r.split(":");if(!s||s.toLowerCase()!=="eip155")throw new go({reason:"Only EIP-155 supported"});if(!i)throw new go({reason:"Chain ID not found"});if(!a)throw new go({reason:"Contract address not found"});if(!o)throw new go({reason:"Token ID not found"});if(!c)throw new go({reason:"ERC namespace not found"});return{chainID:Number.parseInt(i),namespace:c.toLowerCase(),contractAddress:a,tokenID:o}}async function M1(e,{nft:t}){if(t.namespace==="erc721")return Jt(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 Jt(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 P1({namespace:t.namespace})}async function k1(e,{gatewayUrls:t,record:n}){return/eip155:/i.test(n)?B1(e,{gatewayUrls:t,record:n}):pa({uri:n,gatewayUrls:t})}async function B1(e,{gatewayUrls:t,record:n}){const r=I1(n),o=await M1(e,{nft:r}),{uri:s,isOnChain:i,isEncoded:c}=Ff({uri:o,gatewayUrls:t});if(i&&(s.includes("data:application/json;base64,")||s.startsWith("{"))){const u=c?atob(s.replace("data:application/json;base64,","")):s,l=JSON.parse(u);return pa({uri:Df(l),gatewayUrls:t})}let a=r.tokenID;return r.namespace==="erc1155"&&(a=a.replace("0x","").padStart(64,"0")),N1({gatewayUrls:t,uri:s.replace(/(?:0x)?{id}/,a)})}async function Rf(e,t){const{blockNumber:n,blockTag:r,key:o,name:s,gatewayUrls:i,strict:c}=t,{chain:a}=e,u=(()=>{if(t.universalResolverAddress)return t.universalResolverAddress;if(!a)throw new Error("client chain not configured. universalResolverAddress is required.");return fr({blockNumber:n,chain:a,contract:"ensUniversalResolver"})})(),l=a==null?void 0:a.ensTlds;if(l&&!l.some(f=>s.endsWith(f)))return null;try{const f={address:u,abi:vf,functionName:"resolve",args:[Vt(fs(s)),Nt({abi:xf,functionName:"text",args:[ls(s),o]}),i??[us]],blockNumber:n,blockTag:r},d=await ee(e,Jt,"readContract")(f);if(d[0]==="0x")return null;const h=kn({abi:xf,functionName:"text",data:d[0]});return h===""?null:h}catch(f){if(c)throw f;if(ua(f,"resolve"))return null;throw f}}async function L1(e,{blockNumber:t,blockTag:n,assetGatewayUrls:r,name:o,gatewayUrls:s,strict:i,universalResolverAddress:c}){const a=await ee(e,Rf,"getEnsText")({blockNumber:t,blockTag:n,key:"avatar",name:o,universalResolverAddress:c,gatewayUrls:s,strict:i});if(!a)return null;try{return await k1(e,{record:a,gatewayUrls:r})}catch{return null}}async function F1(e,{address:t,blockNumber:n,blockTag:r,gatewayUrls:o,strict:s,universalResolverAddress:i}){let c=i;if(!c){if(!e.chain)throw new Error("client chain not configured. universalResolverAddress is required.");c=fr({blockNumber:n,chain:e.chain,contract:"ensUniversalResolver"})}const a=`${t.toLowerCase().substring(2)}.addr.reverse`;try{const u={address:c,abi:Uy,functionName:"reverse",args:[Vt(fs(a))],blockNumber:n,blockTag:r},l=ee(e,Jt,"readContract"),[f,p]=o?await l({...u,args:[...u.args,o]}):await l(u);return t.toLowerCase()!==p.toLowerCase()?null:f}catch(u){if(s)throw u;if(ua(u,"reverse"))return null;throw u}}async function D1(e,t){const{blockNumber:n,blockTag:r,name:o}=t,{chain:s}=e,i=(()=>{if(t.universalResolverAddress)return t.universalResolverAddress;if(!s)throw new Error("client chain not configured. universalResolverAddress is required.");return fr({blockNumber:n,chain:s,contract:"ensUniversalResolver"})})(),c=s==null?void 0:s.ensTlds;if(c&&!c.some(u=>o.endsWith(u)))throw new Error(`${o} is not a valid ENS TLD (${c==null?void 0:c.join(", ")}) for chain "${s.name}" (id: ${s.id}).`);const[a]=await ee(e,Jt,"readContract")({address:i,abi:[{inputs:[{type:"bytes"}],name:"findResolver",outputs:[{type:"address"},{type:"bytes32"}],stateMutability:"view",type:"function"}],functionName:"findResolver",args:[Vt(fs(o))],blockNumber:n,blockTag:r});return a}async function jf(e,t){var v,A,w;const{account:n=e.account,blockNumber:r,blockTag:o="latest",blobs:s,data:i,gas:c,gasPrice:a,maxFeePerBlobGas:u,maxFeePerGas:l,maxPriorityFeePerGas:f,to:p,value:d,...h}=t,m=n?xt(n):void 0;try{lo(t);const B=(typeof r=="bigint"?J(r):void 0)||o,F=(w=(A=(v=e.chain)==null?void 0:v.formatters)==null?void 0:A.transactionRequest)==null?void 0:w.format,j=(F||Jo)({...Bi(h,{format:F}),from:m==null?void 0:m.address,blobs:s,data:i,gas:c,gasPrice:a,maxFeePerBlobGas:u,maxFeePerGas:l,maxPriorityFeePerGas:f,to:p,value:d}),g=await e.request({method:"eth_createAccessList",params:[j,B]});return{accessList:g.accessList,gasUsed:BigInt(g.gasUsed)}}catch(T){throw Tf(T,{...t,account:m,chain:e.chain})}}async function R1(e){const t=qo(e,{method:"eth_newBlockFilter"}),n=await e.request({method:"eth_newBlockFilter"});return{id:n,request:t(n),type:"block"}}async function _f(e,{address:t,args:n,event:r,events:o,fromBlock:s,strict:i,toBlock:c}={}){const a=o??(r?[r]:void 0),u=qo(e,{method:"eth_newFilter"});let l=[];a&&(l=[a.flatMap(d=>_r({abi:[d],eventName:d.name,args:n}))],r&&(l=l[0]));const f=await e.request({method:"eth_newFilter",params:[{address:t,fromBlock:typeof s=="bigint"?J(s):s,toBlock:typeof c=="bigint"?J(c):c,...l.length?{topics:l}:{}}]});return{abi:a,args:n,eventName:r?r.name:void 0,fromBlock:s,id:f,request:u(f),strict:!!i,toBlock:c,type:"event"}}async function Uf(e){const t=qo(e,{method:"eth_newPendingTransactionFilter"}),n=await e.request({method:"eth_newPendingTransactionFilter"});return{id:n,request:t(n),type:"transaction"}}async function j1(e){const t=await e.request({method:"eth_blobBaseFee"});return BigInt(t)}async function _1(e,{blockHash:t,blockNumber:n,blockTag:r="latest"}={}){const o=n!==void 0?J(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:[o||r]},{dedupe:!!o}),Wt(s)}async function zf(e,{address:t,blockNumber:n,blockTag:r="latest"}){const o=n!==void 0?J(n):void 0,s=await e.request({method:"eth_getCode",params:[t,o||r]},{dedupe:!!o});if(s!=="0x")return s}class U1 extends G{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 z1(e,t){const{address:n,factory:r,factoryData:o}=t;try{const[s,i,c,a,u,l,f]=await ee(e,Jt,"readContract")({abi:H1,address:n,functionName:"eip712Domain",factory:r,factoryData:o});return{domain:{name:i,version:c,chainId:Number(a),verifyingContract:u,salt:l},extensions:f,fields:s}}catch(s){const i=s;throw i.name==="ContractFunctionExecutionError"&&i.cause.name==="ContractFunctionZeroDataError"?new U1({address:n}):i}}const H1=[{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 W1(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 V1(e,{blockCount:t,blockNumber:n,blockTag:r="latest",rewardPercentiles:o}){const s=typeof n=="bigint"?J(n):void 0,i=await e.request({method:"eth_feeHistory",params:[J(t),s||r,o]},{dedupe:!!s});return W1(i)}async function G1(e,{filter:t}){const n=t.strict??!1,o=(await t.request({method:"eth_getFilterLogs",params:[t.id]})).map(s=>Xt(s));return t.abi?zi({abi:t.abi,logs:o,strict:n}):o}class q1 extends G{constructor({callbackSelector:t,cause:n,data:r,extraData:o,sender:s,urls:i}){var c;super(n.shortMessage||"An error occurred while fetching for an offchain result.",{cause:n,metaMessages:[...n.metaMessages||[],(c=n.metaMessages)!=null&&c.length?"":[],"Offchain Gateway Call:",i&&[" Gateway URL(s):",...i.map(a=>` ${Hr(a)}`)],` Sender: ${s}`,` Data: ${r}`,` Callback selector: ${t}`,` Extra data: ${o}`].flat(),name:"OffchainLookupError"})}}class Z1 extends G{constructor({result:t,url:n}){super("Offchain gateway response is malformed. Response data must be a hex value.",{metaMessages:[`Gateway URL: ${Hr(n)}`,`Response: ${Te(t)}`],name:"OffchainLookupResponseMalformedError"})}}class K1 extends G{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 Y1="0x556f1830",Hf={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 X1(e,{blockNumber:t,blockTag:n,data:r,to:o}){const{args:s}=Sl({data:r,abi:[Hf]}),[i,c,a,u,l]=s,{ccipRead:f}=e,p=f&&typeof(f==null?void 0:f.request)=="function"?f.request:Wf;try{if(!es(o,i))throw new K1({sender:i,to:o});const d=c.includes(us)?await kf({data:a,ccipRequest:p}):await p({data:a,sender:i,urls:c}),{data:h}=await po(e,{blockNumber:t,blockTag:n,data:vt([u,Kt([{type:"bytes"},{type:"bytes"}],[d,l])]),to:o});return h}catch(d){throw new q1({callbackSelector:u,cause:d,data:r,extraData:l,sender:i,urls:c})}}async function Wf({data:e,sender:t,urls:n}){var o;let r=new Error("An unknown error occurred.");for(let s=0;s<n.length;s++){const i=n[s],c=i.includes("{data}")?"GET":"POST",a=c==="POST"?{data:e,sender:t}:void 0,u=c==="POST"?{"Content-Type":"application/json"}:{};try{const l=await fetch(i.replace("{sender}",t.toLowerCase()).replace("{data}",e),{body:JSON.stringify(a),headers:u,method:c});let f;if((o=l.headers.get("Content-Type"))!=null&&o.startsWith("application/json")?f=(await l.json()).data:f=await l.text(),!l.ok){r=new Cn({body:a,details:f!=null&&f.error?Te(f.error):l.statusText,headers:l.headers,status:l.status,url:i});continue}if(!bt(f)){r=new Z1({result:f,url:i});continue}return f}catch(l){r=new Cn({body:a,details:l.message,url:i})}}throw r}const Q1=Object.freeze(Object.defineProperty({__proto__:null,ccipRequest:Wf,offchainLookup:X1,offchainLookupAbiItem:Hf,offchainLookupSignature:Y1},Symbol.toStringTag,{value:"Module"}));function J1(e){return{formatters:void 0,fees:void 0,serializers:void 0,...e}}class ew extends G{constructor({domain:t}){super(`Invalid domain "${Te(t)}".`,{metaMessages:["Must be a valid EIP-712 domain."]})}}class tw extends G{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 nw extends G{constructor({type:t}){super(`Struct type "${t}" is invalid.`,{metaMessages:["Struct type must not be a Solidity type."],name:"InvalidStructTypeError"})}}function rw(e){const{domain:t={},message:n,primaryType:r}=e,o={EIP712Domain:cw({domain:t}),...e.types};aw({domain:t,message:n,primaryType:r,types:o});const s=["0x1901"];return t&&s.push(ow({domain:t,types:o})),r!=="EIP712Domain"&&s.push(Vf({data:n,primaryType:r,types:o})),Ie(vt(s))}function ow({domain:e,types:t}){return Vf({data:e,primaryType:"EIP712Domain",types:t})}function Vf({data:e,primaryType:t,types:n}){const r=Gf({data:e,primaryType:t,types:n});return Ie(r)}function Gf({data:e,primaryType:t,types:n}){const r=[{type:"bytes32"}],o=[sw({primaryType:t,types:n})];for(const s of n[t]){const[i,c]=Zf({types:n,name:s.name,type:s.type,value:e[s.name]});r.push(i),o.push(c)}return Kt(r,o)}function sw({primaryType:e,types:t}){const n=Vt(iw({primaryType:e,types:t}));return Ie(n)}function iw({primaryType:e,types:t}){let n="";const r=qf({primaryType:e,types:t});r.delete(e);const o=[e,...Array.from(r).sort()];for(const s of o)n+=`${s}(${t[s].map(({name:i,type:c})=>`${c} ${i}`).join(",")})`;return n}function qf({primaryType:e,types:t},n=new Set){const r=e.match(/^\w*/u),o=r==null?void 0:r[0];if(n.has(o)||t[o]===void 0)return n;n.add(o);for(const s of t[o])qf({primaryType:s.type,types:t},n);return n}function Zf({types:e,name:t,type:n,value:r}){if(e[n]!==void 0)return[{type:"bytes32"},Ie(Gf({data:r,primaryType:n,types:e}))];if(n==="bytes")return r=`0x${(r.length%2?"0":"")+r.slice(2)}`,[{type:"bytes32"},Ie(r)];if(n==="string")return[{type:"bytes32"},Ie(Vt(r))];if(n.lastIndexOf("]")===n.length-1){const o=n.slice(0,n.lastIndexOf("[")),s=r.map(i=>Zf({name:t,type:o,types:e,value:i}));return[{type:"bytes32"},Ie(Kt(s.map(([i])=>i),s.map(([,i])=>i)))]}return[{type:n},r]}function aw(e){const{domain:t,message:n,primaryType:r,types:o}=e,s=(i,c)=>{for(const a of i){const{name:u,type:l}=a,f=c[u],p=l.match(dl);if(p&&(typeof f=="number"||typeof f=="bigint")){const[m,v,A]=p;J(f,{signed:v==="int",size:Number.parseInt(A)/8})}if(l==="address"&&typeof f=="string"&&!et(f))throw new pn({address:f});const d=l.match(Kg);if(d){const[m,v]=d;if(v&&xe(f)!==Number.parseInt(v))throw new ag({expectedSize:Number.parseInt(v),givenSize:xe(f)})}const h=o[l];h&&(uw(l),s(h,f))}};if(o.EIP712Domain&&t){if(typeof t!="object")throw new ew({domain:t});s(o.EIP712Domain,t)}if(r!=="EIP712Domain")if(o[r])s(o[r],n);else throw new tw({primaryType:r,types:o})}function cw({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 uw(e){if(e==="address"||e==="bool"||e==="string"||e.startsWith("bytes")||e.startsWith("uint")||e.startsWith("int"))throw new nw({type:e})}const lw=`Ethereum Signed Message:
|
|
80
|
-
`;function fw(e){const t=typeof e=="string"?Fr(e):typeof e.raw=="string"?e.raw:$e(e.raw),n=Fr(`${lw}${xe(t)}`);return vt([n,t])}function Kf(e,t){return Ie(fw(e),t)}const Yf="0x6492649264926492649264926492649264926492649264926492649264926492";function dw(e){return fl(e,-32)===Yf}function pw(e){const{address:t,data:n,signature:r,to:o="hex"}=e,s=rr([Kt([{type:"address"},{type:"bytes"},{type:"bytes"}],[t,n,r]),Yf]);return o==="hex"?s:wt(s)}class hw extends G{constructor({value:t}){super(`Number \`${t}\` is not a valid decimal number.`,{name:"InvalidDecimalNumberError"})}}function mw(e,t){if(!/^(-?)([0-9]*)\.?([0-9]*)$/.test(e))throw new hw({value:e});let[n,r="0"]=e.split(".");const o=n.startsWith("-");if(o&&(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,i,c]=[r.slice(0,t-1),r.slice(t-1,t),r.slice(t)],a=Math.round(+`${i}.${c}`);a>9?r=`${BigInt(s)+BigInt(1)}0`.padStart(s.length+1,"0"):r=`${s}${a}`,r.length>t&&(r=r.slice(1),n=`${BigInt(n)+1n}`),r=r.slice(0,t)}else r=r.padEnd(t,"0");return BigInt(`${o?"-":""}${n}${r}`)}function gw(e){return e.map(t=>({...t,value:BigInt(t.value)}))}function bw(e){return{...e,balance:e.balance?BigInt(e.balance):void 0,nonce:e.nonce?Wt(e.nonce):void 0,storageProof:e.storageProof?gw(e.storageProof):void 0}}async function yw(e,{address:t,blockNumber:n,blockTag:r,storageKeys:o}){const s=r??"latest",i=n!==void 0?J(n):void 0,c=await e.request({method:"eth_getProof",params:[t,o,i||s]});return bw(c)}async function ww(e,{address:t,blockNumber:n,blockTag:r="latest",slot:o}){const s=n!==void 0?J(n):void 0;return await e.request({method:"eth_getStorageAt",params:[t,o,s||r]})}async function ha(e,{blockHash:t,blockNumber:n,blockTag:r,hash:o,index:s}){var l,f,p;const i=r||"latest",c=n!==void 0?J(n):void 0;let a=null;if(o?a=await e.request({method:"eth_getTransactionByHash",params:[o]},{dedupe:!0}):t?a=await e.request({method:"eth_getTransactionByBlockHashAndIndex",params:[t,J(s)]},{dedupe:!0}):a=await e.request({method:"eth_getTransactionByBlockNumberAndIndex",params:[c||i,J(s)]},{dedupe:!!c}),!a)throw new Al({blockHash:t,blockNumber:n,blockTag:i,hash:o,index:s});return(((p=(f=(l=e.chain)==null?void 0:l.formatters)==null?void 0:f.transaction)==null?void 0:p.format)||jl)(a)}async function vw(e,{hash:t,transactionReceipt:n}){const[r,o]=await Promise.all([ee(e,mo,"getBlockNumber")({}),t?ee(e,ha,"getTransaction")({hash:t}):void 0]),s=(n==null?void 0:n.blockNumber)||(o==null?void 0:o.blockNumber);return s?r-s+1n:0n}async function ds(e,{hash:t}){var o,s,i;const n=await e.request({method:"eth_getTransactionReceipt",params:[t]},{dedupe:!0});if(!n)throw new Ol({hash:t});return(((i=(s=(o=e.chain)==null?void 0:o.formatters)==null?void 0:s.transactionReceipt)==null?void 0:i.format)||i1)(n)}async function xw(e,t){var A;const{account:n,allowFailure:r=!0,batchSize:o,blockNumber:s,blockTag:i,multicallAddress:c,stateOverride:a}=t,u=t.contracts,l=o??(typeof((A=e.batch)==null?void 0:A.multicall)=="object"&&e.batch.multicall.batchSize||1024);let f=c;if(!f){if(!e.chain)throw new Error("client chain not configured. multicallAddress is required.");f=fr({blockNumber:s,chain:e.chain,contract:"multicall3"})}const p=[[]];let d=0,h=0;for(let w=0;w<u.length;w++){const{abi:T,address:B,args:F,functionName:R}=u[w];try{const j=Nt({abi:T,args:F,functionName:R});h+=(j.length-2)/2,l>0&&h>l&&p[d].length>0&&(d++,h=(j.length-2)/2,p[d]=[]),p[d]=[...p[d],{allowFailure:!0,callData:j,target:B}]}catch(j){const g=cr(j,{abi:T,address:B,args:F,docsPath:"/docs/contract/multicall",functionName:R,sender:n});if(!r)throw g;p[d]=[...p[d],{allowFailure:!0,callData:"0x",target:B}]}}const m=await Promise.allSettled(p.map(w=>ee(e,Jt,"readContract")({abi:Ji,account:n,address:f,args:[w],blockNumber:s,blockTag:i,functionName:"aggregate3",stateOverride:a}))),v=[];for(let w=0;w<m.length;w++){const T=m[w];if(T.status==="rejected"){if(!r)throw T.reason;for(let F=0;F<p[w].length;F++)v.push({status:"failure",error:T.reason,result:void 0});continue}const B=T.value;for(let F=0;F<B.length;F++){const{returnData:R,success:j}=B[F],{callData:g}=p[w][F],{abi:y,address:$,functionName:k,args:N}=u[v.length];try{if(g==="0x")throw new Br;if(!j)throw new Ko({data:R});const P=kn({abi:y,args:N,data:R,functionName:k});v.push(r?{result:P,status:"success"}:P)}catch(P){const S=cr(P,{abi:y,address:$,args:N,docsPath:"/docs/contract/multicall",functionName:k});if(!r)throw S;v.push({error:S,result:void 0,status:"failure"})}}}if(v.length!==u.length)throw new G("multicall results mismatch");return v}async function ma(e,t){const{blockNumber:n,blockTag:r=e.experimental_blockTag??"latest",blocks:o,returnFullTransactions:s,traceTransfers:i,validation:c}=t;try{const a=[];for(const p of o){const d=p.blockOverrides?yf(p.blockOverrides):void 0,h=p.calls.map(v=>{const A=v,w=A.account?xt(A.account):void 0,T=A.abi?Nt(A):A.data,B={...A,data:A.dataSuffix?vt([T||"0x",A.dataSuffix]):T,from:A.from??(w==null?void 0:w.address)};return lo(B),Jo(B)}),m=p.stateOverrides?Li(p.stateOverrides):void 0;a.push({blockOverrides:d,calls:h,stateOverrides:m})}const l=(typeof n=="bigint"?J(n):void 0)||r;return(await e.request({method:"eth_simulateV1",params:[{blockStateCalls:a,returnFullTransactions:s,traceTransfers:i,validation:c},l]})).map((p,d)=>({..._l(p),calls:p.calls.map((h,m)=>{var $,k;const{abi:v,args:A,functionName:w,to:T}=o[d].calls[m],B=(($=h.error)==null?void 0:$.data)??h.returnData,F=BigInt(h.gasUsed),R=(k=h.logs)==null?void 0:k.map(N=>Xt(N)),j=h.status==="0x1"?"success":"failure",g=v&&j==="success"&&B!=="0x"?kn({abi:v,data:B,functionName:w}):null,y=(()=>{var P;if(j==="success")return;let N;if(((P=h.error)==null?void 0:P.data)==="0x"?N=new Br:h.error&&(N=new Ko(h.error)),!!N)return cr(N,{abi:v??[],address:T??"0x",args:A,functionName:w??"<unknown>"})})();return{data:B,gasUsed:F,logs:R,status:j,...j==="success"?{result:g}:{error:y}}})}))}catch(a){const u=a,l=ki(u,{});throw l instanceof Qo?u:l}}function Xf(e,t={}){const{as:n=typeof e=="string"?"Hex":"Bytes"}=t,r=il(Ay(e));return n==="Bytes"?r:pf(r)}class Ew 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 ga={checksum:new Ew(8192)}.checksum,Sw=/^0x[a-fA-F0-9]{40}$/;function ps(e,t={}){const{strict:n=!0}=t;if(!Sw.test(e))throw new Qf({address:e,cause:new $w});if(n){if(e.toLowerCase()===e)return;if(Pw(e)!==e)throw new Qf({address:e,cause:new Tw})}}function Pw(e){if(ga.has(e))return ga.get(e);ps(e,{strict:!1});const t=e.substring(2).toLowerCase(),n=Xf(Ny(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 o=`0x${r.join("")}`;return ga.set(e,o),o}function ba(e,t={}){const{strict:n=!0}=t??{};try{return ps(e,{strict:n}),!0}catch{return!1}}class Qf extends be{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 $w extends be{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 Tw extends be{constructor(){super("Address does not match its checksum counterpart."),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Address.InvalidChecksumError"})}}function ya(e){let t=!0,n="",r=0,o="",s=!1;for(let i=0;i<e.length;i++){const c=e[i];if(["(",")",","].includes(c)&&(t=!0),c==="("&&r++,c===")"&&r--,!!t){if(r===0){if(c===" "&&["event","function","error",""].includes(o))o="";else if(o+=c,c===")"){s=!0;break}continue}if(c===" "){e[i-1]!==","&&n!==","&&n!==",("&&(n="",t=!1);continue}o+=c,n+=c}}if(!s)throw new be("Unable to normalize signature.");return o}function wa(e,t){const n=typeof e,r=t.type;switch(r){case"address":return ba(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((o,s)=>wa(Object.values(e)[s],o)):/^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(o=>wa(o,{...t,type:r.replace(/(\[[0-9]{0,}\])$/,"")})):!1}}function Jf(e,t,n){for(const r in e){const o=e[r],s=t[r];if(o.type==="tuple"&&s.type==="tuple"&&"components"in o&&"components"in s)return Jf(o.components,s.components,n[r]);const i=[o.type,s.type];if(i.includes("address")&&i.includes("bytes20")?!0:i.includes("address")&&i.includes("string")?ba(n[r],{strict:!1}):i.includes("address")&&i.includes("bytes")?ba(n[r],{strict:!1}):!1)return i}}function ed(e,t={}){const{prepare:n=!0}=t,r=Array.isArray(e)||typeof e=="string"?Cu(e):e;return{...r,...n?{hash:dr(r)}:{}}}function Aw(e,t,n){const{args:r=[],prepare:o=!0}=n??{},s=Dy(t,{strict:!1}),i=e.filter(u=>s?u.type==="function"||u.type==="error"?td(u)===Qi(t,0,4):u.type==="event"?dr(u)===t:!1:"name"in u&&u.name===t);if(i.length===0)throw new va({name:t});if(i.length===1)return{...i[0],...o?{hash:dr(i[0])}:{}};let c;for(const u of i){if(!("inputs"in u))continue;if(!r||r.length===0){if(!u.inputs||u.inputs.length===0)return{...u,...o?{hash:dr(u)}:{}};continue}if(!u.inputs||u.inputs.length===0||u.inputs.length!==r.length)continue;if(r.every((f,p)=>{const d="inputs"in u&&u.inputs[p];return d?wa(f,d):!1})){if(c&&"inputs"in c&&c.inputs){const f=Jf(u.inputs,c.inputs,r);if(f)throw new Cw({abiItem:u,type:f[0]},{abiItem:c,type:f[1]})}c=u}}const a=(()=>{if(c)return c;const[u,...l]=i;return{...u,overloads:l}})();if(!a)throw new va({name:t});return{...a,...o?{hash:dr(a)}:{}}}function td(e){return Qi(dr(e),0,4)}function Ow(e){const t=typeof e=="string"?e:Ro(e);return ya(t)}function dr(e){return typeof e!="string"&&"hash"in e&&e.hash?e.hash:Xf(Xi(Ow(e)))}class Cw extends be{constructor(t,n){super("Found ambiguous types in overloaded ABI Items.",{metaMessages:[`\`${t.type}\` in \`${ya(Ro(t.abiItem))}\`, and`,`\`${n.type}\` in \`${ya(Ro(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 va extends be{constructor({name:t,data:n,type:r="item"}){const o=t?` with name "${t}"`:n?` with data "${n}"`:"";super(`ABI ${r}${o} not found.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiItem.NotFoundError"})}}const Nw=/^(.*)\[([0-9]*)\]$/,Iw=/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/,nd=/^(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 Mw({checksumAddress:e,parameters:t,values:n}){const r=[];for(let o=0;o<t.length;o++)r.push(xa({checksumAddress:e,parameter:t[o],value:n[o]}));return r}function xa({checksumAddress:e=!1,parameter:t,value:n}){const r=t,o=_w(r.type);if(o){const[s,i]=o;return Bw(n,{checksumAddress:e,length:s,parameter:{...r,type:i}})}if(r.type==="tuple")return jw(n,{checksumAddress:e,parameter:r});if(r.type==="address")return kw(n,{checksum:e});if(r.type==="bool")return Fw(n);if(r.type.startsWith("uint")||r.type.startsWith("int")){const s=r.type.startsWith("int"),[,,i="256"]=nd.exec(r.type)??[];return Dw(n,{signed:s,size:Number(i)})}if(r.type.startsWith("bytes"))return Lw(n,{type:r.type});if(r.type==="string")return Rw(n);throw new id(r.type)}function Ea(e){let t=0;for(let s=0;s<e.length;s++){const{dynamic:i,encoded:c}=e[s];i?t+=32:t+=tt(c)}const n=[],r=[];let o=0;for(let s=0;s<e.length;s++){const{dynamic:i,encoded:c}=e[s];i?(n.push(Be(t+o,{size:32})),r.push(c),o+=tt(c)):n.push(c)}return Mt(...n,...r)}function kw(e,t){const{checksum:n=!1}=t;return ps(e,{strict:n}),{dynamic:!1,encoded:Ln(e.toLowerCase())}}function Bw(e,t){const{checksumAddress:n,length:r,parameter:o}=t,s=r===null;if(!Array.isArray(e))throw new zw(e);if(!s&&e.length!==r)throw new Uw({expectedLength:r,givenLength:e.length,type:`${o.type}[${r}]`});let i=!1;const c=[];for(let a=0;a<e.length;a++){const u=xa({checksumAddress:n,parameter:o,value:e[a]});u.dynamic&&(i=!0),c.push(u)}if(s||i){const a=Ea(c);if(s){const u=Be(c.length,{size:32});return{dynamic:!0,encoded:c.length>0?Mt(u,a):u}}if(i)return{dynamic:!0,encoded:a}}return{dynamic:!1,encoded:Mt(...c.map(({encoded:a})=>a))}}function Lw(e,{type:t}){const[,n]=t.split("bytes"),r=tt(e);if(!n){let o=e;return r%32!==0&&(o=Fn(o,Math.ceil((e.length-2)/2/32)*32)),{dynamic:!0,encoded:Mt(Ln(Be(r,{size:32})),o)}}if(r!==Number.parseInt(n))throw new od({expectedSize:Number.parseInt(n),value:e});return{dynamic:!1,encoded:Fn(e)}}function Fw(e){if(typeof e!="boolean")throw new be(`Invalid boolean value: "${e}" (type: ${typeof e}). Expected: \`true\` or \`false\`.`);return{dynamic:!1,encoded:Ln(df(e))}}function Dw(e,{signed:t,size:n}){if(typeof n=="number"){const r=2n**(BigInt(n)-(t?1n:0n))-1n,o=t?-r-1n:0n;if(e>r||e<o)throw new hf({max:r.toString(),min:o.toString(),signed:t,size:n/8,value:e.toString()})}return{dynamic:!1,encoded:Be(e,{size:32,signed:t})}}function Rw(e){const t=Xi(e),n=Math.ceil(tt(t)/32),r=[];for(let o=0;o<n;o++)r.push(Fn(Qi(t,o*32,(o+1)*32)));return{dynamic:!0,encoded:Mt(Fn(Be(tt(t),{size:32})),...r)}}function jw(e,t){const{checksumAddress:n,parameter:r}=t;let o=!1;const s=[];for(let i=0;i<r.components.length;i++){const c=r.components[i],a=Array.isArray(e)?i:c.name,u=xa({checksumAddress:n,parameter:c,value:e[a]});s.push(u),u.dynamic&&(o=!0)}return{dynamic:o,encoded:o?Ea(s):Mt(...s.map(({encoded:i})=>i))}}function _w(e){const t=e.match(/^(.*)\[(\d+)?\]$/);return t?[t[2]?Number(t[2]):null,t[1]]:void 0}function rd(e,t,n){const{checksumAddress:r=!1}={};if(e.length!==t.length)throw new sd({expectedLength:e.length,givenLength:t.length});const o=Mw({checksumAddress:r,parameters:e,values:t}),s=Ea(o);return s.length===0?"0x":s}function Sa(e,t){if(e.length!==t.length)throw new sd({expectedLength:e.length,givenLength:t.length});const n=[];for(let r=0;r<e.length;r++){const o=e[r],s=t[r];n.push(Sa.encode(o,s))}return Mt(...n)}(function(e){function t(n,r,o=!1){if(n==="address"){const a=r;return ps(a),Ln(a.toLowerCase(),o?32:0)}if(n==="string")return Xi(r);if(n==="bytes")return r;if(n==="bool")return Ln(df(r),o?32:1);const s=n.match(nd);if(s){const[a,u,l="256"]=s,f=Number.parseInt(l)/8;return Be(r,{size:o?32:f,signed:u==="int"})}const i=n.match(Iw);if(i){const[a,u]=i;if(Number.parseInt(u)!==(r.length-2)/2)throw new od({expectedSize:Number.parseInt(u),value:r});return Fn(r,o?32:0)}const c=n.match(Nw);if(c&&Array.isArray(r)){const[a,u]=c,l=[];for(let f=0;f<r.length;f++)l.push(t(u,r[f],!0));return l.length===0?"0x":Mt(...l)}throw new id(n)}e.encode=t})(Sa||(Sa={}));class Uw extends be{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 od extends be{constructor({expectedSize:t,value:n}){super(`Size of bytes "${n}" (bytes${tt(n)}) does not match expected size (bytes${t}).`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiParameters.BytesSizeMismatchError"})}}class sd extends be{constructor({expectedLength:t,givenLength:n}){super(["ABI encoding parameters/values length mismatch.",`Expected length (parameters): ${t}`,`Given length (values): ${n}`].join(`
|
|
81
|
-
`)),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiParameters.LengthMismatchError"})}}class zw extends be{constructor(t){super(`Value \`${t}\` is not a valid array.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiParameters.InvalidArrayError"})}}class id extends be{constructor(t){super(`Type \`${t}\` is not a valid ABI Type.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiParameters.InvalidTypeError"})}}function Hw(e,t){var o;const{bytecode:n,args:r}=t;return Mt(n,(o=e.inputs)!=null&&o.length&&(r!=null&&r.length)?rd(e.inputs,r):"0x")}function Ww(e){return ed(e)}function Vw(e,...t){const{overloads:n}=e,r=n?Gw([e,...n],e.name,{args:t[0]}):e,o=qw(r),s=t.length>0?rd(r.inputs,t[0]):void 0;return s?Mt(o,s):o}function pr(e,t={}){return ed(e,t)}function Gw(e,t,n){const r=Aw(e,t,n);if(r.type!=="function")throw new va({name:t,type:"function"});return r}function qw(e){return td(e)}const Zw="0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",kt="0x0000000000000000000000000000000000000000",Kw="0x6080604052348015600e575f80fd5b5061016d8061001c5f395ff3fe608060405234801561000f575f80fd5b5060043610610029575f3560e01c8063f8b2cb4f1461002d575b5f80fd5b610047600480360381019061004291906100db565b61005d565b604051610054919061011e565b60405180910390f35b5f8173ffffffffffffffffffffffffffffffffffffffff16319050919050565b5f80fd5b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f6100aa82610081565b9050919050565b6100ba816100a0565b81146100c4575f80fd5b50565b5f813590506100d5816100b1565b92915050565b5f602082840312156100f0576100ef61007d565b5b5f6100fd848285016100c7565b91505092915050565b5f819050919050565b61011881610106565b82525050565b5f6020820190506101315f83018461010f565b9291505056fea26469706673582212203b9fe929fe995c7cf9887f0bdba8a36dd78e8b73f149b17d2d9ad7cd09d2dc6264736f6c634300081a0033";async function Yw(e,t){const{blockNumber:n,blockTag:r,calls:o,stateOverrides:s,traceAssetChanges:i,traceTransfers:c,validation:a}=t,u=t.account?xt(t.account):void 0;if(i&&!u)throw new G("`account` is required when `traceAssetChanges` is true");const l=u?Hw(Ww("constructor(bytes, bytes)"),{bytecode:Pf,args:[Kw,Vw(pr("function getBalance(address)"),[u.address])]}):void 0,f=i?await Promise.all(t.calls.map(async b=>{if(!b.data&&!b.abi)return;const{accessList:M}=await jf(e,{account:u.address,...b,data:b.abi?Nt(b):b.data});return M.map(({address:D,storageKeys:_})=>_.length>0?D:null)})).then(b=>b.flat().filter(Boolean)):[],p=await ma(e,{blockNumber:n,blockTag:r,blocks:[...i?[{calls:[{data:l}],stateOverrides:s},{calls:f.map((b,M)=>({abi:[pr("function balanceOf(address) returns (uint256)")],functionName:"balanceOf",args:[u.address],to:b,from:kt,nonce:M})),stateOverrides:[{address:kt,nonce:0}]}]:[],{calls:[...o,{}].map(b=>({...b,from:u==null?void 0:u.address})),stateOverrides:s},...i?[{calls:[{data:l}]},{calls:f.map((b,M)=>({abi:[pr("function balanceOf(address) returns (uint256)")],functionName:"balanceOf",args:[u.address],to:b,from:kt,nonce:M})),stateOverrides:[{address:kt,nonce:0}]},{calls:f.map((b,M)=>({to:b,abi:[pr("function decimals() returns (uint256)")],functionName:"decimals",from:kt,nonce:M})),stateOverrides:[{address:kt,nonce:0}]},{calls:f.map((b,M)=>({to:b,abi:[pr("function tokenURI(uint256) returns (string)")],functionName:"tokenURI",args:[0n],from:kt,nonce:M})),stateOverrides:[{address:kt,nonce:0}]},{calls:f.map((b,M)=>({to:b,abi:[pr("function symbol() returns (string)")],functionName:"symbol",from:kt,nonce:M})),stateOverrides:[{address:kt,nonce:0}]}]:[]],traceTransfers:c,validation:a}),d=i?p[2]:p[0],[h,m,,v,A,w,T,B]=i?p:[],{calls:F,...R}=d,j=F.slice(0,-1)??[],g=(h==null?void 0:h.calls)??[],y=(m==null?void 0:m.calls)??[],$=[...g,...y].map(b=>b.status==="success"?Ot(b.data):null),k=(v==null?void 0:v.calls)??[],N=(A==null?void 0:A.calls)??[],P=[...k,...N].map(b=>b.status==="success"?Ot(b.data):null),S=((w==null?void 0:w.calls)??[]).map(b=>b.status==="success"?b.result:null),E=((B==null?void 0:B.calls)??[]).map(b=>b.status==="success"?b.result:null),C=((T==null?void 0:T.calls)??[]).map(b=>b.status==="success"?b.result:null),O=[];for(const[b,M]of P.entries()){const D=$[b];if(typeof M!="bigint"||typeof D!="bigint")continue;const _=S[b-1],U=E[b-1],W=C[b-1],K=b===0?{address:Zw,decimals:18,symbol:"ETH"}:{address:f[b-1],decimals:W||_?Number(_??1):void 0,symbol:U??void 0};O.some(V=>V.token.address===K.address)||O.push({token:K,value:{pre:D,post:M,diff:M-D}})}return{assetChanges:O,block:R,results:j}}class ad extends fi{constructor(t,n){super(),this.finished=!1,this.destroyed=!1,qu(t);const r=Wo(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 o=this.blockLen,s=new Uint8Array(o);s.set(r.length>o?t.create().update(r).digest():r);for(let i=0;i<s.length;i++)s[i]^=54;this.iHash.update(s),this.oHash=t.create();for(let i=0;i<s.length;i++)s[i]^=106;this.oHash.update(s),tr(s)}update(t){return er(this),this.iHash.update(t),this}digestInto(t){er(this),qt(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:o,destroyed:s,blockLen:i,outputLen:c}=this;return t=t,t.finished=o,t.destroyed=s,t.blockLen=i,t.outputLen=c,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 cd=(e,t,n)=>new ad(e,t).update(n).digest();cd.create=(e,t)=>new ad(e,t);/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const Ue=BigInt(0),Le=BigInt(1),Dn=BigInt(2),ud=BigInt(3),ld=BigInt(4),fd=BigInt(5),Xw=BigInt(7),dd=BigInt(8),Qw=BigInt(9),pd=BigInt(16);function St(e,t){const n=e%t;return n>=Ue?n:t+n}function nt(e,t,n){let r=e;for(;t-- >Ue;)r*=r,r%=n;return r}function hd(e,t){if(e===Ue)throw new Error("invert: expected non-zero number");if(t<=Ue)throw new Error("invert: expected positive modulus, got "+t);let n=St(e,t),r=t,o=Ue,s=Le;for(;n!==Ue;){const c=r/n,a=r%n,u=o-s*c;r=n,n=a,o=s,s=u}if(r!==Le)throw new Error("invert: does not exist");return St(o,t)}function Pa(e,t,n){if(!e.eql(e.sqr(t),n))throw new Error("Cannot find square root")}function md(e,t){const n=(e.ORDER+Le)/ld,r=e.pow(t,n);return Pa(e,r,t),r}function Jw(e,t){const n=(e.ORDER-fd)/dd,r=e.mul(t,Dn),o=e.pow(r,n),s=e.mul(t,o),i=e.mul(e.mul(s,Dn),o),c=e.mul(s,e.sub(i,e.ONE));return Pa(e,c,t),c}function ev(e){const t=bo(e),n=gd(e),r=n(t,t.neg(t.ONE)),o=n(t,r),s=n(t,t.neg(r)),i=(e+Xw)/pd;return(c,a)=>{let u=c.pow(a,i),l=c.mul(u,r);const f=c.mul(u,o),p=c.mul(u,s),d=c.eql(c.sqr(l),a),h=c.eql(c.sqr(f),a);u=c.cmov(u,l,d),l=c.cmov(p,f,h);const m=c.eql(c.sqr(l),a),v=c.cmov(u,l,m);return Pa(c,v,a),v}}function gd(e){if(e<ud)throw new Error("sqrt is not defined for small field");let t=e-Le,n=0;for(;t%Dn===Ue;)t/=Dn,n++;let r=Dn;const o=bo(e);for(;yd(o,r)===1;)if(r++>1e3)throw new Error("Cannot find square root: probably non-prime P");if(n===1)return md;let s=o.pow(r,t);const i=(t+Le)/Dn;return function(a,u){if(a.is0(u))return u;if(yd(a,u)!==1)throw new Error("Cannot find square root");let l=n,f=a.mul(a.ONE,s),p=a.pow(u,t),d=a.pow(u,i);for(;!a.eql(p,a.ONE);){if(a.is0(p))return a.ZERO;let h=1,m=a.sqr(p);for(;!a.eql(m,a.ONE);)if(h++,m=a.sqr(m),h===l)throw new Error("Cannot find square root");const v=Le<<BigInt(l-h-1),A=a.pow(f,v);l=h,f=a.sqr(A),p=a.mul(p,f),d=a.mul(d,A)}return d}}function tv(e){return e%ld===ud?md:e%dd===fd?Jw:e%pd===Qw?ev(e):gd(e)}const nv=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function rv(e){const t={ORDER:"bigint",MASK:"bigint",BYTES:"number",BITS:"number"},n=nv.reduce((r,o)=>(r[o]="function",r),t);return Ki(e,n),e}function ov(e,t,n){if(n<Ue)throw new Error("invalid exponent, negatives unsupported");if(n===Ue)return e.ONE;if(n===Le)return t;let r=e.ONE,o=t;for(;n>Ue;)n&Le&&(r=e.mul(r,o)),o=e.sqr(o),n>>=Le;return r}function bd(e,t,n=!1){const r=new Array(t.length).fill(n?e.ZERO:void 0),o=t.reduce((i,c,a)=>e.is0(c)?i:(r[a]=i,e.mul(i,c)),e.ONE),s=e.inv(o);return t.reduceRight((i,c,a)=>e.is0(c)?i:(r[a]=e.mul(i,r[a]),e.mul(i,c)),s),r}function yd(e,t){const n=(e.ORDER-Le)/Dn,r=e.pow(t,n),o=e.eql(r,e.ONE),s=e.eql(r,e.ZERO),i=e.eql(r,e.neg(e.ONE));if(!o&&!s&&!i)throw new Error("invalid Legendre symbol result");return o?1:s?0:-1}function wd(e,t){t!==void 0&&Dr(t);const n=t!==void 0?t:e.toString(2).length,r=Math.ceil(n/8);return{nBitLength:n,nByteLength:r}}function bo(e,t,n=!1,r={}){if(e<=Ue)throw new Error("invalid field: expected ORDER > 0, got "+e);let o,s,i=!1,c;if(typeof t=="object"&&t!=null){if(r.sqrt||n)throw new Error("cannot specify opts in two arguments");const p=t;p.BITS&&(o=p.BITS),p.sqrt&&(s=p.sqrt),typeof p.isLE=="boolean"&&(n=p.isLE),typeof p.modFromBytes=="boolean"&&(i=p.modFromBytes),c=p.allowedLengths}else typeof t=="number"&&(o=t),r.sqrt&&(s=r.sqrt);const{nBitLength:a,nByteLength:u}=wd(e,o);if(u>2048)throw new Error("invalid field: expected ORDER of <= 2048 bytes");let l;const f=Object.freeze({ORDER:e,isLE:n,BITS:a,BYTES:u,MASK:fo(a),ZERO:Ue,ONE:Le,allowedLengths:c,create:p=>St(p,e),isValid:p=>{if(typeof p!="bigint")throw new Error("invalid field element: expected bigint, got "+typeof p);return Ue<=p&&p<e},is0:p=>p===Ue,isValidNot0:p=>!f.is0(p)&&f.isValid(p),isOdd:p=>(p&Le)===Le,neg:p=>St(-p,e),eql:(p,d)=>p===d,sqr:p=>St(p*p,e),add:(p,d)=>St(p+d,e),sub:(p,d)=>St(p-d,e),mul:(p,d)=>St(p*d,e),pow:(p,d)=>ov(f,p,d),div:(p,d)=>St(p*hd(d,e),e),sqrN:p=>p*p,addN:(p,d)=>p+d,subN:(p,d)=>p-d,mulN:(p,d)=>p*d,inv:p=>hd(p,e),sqrt:s||(p=>(l||(l=tv(e)),l(f,p))),toBytes:p=>n?of(p,u):qi(p,u),fromBytes:(p,d=!0)=>{if(c){if(!c.includes(p.length)||p.length>u)throw new Error("Field.fromBytes: expected "+c+" bytes, got "+p.length);const m=new Uint8Array(u);m.set(p,n?0:m.length-p.length),p=m}if(p.length!==u)throw new Error("Field.fromBytes: expected "+u+" bytes, got "+p.length);let h=n?rf(p):rs(p);if(i&&(h=St(h,e)),!d&&!f.isValid(h))throw new Error("invalid field element: outside of range 0..ORDER");return h},invertBatch:p=>bd(f,p),cmov:(p,d,h)=>h?d:p});return Object.freeze(f)}function vd(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 xd(e){const t=vd(e);return t+Math.ceil(t/2)}function sv(e,t,n=!1){const r=e.length,o=vd(t),s=xd(t);if(r<16||r<s||r>1024)throw new Error("expected "+s+"-1024 bytes of input, got "+r);const i=n?rf(e):rs(e),c=St(i,t-Le)+Le;return n?of(c,o):qi(c,o)}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const hr=BigInt(0),Rn=BigInt(1);function hs(e,t){const n=t.negate();return e?n:t}function $a(e,t){const n=bd(e.Fp,t.map(r=>r.Z));return t.map((r,o)=>e.fromAffine(r.toAffine(n[o])))}function Ed(e,t){if(!Number.isSafeInteger(e)||e<=0||e>t)throw new Error("invalid window size, expected [1.."+t+"], got W="+e)}function Ta(e,t){Ed(e,t);const n=Math.ceil(t/e)+1,r=2**(e-1),o=2**e,s=fo(e),i=BigInt(e);return{windows:n,windowSize:r,mask:s,maxNumber:o,shiftBy:i}}function Sd(e,t,n){const{windowSize:r,mask:o,maxNumber:s,shiftBy:i}=n;let c=Number(e&o),a=e>>i;c>r&&(c-=s,a+=Rn);const u=t*r,l=u+Math.abs(c)-1,f=c===0,p=c<0,d=t%2!==0;return{nextN:a,offset:l,isZero:f,isNeg:p,isNegF:d,offsetF:u}}function iv(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 av(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 Aa=new WeakMap,Pd=new WeakMap;function Oa(e){return Pd.get(e)||1}function $d(e){if(e!==hr)throw new Error("invalid wNAF")}class cv{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 o=t;for(;n>hr;)n&Rn&&(r=r.add(o)),o=o.double(),n>>=Rn;return r}precomputeWindow(t,n){const{windows:r,windowSize:o}=Ta(n,this.bits),s=[];let i=t,c=i;for(let a=0;a<r;a++){c=i,s.push(c);for(let u=1;u<o;u++)c=c.add(i),s.push(c);i=c.double()}return s}wNAF(t,n,r){if(!this.Fn.isValid(r))throw new Error("invalid scalar");let o=this.ZERO,s=this.BASE;const i=Ta(t,this.bits);for(let c=0;c<i.windows;c++){const{nextN:a,offset:u,isZero:l,isNeg:f,isNegF:p,offsetF:d}=Sd(r,c,i);r=a,l?s=s.add(hs(p,n[d])):o=o.add(hs(f,n[u]))}return $d(r),{p:o,f:s}}wNAFUnsafe(t,n,r,o=this.ZERO){const s=Ta(t,this.bits);for(let i=0;i<s.windows&&r!==hr;i++){const{nextN:c,offset:a,isZero:u,isNeg:l}=Sd(r,i,s);if(r=c,!u){const f=n[a];o=o.add(l?f.negate():f)}}return $d(r),o}getPrecomputes(t,n,r){let o=Aa.get(n);return o||(o=this.precomputeWindow(n,t),t!==1&&(typeof r=="function"&&(o=r(o)),Aa.set(n,o))),o}cached(t,n,r){const o=Oa(t);return this.wNAF(o,this.getPrecomputes(o,t,r),n)}unsafe(t,n,r,o){const s=Oa(t);return s===1?this._unsafeLadder(t,n,o):this.wNAFUnsafe(s,this.getPrecomputes(s,t,r),n,o)}createCache(t,n){Ed(n,this.bits),Pd.set(t,n),Aa.delete(t)}hasCache(t){return Oa(t)!==1}}function uv(e,t,n,r){let o=t,s=e.ZERO,i=e.ZERO;for(;n>hr||r>hr;)n&Rn&&(s=s.add(o)),r&Rn&&(i=i.add(o)),o=o.double(),n>>=Rn,r>>=Rn;return{p1:s,p2:i}}function lv(e,t,n,r){iv(n,e),av(r,t);const o=n.length,s=r.length;if(o!==s)throw new Error("arrays of points and scalars must have equal length");const i=e.ZERO,c=sf(BigInt(o));let a=1;c>12?a=c-3:c>4?a=c-2:c>0&&(a=2);const u=fo(a),l=new Array(Number(u)+1).fill(i),f=Math.floor((t.BITS-1)/a)*a;let p=i;for(let d=f;d>=0;d-=a){l.fill(i);for(let m=0;m<s;m++){const v=r[m],A=Number(v>>BigInt(d)&u);l[A]=l[A].add(n[m])}let h=i;for(let m=l.length-1,v=i;m>0;m--)v=v.add(l[m]),h=h.add(v);if(p=p.add(h),d!==0)for(let m=0;m<a;m++)p=p.double()}return p}function Td(e,t,n){if(t){if(t.ORDER!==e)throw new Error("Field.ORDER must match order: Fp == p, Fn == n");return rv(t),t}else return bo(e,{isLE:n})}function fv(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 a of["p","n","h"]){const u=t[a];if(!(typeof u=="bigint"&&u>hr))throw new Error(`CURVE.${a} must be positive bigint`)}const o=Td(t.p,n.Fp,r),s=Td(t.n,n.Fn,r),c=["Gx","Gy","a","b"];for(const a of c)if(!o.isValid(t[a]))throw new Error(`CURVE.${a} must be valid field element of CURVE.Fp`);return t=Object.freeze(Object.assign({},t)),{CURVE:t,Fp:o,Fn:s}}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const Ad=(e,t)=>(e+(e>=0?t:-t)/Od)/t;function dv(e,t,n){const[[r,o],[s,i]]=t,c=Ad(i*e,n),a=Ad(-o*e,n);let u=e-c*r-a*s,l=-c*o-a*i;const f=u<tn,p=l<tn;f&&(u=-u),p&&(l=-l);const d=fo(Math.ceil(sf(n)/2))+mr;if(u<tn||u>=d||l<tn||l>=d)throw new Error("splitScalar (endomorphism): failed, k="+e);return{k1neg:f,k1:u,k2neg:p,k2:l}}function Ca(e){if(!["compact","recovered","der"].includes(e))throw new Error('Signature format must be "compact", "recovered", or "der"');return e}function Na(e,t){const n={};for(let r of Object.keys(t))n[r]=e[r]===void 0?t[r]:e[r];return ts(n.lowS,"lowS"),ts(n.prehash,"prehash"),n.format!==void 0&&Ca(n.format),n}class pv extends Error{constructor(t=""){super(t)}}const en={Err:pv,_tlv:{encode:(e,t)=>{const{Err:n}=en;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,o=ns(r);if(o.length/2&128)throw new n("tlv.encode: long form length too big");const s=r>127?ns(o.length/2|128):"";return ns(e)+s+o+t},decode(e,t){const{Err:n}=en;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 o=t[r++],s=!!(o&128);let i=0;if(!s)i=o;else{const a=o&127;if(!a)throw new n("tlv.decode(long): indefinite length not supported");if(a>4)throw new n("tlv.decode(long): byte length is too big");const u=t.subarray(r,r+a);if(u.length!==a)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)i=i<<8|l;if(r+=a,i<128)throw new n("tlv.decode(long): not minimal encoding")}const c=t.subarray(r,r+i);if(c.length!==i)throw new n("tlv.decode: wrong value length");return{v:c,l:t.subarray(r+i)}}},_int:{encode(e){const{Err:t}=en;if(e<tn)throw new t("integer: negative integers are not allowed");let n=ns(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}=en;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 rs(e)}},toSig(e){const{Err:t,_int:n,_tlv:r}=en,o=_e("signature",e),{v:s,l:i}=r.decode(48,o);if(i.length)throw new t("invalid signature: left bytes after parsing");const{v:c,l:a}=r.decode(2,s),{v:u,l}=r.decode(2,a);if(l.length)throw new t("invalid signature: left bytes after parsing");return{r:n.decode(c),s:n.decode(u)}},hexFromSig(e){const{_tlv:t,_int:n}=en,r=t.encode(2,n.encode(e.r)),o=t.encode(2,n.encode(e.s)),s=r+o;return t.encode(48,s)}},tn=BigInt(0),mr=BigInt(1),Od=BigInt(2),ms=BigInt(3),hv=BigInt(4);function gr(e,t){const{BYTES:n}=e;let r;if(typeof t=="bigint")r=t;else{let o=_e("private key",t);try{r=e.fromBytes(o)}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 mv(e,t={}){const n=fv("weierstrass",e,t),{Fp:r,Fn:o}=n;let s=n.CURVE;const{h:i,n:c}=s;Ki(t,{},{allowInfinityPoint:"boolean",clearCofactor:"function",isTorsionFree:"function",fromBytes:"function",toBytes:"function",endo:"object",wrapPrivateKey:"boolean"});const{endo:a}=t;if(a&&(!r.is0(s.a)||typeof a.beta!="bigint"||!Array.isArray(a.basises)))throw new Error('invalid endo: expected "beta": bigint and "basises": array');const u=Nd(r,o);function l(){if(!r.isOdd)throw new Error("compression is not supported: Field does not have .isOdd()")}function f(N,P,S){const{x:E,y:C}=P.toAffine(),O=r.toBytes(E);if(ts(S,"isCompressed"),S){l();const b=!r.isOdd(C);return dn(Cd(b),O)}else return dn(Uint8Array.of(4),O,r.toBytes(C))}function p(N){Bn(N,void 0,"Point");const{publicKey:P,publicKeyUncompressed:S}=u,E=N.length,C=N[0],O=N.subarray(1);if(E===P&&(C===2||C===3)){const b=r.fromBytes(O);if(!r.isValid(b))throw new Error("bad point: is not on curve, wrong x");const M=m(b);let D;try{D=r.sqrt(M)}catch(W){const K=W instanceof Error?": "+W.message:"";throw new Error("bad point: is not on curve, sqrt error"+K)}l();const _=r.isOdd(D);return(C&1)===1!==_&&(D=r.neg(D)),{x:b,y:D}}else if(E===S&&C===4){const b=r.BYTES,M=r.fromBytes(O.subarray(0,b)),D=r.fromBytes(O.subarray(b,b*2));if(!v(M,D))throw new Error("bad point: is not on curve");return{x:M,y:D}}else throw new Error(`bad point: got length ${E}, expected compressed=${P} or uncompressed=${S}`)}const d=t.toBytes||f,h=t.fromBytes||p;function m(N){const P=r.sqr(N),S=r.mul(P,N);return r.add(r.add(S,r.mul(N,s.a)),s.b)}function v(N,P){const S=r.sqr(P),E=m(N);return r.eql(S,E)}if(!v(s.Gx,s.Gy))throw new Error("bad curve params: generator point");const A=r.mul(r.pow(s.a,ms),hv),w=r.mul(r.sqr(s.b),BigInt(27));if(r.is0(r.add(A,w)))throw new Error("bad curve params: a or b");function T(N,P,S=!1){if(!r.isValid(P)||S&&r.is0(P))throw new Error(`bad point coordinate ${N}`);return P}function B(N){if(!(N instanceof y))throw new Error("ProjectivePoint expected")}function F(N){if(!a||!a.basises)throw new Error("no endo");return dv(N,a.basises,o.ORDER)}const R=af((N,P)=>{const{X:S,Y:E,Z:C}=N;if(r.eql(C,r.ONE))return{x:S,y:E};const O=N.is0();P==null&&(P=O?r.ONE:r.inv(C));const b=r.mul(S,P),M=r.mul(E,P),D=r.mul(C,P);if(O)return{x:r.ZERO,y:r.ZERO};if(!r.eql(D,r.ONE))throw new Error("invZ was invalid");return{x:b,y:M}}),j=af(N=>{if(N.is0()){if(t.allowInfinityPoint&&!r.is0(N.Y))return;throw new Error("bad point: ZERO")}const{x:P,y:S}=N.toAffine();if(!r.isValid(P)||!r.isValid(S))throw new Error("bad point: x or y not field elements");if(!v(P,S))throw new Error("bad point: equation left != right");if(!N.isTorsionFree())throw new Error("bad point: not in prime-order subgroup");return!0});function g(N,P,S,E,C){return S=new y(r.mul(S.X,N),S.Y,S.Z),P=hs(E,P),S=hs(C,S),P.add(S)}class y{constructor(P,S,E){this.X=T("x",P),this.Y=T("y",S,!0),this.Z=T("z",E),Object.freeze(this)}static CURVE(){return s}static fromAffine(P){const{x:S,y:E}=P||{};if(!P||!r.isValid(S)||!r.isValid(E))throw new Error("invalid affine point");if(P instanceof y)throw new Error("projective point not allowed");return r.is0(S)&&r.is0(E)?y.ZERO:new y(S,E,r.ONE)}static fromBytes(P){const S=y.fromAffine(h(Bn(P,void 0,"point")));return S.assertValidity(),S}static fromHex(P){return y.fromBytes(_e("pointHex",P))}get x(){return this.toAffine().x}get y(){return this.toAffine().y}precompute(P=8,S=!0){return k.createCache(this,P),S||this.multiply(ms),this}assertValidity(){j(this)}hasEvenY(){const{y:P}=this.toAffine();if(!r.isOdd)throw new Error("Field doesn't support isOdd");return!r.isOdd(P)}equals(P){B(P);const{X:S,Y:E,Z:C}=this,{X:O,Y:b,Z:M}=P,D=r.eql(r.mul(S,M),r.mul(O,C)),_=r.eql(r.mul(E,M),r.mul(b,C));return D&&_}negate(){return new y(this.X,r.neg(this.Y),this.Z)}double(){const{a:P,b:S}=s,E=r.mul(S,ms),{X:C,Y:O,Z:b}=this;let M=r.ZERO,D=r.ZERO,_=r.ZERO,U=r.mul(C,C),W=r.mul(O,O),K=r.mul(b,b),V=r.mul(C,O);return V=r.add(V,V),_=r.mul(C,b),_=r.add(_,_),M=r.mul(P,_),D=r.mul(E,K),D=r.add(M,D),M=r.sub(W,D),D=r.add(W,D),D=r.mul(M,D),M=r.mul(V,M),_=r.mul(E,_),K=r.mul(P,K),V=r.sub(U,K),V=r.mul(P,V),V=r.add(V,_),_=r.add(U,U),U=r.add(_,U),U=r.add(U,K),U=r.mul(U,V),D=r.add(D,U),K=r.mul(O,b),K=r.add(K,K),U=r.mul(K,V),M=r.sub(M,U),_=r.mul(K,W),_=r.add(_,_),_=r.add(_,_),new y(M,D,_)}add(P){B(P);const{X:S,Y:E,Z:C}=this,{X:O,Y:b,Z:M}=P;let D=r.ZERO,_=r.ZERO,U=r.ZERO;const W=s.a,K=r.mul(s.b,ms);let V=r.mul(S,O),Z=r.mul(E,b),H=r.mul(C,M),Q=r.add(S,E),X=r.add(O,b);Q=r.mul(Q,X),X=r.add(V,Z),Q=r.sub(Q,X),X=r.add(S,C);let se=r.add(O,M);return X=r.mul(X,se),se=r.add(V,H),X=r.sub(X,se),se=r.add(E,C),D=r.add(b,M),se=r.mul(se,D),D=r.add(Z,H),se=r.sub(se,D),U=r.mul(W,X),D=r.mul(K,H),U=r.add(D,U),D=r.sub(Z,U),U=r.add(Z,U),_=r.mul(D,U),Z=r.add(V,V),Z=r.add(Z,V),H=r.mul(W,H),X=r.mul(K,X),Z=r.add(Z,H),H=r.sub(V,H),H=r.mul(W,H),X=r.add(X,H),V=r.mul(Z,X),_=r.add(_,V),V=r.mul(se,X),D=r.mul(Q,D),D=r.sub(D,V),V=r.mul(Q,Z),U=r.mul(se,U),U=r.add(U,V),new y(D,_,U)}subtract(P){return this.add(P.negate())}is0(){return this.equals(y.ZERO)}multiply(P){const{endo:S}=t;if(!o.isValidNot0(P))throw new Error("invalid scalar: out of range");let E,C;const O=b=>k.cached(this,b,M=>$a(y,M));if(S){const{k1neg:b,k1:M,k2neg:D,k2:_}=F(P),{p:U,f:W}=O(M),{p:K,f:V}=O(_);C=W.add(V),E=g(S.beta,U,K,b,D)}else{const{p:b,f:M}=O(P);E=b,C=M}return $a(y,[E,C])[0]}multiplyUnsafe(P){const{endo:S}=t,E=this;if(!o.isValid(P))throw new Error("invalid scalar: out of range");if(P===tn||E.is0())return y.ZERO;if(P===mr)return E;if(k.hasCache(this))return this.multiply(P);if(S){const{k1neg:C,k1:O,k2neg:b,k2:M}=F(P),{p1:D,p2:_}=uv(y,E,O,M);return g(S.beta,D,_,C,b)}else return k.unsafe(E,P)}multiplyAndAddUnsafe(P,S,E){const C=this.multiplyUnsafe(S).add(P.multiplyUnsafe(E));return C.is0()?void 0:C}toAffine(P){return R(this,P)}isTorsionFree(){const{isTorsionFree:P}=t;return i===mr?!0:P?P(y,this):k.unsafe(this,c).is0()}clearCofactor(){const{clearCofactor:P}=t;return i===mr?this:P?P(y,this):this.multiplyUnsafe(i)}isSmallOrder(){return this.multiplyUnsafe(i).is0()}toBytes(P=!0){return ts(P,"isCompressed"),this.assertValidity(),d(y,this,P)}toHex(P=!0){return nr(this.toBytes(P))}toString(){return`<Point ${this.is0()?"ZERO":this.toHex()}>`}get px(){return this.X}get py(){return this.X}get pz(){return this.Z}toRawBytes(P=!0){return this.toBytes(P)}_setWindowSize(P){this.precompute(P)}static normalizeZ(P){return $a(y,P)}static msm(P,S){return lv(y,o,P,S)}static fromPrivateKey(P){return y.BASE.multiply(gr(o,P))}}y.BASE=new y(s.Gx,s.Gy,r.ONE),y.ZERO=new y(r.ZERO,r.ONE,r.ZERO),y.Fp=r,y.Fn=o;const $=o.BITS,k=new cv(y,t.endo?Math.ceil($/2):$);return y.BASE.precompute(8),y}function Cd(e){return Uint8Array.of(e?2:3)}function Nd(e,t){return{secretKey:t.BYTES,publicKey:1+e.BYTES,publicKeyUncompressed:1+2*e.BYTES,publicKeyHasPrefix:!0,signature:2*t.BYTES}}function gv(e,t={}){const{Fn:n}=e,r=t.randomBytes||Ju,o=Object.assign(Nd(e.Fp,n),{seed:xd(n.ORDER)});function s(d){try{return!!gr(n,d)}catch{return!1}}function i(d,h){const{publicKey:m,publicKeyUncompressed:v}=o;try{const A=d.length;return h===!0&&A!==m||h===!1&&A!==v?!1:!!e.fromBytes(d)}catch{return!1}}function c(d=r(o.seed)){return sv(Bn(d,o.seed,"seed"),n.ORDER)}function a(d,h=!0){return e.BASE.multiply(gr(n,d)).toBytes(h)}function u(d){const h=c(d);return{secretKey:h,publicKey:a(h)}}function l(d){if(typeof d=="bigint")return!1;if(d instanceof e)return!0;const{secretKey:h,publicKey:m,publicKeyUncompressed:v}=o;if(n.allowedLengths||h===m)return;const A=_e("key",d).length;return A===m||A===v}function f(d,h,m=!0){if(l(d)===!0)throw new Error("first arg must be private key");if(l(h)===!1)throw new Error("second arg must be public key");const v=gr(n,d);return e.fromHex(h).multiply(v).toBytes(m)}return Object.freeze({getPublicKey:a,getSharedSecret:f,keygen:u,Point:e,utils:{isValidSecretKey:s,isValidPublicKey:i,randomSecretKey:c,isValidPrivateKey:s,randomPrivateKey:c,normPrivateKeyToScalar:d=>gr(n,d),precompute(d=8,h=e.BASE){return h.precompute(d,!1)}},lengths:o})}function bv(e,t,n={}){qu(t),Ki(n,{},{hmac:"function",lowS:"boolean",randomBytes:"function",bits2int:"function",bits2int_modN:"function"});const r=n.randomBytes||Ju,o=n.hmac||((S,...E)=>cd(t,S,dn(...E))),{Fp:s,Fn:i}=e,{ORDER:c,BITS:a}=i,{keygen:u,getPublicKey:l,getSharedSecret:f,utils:p,lengths:d}=gv(e,n),h={prehash:!1,lowS:typeof n.lowS=="boolean"?n.lowS:!1,format:void 0,extraEntropy:!1},m="compact";function v(S){const E=c>>mr;return S>E}function A(S,E){if(!i.isValidNot0(E))throw new Error(`invalid signature ${S}: out of range 1..Point.Fn.ORDER`);return E}function w(S,E){Ca(E);const C=d.signature,O=E==="compact"?C:E==="recovered"?C+1:void 0;return Bn(S,O,`${E} signature`)}class T{constructor(E,C,O){this.r=A("r",E),this.s=A("s",C),O!=null&&(this.recovery=O),Object.freeze(this)}static fromBytes(E,C=m){w(E,C);let O;if(C==="der"){const{r:_,s:U}=en.toSig(Bn(E));return new T(_,U)}C==="recovered"&&(O=E[0],C="compact",E=E.subarray(1));const b=i.BYTES,M=E.subarray(0,b),D=E.subarray(b,b*2);return new T(i.fromBytes(M),i.fromBytes(D),O)}static fromHex(E,C){return this.fromBytes(Ho(E),C)}addRecoveryBit(E){return new T(this.r,this.s,E)}recoverPublicKey(E){const C=s.ORDER,{r:O,s:b,recovery:M}=this;if(M==null||![0,1,2,3].includes(M))throw new Error("recovery id invalid");if(c*Od<C&&M>1)throw new Error("recovery id is ambiguous for h>1 curve");const _=M===2||M===3?O+c:O;if(!s.isValid(_))throw new Error("recovery id 2 or 3 invalid");const U=s.toBytes(_),W=e.fromBytes(dn(Cd((M&1)===0),U)),K=i.inv(_),V=F(_e("msgHash",E)),Z=i.create(-V*K),H=i.create(b*K),Q=e.BASE.multiplyUnsafe(Z).add(W.multiplyUnsafe(H));if(Q.is0())throw new Error("point at infinify");return Q.assertValidity(),Q}hasHighS(){return v(this.s)}toBytes(E=m){if(Ca(E),E==="der")return Ho(en.hexFromSig(this));const C=i.toBytes(this.r),O=i.toBytes(this.s);if(E==="recovered"){if(this.recovery==null)throw new Error("recovery bit must be present");return dn(Uint8Array.of(this.recovery),C,O)}return dn(C,O)}toHex(E){return nr(this.toBytes(E))}assertValidity(){}static fromCompact(E){return T.fromBytes(_e("sig",E),"compact")}static fromDER(E){return T.fromBytes(_e("sig",E),"der")}normalizeS(){return this.hasHighS()?new T(this.r,i.neg(this.s),this.recovery):this}toDERRawBytes(){return this.toBytes("der")}toDERHex(){return nr(this.toBytes("der"))}toCompactRawBytes(){return this.toBytes("compact")}toCompactHex(){return nr(this.toBytes("compact"))}}const B=n.bits2int||function(E){if(E.length>8192)throw new Error("input is too large");const C=rs(E),O=E.length*8-a;return O>0?C>>BigInt(O):C},F=n.bits2int_modN||function(E){return i.create(B(E))},R=fo(a);function j(S){return gy("num < 2^"+a,S,tn,R),i.toBytes(S)}function g(S,E){return Bn(S,void 0,"message"),E?Bn(t(S),void 0,"prehashed message"):S}function y(S,E,C){if(["recovered","canonical"].some(Z=>Z in C))throw new Error("sign() legacy options not supported");const{lowS:O,prehash:b,extraEntropy:M}=Na(C,h);S=g(S,b);const D=F(S),_=gr(i,E),U=[j(_),j(D)];if(M!=null&&M!==!1){const Z=M===!0?r(d.secretKey):M;U.push(_e("extraEntropy",Z))}const W=dn(...U),K=D;function V(Z){const H=B(Z);if(!i.isValidNot0(H))return;const Q=i.inv(H),X=e.BASE.multiply(H).toAffine(),se=i.create(X.x);if(se===tn)return;const me=i.create(Q*i.create(K+se*_));if(me===tn)return;let pe=(X.x===se?0:2)|Number(X.y&mr),ue=me;return O&&v(me)&&(ue=i.neg(me),pe^=1),new T(se,ue,pe)}return{seed:W,k2sig:V}}function $(S,E,C={}){S=_e("message",S);const{seed:O,k2sig:b}=y(S,E,C);return by(t.outputLen,i.BYTES,o)(O,b)}function k(S){let E;const C=typeof S=="string"||zo(S),O=!C&&S!==null&&typeof S=="object"&&typeof S.r=="bigint"&&typeof S.s=="bigint";if(!C&&!O)throw new Error("invalid signature, expected Uint8Array, hex string or Signature instance");if(O)E=new T(S.r,S.s);else if(C){try{E=T.fromBytes(_e("sig",S),"der")}catch(b){if(!(b instanceof en.Err))throw b}if(!E)try{E=T.fromBytes(_e("sig",S),"compact")}catch{return!1}}return E||!1}function N(S,E,C,O={}){const{lowS:b,prehash:M,format:D}=Na(O,h);if(C=_e("publicKey",C),E=g(_e("message",E),M),"strict"in O)throw new Error("options.strict was renamed to lowS");const _=D===void 0?k(S):T.fromBytes(_e("sig",S),D);if(_===!1)return!1;try{const U=e.fromBytes(C);if(b&&_.hasHighS())return!1;const{r:W,s:K}=_,V=F(E),Z=i.inv(K),H=i.create(V*Z),Q=i.create(W*Z),X=e.BASE.multiplyUnsafe(H).add(U.multiplyUnsafe(Q));return X.is0()?!1:i.create(X.x)===W}catch{return!1}}function P(S,E,C={}){const{prehash:O}=Na(C,h);return E=g(E,O),T.fromBytes(S,"recovered").recoverPublicKey(E).toBytes()}return Object.freeze({keygen:u,getPublicKey:l,getSharedSecret:f,utils:p,lengths:d,Point:e,sign:$,verify:N,recoverPublicKey:P,Signature:T,hash:t})}function yv(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(i=>Math.ceil(i/2)))):void 0;const o=bo(t.n,{BITS:e.nBitLength,allowedLengths:r,modFromBytes:e.wrapPrivateKey}),s={Fp:n,Fn:o,allowInfinityPoint:e.allowInfinityPoint,endo:e.endo,isTorsionFree:e.isTorsionFree,clearCofactor:e.clearCofactor,fromBytes:e.fromBytes,toBytes:e.toBytes};return{CURVE:t,curveOpts:s}}function wv(e){const{CURVE:t,curveOpts:n}=yv(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 vv(e,t){const n=t.Point;return Object.assign({},t,{ProjectivePoint:n,CURVE:Object.assign({},e,wd(n.Fn.ORDER,n.Fn.BITS))})}function xv(e){const{CURVE:t,curveOpts:n,hash:r,ecdsaOpts:o}=wv(e),s=mv(t,n),i=bv(s,r,o);return vv(e,i)}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */function Ev(e,t){const n=r=>xv({...e,hash:r});return{...n(t),create:n}}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const Ia={p:BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),n:BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),h:BigInt(1),a:BigInt(0),b:BigInt(7),Gx:BigInt("0x79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798"),Gy:BigInt("0x483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8")},Sv={beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),basises:[[BigInt("0x3086d221a7d46bcde86c90e49284eb15"),-BigInt("0xe4437ed6010e88286f547fa90abfe4c3")],[BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),BigInt("0x3086d221a7d46bcde86c90e49284eb15")]]},Id=BigInt(2);function Pv(e){const t=Ia.p,n=BigInt(3),r=BigInt(6),o=BigInt(11),s=BigInt(22),i=BigInt(23),c=BigInt(44),a=BigInt(88),u=e*e*e%t,l=u*u*e%t,f=nt(l,n,t)*l%t,p=nt(f,n,t)*l%t,d=nt(p,Id,t)*u%t,h=nt(d,o,t)*d%t,m=nt(h,s,t)*h%t,v=nt(m,c,t)*m%t,A=nt(v,a,t)*v%t,w=nt(A,c,t)*m%t,T=nt(w,n,t)*l%t,B=nt(T,i,t)*h%t,F=nt(B,r,t)*u%t,R=nt(F,Id,t);if(!Ma.eql(Ma.sqr(R),e))throw new Error("Cannot find square root");return R}const Ma=bo(Ia.p,{sqrt:Pv}),Md=Ev({...Ia,Fp:Ma,lowS:!0,endo:Sv},Vl),$v=Object.freeze(Object.defineProperty({__proto__:null,secp256k1:Md},Symbol.toStringTag,{value:"Module"}));function Tv({r:e,s:t,to:n="hex",v:r,yParity:o}){const s=(()=>{if(o===0||o===1)return o;if(r&&(r===27n||r===28n||r>=35n))return r%2n===0n?1:0;throw new Error("Invalid `v` or `yParity` value")})(),i=`0x${new Md.Signature(Ot(e),Ot(t)).toCompactHex()}${s===0?"1b":"1c"}`;return n==="hex"?i:wt(i)}async function ka(e,t){var f,p,d;const{address:n,factory:r,factoryData:o,hash:s,signature:i,universalSignatureVerifierAddress:c=(d=(p=(f=e.chain)==null?void 0:f.contracts)==null?void 0:p.universalSignatureVerifier)==null?void 0:d.address,...a}=t,u=bt(i)?i:typeof i=="object"&&"r"in i&&"s"in i?Tv(i):$e(i),l=await(async()=>!r&&!o||dw(u)?u:pw({address:r,data:o,signature:u}))();try{const h=c?{to:c,data:Nt({abi:Sf,functionName:"isValidSig",args:[n,s,l]}),...a}:{data:ra({abi:Sf,args:[n,s,l],bytecode:Wy}),...a},{data:m}=await ee(e,po,"call")(h);return gg(m??"0x0")}catch(h){try{if(es(An(n),await Ml({hash:s,signature:i})))return!0}catch{}if(h instanceof Cl)return!1;throw h}}async function Av(e,{address:t,message:n,factory:r,factoryData:o,signature:s,...i}){const c=Kf(n);return ka(e,{address:t,factory:r,factoryData:o,hash:c,signature:s,...i})}async function Ov(e,t){const{address:n,factory:r,factoryData:o,signature:s,message:i,primaryType:c,types:a,domain:u,...l}=t,f=rw({message:i,primaryType:c,types:a,domain:u});return ka(e,{address:n,factory:r,factoryData:o,hash:f,signature:s,...l})}function kd(e,{emitOnBegin:t=!1,emitMissed:n=!1,onBlockNumber:r,onError:o,poll:s,pollingInterval:i=e.pollingInterval}){const c=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 a;return c?(()=>{const f=Te(["watchBlockNumber",e.uid,t,n,i]);return gn(f,{onBlockNumber:r,onError:o},p=>ho(async()=>{var d;try{const h=await ee(e,mo,"getBlockNumber")({cacheTime:0});if(a){if(h===a)return;if(h-a>1&&n)for(let m=a+1n;m<h;m++)p.onBlockNumber(m,a),a=m}(!a||h>a)&&(p.onBlockNumber(h,a),a=h)}catch(h){(d=p.onError)==null||d.call(p,h)}},{emitOnBegin:t,interval:i}))})():(()=>{const f=Te(["watchBlockNumber",e.uid,t,n]);return gn(f,{onBlockNumber:r,onError:o},p=>{let d=!0,h=()=>d=!1;return(async()=>{try{const m=(()=>{if(e.transport.type==="fallback"){const A=e.transport.transports.find(w=>w.config.type==="webSocket"||w.config.type==="ipc");return A?A.value:e.transport}return e.transport})(),{unsubscribe:v}=await m.subscribe({params:["newHeads"],onData(A){var T;if(!d)return;const w=Ot((T=A.result)==null?void 0:T.number);p.onBlockNumber(w,a),a=w},onError(A){var w;(w=p.onError)==null||w.call(p,A)}});h=v,d||h()}catch(m){o==null||o(m)}})(),()=>h()})})()}async function Cv(e,t){const{checkReplacement:n=!0,confirmations:r=1,hash:o,onReplaced:s,retryCount:i=6,retryDelay:c=({count:F})=>~~(1<<F)*200,timeout:a=18e4}=t,u=Te(["waitForTransactionReceipt",e.uid,o]),l=(()=>{var F;return t.pollingInterval?t.pollingInterval:(F=e.chain)!=null&&F.experimental_preconfirmationTime?e.chain.experimental_preconfirmationTime:e.pollingInterval})();let f,p,d,h=!1,m,v;const{promise:A,resolve:w,reject:T}=Af(),B=a?setTimeout(()=>{v(),m(),T(new $b({hash:o}))},a):void 0;return m=gn(u,{onReplaced:s,resolve:w,reject:T},async F=>{if(d=await ee(e,ds,"getTransactionReceipt")({hash:o}).catch(()=>{}),d&&r<=1){clearTimeout(B),F.resolve(d),m();return}v=ee(e,kd,"watchBlockNumber")({emitMissed:!0,emitOnBegin:!0,poll:!0,pollingInterval:l,async onBlockNumber(R){const j=y=>{clearTimeout(B),v(),y(),m()};let g=R;if(!h)try{if(d){if(r>1&&(!d.blockNumber||g-d.blockNumber+1n<r))return;j(()=>F.resolve(d));return}if(n&&!f&&(h=!0,await aa(async()=>{f=await ee(e,ha,"getTransaction")({hash:o}),f.blockNumber&&(g=f.blockNumber)},{delay:c,retryCount:i}),h=!1),d=await ee(e,ds,"getTransactionReceipt")({hash:o}),r>1&&(!d.blockNumber||g-d.blockNumber+1n<r))return;j(()=>F.resolve(d))}catch(y){if(y instanceof Al||y instanceof Ol){if(!f){h=!1;return}try{p=f,h=!0;const $=await aa(()=>ee(e,It,"getBlock")({blockNumber:g,includeTransactions:!0}),{delay:c,retryCount:i,shouldRetry:({error:P})=>P instanceof Dl});h=!1;const k=$.transactions.find(({from:P,nonce:S})=>P===p.from&&S===p.nonce);if(!k||(d=await ee(e,ds,"getTransactionReceipt")({hash:k.hash}),r>1&&(!d.blockNumber||g-d.blockNumber+1n<r)))return;let N="replaced";k.to===p.to&&k.value===p.value&&k.input===p.input?N="repriced":k.from===k.to&&k.value===0n&&(N="cancelled"),j(()=>{var P;(P=F.onReplaced)==null||P.call(F,{reason:N,replacedTransaction:p,transaction:k,transactionReceipt:d}),F.resolve(d)})}catch($){j(()=>F.reject($))}}else j(()=>F.reject(y))}}})}),A}function Nv(e,{blockTag:t=e.experimental_blockTag??"latest",emitMissed:n=!1,emitOnBegin:r=!1,onBlock:o,onError:s,includeTransactions:i,poll:c,pollingInterval:a=e.pollingInterval}){const u=typeof c<"u"?c:!(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=i??!1;let f;return u?(()=>{const h=Te(["watchBlocks",e.uid,t,n,r,l,a]);return gn(h,{onBlock:o,onError:s},m=>ho(async()=>{var v;try{const A=await ee(e,It,"getBlock")({blockTag:t,includeTransactions:l});if(A.number!==null&&(f==null?void 0:f.number)!=null){if(A.number===f.number)return;if(A.number-f.number>1&&n)for(let w=(f==null?void 0:f.number)+1n;w<A.number;w++){const T=await ee(e,It,"getBlock")({blockNumber:w,includeTransactions:l});m.onBlock(T,f),f=T}}((f==null?void 0:f.number)==null||t==="pending"&&(A==null?void 0:A.number)==null||A.number!==null&&A.number>f.number)&&(m.onBlock(A,f),f=A)}catch(A){(v=m.onError)==null||v.call(m,A)}},{emitOnBegin:r,interval:a}))})():(()=>{let h=!0,m=!0,v=()=>h=!1;return(async()=>{try{r&&ee(e,It,"getBlock")({blockTag:t,includeTransactions:l}).then(T=>{h&&m&&(o(T,void 0),m=!1)}).catch(s);const A=(()=>{if(e.transport.type==="fallback"){const T=e.transport.transports.find(B=>B.config.type==="webSocket"||B.config.type==="ipc");return T?T.value:e.transport}return e.transport})(),{unsubscribe:w}=await A.subscribe({params:["newHeads"],async onData(T){var F;if(!h)return;const B=await ee(e,It,"getBlock")({blockNumber:(F=T.result)==null?void 0:F.number,includeTransactions:l}).catch(()=>{});h&&(o(B,f),m=!1,f=B)},onError(T){s==null||s(T)}});v=w,h||v()}catch(A){s==null||s(A)}})(),()=>v()})()}function Iv(e,{address:t,args:n,batch:r=!0,event:o,events:s,fromBlock:i,onError:c,onLogs:a,poll:u,pollingInterval:l=e.pollingInterval,strict:f}){const p=typeof u<"u"?u:typeof i=="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")),d=f??!1;return p?(()=>{const v=Te(["watchEvent",t,n,r,e.uid,o,l,i]);return gn(v,{onLogs:a,onError:c},A=>{let w;i!==void 0&&(w=i-1n);let T,B=!1;const F=ho(async()=>{var R;if(!B){try{T=await ee(e,_f,"createEventFilter")({address:t,args:n,event:o,events:s,strict:d,fromBlock:i})}catch{}B=!0;return}try{let j;if(T)j=await ee(e,os,"getFilterChanges")({filter:T});else{const g=await ee(e,mo,"getBlockNumber")({});w&&w!==g?j=await ee(e,Hi,"getLogs")({address:t,args:n,event:o,events:s,fromBlock:w+1n,toBlock:g}):j=[],w=g}if(j.length===0)return;if(r)A.onLogs(j);else for(const g of j)A.onLogs([g])}catch(j){T&&j instanceof In&&(B=!1),(R=A.onError)==null||R.call(A,j)}},{emitOnBegin:!0,interval:l});return async()=>{T&&await ee(e,ss,"uninstallFilter")({filter:T}),F()}})})():(()=>{let v=!0,A=()=>v=!1;return(async()=>{try{const w=(()=>{if(e.transport.type==="fallback"){const R=e.transport.transports.find(j=>j.config.type==="webSocket"||j.config.type==="ipc");return R?R.value:e.transport}return e.transport})(),T=s??(o?[o]:void 0);let B=[];T&&(B=[T.flatMap(j=>_r({abi:[j],eventName:j.name,args:n}))],o&&(B=B[0]));const{unsubscribe:F}=await w.subscribe({params:["logs",{address:t,topics:B}],onData(R){var g;if(!v)return;const j=R.result;try{const{eventName:y,args:$}=Ui({abi:T??[],data:j.data,topics:j.topics,strict:d}),k=Xt(j,{args:$,eventName:y});a([k])}catch(y){let $,k;if(y instanceof Lr||y instanceof _o){if(f)return;$=y.abiItem.name,k=(g=y.abiItem.inputs)==null?void 0:g.some(P=>!("name"in P&&P.name))}const N=Xt(j,{args:k?[]:{},eventName:$});a([N])}},onError(R){c==null||c(R)}});A=F,v||A()}catch(w){c==null||c(w)}})(),()=>A()})()}function Mv(e,{batch:t=!0,onError:n,onTransactions:r,poll:o,pollingInterval:s=e.pollingInterval}){return(typeof o<"u"?o:e.transport.type!=="webSocket"&&e.transport.type!=="ipc")?(()=>{const u=Te(["watchPendingTransactions",e.uid,t,s]);return gn(u,{onTransactions:r,onError:n},l=>{let f;const p=ho(async()=>{var d;try{if(!f)try{f=await ee(e,Uf,"createPendingTransactionFilter")({});return}catch(m){throw p(),m}const h=await ee(e,os,"getFilterChanges")({filter:f});if(h.length===0)return;if(t)l.onTransactions(h);else for(const m of h)l.onTransactions([m])}catch(h){(d=l.onError)==null||d.call(l,h)}},{emitOnBegin:!0,interval:s});return async()=>{f&&await ee(e,ss,"uninstallFilter")({filter:f}),p()}})})():(()=>{let u=!0,l=()=>u=!1;return(async()=>{try{const{unsubscribe:f}=await e.transport.subscribe({params:["newPendingTransactions"],onData(p){if(!u)return;const d=p.result;r([d])},onError(p){n==null||n(p)}});l=f,u||l()}catch(f){n==null||n(f)}})(),()=>l()})()}function kv(e){var f,p,d;const{scheme:t,statement:n,...r}=((f=e.match(Bv))==null?void 0:f.groups)??{},{chainId:o,expirationTime:s,issuedAt:i,notBefore:c,requestId:a,...u}=((p=e.match(Lv))==null?void 0:p.groups)??{},l=(d=e.split("Resources:")[1])==null?void 0:d.split(`
|
|
82
|
-
- `).slice(1);return{...r,...u,...o?{chainId:Number(o)}:{},...s?{expirationTime:new Date(s)}:{},...i?{issuedAt:new Date(i)}:{},...c?{notBefore:new Date(c)}:{},...a?{requestId:a}:{},...l?{resources:l}:{},...t?{scheme:t}:{},...n?{statement:n}:{}}}const Bv=/^(?:(?<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)?/,Lv=/(?: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 Fv(e){const{address:t,domain:n,message:r,nonce:o,scheme:s,time:i=new Date}=e;if(n&&r.domain!==n||o&&r.nonce!==o||s&&r.scheme!==s||r.expirationTime&&i>=r.expirationTime||r.notBefore&&i<r.notBefore)return!1;try{if(!r.address||!et(r.address,{strict:!1})||t&&!es(r.address,t))return!1}catch{return!1}return!0}async function Dv(e,t){const{address:n,domain:r,message:o,nonce:s,scheme:i,signature:c,time:a=new Date,...u}=t,l=kv(o);if(!l.address||!Fv({address:n,domain:r,message:l,nonce:s,scheme:i,time:a}))return!1;const p=Kf(o);return ka(e,{address:l.address,hash:p,signature:c,...u})}function Rv(e){return{call:t=>po(e,t),createAccessList:t=>jf(e,t),createBlockFilter:()=>R1(e),createContractEventFilter:t=>gl(e,t),createEventFilter:t=>_f(e,t),createPendingTransactionFilter:()=>Uf(e),estimateContractGas:t=>dy(e,t),estimateGas:t=>_i(e,t),getBalance:t=>Jl(e,t),getBlobBaseFee:()=>j1(e),getBlock:t=>It(e,t),getBlockNumber:t=>mo(e,t),getBlockTransactionCount:t=>_1(e,t),getBytecode:t=>zf(e,t),getChainId:()=>Yl(e),getCode:t=>zf(e,t),getContractEvents:t=>tf(e,t),getEip712Domain:t=>z1(e,t),getEnsAddress:t=>E1(e,t),getEnsAvatar:t=>L1(e,t),getEnsName:t=>F1(e,t),getEnsResolver:t=>D1(e,t),getEnsText:t=>Rf(e,t),getFeeHistory:t=>V1(e,t),estimateFeesPerGas:t=>Kb(e,t),getFilterChanges:t=>os(e,t),getFilterLogs:t=>G1(e,t),getGasPrice:()=>Di(e),getLogs:t=>Hi(e,t),getProof:t=>yw(e,t),estimateMaxPriorityFeePerGas:t=>Zb(e,t),getStorageAt:t=>ww(e,t),getTransaction:t=>ha(e,t),getTransactionConfirmations:t=>vw(e,t),getTransactionCount:t=>zl(e,t),getTransactionReceipt:t=>ds(e,t),multicall:t=>xw(e,t),prepareTransactionRequest:t=>Ql(e,t),readContract:t=>Jt(e,t),sendRawTransaction:t=>o1(e,t),simulate:t=>ma(e,t),simulateBlocks:t=>ma(e,t),simulateCalls:t=>Yw(e,t),simulateContract:t=>Yy(e,t),verifyMessage:t=>Av(e,t),verifySiweMessage:t=>Dv(e,t),verifyTypedData:t=>Ov(e,t),uninstallFilter:t=>ss(e,t),waitForTransactionReceipt:t=>Cv(e,t),watchBlocks:t=>Nv(e,t),watchBlockNumber:t=>kd(e,t),watchContractEvent:t=>r1(e,t),watchEvent:t=>Iv(e,t),watchPendingTransactions:t=>Mv(e,t)}}function jv(e){const{key:t="public",name:n="Public Client"}=e;return a1({...e,key:t,name:n,type:"publicClient"}).extend(Rv)}const _v=J1({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}}});function Uv({client:e,tokenAddress:t,holder:n,decimals:r,fallbackFormatted:o="0",pollingInterval:s=12e3}){const[i,c]=x.useState(null),[a,u]=x.useState(o);return x.useEffect(()=>{let l,f;const p=async()=>{try{const d=await e.readContract({address:t,abi:lr,functionName:"balanceOf",args:[n]});c(d),u(Ei(d,r))}catch{u(o)}};p();try{l=e.watchContractEvent({address:t,abi:lr,eventName:"Transfer",args:{to:n},onLogs:()=>{p()},poll:!0,pollingInterval:s}),f=e.watchContractEvent({address:t,abi:lr,eventName:"Transfer",args:{from:n},onLogs:()=>{p()},poll:!0,pollingInterval:s})}catch{}return()=>{l==null||l(),f==null||f()}},[e,t,n,r,o,s]),{value:i,formatted:a}}const zv=()=>({openDeposit:x.useCallback(t=>{},[])}),Hv=()=>({openWithdraw:x.useCallback(t=>{},[])}),jn="MPC",Ba="EVM",Wv="spot";/**
|
|
77
|
+
`,o+=qu(r.state)),r.stateDiff&&(o+=` stateDiff:
|
|
78
|
+
`,o+=qu(r.stateDiff)),o},` State Override:
|
|
79
|
+
`).slice(0,-1)}function Xr(e){const t=Object.entries(e).map(([r,o])=>o===void 0||o===!1?null:[r,o]).filter(Boolean),n=t.reduce((r,[o])=>Math.max(r,o.length),0);return t.map(([r,o])=>` ${`${r}:`.padEnd(n+1)} ${o}`).join(`
|
|
80
|
+
`)}class Eg extends V{constructor({transaction:t}){super("Cannot infer a transaction type from provided transaction.",{metaMessages:["Provided Transaction:","{",Xr(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 Sg extends V{constructor(t,{account:n,docsPath:r,chain:o,data:s,gas:i,gasPrice:c,maxFeePerGas:a,maxPriorityFeePerGas:l,nonce:u,to:f,value:p}){var h;const d=Xr({chain:o&&`${o==null?void 0:o.name} (id: ${o==null?void 0:o.id})`,from:n==null?void 0:n.address,to:f,value:typeof p<"u"&&`${Hi(p)} ${((h=o==null?void 0:o.nativeCurrency)==null?void 0:h.symbol)||"ETH"}`,data:s,gas:i,gasPrice:typeof c<"u"&&`${Ve(c)} gwei`,maxFeePerGas:typeof a<"u"&&`${Ve(a)} gwei`,maxPriorityFeePerGas:typeof l<"u"&&`${Ve(l)} gwei`,nonce:u});super(t.shortMessage,{cause:t,docsPath:r,metaMessages:[...t.metaMessages?[...t.metaMessages," "]:[],"Request Arguments:",d].filter(Boolean),name:"TransactionExecutionError"}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.cause=t}}class Ku extends V{constructor({blockHash:t,blockNumber:n,blockTag:r,hash:o,index:s}){let i="Transaction";r&&s!==void 0&&(i=`Transaction at block time "${r}" at index "${s}"`),t&&s!==void 0&&(i=`Transaction at block hash "${t}" at index "${s}"`),n&&s!==void 0&&(i=`Transaction at block number "${n}" at index "${s}"`),o&&(i=`Transaction with hash "${o}"`),super(`${i} could not be found.`,{name:"TransactionNotFoundError"})}}class Zu extends V{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 Pg extends V{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 Tg extends V{constructor({hash:t}){super(`Timed out while waiting for transaction with hash "${t}" to be confirmed.`,{name:"WaitForTransactionReceiptTimeoutError"})}}const Ag=e=>e,Jr=e=>e;class Yu extends V{constructor(t,{account:n,docsPath:r,chain:o,data:s,gas:i,gasPrice:c,maxFeePerGas:a,maxPriorityFeePerGas:l,nonce:u,to:f,value:p,stateOverride:d}){var x;const h=n?nt(n):void 0;let m=Xr({from:h==null?void 0:h.address,to:f,value:typeof p<"u"&&`${Hi(p)} ${((x=o==null?void 0:o.nativeCurrency)==null?void 0:x.symbol)||"ETH"}`,data:s,gas:i,gasPrice:typeof c<"u"&&`${Ve(c)} gwei`,maxFeePerGas:typeof a<"u"&&`${Ve(a)} gwei`,maxPriorityFeePerGas:typeof l<"u"&&`${Ve(l)} gwei`,nonce:u});d&&(m+=`
|
|
81
|
+
${xg(d)}`),super(t.shortMessage,{cause:t,docsPath:r,metaMessages:[...t.metaMessages?[...t.metaMessages," "]:[],"Raw Call Arguments:",m].filter(Boolean),name:"CallExecutionError"}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.cause=t}}class Xu extends V{constructor(t,{abi:n,args:r,contractAddress:o,docsPath:s,functionName:i,sender:c}){const a=Rn({abi:n,args:r,name:i}),l=a?Gu({abiItem:a,args:r,includeFunctionName:!1,includeName:!1}):void 0,u=a?Tt(a,{includeName:!0}):void 0,f=Xr({address:o&&Ag(o),function:u,args:l&&l!=="()"&&`${[...Array((i==null?void 0:i.length)??0).keys()].map(()=>" ").join("")}${l}`,sender:c});super(t.shortMessage||`An unknown error occurred while executing the contract function "${i}".`,{cause:t,docsPath:s,metaMessages:[...t.metaMessages?[...t.metaMessages," "]:[],f&&"Contract Call:",f].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=o,this.functionName=i,this.sender=c}}class Gi extends V{constructor({abi:t,data:n,functionName:r,message:o}){let s,i,c,a;if(n&&n!=="0x")try{i=Hu({abi:t,data:n});const{abiItem:u,errorName:f,args:p}=i;if(f==="Error")a=p[0];else if(f==="Panic"){const[d]=p;a=rg[d]}else{const d=u?Tt(u,{includeName:!0}):void 0,h=u&&p?Gu({abiItem:u,args:p,includeFunctionName:!1,includeName:!1}):void 0;c=[d?`Error: ${d}`:"",h&&h!=="()"?` ${[...Array((f==null?void 0:f.length)??0).keys()].map(()=>" ").join("")}${h}`:""]}}catch(u){s=u}else o&&(a=o);let l;s instanceof uu&&(l=s.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://openchain.xyz/signatures?query=${l}.`]),super(a&&a!=="execution reverted"||l?[`The contract function "${r}" reverted with the following ${l?"signature":"reason"}:`,a||l].join(`
|
|
82
|
+
`):`The contract function "${r}" reverted.`,{cause: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=i,this.raw=n,this.reason=a,this.signature=l}}class Ng extends V{constructor({functionName:t}){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"})}}class Cg extends V{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 fs extends V{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}}class jn extends V{constructor({body:t,cause:n,details:r,headers:o,status:s,url:i}){super("HTTP request failed.",{cause:n,details:r,metaMessages:[s&&`Status: ${s}`,`URL: ${Jr(i)}`,t&&`Request body: ${Oe(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=o,this.status=s,this.url=i}}class qi extends V{constructor({body:t,error:n,url:r}){super("RPC Request failed.",{cause:n,details:n.message,metaMessages:[`URL: ${Jr(r)}`,`Request body: ${Oe(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 Ju extends V{constructor({body:t,url:n}){super("The request took too long to respond.",{details:"The request timed out.",metaMessages:[`URL: ${Jr(n)}`,`Request body: ${Oe(t)}`],name:"TimeoutError"}),Object.defineProperty(this,"url",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.url=n}}const Og=-1;class He extends V{constructor(t,{code:n,docsPath:r,metaMessages:o,name:s,shortMessage:i}){super(i,{cause:t,docsPath:r,metaMessages:o||(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 qi?t.code:n??Og}}class rt extends He{constructor(t,n){super(t,n),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.data=n.data}}class Qr extends He{constructor(t){super(t,{code:Qr.code,name:"ParseRpcError",shortMessage:"Invalid JSON was received by the server. An error occurred on the server while parsing the JSON text."})}}Object.defineProperty(Qr,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32700});class eo extends He{constructor(t){super(t,{code:eo.code,name:"InvalidRequestRpcError",shortMessage:"JSON is not a valid request object."})}}Object.defineProperty(eo,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32600});class to extends He{constructor(t,{method:n}={}){super(t,{code:to.code,name:"MethodNotFoundRpcError",shortMessage:`The method${n?` "${n}"`:""} does not exist / is not available.`})}}Object.defineProperty(to,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32601});class no extends He{constructor(t){super(t,{code:no.code,name:"InvalidParamsRpcError",shortMessage:["Invalid parameters were provided to the RPC method.","Double check you have provided the correct parameters."].join(`
|
|
83
|
+
`)})}}Object.defineProperty(no,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32602});class zn extends He{constructor(t){super(t,{code:zn.code,name:"InternalRpcError",shortMessage:"An internal error was received."})}}Object.defineProperty(zn,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32603});class Sn extends He{constructor(t){super(t,{code:Sn.code,name:"InvalidInputRpcError",shortMessage:["Missing or invalid parameters.","Double check you have provided the correct parameters."].join(`
|
|
84
|
+
`)})}}Object.defineProperty(Sn,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32e3});class ro extends He{constructor(t){super(t,{code:ro.code,name:"ResourceNotFoundRpcError",shortMessage:"Requested resource not found."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ResourceNotFoundRpcError"})}}Object.defineProperty(ro,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32001});class oo extends He{constructor(t){super(t,{code:oo.code,name:"ResourceUnavailableRpcError",shortMessage:"Requested resource not available."})}}Object.defineProperty(oo,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32002});class so extends He{constructor(t){super(t,{code:so.code,name:"TransactionRejectedRpcError",shortMessage:"Transaction creation failed."})}}Object.defineProperty(so,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32003});class Un extends He{constructor(t,{method:n}={}){super(t,{code:Un.code,name:"MethodNotSupportedRpcError",shortMessage:`Method${n?` "${n}"`:""} is not supported.`})}}Object.defineProperty(Un,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32004});class br extends He{constructor(t){super(t,{code:br.code,name:"LimitExceededRpcError",shortMessage:"Request exceeds defined limit."})}}Object.defineProperty(br,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32005});class io extends He{constructor(t){super(t,{code:io.code,name:"JsonRpcVersionUnsupportedError",shortMessage:"Version of JSON-RPC protocol is not supported."})}}Object.defineProperty(io,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32006});class gr extends rt{constructor(t){super(t,{code:gr.code,name:"UserRejectedRequestError",shortMessage:"User rejected the request."})}}Object.defineProperty(gr,"code",{enumerable:!0,configurable:!0,writable:!0,value:4001});class ao extends rt{constructor(t){super(t,{code:ao.code,name:"UnauthorizedProviderError",shortMessage:"The requested method and/or account has not been authorized by the user."})}}Object.defineProperty(ao,"code",{enumerable:!0,configurable:!0,writable:!0,value:4100});class co extends rt{constructor(t,{method:n}={}){super(t,{code:co.code,name:"UnsupportedProviderMethodError",shortMessage:`The Provider does not support the requested method${n?` " ${n}"`:""}.`})}}Object.defineProperty(co,"code",{enumerable:!0,configurable:!0,writable:!0,value:4200});class lo extends rt{constructor(t){super(t,{code:lo.code,name:"ProviderDisconnectedError",shortMessage:"The Provider is disconnected from all chains."})}}Object.defineProperty(lo,"code",{enumerable:!0,configurable:!0,writable:!0,value:4900});class uo extends rt{constructor(t){super(t,{code:uo.code,name:"ChainDisconnectedError",shortMessage:"The Provider is not connected to the requested chain."})}}Object.defineProperty(uo,"code",{enumerable:!0,configurable:!0,writable:!0,value:4901});class fo extends rt{constructor(t){super(t,{code:fo.code,name:"SwitchChainError",shortMessage:"An error occurred when attempting to switch chain."})}}Object.defineProperty(fo,"code",{enumerable:!0,configurable:!0,writable:!0,value:4902});class po extends rt{constructor(t){super(t,{code:po.code,name:"UnsupportedNonOptionalCapabilityError",shortMessage:"This Wallet does not support a capability that was not marked as optional."})}}Object.defineProperty(po,"code",{enumerable:!0,configurable:!0,writable:!0,value:5700});class ho extends rt{constructor(t){super(t,{code:ho.code,name:"UnsupportedChainIdError",shortMessage:"This Wallet does not support the requested chain ID."})}}Object.defineProperty(ho,"code",{enumerable:!0,configurable:!0,writable:!0,value:5710});class mo extends rt{constructor(t){super(t,{code:mo.code,name:"DuplicateIdError",shortMessage:"There is already a bundle submitted with this ID."})}}Object.defineProperty(mo,"code",{enumerable:!0,configurable:!0,writable:!0,value:5720});class bo extends rt{constructor(t){super(t,{code:bo.code,name:"UnknownBundleIdError",shortMessage:"This bundle id is unknown / has not been submitted"})}}Object.defineProperty(bo,"code",{enumerable:!0,configurable:!0,writable:!0,value:5730});class go extends rt{constructor(t){super(t,{code:go.code,name:"BundleTooLargeError",shortMessage:"The call bundle is too large for the Wallet to process."})}}Object.defineProperty(go,"code",{enumerable:!0,configurable:!0,writable:!0,value:5740});class yo extends rt{constructor(t){super(t,{code:yo.code,name:"AtomicReadyWalletRejectedUpgradeError",shortMessage:"The Wallet can support atomicity after an upgrade, but the user rejected the upgrade."})}}Object.defineProperty(yo,"code",{enumerable:!0,configurable:!0,writable:!0,value:5750});class vo extends rt{constructor(t){super(t,{code:vo.code,name:"AtomicityNotSupportedError",shortMessage:"The wallet does not support atomic execution but the request requires it."})}}Object.defineProperty(vo,"code",{enumerable:!0,configurable:!0,writable:!0,value:5760});class Ig extends He{constructor(t){super(t,{name:"UnknownRpcError",shortMessage:"An unknown RPC error occurred."})}}const $g=3;function yr(e,{abi:t,address:n,args:r,docsPath:o,functionName:s,sender:i}){const c=e instanceof fs?e:e instanceof V?e.walk(h=>"data"in h)||e.walk():{},{code:a,data:l,details:u,message:f,shortMessage:p}=c,d=e instanceof Wr?new Ng({functionName:s}):[$g,zn.code].includes(a)&&(l||u||f||p)||a===Sn.code&&u==="execution reverted"&&l?new Gi({abi:t,data:typeof l=="object"?l.data:l,functionName:s,message:c instanceof qi?u:p??f}):e;return new Xu(d,{abi:t,args:r,contractAddress:n,docsPath:o,functionName:s,sender:i})}function kg(e){const t=Me(`0x${e.substring(4)}`).substring(26);return ls(`0x${t}`)}async function Dg({hash:e,signature:t}){const n=At(e)?e:vn(e),{secp256k1:r}=await Promise.resolve().then(()=>d6);return`0x${(()=>{if(typeof t=="object"&&"r"in t&&"s"in t){const{r:l,s:u,v:f,yParity:p}=t,d=Number(p??f),h=Qu(d);return new r.Signature(Ft(l),Ft(u)).addRecoveryBit(h)}const i=At(t)?t:vn(t);if(Ee(i)!==65)throw new Error("invalid signature length");const c=Qt(`0x${i.slice(130)}`),a=Qu(c);return r.Signature.fromCompact(i.substring(2,130)).addRecoveryBit(a)})().recoverPublicKey(n.substring(2)).toHex(!1)}`}function Qu(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 ef({hash:e,signature:t}){return kg(await Dg({hash:e,signature:t}))}function Mg(e,t="hex"){const n=tf(e),r=_i(new Uint8Array(n.length));return n.encode(r),t==="hex"?Ce(r.bytes):r.bytes}function tf(e){return Array.isArray(e)?Bg(e.map(t=>tf(t))):Lg(e)}function Bg(e){const t=e.reduce((o,s)=>o+s.length,0),n=nf(t);return{length:t<=55?1+t:1+n+t,encode(o){t<=55?o.pushByte(192+t):(o.pushByte(247+n),n===1?o.pushUint8(t):n===2?o.pushUint16(t):n===3?o.pushUint24(t):o.pushUint32(t));for(const{encode:s}of e)s(o)}}}function Lg(e){const t=typeof e=="string"?Rt(e):e,n=nf(t.length);return{length:t.length===1&&t[0]<128?1:t.length<=55?1+t.length:1+n+t.length,encode(o){t.length===1&&t[0]<128?o.pushBytes(t):t.length<=55?(o.pushByte(128+t.length),o.pushBytes(t)):(o.pushByte(183+n),n===1?o.pushUint8(t.length):n===2?o.pushUint16(t.length):n===3?o.pushUint24(t.length):o.pushUint32(t.length),o.pushBytes(t))}}}function nf(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 V("Length is too large.")}function Fg(e){const{chainId:t,nonce:n,to:r}=e,o=e.contractAddress??e.address,s=Me(pr(["0x05",Mg([t?oe(t):"0x",o,n?oe(n):"0x"])]));return r==="bytes"?Rt(s):s}async function rf(e){const{authorization:t,signature:n}=e;return ef({hash:Fg(t),signature:n??t})}class Rg extends V{constructor(t,{account:n,docsPath:r,chain:o,data:s,gas:i,gasPrice:c,maxFeePerGas:a,maxPriorityFeePerGas:l,nonce:u,to:f,value:p}){var h;const d=Xr({from:n==null?void 0:n.address,to:f,value:typeof p<"u"&&`${Hi(p)} ${((h=o==null?void 0:o.nativeCurrency)==null?void 0:h.symbol)||"ETH"}`,data:s,gas:i,gasPrice:typeof c<"u"&&`${Ve(c)} gwei`,maxFeePerGas:typeof a<"u"&&`${Ve(a)} gwei`,maxPriorityFeePerGas:typeof l<"u"&&`${Ve(l)} gwei`,nonce:u});super(t.shortMessage,{cause:t,docsPath:r,metaMessages:[...t.metaMessages?[...t.metaMessages," "]:[],"Estimate Gas Arguments:",d].filter(Boolean),name:"EstimateGasExecutionError"}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.cause=t}}class vr extends V{constructor({cause:t,message:n}={}){var o;const r=(o=n==null?void 0:n.replace("execution reverted: ",""))==null?void 0:o.replace("execution reverted","");super(`Execution reverted ${r?`with reason: ${r}`:"for an unknown reason"}.`,{cause:t,name:"ExecutionRevertedError"})}}Object.defineProperty(vr,"code",{enumerable:!0,configurable:!0,writable:!0,value:3}),Object.defineProperty(vr,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/execution reverted/});class ds extends V{constructor({cause:t,maxFeePerGas:n}={}){super(`The fee cap (\`maxFeePerGas\`${n?` = ${Ve(n)} gwei`:""}) cannot be higher than the maximum allowed value (2^256-1).`,{cause:t,name:"FeeCapTooHighError"})}}Object.defineProperty(ds,"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 Ki extends V{constructor({cause:t,maxFeePerGas:n}={}){super(`The fee cap (\`maxFeePerGas\`${n?` = ${Ve(n)}`:""} gwei) cannot be lower than the block base fee.`,{cause:t,name:"FeeCapTooLowError"})}}Object.defineProperty(Ki,"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 Zi extends V{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(Zi,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/nonce too high/});class Yi extends V{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(`
|
|
85
|
+
`),{cause:t,name:"NonceTooLowError"})}}Object.defineProperty(Yi,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/nonce too low|transaction already imported|already known/});class Xi extends V{constructor({cause:t,nonce:n}={}){super(`Nonce provided for the transaction ${n?`(${n}) `:""}exceeds the maximum allowed nonce.`,{cause:t,name:"NonceMaxValueError"})}}Object.defineProperty(Xi,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/nonce has max value/});class Ji extends V{constructor({cause:t}={}){super(["The total cost (gas * gas fee + value) of executing this transaction exceeds the balance of the account."].join(`
|
|
86
|
+
`),{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(Ji,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/insufficient funds|exceeds transaction sender account balance/});class Qi extends V{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(Qi,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/intrinsic gas too high|gas limit reached/});class ea extends V{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(ea,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/intrinsic gas too low/});class ta extends V{constructor({cause:t}){super("The transaction type is not supported for this chain.",{cause:t,name:"TransactionTypeNotSupportedError"})}}Object.defineProperty(ta,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/transaction type not valid/});class ps extends V{constructor({cause:t,maxPriorityFeePerGas:n,maxFeePerGas:r}={}){super([`The provided tip (\`maxPriorityFeePerGas\`${n?` = ${Ve(n)} gwei`:""}) cannot be higher than the fee cap (\`maxFeePerGas\`${r?` = ${Ve(r)} gwei`:""}).`].join(`
|
|
87
|
+
`),{cause:t,name:"TipAboveFeeCapError"})}}Object.defineProperty(ps,"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 wo extends V{constructor({cause:t}){super(`An error occurred while executing: ${t==null?void 0:t.shortMessage}`,{cause:t,name:"UnknownNodeError"})}}function hs(e,t){const n=(e.details||"").toLowerCase(),r=e instanceof V?e.walk(o=>(o==null?void 0:o.code)===vr.code):e;return r instanceof V?new vr({cause:e,message:r.details}):vr.nodeMessage.test(n)?new vr({cause:e,message:e.details}):ds.nodeMessage.test(n)?new ds({cause:e,maxFeePerGas:t==null?void 0:t.maxFeePerGas}):Ki.nodeMessage.test(n)?new Ki({cause:e,maxFeePerGas:t==null?void 0:t.maxFeePerGas}):Zi.nodeMessage.test(n)?new Zi({cause:e,nonce:t==null?void 0:t.nonce}):Yi.nodeMessage.test(n)?new Yi({cause:e,nonce:t==null?void 0:t.nonce}):Xi.nodeMessage.test(n)?new Xi({cause:e,nonce:t==null?void 0:t.nonce}):Ji.nodeMessage.test(n)?new Ji({cause:e}):Qi.nodeMessage.test(n)?new Qi({cause:e,gas:t==null?void 0:t.gas}):ea.nodeMessage.test(n)?new ea({cause:e,gas:t==null?void 0:t.gas}):ta.nodeMessage.test(n)?new ta({cause:e}):ps.nodeMessage.test(n)?new ps({cause:e,maxFeePerGas:t==null?void 0:t.maxFeePerGas,maxPriorityFeePerGas:t==null?void 0:t.maxPriorityFeePerGas}):new wo({cause:e})}function jg(e,{docsPath:t,...n}){const r=(()=>{const o=hs(e,n);return o instanceof wo?e:o})();return new Rg(r,{docsPath:t,...n})}function ms(e,{format:t}){if(!t)return{};const n={};function r(s){const i=Object.keys(s);for(const c of i)c in e&&(n[c]=e[c]),s[c]&&typeof s[c]=="object"&&!Array.isArray(s[c])&&r(s[c])}const o=t(e||{});return r(o),n}const zg={legacy:"0x0",eip2930:"0x1",eip1559:"0x2",eip4844:"0x3",eip7702:"0x4"};function xo(e,t){const n={};return typeof e.authorizationList<"u"&&(n.authorizationList=Ug(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=>Ce(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=zg[e.type]),typeof e.value<"u"&&(n.value=oe(e.value)),n}function Ug(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 of(e){if(!(!e||e.length===0))return e.reduce((t,{slot:n,value:r})=>{if(n.length!==66)throw new bu({size:n.length,targetSize:66,type:"hex"});if(r.length!==66)throw new bu({size:r.length,targetSize:66,type:"hex"});return t[n]=r,t},{})}function _g(e){const{balance:t,nonce:n,state:r,stateDiff:o,code:s}=e,i={};if(s!==void 0&&(i.code=s),t!==void 0&&(i.balance=oe(t)),n!==void 0&&(i.nonce=oe(n)),r!==void 0&&(i.state=of(r)),o!==void 0){if(i.state)throw new wg;i.stateDiff=of(o)}return i}function na(e){if(!e)return;const t={};for(const{address:n,...r}of e){if(!dt(n,{strict:!1}))throw new wn({address:n});if(t[n])throw new vg({address:n});t[n]=_g(r)}return t}const sf=2n**256n-1n;function wr(e){const{account:t,maxFeePerGas:n,maxPriorityFeePerGas:r,to:o}=e,s=t?nt(t):void 0;if(s&&!dt(s.address))throw new wn({address:s.address});if(o&&!dt(o))throw new wn({address:o});if(n&&n>sf)throw new ds({maxFeePerGas:n});if(r&&n&&r>n)throw new ps({maxFeePerGas:n,maxPriorityFeePerGas:r})}class af extends V{constructor(){super("`baseFeeMultiplier` must be greater than 1.",{name:"BaseFeeScalarError"})}}class ra extends V{constructor(){super("Chain does not support EIP-1559 fees.",{name:"Eip1559FeesNotSupportedError"})}}class Wg extends V{constructor({maxPriorityFeePerGas:t}){super(`\`maxFeePerGas\` cannot be less than the \`maxPriorityFeePerGas\` (${Ve(t)} gwei).`,{name:"MaxFeePerGasTooLowError"})}}class cf extends V{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 lf={"0x0":"legacy","0x1":"eip2930","0x2":"eip1559","0x3":"eip4844","0x4":"eip7702"};function oa(e,t){const n={...e,blockHash:e.blockHash?e.blockHash:null,blockNumber:e.blockNumber?BigInt(e.blockNumber):null,chainId:e.chainId?Qt(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?Qt(e.nonce):void 0,to:e.to?e.to:null,transactionIndex:e.transactionIndex?Number(e.transactionIndex):null,type:e.type?lf[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=Vg(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}function Vg(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 uf(e,t){const n=(e.transactions??[]).map(r=>typeof r=="string"?r:oa(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}}async function It(e,{blockHash:t,blockNumber:n,blockTag:r=e.experimental_blockTag??"latest",includeTransactions:o}={}){var l,u,f;const s=o??!1,i=n!==void 0?oe(n):void 0;let c=null;if(t?c=await e.request({method:"eth_getBlockByHash",params:[t,s]},{dedupe:!0}):c=await e.request({method:"eth_getBlockByNumber",params:[i||r,s]},{dedupe:!!i}),!c)throw new cf({blockHash:t,blockNumber:n});return(((f=(u=(l=e.chain)==null?void 0:l.formatters)==null?void 0:u.block)==null?void 0:f.format)||uf)(c,"getBlock")}async function sa(e){const t=await e.request({method:"eth_gasPrice"});return BigInt(t)}async function Hg(e,t){return ff(e,t)}async function ff(e,t){var s,i;const{block:n,chain:r=e.chain,request:o}=t||{};try{const c=((s=r==null?void 0:r.fees)==null?void 0:s.maxPriorityFeePerGas)??((i=r==null?void 0:r.fees)==null?void 0:i.defaultPriorityFee);if(typeof c=="function"){const l=n||await te(e,It,"getBlock")({}),u=await c({block:l,client:e,request:o});if(u===null)throw new Error;return u}if(typeof c<"u")return c;const a=await e.request({method:"eth_maxPriorityFeePerGas"});return Ft(a)}catch{const[c,a]=await Promise.all([n?Promise.resolve(n):te(e,It,"getBlock")({}),te(e,sa,"getGasPrice")({})]);if(typeof c.baseFeePerGas!="bigint")throw new ra;const l=a-c.baseFeePerGas;return l<0n?0n:l}}async function Gg(e,t){return ia(e,t)}async function ia(e,t){var p,d;const{block:n,chain:r=e.chain,request:o,type:s="eip1559"}=t||{},i=await(async()=>{var h,m;return typeof((h=r==null?void 0:r.fees)==null?void 0:h.baseFeeMultiplier)=="function"?r.fees.baseFeeMultiplier({block:n,client:e,request:o}):((m=r==null?void 0:r.fees)==null?void 0:m.baseFeeMultiplier)??1.2})();if(i<1)throw new af;const a=10**(((p=i.toString().split(".")[1])==null?void 0:p.length)??0),l=h=>h*BigInt(Math.ceil(i*a))/BigInt(a),u=n||await te(e,It,"getBlock")({});if(typeof((d=r==null?void 0:r.fees)==null?void 0:d.estimateFeesPerGas)=="function"){const h=await r.fees.estimateFeesPerGas({block:n,client:e,multiply:l,request:o,type:s});if(h!==null)return h}if(s==="eip1559"){if(typeof u.baseFeePerGas!="bigint")throw new ra;const h=typeof(o==null?void 0:o.maxPriorityFeePerGas)=="bigint"?o.maxPriorityFeePerGas:await ff(e,{block:u,chain:r,request:o}),m=l(u.baseFeePerGas);return{maxFeePerGas:(o==null?void 0:o.maxFeePerGas)??m+h,maxPriorityFeePerGas:h}}return{gasPrice:(o==null?void 0:o.gasPrice)??l(await te(e,sa,"getGasPrice")({}))}}async function df(e,{address:t,blockTag:n="latest",blockNumber:r}){const o=await e.request({method:"eth_getTransactionCount",params:[t,typeof r=="bigint"?oe(r):n]},{dedupe:!!r});return Qt(o)}function pf(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=>Rt(s)):e.blobs,o=[];for(const s of r)o.push(Uint8Array.from(t.blobToKzgCommitment(s)));return n==="bytes"?o:o.map(s=>Ce(s))}function hf(e){const{kzg:t}=e,n=e.to??(typeof e.blobs[0]=="string"?"hex":"bytes"),r=typeof e.blobs[0]=="string"?e.blobs.map(i=>Rt(i)):e.blobs,o=typeof e.commitments[0]=="string"?e.commitments.map(i=>Rt(i)):e.commitments,s=[];for(let i=0;i<r.length;i++){const c=r[i],a=o[i];s.push(Uint8Array.from(t.computeBlobKzgProof(c,a)))}return n==="bytes"?s:s.map(i=>Ce(i))}function qg(e,t,n,r){if(typeof e.setBigUint64=="function")return e.setBigUint64(t,n,r);const o=BigInt(32),s=BigInt(4294967295),i=Number(n>>o&s),c=Number(n&s),a=r?4:0,l=r?0:4;e.setUint32(t+a,i,r),e.setUint32(t+l,c,r)}function Kg(e,t,n){return e&t^~e&n}function Zg(e,t,n){return e&t^e&n^t&n}class Yg extends Mi{constructor(t,n,r,o){super(),this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.blockLen=t,this.outputLen=n,this.padOffset=r,this.isLE=o,this.buffer=new Uint8Array(t),this.view=Di(this.buffer)}update(t){fr(this),t=is(t),Fn(t);const{view:n,buffer:r,blockLen:o}=this,s=t.length;for(let i=0;i<s;){const c=Math.min(o-this.pos,s-i);if(c===o){const a=Di(t);for(;o<=s-i;i+=o)this.process(a,i);continue}r.set(t.subarray(i,i+c),this.pos),this.pos+=c,i+=c,this.pos===o&&(this.process(n,0),this.pos=0)}return this.length+=t.length,this.roundClean(),this}digestInto(t){fr(this),xu(t,this),this.finished=!0;const{buffer:n,view:r,blockLen:o,isLE:s}=this;let{pos:i}=this;n[i++]=128,dr(this.buffer.subarray(i)),this.padOffset>o-i&&(this.process(r,0),i=0);for(let f=i;f<o;f++)n[f]=0;qg(r,o-8,BigInt(this.length*8),s),this.process(r,0);const c=Di(t),a=this.outputLen;if(a%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const l=a/4,u=this.get();if(l>u.length)throw new Error("_sha2: outputLen bigger than state");for(let f=0;f<l;f++)c.setUint32(4*f,u[f],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:o,finished:s,destroyed:i,pos:c}=this;return t.destroyed=i,t.finished=s,t.length=o,t.pos=c,o%n&&t.buffer.set(r),t}clone(){return this._cloneInto()}}const Pn=Uint32Array.from([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),Xg=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]),Tn=new Uint32Array(64);class Jg extends Yg{constructor(t=32){super(64,t,8,!1),this.A=Pn[0]|0,this.B=Pn[1]|0,this.C=Pn[2]|0,this.D=Pn[3]|0,this.E=Pn[4]|0,this.F=Pn[5]|0,this.G=Pn[6]|0,this.H=Pn[7]|0}get(){const{A:t,B:n,C:r,D:o,E:s,F:i,G:c,H:a}=this;return[t,n,r,o,s,i,c,a]}set(t,n,r,o,s,i,c,a){this.A=t|0,this.B=n|0,this.C=r|0,this.D=o|0,this.E=s|0,this.F=i|0,this.G=c|0,this.H=a|0}process(t,n){for(let f=0;f<16;f++,n+=4)Tn[f]=t.getUint32(n,!1);for(let f=16;f<64;f++){const p=Tn[f-15],d=Tn[f-2],h=jt(p,7)^jt(p,18)^p>>>3,m=jt(d,17)^jt(d,19)^d>>>10;Tn[f]=m+Tn[f-7]+h+Tn[f-16]|0}let{A:r,B:o,C:s,D:i,E:c,F:a,G:l,H:u}=this;for(let f=0;f<64;f++){const p=jt(c,6)^jt(c,11)^jt(c,25),d=u+p+Kg(c,a,l)+Xg[f]+Tn[f]|0,m=(jt(r,2)^jt(r,13)^jt(r,22))+Zg(r,o,s)|0;u=l,l=a,a=c,c=i+d|0,i=s,s=o,o=r,r=d+m|0}r=r+this.A|0,o=o+this.B|0,s=s+this.C|0,i=i+this.D|0,c=c+this.E|0,a=a+this.F|0,l=l+this.G|0,u=u+this.H|0,this.set(r,o,s,i,c,a,l,u)}roundClean(){dr(Tn)}destroy(){this.set(0,0,0,0,0,0,0,0),dr(this.buffer)}}const mf=Su(()=>new Jg),Qg=mf;function ey(e,t){return Qg(At(e,{strict:!1})?lr(e):e)}function ty(e){const{commitment:t,version:n=1}=e,r=e.to??(typeof t=="string"?"hex":"bytes"),o=ey(t);return o.set([n],0),r==="bytes"?o:Ce(o)}function ny(e){const{commitments:t,version:n}=e,r=e.to,o=[];for(const s of t)o.push(ty({commitment:s,to:r,version:n}));return o}const bf=6,gf=32,aa=4096,yf=gf*aa,vf=yf*bf-1-1*aa*bf;class ry extends V{constructor({maxSize:t,size:n}){super("Blob size is too large.",{metaMessages:[`Max: ${t} bytes`,`Given: ${n} bytes`],name:"BlobSizeTooLargeError"})}}class oy extends V{constructor(){super("Blob data must not be empty.",{name:"EmptyBlobError"})}}function sy(e){const t=typeof e.data=="string"?Rt(e.data):e.data,n=Ee(t);if(!n)throw new oy;if(n>vf)throw new ry({maxSize:vf,size:n});const r=[];let o=!0,s=0;for(;o;){const i=_i(new Uint8Array(yf));let c=0;for(;c<aa;){const a=t.slice(s,s+(gf-1));if(i.pushByte(0),i.pushBytes(a),a.length<31){i.pushByte(128),o=!1;break}c++,s+=31}r.push(i)}return r.map(i=>Ce(i.bytes))}function iy(e){const{data:t,kzg:n,to:r}=e,o=e.blobs??sy({data:t}),s=e.commitments??pf({blobs:o,kzg:n,to:r}),i=e.proofs??hf({blobs:o,commitments:s,kzg:n,to:r}),c=[];for(let a=0;a<o.length;a++)c.push({blob:o[a],commitment:s[a],proof:i[a]});return c}function ay(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 Eg({transaction:e})}function cy(e,{docsPath:t,...n}){const r=(()=>{const o=hs(e,n);return o instanceof wo?e:o})();return new Sg(r,{docsPath:t,...n})}async function ca(e){const t=await e.request({method:"eth_chainId"},{dedupe:!0});return Qt(t)}async function wf(e,t){var b,g,w,O,C;const{account:n=e.account,accessList:r,authorizationList:o,chain:s=e.chain,blobVersionedHashes:i,blobs:c,data:a,gas:l,gasPrice:u,maxFeePerBlobGas:f,maxFeePerGas:p,maxPriorityFeePerGas:d,nonce:h,nonceManager:m,to:x,type:P,value:E,...T}=t,N=await(async()=>{if(!n||!m||typeof h<"u")return h;const I=nt(n),k=s?s.id:await te(e,ca,"getChainId")({});return await m.consume({address:I.address,chainId:k,client:e})})();wr(t);const M=(g=(b=s==null?void 0:s.formatters)==null?void 0:b.transactionRequest)==null?void 0:g.format,L=(M||xo)({...ms(T,{format:M}),account:n?nt(n):void 0,accessList:r,authorizationList:o,blobs:c,blobVersionedHashes:i,data:a,gas:l,gasPrice:u,maxFeePerBlobGas:f,maxFeePerGas:p,maxPriorityFeePerGas:d,nonce:N,to:x,type:P,value:E},"fillTransaction");try{const I=await e.request({method:"eth_fillTransaction",params:[L]}),y=(((O=(w=s==null?void 0:s.formatters)==null?void 0:w.transaction)==null?void 0:O.format)||oa)(I.tx);delete y.blockHash,delete y.blockNumber,delete y.r,delete y.s,delete y.transactionIndex,delete y.v,delete y.yParity,y.data=y.input,y.gas&&(y.gas=t.gas??y.gas),y.gasPrice&&(y.gasPrice=t.gasPrice??y.gasPrice),y.maxFeePerBlobGas&&(y.maxFeePerBlobGas=t.maxFeePerBlobGas??y.maxFeePerBlobGas),y.maxFeePerGas&&(y.maxFeePerGas=t.maxFeePerGas??y.maxFeePerGas),y.maxPriorityFeePerGas&&(y.maxPriorityFeePerGas=t.maxPriorityFeePerGas??y.maxPriorityFeePerGas),y.nonce&&(y.nonce=t.nonce??y.nonce);const A=await(async()=>{var j,_;if(typeof((j=s==null?void 0:s.fees)==null?void 0:j.baseFeeMultiplier)=="function"){const W=await te(e,It,"getBlock")({});return s.fees.baseFeeMultiplier({block:W,client:e,request:t})}return((_=s==null?void 0:s.fees)==null?void 0:_.baseFeeMultiplier)??1.2})();if(A<1)throw new af;const S=10**(((C=A.toString().split(".")[1])==null?void 0:C.length)??0),B=j=>j*BigInt(Math.ceil(A*S))/BigInt(S);return y.maxFeePerGas&&!t.maxFeePerGas&&(y.maxFeePerGas=B(y.maxFeePerGas)),y.gasPrice&&!t.gasPrice&&(y.gasPrice=B(y.gasPrice)),{raw:I.raw,transaction:{from:L.from,...y}}}catch(I){throw cy(I,{...t,chain:e.chain})}}const ly=["blobVersionedHashes","chainId","fees","gas","nonce","type"],xf=new Map,la=new cs(128);async function Ef(e,t){var N,M,F;let n=t;const{account:r=e.account,chain:o=e.chain,nonceManager:s,parameters:i=ly}=n,c=(()=>{if(typeof(o==null?void 0:o.prepareTransactionRequest)=="function")return{fn:o.prepareTransactionRequest,runAt:["beforeFillTransaction"]};if(Array.isArray(o==null?void 0:o.prepareTransactionRequest))return{fn:o.prepareTransactionRequest[0],runAt:o.prepareTransactionRequest[1].runAt}})();let a;async function l(){return a||(typeof n.chainId<"u"?n.chainId:o?o.id:(a=await te(e,ca,"getChainId")({}),a))}const u=r&&nt(r);let f=n.nonce;if(i.includes("nonce")&&typeof f>"u"&&u&&s){const L=await l();f=await s.consume({address:u.address,chainId:L,client:e})}c!=null&&c.fn&&((N=c.runAt)!=null&&N.includes("beforeFillTransaction"))&&(n=await c.fn(n,{phase:"beforeFillTransaction"}),f??(f=n.nonce));const d=((i.includes("blobVersionedHashes")||i.includes("sidecars"))&&n.kzg&&n.blobs||la.get(e.uid)===!1||!["fees","gas"].some(b=>i.includes(b))?!1:!!(i.includes("chainId")&&typeof n.chainId!="number"||i.includes("nonce")&&typeof f!="number"||i.includes("fees")&&typeof n.gasPrice!="bigint"&&(typeof n.maxFeePerGas!="bigint"||typeof n.maxPriorityFeePerGas!="bigint")||i.includes("gas")&&typeof n.gas!="bigint"))?await te(e,wf,"fillTransaction")({...n,nonce:f}).then(L=>{const{chainId:b,from:g,gas:w,gasPrice:O,nonce:C,maxFeePerBlobGas:I,maxFeePerGas:k,maxPriorityFeePerGas:y,type:A,...D}=L.transaction;return la.set(e.uid,!0),{...n,...g?{from:g}:{},...A?{type:A}:{},...typeof b<"u"?{chainId:b}:{},...typeof w<"u"?{gas:w}:{},...typeof O<"u"?{gasPrice:O}:{},...typeof C<"u"?{nonce:C}:{},...typeof I<"u"?{maxFeePerBlobGas:I}:{},...typeof k<"u"?{maxFeePerGas:k}:{},...typeof y<"u"?{maxPriorityFeePerGas:y}:{},..."nonceKey"in D&&typeof D.nonceKey<"u"?{nonceKey:D.nonceKey}:{}}}).catch(L=>{var w;const b=L;return((w=b.walk)==null?void 0:w.call(b,O=>{const C=O;return C.name==="MethodNotFoundRpcError"||C.name==="MethodNotSupportedRpcError"}))&&la.set(e.uid,!1),n}):n;f??(f=d.nonce),n={...d,...u?{from:u==null?void 0:u.address}:{},...f?{nonce:f}:{}};const{blobs:h,gas:m,kzg:x,type:P}=n;c!=null&&c.fn&&((M=c.runAt)!=null&&M.includes("beforeFillParameters"))&&(n=await c.fn(n,{phase:"beforeFillParameters"}));let E;async function T(){return E||(E=await te(e,It,"getBlock")({blockTag:"latest"}),E)}if(i.includes("nonce")&&typeof f>"u"&&u&&!s&&(n.nonce=await te(e,df,"getTransactionCount")({address:u.address,blockTag:"pending"})),(i.includes("blobVersionedHashes")||i.includes("sidecars"))&&h&&x){const L=pf({blobs:h,kzg:x});if(i.includes("blobVersionedHashes")){const b=ny({commitments:L,to:"hex"});n.blobVersionedHashes=b}if(i.includes("sidecars")){const b=hf({blobs:h,commitments:L,kzg:x}),g=iy({blobs:h,commitments:L,proofs:b,to:"hex"});n.sidecars=g}}if(i.includes("chainId")&&(n.chainId=await l()),(i.includes("fees")||i.includes("type"))&&typeof P>"u")try{n.type=ay(n)}catch{let L=xf.get(e.uid);if(typeof L>"u"){const b=await T();L=typeof(b==null?void 0:b.baseFeePerGas)=="bigint",xf.set(e.uid,L)}n.type=L?"eip1559":"legacy"}if(i.includes("fees"))if(n.type!=="legacy"&&n.type!=="eip2930"){if(typeof n.maxFeePerGas>"u"||typeof n.maxPriorityFeePerGas>"u"){const L=await T(),{maxFeePerGas:b,maxPriorityFeePerGas:g}=await ia(e,{block:L,chain:o,request:n});if(typeof n.maxPriorityFeePerGas>"u"&&n.maxFeePerGas&&n.maxFeePerGas<g)throw new Wg({maxPriorityFeePerGas:g});n.maxPriorityFeePerGas=g,n.maxFeePerGas=b}}else{if(typeof n.maxFeePerGas<"u"||typeof n.maxPriorityFeePerGas<"u")throw new ra;if(typeof n.gasPrice>"u"){const L=await T(),{gasPrice:b}=await ia(e,{block:L,chain:o,request:n,type:"legacy"});n.gasPrice=b}}return i.includes("gas")&&typeof m>"u"&&(n.gas=await te(e,ua,"estimateGas")({...n,account:u,prepare:(u==null?void 0:u.type)==="local"?[]:["blobVersionedHashes"]})),c!=null&&c.fn&&((F=c.runAt)!=null&&F.includes("afterFillParameters"))&&(n=await c.fn(n,{phase:"afterFillParameters"})),wr(n),delete n.parameters,n}async function ua(e,t){var i,c,a;const{account:n=e.account,prepare:r=!0}=t,o=n?nt(n):void 0,s=(()=>{if(Array.isArray(r))return r;if((o==null?void 0:o.type)!=="local")return["blobVersionedHashes"]})();try{const l=await(async()=>{if(t.to)return t.to;if(t.authorizationList&&t.authorizationList.length>0)return await rf({authorization:t.authorizationList[0]}).catch(()=>{throw new V("`to` is required. Could not infer from `authorizationList`")})})(),{accessList:u,authorizationList:f,blobs:p,blobVersionedHashes:d,blockNumber:h,blockTag:m,data:x,gas:P,gasPrice:E,maxFeePerBlobGas:T,maxFeePerGas:N,maxPriorityFeePerGas:M,nonce:F,value:L,stateOverride:b,...g}=r?await Ef(e,{...t,parameters:s,to:l}):t;if(P&&t.gas!==P)return P;const O=(typeof h=="bigint"?oe(h):void 0)||m,C=na(b);wr(t);const I=(a=(c=(i=e.chain)==null?void 0:i.formatters)==null?void 0:c.transactionRequest)==null?void 0:a.format,y=(I||xo)({...ms(g,{format:I}),account:o,accessList:u,authorizationList:f,blobs:p,blobVersionedHashes:d,data:x,gasPrice:E,maxFeePerBlobGas:T,maxFeePerGas:N,maxPriorityFeePerGas:M,nonce:F,to:l,value:L},"estimateGas");return BigInt(await e.request({method:"eth_estimateGas",params:C?[y,O??e.experimental_blockTag??"latest",C]:O?[y,O]:[y]}))}catch(l){throw jg(l,{...t,account:o,chain:e.chain})}}async function uy(e,t){const{abi:n,address:r,args:o,functionName:s,dataSuffix:i,...c}=t,a=Ot({abi:n,args:o,functionName:s});try{return await te(e,ua,"estimateGas")({data:`${a}${i?i.replace("0x",""):""}`,to:r,...c})}catch(l){const u=c.account?nt(c.account):void 0;throw yr(l,{abi:n,address:r,args:o,docsPath:"/docs/contract/estimateContractGas",functionName:s,sender:u==null?void 0:u.address})}}function Eo(e,t){if(!dt(e,{strict:!1}))throw new wn({address:e});if(!dt(t,{strict:!1}))throw new wn({address:t});return e.toLowerCase()===t.toLowerCase()}const Sf="/docs/contract/decodeEventLog";function bs(e){const{abi:t,data:n,strict:r,topics:o}=e,s=r??!0,[i,...c]=o;if(!i)throw new Xb({docsPath:Sf});const a=t.find(m=>m.type==="event"&&i===as(Tt(m)));if(!(a&&"name"in a)||a.type!=="event")throw new Jb(i,{docsPath:Sf});const{name:l,inputs:u}=a,f=u==null?void 0:u.some(m=>!("name"in m&&m.name)),p=f?[]:{},d=u.map((m,x)=>[m,x]).filter(([m])=>"indexed"in m&&m.indexed);for(let m=0;m<d.length;m++){const[x,P]=d[m],E=c[m];if(!E)throw new ki({abiItem:a,param:x});p[f?P:x.name||P]=fy({param:x,value:E})}const h=u.filter(m=>!("indexed"in m&&m.indexed));if(h.length>0){if(n&&n!=="0x")try{const m=Zr(h,n);if(m)if(f)for(let x=0;x<u.length;x++)p[x]=p[x]??m.shift();else for(let x=0;x<h.length;x++)p[h[x].name]=m[x]}catch(m){if(s)throw m instanceof cu||m instanceof Wu?new os({abiItem:a,data:n,params:h,size:Ee(n)}):m}else if(s)throw new os({abiItem:a,data:"0x",params:h,size:0})}return{eventName:l,args:Object.values(p).length>0?p:void 0}}function fy({param:e,value:t}){return e.type==="string"||e.type==="bytes"||e.type==="tuple"||e.type.match(/^(.*)\[(\d+)?\]$/)?t:(Zr([e],t)||[])[0]}function fa(e){const{abi:t,args:n,logs:r,strict:o=!0}=e,s=(()=>{if(e.eventName)return Array.isArray(e.eventName)?e.eventName:[e.eventName]})();return r.map(i=>{var u;const c=t.filter(f=>f.type==="event"&&i.topics[0]===as(f));if(c.length===0)return null;let a,l;for(const f of c)try{a=bs({...i,abi:[f],strict:!0}),l=f;break}catch{}if(!a&&!o){l=c[0];try{a=bs({...i,abi:[l],strict:!1})}catch{const f=(u=l.inputs)==null?void 0:u.some(p=>!("name"in p&&p.name));return{...i,args:f?[]:{},eventName:l.name}}}return!a||!l||s&&!s.includes(a.eventName)||!dy({args:a.args,inputs:l.inputs,matchArgs:n})?null:{...a,...i}}).filter(Boolean)}function dy(e){const{args:t,inputs:n,matchArgs:r}=e;if(!r)return!0;if(!t)return!1;function o(s,i,c){try{return s.type==="address"?Eo(i,c):s.type==="string"||s.type==="bytes"?Me(lr(i))===c:i===c}catch{return!1}}return Array.isArray(t)&&Array.isArray(r)?r.every((s,i)=>{if(s==null)return!0;const c=n[i];return c?(Array.isArray(s)?s:[s]).some(l=>o(c,l,t[i])):!1}):typeof t=="object"&&!Array.isArray(t)&&typeof r=="object"&&!Array.isArray(r)?Object.entries(r).every(([s,i])=>{if(i==null)return!0;const c=n.find(l=>l.name===s);return c?(Array.isArray(i)?i:[i]).some(l=>o(c,l,t[s])):!1}):!1}function nn(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}:{}}}async function da(e,{address:t,blockHash:n,fromBlock:r,toBlock:o,event:s,events:i,args:c,strict:a}={}){const l=a??!1,u=i??(s?[s]:void 0);let f=[];u&&(f=[u.flatMap(m=>Kr({abi:[m],eventName:m.name,args:i?void 0:c}))],s&&(f=f[0]));let p;n?p=await e.request({method:"eth_getLogs",params:[{address:t,topics:f,blockHash:n}]}):p=await e.request({method:"eth_getLogs",params:[{address:t,topics:f,fromBlock:typeof r=="bigint"?oe(r):r,toBlock:typeof o=="bigint"?oe(o):o}]});const d=p.map(h=>nn(h));return u?fa({abi:u,args:c,logs:d,strict:l}):d}async function Pf(e,t){const{abi:n,address:r,args:o,blockHash:s,eventName:i,fromBlock:c,toBlock:a,strict:l}=t,u=i?Rn({abi:n,name:i}):void 0,f=u?void 0:n.filter(p=>p.type==="event");return te(e,da,"getLogs")({address:r,args:o,blockHash:s,event:u,events:f,fromBlock:c,toBlock:a,strict:l})}const pa="/docs/contract/decodeFunctionResult";function _n(e){const{abi:t,args:n,functionName:r,data:o}=e;let s=t[0];if(r){const c=Rn({abi:t,args:n,name:r});if(!c)throw new ar(r,{docsPath:pa});s=c}if(s.type!=="function")throw new ar(void 0,{docsPath:pa});if(!s.outputs)throw new du(s.name,{docsPath:pa});const i=Zr(s.outputs,o);if(i&&i.length>1)return i;if(i&&i.length===1)return i[0]}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const ha=BigInt(0),ma=BigInt(1);function So(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array"}function ba(e){if(!So(e))throw new Error("Uint8Array expected")}function Po(e,t){if(typeof t!="boolean")throw new Error(e+" boolean expected, got "+t)}function gs(e){const t=e.toString(16);return t.length&1?"0"+t:t}function Tf(e){if(typeof e!="string")throw new Error("hex string expected, got "+typeof e);return e===""?ha:BigInt("0x"+e)}const Af=typeof Uint8Array.from([]).toHex=="function"&&typeof Uint8Array.fromHex=="function",py=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function To(e){if(ba(e),Af)return e.toHex();let t="";for(let n=0;n<e.length;n++)t+=py[e[n]];return t}const rn={_0:48,_9:57,A:65,F:70,a:97,f:102};function Nf(e){if(e>=rn._0&&e<=rn._9)return e-rn._0;if(e>=rn.A&&e<=rn.F)return e-(rn.A-10);if(e>=rn.a&&e<=rn.f)return e-(rn.a-10)}function ys(e){if(typeof e!="string")throw new Error("hex string expected, got "+typeof e);if(Af)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 o=0,s=0;o<n;o++,s+=2){const i=Nf(e.charCodeAt(s)),c=Nf(e.charCodeAt(s+1));if(i===void 0||c===void 0){const a=e[s]+e[s+1];throw new Error('hex string expected, got non-hex character "'+a+'" at index '+s)}r[o]=i*16+c}return r}function Wn(e){return Tf(To(e))}function Cf(e){return ba(e),Tf(To(Uint8Array.from(e).reverse()))}function Ao(e,t){return ys(e.toString(16).padStart(t*2,"0"))}function Of(e,t){return Ao(e,t).reverse()}function pt(e,t,n){let r;if(typeof t=="string")try{r=ys(t)}catch(s){throw new Error(e+" must be hex string or Uint8Array, cause: "+s)}else if(So(t))r=Uint8Array.from(t);else throw new Error(e+" must be hex string or Uint8Array");const o=r.length;if(typeof n=="number"&&o!==n)throw new Error(e+" of length "+n+" expected, got "+o);return r}function vs(...e){let t=0;for(let r=0;r<e.length;r++){const o=e[r];ba(o),t+=o.length}const n=new Uint8Array(t);for(let r=0,o=0;r<e.length;r++){const s=e[r];n.set(s,o),o+=s.length}return n}const ga=e=>typeof e=="bigint"&&ha<=e;function ya(e,t,n){return ga(e)&&ga(t)&&ga(n)&&t<=e&&e<n}function xr(e,t,n,r){if(!ya(t,n,r))throw new Error("expected valid "+e+": "+n+" <= n < "+r+", got "+t)}function hy(e){let t;for(t=0;e>ha;e>>=ma,t+=1);return t}const ws=e=>(ma<<BigInt(e))-ma,va=e=>new Uint8Array(e),If=e=>Uint8Array.from(e);function my(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=va(e),o=va(e),s=0;const i=()=>{r.fill(1),o.fill(0),s=0},c=(...f)=>n(o,r,...f),a=(f=va(0))=>{o=c(If([0]),f),r=c(),f.length!==0&&(o=c(If([1]),f),r=c())},l=()=>{if(s++>=1e3)throw new Error("drbg: tried 1000 values");let f=0;const p=[];for(;f<t;){r=c();const d=r.slice();p.push(d),f+=r.length}return vs(...p)};return(f,p)=>{i(),a(f);let d;for(;!(d=p(l()));)a();return i(),d}}const by={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"||So(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 xs(e,t,n={}){const r=(o,s,i)=>{const c=by[s];if(typeof c!="function")throw new Error("invalid validator function");const a=e[o];if(!(i&&a===void 0)&&!c(a,e))throw new Error("param "+String(o)+" is invalid. Expected "+s+", got "+a)};for(const[o,s]of Object.entries(t))r(o,s,!1);for(const[o,s]of Object.entries(n))r(o,s,!0);return e}function $f(e){const t=new WeakMap;return(n,...r)=>{const o=t.get(n);if(o!==void 0)return o;const s=e(n,...r);return t.set(n,s),s}}const gy="0.1.1";function yy(){return gy}class ue extends Error{constructor(t,n={}){const r=(()=>{var a;if(n.cause instanceof ue){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:(a=n.cause)!=null&&a.message?n.cause.message:n.details})(),o=n.cause instanceof ue&&n.cause.docsPath||n.docsPath,i=`https://oxlib.sh${o??""}`,c=[t||"An error occurred.",...n.metaMessages?["",...n.metaMessages]:[],...r||o?["",r?`Details: ${r}`:void 0,o?`See: ${i}`:void 0]:[]].filter(a=>typeof a=="string").join(`
|
|
88
|
+
`);super(c,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@${yy()}`}),this.cause=n.cause,this.details=r,this.docs=i,this.docsPath=o,this.shortMessage=t}walk(t){return kf(this,t)}}function kf(e,t){return t!=null&&t(e)?e:e&&typeof e=="object"&&"cause"in e&&e.cause?kf(e.cause,t):t?null:e}function No(e,t){if(Er(e)>t)throw new By({givenSize:Er(e),maxSize:t})}const on={zero:48,nine:57,A:65,F:70,a:97,f:102};function Df(e){if(e>=on.zero&&e<=on.nine)return e-on.zero;if(e>=on.A&&e<=on.F)return e-(on.A-10);if(e>=on.a&&e<=on.f)return e-(on.a-10)}function vy(e,t={}){const{dir:n,size:r=32}=t;if(r===0)return e;if(e.length>r)throw new Ly({size:e.length,targetSize:r,type:"Bytes"});const o=new Uint8Array(r);for(let s=0;s<r;s++){const i=n==="right";o[i?s:r-s-1]=e[i?s:e.length-s-1]}return o}function Mf(e,t={}){const{dir:n="left"}=t;let r=e,o=0;for(let s=0;s<r.length-1&&r[n==="left"?s:r.length-s-1].toString()==="0";s++)o++;return r=n==="left"?r.slice(o):r.slice(0,r.length-o),r}function Es(e,t){if(ot(e)>t)throw new _y({givenSize:ot(e),maxSize:t})}function wy(e,t){if(typeof t=="number"&&t>0&&t>ot(e)-1)throw new Hf({offset:t,position:"start",size:ot(e)})}function xy(e,t,n){if(typeof t=="number"&&typeof n=="number"&&ot(e)!==n-t)throw new Hf({offset:n,position:"end",size:ot(e)})}function Bf(e,t={}){const{dir:n,size:r=32}=t;if(r===0)return e;const o=e.replace("0x","");if(o.length>r*2)throw new Wy({size:Math.ceil(o.length/2),targetSize:r,type:"Hex"});return`0x${o[n==="right"?"padEnd":"padStart"](r*2,"0")}`}const Ey="#__bigint";function Lf(e,t,n){return JSON.stringify(e,(r,o)=>typeof o=="bigint"?o.toString()+Ey:o,n)}const Sy=new TextDecoder,Py=new TextEncoder;function Ty(e){return e instanceof Uint8Array?e:typeof e=="string"?Ff(e):Ay(e)}function Ay(e){return e instanceof Uint8Array?e:new Uint8Array(e)}function Ff(e,t={}){const{size:n}=t;let r=e;n&&(Es(e,n),r=Hn(e,n));let o=r.slice(2);o.length%2&&(o=`0${o}`);const s=o.length/2,i=new Uint8Array(s);for(let c=0,a=0;c<s;c++){const l=Df(o.charCodeAt(a++)),u=Df(o.charCodeAt(a++));if(l===void 0||u===void 0)throw new ue(`Invalid byte sequence ("${o[a-2]}${o[a-1]}" in "${o}").`);i[c]=l*16+u}return i}function Ny(e,t={}){const{size:n}=t,r=Py.encode(e);return typeof n=="number"?(No(r,n),Cy(r,n)):r}function Cy(e,t){return vy(e,{dir:"right",size:t})}function Er(e){return e.length}function Oy(e,t,n,r={}){const{strict:o}=r;return e.slice(t,n)}function Iy(e,t={}){const{size:n}=t;typeof n<"u"&&No(e,n);const r=kt(e,t);return zf(r,t)}function $y(e,t={}){const{size:n}=t;let r=e;if(typeof n<"u"&&(No(r,n),r=Rf(r)),r.length>1||r[0]>1)throw new My(r);return!!r[0]}function sn(e,t={}){const{size:n}=t;typeof n<"u"&&No(e,n);const r=kt(e,t);return Uf(r,t)}function ky(e,t={}){const{size:n}=t;let r=e;return typeof n<"u"&&(No(r,n),r=Dy(r)),Sy.decode(r)}function Rf(e){return Mf(e,{dir:"left"})}function Dy(e){return Mf(e,{dir:"right"})}class My extends ue{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 By=class extends ue{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"})}},Ly=class extends ue{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 Fy=new TextEncoder,Ry=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function jy(e,t={}){const{strict:n=!1}=t;if(!e)throw new Wf(e);if(typeof e!="string")throw new Wf(e);if(n&&!/^0x[0-9a-fA-F]*$/.test(e))throw new Vf(e);if(!e.startsWith("0x"))throw new Vf(e)}function $t(...e){return`0x${e.reduce((t,n)=>t+n.replace("0x",""),"")}`}function zy(e){return e instanceof Uint8Array?kt(e):Array.isArray(e)?kt(new Uint8Array(e)):e}function jf(e,t={}){const n=`0x${Number(e)}`;return typeof t.size=="number"?(Es(n,t.size),Vn(n,t.size)):n}function kt(e,t={}){let n="";for(let o=0;o<e.length;o++)n+=Ry[e[o]];const r=`0x${n}`;return typeof t.size=="number"?(Es(r,t.size),Hn(r,t.size)):r}function Fe(e,t={}){const{signed:n,size:r}=t,o=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 i=typeof s=="bigint"&&n?-s-1n:0;if(s&&o>s||o<i){const l=typeof e=="bigint"?"n":"";throw new _f({max:s?`${s}${l}`:void 0,min:`${i}${l}`,signed:n,size:r,value:`${e}${l}`})}const a=`0x${(n&&o<0?(1n<<BigInt(r*8))+BigInt(o):o).toString(16)}`;return r?Vn(a,r):a}function wa(e,t={}){return kt(Fy.encode(e),t)}function Vn(e,t){return Bf(e,{dir:"left",size:t})}function Hn(e,t){return Bf(e,{dir:"right",size:t})}function zt(e,t,n,r={}){const{strict:o}=r;wy(e,t);const s=`0x${e.replace("0x","").slice((t??0)*2,(n??e.length)*2)}`;return o&&xy(s,t,n),s}function ot(e){return Math.ceil((e.length-2)/2)}function zf(e,t={}){const{signed:n}=t;t.size&&Es(e,t.size);const r=BigInt(e);if(!n)return r;const o=(e.length-2)/2,s=(1n<<BigInt(o)*8n)-1n,i=s>>1n;return r<=i?r:r-s-1n}function Uf(e,t={}){const{signed:n,size:r}=t;return Number(!n&&!r?e:zf(e,t))}function Uy(e,t={}){const{strict:n=!1}=t;try{return jy(e,{strict:n}),!0}catch{return!1}}class _f extends ue{constructor({max:t,min:n,signed:r,size:o,value:s}){super(`Number \`${s}\` is not in safe${o?` ${o*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 Wf extends ue{constructor(t){super(`Value \`${typeof t=="object"?Lf(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 Vf extends ue{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"})}}class _y extends ue{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"})}}class Hf extends ue{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 Wy extends ue{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 Vy(e){return{address:e.address,amount:Fe(e.amount),index:Fe(e.index),validatorIndex:Fe(e.validatorIndex)}}function Gf(e){return{...typeof e.baseFeePerGas=="bigint"&&{baseFeePerGas:Fe(e.baseFeePerGas)},...typeof e.blobBaseFee=="bigint"&&{blobBaseFee:Fe(e.blobBaseFee)},...typeof e.feeRecipient=="string"&&{feeRecipient:e.feeRecipient},...typeof e.gasLimit=="bigint"&&{gasLimit:Fe(e.gasLimit)},...typeof e.number=="bigint"&&{number:Fe(e.number)},...typeof e.prevRandao=="bigint"&&{prevRandao:Fe(e.prevRandao)},...typeof e.time=="bigint"&&{time:Fe(e.time)},...e.withdrawals&&{withdrawals:e.withdrawals.map(Vy)}}}const Ss=[{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:"getCurrentBlockTimestamp",outputs:[{internalType:"uint256",name:"timestamp",type:"uint256"}],stateMutability:"view",type:"function"}],xa=[{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"}]}],qf=[{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"}],Kf=[...qf,{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"}]}],Hy=[...qf,{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"}]}],Zf=[{name:"text",type:"function",stateMutability:"view",inputs:[{name:"name",type:"bytes32"},{name:"key",type:"string"}],outputs:[{name:"",type:"string"}]}],Yf=[{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"}]}],Xf=[{name:"isValidSignature",type:"function",stateMutability:"view",inputs:[{name:"hash",type:"bytes32"},{name:"signature",type:"bytes"}],outputs:[{name:"",type:"bytes4"}]}],Jf=[{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"}],Sr=[{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"}]}],Gy="0x82ad56cb",Qf="0x608060405234801561001057600080fd5b5060405161018e38038061018e83398101604081905261002f91610124565b6000808351602085016000f59050803b61004857600080fd5b6000808351602085016000855af16040513d6000823e81610067573d81fd5b3d81f35b634e487b7160e01b600052604160045260246000fd5b600082601f83011261009257600080fd5b81516001600160401b038111156100ab576100ab61006b565b604051601f8201601f19908116603f011681016001600160401b03811182821017156100d9576100d961006b565b6040528181528382016020018510156100f157600080fd5b60005b82811015610110576020818601810151838301820152016100f4565b506000918101602001919091529392505050565b6000806040838503121561013757600080fd5b82516001600160401b0381111561014d57600080fd5b61015985828601610081565b602085015190935090506001600160401b0381111561017757600080fd5b61018385828601610081565b915050925092905056fe",qy="0x608060405234801561001057600080fd5b506040516102c03803806102c083398101604081905261002f916101e6565b836001600160a01b03163b6000036100e457600080836001600160a01b03168360405161005c9190610270565b6000604051808303816000865af19150503d8060008114610099576040519150601f19603f3d011682016040523d82523d6000602084013e61009e565b606091505b50915091508115806100b857506001600160a01b0386163b155b156100e1578060405163101bb98d60e01b81526004016100d8919061028c565b60405180910390fd5b50505b6000808451602086016000885af16040513d6000823e81610103573d81fd5b3d81f35b80516001600160a01b038116811461011e57600080fd5b919050565b634e487b7160e01b600052604160045260246000fd5b60005b8381101561015457818101518382015260200161013c565b50506000910152565b600082601f83011261016e57600080fd5b81516001600160401b0381111561018757610187610123565b604051601f8201601f19908116603f011681016001600160401b03811182821017156101b5576101b5610123565b6040528181528382016020018510156101cd57600080fd5b6101de826020830160208701610139565b949350505050565b600080600080608085870312156101fc57600080fd5b61020585610107565b60208601519094506001600160401b0381111561022157600080fd5b61022d8782880161015d565b93505061023c60408601610107565b60608601519092506001600160401b0381111561025857600080fd5b6102648782880161015d565b91505092959194509250565b60008251610282818460208701610139565b9190910192915050565b60208152600082518060208401526102ab816040850160208701610139565b601f01601f1916919091016040019291505056fe",Ky="0x608060405234801561001057600080fd5b5060405161069438038061069483398101604081905261002f9161051e565b600061003c848484610048565b9050806000526001601ff35b60007f64926492649264926492649264926492649264926492649264926492649264926100748361040c565b036101e7576000606080848060200190518101906100929190610577565b60405192955090935091506000906001600160a01b038516906100b69085906105dd565b6000604051808303816000865af19150503d80600081146100f3576040519150601f19603f3d011682016040523d82523d6000602084013e6100f8565b606091505b50509050876001600160a01b03163b60000361016057806101605760405162461bcd60e51b815260206004820152601e60248201527f5369676e617475726556616c696461746f723a206465706c6f796d656e74000060448201526064015b60405180910390fd5b604051630b135d3f60e11b808252906001600160a01b038a1690631626ba7e90610190908b9087906004016105f9565b602060405180830381865afa1580156101ad573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101d19190610633565b6001600160e01b03191614945050505050610405565b6001600160a01b0384163b1561027a57604051630b135d3f60e11b808252906001600160a01b03861690631626ba7e9061022790879087906004016105f9565b602060405180830381865afa158015610244573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102689190610633565b6001600160e01b031916149050610405565b81516041146102df5760405162461bcd60e51b815260206004820152603a602482015260008051602061067483398151915260448201527f3a20696e76616c6964207369676e6174757265206c656e6774680000000000006064820152608401610157565b6102e7610425565b5060208201516040808401518451859392600091859190811061030c5761030c61065d565b016020015160f81c9050601b811480159061032b57508060ff16601c14155b1561038c5760405162461bcd60e51b815260206004820152603b602482015260008051602061067483398151915260448201527f3a20696e76616c6964207369676e617475726520762076616c756500000000006064820152608401610157565b60408051600081526020810180835289905260ff83169181019190915260608101849052608081018390526001600160a01b0389169060019060a0016020604051602081039080840390855afa1580156103ea573d6000803e3d6000fd5b505050602060405103516001600160a01b0316149450505050505b9392505050565b600060208251101561041d57600080fd5b508051015190565b60405180606001604052806003906020820280368337509192915050565b6001600160a01b038116811461045857600080fd5b50565b634e487b7160e01b600052604160045260246000fd5b60005b8381101561048c578181015183820152602001610474565b50506000910152565b600082601f8301126104a657600080fd5b81516001600160401b038111156104bf576104bf61045b565b604051601f8201601f19908116603f011681016001600160401b03811182821017156104ed576104ed61045b565b60405281815283820160200185101561050557600080fd5b610516826020830160208701610471565b949350505050565b60008060006060848603121561053357600080fd5b835161053e81610443565b6020850151604086015191945092506001600160401b0381111561056157600080fd5b61056d86828701610495565b9150509250925092565b60008060006060848603121561058c57600080fd5b835161059781610443565b60208501519093506001600160401b038111156105b357600080fd5b6105bf86828701610495565b604086015190935090506001600160401b0381111561056157600080fd5b600082516105ef818460208701610471565b9190910192915050565b828152604060208201526000825180604084015261061e816060850160208701610471565b601f01601f1916919091016060019392505050565b60006020828403121561064557600080fd5b81516001600160e01b03198116811461040557600080fd5b634e487b7160e01b600052603260045260246000fdfe5369676e617475726556616c696461746f72237265636f7665725369676e6572",Ea="0x608060405234801561001057600080fd5b506115b9806100206000396000f3fe6080604052600436106100f35760003560e01c80634d2301cc1161008a578063a8b0574e11610059578063a8b0574e14610325578063bce38bd714610350578063c3077fa914610380578063ee82ac5e146103b2576100f3565b80634d2301cc1461026257806372425d9d1461029f57806382ad56cb146102ca57806386d516e8146102fa576100f3565b80633408e470116100c65780633408e470146101af578063399542e9146101da5780633e64a6961461020c57806342cbb15c14610237576100f3565b80630f28c97d146100f8578063174dea7114610123578063252dba421461015357806327e86d6e14610184575b600080fd5b34801561010457600080fd5b5061010d6103ef565b60405161011a9190610c0a565b60405180910390f35b61013d60048036038101906101389190610c94565b6103f7565b60405161014a9190610e94565b60405180910390f35b61016d60048036038101906101689190610f0c565b610615565b60405161017b92919061101b565b60405180910390f35b34801561019057600080fd5b506101996107ab565b6040516101a69190611064565b60405180910390f35b3480156101bb57600080fd5b506101c46107b7565b6040516101d19190610c0a565b60405180910390f35b6101f460048036038101906101ef91906110ab565b6107bf565b6040516102039392919061110b565b60405180910390f35b34801561021857600080fd5b506102216107e1565b60405161022e9190610c0a565b60405180910390f35b34801561024357600080fd5b5061024c6107e9565b6040516102599190610c0a565b60405180910390f35b34801561026e57600080fd5b50610289600480360381019061028491906111a7565b6107f1565b6040516102969190610c0a565b60405180910390f35b3480156102ab57600080fd5b506102b4610812565b6040516102c19190610c0a565b60405180910390f35b6102e460048036038101906102df919061122a565b61081a565b6040516102f19190610e94565b60405180910390f35b34801561030657600080fd5b5061030f6109e4565b60405161031c9190610c0a565b60405180910390f35b34801561033157600080fd5b5061033a6109ec565b6040516103479190611286565b60405180910390f35b61036a600480360381019061036591906110ab565b6109f4565b6040516103779190610e94565b60405180910390f35b61039a60048036038101906103959190610f0c565b610ba6565b6040516103a99392919061110b565b60405180910390f35b3480156103be57600080fd5b506103d960048036038101906103d491906112cd565b610bca565b6040516103e69190611064565b60405180910390f35b600042905090565b60606000808484905090508067ffffffffffffffff81111561041c5761041b6112fa565b5b60405190808252806020026020018201604052801561045557816020015b610442610bd5565b81526020019060019003908161043a5790505b5092503660005b828110156105c957600085828151811061047957610478611329565b5b6020026020010151905087878381811061049657610495611329565b5b90506020028101906104a89190611367565b925060008360400135905080860195508360000160208101906104cb91906111a7565b73ffffffffffffffffffffffffffffffffffffffff16818580606001906104f2919061138f565b604051610500929190611431565b60006040518083038185875af1925050503d806000811461053d576040519150601f19603f3d011682016040523d82523d6000602084013e610542565b606091505b5083600001846020018290528215151515815250505081516020850135176105bc577f08c379a000000000000000000000000000000000000000000000000000000000600052602060045260176024527f4d756c746963616c6c333a2063616c6c206661696c656400000000000000000060445260846000fd5b826001019250505061045c565b5082341461060c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610603906114a7565b60405180910390fd5b50505092915050565b6000606043915060008484905090508067ffffffffffffffff81111561063e5761063d6112fa565b5b60405190808252806020026020018201604052801561067157816020015b606081526020019060019003908161065c5790505b5091503660005b828110156107a157600087878381811061069557610694611329565b5b90506020028101906106a791906114c7565b92508260000160208101906106bc91906111a7565b73ffffffffffffffffffffffffffffffffffffffff168380602001906106e2919061138f565b6040516106f0929190611431565b6000604051808303816000865af19150503d806000811461072d576040519150601f19603f3d011682016040523d82523d6000602084013e610732565b606091505b5086848151811061074657610745611329565b5b60200260200101819052819250505080610795576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161078c9061153b565b60405180910390fd5b81600101915050610678565b5050509250929050565b60006001430340905090565b600046905090565b6000806060439250434091506107d68686866109f4565b905093509350939050565b600048905090565b600043905090565b60008173ffffffffffffffffffffffffffffffffffffffff16319050919050565b600044905090565b606060008383905090508067ffffffffffffffff81111561083e5761083d6112fa565b5b60405190808252806020026020018201604052801561087757816020015b610864610bd5565b81526020019060019003908161085c5790505b5091503660005b828110156109db57600084828151811061089b5761089a611329565b5b602002602001015190508686838181106108b8576108b7611329565b5b90506020028101906108ca919061155b565b92508260000160208101906108df91906111a7565b73ffffffffffffffffffffffffffffffffffffffff16838060400190610905919061138f565b604051610913929190611431565b6000604051808303816000865af19150503d8060008114610950576040519150601f19603f3d011682016040523d82523d6000602084013e610955565b606091505b5082600001836020018290528215151515815250505080516020840135176109cf577f08c379a000000000000000000000000000000000000000000000000000000000600052602060045260176024527f4d756c746963616c6c333a2063616c6c206661696c656400000000000000000060445260646000fd5b8160010191505061087e565b50505092915050565b600045905090565b600041905090565b606060008383905090508067ffffffffffffffff811115610a1857610a176112fa565b5b604051908082528060200260200182016040528015610a5157816020015b610a3e610bd5565b815260200190600190039081610a365790505b5091503660005b82811015610b9c576000848281518110610a7557610a74611329565b5b60200260200101519050868683818110610a9257610a91611329565b5b9050602002810190610aa491906114c7565b9250826000016020810190610ab991906111a7565b73ffffffffffffffffffffffffffffffffffffffff16838060200190610adf919061138f565b604051610aed929190611431565b6000604051808303816000865af19150503d8060008114610b2a576040519150601f19603f3d011682016040523d82523d6000602084013e610b2f565b606091505b508260000183602001829052821515151581525050508715610b90578060000151610b8f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b869061153b565b60405180910390fd5b5b81600101915050610a58565b5050509392505050565b6000806060610bb7600186866107bf565b8093508194508295505050509250925092565b600081409050919050565b6040518060400160405280600015158152602001606081525090565b6000819050919050565b610c0481610bf1565b82525050565b6000602082019050610c1f6000830184610bfb565b92915050565b600080fd5b600080fd5b600080fd5b600080fd5b600080fd5b60008083601f840112610c5457610c53610c2f565b5b8235905067ffffffffffffffff811115610c7157610c70610c34565b5b602083019150836020820283011115610c8d57610c8c610c39565b5b9250929050565b60008060208385031215610cab57610caa610c25565b5b600083013567ffffffffffffffff811115610cc957610cc8610c2a565b5b610cd585828601610c3e565b92509250509250929050565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b60008115159050919050565b610d2281610d0d565b82525050565b600081519050919050565b600082825260208201905092915050565b60005b83811015610d62578082015181840152602081019050610d47565b83811115610d71576000848401525b50505050565b6000601f19601f8301169050919050565b6000610d9382610d28565b610d9d8185610d33565b9350610dad818560208601610d44565b610db681610d77565b840191505092915050565b6000604083016000830151610dd96000860182610d19565b5060208301518482036020860152610df18282610d88565b9150508091505092915050565b6000610e0a8383610dc1565b905092915050565b6000602082019050919050565b6000610e2a82610ce1565b610e348185610cec565b935083602082028501610e4685610cfd565b8060005b85811015610e825784840389528151610e638582610dfe565b9450610e6e83610e12565b925060208a01995050600181019050610e4a565b50829750879550505050505092915050565b60006020820190508181036000830152610eae8184610e1f565b905092915050565b60008083601f840112610ecc57610ecb610c2f565b5b8235905067ffffffffffffffff811115610ee957610ee8610c34565b5b602083019150836020820283011115610f0557610f04610c39565b5b9250929050565b60008060208385031215610f2357610f22610c25565b5b600083013567ffffffffffffffff811115610f4157610f40610c2a565b5b610f4d85828601610eb6565b92509250509250929050565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b6000610f918383610d88565b905092915050565b6000602082019050919050565b6000610fb182610f59565b610fbb8185610f64565b935083602082028501610fcd85610f75565b8060005b858110156110095784840389528151610fea8582610f85565b9450610ff583610f99565b925060208a01995050600181019050610fd1565b50829750879550505050505092915050565b60006040820190506110306000830185610bfb565b81810360208301526110428184610fa6565b90509392505050565b6000819050919050565b61105e8161104b565b82525050565b60006020820190506110796000830184611055565b92915050565b61108881610d0d565b811461109357600080fd5b50565b6000813590506110a58161107f565b92915050565b6000806000604084860312156110c4576110c3610c25565b5b60006110d286828701611096565b935050602084013567ffffffffffffffff8111156110f3576110f2610c2a565b5b6110ff86828701610eb6565b92509250509250925092565b60006060820190506111206000830186610bfb565b61112d6020830185611055565b818103604083015261113f8184610e1f565b9050949350505050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b600061117482611149565b9050919050565b61118481611169565b811461118f57600080fd5b50565b6000813590506111a18161117b565b92915050565b6000602082840312156111bd576111bc610c25565b5b60006111cb84828501611192565b91505092915050565b60008083601f8401126111ea576111e9610c2f565b5b8235905067ffffffffffffffff81111561120757611206610c34565b5b60208301915083602082028301111561122357611222610c39565b5b9250929050565b6000806020838503121561124157611240610c25565b5b600083013567ffffffffffffffff81111561125f5761125e610c2a565b5b61126b858286016111d4565b92509250509250929050565b61128081611169565b82525050565b600060208201905061129b6000830184611277565b92915050565b6112aa81610bf1565b81146112b557600080fd5b50565b6000813590506112c7816112a1565b92915050565b6000602082840312156112e3576112e2610c25565b5b60006112f1848285016112b8565b91505092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b600080fd5b600080fd5b600080fd5b60008235600160800383360303811261138357611382611358565b5b80830191505092915050565b600080833560016020038436030381126113ac576113ab611358565b5b80840192508235915067ffffffffffffffff8211156113ce576113cd61135d565b5b6020830192506001820236038313156113ea576113e9611362565b5b509250929050565b600081905092915050565b82818337600083830152505050565b600061141883856113f2565b93506114258385846113fd565b82840190509392505050565b600061143e82848661140c565b91508190509392505050565b600082825260208201905092915050565b7f4d756c746963616c6c333a2076616c7565206d69736d61746368000000000000600082015250565b6000611491601a8361144a565b915061149c8261145b565b602082019050919050565b600060208201905081810360008301526114c081611484565b9050919050565b6000823560016040038336030381126114e3576114e2611358565b5b80830191505092915050565b7f4d756c746963616c6c333a2063616c6c206661696c6564000000000000000000600082015250565b600061152560178361144a565b9150611530826114ef565b602082019050919050565b6000602082019050818103600083015261155481611518565b9050919050565b60008235600160600383360303811261157757611576611358565b5b8083019150509291505056fea264697066735822122020c1bc9aacf8e4a6507193432a895a8e77094f45a1395583f07b24e860ef06cd64736f6c634300080c0033";class Sa extends V{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 ed extends V{constructor(){super("No chain was provided to the Client.",{name:"ClientChainNotConfiguredError"})}}const Pa="/docs/contract/encodeDeployData";function Ta(e){const{abi:t,args:n,bytecode:r}=e;if(!n||n.length===0)return r;const o=t.find(i=>"type"in i&&i.type==="constructor");if(!o)throw new Gb({docsPath:Pa});if(!("inputs"in o))throw new au({docsPath:Pa});if(!o.inputs||o.inputs.length===0)throw new au({docsPath:Pa});const s=En(o.inputs,n);return pr([r,s])}function Pr({blockNumber:e,chain:t,contract:n}){var o;const r=(o=t==null?void 0:t.contracts)==null?void 0:o[n];if(!r)throw new Sa({chain:t,contract:{name:n}});if(e&&r.blockCreated&&r.blockCreated>e)throw new Sa({blockNumber:e,chain:t,contract:{name:n,blockCreated:r.blockCreated}});return r.address}function td(e,{docsPath:t,...n}){const r=(()=>{const o=hs(e,n);return o instanceof wo?e:o})();return new Yu(r,{docsPath:t,...n})}function nd(){let e=()=>{},t=()=>{};return{promise:new Promise((r,o)=>{e=r,t=o}),resolve:e,reject:t}}const Aa=new Map;function rd({fn:e,id:t,shouldSplitBatch:n,wait:r=0,sort:o}){const s=async()=>{const u=a();i();const f=u.map(({args:p})=>p);f.length!==0&&e(f).then(p=>{o&&Array.isArray(p)&&p.sort(o);for(let d=0;d<u.length;d++){const{resolve:h}=u[d];h==null||h([p[d],p])}}).catch(p=>{for(let d=0;d<u.length;d++){const{reject:h}=u[d];h==null||h(p)}})},i=()=>Aa.delete(t),c=()=>a().map(({args:u})=>u),a=()=>Aa.get(t)||[],l=u=>Aa.set(t,[...a(),u]);return{flush:i,async schedule(u){const{promise:f,resolve:p,reject:d}=nd();return(n==null?void 0:n([...c(),u]))&&s(),a().length>0?(l({args:u,resolve:p,reject:d}),f):(l({args:u,resolve:p,reject:d}),setTimeout(s,r),f)}}}async function Co(e,t){var I,k,y,A;const{account:n=e.account,authorizationList:r,batch:o=!!((I=e.batch)!=null&&I.multicall),blockNumber:s,blockTag:i=e.experimental_blockTag??"latest",accessList:c,blobs:a,blockOverrides:l,code:u,data:f,factory:p,factoryData:d,gas:h,gasPrice:m,maxFeePerBlobGas:x,maxFeePerGas:P,maxPriorityFeePerGas:E,nonce:T,to:N,value:M,stateOverride:F,...L}=t,b=n?nt(n):void 0;if(u&&(p||d))throw new V("Cannot provide both `code` & `factory`/`factoryData` as parameters.");if(u&&N)throw new V("Cannot provide both `code` & `to` as parameters.");const g=u&&f,w=p&&d&&N&&f,O=g||w,C=g?od({code:u,data:f}):w?Xy({data:f,factory:p,factoryData:d,to:N}):f;try{wr(t);const S=(typeof s=="bigint"?oe(s):void 0)||i,B=l?Gf(l):void 0,j=na(F),_=(A=(y=(k=e.chain)==null?void 0:k.formatters)==null?void 0:y.transactionRequest)==null?void 0:A.format,q=(_||xo)({...ms(L,{format:_}),accessList:c,account:b,authorizationList:r,blobs:a,data:C,gas:h,gasPrice:m,maxFeePerBlobGas:x,maxFeePerGas:P,maxPriorityFeePerGas:E,nonce:T,to:O?void 0:N,value:M},"call");if(o&&Zy({request:q})&&!j&&!B)try{return await Yy(e,{...q,blockNumber:s,blockTag:i})}catch(U){if(!(U instanceof ed)&&!(U instanceof Sa))throw U}const Z=(()=>{const U=[q,S];return j&&B?[...U,j,B]:j?[...U,j]:B?[...U,{},B]:U})(),H=await e.request({method:"eth_call",params:Z});return H==="0x"?{data:void 0}:{data:H}}catch(D){const S=Jy(D),{offchainLookup:B,offchainLookupSignature:j}=await Promise.resolve().then(()=>Yv);if(e.ccipRead!==!1&&(S==null?void 0:S.slice(0,10))===j&&N)return{data:await B(e,{data:S,to:N})};throw O&&(S==null?void 0:S.slice(0,10))==="0x101bb98d"?new Cg({factory:p}):td(D,{...t,account:b,chain:e.chain})}}function Zy({request:e}){const{data:t,to:n,...r}=e;return!(!t||t.startsWith(Gy)||!n||Object.values(r).filter(o=>typeof o<"u").length>0)}async function Yy(e,t){var m;const{batchSize:n=1024,deployless:r=!1,wait:o=0}=typeof((m=e.batch)==null?void 0:m.multicall)=="object"?e.batch.multicall:{},{blockNumber:s,blockTag:i=e.experimental_blockTag??"latest",data:c,to:a}=t,l=(()=>{if(r)return null;if(t.multicallAddress)return t.multicallAddress;if(e.chain)return Pr({blockNumber:s,chain:e.chain,contract:"multicall3"});throw new ed})(),f=(typeof s=="bigint"?oe(s):void 0)||i,{schedule:p}=rd({id:`${e.uid}.${f}`,wait:o,shouldSplitBatch(x){return x.reduce((E,{data:T})=>E+(T.length-2),0)>n*2},fn:async x=>{const P=x.map(N=>({allowFailure:!0,callData:N.data,target:N.to})),E=Ot({abi:Ss,args:[P],functionName:"aggregate3"}),T=await e.request({method:"eth_call",params:[{...l===null?{data:od({code:Ea,data:E})}:{to:l,data:E}},f]});return _n({abi:Ss,args:[P],functionName:"aggregate3",data:T||"0x"})}}),[{returnData:d,success:h}]=await p({data:c,to:a});if(!h)throw new fs({data:d});return d==="0x"?{data:void 0}:{data:d}}function od(e){const{code:t,data:n}=e;return Ta({abi:nu(["constructor(bytes, bytes)"]),bytecode:Qf,args:[t,n]})}function Xy(e){const{data:t,factory:n,factoryData:r,to:o}=e;return Ta({abi:nu(["constructor(address, bytes, address, bytes)"]),bytecode:qy,args:[o,t,n,r]})}function Jy(e){var n;if(!(e instanceof V))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 Dt(e,t){const{abi:n,address:r,args:o,functionName:s,...i}=t,c=Ot({abi:n,args:o,functionName:s});try{const{data:a}=await te(e,Co,"call")({...i,data:c,to:r});return _n({abi:n,args:o,functionName:s,data:a||"0x"})}catch(a){throw yr(a,{abi:n,address:r,args:o,docsPath:"/docs/contract/readContract",functionName:s})}}async function Qy(e,t){const{abi:n,address:r,args:o,dataSuffix:s,functionName:i,...c}=t,a=c.account?nt(c.account):e.account,l=Ot({abi:n,args:o,functionName:i});try{const{data:u}=await te(e,Co,"call")({batch:!1,data:`${l}${s?s.replace("0x",""):""}`,to:r,...c,account:a}),f=_n({abi:n,args:o,functionName:i,data:u||"0x"}),p=n.filter(d=>"name"in d&&d.name===t.functionName);return{result:f,request:{abi:p,address:r,args:o,dataSuffix:s,functionName:i,...c,account:a}}}catch(u){throw yr(u,{abi:n,address:r,args:o,docsPath:"/docs/contract/simulateContract",functionName:i,sender:a==null?void 0:a.address})}}const Na=new Map,sd=new Map;let ev=0;function An(e,t,n){const r=++ev,o=()=>Na.get(e)||[],s=()=>{const u=o();Na.set(e,u.filter(f=>f.id!==r))},i=()=>{const u=o();if(!u.some(p=>p.id===r))return;const f=sd.get(e);if(u.length===1&&f){const p=f();p instanceof Promise&&p.catch(()=>{})}s()},c=o();if(Na.set(e,[...c,{id:r,fns:t}]),c&&c.length>0)return i;const a={};for(const u in t)a[u]=(...f)=>{var d,h;const p=o();if(p.length!==0)for(const m of p)(h=(d=m.fns)[u])==null||h.call(d,...f)};const l=n(a);return typeof l=="function"&&sd.set(e,l),i}async function Ca(e){return new Promise(t=>setTimeout(t,e))}function Oo(e,{emitOnBegin:t,initialWaitTime:n,interval:r}){let o=!0;const s=()=>o=!1;return(async()=>{let c;t&&(c=await e({unpoll:s}));const a=await(n==null?void 0:n(c))??r;await Ca(a);const l=async()=>{o&&(await e({unpoll:s}),await Ca(r),l())};l()})(),s}const tv=new Map,nv=new Map;function rv(e){const t=(o,s)=>({clear:()=>s.delete(o),get:()=>s.get(o),set:i=>s.set(o,i)}),n=t(e,tv),r=t(e,nv);return{clear:()=>{n.clear(),r.clear()},promise:n,response:r}}async function ov(e,{cacheKey:t,cacheTime:n=Number.POSITIVE_INFINITY}){const r=rv(t),o=r.response.get();if(o&&n>0&&Date.now()-o.created.getTime()<n)return o.data;let s=r.promise.get();s||(s=e(),r.promise.set(s));try{const i=await s;return r.response.set({created:new Date,data:i}),i}finally{r.promise.clear()}}const sv=e=>`blockNumber.${e}`;async function Io(e,{cacheTime:t=e.cacheTime}={}){const n=await ov(()=>e.request({method:"eth_blockNumber"}),{cacheKey:sv(e.uid),cacheTime:t});return BigInt(n)}async function Ps(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 o=r.map(s=>nn(s));return!("abi"in t)||!t.abi?o:fa({abi:t.abi,logs:o,strict:n})}async function Ts(e,{filter:t}){return t.request({method:"eth_uninstallFilter",params:[t.id]})}function iv(e,t){const{abi:n,address:r,args:o,batch:s=!0,eventName:i,fromBlock:c,onError:a,onLogs:l,poll:u,pollingInterval:f=e.pollingInterval,strict:p}=t;return(typeof u<"u"?u:typeof c=="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 x=p??!1,P=Oe(["watchContractEvent",r,o,s,e.uid,i,f,x,c]);return An(P,{onLogs:l,onError:a},E=>{let T;c!==void 0&&(T=c-1n);let N,M=!1;const F=Oo(async()=>{var L;if(!M){try{N=await te(e,ju,"createContractEventFilter")({abi:n,address:r,args:o,eventName:i,strict:x,fromBlock:c})}catch{}M=!0;return}try{let b;if(N)b=await te(e,Ps,"getFilterChanges")({filter:N});else{const g=await te(e,Io,"getBlockNumber")({});T&&T<g?b=await te(e,Pf,"getContractEvents")({abi:n,address:r,args:o,eventName:i,fromBlock:T+1n,toBlock:g,strict:x}):b=[],T=g}if(b.length===0)return;if(s)E.onLogs(b);else for(const g of b)E.onLogs([g])}catch(b){N&&b instanceof Sn&&(M=!1),(L=E.onError)==null||L.call(E,b)}},{emitOnBegin:!0,interval:f});return async()=>{N&&await te(e,Ts,"uninstallFilter")({filter:N}),F()}})})():(()=>{const x=p??!1,P=Oe(["watchContractEvent",r,o,s,e.uid,i,f,x]);let E=!0,T=()=>E=!1;return An(P,{onLogs:l,onError:a},N=>((async()=>{try{const M=(()=>{if(e.transport.type==="fallback"){const b=e.transport.transports.find(g=>g.config.type==="webSocket"||g.config.type==="ipc");return b?b.value:e.transport}return e.transport})(),F=i?Kr({abi:n,eventName:i,args:o}):[],{unsubscribe:L}=await M.subscribe({params:["logs",{address:r,topics:F}],onData(b){var w;if(!E)return;const g=b.result;try{const{eventName:O,args:C}=bs({abi:n,data:g.data,topics:g.topics,strict:p}),I=nn(g,{args:C,eventName:O});N.onLogs([I])}catch(O){let C,I;if(O instanceof os||O instanceof ki){if(p)return;C=O.abiItem.name,I=(w=O.abiItem.inputs)==null?void 0:w.some(y=>!("name"in y&&y.name))}const k=nn(g,{args:I?[]:{},eventName:C});N.onLogs([k])}},onError(b){var g;(g=N.onError)==null||g.call(N,b)}});T=L,E||T()}catch(M){a==null||a(M)}})(),()=>T()))})()}async function av(e,{serializedTransaction:t}){return e.request({method:"eth_sendRawTransaction",params:[t]},{retryCount:0})}function Oa(e,{delay:t=100,retryCount:n=2,shouldRetry:r=()=>!0}={}){return new Promise((o,s)=>{const i=async({count:c=0}={})=>{const a=async({error:l})=>{const u=typeof t=="function"?t({count:c,error:l}):t;u&&await Ca(u),i({count:c+1})};try{const l=await e();o(l)}catch(l){if(c<n&&await r({count:c,error:l}))return a({error:l});s(l)}};i()})}const cv={"0x0":"reverted","0x1":"success"};function id(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=>nn(r)):null,to:e.to?e.to:null,transactionIndex:e.transactionIndex?Qt(e.transactionIndex):null,status:e.status?cv[e.status]:null,type:e.type?lf[e.type]||e.type:null};return e.blobGasPrice&&(n.blobGasPrice=BigInt(e.blobGasPrice)),e.blobGasUsed&&(n.blobGasUsed=BigInt(e.blobGasUsed)),n}const Ia=256;let As=Ia,Ns;function ad(e=11){if(!Ns||As+e>Ia*2){Ns="",As=0;for(let t=0;t<Ia;t++)Ns+=(256+Math.random()*256|0).toString(16).substring(1)}return Ns.substring(As,As+++e)}function lv(e){const{batch:t,chain:n,ccipRead:r,key:o="base",name:s="Base Client",type:i="base"}=e,c=e.experimental_blockTag??(typeof(n==null?void 0:n.experimental_preconfirmationTime)=="number"?"pending":void 0),a=(n==null?void 0:n.blockTime)??12e3,l=Math.min(Math.max(Math.floor(a/2),500),4e3),u=e.pollingInterval??l,f=e.cacheTime??u,p=e.account?nt(e.account):void 0,{config:d,request:h,value:m}=e.transport({account:p,chain:n,pollingInterval:u}),x={...d,...m},P={account:p,batch:t,cacheTime:f,ccipRead:r,chain:n,key:o,name:s,pollingInterval:u,request:h,transport:x,type:i,uid:ad(),...c?{experimental_blockTag:c}:{}};function E(T){return N=>{const M=N(T);for(const L in P)delete M[L];const F={...T,...M};return Object.assign(F,{extend:E(F)})}}return Object.assign(P,{extend:E(P)})}function $a(e){var n,r,o,s,i,c;if(!(e instanceof V))return!1;const t=e.walk(a=>a instanceof Gi);return t instanceof Gi?((n=t.data)==null?void 0:n.errorName)==="HttpError"||((r=t.data)==null?void 0:r.errorName)==="ResolverError"||((o=t.data)==null?void 0:o.errorName)==="ResolverNotContract"||((s=t.data)==null?void 0:s.errorName)==="ResolverNotFound"||((i=t.data)==null?void 0:i.errorName)==="ReverseAddressMismatch"||((c=t.data)==null?void 0:c.errorName)==="UnsupportedResolverProfile":!1}function uv(e){const{abi:t,data:n}=e,r=hr(n,0,4),o=t.find(s=>s.type==="function"&&r===qr(Tt(s)));if(!o)throw new Qb(r,{docsPath:"/docs/contract/decodeFunctionData"});return{functionName:o.name,args:"inputs"in o&&o.inputs&&o.inputs.length>0?Zr(o.inputs,hr(n,4)):void 0}}const ka="/docs/contract/encodeErrorResult";function cd(e){const{abi:t,errorName:n,args:r}=e;let o=t[0];if(n){const a=Rn({abi:t,args:r,name:n});if(!a)throw new lu(n,{docsPath:ka});o=a}if(o.type!=="error")throw new lu(void 0,{docsPath:ka});const s=Tt(o),i=qr(s);let c="0x";if(r&&r.length>0){if(!o.inputs)throw new Yb(o.name,{docsPath:ka});c=En(o.inputs,r)}return pr([i,c])}const Da="/docs/contract/encodeFunctionResult";function fv(e){const{abi:t,functionName:n,result:r}=e;let o=t[0];if(n){const i=Rn({abi:t,name:n});if(!i)throw new ar(n,{docsPath:Da});o=i}if(o.type!=="function")throw new ar(void 0,{docsPath:Da});if(!o.outputs)throw new du(o.name,{docsPath:Da});const s=(()=>{if(o.outputs.length===0)return[];if(o.outputs.length===1)return[r];if(Array.isArray(r))return r;throw new pu(r)})();return En(o.outputs,s)}const $o="x-batch-gateway:true";async function ld(e){const{data:t,ccipRequest:n}=e,{args:[r]}=uv({abi:xa,data:t}),o=[],s=[];return await Promise.all(r.map(async(i,c)=>{try{s[c]=i.urls.includes($o)?await ld({data:i.data,ccipRequest:n}):await n(i),o[c]=!1}catch(a){o[c]=!0,s[c]=dv(a)}})),fv({abi:xa,functionName:"query",result:[o,s]})}function dv(e){return e.name==="HttpRequestError"&&e.status?cd({abi:xa,errorName:"HttpError",args:[e.status,e.shortMessage]}):cd({abi:[Uu],errorName:"Error",args:["shortMessage"in e?e.shortMessage:e.message]})}function ud(e){if(e.length!==66||e.indexOf("[")!==0||e.indexOf("]")!==65)return null;const t=`0x${e.slice(1,65)}`;return At(t)?t:null}function Ma(e){let t=new Uint8Array(32).fill(0);if(!e)return Ce(t);const n=e.split(".");for(let r=n.length-1;r>=0;r-=1){const o=ud(n[r]),s=o?lr(o):Me(Ln(n[r]),"bytes");t=Me(Ct([t,s]),"bytes")}return Ce(t)}function pv(e){return`[${e.slice(2)}]`}function hv(e){const t=new Uint8Array(32).fill(0);return e?ud(e)||Me(Ln(e)):Ce(t)}function Ba(e){const t=e.replace(/^\.|\.$/gm,"");if(t.length===0)return new Uint8Array(1);const n=new Uint8Array(Ln(t).byteLength+2);let r=0;const o=t.split(".");for(let s=0;s<o.length;s++){let i=Ln(o[s]);i.byteLength>255&&(i=Ln(pv(hv(o[s])))),n[r]=i.length,n.set(i,r+1),r+=i.length+1}return n.byteLength!==r+1?n.slice(0,r+1):n}async function mv(e,t){const{blockNumber:n,blockTag:r,coinType:o,name:s,gatewayUrls:i,strict:c}=t,{chain:a}=e,l=(()=>{if(t.universalResolverAddress)return t.universalResolverAddress;if(!a)throw new Error("client chain not configured. universalResolverAddress is required.");return Pr({blockNumber:n,chain:a,contract:"ensUniversalResolver"})})(),u=a==null?void 0:a.ensTlds;if(u&&!u.some(p=>s.endsWith(p)))return null;const f=o!=null?[Ma(s),BigInt(o)]:[Ma(s)];try{const p=Ot({abi:Yf,functionName:"addr",args:f}),d={address:l,abi:Kf,functionName:"resolveWithGateways",args:[vn(Ba(s)),p,i??[$o]],blockNumber:n,blockTag:r},m=await te(e,Dt,"readContract")(d);if(m[0]==="0x")return null;const x=_n({abi:Yf,args:f,functionName:"addr",data:m[0]});return x==="0x"||Bn(x)==="0x00"?null:x}catch(p){if(c)throw p;if($a(p))return null;throw p}}class bv extends V{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 ko extends V{constructor({reason:t}){super(`ENS NFT avatar URI is invalid. ${t}`,{name:"EnsAvatarInvalidNftUriError"})}}class La extends V{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 gv extends V{constructor({namespace:t}){super(`ENS NFT avatar namespace "${t}" is not supported. Must be "erc721" or "erc1155".`,{name:"EnsAvatarUnsupportedNamespaceError"})}}const yv=/(?<protocol>https?:\/\/[^/]*|ipfs:\/|ipns:\/|ar:\/)?(?<root>\/)?(?<subpath>ipfs\/|ipns\/)?(?<target>[\w\-.]+)(?<subtarget>\/.*)?/,vv=/^(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>\/.*)?$/,wv=/^data:([a-zA-Z\-/+]*);base64,([^"].*)/,xv=/^data:([a-zA-Z\-/+]*)?(;[a-zA-Z0-9].*?)?(,)/;async function Ev(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 fd(e,t){return e?e.endsWith("/")?e.slice(0,-1):e:t}function dd({uri:e,gatewayUrls:t}){const n=wv.test(e);if(n)return{uri:e,isOnChain:!0,isEncoded:n};const r=fd(t==null?void 0:t.ipfs,"https://ipfs.io"),o=fd(t==null?void 0:t.arweave,"https://arweave.net"),s=e.match(yv),{protocol:i,subpath:c,target:a,subtarget:l=""}=(s==null?void 0:s.groups)||{},u=i==="ipns:/"||c==="ipns/",f=i==="ipfs:/"||c==="ipfs/"||vv.test(e);if(e.startsWith("http")&&!u&&!f){let d=e;return t!=null&&t.arweave&&(d=e.replace(/https:\/\/arweave.net/g,t==null?void 0:t.arweave)),{uri:d,isOnChain:!1,isEncoded:!1}}if((u||f)&&a)return{uri:`${r}/${u?"ipns":"ipfs"}/${a}${l}`,isOnChain:!1,isEncoded:!1};if(i==="ar:/"&&a)return{uri:`${o}/${a}${l||""}`,isOnChain:!1,isEncoded:!1};let p=e.replace(xv,"");if(p.startsWith("<svg")&&(p=`data:image/svg+xml;base64,${btoa(p)}`),p.startsWith("data:")||p.startsWith("{"))return{uri:p,isOnChain:!0,isEncoded:!1};throw new La({uri:e})}function pd(e){if(typeof e!="object"||!("image"in e)&&!("image_url"in e)&&!("image_data"in e))throw new bv({data:e});return e.image||e.image_url||e.image_data}async function Sv({gatewayUrls:e,uri:t}){try{const n=await fetch(t).then(o=>o.json());return await Fa({gatewayUrls:e,uri:pd(n)})}catch{throw new La({uri:t})}}async function Fa({gatewayUrls:e,uri:t}){const{uri:n,isOnChain:r}=dd({uri:t,gatewayUrls:e});if(r||await Ev(n))return n;throw new La({uri:t})}function Pv(e){let t=e;t.startsWith("did:nft:")&&(t=t.replace("did:nft:","").replace(/_/g,"/"));const[n,r,o]=t.split("/"),[s,i]=n.split(":"),[c,a]=r.split(":");if(!s||s.toLowerCase()!=="eip155")throw new ko({reason:"Only EIP-155 supported"});if(!i)throw new ko({reason:"Chain ID not found"});if(!a)throw new ko({reason:"Contract address not found"});if(!o)throw new ko({reason:"Token ID not found"});if(!c)throw new ko({reason:"ERC namespace not found"});return{chainID:Number.parseInt(i,10),namespace:c.toLowerCase(),contractAddress:a,tokenID:o}}async function Tv(e,{nft:t}){if(t.namespace==="erc721")return Dt(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 Dt(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 gv({namespace:t.namespace})}async function Av(e,{gatewayUrls:t,record:n}){return/eip155:/i.test(n)?Nv(e,{gatewayUrls:t,record:n}):Fa({uri:n,gatewayUrls:t})}async function Nv(e,{gatewayUrls:t,record:n}){const r=Pv(n),o=await Tv(e,{nft:r}),{uri:s,isOnChain:i,isEncoded:c}=dd({uri:o,gatewayUrls:t});if(i&&(s.includes("data:application/json;base64,")||s.startsWith("{"))){const l=c?atob(s.replace("data:application/json;base64,","")):s,u=JSON.parse(l);return Fa({uri:pd(u),gatewayUrls:t})}let a=r.tokenID;return r.namespace==="erc1155"&&(a=a.replace("0x","").padStart(64,"0")),Sv({gatewayUrls:t,uri:s.replace(/(?:0x)?{id}/,a)})}async function hd(e,t){const{blockNumber:n,blockTag:r,key:o,name:s,gatewayUrls:i,strict:c}=t,{chain:a}=e,l=(()=>{if(t.universalResolverAddress)return t.universalResolverAddress;if(!a)throw new Error("client chain not configured. universalResolverAddress is required.");return Pr({blockNumber:n,chain:a,contract:"ensUniversalResolver"})})(),u=a==null?void 0:a.ensTlds;if(u&&!u.some(f=>s.endsWith(f)))return null;try{const f={address:l,abi:Kf,args:[vn(Ba(s)),Ot({abi:Zf,functionName:"text",args:[Ma(s),o]}),i??[$o]],functionName:"resolveWithGateways",blockNumber:n,blockTag:r},d=await te(e,Dt,"readContract")(f);if(d[0]==="0x")return null;const h=_n({abi:Zf,functionName:"text",data:d[0]});return h===""?null:h}catch(f){if(c)throw f;if($a(f))return null;throw f}}async function Cv(e,{blockNumber:t,blockTag:n,assetGatewayUrls:r,name:o,gatewayUrls:s,strict:i,universalResolverAddress:c}){const a=await te(e,hd,"getEnsText")({blockNumber:t,blockTag:n,key:"avatar",name:o,universalResolverAddress:c,gatewayUrls:s,strict:i});if(!a)return null;try{return await Av(e,{record:a,gatewayUrls:r})}catch{return null}}async function Ov(e,t){const{address:n,blockNumber:r,blockTag:o,coinType:s=60n,gatewayUrls:i,strict:c}=t,{chain:a}=e,l=(()=>{if(t.universalResolverAddress)return t.universalResolverAddress;if(!a)throw new Error("client chain not configured. universalResolverAddress is required.");return Pr({blockNumber:r,chain:a,contract:"ensUniversalResolver"})})();try{const u={address:l,abi:Hy,args:[n,s,i??[$o]],functionName:"reverseWithGateways",blockNumber:r,blockTag:o},f=te(e,Dt,"readContract"),[p]=await f(u);return p||null}catch(u){if(c)throw u;if($a(u))return null;throw u}}async function Iv(e,t){const{blockNumber:n,blockTag:r,name:o}=t,{chain:s}=e,i=(()=>{if(t.universalResolverAddress)return t.universalResolverAddress;if(!s)throw new Error("client chain not configured. universalResolverAddress is required.");return Pr({blockNumber:n,chain:s,contract:"ensUniversalResolver"})})(),c=s==null?void 0:s.ensTlds;if(c&&!c.some(l=>o.endsWith(l)))throw new Error(`${o} is not a valid ENS TLD (${c==null?void 0:c.join(", ")}) for chain "${s.name}" (id: ${s.id}).`);const[a]=await te(e,Dt,"readContract")({address:i,abi:[{inputs:[{type:"bytes"}],name:"findResolver",outputs:[{type:"address"},{type:"bytes32"},{type:"uint256"}],stateMutability:"view",type:"function"}],functionName:"findResolver",args:[vn(Ba(o))],blockNumber:n,blockTag:r});return a}async function md(e,t){var x,P,E;const{account:n=e.account,blockNumber:r,blockTag:o="latest",blobs:s,data:i,gas:c,gasPrice:a,maxFeePerBlobGas:l,maxFeePerGas:u,maxPriorityFeePerGas:f,to:p,value:d,...h}=t,m=n?nt(n):void 0;try{wr(t);const N=(typeof r=="bigint"?oe(r):void 0)||o,M=(E=(P=(x=e.chain)==null?void 0:x.formatters)==null?void 0:P.transactionRequest)==null?void 0:E.format,L=(M||xo)({...ms(h,{format:M}),account:m,blobs:s,data:i,gas:c,gasPrice:a,maxFeePerBlobGas:l,maxFeePerGas:u,maxPriorityFeePerGas:f,to:p,value:d},"createAccessList"),b=await e.request({method:"eth_createAccessList",params:[L,N]});return{accessList:b.accessList,gasUsed:BigInt(b.gasUsed)}}catch(T){throw td(T,{...t,account:m,chain:e.chain})}}async function $v(e){const t=us(e,{method:"eth_newBlockFilter"}),n=await e.request({method:"eth_newBlockFilter"});return{id:n,request:t(n),type:"block"}}async function bd(e,{address:t,args:n,event:r,events:o,fromBlock:s,strict:i,toBlock:c}={}){const a=o??(r?[r]:void 0),l=us(e,{method:"eth_newFilter"});let u=[];a&&(u=[a.flatMap(d=>Kr({abi:[d],eventName:d.name,args:n}))],r&&(u=u[0]));const f=await e.request({method:"eth_newFilter",params:[{address:t,fromBlock:typeof s=="bigint"?oe(s):s,toBlock:typeof c=="bigint"?oe(c):c,...u.length?{topics:u}:{}}]});return{abi:a,args:n,eventName:r?r.name:void 0,fromBlock:s,id:f,request:l(f),strict:!!i,toBlock:c,type:"event"}}async function gd(e){const t=us(e,{method:"eth_newPendingTransactionFilter"}),n=await e.request({method:"eth_newPendingTransactionFilter"});return{id:n,request:t(n),type:"transaction"}}async function kv(e,{address:t,blockNumber:n,blockTag:r=e.experimental_blockTag??"latest"}){const o=typeof n=="bigint"?oe(n):void 0,s=await e.request({method:"eth_getBalance",params:[t,o||r]});return BigInt(s)}async function Dv(e){const t=await e.request({method:"eth_blobBaseFee"});return BigInt(t)}async function Mv(e,{blockHash:t,blockNumber:n,blockTag:r="latest"}={}){const o=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:[o||r]},{dedupe:!!o}),Qt(s)}async function Ra(e,{address:t,blockNumber:n,blockTag:r="latest"}){const o=n!==void 0?oe(n):void 0,s=await e.request({method:"eth_getCode",params:[t,o||r]},{dedupe:!!o});if(s!=="0x")return s}class Bv extends V{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 Lv(e,t){const{address:n,factory:r,factoryData:o}=t;try{const[s,i,c,a,l,u,f]=await te(e,Dt,"readContract")({abi:Fv,address:n,functionName:"eip712Domain",factory:r,factoryData:o});return{domain:{name:i,version:c,chainId:Number(a),verifyingContract:l,salt:u},extensions:f,fields:s}}catch(s){const i=s;throw i.name==="ContractFunctionExecutionError"&&i.cause.name==="ContractFunctionZeroDataError"?new Bv({address:n}):i}}const Fv=[{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 Rv(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 jv(e,{blockCount:t,blockNumber:n,blockTag:r="latest",rewardPercentiles:o}){const s=typeof n=="bigint"?oe(n):void 0,i=await e.request({method:"eth_feeHistory",params:[oe(t),s||r,o]},{dedupe:!!s});return Rv(i)}async function zv(e,{filter:t}){const n=t.strict??!1,o=(await t.request({method:"eth_getFilterLogs",params:[t.id]})).map(s=>nn(s));return t.abi?fa({abi:t.abi,logs:o,strict:n}):o}async function Uv({address:e,authorization:t,signature:n}){return Eo(xn(e),await rf({authorization:t,signature:n}))}const Cs=new cs(8192);function _v(e,{enabled:t=!0,id:n}){if(!t||!n)return e();if(Cs.get(n))return Cs.get(n);const r=e().finally(()=>Cs.delete(n));return Cs.set(n,r),r}function Wv(e,t={}){return async(n,r={})=>{var f;const{dedupe:o=!1,methods:s,retryDelay:i=150,retryCount:c=3,uid:a}={...t,...r},{method:l}=n;if((f=s==null?void 0:s.exclude)!=null&&f.includes(l))throw new Un(new Error("method not supported"),{method:l});if(s!=null&&s.include&&!s.include.includes(l))throw new Un(new Error("method not supported"),{method:l});const u=o?Vr(`${a}.${Oe(n)}`):void 0;return _v(()=>Oa(async()=>{try{return await e(n)}catch(p){const d=p;switch(d.code){case Qr.code:throw new Qr(d);case eo.code:throw new eo(d);case to.code:throw new to(d,{method:n.method});case no.code:throw new no(d);case zn.code:throw new zn(d);case Sn.code:throw new Sn(d);case ro.code:throw new ro(d);case oo.code:throw new oo(d);case so.code:throw new so(d);case Un.code:throw new Un(d,{method:n.method});case br.code:throw new br(d);case io.code:throw new io(d);case gr.code:throw new gr(d);case ao.code:throw new ao(d);case co.code:throw new co(d);case lo.code:throw new lo(d);case uo.code:throw new uo(d);case fo.code:throw new fo(d);case po.code:throw new po(d);case ho.code:throw new ho(d);case mo.code:throw new mo(d);case bo.code:throw new bo(d);case go.code:throw new go(d);case yo.code:throw new yo(d);case vo.code:throw new vo(d);case 5e3:throw new gr(d);default:throw p instanceof V?p:new Ig(d)}}},{delay:({count:p,error:d})=>{var h;if(d&&d instanceof jn){const m=(h=d==null?void 0:d.headers)==null?void 0:h.get("Retry-After");if(m!=null&&m.match(/\d/))return Number.parseInt(m,10)*1e3}return~~(1<<p)*i},retryCount:c,shouldRetry:({error:p})=>Vv(p)}),{enabled:o,id:u})}}function Vv(e){return"code"in e&&typeof e.code=="number"?e.code===-1||e.code===br.code||e.code===zn.code:e instanceof jn&&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 Hv extends V{constructor({callbackSelector:t,cause:n,data:r,extraData:o,sender:s,urls:i}){var c;super(n.shortMessage||"An error occurred while fetching for an offchain result.",{cause:n,metaMessages:[...n.metaMessages||[],(c=n.metaMessages)!=null&&c.length?"":[],"Offchain Gateway Call:",i&&[" Gateway URL(s):",...i.map(a=>` ${Jr(a)}`)],` Sender: ${s}`,` Data: ${r}`,` Callback selector: ${t}`,` Extra data: ${o}`].flat(),name:"OffchainLookupError"})}}class Gv extends V{constructor({result:t,url:n}){super("Offchain gateway response is malformed. Response data must be a hex value.",{metaMessages:[`Gateway URL: ${Jr(n)}`,`Response: ${Oe(t)}`],name:"OffchainLookupResponseMalformedError"})}}class qv extends V{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 Kv="0x556f1830",yd={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 Zv(e,{blockNumber:t,blockTag:n,data:r,to:o}){const{args:s}=Hu({data:r,abi:[yd]}),[i,c,a,l,u]=s,{ccipRead:f}=e,p=f&&typeof(f==null?void 0:f.request)=="function"?f.request:vd;try{if(!Eo(o,i))throw new qv({sender:i,to:o});const d=c.includes($o)?await ld({data:a,ccipRequest:p}):await p({data:a,sender:i,urls:c}),{data:h}=await Co(e,{blockNumber:t,blockTag:n,data:Ct([l,En([{type:"bytes"},{type:"bytes"}],[d,u])]),to:o});return h}catch(d){throw new Hv({callbackSelector:l,cause:d,data:r,extraData:u,sender:i,urls:c})}}async function vd({data:e,sender:t,urls:n}){var o;let r=new Error("An unknown error occurred.");for(let s=0;s<n.length;s++){const i=n[s],c=i.includes("{data}")?"GET":"POST",a=c==="POST"?{data:e,sender:t}:void 0,l=c==="POST"?{"Content-Type":"application/json"}:{};try{const u=await fetch(i.replace("{sender}",t.toLowerCase()).replace("{data}",e),{body:JSON.stringify(a),headers:l,method:c});let f;if((o=u.headers.get("Content-Type"))!=null&&o.startsWith("application/json")?f=(await u.json()).data:f=await u.text(),!u.ok){r=new jn({body:a,details:f!=null&&f.error?Oe(f.error):u.statusText,headers:u.headers,status:u.status,url:i});continue}if(!At(f)){r=new Gv({result:f,url:i});continue}return f}catch(u){r=new jn({body:a,details:u.message,url:i})}}throw r}const Yv=Object.freeze(Object.defineProperty({__proto__:null,ccipRequest:vd,offchainLookup:Zv,offchainLookupAbiItem:yd,offchainLookupSignature:Kv},Symbol.toStringTag,{value:"Module"}));function Xv(e){return{formatters:void 0,fees:void 0,serializers:void 0,...e}}function Jv(e,{errorInstance:t=new Error("timed out"),timeout:n,signal:r}){return new Promise((o,s)=>{(async()=>{let i;try{const c=new AbortController;n>0&&(i=setTimeout(()=>{r&&c.abort()},n)),o(await e({signal:(c==null?void 0:c.signal)||null}))}catch(c){(c==null?void 0:c.name)==="AbortError"&&s(t),s(c)}finally{clearTimeout(i)}})()})}function Qv(){return{current:0,take(){return this.current++},reset(){this.current=0}}}const wd=Qv();function ew(e,t={}){return{async request(n){var p;const{body:r,fetchFn:o=t.fetchFn??fetch,onRequest:s=t.onRequest,onResponse:i=t.onResponse,timeout:c=t.timeout??1e4}=n,a={...t.fetchOptions??{},...n.fetchOptions??{}},{headers:l,method:u,signal:f}=a;try{const d=await Jv(async({signal:m})=>{const x={...a,body:Array.isArray(r)?Oe(r.map(N=>({jsonrpc:"2.0",id:N.id??wd.take(),...N}))):Oe({jsonrpc:"2.0",id:r.id??wd.take(),...r}),headers:{"Content-Type":"application/json",...l},method:u||"POST",signal:f||(c>0?m:null)},P=new Request(e,x),E=await(s==null?void 0:s(P,x))??{...x,url:e};return await o(E.url??e,E)},{errorInstance:new Ju({body:r,url:e}),timeout:c,signal:!0});i&&await i(d);let h;if((p=d.headers.get("Content-Type"))!=null&&p.startsWith("application/json"))h=await d.json();else{h=await d.text();try{h=JSON.parse(h||"{}")}catch(m){if(d.ok)throw m;h={error:h}}}if(!d.ok)throw new jn({body:r,details:Oe(h.error)||d.statusText,headers:d.headers,status:d.status,url:e});return h}catch(d){throw d instanceof jn||d instanceof Ju?d:new jn({body:r,cause:d,url:e})}}}}const tw=`Ethereum Signed Message:
|
|
89
|
+
`;function nw(e){const t=typeof e=="string"?Vr(e):typeof e.raw=="string"?e.raw:Ce(e.raw),n=Vr(`${tw}${Ee(t)}`);return Ct([n,t])}function xd(e,t){return Me(nw(e),t)}class rw extends V{constructor({domain:t}){super(`Invalid domain "${Oe(t)}".`,{metaMessages:["Must be a valid EIP-712 domain."]})}}class ow extends V{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 sw extends V{constructor({type:t}){super(`Struct type "${t}" is invalid.`,{metaMessages:["Struct type must not be a Solidity type."],name:"InvalidStructTypeError"})}}function iw(e){const{domain:t,message:n,primaryType:r,types:o}=e,s=(i,c)=>{for(const a of i){const{name:l,type:u}=a,f=c[l],p=u.match(Bu);if(p&&(typeof f=="number"||typeof f=="bigint")){const[m,x,P]=p;oe(f,{signed:x==="int",size:Number.parseInt(P,10)/8})}if(u==="address"&&typeof f=="string"&&!dt(f))throw new wn({address:f});const d=u.match(q1);if(d){const[m,x]=d;if(x&&Ee(f)!==Number.parseInt(x,10))throw new t1({expectedSize:Number.parseInt(x,10),givenSize:Ee(f)})}const h=o[u];h&&(cw(u),s(h,f))}};if(o.EIP712Domain&&t){if(typeof t!="object")throw new rw({domain:t});s(o.EIP712Domain,t)}if(r!=="EIP712Domain")if(o[r])s(o[r],n);else throw new ow({primaryType:r,types:o})}function aw({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 cw(e){if(e==="address"||e==="bool"||e==="string"||e.startsWith("bytes")||e.startsWith("uint")||e.startsWith("int"))throw new sw({type:e})}function lw(e){const{domain:t={},message:n,primaryType:r}=e,o={EIP712Domain:aw({domain:t}),...e.types};iw({domain:t,message:n,primaryType:r,types:o});const s=["0x1901"];return t&&s.push(uw({domain:t,types:o})),r!=="EIP712Domain"&&s.push(Ed({data:n,primaryType:r,types:o})),Me(Ct(s))}function uw({domain:e,types:t}){return Ed({data:e,primaryType:"EIP712Domain",types:t})}function Ed({data:e,primaryType:t,types:n}){const r=Sd({data:e,primaryType:t,types:n});return Me(r)}function Sd({data:e,primaryType:t,types:n}){const r=[{type:"bytes32"}],o=[fw({primaryType:t,types:n})];for(const s of n[t]){const[i,c]=Td({types:n,name:s.name,type:s.type,value:e[s.name]});r.push(i),o.push(c)}return En(r,o)}function fw({primaryType:e,types:t}){const n=vn(dw({primaryType:e,types:t}));return Me(n)}function dw({primaryType:e,types:t}){let n="";const r=Pd({primaryType:e,types:t});r.delete(e);const o=[e,...Array.from(r).sort()];for(const s of o)n+=`${s}(${t[s].map(({name:i,type:c})=>`${c} ${i}`).join(",")})`;return n}function Pd({primaryType:e,types:t},n=new Set){const r=e.match(/^\w*/u),o=r==null?void 0:r[0];if(n.has(o)||t[o]===void 0)return n;n.add(o);for(const s of t[o])Pd({primaryType:s.type,types:t},n);return n}function Td({types:e,name:t,type:n,value:r}){if(e[n]!==void 0)return[{type:"bytes32"},Me(Sd({data:r,primaryType:n,types:e}))];if(n==="bytes")return[{type:"bytes32"},Me(r)];if(n==="string")return[{type:"bytes32"},Me(vn(r))];if(n.lastIndexOf("]")===n.length-1){const o=n.slice(0,n.lastIndexOf("[")),s=r.map(i=>Td({name:t,type:o,types:e,value:i}));return[{type:"bytes32"},Me(En(s.map(([i])=>i),s.map(([,i])=>i)))]}return[{type:n},r]}class pw 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 ja={checksum:new pw(8192)}.checksum;function Ad(e,t={}){const{as:n=typeof e=="string"?"Hex":"Bytes"}=t,r=Iu(Ty(e));return n==="Bytes"?r:kt(r)}const hw=/^0x[a-fA-F0-9]{40}$/;function Os(e,t={}){const{strict:n=!0}=t;if(!hw.test(e))throw new Cd({address:e,cause:new mw});if(n){if(e.toLowerCase()===e)return;if(Nd(e)!==e)throw new Cd({address:e,cause:new bw})}}function Nd(e){if(ja.has(e))return ja.get(e);Os(e,{strict:!1});const t=e.substring(2).toLowerCase(),n=Ad(Ny(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 o=`0x${r.join("")}`;return ja.set(e,o),o}function za(e,t={}){const{strict:n=!0}=t??{};try{return Os(e,{strict:n}),!0}catch{return!1}}class Cd extends ue{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 mw extends ue{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 bw extends ue{constructor(){super("Address does not match its checksum counterpart."),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Address.InvalidChecksumError"})}}const gw=/^(.*)\[([0-9]*)\]$/,yw=/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/,Od=/^(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)?$/,Id=2n**256n-1n;function Tr(e,t,n){const{checksumAddress:r,staticPosition:o}=n,s=Va(t.type);if(s){const[i,c]=s;return ww(e,{...t,type:c},{checksumAddress:r,length:i,staticPosition:o})}if(t.type==="tuple")return Pw(e,t,{checksumAddress:r,staticPosition:o});if(t.type==="address")return vw(e,{checksum:r});if(t.type==="bool")return xw(e);if(t.type.startsWith("bytes"))return Ew(e,t,{staticPosition:o});if(t.type.startsWith("uint")||t.type.startsWith("int"))return Sw(e,t);if(t.type==="string")return Tw(e,{staticPosition:o});throw new qa(t.type)}const $d=32,Ua=32;function vw(e,t={}){const{checksum:n=!1}=t,r=e.readBytes(32);return[(s=>n?Nd(s):s)(kt(Oy(r,-20))),32]}function ww(e,t,n){const{checksumAddress:r,length:o,staticPosition:s}=n;if(!o){const a=sn(e.readBytes(Ua)),l=s+a,u=l+$d;e.setPosition(l);const f=sn(e.readBytes($d)),p=Do(t);let d=0;const h=[];for(let m=0;m<f;++m){e.setPosition(u+(p?m*32:d));const[x,P]=Tr(e,t,{checksumAddress:r,staticPosition:u});d+=P,h.push(x)}return e.setPosition(s+32),[h,32]}if(Do(t)){const a=sn(e.readBytes(Ua)),l=s+a,u=[];for(let f=0;f<o;++f){e.setPosition(l+f*32);const[p]=Tr(e,t,{checksumAddress:r,staticPosition:l});u.push(p)}return e.setPosition(s+32),[u,32]}let i=0;const c=[];for(let a=0;a<o;++a){const[l,u]=Tr(e,t,{checksumAddress:r,staticPosition:s+i});i+=u,c.push(l)}return[c,i]}function xw(e){return[$y(e.readBytes(32),{size:32}),32]}function Ew(e,t,{staticPosition:n}){const[r,o]=t.type.split("bytes");if(!o){const i=sn(e.readBytes(32));e.setPosition(n+i);const c=sn(e.readBytes(32));if(c===0)return e.setPosition(n+32),["0x",32];const a=e.readBytes(c);return e.setPosition(n+32),[kt(a),32]}return[kt(e.readBytes(Number.parseInt(o,10),32)),32]}function Sw(e,t){const n=t.type.startsWith("int"),r=Number.parseInt(t.type.split("int")[1]||"256",10),o=e.readBytes(32);return[r>48?Iy(o,{signed:n}):sn(o,{signed:n}),32]}function Pw(e,t,n){const{checksumAddress:r,staticPosition:o}=n,s=t.components.length===0||t.components.some(({name:a})=>!a),i=s?[]:{};let c=0;if(Do(t)){const a=sn(e.readBytes(Ua)),l=o+a;for(let u=0;u<t.components.length;++u){const f=t.components[u];e.setPosition(l+c);const[p,d]=Tr(e,f,{checksumAddress:r,staticPosition:l});c+=d,i[s?u:f==null?void 0:f.name]=p}return e.setPosition(o+32),[i,32]}for(let a=0;a<t.components.length;++a){const l=t.components[a],[u,f]=Tr(e,l,{checksumAddress:r,staticPosition:o});i[s?a:l==null?void 0:l.name]=u,c+=f}return[i,c]}function Tw(e,{staticPosition:t}){const n=sn(e.readBytes(32)),r=t+n;e.setPosition(r);const o=sn(e.readBytes(32));if(o===0)return e.setPosition(t+32),["",32];const s=e.readBytes(o,32),i=ky(Rf(s));return e.setPosition(t+32),[i,32]}function Aw({checksumAddress:e,parameters:t,values:n}){const r=[];for(let o=0;o<t.length;o++)r.push(_a({checksumAddress:e,parameter:t[o],value:n[o]}));return r}function _a({checksumAddress:e=!1,parameter:t,value:n}){const r=t,o=Va(r.type);if(o){const[s,i]=o;return Cw(n,{checksumAddress:e,length:s,parameter:{...r,type:i}})}if(r.type==="tuple")return Dw(n,{checksumAddress:e,parameter:r});if(r.type==="address")return Nw(n,{checksum:e});if(r.type==="bool")return Iw(n);if(r.type.startsWith("uint")||r.type.startsWith("int")){const s=r.type.startsWith("int"),[,,i="256"]=Od.exec(r.type)??[];return $w(n,{signed:s,size:Number(i)})}if(r.type.startsWith("bytes"))return Ow(n,{type:r.type});if(r.type==="string")return kw(n);throw new qa(r.type)}function Wa(e){let t=0;for(let s=0;s<e.length;s++){const{dynamic:i,encoded:c}=e[s];i?t+=32:t+=ot(c)}const n=[],r=[];let o=0;for(let s=0;s<e.length;s++){const{dynamic:i,encoded:c}=e[s];i?(n.push(Fe(t+o,{size:32})),r.push(c),o+=ot(c)):n.push(c)}return $t(...n,...r)}function Nw(e,t){const{checksum:n=!1}=t;return Os(e,{strict:n}),{dynamic:!1,encoded:Vn(e.toLowerCase())}}function Cw(e,t){const{checksumAddress:n,length:r,parameter:o}=t,s=r===null;if(!Array.isArray(e))throw new _w(e);if(!s&&e.length!==r)throw new Uw({expectedLength:r,givenLength:e.length,type:`${o.type}[${r}]`});let i=!1;const c=[];for(let a=0;a<e.length;a++){const l=_a({checksumAddress:n,parameter:o,value:e[a]});l.dynamic&&(i=!0),c.push(l)}if(s||i){const a=Wa(c);if(s){const l=Fe(c.length,{size:32});return{dynamic:!0,encoded:c.length>0?$t(l,a):l}}if(i)return{dynamic:!0,encoded:a}}return{dynamic:!1,encoded:$t(...c.map(({encoded:a})=>a))}}function Ow(e,{type:t}){const[,n]=t.split("bytes"),r=ot(e);if(!n){let o=e;return r%32!==0&&(o=Hn(o,Math.ceil((e.length-2)/2/32)*32)),{dynamic:!0,encoded:$t(Vn(Fe(r,{size:32})),o)}}if(r!==Number.parseInt(n,10))throw new Md({expectedSize:Number.parseInt(n,10),value:e});return{dynamic:!1,encoded:Hn(e)}}function Iw(e){if(typeof e!="boolean")throw new ue(`Invalid boolean value: "${e}" (type: ${typeof e}). Expected: \`true\` or \`false\`.`);return{dynamic:!1,encoded:Vn(jf(e))}}function $w(e,{signed:t,size:n}){if(typeof n=="number"){const r=2n**(BigInt(n)-(t?1n:0n))-1n,o=t?-r-1n:0n;if(e>r||e<o)throw new _f({max:r.toString(),min:o.toString(),signed:t,size:n/8,value:e.toString()})}return{dynamic:!1,encoded:Fe(e,{size:32,signed:t})}}function kw(e){const t=wa(e),n=Math.ceil(ot(t)/32),r=[];for(let o=0;o<n;o++)r.push(Hn(zt(t,o*32,(o+1)*32)));return{dynamic:!0,encoded:$t(Hn(Fe(ot(t),{size:32})),...r)}}function Dw(e,t){const{checksumAddress:n,parameter:r}=t;let o=!1;const s=[];for(let i=0;i<r.components.length;i++){const c=r.components[i],a=Array.isArray(e)?i:c.name,l=_a({checksumAddress:n,parameter:c,value:e[a]});s.push(l),l.dynamic&&(o=!0)}return{dynamic:o,encoded:o?Wa(s):$t(...s.map(({encoded:i})=>i))}}function Va(e){const t=e.match(/^(.*)\[(\d+)?\]$/);return t?[t[2]?Number(t[2]):null,t[1]]:void 0}function Do(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(Do);const n=Va(e.type);return!!(n&&Do({...e,type:n[1]}))}const Mw={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 Fw({count:this.recursiveReadCount+1,limit:this.recursiveReadLimit})},assertPosition(e){if(e<0||e>this.bytes.length-1)throw new Lw({length:this.bytes.length,position:e})},decrementPosition(e){if(e<0)throw new kd({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 kd({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 Bw(e,{recursiveReadLimit:t=8192}={}){const n=Object.create(Mw);return n.bytes=e,n.dataView=new DataView(e.buffer,e.byteOffset,e.byteLength),n.positionReadCount=new Map,n.recursiveReadLimit=t,n}class kd extends ue{constructor({offset:t}){super(`Offset \`${t}\` cannot be negative.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Cursor.NegativeOffsetError"})}}class Lw extends ue{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 Fw extends ue{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 Rw(e,t,n={}){const{as:r="Array",checksumAddress:o=!1}=n,s=typeof t=="string"?Ff(t):t,i=Bw(s);if(Er(s)===0&&e.length>0)throw new zw;if(Er(s)&&Er(s)<32)throw new jw({data:typeof t=="string"?t:kt(t),parameters:e,size:Er(s)});let c=0;const a=r==="Array"?[]:{};for(let l=0;l<e.length;++l){const u=e[l];i.setPosition(c);const[f,p]=Tr(i,u,{checksumAddress:o,staticPosition:0});c+=p,r==="Array"?a.push(f):a[u.name??l]=f}return a}function Ha(e,t,n){const{checksumAddress:r=!1}={};if(e.length!==t.length)throw new Bd({expectedLength:e.length,givenLength:t.length});const o=Aw({checksumAddress:r,parameters:e,values:t}),s=Wa(o);return s.length===0?"0x":s}function Ga(e,t){if(e.length!==t.length)throw new Bd({expectedLength:e.length,givenLength:t.length});const n=[];for(let r=0;r<e.length;r++){const o=e[r],s=t[r];n.push(Ga.encode(o,s))}return $t(...n)}(function(e){function t(n,r,o=!1){if(n==="address"){const a=r;return Os(a),Vn(a.toLowerCase(),o?32:0)}if(n==="string")return wa(r);if(n==="bytes")return r;if(n==="bool")return Vn(jf(r),o?32:1);const s=n.match(Od);if(s){const[a,l,u="256"]=s,f=Number.parseInt(u,10)/8;return Fe(r,{size:o?32:f,signed:l==="int"})}const i=n.match(yw);if(i){const[a,l]=i;if(Number.parseInt(l,10)!==(r.length-2)/2)throw new Md({expectedSize:Number.parseInt(l,10),value:r});return Hn(r,o?32:0)}const c=n.match(gw);if(c&&Array.isArray(r)){const[a,l]=c,u=[];for(let f=0;f<r.length;f++)u.push(t(l,r[f],!0));return u.length===0?"0x":$t(...u)}throw new qa(n)}e.encode=t})(Ga||(Ga={}));function Dd(e){return Array.isArray(e)&&typeof e[0]=="string"||typeof e=="string"?ou(e):e}class jw extends ue{constructor({data:t,parameters:n,size:r}){super(`Data size of ${r} bytes is too small for given parameters.`,{metaMessages:[`Params: (${sr(n)})`,`Data: ${t} (${r} bytes)`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiParameters.DataSizeTooSmallError"})}}class zw extends ue{constructor(){super('Cannot decode zero data ("0x") with ABI parameters.'),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiParameters.ZeroDataError"})}}class Uw extends ue{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 Md extends ue{constructor({expectedSize:t,value:n}){super(`Size of bytes "${n}" (bytes${ot(n)}) does not match expected size (bytes${t}).`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiParameters.BytesSizeMismatchError"})}}class Bd extends ue{constructor({expectedLength:t,givenLength:n}){super(["ABI encoding parameters/values length mismatch.",`Expected length (parameters): ${t}`,`Given length (values): ${n}`].join(`
|
|
90
|
+
`)),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiParameters.LengthMismatchError"})}}class _w extends ue{constructor(t){super(`Value \`${t}\` is not a valid array.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiParameters.InvalidArrayError"})}}class qa extends ue{constructor(t){super(`Type \`${t}\` is not a valid ABI Type.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiParameters.InvalidTypeError"})}}class Ld extends Mi{constructor(t,n){super(),this.finished=!1,this.destroyed=!1,S1(t);const r=is(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 o=this.blockLen,s=new Uint8Array(o);s.set(r.length>o?t.create().update(r).digest():r);for(let i=0;i<s.length;i++)s[i]^=54;this.iHash.update(s),this.oHash=t.create();for(let i=0;i<s.length;i++)s[i]^=106;this.oHash.update(s),dr(s)}update(t){return fr(this),this.iHash.update(t),this}digestInto(t){fr(this),Fn(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:o,destroyed:s,blockLen:i,outputLen:c}=this;return t=t,t.finished=o,t.destroyed=s,t.blockLen=i,t.outputLen=c,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 Fd=(e,t,n)=>new Ld(e,t).update(n).digest();Fd.create=(e,t)=>new Ld(e,t);/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const Ge=BigInt(0),Re=BigInt(1),Gn=BigInt(2),Ww=BigInt(3),Rd=BigInt(4),jd=BigInt(5),zd=BigInt(8);function qe(e,t){const n=e%t;return n>=Ge?n:t+n}function ht(e,t,n){let r=e;for(;t-- >Ge;)r*=r,r%=n;return r}function Ka(e,t){if(e===Ge)throw new Error("invert: expected non-zero number");if(t<=Ge)throw new Error("invert: expected positive modulus, got "+t);let n=qe(e,t),r=t,o=Ge,s=Re;for(;n!==Ge;){const c=r/n,a=r%n,l=o-s*c;r=n,n=a,o=s,s=l}if(r!==Re)throw new Error("invert: does not exist");return qe(o,t)}function Ud(e,t){const n=(e.ORDER+Re)/Rd,r=e.pow(t,n);if(!e.eql(e.sqr(r),t))throw new Error("Cannot find square root");return r}function Vw(e,t){const n=(e.ORDER-jd)/zd,r=e.mul(t,Gn),o=e.pow(r,n),s=e.mul(t,o),i=e.mul(e.mul(s,Gn),o),c=e.mul(s,e.sub(i,e.ONE));if(!e.eql(e.sqr(c),t))throw new Error("Cannot find square root");return c}function Hw(e){if(e<BigInt(3))throw new Error("sqrt is not defined for small field");let t=e-Re,n=0;for(;t%Gn===Ge;)t/=Gn,n++;let r=Gn;const o=Za(e);for(;Wd(o,r)===1;)if(r++>1e3)throw new Error("Cannot find square root: probably non-prime P");if(n===1)return Ud;let s=o.pow(r,t);const i=(t+Re)/Gn;return function(a,l){if(a.is0(l))return l;if(Wd(a,l)!==1)throw new Error("Cannot find square root");let u=n,f=a.mul(a.ONE,s),p=a.pow(l,t),d=a.pow(l,i);for(;!a.eql(p,a.ONE);){if(a.is0(p))return a.ZERO;let h=1,m=a.sqr(p);for(;!a.eql(m,a.ONE);)if(h++,m=a.sqr(m),h===u)throw new Error("Cannot find square root");const x=Re<<BigInt(u-h-1),P=a.pow(f,x);u=h,f=a.sqr(P),p=a.mul(p,f),d=a.mul(d,P)}return d}}function Gw(e){return e%Rd===Ww?Ud:e%zd===jd?Vw:Hw(e)}const qw=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function Kw(e){const t={ORDER:"bigint",MASK:"bigint",BYTES:"isSafeInteger",BITS:"isSafeInteger"},n=qw.reduce((r,o)=>(r[o]="function",r),t);return xs(e,n)}function Zw(e,t,n){if(n<Ge)throw new Error("invalid exponent, negatives unsupported");if(n===Ge)return e.ONE;if(n===Re)return t;let r=e.ONE,o=t;for(;n>Ge;)n&Re&&(r=e.mul(r,o)),o=e.sqr(o),n>>=Re;return r}function _d(e,t,n=!1){const r=new Array(t.length).fill(n?e.ZERO:void 0),o=t.reduce((i,c,a)=>e.is0(c)?i:(r[a]=i,e.mul(i,c)),e.ONE),s=e.inv(o);return t.reduceRight((i,c,a)=>e.is0(c)?i:(r[a]=e.mul(i,r[a]),e.mul(i,c)),s),r}function Wd(e,t){const n=(e.ORDER-Re)/Gn,r=e.pow(t,n),o=e.eql(r,e.ONE),s=e.eql(r,e.ZERO),i=e.eql(r,e.neg(e.ONE));if(!o&&!s&&!i)throw new Error("invalid Legendre symbol result");return o?1:s?0:-1}function Vd(e,t){t!==void 0&&Hr(t);const n=t!==void 0?t:e.toString(2).length,r=Math.ceil(n/8);return{nBitLength:n,nByteLength:r}}function Za(e,t,n=!1,r={}){if(e<=Ge)throw new Error("invalid field: expected ORDER > 0, got "+e);const{nBitLength:o,nByteLength:s}=Vd(e,t);if(s>2048)throw new Error("invalid field: expected ORDER of <= 2048 bytes");let i;const c=Object.freeze({ORDER:e,isLE:n,BITS:o,BYTES:s,MASK:ws(o),ZERO:Ge,ONE:Re,create:a=>qe(a,e),isValid:a=>{if(typeof a!="bigint")throw new Error("invalid field element: expected bigint, got "+typeof a);return Ge<=a&&a<e},is0:a=>a===Ge,isOdd:a=>(a&Re)===Re,neg:a=>qe(-a,e),eql:(a,l)=>a===l,sqr:a=>qe(a*a,e),add:(a,l)=>qe(a+l,e),sub:(a,l)=>qe(a-l,e),mul:(a,l)=>qe(a*l,e),pow:(a,l)=>Zw(c,a,l),div:(a,l)=>qe(a*Ka(l,e),e),sqrN:a=>a*a,addN:(a,l)=>a+l,subN:(a,l)=>a-l,mulN:(a,l)=>a*l,inv:a=>Ka(a,e),sqrt:r.sqrt||(a=>(i||(i=Gw(e)),i(c,a))),toBytes:a=>n?Of(a,s):Ao(a,s),fromBytes:a=>{if(a.length!==s)throw new Error("Field.fromBytes: expected "+s+" bytes, got "+a.length);return n?Cf(a):Wn(a)},invertBatch:a=>_d(c,a),cmov:(a,l,u)=>u?l:a});return Object.freeze(c)}function Hd(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 Gd(e){const t=Hd(e);return t+Math.ceil(t/2)}function Yw(e,t,n=!1){const r=e.length,o=Hd(t),s=Gd(t);if(r<16||r<s||r>1024)throw new Error("expected "+s+"-1024 bytes of input, got "+r);const i=n?Cf(e):Wn(e),c=qe(i,t-Re)+Re;return n?Of(c,o):Ao(c,o)}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const qd=BigInt(0),Ya=BigInt(1);function Xa(e,t){const n=t.negate();return e?n:t}function Kd(e,t){if(!Number.isSafeInteger(e)||e<=0||e>t)throw new Error("invalid window size, expected [1.."+t+"], got W="+e)}function Ja(e,t){Kd(e,t);const n=Math.ceil(t/e)+1,r=2**(e-1),o=2**e,s=ws(e),i=BigInt(e);return{windows:n,windowSize:r,mask:s,maxNumber:o,shiftBy:i}}function Zd(e,t,n){const{windowSize:r,mask:o,maxNumber:s,shiftBy:i}=n;let c=Number(e&o),a=e>>i;c>r&&(c-=s,a+=Ya);const l=t*r,u=l+Math.abs(c)-1,f=c===0,p=c<0,d=t%2!==0;return{nextN:a,offset:u,isZero:f,isNeg:p,isNegF:d,offsetF:l}}function Xw(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 Jw(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 Qa=new WeakMap,Yd=new WeakMap;function ec(e){return Yd.get(e)||1}function Qw(e,t){return{constTimeNegate:Xa,hasPrecomputes(n){return ec(n)!==1},unsafeLadder(n,r,o=e.ZERO){let s=n;for(;r>qd;)r&Ya&&(o=o.add(s)),s=s.double(),r>>=Ya;return o},precomputeWindow(n,r){const{windows:o,windowSize:s}=Ja(r,t),i=[];let c=n,a=c;for(let l=0;l<o;l++){a=c,i.push(a);for(let u=1;u<s;u++)a=a.add(c),i.push(a);c=a.double()}return i},wNAF(n,r,o){let s=e.ZERO,i=e.BASE;const c=Ja(n,t);for(let a=0;a<c.windows;a++){const{nextN:l,offset:u,isZero:f,isNeg:p,isNegF:d,offsetF:h}=Zd(o,a,c);o=l,f?i=i.add(Xa(d,r[h])):s=s.add(Xa(p,r[u]))}return{p:s,f:i}},wNAFUnsafe(n,r,o,s=e.ZERO){const i=Ja(n,t);for(let c=0;c<i.windows&&o!==qd;c++){const{nextN:a,offset:l,isZero:u,isNeg:f}=Zd(o,c,i);if(o=a,!u){const p=r[l];s=s.add(f?p.negate():p)}}return s},getPrecomputes(n,r,o){let s=Qa.get(r);return s||(s=this.precomputeWindow(r,n),n!==1&&Qa.set(r,o(s))),s},wNAFCached(n,r,o){const s=ec(n);return this.wNAF(s,this.getPrecomputes(s,n,o),r)},wNAFCachedUnsafe(n,r,o,s){const i=ec(n);return i===1?this.unsafeLadder(n,r,s):this.wNAFUnsafe(i,this.getPrecomputes(i,n,o),r,s)},setWindowSize(n,r){Kd(r,t),Yd.set(n,r),Qa.delete(n)}}}function e6(e,t,n,r){Xw(n,e),Jw(r,t);const o=n.length,s=r.length;if(o!==s)throw new Error("arrays of points and scalars must have equal length");const i=e.ZERO,c=hy(BigInt(o));let a=1;c>12?a=c-3:c>4?a=c-2:c>0&&(a=2);const l=ws(a),u=new Array(Number(l)+1).fill(i),f=Math.floor((t.BITS-1)/a)*a;let p=i;for(let d=f;d>=0;d-=a){u.fill(i);for(let m=0;m<s;m++){const x=r[m],P=Number(x>>BigInt(d)&l);u[P]=u[P].add(n[m])}let h=i;for(let m=u.length-1,x=i;m>0;m--)x=x.add(u[m]),h=h.add(x);if(p=p.add(h),d!==0)for(let m=0;m<a;m++)p=p.double()}return p}function Xd(e){return Kw(e.Fp),xs(e,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze({...Vd(e.n,e.nBitLength),...e,p:e.Fp.ORDER})}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */function Jd(e){e.lowS!==void 0&&Po("lowS",e.lowS),e.prehash!==void 0&&Po("prehash",e.prehash)}function t6(e){const t=Xd(e);xs(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:o}=t;if(n){if(!r.eql(o,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})}class n6 extends Error{constructor(t=""){super(t)}}const an={Err:n6,_tlv:{encode:(e,t)=>{const{Err:n}=an;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,o=gs(r);if(o.length/2&128)throw new n("tlv.encode: long form length too big");const s=r>127?gs(o.length/2|128):"";return gs(e)+s+o+t},decode(e,t){const{Err:n}=an;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 o=t[r++],s=!!(o&128);let i=0;if(!s)i=o;else{const a=o&127;if(!a)throw new n("tlv.decode(long): indefinite length not supported");if(a>4)throw new n("tlv.decode(long): byte length is too big");const l=t.subarray(r,r+a);if(l.length!==a)throw new n("tlv.decode: length bytes not complete");if(l[0]===0)throw new n("tlv.decode(long): zero leftmost byte");for(const u of l)i=i<<8|u;if(r+=a,i<128)throw new n("tlv.decode(long): not minimal encoding")}const c=t.subarray(r,r+i);if(c.length!==i)throw new n("tlv.decode: wrong value length");return{v:c,l:t.subarray(r+i)}}},_int:{encode(e){const{Err:t}=an;if(e<cn)throw new t("integer: negative integers are not allowed");let n=gs(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}=an;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 Wn(e)}},toSig(e){const{Err:t,_int:n,_tlv:r}=an,o=pt("signature",e),{v:s,l:i}=r.decode(48,o);if(i.length)throw new t("invalid signature: left bytes after parsing");const{v:c,l:a}=r.decode(2,s),{v:l,l:u}=r.decode(2,a);if(u.length)throw new t("invalid signature: left bytes after parsing");return{r:n.decode(c),s:n.decode(l)}},hexFromSig(e){const{_tlv:t,_int:n}=an,r=t.encode(2,n.encode(e.r)),o=t.encode(2,n.encode(e.s)),s=r+o;return t.encode(48,s)}};function tc(e,t){return To(Ao(e,t))}const cn=BigInt(0),$e=BigInt(1);BigInt(2);const nc=BigInt(3),r6=BigInt(4);function o6(e){const t=t6(e),{Fp:n}=t,r=Za(t.n,t.nBitLength),o=t.toBytes||((T,N,M)=>{const F=N.toAffine();return vs(Uint8Array.from([4]),n.toBytes(F.x),n.toBytes(F.y))}),s=t.fromBytes||(T=>{const N=T.subarray(1),M=n.fromBytes(N.subarray(0,n.BYTES)),F=n.fromBytes(N.subarray(n.BYTES,2*n.BYTES));return{x:M,y:F}});function i(T){const{a:N,b:M}=t,F=n.sqr(T),L=n.mul(F,T);return n.add(n.add(L,n.mul(T,N)),M)}function c(T,N){const M=n.sqr(N),F=i(T);return n.eql(M,F)}if(!c(t.Gx,t.Gy))throw new Error("bad curve params: generator point");const a=n.mul(n.pow(t.a,nc),r6),l=n.mul(n.sqr(t.b),BigInt(27));if(n.is0(n.add(a,l)))throw new Error("bad curve params: a or b");function u(T){return ya(T,$e,t.n)}function f(T){const{allowedPrivateKeyLengths:N,nByteLength:M,wrapPrivateKey:F,n:L}=t;if(N&&typeof T!="bigint"){if(So(T)&&(T=To(T)),typeof T!="string"||!N.includes(T.length))throw new Error("invalid private key");T=T.padStart(M*2,"0")}let b;try{b=typeof T=="bigint"?T:Wn(pt("private key",T,M))}catch{throw new Error("invalid private key, expected hex or "+M+" bytes, got "+typeof T)}return F&&(b=qe(b,L)),xr("private key",b,$e,L),b}function p(T){if(!(T instanceof m))throw new Error("ProjectivePoint expected")}const d=$f((T,N)=>{const{px:M,py:F,pz:L}=T;if(n.eql(L,n.ONE))return{x:M,y:F};const b=T.is0();N==null&&(N=b?n.ONE:n.inv(L));const g=n.mul(M,N),w=n.mul(F,N),O=n.mul(L,N);if(b)return{x:n.ZERO,y:n.ZERO};if(!n.eql(O,n.ONE))throw new Error("invZ was invalid");return{x:g,y:w}}),h=$f(T=>{if(T.is0()){if(t.allowInfinityPoint&&!n.is0(T.py))return;throw new Error("bad point: ZERO")}const{x:N,y:M}=T.toAffine();if(!n.isValid(N)||!n.isValid(M))throw new Error("bad point: x or y not FE");if(!c(N,M))throw new Error("bad point: equation left != right");if(!T.isTorsionFree())throw new Error("bad point: not in prime-order subgroup");return!0});class m{constructor(N,M,F){if(N==null||!n.isValid(N))throw new Error("x required");if(M==null||!n.isValid(M)||n.is0(M))throw new Error("y required");if(F==null||!n.isValid(F))throw new Error("z required");this.px=N,this.py=M,this.pz=F,Object.freeze(this)}static fromAffine(N){const{x:M,y:F}=N||{};if(!N||!n.isValid(M)||!n.isValid(F))throw new Error("invalid affine point");if(N instanceof m)throw new Error("projective point not allowed");const L=b=>n.eql(b,n.ZERO);return L(M)&&L(F)?m.ZERO:new m(M,F,n.ONE)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static normalizeZ(N){const M=_d(n,N.map(F=>F.pz));return N.map((F,L)=>F.toAffine(M[L])).map(m.fromAffine)}static fromHex(N){const M=m.fromAffine(s(pt("pointHex",N)));return M.assertValidity(),M}static fromPrivateKey(N){return m.BASE.multiply(f(N))}static msm(N,M){return e6(m,r,N,M)}_setWindowSize(N){E.setWindowSize(this,N)}assertValidity(){h(this)}hasEvenY(){const{y:N}=this.toAffine();if(n.isOdd)return!n.isOdd(N);throw new Error("Field doesn't support isOdd")}equals(N){p(N);const{px:M,py:F,pz:L}=this,{px:b,py:g,pz:w}=N,O=n.eql(n.mul(M,w),n.mul(b,L)),C=n.eql(n.mul(F,w),n.mul(g,L));return O&&C}negate(){return new m(this.px,n.neg(this.py),this.pz)}double(){const{a:N,b:M}=t,F=n.mul(M,nc),{px:L,py:b,pz:g}=this;let w=n.ZERO,O=n.ZERO,C=n.ZERO,I=n.mul(L,L),k=n.mul(b,b),y=n.mul(g,g),A=n.mul(L,b);return A=n.add(A,A),C=n.mul(L,g),C=n.add(C,C),w=n.mul(N,C),O=n.mul(F,y),O=n.add(w,O),w=n.sub(k,O),O=n.add(k,O),O=n.mul(w,O),w=n.mul(A,w),C=n.mul(F,C),y=n.mul(N,y),A=n.sub(I,y),A=n.mul(N,A),A=n.add(A,C),C=n.add(I,I),I=n.add(C,I),I=n.add(I,y),I=n.mul(I,A),O=n.add(O,I),y=n.mul(b,g),y=n.add(y,y),I=n.mul(y,A),w=n.sub(w,I),C=n.mul(y,k),C=n.add(C,C),C=n.add(C,C),new m(w,O,C)}add(N){p(N);const{px:M,py:F,pz:L}=this,{px:b,py:g,pz:w}=N;let O=n.ZERO,C=n.ZERO,I=n.ZERO;const k=t.a,y=n.mul(t.b,nc);let A=n.mul(M,b),D=n.mul(F,g),S=n.mul(L,w),B=n.add(M,F),j=n.add(b,g);B=n.mul(B,j),j=n.add(A,D),B=n.sub(B,j),j=n.add(M,L);let _=n.add(b,w);return j=n.mul(j,_),_=n.add(A,S),j=n.sub(j,_),_=n.add(F,L),O=n.add(g,w),_=n.mul(_,O),O=n.add(D,S),_=n.sub(_,O),I=n.mul(k,j),O=n.mul(y,S),I=n.add(O,I),O=n.sub(D,I),I=n.add(D,I),C=n.mul(O,I),D=n.add(A,A),D=n.add(D,A),S=n.mul(k,S),j=n.mul(y,j),D=n.add(D,S),S=n.sub(A,S),S=n.mul(k,S),j=n.add(j,S),A=n.mul(D,j),C=n.add(C,A),A=n.mul(_,j),O=n.mul(B,O),O=n.sub(O,A),A=n.mul(B,D),I=n.mul(_,I),I=n.add(I,A),new m(O,C,I)}subtract(N){return this.add(N.negate())}is0(){return this.equals(m.ZERO)}wNAF(N){return E.wNAFCached(this,N,m.normalizeZ)}multiplyUnsafe(N){const{endo:M,n:F}=t;xr("scalar",N,cn,F);const L=m.ZERO;if(N===cn)return L;if(this.is0()||N===$e)return this;if(!M||E.hasPrecomputes(this))return E.wNAFCachedUnsafe(this,N,m.normalizeZ);let{k1neg:b,k1:g,k2neg:w,k2:O}=M.splitScalar(N),C=L,I=L,k=this;for(;g>cn||O>cn;)g&$e&&(C=C.add(k)),O&$e&&(I=I.add(k)),k=k.double(),g>>=$e,O>>=$e;return b&&(C=C.negate()),w&&(I=I.negate()),I=new m(n.mul(I.px,M.beta),I.py,I.pz),C.add(I)}multiply(N){const{endo:M,n:F}=t;xr("scalar",N,$e,F);let L,b;if(M){const{k1neg:g,k1:w,k2neg:O,k2:C}=M.splitScalar(N);let{p:I,f:k}=this.wNAF(w),{p:y,f:A}=this.wNAF(C);I=E.constTimeNegate(g,I),y=E.constTimeNegate(O,y),y=new m(n.mul(y.px,M.beta),y.py,y.pz),L=I.add(y),b=k.add(A)}else{const{p:g,f:w}=this.wNAF(N);L=g,b=w}return m.normalizeZ([L,b])[0]}multiplyAndAddUnsafe(N,M,F){const L=m.BASE,b=(w,O)=>O===cn||O===$e||!w.equals(L)?w.multiplyUnsafe(O):w.multiply(O),g=b(this,M).add(b(N,F));return g.is0()?void 0:g}toAffine(N){return d(this,N)}isTorsionFree(){const{h:N,isTorsionFree:M}=t;if(N===$e)return!0;if(M)return M(m,this);throw new Error("isTorsionFree() has not been declared for the elliptic curve")}clearCofactor(){const{h:N,clearCofactor:M}=t;return N===$e?this:M?M(m,this):this.multiplyUnsafe(t.h)}toRawBytes(N=!0){return Po("isCompressed",N),this.assertValidity(),o(m,this,N)}toHex(N=!0){return Po("isCompressed",N),To(this.toRawBytes(N))}}m.BASE=new m(t.Gx,t.Gy,n.ONE),m.ZERO=new m(n.ZERO,n.ONE,n.ZERO);const{endo:x,nBitLength:P}=t,E=Qw(m,x?Math.ceil(P/2):P);return{CURVE:t,ProjectivePoint:m,normPrivateKeyToScalar:f,weierstrassEquation:i,isWithinCurveOrder:u}}function s6(e){const t=Xd(e);return xs(t,{hash:"hash",hmac:"function",randomBytes:"function"},{bits2int:"function",bits2int_modN:"function",lowS:"boolean"}),Object.freeze({lowS:!0,...t})}function i6(e){const t=s6(e),{Fp:n,n:r,nByteLength:o,nBitLength:s}=t,i=n.BYTES+1,c=2*n.BYTES+1;function a(y){return qe(y,r)}function l(y){return Ka(y,r)}const{ProjectivePoint:u,normPrivateKeyToScalar:f,weierstrassEquation:p,isWithinCurveOrder:d}=o6({...t,toBytes(y,A,D){const S=A.toAffine(),B=n.toBytes(S.x),j=vs;return Po("isCompressed",D),D?j(Uint8Array.from([A.hasEvenY()?2:3]),B):j(Uint8Array.from([4]),B,n.toBytes(S.y))},fromBytes(y){const A=y.length,D=y[0],S=y.subarray(1);if(A===i&&(D===2||D===3)){const B=Wn(S);if(!ya(B,$e,n.ORDER))throw new Error("Point is not on curve");const j=p(B);let _;try{_=n.sqrt(j)}catch(Z){const H=Z instanceof Error?": "+Z.message:"";throw new Error("Point is not on curve"+H)}const W=(_&$e)===$e;return(D&1)===1!==W&&(_=n.neg(_)),{x:B,y:_}}else if(A===c&&D===4){const B=n.fromBytes(S.subarray(0,n.BYTES)),j=n.fromBytes(S.subarray(n.BYTES,2*n.BYTES));return{x:B,y:j}}else{const B=i,j=c;throw new Error("invalid Point, expected length of "+B+", or uncompressed "+j+", got "+A)}}});function h(y){const A=r>>$e;return y>A}function m(y){return h(y)?a(-y):y}const x=(y,A,D)=>Wn(y.slice(A,D));class P{constructor(A,D,S){xr("r",A,$e,r),xr("s",D,$e,r),this.r=A,this.s=D,S!=null&&(this.recovery=S),Object.freeze(this)}static fromCompact(A){const D=o;return A=pt("compactSignature",A,D*2),new P(x(A,0,D),x(A,D,2*D))}static fromDER(A){const{r:D,s:S}=an.toSig(pt("DER",A));return new P(D,S)}assertValidity(){}addRecoveryBit(A){return new P(this.r,this.s,A)}recoverPublicKey(A){const{r:D,s:S,recovery:B}=this,j=L(pt("msgHash",A));if(B==null||![0,1,2,3].includes(B))throw new Error("recovery id invalid");const _=B===2||B===3?D+t.n:D;if(_>=n.ORDER)throw new Error("recovery id 2 or 3 invalid");const W=B&1?"03":"02",q=u.fromHex(W+tc(_,n.BYTES)),Z=l(_),H=a(-j*Z),U=a(S*Z),J=u.BASE.multiplyAndAddUnsafe(q,H,U);if(!J)throw new Error("point at infinify");return J.assertValidity(),J}hasHighS(){return h(this.s)}normalizeS(){return this.hasHighS()?new P(this.r,a(-this.s),this.recovery):this}toDERRawBytes(){return ys(this.toDERHex())}toDERHex(){return an.hexFromSig(this)}toCompactRawBytes(){return ys(this.toCompactHex())}toCompactHex(){const A=o;return tc(this.r,A)+tc(this.s,A)}}const E={isValidPrivateKey(y){try{return f(y),!0}catch{return!1}},normPrivateKeyToScalar:f,randomPrivateKey:()=>{const y=Gd(t.n);return Yw(t.randomBytes(y),t.n)},precompute(y=8,A=u.BASE){return A._setWindowSize(y),A.multiply(BigInt(3)),A}};function T(y,A=!0){return u.fromPrivateKey(y).toRawBytes(A)}function N(y){if(typeof y=="bigint")return!1;if(y instanceof u)return!0;const D=pt("key",y).length,S=n.BYTES,B=S+1,j=2*S+1;if(!(t.allowedPrivateKeyLengths||o===B))return D===B||D===j}function M(y,A,D=!0){if(N(y)===!0)throw new Error("first arg must be private key");if(N(A)===!1)throw new Error("second arg must be public key");return u.fromHex(A).multiply(f(y)).toRawBytes(D)}const F=t.bits2int||function(y){if(y.length>8192)throw new Error("input is too large");const A=Wn(y),D=y.length*8-s;return D>0?A>>BigInt(D):A},L=t.bits2int_modN||function(y){return a(F(y))},b=ws(s);function g(y){return xr("num < 2^"+s,y,cn,b),Ao(y,o)}function w(y,A,D=O){if(["recovered","canonical"].some(ee=>ee in D))throw new Error("sign() legacy options not supported");const{hash:S,randomBytes:B}=t;let{lowS:j,prehash:_,extraEntropy:W}=D;j==null&&(j=!0),y=pt("msgHash",y),Jd(D),_&&(y=pt("prehashed msgHash",S(y)));const q=L(y),Z=f(A),H=[g(Z),g(q)];if(W!=null&&W!==!1){const ee=W===!0?B(n.BYTES):W;H.push(pt("extraEntropy",ee))}const U=vs(...H),J=q;function K(ee){const ie=F(ee);if(!d(ie))return;const Y=l(ie),ne=u.BASE.multiply(ie).toAffine(),Q=a(ne.x);if(Q===cn)return;const le=a(Y*a(J+Q*Z));if(le===cn)return;let re=(ne.x===Q?0:2)|Number(ne.y&$e),pe=le;return j&&h(le)&&(pe=m(le),re^=1),new P(Q,pe,re)}return{seed:U,k2sig:K}}const O={lowS:t.lowS,prehash:!1},C={lowS:t.lowS,prehash:!1};function I(y,A,D=O){const{seed:S,k2sig:B}=w(y,A,D),j=t;return my(j.hash.outputLen,j.nByteLength,j.hmac)(S,B)}u.BASE._setWindowSize(8);function k(y,A,D,S=C){var re;const B=y;A=pt("msgHash",A),D=pt("publicKey",D);const{lowS:j,prehash:_,format:W}=S;if(Jd(S),"strict"in S)throw new Error("options.strict was renamed to lowS");if(W!==void 0&&W!=="compact"&&W!=="der")throw new Error("format must be compact or der");const q=typeof B=="string"||So(B),Z=!q&&!W&&typeof B=="object"&&B!==null&&typeof B.r=="bigint"&&typeof B.s=="bigint";if(!q&&!Z)throw new Error("invalid signature, expected Uint8Array, hex string or Signature instance");let H,U;try{if(Z&&(H=new P(B.r,B.s)),q){try{W!=="compact"&&(H=P.fromDER(B))}catch(pe){if(!(pe instanceof an.Err))throw pe}!H&&W!=="der"&&(H=P.fromCompact(B))}U=u.fromHex(D)}catch{return!1}if(!H||j&&H.hasHighS())return!1;_&&(A=t.hash(A));const{r:J,s:K}=H,ee=L(A),ie=l(K),Y=a(ee*ie),ne=a(J*ie),Q=(re=u.BASE.multiplyAndAddUnsafe(U,Y,ne))==null?void 0:re.toAffine();return Q?a(Q.x)===J:!1}return{CURVE:t,getPublicKey:T,getSharedSecret:M,sign:I,verify:k,ProjectivePoint:u,Signature:P,utils:E}}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */function a6(e){return{hash:e,hmac:(t,...n)=>Fd(e,t,O1(...n)),randomBytes:I1}}function c6(e,t){const n=r=>i6({...e,...a6(r)});return{...n(t),create:n}}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const Qd=BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),e0=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),l6=BigInt(0),u6=BigInt(1),rc=BigInt(2),t0=(e,t)=>(e+t/rc)/t;function f6(e){const t=Qd,n=BigInt(3),r=BigInt(6),o=BigInt(11),s=BigInt(22),i=BigInt(23),c=BigInt(44),a=BigInt(88),l=e*e*e%t,u=l*l*e%t,f=ht(u,n,t)*u%t,p=ht(f,n,t)*u%t,d=ht(p,rc,t)*l%t,h=ht(d,o,t)*d%t,m=ht(h,s,t)*h%t,x=ht(m,c,t)*m%t,P=ht(x,a,t)*x%t,E=ht(P,c,t)*m%t,T=ht(E,n,t)*u%t,N=ht(T,i,t)*h%t,M=ht(N,r,t)*l%t,F=ht(M,rc,t);if(!oc.eql(oc.sqr(F),e))throw new Error("Cannot find square root");return F}const oc=Za(Qd,void 0,void 0,{sqrt:f6}),n0=c6({a:l6,b:BigInt(7),Fp:oc,n:e0,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),h:BigInt(1),lowS:!0,endo:{beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar:e=>{const t=e0,n=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),r=-u6*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),o=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),s=n,i=BigInt("0x100000000000000000000000000000000"),c=t0(s*e,t),a=t0(-r*e,t);let l=qe(e-c*n-a*o,t),u=qe(-c*r-a*s,t);const f=l>i,p=u>i;if(f&&(l=t-l),p&&(u=t-u),l>i||u>i)throw new Error("splitScalar: Endomorphism failed, k="+e);return{k1neg:f,k1:l,k2neg:p,k2:u}}}},mf),d6=Object.freeze(Object.defineProperty({__proto__:null,secp256k1:n0},Symbol.toStringTag,{value:"Module"}));function r0(e,t={}){const{recovered:n}=t;if(typeof e.r>"u")throw new ic({signature:e});if(typeof e.s>"u")throw new ic({signature:e});if(n&&typeof e.yParity>"u")throw new ic({signature:e});if(e.r<0n||e.r>Id)throw new v6({value:e.r});if(e.s<0n||e.s>Id)throw new w6({value:e.s});if(typeof e.yParity=="number"&&e.yParity!==0&&e.yParity!==1)throw new ac({value:e.yParity})}function p6(e){return o0(kt(e))}function o0(e){if(e.length!==130&&e.length!==132)throw new y6({signature:e});const t=BigInt(zt(e,0,32)),n=BigInt(zt(e,32,64)),r=(()=>{const o=+`0x${e.slice(130)}`;if(!Number.isNaN(o))try{return sc(o)}catch{throw new ac({value:o})}})();return typeof r>"u"?{r:t,s:n}:{r:t,s:n,yParity:r}}function h6(e){if(!(typeof e.r>"u")&&!(typeof e.s>"u"))return m6(e)}function m6(e){const t=typeof e=="string"?o0(e):e instanceof Uint8Array?p6(e):typeof e.r=="string"?g6(e):e.v?b6(e):{r:e.r,s:e.s,...typeof e.yParity<"u"?{yParity:e.yParity}:{}};return r0(t),t}function b6(e){return{r:e.r,s:e.s,yParity:sc(e.v)}}function g6(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=sc(n)),typeof r!="number")throw new ac({value:e.yParity});return r})();return{r:BigInt(e.r),s:BigInt(e.s),yParity:t}}function sc(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 x6({value:e})}class y6 extends ue{constructor({signature:t}){super(`Value \`${t}\` is an invalid signature size.`,{metaMessages:["Expected: 64 bytes or 65 bytes.",`Received ${ot(zy(t))} bytes.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Signature.InvalidSerializedSizeError"})}}class ic extends ue{constructor({signature:t}){super(`Signature \`${Lf(t)}\` is missing either an \`r\`, \`s\`, or \`yParity\` property.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Signature.MissingPropertiesError"})}}class v6 extends ue{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 w6 extends ue{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 ac extends ue{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 x6 extends ue{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 E6(e,t={}){return typeof e.chainId=="string"?S6(e):{...e,...t.signature}}function S6(e){const{address:t,chainId:n,nonce:r}=e,o=h6(e);return{address:t,chainId:Number(n),nonce:BigInt(r),...o}}const P6="0x8010801080108010801080108010801080108010801080108010801080108010",T6=Dd("(uint256 chainId, address delegation, uint256 nonce, uint8 yParity, uint256 r, uint256 s), address to, bytes data");function s0(e){if(typeof e=="string"){if(zt(e,-32)!==P6)throw new C6(e)}else r0(e.authorization)}function A6(e){s0(e);const t=Uf(zt(e,-64,-32)),n=zt(e,-t-64,-64),r=zt(e,0,-t-64),[o,s,i]=Rw(T6,n);return{authorization:E6({address:o.delegation,chainId:Number(o.chainId),nonce:o.nonce,yParity:o.yParity,r:o.r,s:o.s}),signature:r,...i&&i!=="0x"?{data:i,to:s}:{}}}function N6(e){try{return s0(e),!0}catch{return!1}}let C6=class extends ue{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"})}};class O6 extends V{constructor({value:t}){super(`Number \`${t}\` is not a valid decimal number.`,{name:"InvalidDecimalNumberError"})}}function I6(e,t){if(!/^(-?)([0-9]*)\.?([0-9]*)$/.test(e))throw new O6({value:e});let[n,r="0"]=e.split(".");const o=n.startsWith("-");if(o&&(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,i,c]=[r.slice(0,t-1),r.slice(t-1,t),r.slice(t)],a=Math.round(+`${i}.${c}`);a>9?r=`${BigInt(s)+BigInt(1)}0`.padStart(s.length+1,"0"):r=`${s}${a}`,r.length>t&&(r=r.slice(1),n=`${BigInt(n)+1n}`),r=r.slice(0,t)}else r=r.padEnd(t,"0");return BigInt(`${o?"-":""}${n}${r}`)}function $6(e){return e.map(t=>({...t,value:BigInt(t.value)}))}function k6(e){return{...e,balance:e.balance?BigInt(e.balance):void 0,nonce:e.nonce?Qt(e.nonce):void 0,storageProof:e.storageProof?$6(e.storageProof):void 0}}async function D6(e,{address:t,blockNumber:n,blockTag:r,storageKeys:o}){const s=r??"latest",i=n!==void 0?oe(n):void 0,c=await e.request({method:"eth_getProof",params:[t,o,i||s]});return k6(c)}async function M6(e,{address:t,blockNumber:n,blockTag:r="latest",slot:o}){const s=n!==void 0?oe(n):void 0;return await e.request({method:"eth_getStorageAt",params:[t,o,s||r]})}async function cc(e,{blockHash:t,blockNumber:n,blockTag:r,hash:o,index:s,sender:i,nonce:c}){var p,d,h;const a=r||"latest",l=n!==void 0?oe(n):void 0;let u=null;if(o?u=await e.request({method:"eth_getTransactionByHash",params:[o]},{dedupe:!0}):t?u=await e.request({method:"eth_getTransactionByBlockHashAndIndex",params:[t,oe(s)]},{dedupe:!0}):typeof s=="number"?u=await e.request({method:"eth_getTransactionByBlockNumberAndIndex",params:[l||a,oe(s)]},{dedupe:!!l}):i&&typeof c=="number"&&(u=await e.request({method:"eth_getTransactionBySenderAndNonce",params:[i,oe(c)]},{dedupe:!0})),!u)throw new Ku({blockHash:t,blockNumber:n,blockTag:a,hash:o,index:s});return(((h=(d=(p=e.chain)==null?void 0:p.formatters)==null?void 0:d.transaction)==null?void 0:h.format)||oa)(u,"getTransaction")}async function B6(e,{hash:t,transactionReceipt:n}){const[r,o]=await Promise.all([te(e,Io,"getBlockNumber")({}),t?te(e,cc,"getTransaction")({hash:t}):void 0]),s=(n==null?void 0:n.blockNumber)||(o==null?void 0:o.blockNumber);return s?r-s+1n:0n}async function Is(e,{hash:t}){var o,s,i;const n=await e.request({method:"eth_getTransactionReceipt",params:[t]},{dedupe:!0});if(!n)throw new Zu({hash:t});return(((i=(s=(o=e.chain)==null?void 0:o.formatters)==null?void 0:s.transactionReceipt)==null?void 0:i.format)||id)(n,"getTransactionReceipt")}async function L6(e,t){var E;const{account:n,authorizationList:r,allowFailure:o=!0,blockNumber:s,blockOverrides:i,blockTag:c,stateOverride:a}=t,l=t.contracts,{batchSize:u=t.batchSize??1024,deployless:f=t.deployless??!1}=typeof((E=e.batch)==null?void 0:E.multicall)=="object"?e.batch.multicall:{},p=(()=>{if(t.multicallAddress)return t.multicallAddress;if(f)return null;if(e.chain)return Pr({blockNumber:s,chain:e.chain,contract:"multicall3"});throw new Error("client chain not configured. multicallAddress is required.")})(),d=[[]];let h=0,m=0;for(let T=0;T<l.length;T++){const{abi:N,address:M,args:F,functionName:L}=l[T];try{const b=Ot({abi:N,args:F,functionName:L});m+=(b.length-2)/2,u>0&&m>u&&d[h].length>0&&(h++,m=(b.length-2)/2,d[h]=[]),d[h]=[...d[h],{allowFailure:!0,callData:b,target:M}]}catch(b){const g=yr(b,{abi:N,address:M,args:F,docsPath:"/docs/contract/multicall",functionName:L,sender:n});if(!o)throw g;d[h]=[...d[h],{allowFailure:!0,callData:"0x",target:M}]}}const x=await Promise.allSettled(d.map(T=>te(e,Dt,"readContract")({...p===null?{code:Ea}:{address:p},abi:Ss,account:n,args:[T],authorizationList:r,blockNumber:s,blockOverrides:i,blockTag:c,functionName:"aggregate3",stateOverride:a}))),P=[];for(let T=0;T<x.length;T++){const N=x[T];if(N.status==="rejected"){if(!o)throw N.reason;for(let F=0;F<d[T].length;F++)P.push({status:"failure",error:N.reason,result:void 0});continue}const M=N.value;for(let F=0;F<M.length;F++){const{returnData:L,success:b}=M[F],{callData:g}=d[T][F],{abi:w,address:O,functionName:C,args:I}=l[P.length];try{if(g==="0x")throw new Wr;if(!b)throw new fs({data:L});const k=_n({abi:w,args:I,data:L,functionName:C});P.push(o?{result:k,status:"success"}:k)}catch(k){const y=yr(k,{abi:w,address:O,args:I,docsPath:"/docs/contract/multicall",functionName:C});if(!o)throw y;P.push({error:y,result:void 0,status:"failure"})}}}if(P.length!==l.length)throw new V("multicall results mismatch");return P}async function lc(e,t){const{blockNumber:n,blockTag:r=e.experimental_blockTag??"latest",blocks:o,returnFullTransactions:s,traceTransfers:i,validation:c}=t;try{const a=[];for(const p of o){const d=p.blockOverrides?Gf(p.blockOverrides):void 0,h=p.calls.map(x=>{const P=x,E=P.account?nt(P.account):void 0,T=P.abi?Ot(P):P.data,N={...P,account:E,data:P.dataSuffix?Ct([T||"0x",P.dataSuffix]):T,from:P.from??(E==null?void 0:E.address)};return wr(N),xo(N)}),m=p.stateOverrides?na(p.stateOverrides):void 0;a.push({blockOverrides:d,calls:h,stateOverrides:m})}const u=(typeof n=="bigint"?oe(n):void 0)||r;return(await e.request({method:"eth_simulateV1",params:[{blockStateCalls:a,returnFullTransactions:s,traceTransfers:i,validation:c},u]})).map((p,d)=>({...uf(p),calls:p.calls.map((h,m)=>{var w,O;const{abi:x,args:P,functionName:E,to:T}=o[d].calls[m],N=((w=h.error)==null?void 0:w.data)??h.returnData,M=BigInt(h.gasUsed),F=(O=h.logs)==null?void 0:O.map(C=>nn(C)),L=h.status==="0x1"?"success":"failure",b=x&&L==="success"&&N!=="0x"?_n({abi:x,data:N,functionName:E}):null,g=(()=>{var I;if(L==="success")return;let C;if(((I=h.error)==null?void 0:I.data)==="0x"?C=new Wr:h.error&&(C=new fs(h.error)),!!C)return yr(C,{abi:x??[],address:T??"0x",args:P,functionName:E??"<unknown>"})})();return{data:N,gasUsed:M,logs:F,status:L,...L==="success"?{result:b}:{error:g}}})}))}catch(a){const l=a,u=hs(l,{});throw u instanceof wo?l:u}}function uc(e){let t=!0,n="",r=0,o="",s=!1;for(let i=0;i<e.length;i++){const c=e[i];if(["(",")",","].includes(c)&&(t=!0),c==="("&&r++,c===")"&&r--,!!t){if(r===0){if(c===" "&&["event","function","error",""].includes(o))o="";else if(o+=c,c===")"){s=!0;break}continue}if(c===" "){e[i-1]!==","&&n!==","&&n!==",("&&(n="",t=!1);continue}o+=c,n+=c}}if(!s)throw new ue("Unable to normalize signature.");return o}function fc(e,t){const n=typeof e,r=t.type;switch(r){case"address":return za(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((o,s)=>fc(Object.values(e)[s],o)):/^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(o=>fc(o,{...t,type:r.replace(/(\[[0-9]{0,}\])$/,"")})):!1}}function i0(e,t,n){for(const r in e){const o=e[r],s=t[r];if(o.type==="tuple"&&s.type==="tuple"&&"components"in o&&"components"in s)return i0(o.components,s.components,n[r]);const i=[o.type,s.type];if(i.includes("address")&&i.includes("bytes20")?!0:i.includes("address")&&i.includes("string")?za(n[r],{strict:!1}):i.includes("address")&&i.includes("bytes")?za(n[r],{strict:!1}):!1)return i}}function a0(e,t={}){const{prepare:n=!0}=t,r=Array.isArray(e)||typeof e=="string"?ru(e):e;return{...r,...n?{hash:Ar(r)}:{}}}function $s(e,t,n){const{args:r=[],prepare:o=!0}=n??{},s=Uy(t,{strict:!1}),i=e.filter(l=>s?l.type==="function"||l.type==="error"?c0(l)===zt(t,0,4):l.type==="event"?Ar(l)===t:!1:"name"in l&&l.name===t);if(i.length===0)throw new ks({name:t});if(i.length===1)return{...i[0],...o?{hash:Ar(i[0])}:{}};let c;for(const l of i){if(!("inputs"in l))continue;if(!r||r.length===0){if(!l.inputs||l.inputs.length===0)return{...l,...o?{hash:Ar(l)}:{}};continue}if(!l.inputs||l.inputs.length===0||l.inputs.length!==r.length)continue;if(r.every((f,p)=>{const d="inputs"in l&&l.inputs[p];return d?fc(f,d):!1})){if(c&&"inputs"in c&&c.inputs){const f=i0(l.inputs,c.inputs,r);if(f)throw new R6({abiItem:l,type:f[0]},{abiItem:c,type:f[1]})}c=l}}const a=(()=>{if(c)return c;const[l,...u]=i;return{...l,overloads:u}})();if(!a)throw new ks({name:t});return{...a,...o?{hash:Ar(a)}:{}}}function c0(...e){const t=(()=>{if(Array.isArray(e[0])){const[n,r]=e;return $s(n,r)}return e[0]})();return zt(Ar(t),0,4)}function F6(...e){const t=(()=>{if(Array.isArray(e[0])){const[r,o]=e;return $s(r,o)}return e[0]})(),n=typeof t=="string"?t:ts(t);return uc(n)}function Ar(...e){const t=(()=>{if(Array.isArray(e[0])){const[n,r]=e;return $s(n,r)}return e[0]})();return typeof t!="string"&&"hash"in t&&t.hash?t.hash:Ad(wa(F6(t)))}class R6 extends ue{constructor(t,n){super("Found ambiguous types in overloaded ABI Items.",{metaMessages:[`\`${t.type}\` in \`${uc(ts(t.abiItem))}\`, and`,`\`${n.type}\` in \`${uc(ts(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 ks extends ue{constructor({name:t,data:n,type:r="item"}){const o=t?` with name "${t}"`:n?` with data "${n}"`:"";super(`ABI ${r}${o} not found.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiItem.NotFoundError"})}}function j6(...e){var s;const[t,n]=(()=>{if(Array.isArray(e[0])){const[i,c]=e;return[U6(i),c]}return e})(),{bytecode:r,args:o}=n;return $t(r,(s=t.inputs)!=null&&s.length&&(o!=null&&o.length)?Ha(t.inputs,o):"0x")}function z6(e){return a0(e)}function U6(e){const t=e.find(n=>n.type==="constructor");if(!t)throw new ks({name:"constructor"});return t}function _6(...e){const[t,n=[]]=(()=>{if(Array.isArray(e[0])){const[l,u,f]=e;return[l0(l,u,{args:f}),f]}const[c,a]=e;return[c,a]})(),{overloads:r}=t,o=r?l0([t,...r],t.name,{args:n}):t,s=W6(o),i=n.length>0?Ha(o.inputs,n):void 0;return i?$t(s,i):s}function Nr(e,t={}){return a0(e,t)}function l0(e,t,n){const r=$s(e,t,n);if(r.type!=="function")throw new ks({name:t,type:"function"});return r}function W6(e){return c0(e)}const V6="0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",Ut="0x0000000000000000000000000000000000000000",H6="0x6080604052348015600e575f80fd5b5061016d8061001c5f395ff3fe608060405234801561000f575f80fd5b5060043610610029575f3560e01c8063f8b2cb4f1461002d575b5f80fd5b610047600480360381019061004291906100db565b61005d565b604051610054919061011e565b60405180910390f35b5f8173ffffffffffffffffffffffffffffffffffffffff16319050919050565b5f80fd5b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f6100aa82610081565b9050919050565b6100ba816100a0565b81146100c4575f80fd5b50565b5f813590506100d5816100b1565b92915050565b5f602082840312156100f0576100ef61007d565b5b5f6100fd848285016100c7565b91505092915050565b5f819050919050565b61011881610106565b82525050565b5f6020820190506101315f83018461010f565b9291505056fea26469706673582212203b9fe929fe995c7cf9887f0bdba8a36dd78e8b73f149b17d2d9ad7cd09d2dc6264736f6c634300081a0033";async function G6(e,t){const{blockNumber:n,blockTag:r,calls:o,stateOverrides:s,traceAssetChanges:i,traceTransfers:c,validation:a}=t,l=t.account?nt(t.account):void 0;if(i&&!l)throw new V("`account` is required when `traceAssetChanges` is true");const u=l?j6(z6("constructor(bytes, bytes)"),{bytecode:Qf,args:[H6,_6(Nr("function getBalance(address)"),[l.address])]}):void 0,f=i?await Promise.all(t.calls.map(async S=>{if(!S.data&&!S.abi)return;const{accessList:B}=await md(e,{account:l.address,...S,data:S.abi?Ot(S):S.data});return B.map(({address:j,storageKeys:_})=>_.length>0?j:null)})).then(S=>S.flat().filter(Boolean)):[],p=await lc(e,{blockNumber:n,blockTag:r,blocks:[...i?[{calls:[{data:u}],stateOverrides:s},{calls:f.map((S,B)=>({abi:[Nr("function balanceOf(address) returns (uint256)")],functionName:"balanceOf",args:[l.address],to:S,from:Ut,nonce:B})),stateOverrides:[{address:Ut,nonce:0}]}]:[],{calls:[...o,{}].map(S=>({...S,from:l==null?void 0:l.address})),stateOverrides:s},...i?[{calls:[{data:u}]},{calls:f.map((S,B)=>({abi:[Nr("function balanceOf(address) returns (uint256)")],functionName:"balanceOf",args:[l.address],to:S,from:Ut,nonce:B})),stateOverrides:[{address:Ut,nonce:0}]},{calls:f.map((S,B)=>({to:S,abi:[Nr("function decimals() returns (uint256)")],functionName:"decimals",from:Ut,nonce:B})),stateOverrides:[{address:Ut,nonce:0}]},{calls:f.map((S,B)=>({to:S,abi:[Nr("function tokenURI(uint256) returns (string)")],functionName:"tokenURI",args:[0n],from:Ut,nonce:B})),stateOverrides:[{address:Ut,nonce:0}]},{calls:f.map((S,B)=>({to:S,abi:[Nr("function symbol() returns (string)")],functionName:"symbol",from:Ut,nonce:B})),stateOverrides:[{address:Ut,nonce:0}]}]:[]],traceTransfers:c,validation:a}),d=i?p[2]:p[0],[h,m,,x,P,E,T,N]=i?p:[],{calls:M,...F}=d,L=M.slice(0,-1)??[],b=(h==null?void 0:h.calls)??[],g=(m==null?void 0:m.calls)??[],w=[...b,...g].map(S=>S.status==="success"?Ft(S.data):null),O=(x==null?void 0:x.calls)??[],C=(P==null?void 0:P.calls)??[],I=[...O,...C].map(S=>S.status==="success"?Ft(S.data):null),k=((E==null?void 0:E.calls)??[]).map(S=>S.status==="success"?S.result:null),y=((N==null?void 0:N.calls)??[]).map(S=>S.status==="success"?S.result:null),A=((T==null?void 0:T.calls)??[]).map(S=>S.status==="success"?S.result:null),D=[];for(const[S,B]of I.entries()){const j=w[S];if(typeof B!="bigint"||typeof j!="bigint")continue;const _=k[S-1],W=y[S-1],q=A[S-1],Z=S===0?{address:V6,decimals:18,symbol:"ETH"}:{address:f[S-1],decimals:q||_?Number(_??1):void 0,symbol:W??void 0};D.some(H=>H.token.address===Z.address)||D.push({token:Z,value:{pre:j,post:B,diff:B-j}})}return{assetChanges:D,block:F,results:L}}const u0="0x6492649264926492649264926492649264926492649264926492649264926492";function q6(e){if(zt(e,-32)!==u0)throw new Y6(e)}function K6(e){const{data:t,signature:n,to:r}=e;return $t(Ha(Dd("address, bytes, bytes"),[r,t,n]),u0)}function Z6(e){try{return q6(e),!0}catch{return!1}}class Y6 extends ue{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 X6({r:e,s:t,to:n="hex",v:r,yParity:o}){const s=(()=>{if(o===0||o===1)return o;if(r&&(r===27n||r===28n||r>=35n))return r%2n===0n?1:0;throw new Error("Invalid `v` or `yParity` value")})(),i=`0x${new n0.Signature(Ft(e),Ft(t)).toCompactHex()}${s===0?"1b":"1c"}`;return n==="hex"?i:Rt(i)}async function Ds(e,t){var c,a,l,u,f,p;const{address:n,hash:r,erc6492VerifierAddress:o=t.universalSignatureVerifierAddress??((l=(a=(c=e.chain)==null?void 0:c.contracts)==null?void 0:a.erc6492Verifier)==null?void 0:l.address),multicallAddress:s=t.multicallAddress??((p=(f=(u=e.chain)==null?void 0:u.contracts)==null?void 0:f.multicall3)==null?void 0:p.address)}=t,i=(()=>{const d=t.signature;return At(d)?d:typeof d=="object"&&"r"in d&&"s"in d?X6(d):Ce(d)})();try{return N6(i)?await J6(e,{...t,multicallAddress:s,signature:i}):await Q6(e,{...t,verifierAddress:o,signature:i})}catch(d){try{if(Eo(xn(n),await ef({hash:r,signature:i})))return!0}catch{}if(d instanceof qn)return!1;throw d}}async function J6(e,t){var x;const{address:n,blockNumber:r,blockTag:o,hash:s,multicallAddress:i}=t,{authorization:c,data:a,signature:l,to:u}=A6(t.signature);if(await Ra(e,{address:n,blockNumber:r,blockTag:o})===pr(["0xef0100",c.address]))return await e5(e,{address:n,blockNumber:r,blockTag:o,hash:s,signature:l});const p={address:c.address,chainId:Number(c.chainId),nonce:Number(c.nonce),r:oe(c.r,{size:32}),s:oe(c.s,{size:32}),yParity:c.yParity};if(!await Uv({address:n,authorization:p}))throw new qn;const h=await te(e,Dt,"readContract")({...i?{address:i}:{code:Ea},authorizationList:[p],abi:Ss,blockNumber:r,blockTag:"pending",functionName:"aggregate3",args:[[...a?[{allowFailure:!0,target:u??n,callData:a}]:[],{allowFailure:!0,target:n,callData:Ot({abi:Xf,functionName:"isValidSignature",args:[s,l]})}]]}),m=(x=h[h.length-1])==null?void 0:x.returnData;if(m!=null&&m.startsWith("0x1626ba7e"))return!0;throw new qn}async function Q6(e,t){const{address:n,factory:r,factoryData:o,hash:s,signature:i,verifierAddress:c,...a}=t,l=await(async()=>!r&&!o||Z6(i)?i:K6({data:o,signature:i,to:r}))(),u=c?{to:c,data:Ot({abi:Jf,functionName:"isValidSig",args:[n,s,l]}),...a}:{data:Ta({abi:Jf,args:[n,s,l],bytecode:Ky}),...a},{data:f}=await te(e,Co,"call")(u).catch(p=>{throw p instanceof Yu?new qn:p});if(u1(f??"0x0"))return!0;throw new qn}async function e5(e,t){const{address:n,blockNumber:r,blockTag:o,hash:s,signature:i}=t;if((await te(e,Dt,"readContract")({address:n,abi:Xf,args:[s,i],blockNumber:r,blockTag:o,functionName:"isValidSignature"}).catch(a=>{throw a instanceof Xu?new qn:a})).startsWith("0x1626ba7e"))return!0;throw new qn}class qn extends Error{}async function t5(e,{address:t,message:n,factory:r,factoryData:o,signature:s,...i}){const c=xd(n);return te(e,Ds,"verifyHash")({address:t,factory:r,factoryData:o,hash:c,signature:s,...i})}async function n5(e,t){const{address:n,factory:r,factoryData:o,signature:s,message:i,primaryType:c,types:a,domain:l,...u}=t,f=lw({message:i,primaryType:c,types:a,domain:l});return te(e,Ds,"verifyHash")({address:n,factory:r,factoryData:o,hash:f,signature:s,...u})}function f0(e,{emitOnBegin:t=!1,emitMissed:n=!1,onBlockNumber:r,onError:o,poll:s,pollingInterval:i=e.pollingInterval}){const c=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 a;return c?(()=>{const f=Oe(["watchBlockNumber",e.uid,t,n,i]);return An(f,{onBlockNumber:r,onError:o},p=>Oo(async()=>{var d;try{const h=await te(e,Io,"getBlockNumber")({cacheTime:0});if(a!==void 0){if(h===a)return;if(h-a>1&&n)for(let m=a+1n;m<h;m++)p.onBlockNumber(m,a),a=m}(a===void 0||h>a)&&(p.onBlockNumber(h,a),a=h)}catch(h){(d=p.onError)==null||d.call(p,h)}},{emitOnBegin:t,interval:i}))})():(()=>{const f=Oe(["watchBlockNumber",e.uid,t,n]);return An(f,{onBlockNumber:r,onError:o},p=>{let d=!0,h=()=>d=!1;return(async()=>{try{const m=(()=>{if(e.transport.type==="fallback"){const P=e.transport.transports.find(E=>E.config.type==="webSocket"||E.config.type==="ipc");return P?P.value:e.transport}return e.transport})(),{unsubscribe:x}=await m.subscribe({params:["newHeads"],onData(P){var T;if(!d)return;const E=Ft((T=P.result)==null?void 0:T.number);p.onBlockNumber(E,a),a=E},onError(P){var E;(E=p.onError)==null||E.call(p,P)}});h=x,d||h()}catch(m){o==null||o(m)}})(),()=>h()})})()}async function r5(e,t){const{checkReplacement:n=!0,confirmations:r=1,hash:o,onReplaced:s,retryCount:i=6,retryDelay:c=({count:M})=>~~(1<<M)*200,timeout:a=18e4}=t,l=Oe(["waitForTransactionReceipt",e.uid,o]),u=(()=>{var M;return t.pollingInterval?t.pollingInterval:(M=e.chain)!=null&&M.experimental_preconfirmationTime?e.chain.experimental_preconfirmationTime:e.pollingInterval})();let f,p,d,h=!1,m,x;const{promise:P,resolve:E,reject:T}=nd(),N=a?setTimeout(()=>{x==null||x(),m==null||m(),T(new Tg({hash:o}))},a):void 0;return m=An(l,{onReplaced:s,resolve:E,reject:T},async M=>{if(d=await te(e,Is,"getTransactionReceipt")({hash:o}).catch(()=>{}),d&&r<=1){clearTimeout(N),M.resolve(d),m==null||m();return}x=te(e,f0,"watchBlockNumber")({emitMissed:!0,emitOnBegin:!0,poll:!0,pollingInterval:u,async onBlockNumber(F){const L=g=>{clearTimeout(N),x==null||x(),g(),m==null||m()};let b=F;if(!h)try{if(d){if(r>1&&(!d.blockNumber||b-d.blockNumber+1n<r))return;L(()=>M.resolve(d));return}if(n&&!f&&(h=!0,await Oa(async()=>{f=await te(e,cc,"getTransaction")({hash:o}),f.blockNumber&&(b=f.blockNumber)},{delay:c,retryCount:i}),h=!1),d=await te(e,Is,"getTransactionReceipt")({hash:o}),r>1&&(!d.blockNumber||b-d.blockNumber+1n<r))return;L(()=>M.resolve(d))}catch(g){if(g instanceof Ku||g instanceof Zu){if(!f){h=!1;return}try{p=f,h=!0;const w=await Oa(()=>te(e,It,"getBlock")({blockNumber:b,includeTransactions:!0}),{delay:c,retryCount:i,shouldRetry:({error:I})=>I instanceof cf});h=!1;const O=w.transactions.find(({from:I,nonce:k})=>I===p.from&&k===p.nonce);if(!O||(d=await te(e,Is,"getTransactionReceipt")({hash:O.hash}),r>1&&(!d.blockNumber||b-d.blockNumber+1n<r)))return;let C="replaced";O.to===p.to&&O.value===p.value&&O.input===p.input?C="repriced":O.from===O.to&&O.value===0n&&(C="cancelled"),L(()=>{var I;(I=M.onReplaced)==null||I.call(M,{reason:C,replacedTransaction:p,transaction:O,transactionReceipt:d}),M.resolve(d)})}catch(w){L(()=>M.reject(w))}}else L(()=>M.reject(g))}}})}),P}function o5(e,{blockTag:t=e.experimental_blockTag??"latest",emitMissed:n=!1,emitOnBegin:r=!1,onBlock:o,onError:s,includeTransactions:i,poll:c,pollingInterval:a=e.pollingInterval}){const l=typeof c<"u"?c:!(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")),u=i??!1;let f;return l?(()=>{const h=Oe(["watchBlocks",e.uid,t,n,r,u,a]);return An(h,{onBlock:o,onError:s},m=>Oo(async()=>{var x;try{const P=await te(e,It,"getBlock")({blockTag:t,includeTransactions:u});if(P.number!==null&&(f==null?void 0:f.number)!=null){if(P.number===f.number)return;if(P.number-f.number>1&&n)for(let E=(f==null?void 0:f.number)+1n;E<P.number;E++){const T=await te(e,It,"getBlock")({blockNumber:E,includeTransactions:u});m.onBlock(T,f),f=T}}((f==null?void 0:f.number)==null||t==="pending"&&(P==null?void 0:P.number)==null||P.number!==null&&P.number>f.number)&&(m.onBlock(P,f),f=P)}catch(P){(x=m.onError)==null||x.call(m,P)}},{emitOnBegin:r,interval:a}))})():(()=>{let h=!0,m=!0,x=()=>h=!1;return(async()=>{try{r&&te(e,It,"getBlock")({blockTag:t,includeTransactions:u}).then(T=>{h&&m&&(o(T,void 0),m=!1)}).catch(s);const P=(()=>{if(e.transport.type==="fallback"){const T=e.transport.transports.find(N=>N.config.type==="webSocket"||N.config.type==="ipc");return T?T.value:e.transport}return e.transport})(),{unsubscribe:E}=await P.subscribe({params:["newHeads"],async onData(T){var M;if(!h)return;const N=await te(e,It,"getBlock")({blockNumber:(M=T.result)==null?void 0:M.number,includeTransactions:u}).catch(()=>{});h&&(o(N,f),m=!1,f=N)},onError(T){s==null||s(T)}});x=E,h||x()}catch(P){s==null||s(P)}})(),()=>x()})()}function s5(e,{address:t,args:n,batch:r=!0,event:o,events:s,fromBlock:i,onError:c,onLogs:a,poll:l,pollingInterval:u=e.pollingInterval,strict:f}){const p=typeof l<"u"?l:typeof i=="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")),d=f??!1;return p?(()=>{const x=Oe(["watchEvent",t,n,r,e.uid,o,u,i]);return An(x,{onLogs:a,onError:c},P=>{let E;i!==void 0&&(E=i-1n);let T,N=!1;const M=Oo(async()=>{var F;if(!N){try{T=await te(e,bd,"createEventFilter")({address:t,args:n,event:o,events:s,strict:d,fromBlock:i})}catch{}N=!0;return}try{let L;if(T)L=await te(e,Ps,"getFilterChanges")({filter:T});else{const b=await te(e,Io,"getBlockNumber")({});E&&E!==b?L=await te(e,da,"getLogs")({address:t,args:n,event:o,events:s,fromBlock:E+1n,toBlock:b}):L=[],E=b}if(L.length===0)return;if(r)P.onLogs(L);else for(const b of L)P.onLogs([b])}catch(L){T&&L instanceof Sn&&(N=!1),(F=P.onError)==null||F.call(P,L)}},{emitOnBegin:!0,interval:u});return async()=>{T&&await te(e,Ts,"uninstallFilter")({filter:T}),M()}})})():(()=>{let x=!0,P=()=>x=!1;return(async()=>{try{const E=(()=>{if(e.transport.type==="fallback"){const F=e.transport.transports.find(L=>L.config.type==="webSocket"||L.config.type==="ipc");return F?F.value:e.transport}return e.transport})(),T=s??(o?[o]:void 0);let N=[];T&&(N=[T.flatMap(L=>Kr({abi:[L],eventName:L.name,args:n}))],o&&(N=N[0]));const{unsubscribe:M}=await E.subscribe({params:["logs",{address:t,topics:N}],onData(F){var b;if(!x)return;const L=F.result;try{const{eventName:g,args:w}=bs({abi:T??[],data:L.data,topics:L.topics,strict:d}),O=nn(L,{args:w,eventName:g});a([O])}catch(g){let w,O;if(g instanceof os||g instanceof ki){if(f)return;w=g.abiItem.name,O=(b=g.abiItem.inputs)==null?void 0:b.some(I=>!("name"in I&&I.name))}const C=nn(L,{args:O?[]:{},eventName:w});a([C])}},onError(F){c==null||c(F)}});P=M,x||P()}catch(E){c==null||c(E)}})(),()=>P()})()}function i5(e,{batch:t=!0,onError:n,onTransactions:r,poll:o,pollingInterval:s=e.pollingInterval}){return(typeof o<"u"?o:e.transport.type!=="webSocket"&&e.transport.type!=="ipc")?(()=>{const l=Oe(["watchPendingTransactions",e.uid,t,s]);return An(l,{onTransactions:r,onError:n},u=>{let f;const p=Oo(async()=>{var d;try{if(!f)try{f=await te(e,gd,"createPendingTransactionFilter")({});return}catch(m){throw p(),m}const h=await te(e,Ps,"getFilterChanges")({filter:f});if(h.length===0)return;if(t)u.onTransactions(h);else for(const m of h)u.onTransactions([m])}catch(h){(d=u.onError)==null||d.call(u,h)}},{emitOnBegin:!0,interval:s});return async()=>{f&&await te(e,Ts,"uninstallFilter")({filter:f}),p()}})})():(()=>{let l=!0,u=()=>l=!1;return(async()=>{try{const{unsubscribe:f}=await e.transport.subscribe({params:["newPendingTransactions"],onData(p){if(!l)return;const d=p.result;r([d])},onError(p){n==null||n(p)}});u=f,l||u()}catch(f){n==null||n(f)}})(),()=>u()})()}function a5(e){var f,p,d;const{scheme:t,statement:n,...r}=((f=e.match(c5))==null?void 0:f.groups)??{},{chainId:o,expirationTime:s,issuedAt:i,notBefore:c,requestId:a,...l}=((p=e.match(l5))==null?void 0:p.groups)??{},u=(d=e.split("Resources:")[1])==null?void 0:d.split(`
|
|
91
|
+
- `).slice(1);return{...r,...l,...o?{chainId:Number(o)}:{},...s?{expirationTime:new Date(s)}:{},...i?{issuedAt:new Date(i)}:{},...c?{notBefore:new Date(c)}:{},...a?{requestId:a}:{},...u?{resources:u}:{},...t?{scheme:t}:{},...n?{statement:n}:{}}}const c5=/^(?:(?<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)?/,l5=/(?: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 u5(e){const{address:t,domain:n,message:r,nonce:o,scheme:s,time:i=new Date}=e;if(n&&r.domain!==n||o&&r.nonce!==o||s&&r.scheme!==s||r.expirationTime&&i>=r.expirationTime||r.notBefore&&i<r.notBefore)return!1;try{if(!r.address||!dt(r.address,{strict:!1})||t&&!Eo(r.address,t))return!1}catch{return!1}return!0}async function f5(e,t){const{address:n,domain:r,message:o,nonce:s,scheme:i,signature:c,time:a=new Date,...l}=t,u=a5(o);if(!u.address||!u5({address:n,domain:r,message:u,nonce:s,scheme:i,time:a}))return!1;const p=xd(o);return Ds(e,{address:u.address,hash:p,signature:c,...l})}async function d5(e,{serializedTransaction:t,throwOnReceiptRevert:n,timeout:r}){var c,a,l;const o=await e.request({method:"eth_sendRawTransactionSync",params:r?[t,oe(r)]:[t]},{retryCount:0}),i=(((l=(a=(c=e.chain)==null?void 0:c.formatters)==null?void 0:a.transactionReceipt)==null?void 0:l.format)||id)(o);if(i.status==="reverted"&&n)throw new Pg({receipt:i});return i}function p5(e){return{call:t=>Co(e,t),createAccessList:t=>md(e,t),createBlockFilter:()=>$v(e),createContractEventFilter:t=>ju(e,t),createEventFilter:t=>bd(e,t),createPendingTransactionFilter:()=>gd(e),estimateContractGas:t=>uy(e,t),estimateGas:t=>ua(e,t),getBalance:t=>kv(e,t),getBlobBaseFee:()=>Dv(e),getBlock:t=>It(e,t),getBlockNumber:t=>Io(e,t),getBlockTransactionCount:t=>Mv(e,t),getBytecode:t=>Ra(e,t),getChainId:()=>ca(e),getCode:t=>Ra(e,t),getContractEvents:t=>Pf(e,t),getEip712Domain:t=>Lv(e,t),getEnsAddress:t=>mv(e,t),getEnsAvatar:t=>Cv(e,t),getEnsName:t=>Ov(e,t),getEnsResolver:t=>Iv(e,t),getEnsText:t=>hd(e,t),getFeeHistory:t=>jv(e,t),estimateFeesPerGas:t=>Gg(e,t),getFilterChanges:t=>Ps(e,t),getFilterLogs:t=>zv(e,t),getGasPrice:()=>sa(e),getLogs:t=>da(e,t),getProof:t=>D6(e,t),estimateMaxPriorityFeePerGas:t=>Hg(e,t),fillTransaction:t=>wf(e,t),getStorageAt:t=>M6(e,t),getTransaction:t=>cc(e,t),getTransactionConfirmations:t=>B6(e,t),getTransactionCount:t=>df(e,t),getTransactionReceipt:t=>Is(e,t),multicall:t=>L6(e,t),prepareTransactionRequest:t=>Ef(e,t),readContract:t=>Dt(e,t),sendRawTransaction:t=>av(e,t),sendRawTransactionSync:t=>d5(e,t),simulate:t=>lc(e,t),simulateBlocks:t=>lc(e,t),simulateCalls:t=>G6(e,t),simulateContract:t=>Qy(e,t),verifyHash:t=>Ds(e,t),verifyMessage:t=>t5(e,t),verifySiweMessage:t=>f5(e,t),verifyTypedData:t=>n5(e,t),uninstallFilter:t=>Ts(e,t),waitForTransactionReceipt:t=>r5(e,t),watchBlocks:t=>o5(e,t),watchBlockNumber:t=>f0(e,t),watchContractEvent:t=>iv(e,t),watchEvent:t=>s5(e,t),watchPendingTransactions:t=>i5(e,t)}}function h5(e){const{key:t="public",name:n="Public Client"}=e;return lv({...e,key:t,name:n,type:"publicClient"}).extend(p5)}function m5({key:e,methods:t,name:n,request:r,retryCount:o=3,retryDelay:s=150,timeout:i,type:c},a){const l=ad();return{config:{key:e,methods:t,name:n,request:r,retryCount:o,retryDelay:s,timeout:i,type:c},request:Wv(r,{methods:t,retryCount:o,retryDelay:s,uid:l}),value:a}}class b5 extends V{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 g5(e,t={}){const{batch:n,fetchFn:r,fetchOptions:o,key:s="http",methods:i,name:c="HTTP JSON-RPC",onFetchRequest:a,onFetchResponse:l,retryDelay:u,raw:f}=t;return({chain:p,retryCount:d,timeout:h})=>{const{batchSize:m=1e3,wait:x=0}=typeof n=="object"?n:{},P=t.retryCount??d,E=h??t.timeout??1e4,T=e||(p==null?void 0:p.rpcUrls.default.http[0]);if(!T)throw new b5;const N=ew(T,{fetchFn:r,fetchOptions:o,onRequest:a,onResponse:l,timeout:E});return m5({key:s,methods:i,name:c,async request({method:M,params:F}){const L={method:M,params:F},{schedule:b}=rd({id:T,wait:x,shouldSplitBatch(C){return C.length>m},fn:C=>N.request({body:C}),sort:(C,I)=>C.id-I.id}),g=async C=>n?b(C):[await N.request({body:C})],[{error:w,result:O}]=await g(L);if(f)return{error:w,result:O};if(w)throw new qi({body:L,error:w,url:T});return O},retryCount:P,retryDelay:u,timeout:E,type:"http"},{fetchOptions:o,url:T})}}const y5=Xv({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}}});function v5({client:e,tokenAddress:t,holder:n,decimals:r,fallbackFormatted:o="0",pollingInterval:s=12e3}){const[i,c]=v.useState(null),[a,l]=v.useState(o);return v.useEffect(()=>{let u,f;const p=async()=>{try{const d=await e.readContract({address:t,abi:Sr,functionName:"balanceOf",args:[n]});c(d),l(Vi(d,r))}catch{l(o)}};p();try{u=e.watchContractEvent({address:t,abi:Sr,eventName:"Transfer",args:{to:n},onLogs:()=>{p()},poll:!0,pollingInterval:s}),f=e.watchContractEvent({address:t,abi:Sr,eventName:"Transfer",args:{from:n},onLogs:()=>{p()},poll:!0,pollingInterval:s})}catch{}return()=>{u==null||u(),f==null||f()}},[e,t,n,r,o,s]),{value:i,formatted:a}}const w5=()=>({openDeposit:v.useCallback(t=>{},[])}),x5=()=>({openWithdraw:v.useCallback(t=>{},[])}),ln="MPC",Ms="EVM";var st=(e=>(e.SPOT="spot",e.PERPETUAL="perpetual",e.PERPETUALV2="perpetual_v2",e))(st||{});const E5="spot";/**
|
|
83
92
|
* @license lucide-react v0.540.0 - ISC
|
|
84
93
|
*
|
|
85
94
|
* This source code is licensed under the ISC license.
|
|
86
95
|
* See the LICENSE file in the root directory of this source tree.
|
|
87
|
-
*/const
|
|
96
|
+
*/const S5=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),P5=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,n,r)=>r?r.toUpperCase():n.toLowerCase()),d0=e=>{const t=P5(e);return t.charAt(0).toUpperCase()+t.slice(1)},p0=(...e)=>e.filter((t,n,r)=>!!t&&t.trim()!==""&&r.indexOf(t)===n).join(" ").trim(),T5=e=>{for(const t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0};/**
|
|
88
97
|
* @license lucide-react v0.540.0 - ISC
|
|
89
98
|
*
|
|
90
99
|
* This source code is licensed under the ISC license.
|
|
91
100
|
* See the LICENSE file in the root directory of this source tree.
|
|
92
|
-
*/var
|
|
101
|
+
*/var A5={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/**
|
|
93
102
|
* @license lucide-react v0.540.0 - ISC
|
|
94
103
|
*
|
|
95
104
|
* This source code is licensed under the ISC license.
|
|
96
105
|
* See the LICENSE file in the root directory of this source tree.
|
|
97
|
-
*/const
|
|
106
|
+
*/const N5=v.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:o="",children:s,iconNode:i,...c},a)=>v.createElement("svg",{ref:a,...A5,width:t,height:t,stroke:e,strokeWidth:r?Number(n)*24/Number(t):n,className:p0("lucide",o),...!s&&!T5(c)&&{"aria-hidden":"true"},...c},[...i.map(([l,u])=>v.createElement(l,u)),...Array.isArray(s)?s:[s]]));/**
|
|
98
107
|
* @license lucide-react v0.540.0 - ISC
|
|
99
108
|
*
|
|
100
109
|
* This source code is licensed under the ISC license.
|
|
101
110
|
* See the LICENSE file in the root directory of this source tree.
|
|
102
|
-
*/const
|
|
111
|
+
*/const C5=(e,t)=>{const n=v.forwardRef(({className:r,...o},s)=>v.createElement(N5,{ref:s,iconNode:t,className:p0(`lucide-${S5(d0(e))}`,`lucide-${e}`,r),...o}));return n.displayName=d0(e),n};/**
|
|
103
112
|
* @license lucide-react v0.540.0 - ISC
|
|
104
113
|
*
|
|
105
114
|
* This source code is licensed under the ISC license.
|
|
106
115
|
* See the LICENSE file in the root directory of this source tree.
|
|
107
|
-
*/const Fd=Yv("x",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]),Dd=typeof document<"u"?x.useLayoutEffect:()=>{};var La;const Xv=(La=x.useInsertionEffect)!==null&&La!==void 0?La:Dd;function Qv(e){const t=x.useRef(null);return Xv(()=>{t.current=e},[e]),x.useCallback((...n)=>{const r=t.current;return r==null?void 0:r(...n)},[])}const bn=e=>{var t;return(t=e==null?void 0:e.ownerDocument)!==null&&t!==void 0?t:document},_n=e=>e&&"window"in e&&e.window===e?e:bn(e).defaultView||window;function Jv(e){return e!==null&&typeof e=="object"&&"nodeType"in e&&typeof e.nodeType=="number"}function ex(e){return Jv(e)&&e.nodeType===Node.DOCUMENT_FRAGMENT_NODE&&"host"in e}let tx=!1;function Fa(){return tx}function Rd(e,t){if(!Fa())return t&&e?e.contains(t):!1;if(!e||!t)return!1;let n=t;for(;n!==null;){if(n===e)return!0;n.tagName==="SLOT"&&n.assignedSlot?n=n.assignedSlot.parentNode:ex(n)?n=n.host:n=n.parentNode}return!1}const Da=(e=document)=>{var t;if(!Fa())return e.activeElement;let n=e.activeElement;for(;n&&"shadowRoot"in n&&(!((t=n.shadowRoot)===null||t===void 0)&&t.activeElement);)n=n.shadowRoot.activeElement;return n};function jd(e){return Fa()&&e.target.shadowRoot&&e.composedPath?e.composedPath()[0]:e.target}function gs(e){var t;if(typeof window>"u"||window.navigator==null)return!1;let n=(t=window.navigator.userAgentData)===null||t===void 0?void 0:t.brands;return Array.isArray(n)&&n.some(r=>e.test(r.brand))||e.test(window.navigator.userAgent)}function Ra(e){var t;return typeof window<"u"&&window.navigator!=null?e.test(((t=window.navigator.userAgentData)===null||t===void 0?void 0:t.platform)||window.navigator.platform):!1}function nn(e){if(process.env.NODE_ENV==="test")return e;let t=null;return()=>(t==null&&(t=e()),t)}const ja=nn(function(){return Ra(/^Mac/i)}),nx=nn(function(){return Ra(/^iPhone/i)}),rx=nn(function(){return Ra(/^iPad/i)||ja()&&navigator.maxTouchPoints>1}),ox=nn(function(){return nx()||rx()});nn(function(){return ja()||ox()}),nn(function(){return gs(/AppleWebKit/i)&&!sx()});const sx=nn(function(){return gs(/Chrome/i)}),ix=nn(function(){return gs(/Android/i)});nn(function(){return gs(/Firefox/i)});function _d(){let e=x.useRef(new Map),t=x.useCallback((o,s,i,c)=>{let a=c!=null&&c.once?(...u)=>{e.current.delete(i),i(...u)}:i;e.current.set(i,{type:s,eventTarget:o,fn:a,options:c}),o.addEventListener(s,a,c)},[]),n=x.useCallback((o,s,i,c)=>{var a;let u=((a=e.current.get(i))===null||a===void 0?void 0:a.fn)||i;o.removeEventListener(s,u,c),e.current.delete(i)},[]),r=x.useCallback(()=>{e.current.forEach((o,s)=>{n(o.eventTarget,o.type,s,o.options)})},[n]);return x.useEffect(()=>r,[r]),{addGlobalListener:t,removeGlobalListener:n,removeAllGlobalListeners:r}}function ax(e){return e.mozInputSource===0&&e.isTrusted?!0:ix()&&e.pointerType?e.type==="click"&&e.buttons===1:e.detail===0&&!e.pointerType}function Ud(e){let t=e;return t.nativeEvent=e,t.isDefaultPrevented=()=>t.defaultPrevented,t.isPropagationStopped=()=>t.cancelBubble,t.persist=()=>{},t}function cx(e,t){Object.defineProperty(e,"target",{value:t}),Object.defineProperty(e,"currentTarget",{value:t})}function zd(e){let t=x.useRef({isFocused:!1,observer:null});Dd(()=>{const r=t.current;return()=>{r.observer&&(r.observer.disconnect(),r.observer=null)}},[]);let n=Qv(r=>{e==null||e(r)});return x.useCallback(r=>{if(r.target instanceof HTMLButtonElement||r.target instanceof HTMLInputElement||r.target instanceof HTMLTextAreaElement||r.target instanceof HTMLSelectElement){t.current.isFocused=!0;let o=r.target,s=i=>{if(t.current.isFocused=!1,o.disabled){let c=Ud(i);n(c)}t.current.observer&&(t.current.observer.disconnect(),t.current.observer=null)};o.addEventListener("focusout",s,{once:!0}),t.current.observer=new MutationObserver(()=>{if(t.current.isFocused&&o.disabled){var i;(i=t.current.observer)===null||i===void 0||i.disconnect();let c=o===document.activeElement?null:document.activeElement;o.dispatchEvent(new FocusEvent("blur",{relatedTarget:c})),o.dispatchEvent(new FocusEvent("focusout",{bubbles:!0,relatedTarget:c}))}}),t.current.observer.observe(o,{attributes:!0,attributeFilter:["disabled"]})}},[n])}let ux=!1,yo=null,_a=new Set,wo=new Map,Un=!1,Ua=!1;const lx={Tab:!0,Escape:!0};function za(e,t){for(let n of _a)n(e,t)}function fx(e){return!(e.metaKey||!ja()&&e.altKey||e.ctrlKey||e.key==="Control"||e.key==="Shift"||e.key==="Meta")}function bs(e){Un=!0,fx(e)&&(yo="keyboard",za("keyboard",e))}function rt(e){yo="pointer",(e.type==="mousedown"||e.type==="pointerdown")&&(Un=!0,za("pointer",e))}function Hd(e){ax(e)&&(Un=!0,yo="virtual")}function Wd(e){e.target===window||e.target===document||ux||!e.isTrusted||(!Un&&!Ua&&(yo="virtual",za("virtual",e)),Un=!1,Ua=!1)}function Vd(){Un=!1,Ua=!0}function Ha(e){if(typeof window>"u"||typeof document>"u"||wo.get(_n(e)))return;const t=_n(e),n=bn(e);let r=t.HTMLElement.prototype.focus;t.HTMLElement.prototype.focus=function(){Un=!0,r.apply(this,arguments)},n.addEventListener("keydown",bs,!0),n.addEventListener("keyup",bs,!0),n.addEventListener("click",Hd,!0),t.addEventListener("focus",Wd,!0),t.addEventListener("blur",Vd,!1),typeof PointerEvent<"u"?(n.addEventListener("pointerdown",rt,!0),n.addEventListener("pointermove",rt,!0),n.addEventListener("pointerup",rt,!0)):process.env.NODE_ENV==="test"&&(n.addEventListener("mousedown",rt,!0),n.addEventListener("mousemove",rt,!0),n.addEventListener("mouseup",rt,!0)),t.addEventListener("beforeunload",()=>{Gd(e)},{once:!0}),wo.set(t,{focus:r})}const Gd=(e,t)=>{const n=_n(e),r=bn(e);t&&r.removeEventListener("DOMContentLoaded",t),wo.has(n)&&(n.HTMLElement.prototype.focus=wo.get(n).focus,r.removeEventListener("keydown",bs,!0),r.removeEventListener("keyup",bs,!0),r.removeEventListener("click",Hd,!0),n.removeEventListener("focus",Wd,!0),n.removeEventListener("blur",Vd,!1),typeof PointerEvent<"u"?(r.removeEventListener("pointerdown",rt,!0),r.removeEventListener("pointermove",rt,!0),r.removeEventListener("pointerup",rt,!0)):process.env.NODE_ENV==="test"&&(r.removeEventListener("mousedown",rt,!0),r.removeEventListener("mousemove",rt,!0),r.removeEventListener("mouseup",rt,!0)),wo.delete(n))};function dx(e){const t=bn(e);let n;return t.readyState!=="loading"?Ha(e):(n=()=>{Ha(e)},t.addEventListener("DOMContentLoaded",n)),()=>Gd(e,n)}typeof document<"u"&&dx();function qd(){return yo!=="pointer"}const px=new Set(["checkbox","radio","range","color","file","image","button","submit","reset"]);function hx(e,t,n){let r=bn(n==null?void 0:n.target);const o=typeof window<"u"?_n(n==null?void 0:n.target).HTMLInputElement:HTMLInputElement,s=typeof window<"u"?_n(n==null?void 0:n.target).HTMLTextAreaElement:HTMLTextAreaElement,i=typeof window<"u"?_n(n==null?void 0:n.target).HTMLElement:HTMLElement,c=typeof window<"u"?_n(n==null?void 0:n.target).KeyboardEvent:KeyboardEvent;return e=e||r.activeElement instanceof o&&!px.has(r.activeElement.type)||r.activeElement instanceof s||r.activeElement instanceof i&&r.activeElement.isContentEditable,!(e&&t==="keyboard"&&n instanceof c&&!lx[n.key])}function mx(e,t,n){Ha(),x.useEffect(()=>{let r=(o,s)=>{hx(!!(n!=null&&n.isTextInput),o,s)&&e(qd())};return _a.add(r),()=>{_a.delete(r)}},t)}function gx(e){let{isDisabled:t,onFocus:n,onBlur:r,onFocusChange:o}=e;const s=x.useCallback(a=>{if(a.target===a.currentTarget)return r&&r(a),o&&o(!1),!0},[r,o]),i=zd(s),c=x.useCallback(a=>{const u=bn(a.target),l=u?Da(u):Da();a.target===a.currentTarget&&l===jd(a.nativeEvent)&&(n&&n(a),o&&o(!0),i(a))},[o,n,i]);return{focusProps:{onFocus:!t&&(n||o||r)?c:void 0,onBlur:!t&&(r||o)?s:void 0}}}function bx(e){let{isDisabled:t,onBlurWithin:n,onFocusWithin:r,onFocusWithinChange:o}=e,s=x.useRef({isFocusWithin:!1}),{addGlobalListener:i,removeAllGlobalListeners:c}=_d(),a=x.useCallback(f=>{f.currentTarget.contains(f.target)&&s.current.isFocusWithin&&!f.currentTarget.contains(f.relatedTarget)&&(s.current.isFocusWithin=!1,c(),n&&n(f),o&&o(!1))},[n,o,s,c]),u=zd(a),l=x.useCallback(f=>{if(!f.currentTarget.contains(f.target))return;const p=bn(f.target),d=Da(p);if(!s.current.isFocusWithin&&d===jd(f.nativeEvent)){r&&r(f),o&&o(!0),s.current.isFocusWithin=!0,u(f);let h=f.currentTarget;i(p,"focus",m=>{if(s.current.isFocusWithin&&!Rd(h,m.target)){let v=new p.defaultView.FocusEvent("blur",{relatedTarget:m.target});cx(v,h);let A=Ud(v);a(A)}},{capture:!0})}},[r,o,u,i,a]);return t?{focusWithinProps:{onFocus:void 0,onBlur:void 0}}:{focusWithinProps:{onFocus:l,onBlur:a}}}let ys=!1,ws=0;function Wa(){ys=!0,setTimeout(()=>{ys=!1},50)}function Zd(e){e.pointerType==="touch"&&Wa()}function yx(){if(!(typeof document>"u"))return ws===0&&(typeof PointerEvent<"u"?document.addEventListener("pointerup",Zd):process.env.NODE_ENV==="test"&&document.addEventListener("touchend",Wa)),ws++,()=>{ws--,!(ws>0)&&(typeof PointerEvent<"u"?document.removeEventListener("pointerup",Zd):process.env.NODE_ENV==="test"&&document.removeEventListener("touchend",Wa))}}function wx(e){let{onHoverStart:t,onHoverChange:n,onHoverEnd:r,isDisabled:o}=e,[s,i]=x.useState(!1),c=x.useRef({isHovered:!1,ignoreEmulatedMouseEvents:!1,pointerType:"",target:null}).current;x.useEffect(yx,[]);let{addGlobalListener:a,removeAllGlobalListeners:u}=_d(),{hoverProps:l,triggerHoverEnd:f}=x.useMemo(()=>{let p=(m,v)=>{if(c.pointerType=v,o||v==="touch"||c.isHovered||!m.currentTarget.contains(m.target))return;c.isHovered=!0;let A=m.currentTarget;c.target=A,a(bn(m.target),"pointerover",w=>{c.isHovered&&c.target&&!Rd(c.target,w.target)&&d(w,w.pointerType)},{capture:!0}),t&&t({type:"hoverstart",target:A,pointerType:v}),n&&n(!0),i(!0)},d=(m,v)=>{let A=c.target;c.pointerType="",c.target=null,!(v==="touch"||!c.isHovered||!A)&&(c.isHovered=!1,u(),r&&r({type:"hoverend",target:A,pointerType:v}),n&&n(!1),i(!1))},h={};return typeof PointerEvent<"u"?(h.onPointerEnter=m=>{ys&&m.pointerType==="mouse"||p(m,m.pointerType)},h.onPointerLeave=m=>{!o&&m.currentTarget.contains(m.target)&&d(m,m.pointerType)}):process.env.NODE_ENV==="test"&&(h.onTouchStart=()=>{c.ignoreEmulatedMouseEvents=!0},h.onMouseEnter=m=>{!c.ignoreEmulatedMouseEvents&&!ys&&p(m,"mouse"),c.ignoreEmulatedMouseEvents=!1},h.onMouseLeave=m=>{!o&&m.currentTarget.contains(m.target)&&d(m,"mouse")}),{hoverProps:h,triggerHoverEnd:d}},[t,n,r,o,c,a,u]);return x.useEffect(()=>{o&&f({currentTarget:c.target},c.pointerType)},[o]),{hoverProps:l,isHovered:s}}function vx(e={}){let{autoFocus:t=!1,isTextInput:n,within:r}=e,o=x.useRef({isFocused:!1,isFocusVisible:t||qd()}),[s,i]=x.useState(!1),[c,a]=x.useState(()=>o.current.isFocused&&o.current.isFocusVisible),u=x.useCallback(()=>a(o.current.isFocused&&o.current.isFocusVisible),[]),l=x.useCallback(d=>{o.current.isFocused=d,i(d),u()},[u]);mx(d=>{o.current.isFocusVisible=d,u()},[],{isTextInput:n});let{focusProps:f}=gx({isDisabled:r,onFocusChange:l}),{focusWithinProps:p}=bx({isDisabled:!r,onFocusWithinChange:l});return{isFocused:s,isFocusVisible:c,focusProps:r?p:f}}var xx=Object.defineProperty,Ex=(e,t,n)=>t in e?xx(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Va=(e,t,n)=>(Ex(e,typeof t!="symbol"?t+"":t,n),n);let Sx=class{constructor(){Va(this,"current",this.detect()),Va(this,"handoffState","pending"),Va(this,"currentId",0)}set(t){this.current!==t&&(this.handoffState="pending",this.currentId=0,this.current=t)}reset(){this.set(this.detect())}nextId(){return++this.currentId}get isServer(){return this.current==="server"}get isClient(){return this.current==="client"}detect(){return typeof window>"u"||typeof document>"u"?"server":"client"}handoff(){this.handoffState==="pending"&&(this.handoffState="complete")}get isHandoffComplete(){return this.handoffState==="complete"}},Bt=new Sx;function vo(e){var t,n;return Bt.isServer?null:e?"ownerDocument"in e?e.ownerDocument:"current"in e?(n=(t=e.current)==null?void 0:t.ownerDocument)!=null?n:document:null:document}function Kd(e){typeof queueMicrotask=="function"?queueMicrotask(e):Promise.resolve().then(e).catch(t=>setTimeout(()=>{throw t}))}function Pt(){let e=[],t={addEventListener(n,r,o,s){return n.addEventListener(r,o,s),t.add(()=>n.removeEventListener(r,o,s))},requestAnimationFrame(...n){let r=requestAnimationFrame(...n);return t.add(()=>cancelAnimationFrame(r))},nextFrame(...n){return t.requestAnimationFrame(()=>t.requestAnimationFrame(...n))},setTimeout(...n){let r=setTimeout(...n);return t.add(()=>clearTimeout(r))},microTask(...n){let r={current:!0};return Kd(()=>{r.current&&n[0]()}),t.add(()=>{r.current=!1})},style(n,r,o){let s=n.style.getPropertyValue(r);return Object.assign(n.style,{[r]:o}),this.add(()=>{Object.assign(n.style,{[r]:s})})},group(n){let r=Pt();return n(r),this.add(()=>r.dispose())},add(n){return e.includes(n)||e.push(n),()=>{let r=e.indexOf(n);if(r>=0)for(let o of e.splice(r,1))o()}},dispose(){for(let n of e.splice(0))n()}};return t}function br(){let[e]=x.useState(Pt);return x.useEffect(()=>()=>e.dispose(),[e]),e}let ye=(e,t)=>{Bt.isServer?x.useEffect(e,t):x.useLayoutEffect(e,t)};function zn(e){let t=x.useRef(e);return ye(()=>{t.current=e},[e]),t}let ce=function(e){let t=zn(e);return x.useCallback((...n)=>t.current(...n),[t])};function Px(e){let t=e.width/2,n=e.height/2;return{top:e.clientY-n,right:e.clientX+t,bottom:e.clientY+n,left:e.clientX-t}}function $x(e,t){return!(!e||!t||e.right<t.left||e.left>t.right||e.bottom<t.top||e.top>t.bottom)}function Tx({disabled:e=!1}={}){let t=x.useRef(null),[n,r]=x.useState(!1),o=br(),s=ce(()=>{t.current=null,r(!1),o.dispose()}),i=ce(c=>{if(o.dispose(),t.current===null){t.current=c.currentTarget,r(!0);{let a=vo(c.currentTarget);o.addEventListener(a,"pointerup",s,!1),o.addEventListener(a,"pointermove",u=>{if(t.current){let l=Px(u);r($x(l,t.current.getBoundingClientRect()))}},!1),o.addEventListener(a,"pointercancel",s,!1)}}});return{pressed:n,pressProps:e?{}:{onPointerDown:i,onPointerUp:s,onClick:s}}}let Ax=x.createContext(void 0);function Ga(){return x.useContext(Ax)}function qa(...e){return Array.from(new Set(e.flatMap(t=>typeof t=="string"?t.split(" "):[]))).filter(Boolean).join(" ")}function ot(e,t,...n){if(e in t){let o=t[e];return typeof o=="function"?o(...n):o}let r=new Error(`Tried to handle "${e}" but there is no handler defined. Only defined handlers are: ${Object.keys(t).map(o=>`"${o}"`).join(", ")}.`);throw Error.captureStackTrace&&Error.captureStackTrace(r,ot),r}var vs=(e=>(e[e.None=0]="None",e[e.RenderStrategy=1]="RenderStrategy",e[e.Static=2]="Static",e))(vs||{}),yn=(e=>(e[e.Unmount=0]="Unmount",e[e.Hidden=1]="Hidden",e))(yn||{});function Ye(){let e=Cx();return x.useCallback(t=>Ox({mergeRefs:e,...t}),[e])}function Ox({ourProps:e,theirProps:t,slot:n,defaultTag:r,features:o,visible:s=!0,name:i,mergeRefs:c}){c=c??Nx;let a=Yd(t,e);if(s)return xs(a,n,r,i,c);let u=o??0;if(u&2){let{static:l=!1,...f}=a;if(l)return xs(f,n,r,i,c)}if(u&1){let{unmount:l=!0,...f}=a;return ot(l?0:1,{0(){return null},1(){return xs({...f,hidden:!0,style:{display:"none"}},n,r,i,c)}})}return xs(a,n,r,i,c)}function xs(e,t={},n,r,o){let{as:s=n,children:i,refName:c="ref",...a}=Za(e,["unmount","static"]),u=e.ref!==void 0?{[c]:e.ref}:{},l=typeof i=="function"?i(t):i;"className"in a&&a.className&&typeof a.className=="function"&&(a.className=a.className(t)),a["aria-labelledby"]&&a["aria-labelledby"]===a.id&&(a["aria-labelledby"]=void 0);let f={};if(t){let p=!1,d=[];for(let[h,m]of Object.entries(t))typeof m=="boolean"&&(p=!0),m===!0&&d.push(h.replace(/([A-Z])/g,v=>`-${v.toLowerCase()}`));if(p){f["data-headlessui-state"]=d.join(" ");for(let h of d)f[`data-${h}`]=""}}if(s===x.Fragment&&(Object.keys(wn(a)).length>0||Object.keys(wn(f)).length>0))if(!x.isValidElement(l)||Array.isArray(l)&&l.length>1){if(Object.keys(wn(a)).length>0)throw new Error(['Passing props on "Fragment"!',"",`The current component <${r} /> is rendering a "Fragment".`,"However we need to passthrough the following props:",Object.keys(wn(a)).concat(Object.keys(wn(f))).map(p=>` - ${p}`).join(`
|
|
116
|
+
*/const h0=C5("x",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]),m0=typeof document<"u"?v.useLayoutEffect:()=>{};var dc;const O5=(dc=v.useInsertionEffect)!==null&&dc!==void 0?dc:m0;function I5(e){const t=v.useRef(null);return O5(()=>{t.current=e},[e]),v.useCallback((...n)=>{const r=t.current;return r==null?void 0:r(...n)},[])}const Nn=e=>{var t;return(t=e==null?void 0:e.ownerDocument)!==null&&t!==void 0?t:document},Kn=e=>e&&"window"in e&&e.window===e?e:Nn(e).defaultView||window;function $5(e){return e!==null&&typeof e=="object"&&"nodeType"in e&&typeof e.nodeType=="number"}function k5(e){return $5(e)&&e.nodeType===Node.DOCUMENT_FRAGMENT_NODE&&"host"in e}let D5=!1;function pc(){return D5}function b0(e,t){if(!pc())return t&&e?e.contains(t):!1;if(!e||!t)return!1;let n=t;for(;n!==null;){if(n===e)return!0;n.tagName==="SLOT"&&n.assignedSlot?n=n.assignedSlot.parentNode:k5(n)?n=n.host:n=n.parentNode}return!1}const hc=(e=document)=>{var t;if(!pc())return e.activeElement;let n=e.activeElement;for(;n&&"shadowRoot"in n&&(!((t=n.shadowRoot)===null||t===void 0)&&t.activeElement);)n=n.shadowRoot.activeElement;return n};function g0(e){return pc()&&e.target.shadowRoot&&e.composedPath?e.composedPath()[0]:e.target}function Bs(e){var t;if(typeof window>"u"||window.navigator==null)return!1;let n=(t=window.navigator.userAgentData)===null||t===void 0?void 0:t.brands;return Array.isArray(n)&&n.some(r=>e.test(r.brand))||e.test(window.navigator.userAgent)}function mc(e){var t;return typeof window<"u"&&window.navigator!=null?e.test(((t=window.navigator.userAgentData)===null||t===void 0?void 0:t.platform)||window.navigator.platform):!1}function un(e){if(process.env.NODE_ENV==="test")return e;let t=null;return()=>(t==null&&(t=e()),t)}const bc=un(function(){return mc(/^Mac/i)}),M5=un(function(){return mc(/^iPhone/i)}),B5=un(function(){return mc(/^iPad/i)||bc()&&navigator.maxTouchPoints>1}),L5=un(function(){return M5()||B5()});un(function(){return bc()||L5()}),un(function(){return Bs(/AppleWebKit/i)&&!F5()});const F5=un(function(){return Bs(/Chrome/i)}),R5=un(function(){return Bs(/Android/i)});un(function(){return Bs(/Firefox/i)});function y0(){let e=v.useRef(new Map),t=v.useCallback((o,s,i,c)=>{let a=c!=null&&c.once?(...l)=>{e.current.delete(i),i(...l)}:i;e.current.set(i,{type:s,eventTarget:o,fn:a,options:c}),o.addEventListener(s,a,c)},[]),n=v.useCallback((o,s,i,c)=>{var a;let l=((a=e.current.get(i))===null||a===void 0?void 0:a.fn)||i;o.removeEventListener(s,l,c),e.current.delete(i)},[]),r=v.useCallback(()=>{e.current.forEach((o,s)=>{n(o.eventTarget,o.type,s,o.options)})},[n]);return v.useEffect(()=>r,[r]),{addGlobalListener:t,removeGlobalListener:n,removeAllGlobalListeners:r}}function j5(e){return e.pointerType===""&&e.isTrusted?!0:R5()&&e.pointerType?e.type==="click"&&e.buttons===1:e.detail===0&&!e.pointerType}function v0(e){let t=e;return t.nativeEvent=e,t.isDefaultPrevented=()=>t.defaultPrevented,t.isPropagationStopped=()=>t.cancelBubble,t.persist=()=>{},t}function z5(e,t){Object.defineProperty(e,"target",{value:t}),Object.defineProperty(e,"currentTarget",{value:t})}function w0(e){let t=v.useRef({isFocused:!1,observer:null});m0(()=>{const r=t.current;return()=>{r.observer&&(r.observer.disconnect(),r.observer=null)}},[]);let n=I5(r=>{e==null||e(r)});return v.useCallback(r=>{if(r.target instanceof HTMLButtonElement||r.target instanceof HTMLInputElement||r.target instanceof HTMLTextAreaElement||r.target instanceof HTMLSelectElement){t.current.isFocused=!0;let o=r.target,s=i=>{if(t.current.isFocused=!1,o.disabled){let c=v0(i);n(c)}t.current.observer&&(t.current.observer.disconnect(),t.current.observer=null)};o.addEventListener("focusout",s,{once:!0}),t.current.observer=new MutationObserver(()=>{if(t.current.isFocused&&o.disabled){var i;(i=t.current.observer)===null||i===void 0||i.disconnect();let c=o===document.activeElement?null:document.activeElement;o.dispatchEvent(new FocusEvent("blur",{relatedTarget:c})),o.dispatchEvent(new FocusEvent("focusout",{bubbles:!0,relatedTarget:c}))}}),t.current.observer.observe(o,{attributes:!0,attributeFilter:["disabled"]})}},[n])}let U5=!1,Mo=null,gc=new Set,Bo=new Map,Zn=!1,yc=!1;const _5={Tab:!0,Escape:!0};function vc(e,t){for(let n of gc)n(e,t)}function W5(e){return!(e.metaKey||!bc()&&e.altKey||e.ctrlKey||e.key==="Control"||e.key==="Shift"||e.key==="Meta")}function Ls(e){Zn=!0,W5(e)&&(Mo="keyboard",vc("keyboard",e))}function mt(e){Mo="pointer",(e.type==="mousedown"||e.type==="pointerdown")&&(Zn=!0,vc("pointer",e))}function x0(e){j5(e)&&(Zn=!0,Mo="virtual")}function E0(e){e.target===window||e.target===document||U5||!e.isTrusted||(!Zn&&!yc&&(Mo="virtual",vc("virtual",e)),Zn=!1,yc=!1)}function S0(){Zn=!1,yc=!0}function wc(e){if(typeof window>"u"||typeof document>"u"||Bo.get(Kn(e)))return;const t=Kn(e),n=Nn(e);let r=t.HTMLElement.prototype.focus;t.HTMLElement.prototype.focus=function(){Zn=!0,r.apply(this,arguments)},n.addEventListener("keydown",Ls,!0),n.addEventListener("keyup",Ls,!0),n.addEventListener("click",x0,!0),t.addEventListener("focus",E0,!0),t.addEventListener("blur",S0,!1),typeof PointerEvent<"u"?(n.addEventListener("pointerdown",mt,!0),n.addEventListener("pointermove",mt,!0),n.addEventListener("pointerup",mt,!0)):process.env.NODE_ENV==="test"&&(n.addEventListener("mousedown",mt,!0),n.addEventListener("mousemove",mt,!0),n.addEventListener("mouseup",mt,!0)),t.addEventListener("beforeunload",()=>{P0(e)},{once:!0}),Bo.set(t,{focus:r})}const P0=(e,t)=>{const n=Kn(e),r=Nn(e);t&&r.removeEventListener("DOMContentLoaded",t),Bo.has(n)&&(n.HTMLElement.prototype.focus=Bo.get(n).focus,r.removeEventListener("keydown",Ls,!0),r.removeEventListener("keyup",Ls,!0),r.removeEventListener("click",x0,!0),n.removeEventListener("focus",E0,!0),n.removeEventListener("blur",S0,!1),typeof PointerEvent<"u"?(r.removeEventListener("pointerdown",mt,!0),r.removeEventListener("pointermove",mt,!0),r.removeEventListener("pointerup",mt,!0)):process.env.NODE_ENV==="test"&&(r.removeEventListener("mousedown",mt,!0),r.removeEventListener("mousemove",mt,!0),r.removeEventListener("mouseup",mt,!0)),Bo.delete(n))};function V5(e){const t=Nn(e);let n;return t.readyState!=="loading"?wc(e):(n=()=>{wc(e)},t.addEventListener("DOMContentLoaded",n)),()=>P0(e,n)}typeof document<"u"&&V5();function T0(){return Mo!=="pointer"}const H5=new Set(["checkbox","radio","range","color","file","image","button","submit","reset"]);function G5(e,t,n){let r=Nn(n==null?void 0:n.target);const o=typeof window<"u"?Kn(n==null?void 0:n.target).HTMLInputElement:HTMLInputElement,s=typeof window<"u"?Kn(n==null?void 0:n.target).HTMLTextAreaElement:HTMLTextAreaElement,i=typeof window<"u"?Kn(n==null?void 0:n.target).HTMLElement:HTMLElement,c=typeof window<"u"?Kn(n==null?void 0:n.target).KeyboardEvent:KeyboardEvent;return e=e||r.activeElement instanceof o&&!H5.has(r.activeElement.type)||r.activeElement instanceof s||r.activeElement instanceof i&&r.activeElement.isContentEditable,!(e&&t==="keyboard"&&n instanceof c&&!_5[n.key])}function q5(e,t,n){wc(),v.useEffect(()=>{let r=(o,s)=>{G5(!!(n!=null&&n.isTextInput),o,s)&&e(T0())};return gc.add(r),()=>{gc.delete(r)}},t)}function K5(e){let{isDisabled:t,onFocus:n,onBlur:r,onFocusChange:o}=e;const s=v.useCallback(a=>{if(a.target===a.currentTarget)return r&&r(a),o&&o(!1),!0},[r,o]),i=w0(s),c=v.useCallback(a=>{const l=Nn(a.target),u=l?hc(l):hc();a.target===a.currentTarget&&u===g0(a.nativeEvent)&&(n&&n(a),o&&o(!0),i(a))},[o,n,i]);return{focusProps:{onFocus:!t&&(n||o||r)?c:void 0,onBlur:!t&&(r||o)?s:void 0}}}function Z5(e){let{isDisabled:t,onBlurWithin:n,onFocusWithin:r,onFocusWithinChange:o}=e,s=v.useRef({isFocusWithin:!1}),{addGlobalListener:i,removeAllGlobalListeners:c}=y0(),a=v.useCallback(f=>{f.currentTarget.contains(f.target)&&s.current.isFocusWithin&&!f.currentTarget.contains(f.relatedTarget)&&(s.current.isFocusWithin=!1,c(),n&&n(f),o&&o(!1))},[n,o,s,c]),l=w0(a),u=v.useCallback(f=>{if(!f.currentTarget.contains(f.target))return;const p=Nn(f.target),d=hc(p);if(!s.current.isFocusWithin&&d===g0(f.nativeEvent)){r&&r(f),o&&o(!0),s.current.isFocusWithin=!0,l(f);let h=f.currentTarget;i(p,"focus",m=>{if(s.current.isFocusWithin&&!b0(h,m.target)){let x=new p.defaultView.FocusEvent("blur",{relatedTarget:m.target});z5(x,h);let P=v0(x);a(P)}},{capture:!0})}},[r,o,l,i,a]);return t?{focusWithinProps:{onFocus:void 0,onBlur:void 0}}:{focusWithinProps:{onFocus:u,onBlur:a}}}let Fs=!1,Rs=0;function xc(){Fs=!0,setTimeout(()=>{Fs=!1},50)}function A0(e){e.pointerType==="touch"&&xc()}function Y5(){if(!(typeof document>"u"))return Rs===0&&(typeof PointerEvent<"u"?document.addEventListener("pointerup",A0):process.env.NODE_ENV==="test"&&document.addEventListener("touchend",xc)),Rs++,()=>{Rs--,!(Rs>0)&&(typeof PointerEvent<"u"?document.removeEventListener("pointerup",A0):process.env.NODE_ENV==="test"&&document.removeEventListener("touchend",xc))}}function X5(e){let{onHoverStart:t,onHoverChange:n,onHoverEnd:r,isDisabled:o}=e,[s,i]=v.useState(!1),c=v.useRef({isHovered:!1,ignoreEmulatedMouseEvents:!1,pointerType:"",target:null}).current;v.useEffect(Y5,[]);let{addGlobalListener:a,removeAllGlobalListeners:l}=y0(),{hoverProps:u,triggerHoverEnd:f}=v.useMemo(()=>{let p=(m,x)=>{if(c.pointerType=x,o||x==="touch"||c.isHovered||!m.currentTarget.contains(m.target))return;c.isHovered=!0;let P=m.currentTarget;c.target=P,a(Nn(m.target),"pointerover",E=>{c.isHovered&&c.target&&!b0(c.target,E.target)&&d(E,E.pointerType)},{capture:!0}),t&&t({type:"hoverstart",target:P,pointerType:x}),n&&n(!0),i(!0)},d=(m,x)=>{let P=c.target;c.pointerType="",c.target=null,!(x==="touch"||!c.isHovered||!P)&&(c.isHovered=!1,l(),r&&r({type:"hoverend",target:P,pointerType:x}),n&&n(!1),i(!1))},h={};return typeof PointerEvent<"u"?(h.onPointerEnter=m=>{Fs&&m.pointerType==="mouse"||p(m,m.pointerType)},h.onPointerLeave=m=>{!o&&m.currentTarget.contains(m.target)&&d(m,m.pointerType)}):process.env.NODE_ENV==="test"&&(h.onTouchStart=()=>{c.ignoreEmulatedMouseEvents=!0},h.onMouseEnter=m=>{!c.ignoreEmulatedMouseEvents&&!Fs&&p(m,"mouse"),c.ignoreEmulatedMouseEvents=!1},h.onMouseLeave=m=>{!o&&m.currentTarget.contains(m.target)&&d(m,"mouse")}),{hoverProps:h,triggerHoverEnd:d}},[t,n,r,o,c,a,l]);return v.useEffect(()=>{o&&f({currentTarget:c.target},c.pointerType)},[o]),{hoverProps:u,isHovered:s}}function J5(e={}){let{autoFocus:t=!1,isTextInput:n,within:r}=e,o=v.useRef({isFocused:!1,isFocusVisible:t||T0()}),[s,i]=v.useState(!1),[c,a]=v.useState(()=>o.current.isFocused&&o.current.isFocusVisible),l=v.useCallback(()=>a(o.current.isFocused&&o.current.isFocusVisible),[]),u=v.useCallback(d=>{o.current.isFocused=d,i(d),l()},[l]);q5(d=>{o.current.isFocusVisible=d,l()},[],{isTextInput:n});let{focusProps:f}=K5({isDisabled:r,onFocusChange:u}),{focusWithinProps:p}=Z5({isDisabled:!r,onFocusWithinChange:u});return{isFocused:s,isFocusVisible:c,focusProps:r?p:f}}var Q5=Object.defineProperty,ex=(e,t,n)=>t in e?Q5(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Ec=(e,t,n)=>(ex(e,typeof t!="symbol"?t+"":t,n),n);let tx=class{constructor(){Ec(this,"current",this.detect()),Ec(this,"handoffState","pending"),Ec(this,"currentId",0)}set(t){this.current!==t&&(this.handoffState="pending",this.currentId=0,this.current=t)}reset(){this.set(this.detect())}nextId(){return++this.currentId}get isServer(){return this.current==="server"}get isClient(){return this.current==="client"}detect(){return typeof window>"u"||typeof document>"u"?"server":"client"}handoff(){this.handoffState==="pending"&&(this.handoffState="complete")}get isHandoffComplete(){return this.handoffState==="complete"}},_t=new tx;function js(e){var t;return _t.isServer?null:e==null?document:(t=e==null?void 0:e.ownerDocument)!=null?t:document}function zs(e){var t,n;return _t.isServer?null:e==null?document:(n=(t=e==null?void 0:e.getRootNode)==null?void 0:t.call(e))!=null?n:document}function N0(e){var t,n;return(n=(t=zs(e))==null?void 0:t.activeElement)!=null?n:null}function nx(e){return N0(e)===e}function C0(e){typeof queueMicrotask=="function"?queueMicrotask(e):Promise.resolve().then(e).catch(t=>setTimeout(()=>{throw t}))}function it(){let e=[],t={addEventListener(n,r,o,s){return n.addEventListener(r,o,s),t.add(()=>n.removeEventListener(r,o,s))},requestAnimationFrame(...n){let r=requestAnimationFrame(...n);return t.add(()=>cancelAnimationFrame(r))},nextFrame(...n){return t.requestAnimationFrame(()=>t.requestAnimationFrame(...n))},setTimeout(...n){let r=setTimeout(...n);return t.add(()=>clearTimeout(r))},microTask(...n){let r={current:!0};return C0(()=>{r.current&&n[0]()}),t.add(()=>{r.current=!1})},style(n,r,o){let s=n.style.getPropertyValue(r);return Object.assign(n.style,{[r]:o}),this.add(()=>{Object.assign(n.style,{[r]:s})})},group(n){let r=it();return n(r),this.add(()=>r.dispose())},add(n){return e.includes(n)||e.push(n),()=>{let r=e.indexOf(n);if(r>=0)for(let o of e.splice(r,1))o()}},dispose(){for(let n of e.splice(0))n()}};return t}function Yn(){let[e]=v.useState(it);return v.useEffect(()=>()=>e.dispose(),[e]),e}let Te=(e,t)=>{_t.isServer?v.useEffect(e,t):v.useLayoutEffect(e,t)};function Xn(e){let t=v.useRef(e);return Te(()=>{t.current=e},[e]),t}let me=function(e){let t=Xn(e);return v.useCallback((...n)=>t.current(...n),[t])};function rx(e){let t=e.width/2,n=e.height/2;return{top:e.clientY-n,right:e.clientX+t,bottom:e.clientY+n,left:e.clientX-t}}function ox(e,t){return!(!e||!t||e.right<t.left||e.left>t.right||e.bottom<t.top||e.top>t.bottom)}function sx({disabled:e=!1}={}){let t=v.useRef(null),[n,r]=v.useState(!1),o=Yn(),s=me(()=>{t.current=null,r(!1),o.dispose()}),i=me(c=>{if(o.dispose(),t.current===null){t.current=c.currentTarget,r(!0);{let a=js(c.currentTarget);o.addEventListener(a,"pointerup",s,!1),o.addEventListener(a,"pointermove",l=>{if(t.current){let u=rx(l);r(ox(u,t.current.getBoundingClientRect()))}},!1),o.addEventListener(a,"pointercancel",s,!1)}}});return{pressed:n,pressProps:e?{}:{onPointerDown:i,onPointerUp:s,onClick:s}}}function Cn(e){return v.useMemo(()=>e,Object.values(e))}let ix=v.createContext(void 0);function Sc(){return v.useContext(ix)}function Pc(...e){return Array.from(new Set(e.flatMap(t=>typeof t=="string"?t.split(" "):[]))).filter(Boolean).join(" ")}function bt(e,t,...n){if(e in t){let o=t[e];return typeof o=="function"?o(...n):o}let r=new Error(`Tried to handle "${e}" but there is no handler defined. Only defined handlers are: ${Object.keys(t).map(o=>`"${o}"`).join(", ")}.`);throw Error.captureStackTrace&&Error.captureStackTrace(r,bt),r}var Us=(e=>(e[e.None=0]="None",e[e.RenderStrategy=1]="RenderStrategy",e[e.Static=2]="Static",e))(Us||{}),On=(e=>(e[e.Unmount=0]="Unmount",e[e.Hidden=1]="Hidden",e))(On||{});function at(){let e=cx();return v.useCallback(t=>ax({mergeRefs:e,...t}),[e])}function ax({ourProps:e,theirProps:t,slot:n,defaultTag:r,features:o,visible:s=!0,name:i,mergeRefs:c}){c=c??lx;let a=O0(t,e);if(s)return _s(a,n,r,i,c);let l=o??0;if(l&2){let{static:u=!1,...f}=a;if(u)return _s(f,n,r,i,c)}if(l&1){let{unmount:u=!0,...f}=a;return bt(u?0:1,{0(){return null},1(){return _s({...f,hidden:!0,style:{display:"none"}},n,r,i,c)}})}return _s(a,n,r,i,c)}function _s(e,t={},n,r,o){let{as:s=n,children:i,refName:c="ref",...a}=Tc(e,["unmount","static"]),l=e.ref!==void 0?{[c]:e.ref}:{},u=typeof i=="function"?i(t):i;"className"in a&&a.className&&typeof a.className=="function"&&(a.className=a.className(t)),a["aria-labelledby"]&&a["aria-labelledby"]===a.id&&(a["aria-labelledby"]=void 0);let f={};if(t){let p=!1,d=[];for(let[h,m]of Object.entries(t))typeof m=="boolean"&&(p=!0),m===!0&&d.push(h.replace(/([A-Z])/g,x=>`-${x.toLowerCase()}`));if(p){f["data-headlessui-state"]=d.join(" ");for(let h of d)f[`data-${h}`]=""}}if(Lo(s)&&(Object.keys(In(a)).length>0||Object.keys(In(f)).length>0))if(!v.isValidElement(u)||Array.isArray(u)&&u.length>1||fx(u)){if(Object.keys(In(a)).length>0)throw new Error(['Passing props on "Fragment"!',"",`The current component <${r} /> is rendering a "Fragment".`,"However we need to passthrough the following props:",Object.keys(In(a)).concat(Object.keys(In(f))).map(p=>` - ${p}`).join(`
|
|
108
117
|
`),"","You can apply a few solutions:",['Add an `as="..."` prop, to ensure that we render an actual element instead of a "Fragment".',"Render a single element as the child so that we can forward the props onto that element."].map(p=>` - ${p}`).join(`
|
|
109
118
|
`)].join(`
|
|
110
|
-
`))}else{let p=l.props,d=p==null?void 0:p.className,h=typeof d=="function"?(...A)=>qa(d(...A),a.className):qa(d,a.className),m=h?{className:h}:{},v=Yd(l.props,wn(Za(a,["ref"])));for(let A in f)A in v&&delete f[A];return x.cloneElement(l,Object.assign({},v,f,u,{ref:o(Ix(l),u.ref)},m))}return x.createElement(s,Object.assign({},Za(a,["ref"]),s!==x.Fragment&&u,s!==x.Fragment&&f),l)}function Cx(){let e=x.useRef([]),t=x.useCallback(n=>{for(let r of e.current)r!=null&&(typeof r=="function"?r(n):r.current=n)},[]);return(...n)=>{if(!n.every(r=>r==null))return e.current=n,t}}function Nx(...e){return e.every(t=>t==null)?void 0:t=>{for(let n of e)n!=null&&(typeof n=="function"?n(t):n.current=t)}}function Yd(...e){if(e.length===0)return{};if(e.length===1)return e[0];let t={},n={};for(let r of e)for(let o in r)o.startsWith("on")&&typeof r[o]=="function"?(n[o]!=null||(n[o]=[]),n[o].push(r[o])):t[o]=r[o];if(t.disabled||t["aria-disabled"])for(let r in n)/^(on(?:Click|Pointer|Mouse|Key)(?:Down|Up|Press)?)$/.test(r)&&(n[r]=[o=>{var s;return(s=o==null?void 0:o.preventDefault)==null?void 0:s.call(o)}]);for(let r in n)Object.assign(t,{[r](o,...s){let i=n[r];for(let c of i){if((o instanceof Event||(o==null?void 0:o.nativeEvent)instanceof Event)&&o.defaultPrevented)return;c(o,...s)}}});return t}function Xd(...e){if(e.length===0)return{};if(e.length===1)return e[0];let t={},n={};for(let r of e)for(let o in r)o.startsWith("on")&&typeof r[o]=="function"?(n[o]!=null||(n[o]=[]),n[o].push(r[o])):t[o]=r[o];for(let r in n)Object.assign(t,{[r](...o){let s=n[r];for(let i of s)i==null||i(...o)}});return t}function ze(e){var t;return Object.assign(x.forwardRef(e),{displayName:(t=e.displayName)!=null?t:e.name})}function wn(e){let t=Object.assign({},e);for(let n in t)t[n]===void 0&&delete t[n];return t}function Za(e,t=[]){let n=Object.assign({},e);for(let r of t)r in n&&delete n[r];return n}function Ix(e){return x.version.split(".")[0]>="19"?e.props.ref:e.ref}function Mx(e,t,n){let[r,o]=x.useState(n),s=e!==void 0,i=x.useRef(s),c=x.useRef(!1),a=x.useRef(!1);return s&&!i.current&&!c.current?(c.current=!0,i.current=s,console.error("A component is changing from uncontrolled to controlled. This may be caused by the value changing from undefined to a defined value, which should not happen.")):!s&&i.current&&!a.current&&(a.current=!0,i.current=s,console.error("A component is changing from controlled to uncontrolled. This may be caused by the value changing from a defined value to undefined, which should not happen.")),[s?e:r,ce(u=>(s||o(u),t==null?void 0:t(u)))]}function kx(e){let[t]=x.useState(e);return t}function Qd(e={},t=null,n=[]){for(let[r,o]of Object.entries(e))ep(n,Jd(t,r),o);return n}function Jd(e,t){return e?e+"["+t+"]":t}function ep(e,t,n){if(Array.isArray(n))for(let[r,o]of n.entries())ep(e,Jd(t,r.toString()),o);else n instanceof Date?e.push([t,n.toISOString()]):typeof n=="boolean"?e.push([t,n?"1":"0"]):typeof n=="string"?e.push([t,n]):typeof n=="number"?e.push([t,`${n}`]):n==null?e.push([t,""]):Qd(n,t,e)}function Bx(e){var t,n;let r=(t=e==null?void 0:e.form)!=null?t:e.closest("form");if(r){for(let o of r.elements)if(o!==e&&(o.tagName==="INPUT"&&o.type==="submit"||o.tagName==="BUTTON"&&o.type==="submit"||o.nodeName==="INPUT"&&o.type==="image")){o.click();return}(n=r.requestSubmit)==null||n.call(r)}}let Lx="span";var Ka=(e=>(e[e.None=1]="None",e[e.Focusable=2]="Focusable",e[e.Hidden=4]="Hidden",e))(Ka||{});function Fx(e,t){var n;let{features:r=1,...o}=e,s={ref:t,"aria-hidden":(r&2)===2?!0:(n=o["aria-hidden"])!=null?n:void 0,hidden:(r&4)===4?!0:void 0,style:{position:"fixed",top:1,left:1,width:1,height:0,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0",...(r&4)===4&&(r&2)!==2&&{display:"none"}}};return Ye()({ourProps:s,theirProps:o,slot:{},defaultTag:Lx,name:"Hidden"})}let tp=ze(Fx),Dx=x.createContext(null);function Rx({children:e}){let t=x.useContext(Dx);if(!t)return x.createElement(x.Fragment,null,e);let{target:n}=t;return n?ke.createPortal(x.createElement(x.Fragment,null,e),n):null}function jx({data:e,form:t,disabled:n,onReset:r,overrides:o}){let[s,i]=x.useState(null),c=br();return x.useEffect(()=>{if(r&&s)return c.addEventListener(s,"reset",r)},[s,t,r]),x.createElement(Rx,null,x.createElement(_x,{setForm:i,formId:t}),Qd(e).map(([a,u])=>x.createElement(tp,{features:Ka.Hidden,...wn({key:a,as:"input",type:"hidden",hidden:!0,readOnly:!0,form:t,disabled:n,name:a,value:u,...o})})))}function _x({setForm:e,formId:t}){return x.useEffect(()=>{if(t){let n=document.getElementById(t);n&&e(n)}},[e,t]),t?null:x.createElement(tp,{features:Ka.Hidden,as:"input",type:"hidden",hidden:!0,readOnly:!0,ref:n=>{if(!n)return;let r=n.closest("form");r&&e(r)}})}let Ux=x.createContext(void 0);function np(){return x.useContext(Ux)}function Ya(e){return typeof e!="object"||e===null?!1:"nodeType"in e}function Es(e){return Ya(e)&&"tagName"in e}function rn(e){return Es(e)&&"accessKey"in e}function yr(e){return Es(e)&&"tabIndex"in e}function zx(e){return Es(e)&&"style"in e}function Hx(e){return rn(e)&&e.nodeName==="IFRAME"}function rp(e){return rn(e)&&e.nodeName==="INPUT"}function op(e){return rn(e)&&e.nodeName==="LABEL"}function Wx(e){return rn(e)&&e.nodeName==="FIELDSET"}function sp(e){return rn(e)&&e.nodeName==="LEGEND"}function Vx(e){return Es(e)?e.matches('a[href],audio[controls],button,details,embed,iframe,img[usemap],input:not([type="hidden"]),label,select,textarea,video[controls]'):!1}function Gx(e){let t=e.parentElement,n=null;for(;t&&!Wx(t);)sp(t)&&(n=t),t=t.parentElement;let r=(t==null?void 0:t.getAttribute("disabled"))==="";return r&&qx(n)?!1:r}function qx(e){if(!e)return!1;let t=e.previousElementSibling;for(;t!==null;){if(sp(t))return!1;t=t.previousElementSibling}return!0}let ip=Symbol();function Zx(e,t=!0){return Object.assign(e,{[ip]:t})}function st(...e){let t=x.useRef(e);x.useEffect(()=>{t.current=e},[e]);let n=ce(r=>{for(let o of t.current)o!=null&&(typeof o=="function"?o(r):o.current=r)});return e.every(r=>r==null||(r==null?void 0:r[ip]))?void 0:n}let Xa=x.createContext(null);Xa.displayName="DescriptionContext";function ap(){let e=x.useContext(Xa);if(e===null){let t=new Error("You used a <Description /> component, but it is not inside a relevant parent.");throw Error.captureStackTrace&&Error.captureStackTrace(t,ap),t}return e}function Kx(){var e,t;return(t=(e=x.useContext(Xa))==null?void 0:e.value)!=null?t:void 0}let Yx="p";function Xx(e,t){let n=x.useId(),r=Ga(),{id:o=`headlessui-description-${n}`,...s}=e,i=ap(),c=st(t);ye(()=>i.register(o),[o,i.register]);let a=r||!1,u=x.useMemo(()=>({...i.slot,disabled:a}),[i.slot,a]),l={ref:c,...i.props,id:o};return Ye()({ourProps:l,theirProps:s,slot:u,defaultTag:Yx,name:i.name||"Description"})}let Qx=ze(Xx);Object.assign(Qx,{});var Oe=(e=>(e.Space=" ",e.Enter="Enter",e.Escape="Escape",e.Backspace="Backspace",e.Delete="Delete",e.ArrowLeft="ArrowLeft",e.ArrowUp="ArrowUp",e.ArrowRight="ArrowRight",e.ArrowDown="ArrowDown",e.Home="Home",e.End="End",e.PageUp="PageUp",e.PageDown="PageDown",e.Tab="Tab",e))(Oe||{});let Ss=x.createContext(null);Ss.displayName="LabelContext";function cp(){let e=x.useContext(Ss);if(e===null){let t=new Error("You used a <Label /> component, but it is not inside a relevant parent.");throw Error.captureStackTrace&&Error.captureStackTrace(t,cp),t}return e}function up(e){var t,n,r;let o=(n=(t=x.useContext(Ss))==null?void 0:t.value)!=null?n:void 0;return((r=e==null?void 0:e.length)!=null?r:0)>0?[o,...e].filter(Boolean).join(" "):o}function Jx({inherit:e=!1}={}){let t=up(),[n,r]=x.useState([]),o=e?[t,...n].filter(Boolean):n;return[o.length>0?o.join(" "):void 0,x.useMemo(()=>function(s){let i=ce(a=>(r(u=>[...u,a]),()=>r(u=>{let l=u.slice(),f=l.indexOf(a);return f!==-1&&l.splice(f,1),l}))),c=x.useMemo(()=>({register:i,slot:s.slot,name:s.name,props:s.props,value:s.value}),[i,s.slot,s.name,s.props,s.value]);return x.createElement(Ss.Provider,{value:c},s.children)},[r])]}let eE="label";function tE(e,t){var n;let r=x.useId(),o=cp(),s=np(),i=Ga(),{id:c=`headlessui-label-${r}`,htmlFor:a=s??((n=o.props)==null?void 0:n.htmlFor),passive:u=!1,...l}=e,f=st(t);ye(()=>o.register(c),[c,o.register]);let p=ce(v=>{let A=v.currentTarget;if(!(v.target!==v.currentTarget&&Vx(v.target))&&(op(A)&&v.preventDefault(),o.props&&"onClick"in o.props&&typeof o.props.onClick=="function"&&o.props.onClick(v),op(A))){let w=document.getElementById(A.htmlFor);if(w){let T=w.getAttribute("disabled");if(T==="true"||T==="")return;let B=w.getAttribute("aria-disabled");if(B==="true"||B==="")return;(rp(w)&&(w.type==="file"||w.type==="radio"||w.type==="checkbox")||w.role==="radio"||w.role==="checkbox"||w.role==="switch")&&w.click(),w.focus({preventScroll:!0})}}}),d=i||!1,h=x.useMemo(()=>({...o.slot,disabled:d}),[o.slot,d]),m={ref:f,...o.props,id:c,htmlFor:a,onClick:p};return u&&("onClick"in m&&(delete m.htmlFor,delete m.onClick),"onClick"in l&&delete l.onClick),Ye()({ourProps:m,theirProps:l,slot:h,defaultTag:a?eE:"div",name:o.name||"Label"})}let nE=ze(tE),rE=Object.assign(nE,{});function oE(e,t){return e!==null&&t!==null&&typeof e=="object"&&typeof t=="object"&&"id"in e&&"id"in t?e.id===t.id:e===t}function sE(e=oE){return x.useCallback((t,n)=>{if(typeof e=="string"){let r=e;return(t==null?void 0:t[r])===(n==null?void 0:n[r])}return e(t,n)},[e])}function iE(e){if(e===null)return{width:0,height:0};let{width:t,height:n}=e.getBoundingClientRect();return{width:t,height:n}}function aE(e,t=!1){let[n,r]=x.useReducer(()=>({}),{}),o=x.useMemo(()=>iE(e),[e,n]);return ye(()=>{if(!e)return;let s=new ResizeObserver(r);return s.observe(e),()=>{s.disconnect()}},[e]),t?{width:`${o.width}px`,height:`${o.height}px`}:o}let lp=class extends Map{constructor(t){super(),this.factory=t}get(t){let n=super.get(t);return n===void 0&&(n=this.factory(t),this.set(t,n)),n}};var cE=Object.defineProperty,uE=(e,t,n)=>t in e?cE(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,lE=(e,t,n)=>(uE(e,t+"",n),n),fp=(e,t,n)=>{if(!t.has(e))throw TypeError("Cannot "+n)},it=(e,t,n)=>(fp(e,t,"read from private field"),n?n.call(e):t.get(e)),Qa=(e,t,n)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,n)},dp=(e,t,n,r)=>(fp(e,t,"write to private field"),t.set(e,n),n),Lt,xo,Eo;let pp=class{constructor(t){Qa(this,Lt,{}),Qa(this,xo,new lp(()=>new Set)),Qa(this,Eo,new Set),lE(this,"disposables",Pt()),dp(this,Lt,t),Bt.isServer&&this.disposables.microTask(()=>{this.dispose()})}dispose(){this.disposables.dispose()}get state(){return it(this,Lt)}subscribe(t,n){if(Bt.isServer)return()=>{};let r={selector:t,callback:n,current:t(it(this,Lt))};return it(this,Eo).add(r),this.disposables.add(()=>{it(this,Eo).delete(r)})}on(t,n){return Bt.isServer?()=>{}:(it(this,xo).get(t).add(n),this.disposables.add(()=>{it(this,xo).get(t).delete(n)}))}send(t){let n=this.reduce(it(this,Lt),t);if(n!==it(this,Lt)){dp(this,Lt,n);for(let r of it(this,Eo)){let o=r.selector(it(this,Lt));hp(r.current,o)||(r.current=o,r.callback(o))}for(let r of it(this,xo).get(t.type))r(it(this,Lt),t)}}};Lt=new WeakMap,xo=new WeakMap,Eo=new WeakMap;function hp(e,t){return Object.is(e,t)?!0:typeof e!="object"||e===null||typeof t!="object"||t===null?!1:Array.isArray(e)&&Array.isArray(t)?e.length!==t.length?!1:Ja(e[Symbol.iterator](),t[Symbol.iterator]()):e instanceof Map&&t instanceof Map||e instanceof Set&&t instanceof Set?e.size!==t.size?!1:Ja(e.entries(),t.entries()):mp(e)&&mp(t)?Ja(Object.entries(e)[Symbol.iterator](),Object.entries(t)[Symbol.iterator]()):!1}function Ja(e,t){do{let n=e.next(),r=t.next();if(n.done&&r.done)return!0;if(n.done||r.done||!Object.is(n.value,r.value))return!1}while(!0)}function mp(e){if(Object.prototype.toString.call(e)!=="[object Object]")return!1;let t=Object.getPrototypeOf(e);return t===null||Object.getPrototypeOf(t)===null}function ec(e){let[t,n]=e(),r=Pt();return(...o)=>{t(...o),r.dispose(),r.microTask(n)}}var fE=Object.defineProperty,dE=(e,t,n)=>t in e?fE(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,gp=(e,t,n)=>(dE(e,typeof t!="symbol"?t+"":t,n),n),bp=(e=>(e[e.Push=0]="Push",e[e.Pop=1]="Pop",e))(bp||{});let pE={0(e,t){let n=t.id,r=e.stack,o=e.stack.indexOf(n);if(o!==-1){let s=e.stack.slice();return s.splice(o,1),s.push(n),r=s,{...e,stack:r}}return{...e,stack:[...e.stack,n]}},1(e,t){let n=t.id,r=e.stack.indexOf(n);if(r===-1)return e;let o=e.stack.slice();return o.splice(r,1),{...e,stack:o}}},hE=class X0 extends pp{constructor(){super(...arguments),gp(this,"actions",{push:t=>this.send({type:0,id:t}),pop:t=>this.send({type:1,id:t})}),gp(this,"selectors",{isTop:(t,n)=>t.stack[t.stack.length-1]===n,inStack:(t,n)=>t.stack.includes(n)})}static new(){return new X0({stack:[]})}reduce(t,n){return ot(n.type,pE,t,n)}};const tc=new lp(()=>hE.new());var nc={exports:{}},rc={};/**
|
|
119
|
+
`))}else{let p=u.props,d=p==null?void 0:p.className,h=typeof d=="function"?(...P)=>Pc(d(...P),a.className):Pc(d,a.className),m=h?{className:h}:{},x=O0(u.props,In(Tc(a,["ref"])));for(let P in f)P in x&&delete f[P];return v.cloneElement(u,Object.assign({},x,f,l,{ref:o(ux(u),l.ref)},m))}return v.createElement(s,Object.assign({},Tc(a,["ref"]),!Lo(s)&&l,!Lo(s)&&f),u)}function cx(){let e=v.useRef([]),t=v.useCallback(n=>{for(let r of e.current)r!=null&&(typeof r=="function"?r(n):r.current=n)},[]);return(...n)=>{if(!n.every(r=>r==null))return e.current=n,t}}function lx(...e){return e.every(t=>t==null)?void 0:t=>{for(let n of e)n!=null&&(typeof n=="function"?n(t):n.current=t)}}function O0(...e){if(e.length===0)return{};if(e.length===1)return e[0];let t={},n={};for(let r of e)for(let o in r)o.startsWith("on")&&typeof r[o]=="function"?(n[o]!=null||(n[o]=[]),n[o].push(r[o])):t[o]=r[o];if(t.disabled||t["aria-disabled"])for(let r in n)/^(on(?:Click|Pointer|Mouse|Key)(?:Down|Up|Press)?)$/.test(r)&&(n[r]=[o=>{var s;return(s=o==null?void 0:o.preventDefault)==null?void 0:s.call(o)}]);for(let r in n)Object.assign(t,{[r](o,...s){let i=n[r];for(let c of i){if((o instanceof Event||(o==null?void 0:o.nativeEvent)instanceof Event)&&o.defaultPrevented)return;c(o,...s)}}});return t}function I0(...e){if(e.length===0)return{};if(e.length===1)return e[0];let t={},n={};for(let r of e)for(let o in r)o.startsWith("on")&&typeof r[o]=="function"?(n[o]!=null||(n[o]=[]),n[o].push(r[o])):t[o]=r[o];for(let r in n)Object.assign(t,{[r](...o){let s=n[r];for(let i of s)i==null||i(...o)}});return t}function Ke(e){var t;return Object.assign(v.forwardRef(e),{displayName:(t=e.displayName)!=null?t:e.name})}function In(e){let t=Object.assign({},e);for(let n in t)t[n]===void 0&&delete t[n];return t}function Tc(e,t=[]){let n=Object.assign({},e);for(let r of t)r in n&&delete n[r];return n}function ux(e){return v.version.split(".")[0]>="19"?e.props.ref:e.ref}function Lo(e){return e===v.Fragment||e===Symbol.for("react.fragment")}function fx(e){return Lo(e.type)}function dx(e,t,n){let[r,o]=v.useState(n),s=e!==void 0,i=v.useRef(s),c=v.useRef(!1),a=v.useRef(!1);return s&&!i.current&&!c.current?(c.current=!0,i.current=s,console.error("A component is changing from uncontrolled to controlled. This may be caused by the value changing from undefined to a defined value, which should not happen.")):!s&&i.current&&!a.current&&(a.current=!0,i.current=s,console.error("A component is changing from controlled to uncontrolled. This may be caused by the value changing from a defined value to undefined, which should not happen.")),[s?e:r,me(l=>(s||Ue.flushSync(()=>o(l)),t==null?void 0:t(l)))]}function px(e){let[t]=v.useState(e);return t}function $0(e={},t=null,n=[]){for(let[r,o]of Object.entries(e))D0(n,k0(t,r),o);return n}function k0(e,t){return e?e+"["+t+"]":t}function D0(e,t,n){if(Array.isArray(n))for(let[r,o]of n.entries())D0(e,k0(t,r.toString()),o);else n instanceof Date?e.push([t,n.toISOString()]):typeof n=="boolean"?e.push([t,n?"1":"0"]):typeof n=="string"?e.push([t,n]):typeof n=="number"?e.push([t,`${n}`]):n==null?e.push([t,""]):mx(n)&&!v.isValidElement(n)&&$0(n,t,e)}function hx(e){var t,n;let r=(t=e==null?void 0:e.form)!=null?t:e.closest("form");if(r){for(let o of r.elements)if(o!==e&&(o.tagName==="INPUT"&&o.type==="submit"||o.tagName==="BUTTON"&&o.type==="submit"||o.nodeName==="INPUT"&&o.type==="image")){o.click();return}(n=r.requestSubmit)==null||n.call(r)}}function mx(e){if(Object.prototype.toString.call(e)!=="[object Object]")return!1;let t=Object.getPrototypeOf(e);return t===null||Object.getPrototypeOf(t)===null}let bx="span";var Ac=(e=>(e[e.None=1]="None",e[e.Focusable=2]="Focusable",e[e.Hidden=4]="Hidden",e))(Ac||{});function gx(e,t){var n;let{features:r=1,...o}=e,s={ref:t,"aria-hidden":(r&2)===2?!0:(n=o["aria-hidden"])!=null?n:void 0,hidden:(r&4)===4?!0:void 0,style:{position:"fixed",top:1,left:1,width:1,height:0,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0",...(r&4)===4&&(r&2)!==2&&{display:"none"}}};return at()({ourProps:s,theirProps:o,slot:{},defaultTag:bx,name:"Hidden"})}let M0=Ke(gx),yx=v.createContext(null);function vx({children:e}){let t=v.useContext(yx);if(!t)return v.createElement(v.Fragment,null,e);let{target:n}=t;return n?Ue.createPortal(v.createElement(v.Fragment,null,e),n):null}function wx({data:e,form:t,disabled:n,onReset:r,overrides:o}){let[s,i]=v.useState(null),c=Yn();return v.useEffect(()=>{if(r&&s)return c.addEventListener(s,"reset",r)},[s,t,r]),v.createElement(vx,null,v.createElement(xx,{setForm:i,formId:t}),$0(e).map(([a,l])=>v.createElement(M0,{features:Ac.Hidden,...In({key:a,as:"input",type:"hidden",hidden:!0,readOnly:!0,form:t,disabled:n,name:a,value:l,...o})})))}function xx({setForm:e,formId:t}){return v.useEffect(()=>{if(t){let n=document.getElementById(t);n&&e(n)}},[e,t]),t?null:v.createElement(M0,{features:Ac.Hidden,as:"input",type:"hidden",hidden:!0,readOnly:!0,ref:n=>{if(!n)return;let r=n.closest("form");r&&e(r)}})}let Ex=v.createContext(void 0);function B0(){return v.useContext(Ex)}function L0(e){return typeof e!="object"||e===null?!1:"nodeType"in e}function Ws(e){return L0(e)&&"tagName"in e}function fn(e){return Ws(e)&&"accessKey"in e}function Cr(e){return Ws(e)&&"tabIndex"in e}function Sx(e){return Ws(e)&&"style"in e}function Px(e){return fn(e)&&e.nodeName==="IFRAME"}function F0(e){return fn(e)&&e.nodeName==="INPUT"}function R0(e){return fn(e)&&e.nodeName==="LABEL"}function Tx(e){return fn(e)&&e.nodeName==="FIELDSET"}function j0(e){return fn(e)&&e.nodeName==="LEGEND"}function Ax(e){return Ws(e)?e.matches('a[href],audio[controls],button,details,embed,iframe,img[usemap],input:not([type="hidden"]),label,select,textarea,video[controls]'):!1}function z0(e){let t=e.parentElement,n=null;for(;t&&!Tx(t);)j0(t)&&(n=t),t=t.parentElement;let r=(t==null?void 0:t.getAttribute("disabled"))==="";return r&&Nx(n)?!1:r}function Nx(e){if(!e)return!1;let t=e.previousElementSibling;for(;t!==null;){if(j0(t))return!1;t=t.previousElementSibling}return!0}let U0=Symbol();function Cx(e,t=!0){return Object.assign(e,{[U0]:t})}function gt(...e){let t=v.useRef(e);v.useEffect(()=>{t.current=e},[e]);let n=me(r=>{for(let o of t.current)o!=null&&(typeof o=="function"?o(r):o.current=r)});return e.every(r=>r==null||(r==null?void 0:r[U0]))?void 0:n}let Nc=v.createContext(null);Nc.displayName="DescriptionContext";function _0(){let e=v.useContext(Nc);if(e===null){let t=new Error("You used a <Description /> component, but it is not inside a relevant parent.");throw Error.captureStackTrace&&Error.captureStackTrace(t,_0),t}return e}function Ox(){var e,t;return(t=(e=v.useContext(Nc))==null?void 0:e.value)!=null?t:void 0}let Ix="p";function $x(e,t){let n=v.useId(),r=Sc(),{id:o=`headlessui-description-${n}`,...s}=e,i=_0(),c=gt(t);Te(()=>i.register(o),[o,i.register]);let a=Cn({...i.slot,disabled:r||!1}),l={ref:c,...i.props,id:o};return at()({ourProps:l,theirProps:s,slot:a,defaultTag:Ix,name:i.name||"Description"})}let kx=Ke($x);Object.assign(kx,{});var ke=(e=>(e.Space=" ",e.Enter="Enter",e.Escape="Escape",e.Backspace="Backspace",e.Delete="Delete",e.ArrowLeft="ArrowLeft",e.ArrowUp="ArrowUp",e.ArrowRight="ArrowRight",e.ArrowDown="ArrowDown",e.Home="Home",e.End="End",e.PageUp="PageUp",e.PageDown="PageDown",e.Tab="Tab",e))(ke||{});let Vs=v.createContext(null);Vs.displayName="LabelContext";function W0(){let e=v.useContext(Vs);if(e===null){let t=new Error("You used a <Label /> component, but it is not inside a relevant parent.");throw Error.captureStackTrace&&Error.captureStackTrace(t,W0),t}return e}function V0(e){var t,n,r;let o=(n=(t=v.useContext(Vs))==null?void 0:t.value)!=null?n:void 0;return((r=e==null?void 0:e.length)!=null?r:0)>0?[o,...e].filter(Boolean).join(" "):o}function Dx({inherit:e=!1}={}){let t=V0(),[n,r]=v.useState([]),o=e?[t,...n].filter(Boolean):n;return[o.length>0?o.join(" "):void 0,v.useMemo(()=>function(s){let i=me(a=>(r(l=>[...l,a]),()=>r(l=>{let u=l.slice(),f=u.indexOf(a);return f!==-1&&u.splice(f,1),u}))),c=v.useMemo(()=>({register:i,slot:s.slot,name:s.name,props:s.props,value:s.value}),[i,s.slot,s.name,s.props,s.value]);return v.createElement(Vs.Provider,{value:c},s.children)},[r])]}let Mx="label";function Bx(e,t){var n;let r=v.useId(),o=W0(),s=B0(),i=Sc(),{id:c=`headlessui-label-${r}`,htmlFor:a=s??((n=o.props)==null?void 0:n.htmlFor),passive:l=!1,...u}=e,f=gt(t);Te(()=>o.register(c),[c,o.register]);let p=me(m=>{let x=m.currentTarget;if(!(m.target!==m.currentTarget&&Ax(m.target))&&(R0(x)&&m.preventDefault(),o.props&&"onClick"in o.props&&typeof o.props.onClick=="function"&&o.props.onClick(m),R0(x))){let P=document.getElementById(x.htmlFor);if(P){let E=P.getAttribute("disabled");if(E==="true"||E==="")return;let T=P.getAttribute("aria-disabled");if(T==="true"||T==="")return;(F0(P)&&(P.type==="file"||P.type==="radio"||P.type==="checkbox")||P.role==="radio"||P.role==="checkbox"||P.role==="switch")&&P.click(),P.focus({preventScroll:!0})}}}),d=Cn({...o.slot,disabled:i||!1}),h={ref:f,...o.props,id:c,htmlFor:a,onClick:p};return l&&("onClick"in h&&(delete h.htmlFor,delete h.onClick),"onClick"in u&&delete u.onClick),at()({ourProps:h,theirProps:u,slot:d,defaultTag:a?Mx:"div",name:o.name||"Label"})}let Lx=Ke(Bx),Fx=Object.assign(Lx,{});function Rx(e,t){return e!==null&&t!==null&&typeof e=="object"&&typeof t=="object"&&"id"in e&&"id"in t?e.id===t.id:e===t}function jx(e=Rx){return v.useCallback((t,n)=>{if(typeof e=="string"){let r=e;return(t==null?void 0:t[r])===(n==null?void 0:n[r])}return e(t,n)},[e])}function H0(e){if(e===null)return{width:0,height:0};let{width:t,height:n}=e.getBoundingClientRect();return{width:t,height:n}}function zx(e,t,n=!1){let[r,o]=v.useState(()=>H0(t));return Te(()=>{if(!t||!e)return;let s=it();return s.requestAnimationFrame(function i(){s.requestAnimationFrame(i),o(c=>{let a=H0(t);return a.width===c.width&&a.height===c.height?c:a})}),()=>{s.dispose()}},[t,e]),n?{width:`${r.width}px`,height:`${r.height}px`}:r}var G0=(e=>(e[e.Left=0]="Left",e[e.Right=2]="Right",e))(G0||{});function Ux(e){let t=v.useRef(null),n=me(o=>{t.current=o.pointerType,!z0(o.currentTarget)&&o.pointerType==="mouse"&&o.button===G0.Left&&(o.preventDefault(),e(o))}),r=me(o=>{t.current!=="mouse"&&(z0(o.currentTarget)||e(o))});return{onPointerDown:n,onClick:r}}let q0=class extends Map{constructor(t){super(),this.factory=t}get(t){let n=super.get(t);return n===void 0&&(n=this.factory(t),this.set(t,n)),n}};var _x=Object.defineProperty,Wx=(e,t,n)=>t in e?_x(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Vx=(e,t,n)=>(Wx(e,t+"",n),n),K0=(e,t,n)=>{if(!t.has(e))throw TypeError("Cannot "+n)},yt=(e,t,n)=>(K0(e,t,"read from private field"),n?n.call(e):t.get(e)),Cc=(e,t,n)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,n)},Z0=(e,t,n,r)=>(K0(e,t,"write to private field"),t.set(e,n),n),Wt,Fo,Ro;let Y0=class{constructor(t){Cc(this,Wt,{}),Cc(this,Fo,new q0(()=>new Set)),Cc(this,Ro,new Set),Vx(this,"disposables",it()),Z0(this,Wt,t),_t.isServer&&this.disposables.microTask(()=>{this.dispose()})}dispose(){this.disposables.dispose()}get state(){return yt(this,Wt)}subscribe(t,n){if(_t.isServer)return()=>{};let r={selector:t,callback:n,current:t(yt(this,Wt))};return yt(this,Ro).add(r),this.disposables.add(()=>{yt(this,Ro).delete(r)})}on(t,n){return _t.isServer?()=>{}:(yt(this,Fo).get(t).add(n),this.disposables.add(()=>{yt(this,Fo).get(t).delete(n)}))}send(t){let n=this.reduce(yt(this,Wt),t);if(n!==yt(this,Wt)){Z0(this,Wt,n);for(let r of yt(this,Ro)){let o=r.selector(yt(this,Wt));X0(r.current,o)||(r.current=o,r.callback(o))}for(let r of yt(this,Fo).get(t.type))r(yt(this,Wt),t)}}};Wt=new WeakMap,Fo=new WeakMap,Ro=new WeakMap;function X0(e,t){return Object.is(e,t)?!0:typeof e!="object"||e===null||typeof t!="object"||t===null?!1:Array.isArray(e)&&Array.isArray(t)?e.length!==t.length?!1:Oc(e[Symbol.iterator](),t[Symbol.iterator]()):e instanceof Map&&t instanceof Map||e instanceof Set&&t instanceof Set?e.size!==t.size?!1:Oc(e.entries(),t.entries()):J0(e)&&J0(t)?Oc(Object.entries(e)[Symbol.iterator](),Object.entries(t)[Symbol.iterator]()):!1}function Oc(e,t){do{let n=e.next(),r=t.next();if(n.done&&r.done)return!0;if(n.done||r.done||!Object.is(n.value,r.value))return!1}while(!0)}function J0(e){if(Object.prototype.toString.call(e)!=="[object Object]")return!1;let t=Object.getPrototypeOf(e);return t===null||Object.getPrototypeOf(t)===null}function Ic(e){let[t,n]=e(),r=it();return(...o)=>{t(...o),r.dispose(),r.microTask(n)}}var Hx=Object.defineProperty,Gx=(e,t,n)=>t in e?Hx(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Q0=(e,t,n)=>(Gx(e,typeof t!="symbol"?t+"":t,n),n),ep=(e=>(e[e.Push=0]="Push",e[e.Pop=1]="Pop",e))(ep||{});let qx={0(e,t){let n=t.id,r=e.stack,o=e.stack.indexOf(n);if(o!==-1){let s=e.stack.slice();return s.splice(o,1),s.push(n),r=s,{...e,stack:r}}return{...e,stack:[...e.stack,n]}},1(e,t){let n=t.id,r=e.stack.indexOf(n);if(r===-1)return e;let o=e.stack.slice();return o.splice(r,1),{...e,stack:o}}},Kx=class jm extends Y0{constructor(){super(...arguments),Q0(this,"actions",{push:t=>this.send({type:0,id:t}),pop:t=>this.send({type:1,id:t})}),Q0(this,"selectors",{isTop:(t,n)=>t.stack[t.stack.length-1]===n,inStack:(t,n)=>t.stack.includes(n)})}static new(){return new jm({stack:[]})}reduce(t,n){return bt(n.type,qx,t,n)}};const $c=new q0(()=>Kx.new());var kc={exports:{}},Dc={};/**
|
|
111
120
|
* @license React
|
|
112
121
|
* use-sync-external-store-with-selector.production.js
|
|
113
122
|
*
|
|
@@ -115,7 +124,7 @@ ${Eb(d)}`),super(t.shortMessage,{cause:t,docsPath:r,metaMessages:[...t.metaMessa
|
|
|
115
124
|
*
|
|
116
125
|
* This source code is licensed under the MIT license found in the
|
|
117
126
|
* LICENSE file in the root directory of this source tree.
|
|
118
|
-
*/var
|
|
127
|
+
*/var tp;function Zx(){if(tp)return Dc;tp=1;var e=v;function t(a,l){return a===l&&(a!==0||1/a===1/l)||a!==a&&l!==l}var n=typeof Object.is=="function"?Object.is:t,r=e.useSyncExternalStore,o=e.useRef,s=e.useEffect,i=e.useMemo,c=e.useDebugValue;return Dc.useSyncExternalStoreWithSelector=function(a,l,u,f,p){var d=o(null);if(d.current===null){var h={hasValue:!1,value:null};d.current=h}else h=d.current;d=i(function(){function x(M){if(!P){if(P=!0,E=M,M=f(M),p!==void 0&&h.hasValue){var F=h.value;if(p(F,M))return T=F}return T=M}if(F=T,n(E,M))return F;var L=f(M);return p!==void 0&&p(F,L)?(E=M,F):(E=M,T=L)}var P=!1,E,T,N=u===void 0?null:u;return[function(){return x(l())},N===null?void 0:function(){return x(N())}]},[l,u,f,p]);var m=r(a,d[0],d[1]);return s(function(){h.hasValue=!0,h.value=m},[m]),c(m),m},Dc}var Mc={};/**
|
|
119
128
|
* @license React
|
|
120
129
|
* use-sync-external-store-with-selector.development.js
|
|
121
130
|
*
|
|
@@ -123,49 +132,49 @@ ${Eb(d)}`),super(t.shortMessage,{cause:t,docsPath:r,metaMessages:[...t.metaMessa
|
|
|
123
132
|
*
|
|
124
133
|
* This source code is licensed under the MIT license found in the
|
|
125
134
|
* LICENSE file in the root directory of this source tree.
|
|
126
|
-
*/var wp;function gE(){return wp||(wp=1,process.env.NODE_ENV!=="production"&&function(){function e(a,u){return a===u&&(a!==0||1/a===1/u)||a!==a&&u!==u}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var t=x,n=typeof Object.is=="function"?Object.is:e,r=t.useSyncExternalStore,o=t.useRef,s=t.useEffect,i=t.useMemo,c=t.useDebugValue;oc.useSyncExternalStoreWithSelector=function(a,u,l,f,p){var d=o(null);if(d.current===null){var h={hasValue:!1,value:null};d.current=h}else h=d.current;d=i(function(){function v(F){if(!A){if(A=!0,w=F,F=f(F),p!==void 0&&h.hasValue){var R=h.value;if(p(R,F))return T=R}return T=F}if(R=T,n(w,F))return R;var j=f(F);return p!==void 0&&p(R,j)?(w=F,R):(w=F,T=j)}var A=!1,w,T,B=l===void 0?null:l;return[function(){return v(u())},B===null?void 0:function(){return v(B())}]},[u,l,f,p]);var m=r(a,d[0],d[1]);return s(function(){h.hasValue=!0,h.value=m},[m]),c(m),m},typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())}()),oc}process.env.NODE_ENV==="production"?nc.exports=mE():nc.exports=gE();var bE=nc.exports;function at(e,t,n=hp){return bE.useSyncExternalStoreWithSelector(ce(r=>e.subscribe(yE,r)),ce(()=>e.state),ce(()=>e.state),ce(t),n)}function yE(e){return e}function vp(e,t){let n=x.useId(),r=tc.get(t),[o,s]=at(r,x.useCallback(i=>[r.selectors.isTop(i,n),r.selectors.inStack(i,n)],[r,n]));return ye(()=>{if(e)return r.actions.push(n),()=>r.actions.pop(n)},[r,e,n]),e?s?o:!0:!1}let sc=new Map,So=new Map;function xp(e){var t;let n=(t=So.get(e))!=null?t:0;return So.set(e,n+1),n!==0?()=>Ep(e):(sc.set(e,{"aria-hidden":e.getAttribute("aria-hidden"),inert:e.inert}),e.setAttribute("aria-hidden","true"),e.inert=!0,()=>Ep(e))}function Ep(e){var t;let n=(t=So.get(e))!=null?t:1;if(n===1?So.delete(e):So.set(e,n-1),n!==1)return;let r=sc.get(e);r&&(r["aria-hidden"]===null?e.removeAttribute("aria-hidden"):e.setAttribute("aria-hidden",r["aria-hidden"]),e.inert=r.inert,sc.delete(e))}function wE(e,{allowed:t,disallowed:n}={}){let r=vp(e,"inert-others");ye(()=>{var o,s;if(!r)return;let i=Pt();for(let a of(o=n==null?void 0:n())!=null?o:[])a&&i.add(xp(a));let c=(s=t==null?void 0:t())!=null?s:[];for(let a of c){if(!a)continue;let u=vo(a);if(!u)continue;let l=a.parentElement;for(;l&&l!==u.body;){for(let f of l.children)c.some(p=>f.contains(p))||i.add(xp(f));l=l.parentElement}}return i.dispose},[r,t,n])}function vE(e,t,n){let r=zn(o=>{let s=o.getBoundingClientRect();s.x===0&&s.y===0&&s.width===0&&s.height===0&&n()});x.useEffect(()=>{if(!e)return;let o=t===null?null:rn(t)?t:t.current;if(!o)return;let s=Pt();if(typeof ResizeObserver<"u"){let i=new ResizeObserver(()=>r.current(o));i.observe(o),s.add(()=>i.disconnect())}if(typeof IntersectionObserver<"u"){let i=new IntersectionObserver(()=>r.current(o));i.observe(o),s.add(()=>i.disconnect())}return()=>s.dispose()},[t,r,e])}let ic=["[contentEditable=true]","[tabindex]","a[href]","area[href]","button:not([disabled])","iframe","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].map(e=>`${e}:not([tabindex='-1'])`).join(","),xE=["[data-autofocus]"].map(e=>`${e}:not([tabindex='-1'])`).join(",");var ac=(e=>(e[e.First=1]="First",e[e.Previous=2]="Previous",e[e.Next=4]="Next",e[e.Last=8]="Last",e[e.WrapAround=16]="WrapAround",e[e.NoScroll=32]="NoScroll",e[e.AutoFocus=64]="AutoFocus",e))(ac||{}),EE=(e=>(e[e.Error=0]="Error",e[e.Overflow=1]="Overflow",e[e.Success=2]="Success",e[e.Underflow=3]="Underflow",e))(EE||{}),SE=(e=>(e[e.Previous=-1]="Previous",e[e.Next=1]="Next",e))(SE||{});function Sp(e=document.body){return e==null?[]:Array.from(e.querySelectorAll(ic)).sort((t,n)=>Math.sign((t.tabIndex||Number.MAX_SAFE_INTEGER)-(n.tabIndex||Number.MAX_SAFE_INTEGER)))}function PE(e=document.body){return e==null?[]:Array.from(e.querySelectorAll(xE)).sort((t,n)=>Math.sign((t.tabIndex||Number.MAX_SAFE_INTEGER)-(n.tabIndex||Number.MAX_SAFE_INTEGER)))}var cc=(e=>(e[e.Strict=0]="Strict",e[e.Loose=1]="Loose",e))(cc||{});function Pp(e,t=0){var n;return e===((n=vo(e))==null?void 0:n.body)?!1:ot(t,{0(){return e.matches(ic)},1(){let r=e;for(;r!==null;){if(r.matches(ic))return!0;r=r.parentElement}return!1}})}var $E=(e=>(e[e.Keyboard=0]="Keyboard",e[e.Mouse=1]="Mouse",e))($E||{});typeof window<"u"&&typeof document<"u"&&(document.addEventListener("keydown",e=>{e.metaKey||e.altKey||e.ctrlKey||(document.documentElement.dataset.headlessuiFocusVisible="")},!0),document.addEventListener("click",e=>{e.detail===1?delete document.documentElement.dataset.headlessuiFocusVisible:e.detail===0&&(document.documentElement.dataset.headlessuiFocusVisible="")},!0));let TE=["textarea","input"].join(",");function AE(e){var t,n;return(n=(t=e==null?void 0:e.matches)==null?void 0:t.call(e,TE))!=null?n:!1}function $p(e,t=n=>n){return e.slice().sort((n,r)=>{let o=t(n),s=t(r);if(o===null||s===null)return 0;let i=o.compareDocumentPosition(s);return i&Node.DOCUMENT_POSITION_FOLLOWING?-1:i&Node.DOCUMENT_POSITION_PRECEDING?1:0})}function OE(e,t){return CE(Sp(),t,{relativeTo:e})}function CE(e,t,{sorted:n=!0,relativeTo:r=null,skipElements:o=[]}={}){let s=Array.isArray(e)?e.length>0?e[0].ownerDocument:document:e.ownerDocument,i=Array.isArray(e)?n?$p(e):e:t&64?PE(e):Sp(e);o.length>0&&i.length>1&&(i=i.filter(d=>!o.some(h=>h!=null&&"current"in h?(h==null?void 0:h.current)===d:h===d))),r=r??s.activeElement;let c=(()=>{if(t&5)return 1;if(t&10)return-1;throw new Error("Missing Focus.First, Focus.Previous, Focus.Next or Focus.Last")})(),a=(()=>{if(t&1)return 0;if(t&2)return Math.max(0,i.indexOf(r))-1;if(t&4)return Math.max(0,i.indexOf(r))+1;if(t&8)return i.length-1;throw new Error("Missing Focus.First, Focus.Previous, Focus.Next or Focus.Last")})(),u=t&32?{preventScroll:!0}:{},l=0,f=i.length,p;do{if(l>=f||l+f<=0)return 0;let d=a+l;if(t&16)d=(d+f)%f;else{if(d<0)return 3;if(d>=f)return 1}p=i[d],p==null||p.focus(u),l+=c}while(p!==s.activeElement);return t&6&&AE(p)&&p.select(),2}function Tp(){return/iPhone/gi.test(window.navigator.platform)||/Mac/gi.test(window.navigator.platform)&&window.navigator.maxTouchPoints>0}function NE(){return/Android/gi.test(window.navigator.userAgent)}function Ap(){return Tp()||NE()}function wr(e,t,n,r){let o=zn(n);x.useEffect(()=>{if(!e)return;function s(i){o.current(i)}return document.addEventListener(t,s,r),()=>document.removeEventListener(t,s,r)},[e,t,r])}function IE(e,t,n,r){let o=zn(n);x.useEffect(()=>{if(!e)return;function s(i){o.current(i)}return window.addEventListener(t,s,r),()=>window.removeEventListener(t,s,r)},[e,t,r])}const Op=30;function ME(e,t,n){let r=zn(n),o=x.useCallback(function(c,a){if(c.defaultPrevented)return;let u=a(c);if(u===null||!u.getRootNode().contains(u)||!u.isConnected)return;let l=function f(p){return typeof p=="function"?f(p()):Array.isArray(p)||p instanceof Set?p:[p]}(t);for(let f of l)if(f!==null&&(f.contains(u)||c.composed&&c.composedPath().includes(f)))return;return!Pp(u,cc.Loose)&&u.tabIndex!==-1&&c.preventDefault(),r.current(c,u)},[r,t]),s=x.useRef(null);wr(e,"pointerdown",c=>{var a,u;Ap()||(s.current=((u=(a=c.composedPath)==null?void 0:a.call(c))==null?void 0:u[0])||c.target)},!0),wr(e,"pointerup",c=>{if(Ap()||!s.current)return;let a=s.current;return s.current=null,o(c,()=>a)},!0);let i=x.useRef({x:0,y:0});wr(e,"touchstart",c=>{i.current.x=c.touches[0].clientX,i.current.y=c.touches[0].clientY},!0),wr(e,"touchend",c=>{let a={x:c.changedTouches[0].clientX,y:c.changedTouches[0].clientY};if(!(Math.abs(a.x-i.current.x)>=Op||Math.abs(a.y-i.current.y)>=Op))return o(c,()=>yr(c.target)?c.target:null)},!0),IE(e,"blur",c=>o(c,()=>Hx(window.document.activeElement)?window.document.activeElement:null),!0)}function uc(...e){return x.useMemo(()=>vo(...e),[...e])}var kE=(e=>(e[e.Ignore=0]="Ignore",e[e.Select=1]="Select",e[e.Close=2]="Close",e))(kE||{});const Ps={Ignore:{kind:0},Select:e=>({kind:1,target:e}),Close:{kind:2}},BE=200,Cp=5;function LE(e,{trigger:t,action:n,close:r,select:o}){let s=x.useRef(null),i=x.useRef(null),c=x.useRef(null);wr(e&&t!==null,"pointerdown",a=>{Ya(a==null?void 0:a.target)&&t!=null&&t.contains(a.target)&&(i.current=a.x,c.current=a.y,s.current=a.timeStamp)}),wr(e&&t!==null,"pointerup",a=>{var u,l;let f=s.current;if(f===null||(s.current=null,!yr(a.target))||Math.abs(a.x-((u=i.current)!=null?u:a.x))<Cp&&Math.abs(a.y-((l=c.current)!=null?l:a.y))<Cp)return;let p=n(a);switch(p.kind){case 0:return;case 1:{a.timeStamp-f>BE&&(o(p.target),r());break}case 2:{r();break}}},{capture:!0})}function FE(e,t){return x.useMemo(()=>{var n;if(e.type)return e.type;let r=(n=e.as)!=null?n:"button";if(typeof r=="string"&&r.toLowerCase()==="button"||(t==null?void 0:t.tagName)==="BUTTON"&&!t.hasAttribute("type"))return"button"},[e.type,e.as,t])}function DE(e){return x.useSyncExternalStore(e.subscribe,e.getSnapshot,e.getSnapshot)}function RE(e,t){let n=e(),r=new Set;return{getSnapshot(){return n},subscribe(o){return r.add(o),()=>r.delete(o)},dispatch(o,...s){let i=t[o].call(n,...s);i&&(n=i,r.forEach(c=>c()))}}}function jE(){let e;return{before({doc:t}){var n;let r=t.documentElement,o=(n=t.defaultView)!=null?n:window;e=Math.max(0,o.innerWidth-r.clientWidth)},after({doc:t,d:n}){let r=t.documentElement,o=Math.max(0,r.clientWidth-r.offsetWidth),s=Math.max(0,e-o);n.style(r,"paddingRight",`${s}px`)}}}function _E(){return Tp()?{before({doc:e,d:t,meta:n}){function r(o){return n.containers.flatMap(s=>s()).some(s=>s.contains(o))}t.microTask(()=>{var o;if(window.getComputedStyle(e.documentElement).scrollBehavior!=="auto"){let c=Pt();c.style(e.documentElement,"scrollBehavior","auto"),t.add(()=>t.microTask(()=>c.dispose()))}let s=(o=window.scrollY)!=null?o:window.pageYOffset,i=null;t.addEventListener(e,"click",c=>{if(yr(c.target))try{let a=c.target.closest("a");if(!a)return;let{hash:u}=new URL(a.href),l=e.querySelector(u);yr(l)&&!r(l)&&(i=l)}catch{}},!0),t.addEventListener(e,"touchstart",c=>{if(yr(c.target)&&zx(c.target))if(r(c.target)){let a=c.target;for(;a.parentElement&&r(a.parentElement);)a=a.parentElement;t.style(a,"overscrollBehavior","contain")}else t.style(c.target,"touchAction","none")}),t.addEventListener(e,"touchmove",c=>{if(yr(c.target)){if(rp(c.target))return;if(r(c.target)){let a=c.target;for(;a.parentElement&&a.dataset.headlessuiPortal!==""&&!(a.scrollHeight>a.clientHeight||a.scrollWidth>a.clientWidth);)a=a.parentElement;a.dataset.headlessuiPortal===""&&c.preventDefault()}else c.preventDefault()}},{passive:!1}),t.add(()=>{var c;let a=(c=window.scrollY)!=null?c:window.pageYOffset;s!==a&&window.scrollTo(0,s),i&&i.isConnected&&(i.scrollIntoView({block:"nearest"}),i=null)})})}}:{}}function UE(){return{before({doc:e,d:t}){t.style(e.documentElement,"overflow","hidden")}}}function zE(e){let t={};for(let n of e)Object.assign(t,n(t));return t}let Hn=RE(()=>new Map,{PUSH(e,t){var n;let r=(n=this.get(e))!=null?n:{doc:e,count:0,d:Pt(),meta:new Set};return r.count++,r.meta.add(t),this.set(e,r),this},POP(e,t){let n=this.get(e);return n&&(n.count--,n.meta.delete(t)),this},SCROLL_PREVENT({doc:e,d:t,meta:n}){let r={doc:e,d:t,meta:zE(n)},o=[_E(),jE(),UE()];o.forEach(({before:s})=>s==null?void 0:s(r)),o.forEach(({after:s})=>s==null?void 0:s(r))},SCROLL_ALLOW({d:e}){e.dispose()},TEARDOWN({doc:e}){this.delete(e)}});Hn.subscribe(()=>{let e=Hn.getSnapshot(),t=new Map;for(let[n]of e)t.set(n,n.documentElement.style.overflow);for(let n of e.values()){let r=t.get(n.doc)==="hidden",o=n.count!==0;(o&&!r||!o&&r)&&Hn.dispatch(n.count>0?"SCROLL_PREVENT":"SCROLL_ALLOW",n),n.count===0&&Hn.dispatch("TEARDOWN",n)}});function HE(e,t,n=()=>({containers:[]})){let r=DE(Hn),o=t?r.get(t):void 0,s=o?o.count>0:!1;return ye(()=>{if(!(!t||!e))return Hn.dispatch("PUSH",t,n),()=>Hn.dispatch("POP",t,n)},[e,t]),s}function WE(e,t,n=()=>[document.body]){let r=vp(e,"scroll-lock");HE(r,t,o=>{var s;return{containers:[...(s=o.containers)!=null?s:[],n]}})}function Np(e){return[e.screenX,e.screenY]}function VE(){let e=x.useRef([-1,-1]);return{wasMoved(t){let n=Np(t);return e.current[0]===n[0]&&e.current[1]===n[1]?!1:(e.current=n,!0)},update(t){e.current=Np(t)}}}function GE(e=0){let[t,n]=x.useState(e),r=x.useCallback(a=>n(a),[t]),o=x.useCallback(a=>n(u=>u|a),[t]),s=x.useCallback(a=>(t&a)===a,[t]),i=x.useCallback(a=>n(u=>u&~a),[n]),c=x.useCallback(a=>n(u=>u^a),[n]);return{flags:t,setFlag:r,addFlag:o,hasFlag:s,removeFlag:i,toggleFlag:c}}var Ip,Mp;typeof process<"u"&&typeof globalThis<"u"&&typeof Element<"u"&&((Ip=process==null?void 0:process.env)==null?void 0:Ip.NODE_ENV)==="test"&&typeof((Mp=Element==null?void 0:Element.prototype)==null?void 0:Mp.getAnimations)>"u"&&(Element.prototype.getAnimations=function(){return console.warn(["Headless UI has polyfilled `Element.prototype.getAnimations` for your tests.","Please install a proper polyfill e.g. `jsdom-testing-mocks`, to silence these warnings.","","Example usage:","```js","import { mockAnimationsApi } from 'jsdom-testing-mocks'","mockAnimationsApi()","```"].join(`
|
|
127
|
-
`)),[]});var
|
|
128
|
-
* tabbable 6.
|
|
135
|
+
*/var np;function Yx(){return np||(np=1,process.env.NODE_ENV!=="production"&&function(){function e(a,l){return a===l&&(a!==0||1/a===1/l)||a!==a&&l!==l}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var t=v,n=typeof Object.is=="function"?Object.is:e,r=t.useSyncExternalStore,o=t.useRef,s=t.useEffect,i=t.useMemo,c=t.useDebugValue;Mc.useSyncExternalStoreWithSelector=function(a,l,u,f,p){var d=o(null);if(d.current===null){var h={hasValue:!1,value:null};d.current=h}else h=d.current;d=i(function(){function x(M){if(!P){if(P=!0,E=M,M=f(M),p!==void 0&&h.hasValue){var F=h.value;if(p(F,M))return T=F}return T=M}if(F=T,n(E,M))return F;var L=f(M);return p!==void 0&&p(F,L)?(E=M,F):(E=M,T=L)}var P=!1,E,T,N=u===void 0?null:u;return[function(){return x(l())},N===null?void 0:function(){return x(N())}]},[l,u,f,p]);var m=r(a,d[0],d[1]);return s(function(){h.hasValue=!0,h.value=m},[m]),c(m),m},typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())}()),Mc}process.env.NODE_ENV==="production"?kc.exports=Zx():kc.exports=Yx();var Xx=kc.exports;function Ze(e,t,n=X0){return Xx.useSyncExternalStoreWithSelector(me(r=>e.subscribe(Jx,r)),me(()=>e.state),me(()=>e.state),me(t),n)}function Jx(e){return e}function rp(e,t){let n=v.useId(),r=$c.get(t),[o,s]=Ze(r,v.useCallback(i=>[r.selectors.isTop(i,n),r.selectors.inStack(i,n)],[r,n]));return Te(()=>{if(e)return r.actions.push(n),()=>r.actions.pop(n)},[r,e,n]),e?s?o:!0:!1}let Bc=new Map,jo=new Map;function op(e){var t;let n=(t=jo.get(e))!=null?t:0;return jo.set(e,n+1),n!==0?()=>sp(e):(Bc.set(e,{"aria-hidden":e.getAttribute("aria-hidden"),inert:e.inert}),e.setAttribute("aria-hidden","true"),e.inert=!0,()=>sp(e))}function sp(e){var t;let n=(t=jo.get(e))!=null?t:1;if(n===1?jo.delete(e):jo.set(e,n-1),n!==1)return;let r=Bc.get(e);r&&(r["aria-hidden"]===null?e.removeAttribute("aria-hidden"):e.setAttribute("aria-hidden",r["aria-hidden"]),e.inert=r.inert,Bc.delete(e))}function Qx(e,{allowed:t,disallowed:n}={}){let r=rp(e,"inert-others");Te(()=>{var o,s;if(!r)return;let i=it();for(let a of(o=n==null?void 0:n())!=null?o:[])a&&i.add(op(a));let c=(s=t==null?void 0:t())!=null?s:[];for(let a of c){if(!a)continue;let l=js(a);if(!l)continue;let u=a.parentElement;for(;u&&u!==l.body;){for(let f of u.children)c.some(p=>f.contains(p))||i.add(op(f));u=u.parentElement}}return i.dispose},[r,t,n])}function e2(e,t,n){let r=Xn(o=>{let s=o.getBoundingClientRect();s.x===0&&s.y===0&&s.width===0&&s.height===0&&n()});v.useEffect(()=>{if(!e)return;let o=t===null?null:fn(t)?t:t.current;if(!o)return;let s=it();if(typeof ResizeObserver<"u"){let i=new ResizeObserver(()=>r.current(o));i.observe(o),s.add(()=>i.disconnect())}if(typeof IntersectionObserver<"u"){let i=new IntersectionObserver(()=>r.current(o));i.observe(o),s.add(()=>i.disconnect())}return()=>s.dispose()},[t,r,e])}let Lc=["[contentEditable=true]","[tabindex]","a[href]","area[href]","button:not([disabled])","iframe","input:not([disabled])","select:not([disabled])","details>summary","textarea:not([disabled])"].map(e=>`${e}:not([tabindex='-1'])`).join(","),t2=["[data-autofocus]"].map(e=>`${e}:not([tabindex='-1'])`).join(",");var Fc=(e=>(e[e.First=1]="First",e[e.Previous=2]="Previous",e[e.Next=4]="Next",e[e.Last=8]="Last",e[e.WrapAround=16]="WrapAround",e[e.NoScroll=32]="NoScroll",e[e.AutoFocus=64]="AutoFocus",e))(Fc||{}),n2=(e=>(e[e.Error=0]="Error",e[e.Overflow=1]="Overflow",e[e.Success=2]="Success",e[e.Underflow=3]="Underflow",e))(n2||{}),r2=(e=>(e[e.Previous=-1]="Previous",e[e.Next=1]="Next",e))(r2||{});function ip(e=document.body){return e==null?[]:Array.from(e.querySelectorAll(Lc)).sort((t,n)=>Math.sign((t.tabIndex||Number.MAX_SAFE_INTEGER)-(n.tabIndex||Number.MAX_SAFE_INTEGER)))}function o2(e=document.body){return e==null?[]:Array.from(e.querySelectorAll(t2)).sort((t,n)=>Math.sign((t.tabIndex||Number.MAX_SAFE_INTEGER)-(n.tabIndex||Number.MAX_SAFE_INTEGER)))}var Rc=(e=>(e[e.Strict=0]="Strict",e[e.Loose=1]="Loose",e))(Rc||{});function ap(e,t=0){var n;return e===((n=js(e))==null?void 0:n.body)?!1:bt(t,{0(){return e.matches(Lc)},1(){let r=e;for(;r!==null;){if(r.matches(Lc))return!0;r=r.parentElement}return!1}})}var s2=(e=>(e[e.Keyboard=0]="Keyboard",e[e.Mouse=1]="Mouse",e))(s2||{});typeof window<"u"&&typeof document<"u"&&(document.addEventListener("keydown",e=>{e.metaKey||e.altKey||e.ctrlKey||(document.documentElement.dataset.headlessuiFocusVisible="")},!0),document.addEventListener("click",e=>{e.detail===1?delete document.documentElement.dataset.headlessuiFocusVisible:e.detail===0&&(document.documentElement.dataset.headlessuiFocusVisible="")},!0));let i2=["textarea","input"].join(",");function a2(e){var t,n;return(n=(t=e==null?void 0:e.matches)==null?void 0:t.call(e,i2))!=null?n:!1}function cp(e,t=n=>n){return e.slice().sort((n,r)=>{let o=t(n),s=t(r);if(o===null||s===null)return 0;let i=o.compareDocumentPosition(s);return i&Node.DOCUMENT_POSITION_FOLLOWING?-1:i&Node.DOCUMENT_POSITION_PRECEDING?1:0})}function c2(e,t,n=e===null?document.body:zs(e)){return l2(ip(n),t,{relativeTo:e})}function l2(e,t,{sorted:n=!0,relativeTo:r=null,skipElements:o=[]}={}){let s=Array.isArray(e)?e.length>0?zs(e[0]):document:zs(e),i=Array.isArray(e)?n?cp(e):e:t&64?o2(e):ip(e);o.length>0&&i.length>1&&(i=i.filter(d=>!o.some(h=>h!=null&&"current"in h?(h==null?void 0:h.current)===d:h===d))),r=r??(s==null?void 0:s.activeElement);let c=(()=>{if(t&5)return 1;if(t&10)return-1;throw new Error("Missing Focus.First, Focus.Previous, Focus.Next or Focus.Last")})(),a=(()=>{if(t&1)return 0;if(t&2)return Math.max(0,i.indexOf(r))-1;if(t&4)return Math.max(0,i.indexOf(r))+1;if(t&8)return i.length-1;throw new Error("Missing Focus.First, Focus.Previous, Focus.Next or Focus.Last")})(),l=t&32?{preventScroll:!0}:{},u=0,f=i.length,p;do{if(u>=f||u+f<=0)return 0;let d=a+u;if(t&16)d=(d+f)%f;else{if(d<0)return 3;if(d>=f)return 1}p=i[d],p==null||p.focus(l),u+=c}while(p!==N0(p));return t&6&&a2(p)&&p.select(),2}function lp(){return/iPhone/gi.test(window.navigator.platform)||/Mac/gi.test(window.navigator.platform)&&window.navigator.maxTouchPoints>0}function u2(){return/Android/gi.test(window.navigator.userAgent)}function up(){return lp()||u2()}function Or(e,t,n,r){let o=Xn(n);v.useEffect(()=>{if(!e)return;function s(i){o.current(i)}return document.addEventListener(t,s,r),()=>document.removeEventListener(t,s,r)},[e,t,r])}function f2(e,t,n,r){let o=Xn(n);v.useEffect(()=>{if(!e)return;function s(i){o.current(i)}return window.addEventListener(t,s,r),()=>window.removeEventListener(t,s,r)},[e,t,r])}const fp=30;function d2(e,t,n){let r=Xn(n),o=v.useCallback(function(c,a){if(c.defaultPrevented)return;let l=a(c);if(l===null||!l.getRootNode().contains(l)||!l.isConnected)return;let u=function f(p){return typeof p=="function"?f(p()):Array.isArray(p)||p instanceof Set?p:[p]}(t);for(let f of u)if(f!==null&&(f.contains(l)||c.composed&&c.composedPath().includes(f)))return;return!ap(l,Rc.Loose)&&l.tabIndex!==-1&&c.preventDefault(),r.current(c,l)},[r,t]),s=v.useRef(null);Or(e,"pointerdown",c=>{var a,l;up()||(s.current=((l=(a=c.composedPath)==null?void 0:a.call(c))==null?void 0:l[0])||c.target)},!0),Or(e,"pointerup",c=>{if(up()||!s.current)return;let a=s.current;return s.current=null,o(c,()=>a)},!0);let i=v.useRef({x:0,y:0});Or(e,"touchstart",c=>{i.current.x=c.touches[0].clientX,i.current.y=c.touches[0].clientY},!0),Or(e,"touchend",c=>{let a={x:c.changedTouches[0].clientX,y:c.changedTouches[0].clientY};if(!(Math.abs(a.x-i.current.x)>=fp||Math.abs(a.y-i.current.y)>=fp))return o(c,()=>Cr(c.target)?c.target:null)},!0),f2(e,"blur",c=>o(c,()=>Px(window.document.activeElement)?window.document.activeElement:null),!0)}function jc(...e){return v.useMemo(()=>js(...e),[...e])}var p2=(e=>(e[e.Ignore=0]="Ignore",e[e.Select=1]="Select",e[e.Close=2]="Close",e))(p2||{});const Hs={Ignore:{kind:0},Select:e=>({kind:1,target:e}),Close:{kind:2}},h2=200,dp=5;function m2(e,{trigger:t,action:n,close:r,select:o}){let s=v.useRef(null),i=v.useRef(null),c=v.useRef(null);Or(e&&t!==null,"pointerdown",a=>{L0(a==null?void 0:a.target)&&t!=null&&t.contains(a.target)&&(i.current=a.x,c.current=a.y,s.current=a.timeStamp)}),Or(e&&t!==null,"pointerup",a=>{var l,u;let f=s.current;if(f===null||(s.current=null,!Cr(a.target))||Math.abs(a.x-((l=i.current)!=null?l:a.x))<dp&&Math.abs(a.y-((u=c.current)!=null?u:a.y))<dp)return;let p=n(a);switch(p.kind){case 0:return;case 1:{a.timeStamp-f>h2&&(o(p.target),r());break}case 2:{r();break}}},{capture:!0})}function b2(e,t){return v.useMemo(()=>{var n;if(e.type)return e.type;let r=(n=e.as)!=null?n:"button";if(typeof r=="string"&&r.toLowerCase()==="button"||(t==null?void 0:t.tagName)==="BUTTON"&&!t.hasAttribute("type"))return"button"},[e.type,e.as,t])}function g2(e){return v.useSyncExternalStore(e.subscribe,e.getSnapshot,e.getSnapshot)}function y2(e,t){let n=e(),r=new Set;return{getSnapshot(){return n},subscribe(o){return r.add(o),()=>r.delete(o)},dispatch(o,...s){let i=t[o].call(n,...s);i&&(n=i,r.forEach(c=>c()))}}}function v2(){let e;return{before({doc:t}){var n;let r=t.documentElement,o=(n=t.defaultView)!=null?n:window;e=Math.max(0,o.innerWidth-r.clientWidth)},after({doc:t,d:n}){let r=t.documentElement,o=Math.max(0,r.clientWidth-r.offsetWidth),s=Math.max(0,e-o);n.style(r,"paddingRight",`${s}px`)}}}function w2(){return lp()?{before({doc:e,d:t,meta:n}){function r(o){for(let s of n().containers)for(let i of s())if(i.contains(o))return!0;return!1}t.microTask(()=>{var o;if(window.getComputedStyle(e.documentElement).scrollBehavior!=="auto"){let c=it();c.style(e.documentElement,"scrollBehavior","auto"),t.add(()=>t.microTask(()=>c.dispose()))}let s=(o=window.scrollY)!=null?o:window.pageYOffset,i=null;t.addEventListener(e,"click",c=>{if(Cr(c.target))try{let a=c.target.closest("a");if(!a)return;let{hash:l}=new URL(a.href),u=e.querySelector(l);Cr(u)&&!r(u)&&(i=u)}catch{}},!0),t.group(c=>{t.addEventListener(e,"touchstart",a=>{if(c.dispose(),Cr(a.target)&&Sx(a.target))if(r(a.target)){let l=a.target;for(;l.parentElement&&r(l.parentElement);)l=l.parentElement;c.style(l,"overscrollBehavior","contain")}else c.style(a.target,"touchAction","none")})}),t.addEventListener(e,"touchmove",c=>{if(Cr(c.target)){if(F0(c.target))return;if(r(c.target)){let a=c.target;for(;a.parentElement&&a.dataset.headlessuiPortal!==""&&!(a.scrollHeight>a.clientHeight||a.scrollWidth>a.clientWidth);)a=a.parentElement;a.dataset.headlessuiPortal===""&&c.preventDefault()}else c.preventDefault()}},{passive:!1}),t.add(()=>{var c;let a=(c=window.scrollY)!=null?c:window.pageYOffset;s!==a&&window.scrollTo(0,s),i&&i.isConnected&&(i.scrollIntoView({block:"nearest"}),i=null)})})}}:{}}function x2(){return{before({doc:e,d:t}){t.style(e.documentElement,"overflow","hidden")}}}function pp(e){let t={};for(let n of e)Object.assign(t,n(t));return t}let Jn=y2(()=>new Map,{PUSH(e,t){var n;let r=(n=this.get(e))!=null?n:{doc:e,count:0,d:it(),meta:new Set,computedMeta:{}};return r.count++,r.meta.add(t),r.computedMeta=pp(r.meta),this.set(e,r),this},POP(e,t){let n=this.get(e);return n&&(n.count--,n.meta.delete(t),n.computedMeta=pp(n.meta)),this},SCROLL_PREVENT(e){let t={doc:e.doc,d:e.d,meta(){return e.computedMeta}},n=[w2(),v2(),x2()];n.forEach(({before:r})=>r==null?void 0:r(t)),n.forEach(({after:r})=>r==null?void 0:r(t))},SCROLL_ALLOW({d:e}){e.dispose()},TEARDOWN({doc:e}){this.delete(e)}});Jn.subscribe(()=>{let e=Jn.getSnapshot(),t=new Map;for(let[n]of e)t.set(n,n.documentElement.style.overflow);for(let n of e.values()){let r=t.get(n.doc)==="hidden",o=n.count!==0;(o&&!r||!o&&r)&&Jn.dispatch(n.count>0?"SCROLL_PREVENT":"SCROLL_ALLOW",n),n.count===0&&Jn.dispatch("TEARDOWN",n)}});function E2(e,t,n=()=>({containers:[]})){let r=g2(Jn),o=t?r.get(t):void 0,s=o?o.count>0:!1;return Te(()=>{if(!(!t||!e))return Jn.dispatch("PUSH",t,n),()=>Jn.dispatch("POP",t,n)},[e,t]),s}function S2(e,t,n=()=>[document.body]){let r=rp(e,"scroll-lock");E2(r,t,o=>{var s;return{containers:[...(s=o.containers)!=null?s:[],n]}})}function hp(e){return[e.screenX,e.screenY]}function P2(){let e=v.useRef([-1,-1]);return{wasMoved(t){let n=hp(t);return e.current[0]===n[0]&&e.current[1]===n[1]?!1:(e.current=n,!0)},update(t){e.current=hp(t)}}}function T2(e=0){let[t,n]=v.useState(e),r=v.useCallback(a=>n(a),[]),o=v.useCallback(a=>n(l=>l|a),[]),s=v.useCallback(a=>(t&a)===a,[t]),i=v.useCallback(a=>n(l=>l&~a),[]),c=v.useCallback(a=>n(l=>l^a),[]);return{flags:t,setFlag:r,addFlag:o,hasFlag:s,removeFlag:i,toggleFlag:c}}var mp,bp;typeof process<"u"&&typeof globalThis<"u"&&typeof Element<"u"&&((mp=process==null?void 0:process.env)==null?void 0:mp.NODE_ENV)==="test"&&typeof((bp=Element==null?void 0:Element.prototype)==null?void 0:bp.getAnimations)>"u"&&(Element.prototype.getAnimations=function(){return console.warn(["Headless UI has polyfilled `Element.prototype.getAnimations` for your tests.","Please install a proper polyfill e.g. `jsdom-testing-mocks`, to silence these warnings.","","Example usage:","```js","import { mockAnimationsApi } from 'jsdom-testing-mocks'","mockAnimationsApi()","```"].join(`
|
|
136
|
+
`)),[]});var A2=(e=>(e[e.None=0]="None",e[e.Closed=1]="Closed",e[e.Enter=2]="Enter",e[e.Leave=4]="Leave",e))(A2||{});function gp(e){let t={};for(let n in e)e[n]===!0&&(t[`data-${n}`]="");return t}function yp(e,t,n,r){let[o,s]=v.useState(n),{hasFlag:i,addFlag:c,removeFlag:a}=T2(e&&o?3:0),l=v.useRef(!1),u=v.useRef(!1),f=Yn();return Te(()=>{var p;if(e){if(n&&s(!0),!t){n&&c(3);return}return(p=r==null?void 0:r.start)==null||p.call(r,n),N2(t,{inFlight:l,prepare(){u.current?u.current=!1:u.current=l.current,l.current=!0,!u.current&&(n?(c(3),a(4)):(c(4),a(2)))},run(){u.current?n?(a(3),c(4)):(a(4),c(3)):n?a(1):c(1)},done(){var d;u.current&&I2(t)||(l.current=!1,a(7),n||s(!1),(d=r==null?void 0:r.end)==null||d.call(r,n))}})}},[e,n,t,f]),e?[o,{closed:i(1),enter:i(2),leave:i(4),transition:i(2)||i(4)}]:[n,{closed:void 0,enter:void 0,leave:void 0,transition:void 0}]}function N2(e,{prepare:t,run:n,done:r,inFlight:o}){let s=it();return O2(e,{prepare:t,inFlight:o}),s.nextFrame(()=>{n(),s.requestAnimationFrame(()=>{s.add(C2(e,r))})}),s.dispose}function C2(e,t){var n,r;let o=it();if(!e)return o.dispose;let s=!1;o.add(()=>{s=!0});let i=(r=(n=e.getAnimations)==null?void 0:n.call(e).filter(c=>c instanceof CSSTransition))!=null?r:[];return i.length===0?(t(),o.dispose):(Promise.allSettled(i.map(c=>c.finished)).then(()=>{s||t()}),o.dispose)}function O2(e,{inFlight:t,prepare:n}){if(t!=null&&t.current){n();return}let r=e.style.transition;e.style.transition="none",n(),e.offsetHeight,e.style.transition=r}function I2(e){var t,n;return((n=(t=e.getAnimations)==null?void 0:t.call(e))!=null?n:[]).some(r=>r instanceof CSSTransition&&r.playState!=="finished")}function Gs(){return typeof window<"u"}function Ir(e){return zc(e)?(e.nodeName||"").toLowerCase():"#document"}function Ye(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Vt(e){var t;return(t=(zc(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function zc(e){return Gs()?e instanceof Node||e instanceof Ye(e).Node:!1}function be(e){return Gs()?e instanceof Element||e instanceof Ye(e).Element:!1}function je(e){return Gs()?e instanceof HTMLElement||e instanceof Ye(e).HTMLElement:!1}function Uc(e){return!Gs()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof Ye(e).ShadowRoot}const $2=new Set(["inline","contents"]);function zo(e){const{overflow:t,overflowX:n,overflowY:r,display:o}=vt(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!$2.has(o)}const k2=new Set(["table","td","th"]);function D2(e){return k2.has(Ir(e))}const M2=[":popover-open",":modal"];function qs(e){return M2.some(t=>{try{return e.matches(t)}catch{return!1}})}const B2=["transform","translate","scale","rotate","perspective"],L2=["transform","translate","scale","rotate","perspective","filter"],F2=["paint","layout","strict","content"];function _c(e){const t=Ks(),n=be(e)?vt(e):e;return B2.some(r=>n[r]?n[r]!=="none":!1)||(n.containerType?n.containerType!=="normal":!1)||!t&&(n.backdropFilter?n.backdropFilter!=="none":!1)||!t&&(n.filter?n.filter!=="none":!1)||L2.some(r=>(n.willChange||"").includes(r))||F2.some(r=>(n.contain||"").includes(r))}function R2(e){let t=pn(e);for(;je(t)&&!dn(t);){if(_c(t))return t;if(qs(t))return null;t=pn(t)}return null}function Ks(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const j2=new Set(["html","body","#document"]);function dn(e){return j2.has(Ir(e))}function vt(e){return Ye(e).getComputedStyle(e)}function Zs(e){return be(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function pn(e){if(Ir(e)==="html")return e;const t=e.assignedSlot||e.parentNode||Uc(e)&&e.host||Vt(e);return Uc(t)?t.host:t}function vp(e){const t=pn(e);return dn(t)?e.ownerDocument?e.ownerDocument.body:e.body:je(t)&&zo(t)?t:vp(t)}function $n(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const o=vp(e),s=o===((r=e.ownerDocument)==null?void 0:r.body),i=Ye(o);if(s){const c=Wc(i);return t.concat(i,i.visualViewport||[],zo(o)?o:[],c&&n?$n(c):[])}return t.concat(o,$n(o,[],n))}function Wc(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function z2(){const e=navigator.userAgentData;return e&&Array.isArray(e.brands)?e.brands.map(t=>{let{brand:n,version:r}=t;return n+"/"+r}).join(" "):navigator.userAgent}const hn=Math.min,Be=Math.max,Uo=Math.round,Ys=Math.floor,Ht=e=>({x:e,y:e}),U2={left:"right",right:"left",bottom:"top",top:"bottom"},_2={start:"end",end:"start"};function Vc(e,t,n){return Be(e,hn(t,n))}function Qn(e,t){return typeof e=="function"?e(t):e}function kn(e){return e.split("-")[0]}function $r(e){return e.split("-")[1]}function wp(e){return e==="x"?"y":"x"}function Hc(e){return e==="y"?"height":"width"}const W2=new Set(["top","bottom"]);function mn(e){return W2.has(kn(e))?"y":"x"}function Gc(e){return wp(mn(e))}function V2(e,t,n){n===void 0&&(n=!1);const r=$r(e),o=Gc(e),s=Hc(o);let i=o==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[s]>t.floating[s]&&(i=Xs(i)),[i,Xs(i)]}function H2(e){const t=Xs(e);return[qc(e),t,qc(t)]}function qc(e){return e.replace(/start|end/g,t=>_2[t])}const xp=["left","right"],Ep=["right","left"],G2=["top","bottom"],q2=["bottom","top"];function K2(e,t,n){switch(e){case"top":case"bottom":return n?t?Ep:xp:t?xp:Ep;case"left":case"right":return t?G2:q2;default:return[]}}function Z2(e,t,n,r){const o=$r(e);let s=K2(kn(e),n==="start",r);return o&&(s=s.map(i=>i+"-"+o),t&&(s=s.concat(s.map(qc)))),s}function Xs(e){return e.replace(/left|right|bottom|top/g,t=>U2[t])}function Y2(e){return{top:0,right:0,bottom:0,left:0,...e}}function Sp(e){return typeof e!="number"?Y2(e):{top:e,right:e,bottom:e,left:e}}function Js(e){const{x:t,y:n,width:r,height:o}=e;return{width:r,height:o,top:n,left:t,right:t+r,bottom:n+o,x:t,y:n}}/*!
|
|
137
|
+
* tabbable 6.3.0
|
|
129
138
|
* @license MIT, https://github.com/focus-trap/tabbable/blob/master/LICENSE
|
|
130
|
-
*/var b2=["input:not([inert])","select:not([inert])","textarea:not([inert])","a[href]:not([inert])","button:not([inert])","[tabindex]:not(slot):not([inert])","audio[controls]:not([inert])","video[controls]:not([inert])",'[contenteditable]:not([contenteditable="false"]):not([inert])',"details>summary:first-of-type:not([inert])","details:not([inert])"],yc=b2.join(","),_p=typeof Element>"u",To=_p?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,Ms=!_p&&Element.prototype.getRootNode?function(e){var t;return e==null||(t=e.getRootNode)===null||t===void 0?void 0:t.call(e)}:function(e){return e==null?void 0:e.ownerDocument},ks=function e(t,n){var r;n===void 0&&(n=!0);var o=t==null||(r=t.getAttribute)===null||r===void 0?void 0:r.call(t,"inert"),s=o===""||o==="true",i=s||n&&t&&e(t.parentNode);return i},y2=function(t){var n,r=t==null||(n=t.getAttribute)===null||n===void 0?void 0:n.call(t,"contenteditable");return r===""||r==="true"},w2=function(t,n,r){if(ks(t))return[];var o=Array.prototype.slice.apply(t.querySelectorAll(yc));return n&&To.call(t,yc)&&o.unshift(t),o=o.filter(r),o},v2=function e(t,n,r){for(var o=[],s=Array.from(t);s.length;){var i=s.shift();if(!ks(i,!1))if(i.tagName==="SLOT"){var c=i.assignedElements(),a=c.length?c:i.children,u=e(a,!0,r);r.flatten?o.push.apply(o,u):o.push({scopeParent:i,candidates:u})}else{var l=To.call(i,yc);l&&r.filter(i)&&(n||!t.includes(i))&&o.push(i);var f=i.shadowRoot||typeof r.getShadowRoot=="function"&&r.getShadowRoot(i),p=!ks(f,!1)&&(!r.shadowRootFilter||r.shadowRootFilter(i));if(f&&p){var d=e(f===!0?i.children:f.children,!0,r);r.flatten?o.push.apply(o,d):o.push({scopeParent:i,candidates:d})}else s.unshift.apply(s,i.children)}}return o},Up=function(t){return!isNaN(parseInt(t.getAttribute("tabindex"),10))},zp=function(t){if(!t)throw new Error("No node provided");return t.tabIndex<0&&(/^(AUDIO|VIDEO|DETAILS)$/.test(t.tagName)||y2(t))&&!Up(t)?0:t.tabIndex},x2=function(t,n){var r=zp(t);return r<0&&n&&!Up(t)?0:r},E2=function(t,n){return t.tabIndex===n.tabIndex?t.documentOrder-n.documentOrder:t.tabIndex-n.tabIndex},Hp=function(t){return t.tagName==="INPUT"},S2=function(t){return Hp(t)&&t.type==="hidden"},P2=function(t){var n=t.tagName==="DETAILS"&&Array.prototype.slice.apply(t.children).some(function(r){return r.tagName==="SUMMARY"});return n},$2=function(t,n){for(var r=0;r<t.length;r++)if(t[r].checked&&t[r].form===n)return t[r]},T2=function(t){if(!t.name)return!0;var n=t.form||Ms(t),r=function(c){return n.querySelectorAll('input[type="radio"][name="'+c+'"]')},o;if(typeof window<"u"&&typeof window.CSS<"u"&&typeof window.CSS.escape=="function")o=r(window.CSS.escape(t.name));else try{o=r(t.name)}catch(i){return console.error("Looks like you have a radio button with a name attribute containing invalid CSS selector characters and need the CSS.escape polyfill: %s",i.message),!1}var s=$2(o,t.form);return!s||s===t},A2=function(t){return Hp(t)&&t.type==="radio"},O2=function(t){return A2(t)&&!T2(t)},C2=function(t){var n,r=t&&Ms(t),o=(n=r)===null||n===void 0?void 0:n.host,s=!1;if(r&&r!==t){var i,c,a;for(s=!!((i=o)!==null&&i!==void 0&&(c=i.ownerDocument)!==null&&c!==void 0&&c.contains(o)||t!=null&&(a=t.ownerDocument)!==null&&a!==void 0&&a.contains(t));!s&&o;){var u,l,f;r=Ms(o),o=(u=r)===null||u===void 0?void 0:u.host,s=!!((l=o)!==null&&l!==void 0&&(f=l.ownerDocument)!==null&&f!==void 0&&f.contains(o))}}return s},Wp=function(t){var n=t.getBoundingClientRect(),r=n.width,o=n.height;return r===0&&o===0},N2=function(t,n){var r=n.displayCheck,o=n.getShadowRoot;if(getComputedStyle(t).visibility==="hidden")return!0;var s=To.call(t,"details>summary:first-of-type"),i=s?t.parentElement:t;if(To.call(i,"details:not([open]) *"))return!0;if(!r||r==="full"||r==="legacy-full"){if(typeof o=="function"){for(var c=t;t;){var a=t.parentElement,u=Ms(t);if(a&&!a.shadowRoot&&o(a)===!0)return Wp(t);t.assignedSlot?t=t.assignedSlot:!a&&u!==t.ownerDocument?t=u.host:t=a}t=c}if(C2(t))return!t.getClientRects().length;if(r!=="legacy-full")return!0}else if(r==="non-zero-area")return Wp(t);return!1},I2=function(t){if(/^(INPUT|BUTTON|SELECT|TEXTAREA)$/.test(t.tagName))for(var n=t.parentElement;n;){if(n.tagName==="FIELDSET"&&n.disabled){for(var r=0;r<n.children.length;r++){var o=n.children.item(r);if(o.tagName==="LEGEND")return To.call(n,"fieldset[disabled] *")?!0:!o.contains(t)}return!0}n=n.parentElement}return!1},M2=function(t,n){return!(n.disabled||ks(n)||S2(n)||N2(n,t)||P2(n)||I2(n))},Vp=function(t,n){return!(O2(n)||zp(n)<0||!M2(t,n))},k2=function(t){var n=parseInt(t.getAttribute("tabindex"),10);return!!(isNaN(n)||n>=0)},B2=function e(t){var n=[],r=[];return t.forEach(function(o,s){var i=!!o.scopeParent,c=i?o.scopeParent:o,a=x2(c,i),u=i?e(o.candidates):c;a===0?i?n.push.apply(n,u):n.push(c):r.push({documentOrder:s,tabIndex:a,item:o,isScope:i,content:u})}),r.sort(E2).reduce(function(o,s){return s.isScope?o.push.apply(o,s.content):o.push(s.content),o},[]).concat(n)},Gp=function(t,n){n=n||{};var r;return n.getShadowRoot?r=v2([t],n.includeContainer,{filter:Vp.bind(null,n),flatten:!1,getShadowRoot:n.getShadowRoot,shadowRootFilter:k2}):r=w2(t,n.includeContainer,Vp.bind(null,n)),B2(r)};function qp(e,t,n){let{reference:r,floating:o}=e;const s=cn(t),i=gc(t),c=mc(i),a=xn(t),u=s==="y",l=r.x+r.width/2-o.width/2,f=r.y+r.height/2-o.height/2,p=r[c]/2-o[c]/2;let d;switch(a){case"top":d={x:l,y:r.y-o.height};break;case"bottom":d={x:l,y:r.y+r.height};break;case"right":d={x:r.x+r.width,y:f};break;case"left":d={x:r.x-o.width,y:f};break;default:d={x:r.x,y:r.y}}switch(xr(t)){case"start":d[i]-=p*(n&&u?-1:1);break;case"end":d[i]+=p*(n&&u?-1:1);break}return d}const L2=async(e,t,n)=>{const{placement:r="bottom",strategy:o="absolute",middleware:s=[],platform:i}=n,c=s.filter(Boolean),a=await(i.isRTL==null?void 0:i.isRTL(t));let u=await i.getElementRects({reference:e,floating:t,strategy:o}),{x:l,y:f}=qp(u,r,a),p=r,d={},h=0;for(let m=0;m<c.length;m++){const{name:v,fn:A}=c[m],{x:w,y:T,data:B,reset:F}=await A({x:l,y:f,initialPlacement:r,placement:p,strategy:o,middlewareData:d,rects:u,platform:i,elements:{reference:e,floating:t}});l=w??l,f=T??f,d={...d,[v]:{...d[v],...B}},F&&h<=50&&(h++,typeof F=="object"&&(F.placement&&(p=F.placement),F.rects&&(u=F.rects===!0?await i.getElementRects({reference:e,floating:t,strategy:o}):F.rects),{x:l,y:f}=qp(u,p,a)),m=-1)}return{x:l,y:f,placement:p,strategy:o,middlewareData:d}};async function Bs(e,t){var n;t===void 0&&(t={});const{x:r,y:o,platform:s,rects:i,elements:c,strategy:a}=e,{boundary:u="clippingAncestors",rootBoundary:l="viewport",elementContext:f="floating",altBoundary:p=!1,padding:d=0}=Wn(t,e),h=jp(d),v=c[p?f==="floating"?"reference":"floating":f],A=Is(await s.getClippingRect({element:(n=await(s.isElement==null?void 0:s.isElement(v)))==null||n?v:v.contextElement||await(s.getDocumentElement==null?void 0:s.getDocumentElement(c.floating)),boundary:u,rootBoundary:l,strategy:a})),w=f==="floating"?{x:r,y:o,width:i.floating.width,height:i.floating.height}:i.reference,T=await(s.getOffsetParent==null?void 0:s.getOffsetParent(c.floating)),B=await(s.isElement==null?void 0:s.isElement(T))?await(s.getScale==null?void 0:s.getScale(T))||{x:1,y:1}:{x:1,y:1},F=Is(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:c,rect:w,offsetParent:T,strategy:a}):w);return{top:(A.top-F.top+h.top)/B.y,bottom:(F.bottom-A.bottom+h.bottom)/B.y,left:(A.left-F.left+h.left)/B.x,right:(F.right-A.right+h.right)/B.x}}const F2=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:o,rects:s,platform:i,elements:c,middlewareData:a}=t,{element:u,padding:l=0}=Wn(e,t)||{};if(u==null)return{};const f=jp(l),p={x:n,y:r},d=gc(o),h=mc(d),m=await i.getDimensions(u),v=d==="y",A=v?"top":"left",w=v?"bottom":"right",T=v?"clientHeight":"clientWidth",B=s.reference[h]+s.reference[d]-p[d]-s.floating[h],F=p[d]-s.reference[d],R=await(i.getOffsetParent==null?void 0:i.getOffsetParent(u));let j=R?R[T]:0;(!j||!await(i.isElement==null?void 0:i.isElement(R)))&&(j=c.floating[T]||s.floating[h]);const g=B/2-F/2,y=j/2-m[h]/2-1,$=an(f[A],y),k=an(f[w],y),N=$,P=j-m[h]-k,S=j/2-m[h]/2+g,E=hc(N,S,P),C=!a.arrow&&xr(o)!=null&&S!==E&&s.reference[h]/2-(S<N?$:k)-m[h]/2<0,O=C?S<N?S-N:S-P:0;return{[d]:p[d]+O,data:{[d]:E,centerOffset:S-E-O,...C&&{alignmentOffset:O}},reset:C}}}),D2=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:o,middlewareData:s,rects:i,initialPlacement:c,platform:a,elements:u}=t,{mainAxis:l=!0,crossAxis:f=!0,fallbackPlacements:p,fallbackStrategy:d="bestFit",fallbackAxisSideDirection:h="none",flipAlignment:m=!0,...v}=Wn(e,t);if((n=s.arrow)!=null&&n.alignmentOffset)return{};const A=xn(o),w=cn(c),T=xn(c)===c,B=await(a.isRTL==null?void 0:a.isRTL(u.floating)),F=p||(T||!m?[Ns(c)]:f2(c)),R=h!=="none";!p&&R&&F.push(...m2(c,m,h,B));const j=[c,...F],g=await Bs(t,v),y=[];let $=((r=s.flip)==null?void 0:r.overflows)||[];if(l&&y.push(g[A]),f){const S=l2(o,i,B);y.push(g[S[0]],g[S[1]])}if($=[...$,{placement:o,overflows:y}],!y.every(S=>S<=0)){var k,N;const S=(((k=s.flip)==null?void 0:k.index)||0)+1,E=j[S];if(E&&(!(f==="alignment"?w!==cn(E):!1)||$.every(b=>cn(b.placement)===w?b.overflows[0]>0:!0)))return{data:{index:S,overflows:$},reset:{placement:E}};let C=(N=$.filter(O=>O.overflows[0]<=0).sort((O,b)=>O.overflows[1]-b.overflows[1])[0])==null?void 0:N.placement;if(!C)switch(d){case"bestFit":{var P;const O=(P=$.filter(b=>{if(R){const M=cn(b.placement);return M===w||M==="y"}return!0}).map(b=>[b.placement,b.overflows.filter(M=>M>0).reduce((M,D)=>M+D,0)]).sort((b,M)=>b[1]-M[1])[0])==null?void 0:P[0];O&&(C=O);break}case"initialPlacement":C=c;break}if(o!==C)return{reset:{placement:C}}}return{}}}},R2=new Set(["left","top"]);async function j2(e,t){const{placement:n,platform:r,elements:o}=e,s=await(r.isRTL==null?void 0:r.isRTL(o.floating)),i=xn(n),c=xr(n),a=cn(n)==="y",u=R2.has(i)?-1:1,l=s&&a?-1:1,f=Wn(t,e);let{mainAxis:p,crossAxis:d,alignmentAxis:h}=typeof f=="number"?{mainAxis:f,crossAxis:0,alignmentAxis:null}:{mainAxis:f.mainAxis||0,crossAxis:f.crossAxis||0,alignmentAxis:f.alignmentAxis};return c&&typeof h=="number"&&(d=c==="end"?h*-1:h),a?{x:d*l,y:p*u}:{x:p*u,y:d*l}}const _2=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:o,y:s,placement:i,middlewareData:c}=t,a=await j2(t,e);return i===((n=c.offset)==null?void 0:n.placement)&&(r=c.arrow)!=null&&r.alignmentOffset?{}:{x:o+a.x,y:s+a.y,data:{...a,placement:i}}}}},U2=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:o}=t,{mainAxis:s=!0,crossAxis:i=!1,limiter:c={fn:v=>{let{x:A,y:w}=v;return{x:A,y:w}}},...a}=Wn(e,t),u={x:n,y:r},l=await Bs(t,a),f=cn(xn(o)),p=Fp(f);let d=u[p],h=u[f];if(s){const v=p==="y"?"top":"left",A=p==="y"?"bottom":"right",w=d+l[v],T=d-l[A];d=hc(w,d,T)}if(i){const v=f==="y"?"top":"left",A=f==="y"?"bottom":"right",w=h+l[v],T=h-l[A];h=hc(w,h,T)}const m=c.fn({...t,[p]:d,[f]:h});return{...m,data:{x:m.x-n,y:m.y-r,enabled:{[p]:s,[f]:i}}}}}},z2=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var n,r;const{placement:o,rects:s,platform:i,elements:c}=t,{apply:a=()=>{},...u}=Wn(e,t),l=await Bs(t,u),f=xn(o),p=xr(o),d=cn(o)==="y",{width:h,height:m}=s.floating;let v,A;f==="top"||f==="bottom"?(v=f,A=p===(await(i.isRTL==null?void 0:i.isRTL(c.floating))?"start":"end")?"left":"right"):(A=f,v=p==="end"?"top":"bottom");const w=m-l.top-l.bottom,T=h-l.left-l.right,B=an(m-l[v],w),F=an(h-l[A],T),R=!t.middlewareData.shift;let j=B,g=F;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(g=T),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(j=w),R&&!p){const $=Me(l.left,0),k=Me(l.right,0),N=Me(l.top,0),P=Me(l.bottom,0);d?g=h-2*($!==0||k!==0?$+k:Me(l.left,l.right)):j=m-2*(N!==0||P!==0?N+P:Me(l.top,l.bottom))}await a({...t,availableWidth:g,availableHeight:j});const y=await i.getDimensions(c.floating);return h!==y.width||m!==y.height?{reset:{rects:!0}}:{}}}};function Zp(e){const t=ct(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const o=Fe(e),s=o?e.offsetWidth:n,i=o?e.offsetHeight:r,c=$o(n)!==s||$o(r)!==i;return c&&(n=s,r=i),{width:n,height:r,$:c}}function wc(e){return fe(e)?e:e.contextElement}function Er(e){const t=wc(e);if(!Fe(t))return Dt(1);const n=t.getBoundingClientRect(),{width:r,height:o,$:s}=Zp(t);let i=(s?$o(n.width):n.width)/r,c=(s?$o(n.height):n.height)/o;return(!i||!Number.isFinite(i))&&(i=1),(!c||!Number.isFinite(c))&&(c=1),{x:i,y:c}}const H2=Dt(0);function Kp(e){const t=He(e);return!As()||!t.visualViewport?H2:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function W2(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==He(e)?!1:t}function Vn(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const o=e.getBoundingClientRect(),s=wc(e);let i=Dt(1);t&&(r?fe(r)&&(i=Er(r)):i=Er(e));const c=W2(s,n,r)?Kp(s):Dt(0);let a=(o.left+c.x)/i.x,u=(o.top+c.y)/i.y,l=o.width/i.x,f=o.height/i.y;if(s){const p=He(s),d=r&&fe(r)?He(r):r;let h=p,m=pc(h);for(;m&&r&&d!==h;){const v=Er(m),A=m.getBoundingClientRect(),w=ct(m),T=A.left+(m.clientLeft+parseFloat(w.paddingLeft))*v.x,B=A.top+(m.clientTop+parseFloat(w.paddingTop))*v.y;a*=v.x,u*=v.y,l*=v.x,f*=v.y,a+=T,u+=B,h=He(m),m=pc(h)}}return Is({width:l,height:f,x:a,y:u})}function Ls(e,t){const n=Os(e).scrollLeft;return t?t.left+n:Vn(Ft(e)).left+n}function Yp(e,t){const n=e.getBoundingClientRect(),r=n.left+t.scrollLeft-Ls(e,n),o=n.top+t.scrollTop;return{x:r,y:o}}function V2(e){let{elements:t,rect:n,offsetParent:r,strategy:o}=e;const s=o==="fixed",i=Ft(r),c=t?Ts(t.floating):!1;if(r===i||c&&s)return n;let a={scrollLeft:0,scrollTop:0},u=Dt(1);const l=Dt(0),f=Fe(r);if((f||!f&&!s)&&((vr(r)!=="body"||Po(i))&&(a=Os(r)),Fe(r))){const d=Vn(r);u=Er(r),l.x=d.x+r.clientLeft,l.y=d.y+r.clientTop}const p=i&&!f&&!s?Yp(i,a):Dt(0);return{width:n.width*u.x,height:n.height*u.y,x:n.x*u.x-a.scrollLeft*u.x+l.x+p.x,y:n.y*u.y-a.scrollTop*u.y+l.y+p.y}}function G2(e){return Array.from(e.getClientRects())}function q2(e){const t=Ft(e),n=Os(e),r=e.ownerDocument.body,o=Me(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),s=Me(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let i=-n.scrollLeft+Ls(e);const c=-n.scrollTop;return ct(r).direction==="rtl"&&(i+=Me(t.clientWidth,r.clientWidth)-o),{width:o,height:s,x:i,y:c}}const Xp=25;function Z2(e,t){const n=He(e),r=Ft(e),o=n.visualViewport;let s=r.clientWidth,i=r.clientHeight,c=0,a=0;if(o){s=o.width,i=o.height;const l=As();(!l||l&&t==="fixed")&&(c=o.offsetLeft,a=o.offsetTop)}const u=Ls(r);if(u<=0){const l=r.ownerDocument,f=l.body,p=getComputedStyle(f),d=l.compatMode==="CSS1Compat"&&parseFloat(p.marginLeft)+parseFloat(p.marginRight)||0,h=Math.abs(r.clientWidth-f.clientWidth-d);h<=Xp&&(s-=h)}else u<=Xp&&(s+=u);return{width:s,height:i,x:c,y:a}}const K2=new Set(["absolute","fixed"]);function Y2(e,t){const n=Vn(e,!0,t==="fixed"),r=n.top+e.clientTop,o=n.left+e.clientLeft,s=Fe(e)?Er(e):Dt(1),i=e.clientWidth*s.x,c=e.clientHeight*s.y,a=o*s.x,u=r*s.y;return{width:i,height:c,x:a,y:u}}function Qp(e,t,n){let r;if(t==="viewport")r=Z2(e,n);else if(t==="document")r=q2(Ft(e));else if(fe(t))r=Y2(t,n);else{const o=Kp(e);r={x:t.x-o.x,y:t.y-o.y,width:t.width,height:t.height}}return Is(r)}function Jp(e,t){const n=sn(e);return n===t||!fe(n)||on(n)?!1:ct(n).position==="fixed"||Jp(n,t)}function X2(e,t){const n=t.get(e);if(n)return n;let r=vn(e,[],!1).filter(c=>fe(c)&&vr(c)!=="body"),o=null;const s=ct(e).position==="fixed";let i=s?sn(e):e;for(;fe(i)&&!on(i);){const c=ct(i),a=dc(i);!a&&c.position==="fixed"&&(o=null),(s?!a&&!o:!a&&c.position==="static"&&!!o&&K2.has(o.position)||Po(i)&&!a&&Jp(e,i))?r=r.filter(l=>l!==i):o=c,i=sn(i)}return t.set(e,r),r}function Q2(e){let{element:t,boundary:n,rootBoundary:r,strategy:o}=e;const i=[...n==="clippingAncestors"?Ts(t)?[]:X2(t,this._c):[].concat(n),r],c=i[0],a=i.reduce((u,l)=>{const f=Qp(t,l,o);return u.top=Me(f.top,u.top),u.right=an(f.right,u.right),u.bottom=an(f.bottom,u.bottom),u.left=Me(f.left,u.left),u},Qp(t,c,o));return{width:a.right-a.left,height:a.bottom-a.top,x:a.left,y:a.top}}function J2(e){const{width:t,height:n}=Zp(e);return{width:t,height:n}}function e6(e,t,n){const r=Fe(t),o=Ft(t),s=n==="fixed",i=Vn(e,!0,s,t);let c={scrollLeft:0,scrollTop:0};const a=Dt(0);function u(){a.x=Ls(o)}if(r||!r&&!s)if((vr(t)!=="body"||Po(o))&&(c=Os(t)),r){const d=Vn(t,!0,s,t);a.x=d.x+t.clientLeft,a.y=d.y+t.clientTop}else o&&u();s&&!r&&o&&u();const l=o&&!r&&!s?Yp(o,c):Dt(0),f=i.left+c.scrollLeft-a.x-l.x,p=i.top+c.scrollTop-a.y-l.y;return{x:f,y:p,width:i.width,height:i.height}}function vc(e){return ct(e).position==="static"}function eh(e,t){if(!Fe(e)||ct(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return Ft(e)===n&&(n=n.ownerDocument.body),n}function th(e,t){const n=He(e);if(Ts(e))return n;if(!Fe(e)){let o=sn(e);for(;o&&!on(o);){if(fe(o)&&!vc(o))return o;o=sn(o)}return n}let r=eh(e,t);for(;r&&JE(r)&&vc(r);)r=eh(r,t);return r&&on(r)&&vc(r)&&!dc(r)?n:r||o2(e)||n}const t6=async function(e){const t=this.getOffsetParent||th,n=this.getDimensions,r=await n(e.floating);return{reference:e6(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function n6(e){return ct(e).direction==="rtl"}const r6={convertOffsetParentRelativeRectToViewportRelativeRect:V2,getDocumentElement:Ft,getClippingRect:Q2,getOffsetParent:th,getElementRects:t6,getClientRects:G2,getDimensions:J2,getScale:Er,isElement:fe,isRTL:n6};function nh(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function o6(e,t){let n=null,r;const o=Ft(e);function s(){var c;clearTimeout(r),(c=n)==null||c.disconnect(),n=null}function i(c,a){c===void 0&&(c=!1),a===void 0&&(a=1),s();const u=e.getBoundingClientRect(),{left:l,top:f,width:p,height:d}=u;if(c||t(),!p||!d)return;const h=Cs(f),m=Cs(o.clientWidth-(l+p)),v=Cs(o.clientHeight-(f+d)),A=Cs(l),T={rootMargin:-h+"px "+-m+"px "+-v+"px "+-A+"px",threshold:Me(0,an(1,a))||1};let B=!0;function F(R){const j=R[0].intersectionRatio;if(j!==a){if(!B)return i();j?i(!1,j):r=setTimeout(()=>{i(!1,1e-7)},1e3)}j===1&&!nh(u,e.getBoundingClientRect())&&i(),B=!1}try{n=new IntersectionObserver(F,{...T,root:o.ownerDocument})}catch{n=new IntersectionObserver(F,T)}n.observe(e)}return i(!0),s}function rh(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:o=!0,ancestorResize:s=!0,elementResize:i=typeof ResizeObserver=="function",layoutShift:c=typeof IntersectionObserver=="function",animationFrame:a=!1}=r,u=wc(e),l=o||s?[...u?vn(u):[],...vn(t)]:[];l.forEach(A=>{o&&A.addEventListener("scroll",n,{passive:!0}),s&&A.addEventListener("resize",n)});const f=u&&c?o6(u,n):null;let p=-1,d=null;i&&(d=new ResizeObserver(A=>{let[w]=A;w&&w.target===u&&d&&(d.unobserve(t),cancelAnimationFrame(p),p=requestAnimationFrame(()=>{var T;(T=d)==null||T.observe(t)})),n()}),u&&!a&&d.observe(u),d.observe(t));let h,m=a?Vn(e):null;a&&v();function v(){const A=Vn(e);m&&!nh(m,A)&&n(),m=A,h=requestAnimationFrame(v)}return n(),()=>{var A;l.forEach(w=>{o&&w.removeEventListener("scroll",n),s&&w.removeEventListener("resize",n)}),f==null||f(),(A=d)==null||A.disconnect(),d=null,a&&cancelAnimationFrame(h)}}const xc=Bs,s6=_2,i6=U2,a6=D2,c6=z2,oh=F2,u6=(e,t,n)=>{const r=new Map,o={platform:r6,...n},s={...o.platform,_c:r};return L2(e,t,{...o,platform:s})};var l6=typeof document<"u",f6=function(){},Fs=l6?x.useLayoutEffect:f6;function Ds(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let n,r,o;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!Ds(e[r],t[r]))return!1;return!0}if(o=Object.keys(e),n=o.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,o[r]))return!1;for(r=n;r--!==0;){const s=o[r];if(!(s==="_owner"&&e.$$typeof)&&!Ds(e[s],t[s]))return!1}return!0}return e!==e&&t!==t}function sh(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function ih(e,t){const n=sh(e);return Math.round(t*n)/n}function Ec(e){const t=z.useRef(e);return Fs(()=>{t.current=e}),t}function ah(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:o,elements:{reference:s,floating:i}={},transform:c=!0,whileElementsMounted:a,open:u}=e,[l,f]=z.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[p,d]=z.useState(r);Ds(p,r)||d(r);const[h,m]=z.useState(null),[v,A]=z.useState(null),w=z.useCallback(b=>{b!==R.current&&(R.current=b,m(b))},[]),T=z.useCallback(b=>{b!==j.current&&(j.current=b,A(b))},[]),B=s||h,F=i||v,R=z.useRef(null),j=z.useRef(null),g=z.useRef(l),y=a!=null,$=Ec(a),k=Ec(o),N=Ec(u),P=z.useCallback(()=>{if(!R.current||!j.current)return;const b={placement:t,strategy:n,middleware:p};k.current&&(b.platform=k.current),u6(R.current,j.current,b).then(M=>{const D={...M,isPositioned:N.current!==!1};S.current&&!Ds(g.current,D)&&(g.current=D,Cr.flushSync(()=>{f(D)}))})},[p,t,n,k,N]);Fs(()=>{u===!1&&g.current.isPositioned&&(g.current.isPositioned=!1,f(b=>({...b,isPositioned:!1})))},[u]);const S=z.useRef(!1);Fs(()=>(S.current=!0,()=>{S.current=!1}),[]),Fs(()=>{if(B&&(R.current=B),F&&(j.current=F),B&&F){if($.current)return $.current(B,F,P);P()}},[B,F,P,$,y]);const E=z.useMemo(()=>({reference:R,floating:j,setReference:w,setFloating:T}),[w,T]),C=z.useMemo(()=>({reference:B,floating:F}),[B,F]),O=z.useMemo(()=>{const b={position:n,left:0,top:0};if(!C.floating)return b;const M=ih(C.floating,l.x),D=ih(C.floating,l.y);return c?{...b,transform:"translate("+M+"px, "+D+"px)",...sh(C.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:M,top:D}},[n,c,C.floating,l.x,l.y]);return z.useMemo(()=>({...l,update:P,refs:E,elements:C,floatingStyles:O}),[l,P,E,C,O])}const d6=e=>{function t(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:e,fn(n){const{element:r,padding:o}=typeof e=="function"?e(n):e;return r&&t(r)?r.current!=null?oh({element:r.current,padding:o}).fn(n):{}:r?oh({element:r,padding:o}).fn(n):{}}}},Sc=(e,t)=>({...s6(e),options:[e,t]}),ch=(e,t)=>({...i6(e),options:[e,t]}),uh=(e,t)=>({...a6(e),options:[e,t]}),p6=(e,t)=>({...c6(e),options:[e,t]}),h6=(e,t)=>({...d6(e),options:[e,t]}),lh={...z},m6=lh.useInsertionEffect||(e=>e());function fh(e){const t=z.useRef(()=>{if(process.env.NODE_ENV!=="production")throw new Error("Cannot call an event handler while rendering.")});return m6(()=>{t.current=e}),z.useCallback(function(){for(var n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return t.current==null?void 0:t.current(...r)},[])}var Pc=typeof document<"u"?x.useLayoutEffect:x.useEffect;let dh=!1,g6=0;const ph=()=>"floating-ui-"+Math.random().toString(36).slice(2,6)+g6++;function b6(){const[e,t]=z.useState(()=>dh?ph():void 0);return Pc(()=>{e==null&&t(ph())},[]),z.useEffect(()=>{dh=!0},[]),e}const y6=lh.useId||b6;let Ao;process.env.NODE_ENV!=="production"&&(Ao=new Set);function w6(){for(var e,t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];const o="Floating UI: "+n.join(" ");if(!((e=Ao)!=null&&e.has(o))){var s;(s=Ao)==null||s.add(o),console.warn(o)}}function v6(){for(var e,t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];const o="Floating UI: "+n.join(" ");if(!((e=Ao)!=null&&e.has(o))){var s;(s=Ao)==null||s.add(o),console.error(o)}}function x6(){const e=new Map;return{emit(t,n){var r;(r=e.get(t))==null||r.forEach(o=>o(n))},on(t,n){e.set(t,[...e.get(t)||[],n])},off(t,n){var r;e.set(t,((r=e.get(t))==null?void 0:r.filter(o=>o!==n))||[])}}}const E6=z.createContext(null),S6=z.createContext(null),P6=()=>{var e;return((e=z.useContext(E6))==null?void 0:e.id)||null},$6=()=>z.useContext(S6),T6="data-floating-ui-focusable";function A6(e){const{open:t=!1,onOpenChange:n,elements:r}=e,o=y6(),s=z.useRef({}),[i]=z.useState(()=>x6()),c=P6()!=null;if(process.env.NODE_ENV!=="production"){const d=r.reference;d&&!fe(d)&&v6("Cannot pass a virtual element to the `elements.reference` option,","as it must be a real DOM element. Use `refs.setPositionReference()`","instead.")}const[a,u]=z.useState(r.reference),l=fh((d,h,m)=>{s.current.openEvent=d?h:void 0,i.emit("openchange",{open:d,event:h,reason:m,nested:c}),n==null||n(d,h,m)}),f=z.useMemo(()=>({setPositionReference:u}),[]),p=z.useMemo(()=>({reference:a||r.reference||null,floating:r.floating||null,domReference:r.reference}),[a,r.reference,r.floating]);return z.useMemo(()=>({dataRef:s,open:t,onOpenChange:l,elements:p,events:i,floatingId:o,refs:f}),[t,l,p,i,o,f])}function O6(e){e===void 0&&(e={});const{nodeId:t}=e,n=A6({...e,elements:{reference:null,floating:null,...e.elements}}),r=e.rootContext||n,o=r.elements,[s,i]=z.useState(null),[c,a]=z.useState(null),l=(o==null?void 0:o.domReference)||s,f=z.useRef(null),p=$6();Pc(()=>{l&&(f.current=l)},[l]);const d=ah({...e,elements:{...o,...c&&{reference:c}}}),h=z.useCallback(T=>{const B=fe(T)?{getBoundingClientRect:()=>T.getBoundingClientRect(),contextElement:T}:T;a(B),d.refs.setReference(B)},[d.refs]),m=z.useCallback(T=>{(fe(T)||T===null)&&(f.current=T,i(T)),(fe(d.refs.reference.current)||d.refs.reference.current===null||T!==null&&!fe(T))&&d.refs.setReference(T)},[d.refs]),v=z.useMemo(()=>({...d.refs,setReference:m,setPositionReference:h,domReference:f}),[d.refs,m,h]),A=z.useMemo(()=>({...d.elements,domReference:l}),[d.elements,l]),w=z.useMemo(()=>({...d,...r,refs:v,elements:A,nodeId:t}),[d,v,A,t,r]);return Pc(()=>{r.dataRef.current.floatingContext=w;const T=p==null?void 0:p.nodesRef.current.find(B=>B.id===t);T&&(T.context=w)}),z.useMemo(()=>({...d,context:w,refs:v,elements:A}),[d,v,A,w])}const hh="active",mh="selected";function $c(e,t,n){const r=new Map,o=n==="item";let s=e;if(o&&e){const{[hh]:i,[mh]:c,...a}=e;s=a}return{...n==="floating"&&{tabIndex:-1,[T6]:""},...s,...t.map(i=>{const c=i?i[n]:null;return typeof c=="function"?e?c(e):null:c}).concat(e).reduce((i,c)=>(c&&Object.entries(c).forEach(a=>{let[u,l]=a;if(!(o&&[hh,mh].includes(u)))if(u.indexOf("on")===0){if(r.has(u)||r.set(u,[]),typeof l=="function"){var f;(f=r.get(u))==null||f.push(l),i[u]=function(){for(var p,d=arguments.length,h=new Array(d),m=0;m<d;m++)h[m]=arguments[m];return(p=r.get(u))==null?void 0:p.map(v=>v(...h)).find(v=>v!==void 0)}}}else i[u]=l}),i),{})}}function C6(e){e===void 0&&(e=[]);const t=e.map(c=>c==null?void 0:c.reference),n=e.map(c=>c==null?void 0:c.floating),r=e.map(c=>c==null?void 0:c.item),o=z.useCallback(c=>$c(c,e,"reference"),t),s=z.useCallback(c=>$c(c,e,"floating"),n),i=z.useCallback(c=>$c(c,e,"item"),r);return z.useMemo(()=>({getReferenceProps:o,getFloatingProps:s,getItemProps:i}),[o,s,i])}function gh(e,t){return{...e,rects:{...e.rects,floating:{...e.rects.floating,height:t}}}}const N6=e=>({name:"inner",options:e,async fn(t){const{listRef:n,overflowRef:r,onFallbackChange:o,offset:s=0,index:i=0,minItemsVisible:c=4,referenceOverflowThreshold:a=0,scrollRef:u,...l}=Wn(e,t),{rects:f,elements:{floating:p}}=t,d=n.current[i],h=(u==null?void 0:u.current)||p,m=p.clientTop||h.clientTop,v=p.clientTop!==0,A=h.clientTop!==0,w=p===h;if(process.env.NODE_ENV!=="production"&&(t.placement.startsWith("bottom")||w6('`placement` side must be "bottom" when using the `inner`',"middleware.")),!d)return{};const T={...t,...await Sc(-d.offsetTop-p.clientTop-f.reference.height/2-d.offsetHeight/2-s).fn(t)},B=await xc(gh(T,h.scrollHeight+m+p.clientTop),l),F=await xc(T,{...l,elementContext:"reference"}),R=Me(0,B.top),j=T.y+R,$=(h.scrollHeight>h.clientHeight?k=>k:$o)(Me(0,h.scrollHeight+(v&&w||A?m*2:0)-R-Me(0,B.bottom)));if(h.style.maxHeight=$+"px",h.scrollTop=R,o){const k=h.offsetHeight<d.offsetHeight*an(c,n.current.length)-1||F.top>=-a||F.bottom>=-a;Cr.flushSync(()=>o(k))}return r&&(r.current=await xc(gh({...T,y:j},h.offsetHeight+m+p.clientTop),l)),{y:j}}});function I6(e,t){const{open:n,elements:r}=e,{enabled:o=!0,overflowRef:s,scrollRef:i,onChange:c}=t,a=fh(c),u=z.useRef(!1),l=z.useRef(null),f=z.useRef(null);z.useEffect(()=>{if(!o)return;function d(m){if(m.ctrlKey||!h||s.current==null)return;const v=m.deltaY,A=s.current.top>=-.5,w=s.current.bottom>=-.5,T=h.scrollHeight-h.clientHeight,B=v<0?-1:1,F=v<0?"max":"min";h.scrollHeight<=h.clientHeight||(!A&&v>0||!w&&v<0?(m.preventDefault(),Cr.flushSync(()=>{a(R=>R+Math[F](v,T*B))})):/firefox/i.test(i2())&&(h.scrollTop+=v))}const h=(i==null?void 0:i.current)||r.floating;if(n&&h)return h.addEventListener("wheel",d),requestAnimationFrame(()=>{l.current=h.scrollTop,s.current!=null&&(f.current={...s.current})}),()=>{l.current=null,f.current=null,h.removeEventListener("wheel",d)}},[o,n,r.floating,s,i,a]);const p=z.useMemo(()=>({onKeyDown(){u.current=!0},onWheel(){u.current=!1},onPointerMove(){u.current=!1},onScroll(){const d=(i==null?void 0:i.current)||r.floating;if(!(!s.current||!d||!u.current)){if(l.current!==null){const h=d.scrollTop-l.current;(s.current.bottom<-.5&&h<-1||s.current.top<-.5&&h>1)&&Cr.flushSync(()=>a(m=>m+h))}requestAnimationFrame(()=>{l.current=d.scrollTop})}}}),[r.floating,a,s,i]);return z.useMemo(()=>o?{floating:p}:{},[o,p])}let Sr=x.createContext({styles:void 0,setReference:()=>{},setFloating:()=>{},getReferenceProps:()=>({}),getFloatingProps:()=>({}),slot:{}});Sr.displayName="FloatingContext";let Tc=x.createContext(null);Tc.displayName="PlacementContext";function M6(e){return x.useMemo(()=>e?typeof e=="string"?{to:e}:e:null,[e])}function k6(){return x.useContext(Sr).setReference}function B6(){return x.useContext(Sr).getReferenceProps}function L6(){let{getFloatingProps:e,slot:t}=x.useContext(Sr);return x.useCallback((...n)=>Object.assign({},e(...n),{"data-anchor":t.anchor}),[e,t])}function F6(e=null){e===!1&&(e=null),typeof e=="string"&&(e={to:e});let t=x.useContext(Tc),n=x.useMemo(()=>e,[JSON.stringify(e,(o,s)=>{var i;return(i=s==null?void 0:s.outerHTML)!=null?i:s})]);ye(()=>{t==null||t(n??null)},[t,n]);let r=x.useContext(Sr);return x.useMemo(()=>[r.setFloating,e?r.styles:{}],[r.setFloating,e,r.styles])}let bh=4;function D6({children:e,enabled:t=!0}){let[n,r]=x.useState(null),[o,s]=x.useState(0),i=x.useRef(null),[c,a]=x.useState(null);R6(c);let u=t&&n!==null&&c!==null,{to:l="bottom",gap:f=0,offset:p=0,padding:d=0,inner:h}=j6(n,c),[m,v="center"]=l.split(" ");ye(()=>{u&&s(0)},[u]);let{refs:A,floatingStyles:w,context:T}=O6({open:u,placement:m==="selection"?v==="center"?"bottom":`bottom-${v}`:v==="center"?`${m}`:`${m}-${v}`,strategy:"absolute",transform:!1,middleware:[Sc({mainAxis:m==="selection"?0:f,crossAxis:p}),ch({padding:d}),m!=="selection"&&uh({padding:d}),m==="selection"&&h?N6({...h,padding:d,overflowRef:i,offset:o,minItemsVisible:bh,referenceOverflowThreshold:d,onFallbackChange(k){var N,P;if(!k)return;let S=T.elements.floating;if(!S)return;let E=parseFloat(getComputedStyle(S).scrollPaddingBottom)||0,C=Math.min(bh,S.childElementCount),O=0,b=0;for(let M of(P=(N=T.elements.floating)==null?void 0:N.childNodes)!=null?P:[])if(rn(M)){let D=M.offsetTop,_=D+M.clientHeight+E,U=S.scrollTop,W=U+S.clientHeight;if(D>=U&&_<=W)C--;else{b=Math.max(0,Math.min(_,W)-Math.max(D,U)),O=M.clientHeight;break}}C>=1&&s(M=>{let D=O*C-b+E;return M>=D?M:D})}}):null,p6({padding:d,apply({availableWidth:k,availableHeight:N,elements:P}){Object.assign(P.floating.style,{overflow:"auto",maxWidth:`${k}px`,maxHeight:`min(var(--anchor-max-height, 100vh), ${N}px)`})}})].filter(Boolean),whileElementsMounted:rh}),[B=m,F=v]=T.placement.split("-");m==="selection"&&(B="selection");let R=x.useMemo(()=>({anchor:[B,F].filter(Boolean).join(" ")}),[B,F]),j=I6(T,{overflowRef:i,onChange:s}),{getReferenceProps:g,getFloatingProps:y}=C6([j]),$=ce(k=>{a(k),A.setFloating(k)});return z.createElement(Tc.Provider,{value:r},z.createElement(Sr.Provider,{value:{setFloating:$,setReference:A.setReference,styles:w,getReferenceProps:g,getFloatingProps:y,slot:R}},e))}function R6(e){ye(()=>{if(!e)return;let t=new MutationObserver(()=>{let n=window.getComputedStyle(e).maxHeight,r=parseFloat(n);if(isNaN(r))return;let o=parseInt(n);isNaN(o)||r!==o&&(e.style.maxHeight=`${Math.ceil(r)}px`)});return t.observe(e,{attributes:!0,attributeFilter:["style"]}),()=>{t.disconnect()}},[e])}function j6(e,t){var n,r,o;let s=Ac((n=e==null?void 0:e.gap)!=null?n:"var(--anchor-gap, 0)",t),i=Ac((r=e==null?void 0:e.offset)!=null?r:"var(--anchor-offset, 0)",t),c=Ac((o=e==null?void 0:e.padding)!=null?o:"var(--anchor-padding, 0)",t);return{...e,gap:s,offset:i,padding:c}}function Ac(e,t,n=void 0){let r=br(),o=ce((a,u)=>{if(a==null)return[n,null];if(typeof a=="number")return[a,null];if(typeof a=="string"){if(!u)return[n,null];let l=wh(a,u);return[l,f=>{let p=yh(a);{let d=p.map(h=>window.getComputedStyle(u).getPropertyValue(h));r.requestAnimationFrame(function h(){r.nextFrame(h);let m=!1;for(let[A,w]of p.entries()){let T=window.getComputedStyle(u).getPropertyValue(w);if(d[A]!==T){d[A]=T,m=!0;break}}if(!m)return;let v=wh(a,u);l!==v&&(f(v),l=v)})}return r.dispose}]}return[n,null]}),s=x.useMemo(()=>o(e,t)[0],[e,t]),[i=s,c]=x.useState();return ye(()=>{let[a,u]=o(e,t);if(c(a),!!u)return u(c)},[e,t]),i}function yh(e){let t=/var\((.*)\)/.exec(e);if(t){let n=t[1].indexOf(",");if(n===-1)return[t[1]];let r=t[1].slice(0,n).trim(),o=t[1].slice(n+1).trim();return o?[r,...yh(o)]:[r]}return[]}function wh(e,t){let n=document.createElement("div");t.appendChild(n),n.style.setProperty("margin-top","0px","important"),n.style.setProperty("margin-top",e,"important");let r=parseFloat(window.getComputedStyle(n).marginTop)||0;return t.removeChild(n),r}function _6(e,t){let[n,r]=x.useState(t);return!e&&n!==t&&r(t),e?n:t}let Oc=x.createContext(null);Oc.displayName="OpenClosedContext";var $t=(e=>(e[e.Open=1]="Open",e[e.Closed=2]="Closed",e[e.Closing=4]="Closing",e[e.Opening=8]="Opening",e))($t||{});function Cc(){return x.useContext(Oc)}function vh({value:e,children:t}){return x.createElement(Oc.Provider,{value:e},t)}function U6(e){throw new Error("Unexpected object: "+e)}var ve=(e=>(e[e.First=0]="First",e[e.Previous=1]="Previous",e[e.Next=2]="Next",e[e.Last=3]="Last",e[e.Specific=4]="Specific",e[e.Nothing=5]="Nothing",e))(ve||{});function Rs(e,t){let n=t.resolveItems();if(n.length<=0)return null;let r=t.resolveActiveIndex(),o=r??-1;switch(e.focus){case 0:{for(let s=0;s<n.length;++s)if(!t.resolveDisabled(n[s],s,n))return s;return r}case 1:{o===-1&&(o=n.length);for(let s=o-1;s>=0;--s)if(!t.resolveDisabled(n[s],s,n))return s;return r}case 2:{for(let s=o+1;s<n.length;++s)if(!t.resolveDisabled(n[s],s,n))return s;return r}case 3:{for(let s=n.length-1;s>=0;--s)if(!t.resolveDisabled(n[s],s,n))return s;return r}case 4:{for(let s=0;s<n.length;++s)if(t.resolveId(n[s],s,n)===e.id)return s;return r}case 5:return null;default:U6(e)}}var xh=(e=>(e[e.Left=0]="Left",e[e.Right=2]="Right",e))(xh||{});function Eh(e){let t=ce(e),n=x.useRef(!1);x.useEffect(()=>(n.current=!1,()=>{n.current=!0,Kd(()=>{n.current&&t()})}),[t])}function z6(){let e=typeof document>"u";return"useSyncExternalStore"in z?(t=>t.useSyncExternalStore)(z)(()=>()=>{},()=>!1,()=>!e):!1}function Nc(){let e=z6(),[t,n]=z.useState(Bt.isHandoffComplete);return t&&Bt.isHandoffComplete===!1&&n(!1),z.useEffect(()=>{t!==!0&&n(!0)},[t]),z.useEffect(()=>Bt.handoff(),[]),e?!1:t}let H6=x.createContext(!1);function W6(){return x.useContext(H6)}function V6(e){let t=W6(),n=x.useContext(Ph),[r,o]=x.useState(()=>{var s;if(!t&&n!==null)return(s=n.current)!=null?s:null;if(Bt.isServer)return null;let i=e==null?void 0:e.getElementById("headlessui-portal-root");if(i)return i;if(e===null)return null;let c=e.createElement("div");return c.setAttribute("id","headlessui-portal-root"),e.body.appendChild(c)});return x.useEffect(()=>{r!==null&&(e!=null&&e.body.contains(r)||e==null||e.body.appendChild(r))},[r,e]),x.useEffect(()=>{t||n!==null&&o(n.current)},[n,o,t]),r}let Sh=x.Fragment,G6=ze(function(e,t){let{ownerDocument:n=null,...r}=e,o=x.useRef(null),s=st(Zx(d=>{o.current=d}),t),i=uc(o),c=n??i,a=V6(c),[u]=x.useState(()=>{var d;return Bt.isServer?null:(d=c==null?void 0:c.createElement("div"))!=null?d:null}),l=x.useContext(Y6),f=Nc();ye(()=>{!a||!u||a.contains(u)||(u.setAttribute("data-headlessui-portal",""),a.appendChild(u))},[a,u]),ye(()=>{if(u&&l)return l.register(u)},[l,u]),Eh(()=>{var d;!a||!u||(Ya(u)&&a.contains(u)&&a.removeChild(u),a.childNodes.length<=0&&((d=a.parentElement)==null||d.removeChild(a)))});let p=Ye();return f?!a||!u?null:ke.createPortal(p({ourProps:{ref:s},theirProps:r,slot:{},defaultTag:Sh,name:"Portal"}),u):null});function q6(e,t){let n=st(t),{enabled:r=!0,ownerDocument:o,...s}=e,i=Ye();return r?x.createElement(G6,{...s,ownerDocument:o,ref:n}):i({ourProps:{ref:n},theirProps:s,slot:{},defaultTag:Sh,name:"Portal"})}let Z6=x.Fragment,Ph=x.createContext(null);function K6(e,t){let{target:n,...r}=e,o={ref:st(t)},s=Ye();return x.createElement(Ph.Provider,{value:n},s({ourProps:o,theirProps:r,defaultTag:Z6,name:"Popover.Group"}))}let Y6=x.createContext(null),X6=ze(q6),Q6=ze(K6),J6=Object.assign(X6,{Group:Q6});function e5(){let e=x.useRef(!1);return ye(()=>(e.current=!0,()=>{e.current=!1}),[]),e}function $h(e){var t;return!!(e.enter||e.enterFrom||e.enterTo||e.leave||e.leaveFrom||e.leaveTo)||((t=e.as)!=null?t:Ah)!==x.Fragment||x.Children.count(e.children)===1}let js=x.createContext(null);js.displayName="TransitionContext";var t5=(e=>(e.Visible="visible",e.Hidden="hidden",e))(t5||{});function n5(){let e=x.useContext(js);if(e===null)throw new Error("A <Transition.Child /> is used but it is missing a parent <Transition /> or <Transition.Root />.");return e}function r5(){let e=x.useContext(_s);if(e===null)throw new Error("A <Transition.Child /> is used but it is missing a parent <Transition /> or <Transition.Root />.");return e}let _s=x.createContext(null);_s.displayName="NestingContext";function Us(e){return"children"in e?Us(e.children):e.current.filter(({el:t})=>t.current!==null).filter(({state:t})=>t==="visible").length>0}function Th(e,t){let n=zn(e),r=x.useRef([]),o=e5(),s=br(),i=ce((d,h=yn.Hidden)=>{let m=r.current.findIndex(({el:v})=>v===d);m!==-1&&(ot(h,{[yn.Unmount](){r.current.splice(m,1)},[yn.Hidden](){r.current[m].state="hidden"}}),s.microTask(()=>{var v;!Us(r)&&o.current&&((v=n.current)==null||v.call(n))}))}),c=ce(d=>{let h=r.current.find(({el:m})=>m===d);return h?h.state!=="visible"&&(h.state="visible"):r.current.push({el:d,state:"visible"}),()=>i(d,yn.Unmount)}),a=x.useRef([]),u=x.useRef(Promise.resolve()),l=x.useRef({enter:[],leave:[]}),f=ce((d,h,m)=>{a.current.splice(0),t&&(t.chains.current[h]=t.chains.current[h].filter(([v])=>v!==d)),t==null||t.chains.current[h].push([d,new Promise(v=>{a.current.push(v)})]),t==null||t.chains.current[h].push([d,new Promise(v=>{Promise.all(l.current[h].map(([A,w])=>w)).then(()=>v())})]),h==="enter"?u.current=u.current.then(()=>t==null?void 0:t.wait.current).then(()=>m(h)):m(h)}),p=ce((d,h,m)=>{Promise.all(l.current[h].splice(0).map(([v,A])=>A)).then(()=>{var v;(v=a.current.shift())==null||v()}).then(()=>m(h))});return x.useMemo(()=>({children:r,register:c,unregister:i,onStart:f,onStop:p,wait:u,chains:l}),[c,i,r,f,p,l,u])}let Ah=x.Fragment,Oh=vs.RenderStrategy;function o5(e,t){var n,r;let{transition:o=!0,beforeEnter:s,afterEnter:i,beforeLeave:c,afterLeave:a,enter:u,enterFrom:l,enterTo:f,entered:p,leave:d,leaveFrom:h,leaveTo:m,...v}=e,[A,w]=x.useState(null),T=x.useRef(null),B=$h(e),F=st(...B?[T,t,w]:t===null?[]:[t]),R=(n=v.unmount)==null||n?yn.Unmount:yn.Hidden,{show:j,appear:g,initial:y}=n5(),[$,k]=x.useState(j?"visible":"hidden"),N=r5(),{register:P,unregister:S}=N;ye(()=>P(T),[P,T]),ye(()=>{if(R===yn.Hidden&&T.current){if(j&&$!=="visible"){k("visible");return}return ot($,{hidden:()=>S(T),visible:()=>P(T)})}},[$,T,P,S,j,R]);let E=Nc();ye(()=>{if(B&&E&&$==="visible"&&T.current===null)throw new Error("Did you forget to passthrough the `ref` to the actual DOM node?")},[T,$,E,B]);let C=y&&!g,O=g&&j&&y,b=x.useRef(!1),M=Th(()=>{b.current||(k("hidden"),S(T))},N),D=ce(H=>{b.current=!0;let Q=H?"enter":"leave";M.onStart(T,Q,X=>{X==="enter"?s==null||s():X==="leave"&&(c==null||c())})}),_=ce(H=>{let Q=H?"enter":"leave";b.current=!1,M.onStop(T,Q,X=>{X==="enter"?i==null||i():X==="leave"&&(a==null||a())}),Q==="leave"&&!Us(M)&&(k("hidden"),S(T))});x.useEffect(()=>{B&&o||(D(j),_(j))},[j,B,o]);let U=!(!o||!B||!E||C),[,W]=Bp(U,A,j,{start:D,end:_}),K=wn({ref:F,className:((r=qa(v.className,O&&u,O&&l,W.enter&&u,W.enter&&W.closed&&l,W.enter&&!W.closed&&f,W.leave&&d,W.leave&&!W.closed&&h,W.leave&&W.closed&&m,!W.transition&&j&&p))==null?void 0:r.trim())||void 0,...kp(W)}),V=0;$==="visible"&&(V|=$t.Open),$==="hidden"&&(V|=$t.Closed),j&&$==="hidden"&&(V|=$t.Opening),!j&&$==="visible"&&(V|=$t.Closing);let Z=Ye();return x.createElement(_s.Provider,{value:M},x.createElement(vh,{value:V},Z({ourProps:K,theirProps:v,defaultTag:Ah,features:Oh,visible:$==="visible",name:"Transition.Child"})))}function s5(e,t){let{show:n,appear:r=!1,unmount:o=!0,...s}=e,i=x.useRef(null),c=$h(e),a=st(...c?[i,t]:t===null?[]:[t]);Nc();let u=Cc();if(n===void 0&&u!==null&&(n=(u&$t.Open)===$t.Open),n===void 0)throw new Error("A <Transition /> is used but it is missing a `show={true | false}` prop.");let[l,f]=x.useState(n?"visible":"hidden"),p=Th(()=>{n||f("hidden")}),[d,h]=x.useState(!0),m=x.useRef([n]);ye(()=>{d!==!1&&m.current[m.current.length-1]!==n&&(m.current.push(n),h(!1))},[m,n]);let v=x.useMemo(()=>({show:n,appear:r,initial:d}),[n,r,d]);ye(()=>{n?f("visible"):!Us(p)&&i.current!==null&&f("hidden")},[n,p]);let A={unmount:o},w=ce(()=>{var F;d&&h(!1),(F=e.beforeEnter)==null||F.call(e)}),T=ce(()=>{var F;d&&h(!1),(F=e.beforeLeave)==null||F.call(e)}),B=Ye();return x.createElement(_s.Provider,{value:p},x.createElement(js.Provider,{value:v},B({ourProps:{...A,as:x.Fragment,children:x.createElement(Ch,{ref:a,...A,...s,beforeEnter:w,beforeLeave:T})},theirProps:{},defaultTag:x.Fragment,features:Oh,visible:l==="visible",name:"Transition"})))}function i5(e,t){let n=x.useContext(js)!==null,r=Cc()!==null;return x.createElement(x.Fragment,null,!n&&r?x.createElement(Ic,{ref:t,...e}):x.createElement(Ch,{ref:t,...e}))}let Ic=ze(s5),Ch=ze(o5),a5=ze(i5),Mc=Object.assign(Ic,{Child:a5,Root:Ic});function c5(e,t){let n=x.useRef({left:0,top:0});if(ye(()=>{if(!t)return;let o=t.getBoundingClientRect();o&&(n.current=o)},[e,t]),t==null||!e||t===document.activeElement)return!1;let r=t.getBoundingClientRect();return r.top!==n.current.top||r.left!==n.current.left}let Nh=/([\u2700-\u27BF]|[\uE000-\uF8FF]|\uD83C[\uDC00-\uDFFF]|\uD83D[\uDC00-\uDFFF]|[\u2011-\u26FF]|\uD83E[\uDD10-\uDDFF])/g;function Ih(e){var t,n;let r=(t=e.innerText)!=null?t:"",o=e.cloneNode(!0);if(!rn(o))return r;let s=!1;for(let c of o.querySelectorAll('[hidden],[aria-hidden],[role="img"]'))c.remove(),s=!0;let i=s?(n=o.innerText)!=null?n:"":r;return Nh.test(i)&&(i=i.replace(Nh,"")),i}function u5(e){let t=e.getAttribute("aria-label");if(typeof t=="string")return t.trim();let n=e.getAttribute("aria-labelledby");if(n){let r=n.split(" ").map(o=>{let s=document.getElementById(o);if(s){let i=s.getAttribute("aria-label");return typeof i=="string"?i.trim():Ih(s).trim()}return null}).filter(Boolean);if(r.length>0)return r.join(", ")}return Ih(e).trim()}function l5(e){let t=x.useRef(""),n=x.useRef("");return ce(()=>{let r=e.current;if(!r)return"";let o=r.innerText;if(t.current===o)return n.current;let s=u5(r).trim().toLowerCase();return t.current=o,n.current=s,s})}var f5=Object.defineProperty,d5=(e,t,n)=>t in e?f5(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Mh=(e,t,n)=>(d5(e,typeof t!="symbol"?t+"":t,n),n),Ce=(e=>(e[e.Open=0]="Open",e[e.Closed=1]="Closed",e))(Ce||{}),Rt=(e=>(e[e.Single=0]="Single",e[e.Multi=1]="Multi",e))(Rt||{}),zs=(e=>(e[e.Pointer=0]="Pointer",e[e.Other=1]="Other",e))(zs||{}),kh=(e=>(e[e.OpenListbox=0]="OpenListbox",e[e.CloseListbox=1]="CloseListbox",e[e.GoToOption=2]="GoToOption",e[e.Search=3]="Search",e[e.ClearSearch=4]="ClearSearch",e[e.RegisterOptions=5]="RegisterOptions",e[e.UnregisterOptions=6]="UnregisterOptions",e[e.SetButtonElement=7]="SetButtonElement",e[e.SetOptionsElement=8]="SetOptionsElement",e[e.SortOptions=9]="SortOptions",e))(kh||{});function Bh(e,t=n=>n){let n=e.activeOptionIndex!==null?e.options[e.activeOptionIndex]:null,r=$p(t(e.options.slice()),s=>s.dataRef.current.domRef.current),o=n?r.indexOf(n):null;return o===-1&&(o=null),{options:r,activeOptionIndex:o}}let p5={1(e){return e.dataRef.current.disabled||e.listboxState===1?e:{...e,activeOptionIndex:null,pendingFocus:{focus:ve.Nothing},listboxState:1,__demoMode:!1}},0(e,t){if(e.dataRef.current.disabled||e.listboxState===0)return e;let n=e.activeOptionIndex,{isSelected:r}=e.dataRef.current,o=e.options.findIndex(s=>r(s.dataRef.current.value));return o!==-1&&(n=o),{...e,pendingFocus:t.focus,listboxState:0,activeOptionIndex:n,__demoMode:!1}},2(e,t){var n,r,o,s,i;if(e.dataRef.current.disabled||e.listboxState===1)return e;let c={...e,searchQuery:"",activationTrigger:(n=t.trigger)!=null?n:1,__demoMode:!1};if(t.focus===ve.Nothing)return{...c,activeOptionIndex:null};if(t.focus===ve.Specific)return{...c,activeOptionIndex:e.options.findIndex(l=>l.id===t.id)};if(t.focus===ve.Previous){let l=e.activeOptionIndex;if(l!==null){let f=e.options[l].dataRef.current.domRef,p=Rs(t,{resolveItems:()=>e.options,resolveActiveIndex:()=>e.activeOptionIndex,resolveId:d=>d.id,resolveDisabled:d=>d.dataRef.current.disabled});if(p!==null){let d=e.options[p].dataRef.current.domRef;if(((r=f.current)==null?void 0:r.previousElementSibling)===d.current||((o=d.current)==null?void 0:o.previousElementSibling)===null)return{...c,activeOptionIndex:p}}}}else if(t.focus===ve.Next){let l=e.activeOptionIndex;if(l!==null){let f=e.options[l].dataRef.current.domRef,p=Rs(t,{resolveItems:()=>e.options,resolveActiveIndex:()=>e.activeOptionIndex,resolveId:d=>d.id,resolveDisabled:d=>d.dataRef.current.disabled});if(p!==null){let d=e.options[p].dataRef.current.domRef;if(((s=f.current)==null?void 0:s.nextElementSibling)===d.current||((i=d.current)==null?void 0:i.nextElementSibling)===null)return{...c,activeOptionIndex:p}}}}let a=Bh(e),u=Rs(t,{resolveItems:()=>a.options,resolveActiveIndex:()=>a.activeOptionIndex,resolveId:l=>l.id,resolveDisabled:l=>l.dataRef.current.disabled});return{...c,...a,activeOptionIndex:u}},3:(e,t)=>{if(e.dataRef.current.disabled||e.listboxState===1)return e;let n=e.searchQuery!==""?0:1,r=e.searchQuery+t.value.toLowerCase(),o=(e.activeOptionIndex!==null?e.options.slice(e.activeOptionIndex+n).concat(e.options.slice(0,e.activeOptionIndex+n)):e.options).find(i=>{var c;return!i.dataRef.current.disabled&&((c=i.dataRef.current.textValue)==null?void 0:c.startsWith(r))}),s=o?e.options.indexOf(o):-1;return s===-1||s===e.activeOptionIndex?{...e,searchQuery:r}:{...e,searchQuery:r,activeOptionIndex:s,activationTrigger:1}},4(e){return e.dataRef.current.disabled||e.listboxState===1||e.searchQuery===""?e:{...e,searchQuery:""}},5:(e,t)=>{let n=e.options.concat(t.options),r=e.activeOptionIndex;if(e.pendingFocus.focus!==ve.Nothing&&(r=Rs(e.pendingFocus,{resolveItems:()=>n,resolveActiveIndex:()=>e.activeOptionIndex,resolveId:o=>o.id,resolveDisabled:o=>o.dataRef.current.disabled})),e.activeOptionIndex===null){let{isSelected:o}=e.dataRef.current;if(o){let s=n.findIndex(i=>o==null?void 0:o(i.dataRef.current.value));s!==-1&&(r=s)}}return{...e,options:n,activeOptionIndex:r,pendingFocus:{focus:ve.Nothing},pendingShouldSort:!0}},6:(e,t)=>{let n=e.options,r=[],o=new Set(t.options);for(let[s,i]of n.entries())if(o.has(i.id)&&(r.push(s),o.delete(i.id),o.size===0))break;if(r.length>0){n=n.slice();for(let s of r.reverse())n.splice(s,1)}return{...e,options:n,activationTrigger:1}},7:(e,t)=>e.buttonElement===t.element?e:{...e,buttonElement:t.element},8:(e,t)=>e.optionsElement===t.element?e:{...e,optionsElement:t.element},9:e=>e.pendingShouldSort?{...e,...Bh(e),pendingShouldSort:!1}:e};class kc extends pp{constructor(t){super(t),Mh(this,"actions",{onChange:n=>{let{onChange:r,compare:o,mode:s,value:i}=this.state.dataRef.current;return ot(s,{0:()=>r==null?void 0:r(n),1:()=>{let c=i.slice(),a=c.findIndex(u=>o(u,n));return a===-1?c.push(n):c.splice(a,1),r==null?void 0:r(c)}})},registerOption:ec(()=>{let n=[],r=new Set;return[(o,s)=>{r.has(s)||(r.add(s),n.push({id:o,dataRef:s}))},()=>(r.clear(),this.send({type:5,options:n.splice(0)}))]}),unregisterOption:ec(()=>{let n=[];return[r=>n.push(r),()=>{this.send({type:6,options:n.splice(0)})}]}),goToOption:ec(()=>{let n=null;return[(r,o)=>{n={type:2,...r,trigger:o}},()=>n&&this.send(n)]}),closeListbox:()=>{this.send({type:1})},openListbox:n=>{this.send({type:0,focus:n})},selectActiveOption:()=>{if(this.state.activeOptionIndex!==null){let{dataRef:n,id:r}=this.state.options[this.state.activeOptionIndex];this.actions.onChange(n.current.value),this.send({type:2,focus:ve.Specific,id:r})}},selectOption:n=>{let r=this.state.options.find(o=>o.id===n);r&&this.actions.onChange(r.dataRef.current.value)},search:n=>{this.send({type:3,value:n})},clearSearch:()=>{this.send({type:4})},setButtonElement:n=>{this.send({type:7,element:n})},setOptionsElement:n=>{this.send({type:8,element:n})}}),Mh(this,"selectors",{activeDescendantId(n){var r;let o=n.activeOptionIndex,s=n.options;return o===null||(r=s[o])==null?void 0:r.id},isActive(n,r){var o;let s=n.activeOptionIndex,i=n.options;return s!==null?((o=i[s])==null?void 0:o.id)===r:!1},shouldScrollIntoView(n,r){return n.__demoMode||n.listboxState!==0||n.activationTrigger===0?!1:this.isActive(n,r)}}),this.on(5,()=>{requestAnimationFrame(()=>{this.send({type:9})})});{let n=this.state.id,r=tc.get(null);this.disposables.add(r.on(bp.Push,o=>{!r.selectors.isTop(o,n)&&this.state.listboxState===0&&this.actions.closeListbox()})),this.on(0,()=>r.actions.push(n)),this.on(1,()=>r.actions.pop(n))}}static new({id:t,__demoMode:n=!1}){return new kc({id:t,dataRef:{current:{}},listboxState:n?0:1,options:[],searchQuery:"",activeOptionIndex:null,activationTrigger:1,buttonElement:null,optionsElement:null,pendingShouldSort:!1,pendingFocus:{focus:ve.Nothing},__demoMode:n})}reduce(t,n){return ot(n.type,p5,t,n)}}const Lh=x.createContext(null);function Bc(e){let t=x.useContext(Lh);if(t===null){let n=new Error(`<${e} /> is missing a parent <Listbox /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,Fh),n}return t}function Fh({id:e,__demoMode:t=!1}){let n=x.useMemo(()=>kc.new({id:e,__demoMode:t}),[]);return Eh(()=>n.dispose()),n}let Hs=x.createContext(null);Hs.displayName="ListboxDataContext";function Oo(e){let t=x.useContext(Hs);if(t===null){let n=new Error(`<${e} /> is missing a parent <Listbox /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,Oo),n}return t}let h5=x.Fragment;function m5(e,t){let n=x.useId(),r=Ga(),{value:o,defaultValue:s,form:i,name:c,onChange:a,by:u,invalid:l=!1,disabled:f=r||!1,horizontal:p=!1,multiple:d=!1,__demoMode:h=!1,...m}=e;const v=p?"horizontal":"vertical";let A=st(t),w=kx(s),[T=d?[]:void 0,B]=Mx(o,a,w),F=Fh({id:n,__demoMode:h}),R=x.useRef({static:!1,hold:!1}),j=x.useRef(new Map),g=sE(u),y=x.useCallback(U=>ot($.mode,{[Rt.Multi]:()=>T.some(W=>g(W,U)),[Rt.Single]:()=>g(T,U)}),[T]),$=x.useMemo(()=>({value:T,disabled:f,invalid:l,mode:d?Rt.Multi:Rt.Single,orientation:v,onChange:B,compare:g,isSelected:y,optionsPropsRef:R,listRef:j}),[T,f,l,d,v,B,g,y,R,j]);ye(()=>{F.state.dataRef.current=$},[$]);let k=at(F,U=>U.listboxState),N=tc.get(null),P=at(N,x.useCallback(U=>N.selectors.isTop(U,n),[N,n])),[S,E]=at(F,U=>[U.buttonElement,U.optionsElement]);ME(P,[S,E],(U,W)=>{F.send({type:kh.CloseListbox}),Pp(W,cc.Loose)||(U.preventDefault(),S==null||S.focus())});let C=x.useMemo(()=>({open:k===Ce.Open,disabled:f,invalid:l,value:T}),[k,f,l,T]),[O,b]=Jx({inherit:!0}),M={ref:A},D=x.useCallback(()=>{if(w!==void 0)return B==null?void 0:B(w)},[B,w]),_=Ye();return x.createElement(b,{value:O,props:{htmlFor:S==null?void 0:S.id},slot:{open:k===Ce.Open,disabled:f}},x.createElement(D6,null,x.createElement(Lh.Provider,{value:F},x.createElement(Hs.Provider,{value:$},x.createElement(vh,{value:ot(k,{[Ce.Open]:$t.Open,[Ce.Closed]:$t.Closed})},c!=null&&T!=null&&x.createElement(jx,{disabled:f,data:{[c]:T},form:i,onReset:D}),_({ourProps:M,theirProps:m,slot:C,defaultTag:h5,name:"Listbox"}))))))}let g5="button";function b5(e,t){let n=x.useId(),r=np(),o=Oo("Listbox.Button"),s=Bc("Listbox.Button"),{id:i=r||`headlessui-listbox-button-${n}`,disabled:c=o.disabled||!1,autoFocus:a=!1,...u}=e,l=st(t,k6(),s.actions.setButtonElement),f=B6(),[p,d,h]=at(s,b=>[b.listboxState,b.buttonElement,b.optionsElement]),m=p===Ce.Open;LE(m,{trigger:d,action:x.useCallback(b=>{if(d!=null&&d.contains(b.target))return Ps.Ignore;let M=b.target.closest('[role="option"]:not([data-disabled])');return rn(M)?Ps.Select(M):h!=null&&h.contains(b.target)?Ps.Ignore:Ps.Close},[d,h]),close:s.actions.closeListbox,select:s.actions.selectActiveOption});let v=ce(b=>{switch(b.key){case Oe.Enter:Bx(b.currentTarget);break;case Oe.Space:case Oe.ArrowDown:b.preventDefault(),s.actions.openListbox({focus:o.value?ve.Nothing:ve.First});break;case Oe.ArrowUp:b.preventDefault(),s.actions.openListbox({focus:o.value?ve.Nothing:ve.Last});break}}),A=ce(b=>{switch(b.key){case Oe.Space:b.preventDefault();break}}),w=ce(b=>{var M;if(b.button===xh.Left){if(Gx(b.currentTarget))return b.preventDefault();s.state.listboxState===Ce.Open?(ke.flushSync(()=>s.actions.closeListbox()),(M=s.state.buttonElement)==null||M.focus({preventScroll:!0})):(b.preventDefault(),s.actions.openListbox({focus:ve.Nothing}))}}),T=x.useRef(null),B=ce(b=>{T.current=b.pointerType,b.pointerType==="mouse"&&w(b)}),F=ce(b=>{T.current!=="mouse"&&w(b)}),R=ce(b=>b.preventDefault()),j=up([i]),g=Kx(),{isFocusVisible:y,focusProps:$}=vx({autoFocus:a}),{isHovered:k,hoverProps:N}=wx({isDisabled:c}),{pressed:P,pressProps:S}=Tx({disabled:c}),E=x.useMemo(()=>({open:p===Ce.Open,active:P||p===Ce.Open,disabled:c,invalid:o.invalid,value:o.value,hover:k,focus:y,autofocus:a}),[p,o.value,c,k,y,P,o.invalid,a]),C=at(s,b=>b.listboxState===Ce.Open),O=Xd(f(),{ref:l,id:i,type:FE(e,d),"aria-haspopup":"listbox","aria-controls":h==null?void 0:h.id,"aria-expanded":C,"aria-labelledby":j,"aria-describedby":g,disabled:c||void 0,autoFocus:a,onKeyDown:v,onKeyUp:A,onKeyPress:R,onPointerDown:B,onClick:F},$,N,S);return Ye()({ourProps:O,theirProps:u,slot:E,defaultTag:g5,name:"Listbox.Button"})}let Dh=x.createContext(!1),y5="div",w5=vs.RenderStrategy|vs.Static;function v5(e,t){let n=x.useId(),{id:r=`headlessui-listbox-options-${n}`,anchor:o,portal:s=!1,modal:i=!0,transition:c=!1,...a}=e,u=M6(o),[l,f]=x.useState(null);u&&(s=!0);let p=Oo("Listbox.Options"),d=Bc("Listbox.Options"),[h,m,v,A]=at(d,H=>[H.listboxState,H.buttonElement,H.optionsElement,H.__demoMode]),w=uc(m),T=uc(v),B=Cc(),[F,R]=Bp(c,l,B!==null?(B&$t.Open)===$t.Open:h===Ce.Open);vE(F,m,d.actions.closeListbox);let j=A?!1:i&&h===Ce.Open;WE(j,T);let g=A?!1:i&&h===Ce.Open;wE(g,{allowed:x.useCallback(()=>[m,v],[m,v])});let y=h!==Ce.Open,$=c5(y,m)?!1:F,k=F&&h===Ce.Closed,N=_6(k,p.value),P=ce(H=>p.compare(N,H)),S=at(d,H=>{var Q;if(u==null||!((Q=u==null?void 0:u.to)!=null&&Q.includes("selection")))return null;let X=H.options.findIndex(se=>P(se.dataRef.current.value));return X===-1&&(X=0),X}),E=(()=>{if(u==null)return;if(S===null)return{...u,inner:void 0};let H=Array.from(p.listRef.current.values());return{...u,inner:{listRef:{current:H},index:S}}})(),[C,O]=F6(E),b=L6(),M=st(t,u?C:null,d.actions.setOptionsElement,f),D=br();x.useEffect(()=>{var H;let Q=v;Q&&h===Ce.Open&&Q!==((H=vo(Q))==null?void 0:H.activeElement)&&(Q==null||Q.focus({preventScroll:!0}))},[h,v]);let _=ce(H=>{var Q,X;switch(D.dispose(),H.key){case Oe.Space:if(d.state.searchQuery!=="")return H.preventDefault(),H.stopPropagation(),d.actions.search(H.key);case Oe.Enter:if(H.preventDefault(),H.stopPropagation(),d.state.activeOptionIndex!==null){let{dataRef:se}=d.state.options[d.state.activeOptionIndex];d.actions.onChange(se.current.value)}p.mode===Rt.Single&&(ke.flushSync(()=>d.actions.closeListbox()),(Q=d.state.buttonElement)==null||Q.focus({preventScroll:!0}));break;case ot(p.orientation,{vertical:Oe.ArrowDown,horizontal:Oe.ArrowRight}):return H.preventDefault(),H.stopPropagation(),d.actions.goToOption({focus:ve.Next});case ot(p.orientation,{vertical:Oe.ArrowUp,horizontal:Oe.ArrowLeft}):return H.preventDefault(),H.stopPropagation(),d.actions.goToOption({focus:ve.Previous});case Oe.Home:case Oe.PageUp:return H.preventDefault(),H.stopPropagation(),d.actions.goToOption({focus:ve.First});case Oe.End:case Oe.PageDown:return H.preventDefault(),H.stopPropagation(),d.actions.goToOption({focus:ve.Last});case Oe.Escape:H.preventDefault(),H.stopPropagation(),ke.flushSync(()=>d.actions.closeListbox()),(X=d.state.buttonElement)==null||X.focus({preventScroll:!0});return;case Oe.Tab:H.preventDefault(),H.stopPropagation(),ke.flushSync(()=>d.actions.closeListbox()),OE(d.state.buttonElement,H.shiftKey?ac.Previous:ac.Next);break;default:H.key.length===1&&(d.actions.search(H.key),D.setTimeout(()=>d.actions.clearSearch(),350));break}}),U=at(d,H=>{var Q;return(Q=H.buttonElement)==null?void 0:Q.id}),W=x.useMemo(()=>({open:h===Ce.Open}),[h]),K=Xd(u?b():{},{id:r,ref:M,"aria-activedescendant":at(d,d.selectors.activeDescendantId),"aria-multiselectable":p.mode===Rt.Multi?!0:void 0,"aria-labelledby":U,"aria-orientation":p.orientation,onKeyDown:_,role:"listbox",tabIndex:h===Ce.Open?0:void 0,style:{...a.style,...O,"--button-width":aE(m,!0).width},...kp(R)}),V=Ye(),Z=x.useMemo(()=>p.mode===Rt.Multi?p:{...p,isSelected:P},[p,P]);return x.createElement(J6,{enabled:s?e.static||F:!1,ownerDocument:w},x.createElement(Hs.Provider,{value:Z},V({ourProps:K,theirProps:a,slot:W,defaultTag:y5,features:w5,visible:$,name:"Listbox.Options"})))}let x5="div";function E5(e,t){let n=x.useId(),{id:r=`headlessui-listbox-option-${n}`,disabled:o=!1,value:s,...i}=e,c=x.useContext(Dh)===!0,a=Oo("Listbox.Option"),u=Bc("Listbox.Option"),l=at(u,$=>u.selectors.isActive($,r)),f=a.isSelected(s),p=x.useRef(null),d=l5(p),h=zn({disabled:o,value:s,domRef:p,get textValue(){return d()}}),m=st(t,p,$=>{$?a.listRef.current.set(r,$):a.listRef.current.delete(r)}),v=at(u,$=>u.selectors.shouldScrollIntoView($,r));ye(()=>{if(v)return Pt().requestAnimationFrame(()=>{var $,k;(k=($=p.current)==null?void 0:$.scrollIntoView)==null||k.call($,{block:"nearest"})})},[v,p]),ye(()=>{if(!c)return u.actions.registerOption(r,h),()=>u.actions.unregisterOption(r)},[h,r,c]);let A=ce($=>{var k;if(o)return $.preventDefault();u.actions.onChange(s),a.mode===Rt.Single&&(ke.flushSync(()=>u.actions.closeListbox()),(k=u.state.buttonElement)==null||k.focus({preventScroll:!0}))}),w=ce(()=>{if(o)return u.actions.goToOption({focus:ve.Nothing});u.actions.goToOption({focus:ve.Specific,id:r})}),T=VE(),B=ce($=>T.update($)),F=ce($=>{T.wasMoved($)&&(o||l&&u.state.activationTrigger===zs.Pointer||u.actions.goToOption({focus:ve.Specific,id:r},zs.Pointer))}),R=ce($=>{T.wasMoved($)&&(o||l&&u.state.activationTrigger===zs.Pointer&&u.actions.goToOption({focus:ve.Nothing}))}),j=x.useMemo(()=>({active:l,focus:l,selected:f,disabled:o,selectedOption:f&&c}),[l,f,o,c]),g=c?{}:{id:r,ref:m,role:"option",tabIndex:o===!0?void 0:-1,"aria-disabled":o===!0?!0:void 0,"aria-selected":f,disabled:void 0,onClick:A,onFocus:w,onPointerEnter:B,onMouseEnter:B,onPointerMove:F,onMouseMove:F,onPointerLeave:R,onMouseLeave:R},y=Ye();return!f&&c?null:y({ourProps:g,theirProps:i,slot:j,defaultTag:x5,name:"Listbox.Option"})}let S5=x.Fragment;function P5(e,t){let{options:n,placeholder:r,...o}=e,s={ref:st(t)},i=Oo("ListboxSelectedOption"),c=x.useMemo(()=>({}),[]),a=i.value===void 0||i.value===null||i.mode===Rt.Multi&&Array.isArray(i.value)&&i.value.length===0,u=Ye();return x.createElement(Dh.Provider,{value:!0},u({ourProps:s,theirProps:{...o,children:x.createElement(x.Fragment,null,r&&a?r:n)},slot:c,defaultTag:S5,name:"ListboxSelectedOption"}))}let $5=ze(m5),T5=ze(b5),A5=rE,O5=ze(v5),C5=ze(E5),N5=ze(P5),ut=Object.assign($5,{Button:T5,Label:A5,Options:O5,Option:C5,SelectedOption:N5});const I5=()=>I.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",children:[I.jsx("g",{clipPath:"url(#clip0_active)",children:I.jsx("path",{d:"M4.63791 6.91929H2.62541C2.36266 6.91929 2.18141 6.65629 2.27491 6.41091L4.27466 1.16191C4.30172 1.0909 4.34971 1.02978 4.41228 0.986649C4.47485 0.943521 4.54905 0.920422 4.62504 0.92041H7.99954C8.26579 0.92041 8.44729 1.19016 8.34679 1.43679L7.18241 4.29479H9.37441C9.69679 4.29479 9.86879 4.67479 9.65616 4.91704L4.28191 11.0408C4.02066 11.3385 3.53629 11.0805 3.63766 10.6977L4.63791 6.91929Z",fill:"#22FD73"})}),I.jsx("defs",{children:I.jsx("clipPath",{id:"clip0_active",children:I.jsx("rect",{width:"12",height:"12",fill:"white",transform:"translate(0 0.0454102)"})})})]}),M5=()=>I.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",children:[I.jsx("g",{clipPath:"url(#clip0_inactive)",children:I.jsx("path",{d:"M4.63791 6.91929H2.62541C2.36266 6.91929 2.18141 6.65629 2.27491 6.41091L4.27466 1.16191C4.30172 1.0909 4.34971 1.02978 4.41228 0.986649C4.47485 0.943521 4.54905 0.920422 4.62504 0.92041H7.99954C8.26579 0.92041 8.44729 1.19016 8.34679 1.43679L7.18241 4.29479H9.37441C9.69679 4.29479 9.86879 4.67479 9.65616 4.91704L4.28191 11.0408C4.02066 11.3385 3.53629 11.0805 3.63766 10.6977L4.63791 6.91929Z",fill:"#F9F9F9"})}),I.jsx("defs",{children:I.jsx("clipPath",{id:"clip0_inactive",children:I.jsx("rect",{width:"12",height:"12",fill:"white",transform:"translate(0 0.0454102)"})})})]}),Co=({selectedLevel:e,maxLevel:t,className:n=""})=>{const r=Array.from({length:t},(o,s)=>s+1);return I.jsx("div",{className:`flex items-center ${n}`,children:r.map(o=>I.jsx("div",{className:"flex items-center justify-center",children:o>t-e?I.jsx(I5,{}):I.jsx(M5,{})},o))})};class Tt{}Bo(Tt,"FAST",3),Bo(Tt,"Medium",2),Bo(Tt,"SLOW",1),Bo(Tt,"NONE",0);const k5=Object.values({MAINNET:1,SEPOLIA:11155111}),un=e=>{const t=typeof e=="string"?parseInt(e,10):e;return k5.includes(t)},B5={USDT:!0},Rh=(e,t)=>{const n=typeof e=="string"?parseInt(e,10):e;return n===1||n===11155111?!1:(n===42161||n===421614)&&t?t.toUpperCase()==="ETH"?!1:!B5[t.toUpperCase()]:!0},L5=({chains:e,selectedChain:t,onChainChange:n,disabled:r=!1,className:o="",walletType:s="mpc"})=>{const{t:i}=ht();return I.jsx("div",{className:`relative ${o}`,children:I.jsx(ut,{value:t,onChange:n,disabled:r,children:({open:c})=>I.jsxs(I.Fragment,{children:[I.jsxs(ut.Button,{className:`
|
|
139
|
+
*/var X2=["input:not([inert])","select:not([inert])","textarea:not([inert])","a[href]:not([inert])","button:not([inert])","[tabindex]:not(slot):not([inert])","audio[controls]:not([inert])","video[controls]:not([inert])",'[contenteditable]:not([contenteditable="false"]):not([inert])',"details>summary:first-of-type:not([inert])","details:not([inert])"],Kc=X2.join(","),Pp=typeof Element>"u",_o=Pp?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,Qs=!Pp&&Element.prototype.getRootNode?function(e){var t;return e==null||(t=e.getRootNode)===null||t===void 0?void 0:t.call(e)}:function(e){return e==null?void 0:e.ownerDocument},Wo=function(t,n){var r;n===void 0&&(n=!0);var o=t==null||(r=t.getAttribute)===null||r===void 0?void 0:r.call(t,"inert"),s=o===""||o==="true",i=s||n&&t&&Wo(t.parentNode);return i},J2=function(t){var n,r=t==null||(n=t.getAttribute)===null||n===void 0?void 0:n.call(t,"contenteditable");return r===""||r==="true"},Q2=function(t,n,r){if(Wo(t))return[];var o=Array.prototype.slice.apply(t.querySelectorAll(Kc));return n&&_o.call(t,Kc)&&o.unshift(t),o=o.filter(r),o},Zc=function(t,n,r){for(var o=[],s=Array.from(t);s.length;){var i=s.shift();if(!Wo(i,!1))if(i.tagName==="SLOT"){var c=i.assignedElements(),a=c.length?c:i.children,l=Zc(a,!0,r);r.flatten?o.push.apply(o,l):o.push({scopeParent:i,candidates:l})}else{var u=_o.call(i,Kc);u&&r.filter(i)&&(n||!t.includes(i))&&o.push(i);var f=i.shadowRoot||typeof r.getShadowRoot=="function"&&r.getShadowRoot(i),p=!Wo(f,!1)&&(!r.shadowRootFilter||r.shadowRootFilter(i));if(f&&p){var d=Zc(f===!0?i.children:f.children,!0,r);r.flatten?o.push.apply(o,d):o.push({scopeParent:i,candidates:d})}else s.unshift.apply(s,i.children)}}return o},Tp=function(t){return!isNaN(parseInt(t.getAttribute("tabindex"),10))},Ap=function(t){if(!t)throw new Error("No node provided");return t.tabIndex<0&&(/^(AUDIO|VIDEO|DETAILS)$/.test(t.tagName)||J2(t))&&!Tp(t)?0:t.tabIndex},eE=function(t,n){var r=Ap(t);return r<0&&n&&!Tp(t)?0:r},tE=function(t,n){return t.tabIndex===n.tabIndex?t.documentOrder-n.documentOrder:t.tabIndex-n.tabIndex},Np=function(t){return t.tagName==="INPUT"},nE=function(t){return Np(t)&&t.type==="hidden"},rE=function(t){var n=t.tagName==="DETAILS"&&Array.prototype.slice.apply(t.children).some(function(r){return r.tagName==="SUMMARY"});return n},oE=function(t,n){for(var r=0;r<t.length;r++)if(t[r].checked&&t[r].form===n)return t[r]},sE=function(t){if(!t.name)return!0;var n=t.form||Qs(t),r=function(c){return n.querySelectorAll('input[type="radio"][name="'+c+'"]')},o;if(typeof window<"u"&&typeof window.CSS<"u"&&typeof window.CSS.escape=="function")o=r(window.CSS.escape(t.name));else try{o=r(t.name)}catch(i){return console.error("Looks like you have a radio button with a name attribute containing invalid CSS selector characters and need the CSS.escape polyfill: %s",i.message),!1}var s=oE(o,t.form);return!s||s===t},iE=function(t){return Np(t)&&t.type==="radio"},aE=function(t){return iE(t)&&!sE(t)},cE=function(t){var n,r=t&&Qs(t),o=(n=r)===null||n===void 0?void 0:n.host,s=!1;if(r&&r!==t){var i,c,a;for(s=!!((i=o)!==null&&i!==void 0&&(c=i.ownerDocument)!==null&&c!==void 0&&c.contains(o)||t!=null&&(a=t.ownerDocument)!==null&&a!==void 0&&a.contains(t));!s&&o;){var l,u,f;r=Qs(o),o=(l=r)===null||l===void 0?void 0:l.host,s=!!((u=o)!==null&&u!==void 0&&(f=u.ownerDocument)!==null&&f!==void 0&&f.contains(o))}}return s},Cp=function(t){var n=t.getBoundingClientRect(),r=n.width,o=n.height;return r===0&&o===0},lE=function(t,n){var r=n.displayCheck,o=n.getShadowRoot;if(r==="full-native"&&"checkVisibility"in t){var s=t.checkVisibility({checkOpacity:!1,opacityProperty:!1,contentVisibilityAuto:!0,visibilityProperty:!0,checkVisibilityCSS:!0});return!s}if(getComputedStyle(t).visibility==="hidden")return!0;var i=_o.call(t,"details>summary:first-of-type"),c=i?t.parentElement:t;if(_o.call(c,"details:not([open]) *"))return!0;if(!r||r==="full"||r==="full-native"||r==="legacy-full"){if(typeof o=="function"){for(var a=t;t;){var l=t.parentElement,u=Qs(t);if(l&&!l.shadowRoot&&o(l)===!0)return Cp(t);t.assignedSlot?t=t.assignedSlot:!l&&u!==t.ownerDocument?t=u.host:t=l}t=a}if(cE(t))return!t.getClientRects().length;if(r!=="legacy-full")return!0}else if(r==="non-zero-area")return Cp(t);return!1},uE=function(t){if(/^(INPUT|BUTTON|SELECT|TEXTAREA)$/.test(t.tagName))for(var n=t.parentElement;n;){if(n.tagName==="FIELDSET"&&n.disabled){for(var r=0;r<n.children.length;r++){var o=n.children.item(r);if(o.tagName==="LEGEND")return _o.call(n,"fieldset[disabled] *")?!0:!o.contains(t)}return!0}n=n.parentElement}return!1},fE=function(t,n){return!(n.disabled||Wo(n)||nE(n)||lE(n,t)||rE(n)||uE(n))},Op=function(t,n){return!(aE(n)||Ap(n)<0||!fE(t,n))},dE=function(t){var n=parseInt(t.getAttribute("tabindex"),10);return!!(isNaN(n)||n>=0)},Ip=function(t){var n=[],r=[];return t.forEach(function(o,s){var i=!!o.scopeParent,c=i?o.scopeParent:o,a=eE(c,i),l=i?Ip(o.candidates):c;a===0?i?n.push.apply(n,l):n.push(c):r.push({documentOrder:s,tabIndex:a,item:o,isScope:i,content:l})}),r.sort(tE).reduce(function(o,s){return s.isScope?o.push.apply(o,s.content):o.push(s.content),o},[]).concat(n)},$p=function(t,n){n=n||{};var r;return n.getShadowRoot?r=Zc([t],n.includeContainer,{filter:Op.bind(null,n),flatten:!1,getShadowRoot:n.getShadowRoot,shadowRootFilter:dE}):r=Q2(t,n.includeContainer,Op.bind(null,n)),Ip(r)};function kp(e,t,n){let{reference:r,floating:o}=e;const s=mn(t),i=Gc(t),c=Hc(i),a=kn(t),l=s==="y",u=r.x+r.width/2-o.width/2,f=r.y+r.height/2-o.height/2,p=r[c]/2-o[c]/2;let d;switch(a){case"top":d={x:u,y:r.y-o.height};break;case"bottom":d={x:u,y:r.y+r.height};break;case"right":d={x:r.x+r.width,y:f};break;case"left":d={x:r.x-o.width,y:f};break;default:d={x:r.x,y:r.y}}switch($r(t)){case"start":d[i]-=p*(n&&l?-1:1);break;case"end":d[i]+=p*(n&&l?-1:1);break}return d}const pE=async(e,t,n)=>{const{placement:r="bottom",strategy:o="absolute",middleware:s=[],platform:i}=n,c=s.filter(Boolean),a=await(i.isRTL==null?void 0:i.isRTL(t));let l=await i.getElementRects({reference:e,floating:t,strategy:o}),{x:u,y:f}=kp(l,r,a),p=r,d={},h=0;for(let m=0;m<c.length;m++){const{name:x,fn:P}=c[m],{x:E,y:T,data:N,reset:M}=await P({x:u,y:f,initialPlacement:r,placement:p,strategy:o,middlewareData:d,rects:l,platform:i,elements:{reference:e,floating:t}});u=E??u,f=T??f,d={...d,[x]:{...d[x],...N}},M&&h<=50&&(h++,typeof M=="object"&&(M.placement&&(p=M.placement),M.rects&&(l=M.rects===!0?await i.getElementRects({reference:e,floating:t,strategy:o}):M.rects),{x:u,y:f}=kp(l,p,a)),m=-1)}return{x:u,y:f,placement:p,strategy:o,middlewareData:d}};async function ei(e,t){var n;t===void 0&&(t={});const{x:r,y:o,platform:s,rects:i,elements:c,strategy:a}=e,{boundary:l="clippingAncestors",rootBoundary:u="viewport",elementContext:f="floating",altBoundary:p=!1,padding:d=0}=Qn(t,e),h=Sp(d),x=c[p?f==="floating"?"reference":"floating":f],P=Js(await s.getClippingRect({element:(n=await(s.isElement==null?void 0:s.isElement(x)))==null||n?x:x.contextElement||await(s.getDocumentElement==null?void 0:s.getDocumentElement(c.floating)),boundary:l,rootBoundary:u,strategy:a})),E=f==="floating"?{x:r,y:o,width:i.floating.width,height:i.floating.height}:i.reference,T=await(s.getOffsetParent==null?void 0:s.getOffsetParent(c.floating)),N=await(s.isElement==null?void 0:s.isElement(T))?await(s.getScale==null?void 0:s.getScale(T))||{x:1,y:1}:{x:1,y:1},M=Js(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:c,rect:E,offsetParent:T,strategy:a}):E);return{top:(P.top-M.top+h.top)/N.y,bottom:(M.bottom-P.bottom+h.bottom)/N.y,left:(P.left-M.left+h.left)/N.x,right:(M.right-P.right+h.right)/N.x}}const hE=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:o,rects:s,platform:i,elements:c,middlewareData:a}=t,{element:l,padding:u=0}=Qn(e,t)||{};if(l==null)return{};const f=Sp(u),p={x:n,y:r},d=Gc(o),h=Hc(d),m=await i.getDimensions(l),x=d==="y",P=x?"top":"left",E=x?"bottom":"right",T=x?"clientHeight":"clientWidth",N=s.reference[h]+s.reference[d]-p[d]-s.floating[h],M=p[d]-s.reference[d],F=await(i.getOffsetParent==null?void 0:i.getOffsetParent(l));let L=F?F[T]:0;(!L||!await(i.isElement==null?void 0:i.isElement(F)))&&(L=c.floating[T]||s.floating[h]);const b=N/2-M/2,g=L/2-m[h]/2-1,w=hn(f[P],g),O=hn(f[E],g),C=w,I=L-m[h]-O,k=L/2-m[h]/2+b,y=Vc(C,k,I),A=!a.arrow&&$r(o)!=null&&k!==y&&s.reference[h]/2-(k<C?w:O)-m[h]/2<0,D=A?k<C?k-C:k-I:0;return{[d]:p[d]+D,data:{[d]:y,centerOffset:k-y-D,...A&&{alignmentOffset:D}},reset:A}}}),mE=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:o,middlewareData:s,rects:i,initialPlacement:c,platform:a,elements:l}=t,{mainAxis:u=!0,crossAxis:f=!0,fallbackPlacements:p,fallbackStrategy:d="bestFit",fallbackAxisSideDirection:h="none",flipAlignment:m=!0,...x}=Qn(e,t);if((n=s.arrow)!=null&&n.alignmentOffset)return{};const P=kn(o),E=mn(c),T=kn(c)===c,N=await(a.isRTL==null?void 0:a.isRTL(l.floating)),M=p||(T||!m?[Xs(c)]:H2(c)),F=h!=="none";!p&&F&&M.push(...Z2(c,m,h,N));const L=[c,...M],b=await ei(t,x),g=[];let w=((r=s.flip)==null?void 0:r.overflows)||[];if(u&&g.push(b[P]),f){const k=V2(o,i,N);g.push(b[k[0]],b[k[1]])}if(w=[...w,{placement:o,overflows:g}],!g.every(k=>k<=0)){var O,C;const k=(((O=s.flip)==null?void 0:O.index)||0)+1,y=L[k];if(y&&(!(f==="alignment"?E!==mn(y):!1)||w.every(S=>mn(S.placement)===E?S.overflows[0]>0:!0)))return{data:{index:k,overflows:w},reset:{placement:y}};let A=(C=w.filter(D=>D.overflows[0]<=0).sort((D,S)=>D.overflows[1]-S.overflows[1])[0])==null?void 0:C.placement;if(!A)switch(d){case"bestFit":{var I;const D=(I=w.filter(S=>{if(F){const B=mn(S.placement);return B===E||B==="y"}return!0}).map(S=>[S.placement,S.overflows.filter(B=>B>0).reduce((B,j)=>B+j,0)]).sort((S,B)=>S[1]-B[1])[0])==null?void 0:I[0];D&&(A=D);break}case"initialPlacement":A=c;break}if(o!==A)return{reset:{placement:A}}}return{}}}},bE=new Set(["left","top"]);async function gE(e,t){const{placement:n,platform:r,elements:o}=e,s=await(r.isRTL==null?void 0:r.isRTL(o.floating)),i=kn(n),c=$r(n),a=mn(n)==="y",l=bE.has(i)?-1:1,u=s&&a?-1:1,f=Qn(t,e);let{mainAxis:p,crossAxis:d,alignmentAxis:h}=typeof f=="number"?{mainAxis:f,crossAxis:0,alignmentAxis:null}:{mainAxis:f.mainAxis||0,crossAxis:f.crossAxis||0,alignmentAxis:f.alignmentAxis};return c&&typeof h=="number"&&(d=c==="end"?h*-1:h),a?{x:d*u,y:p*l}:{x:p*l,y:d*u}}const yE=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:o,y:s,placement:i,middlewareData:c}=t,a=await gE(t,e);return i===((n=c.offset)==null?void 0:n.placement)&&(r=c.arrow)!=null&&r.alignmentOffset?{}:{x:o+a.x,y:s+a.y,data:{...a,placement:i}}}}},vE=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:o}=t,{mainAxis:s=!0,crossAxis:i=!1,limiter:c={fn:x=>{let{x:P,y:E}=x;return{x:P,y:E}}},...a}=Qn(e,t),l={x:n,y:r},u=await ei(t,a),f=mn(kn(o)),p=wp(f);let d=l[p],h=l[f];if(s){const x=p==="y"?"top":"left",P=p==="y"?"bottom":"right",E=d+u[x],T=d-u[P];d=Vc(E,d,T)}if(i){const x=f==="y"?"top":"left",P=f==="y"?"bottom":"right",E=h+u[x],T=h-u[P];h=Vc(E,h,T)}const m=c.fn({...t,[p]:d,[f]:h});return{...m,data:{x:m.x-n,y:m.y-r,enabled:{[p]:s,[f]:i}}}}}},wE=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var n,r;const{placement:o,rects:s,platform:i,elements:c}=t,{apply:a=()=>{},...l}=Qn(e,t),u=await ei(t,l),f=kn(o),p=$r(o),d=mn(o)==="y",{width:h,height:m}=s.floating;let x,P;f==="top"||f==="bottom"?(x=f,P=p===(await(i.isRTL==null?void 0:i.isRTL(c.floating))?"start":"end")?"left":"right"):(P=f,x=p==="end"?"top":"bottom");const E=m-u.top-u.bottom,T=h-u.left-u.right,N=hn(m-u[x],E),M=hn(h-u[P],T),F=!t.middlewareData.shift;let L=N,b=M;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(b=T),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(L=E),F&&!p){const w=Be(u.left,0),O=Be(u.right,0),C=Be(u.top,0),I=Be(u.bottom,0);d?b=h-2*(w!==0||O!==0?w+O:Be(u.left,u.right)):L=m-2*(C!==0||I!==0?C+I:Be(u.top,u.bottom))}await a({...t,availableWidth:b,availableHeight:L});const g=await i.getDimensions(c.floating);return h!==g.width||m!==g.height?{reset:{rects:!0}}:{}}}};function Dp(e){const t=vt(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const o=je(e),s=o?e.offsetWidth:n,i=o?e.offsetHeight:r,c=Uo(n)!==s||Uo(r)!==i;return c&&(n=s,r=i),{width:n,height:r,$:c}}function Yc(e){return be(e)?e:e.contextElement}function kr(e){const t=Yc(e);if(!je(t))return Ht(1);const n=t.getBoundingClientRect(),{width:r,height:o,$:s}=Dp(t);let i=(s?Uo(n.width):n.width)/r,c=(s?Uo(n.height):n.height)/o;return(!i||!Number.isFinite(i))&&(i=1),(!c||!Number.isFinite(c))&&(c=1),{x:i,y:c}}const xE=Ht(0);function Mp(e){const t=Ye(e);return!Ks()||!t.visualViewport?xE:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function EE(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==Ye(e)?!1:t}function er(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const o=e.getBoundingClientRect(),s=Yc(e);let i=Ht(1);t&&(r?be(r)&&(i=kr(r)):i=kr(e));const c=EE(s,n,r)?Mp(s):Ht(0);let a=(o.left+c.x)/i.x,l=(o.top+c.y)/i.y,u=o.width/i.x,f=o.height/i.y;if(s){const p=Ye(s),d=r&&be(r)?Ye(r):r;let h=p,m=Wc(h);for(;m&&r&&d!==h;){const x=kr(m),P=m.getBoundingClientRect(),E=vt(m),T=P.left+(m.clientLeft+parseFloat(E.paddingLeft))*x.x,N=P.top+(m.clientTop+parseFloat(E.paddingTop))*x.y;a*=x.x,l*=x.y,u*=x.x,f*=x.y,a+=T,l+=N,h=Ye(m),m=Wc(h)}}return Js({width:u,height:f,x:a,y:l})}function ti(e,t){const n=Zs(e).scrollLeft;return t?t.left+n:er(Vt(e)).left+n}function Bp(e,t){const n=e.getBoundingClientRect(),r=n.left+t.scrollLeft-ti(e,n),o=n.top+t.scrollTop;return{x:r,y:o}}function SE(e){let{elements:t,rect:n,offsetParent:r,strategy:o}=e;const s=o==="fixed",i=Vt(r),c=t?qs(t.floating):!1;if(r===i||c&&s)return n;let a={scrollLeft:0,scrollTop:0},l=Ht(1);const u=Ht(0),f=je(r);if((f||!f&&!s)&&((Ir(r)!=="body"||zo(i))&&(a=Zs(r)),je(r))){const d=er(r);l=kr(r),u.x=d.x+r.clientLeft,u.y=d.y+r.clientTop}const p=i&&!f&&!s?Bp(i,a):Ht(0);return{width:n.width*l.x,height:n.height*l.y,x:n.x*l.x-a.scrollLeft*l.x+u.x+p.x,y:n.y*l.y-a.scrollTop*l.y+u.y+p.y}}function PE(e){return Array.from(e.getClientRects())}function TE(e){const t=Vt(e),n=Zs(e),r=e.ownerDocument.body,o=Be(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),s=Be(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let i=-n.scrollLeft+ti(e);const c=-n.scrollTop;return vt(r).direction==="rtl"&&(i+=Be(t.clientWidth,r.clientWidth)-o),{width:o,height:s,x:i,y:c}}const Lp=25;function AE(e,t){const n=Ye(e),r=Vt(e),o=n.visualViewport;let s=r.clientWidth,i=r.clientHeight,c=0,a=0;if(o){s=o.width,i=o.height;const u=Ks();(!u||u&&t==="fixed")&&(c=o.offsetLeft,a=o.offsetTop)}const l=ti(r);if(l<=0){const u=r.ownerDocument,f=u.body,p=getComputedStyle(f),d=u.compatMode==="CSS1Compat"&&parseFloat(p.marginLeft)+parseFloat(p.marginRight)||0,h=Math.abs(r.clientWidth-f.clientWidth-d);h<=Lp&&(s-=h)}else l<=Lp&&(s+=l);return{width:s,height:i,x:c,y:a}}const NE=new Set(["absolute","fixed"]);function CE(e,t){const n=er(e,!0,t==="fixed"),r=n.top+e.clientTop,o=n.left+e.clientLeft,s=je(e)?kr(e):Ht(1),i=e.clientWidth*s.x,c=e.clientHeight*s.y,a=o*s.x,l=r*s.y;return{width:i,height:c,x:a,y:l}}function Fp(e,t,n){let r;if(t==="viewport")r=AE(e,n);else if(t==="document")r=TE(Vt(e));else if(be(t))r=CE(t,n);else{const o=Mp(e);r={x:t.x-o.x,y:t.y-o.y,width:t.width,height:t.height}}return Js(r)}function Rp(e,t){const n=pn(e);return n===t||!be(n)||dn(n)?!1:vt(n).position==="fixed"||Rp(n,t)}function OE(e,t){const n=t.get(e);if(n)return n;let r=$n(e,[],!1).filter(c=>be(c)&&Ir(c)!=="body"),o=null;const s=vt(e).position==="fixed";let i=s?pn(e):e;for(;be(i)&&!dn(i);){const c=vt(i),a=_c(i);!a&&c.position==="fixed"&&(o=null),(s?!a&&!o:!a&&c.position==="static"&&!!o&&NE.has(o.position)||zo(i)&&!a&&Rp(e,i))?r=r.filter(u=>u!==i):o=c,i=pn(i)}return t.set(e,r),r}function IE(e){let{element:t,boundary:n,rootBoundary:r,strategy:o}=e;const i=[...n==="clippingAncestors"?qs(t)?[]:OE(t,this._c):[].concat(n),r],c=i[0],a=i.reduce((l,u)=>{const f=Fp(t,u,o);return l.top=Be(f.top,l.top),l.right=hn(f.right,l.right),l.bottom=hn(f.bottom,l.bottom),l.left=Be(f.left,l.left),l},Fp(t,c,o));return{width:a.right-a.left,height:a.bottom-a.top,x:a.left,y:a.top}}function $E(e){const{width:t,height:n}=Dp(e);return{width:t,height:n}}function kE(e,t,n){const r=je(t),o=Vt(t),s=n==="fixed",i=er(e,!0,s,t);let c={scrollLeft:0,scrollTop:0};const a=Ht(0);function l(){a.x=ti(o)}if(r||!r&&!s)if((Ir(t)!=="body"||zo(o))&&(c=Zs(t)),r){const d=er(t,!0,s,t);a.x=d.x+t.clientLeft,a.y=d.y+t.clientTop}else o&&l();s&&!r&&o&&l();const u=o&&!r&&!s?Bp(o,c):Ht(0),f=i.left+c.scrollLeft-a.x-u.x,p=i.top+c.scrollTop-a.y-u.y;return{x:f,y:p,width:i.width,height:i.height}}function Xc(e){return vt(e).position==="static"}function jp(e,t){if(!je(e)||vt(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return Vt(e)===n&&(n=n.ownerDocument.body),n}function zp(e,t){const n=Ye(e);if(qs(e))return n;if(!je(e)){let o=pn(e);for(;o&&!dn(o);){if(be(o)&&!Xc(o))return o;o=pn(o)}return n}let r=jp(e,t);for(;r&&D2(r)&&Xc(r);)r=jp(r,t);return r&&dn(r)&&Xc(r)&&!_c(r)?n:r||R2(e)||n}const DE=async function(e){const t=this.getOffsetParent||zp,n=this.getDimensions,r=await n(e.floating);return{reference:kE(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function ME(e){return vt(e).direction==="rtl"}const BE={convertOffsetParentRelativeRectToViewportRelativeRect:SE,getDocumentElement:Vt,getClippingRect:IE,getOffsetParent:zp,getElementRects:DE,getClientRects:PE,getDimensions:$E,getScale:kr,isElement:be,isRTL:ME};function Up(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function LE(e,t){let n=null,r;const o=Vt(e);function s(){var c;clearTimeout(r),(c=n)==null||c.disconnect(),n=null}function i(c,a){c===void 0&&(c=!1),a===void 0&&(a=1),s();const l=e.getBoundingClientRect(),{left:u,top:f,width:p,height:d}=l;if(c||t(),!p||!d)return;const h=Ys(f),m=Ys(o.clientWidth-(u+p)),x=Ys(o.clientHeight-(f+d)),P=Ys(u),T={rootMargin:-h+"px "+-m+"px "+-x+"px "+-P+"px",threshold:Be(0,hn(1,a))||1};let N=!0;function M(F){const L=F[0].intersectionRatio;if(L!==a){if(!N)return i();L?i(!1,L):r=setTimeout(()=>{i(!1,1e-7)},1e3)}L===1&&!Up(l,e.getBoundingClientRect())&&i(),N=!1}try{n=new IntersectionObserver(M,{...T,root:o.ownerDocument})}catch{n=new IntersectionObserver(M,T)}n.observe(e)}return i(!0),s}function _p(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:o=!0,ancestorResize:s=!0,elementResize:i=typeof ResizeObserver=="function",layoutShift:c=typeof IntersectionObserver=="function",animationFrame:a=!1}=r,l=Yc(e),u=o||s?[...l?$n(l):[],...$n(t)]:[];u.forEach(P=>{o&&P.addEventListener("scroll",n,{passive:!0}),s&&P.addEventListener("resize",n)});const f=l&&c?LE(l,n):null;let p=-1,d=null;i&&(d=new ResizeObserver(P=>{let[E]=P;E&&E.target===l&&d&&(d.unobserve(t),cancelAnimationFrame(p),p=requestAnimationFrame(()=>{var T;(T=d)==null||T.observe(t)})),n()}),l&&!a&&d.observe(l),d.observe(t));let h,m=a?er(e):null;a&&x();function x(){const P=er(e);m&&!Up(m,P)&&n(),m=P,h=requestAnimationFrame(x)}return n(),()=>{var P;u.forEach(E=>{o&&E.removeEventListener("scroll",n),s&&E.removeEventListener("resize",n)}),f==null||f(),(P=d)==null||P.disconnect(),d=null,a&&cancelAnimationFrame(h)}}const Jc=ei,FE=yE,RE=vE,jE=mE,zE=wE,Wp=hE,UE=(e,t,n)=>{const r=new Map,o={platform:BE,...n},s={...o.platform,_c:r};return pE(e,t,{...o,platform:s})};var _E=typeof document<"u",WE=function(){},ni=_E?v.useLayoutEffect:WE;function ri(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let n,r,o;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!ri(e[r],t[r]))return!1;return!0}if(o=Object.keys(e),n=o.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,o[r]))return!1;for(r=n;r--!==0;){const s=o[r];if(!(s==="_owner"&&e.$$typeof)&&!ri(e[s],t[s]))return!1}return!0}return e!==e&&t!==t}function Vp(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Hp(e,t){const n=Vp(e);return Math.round(t*n)/n}function Qc(e){const t=z.useRef(e);return ni(()=>{t.current=e}),t}function Gp(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:o,elements:{reference:s,floating:i}={},transform:c=!0,whileElementsMounted:a,open:l}=e,[u,f]=z.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[p,d]=z.useState(r);ri(p,r)||d(r);const[h,m]=z.useState(null),[x,P]=z.useState(null),E=z.useCallback(S=>{S!==F.current&&(F.current=S,m(S))},[]),T=z.useCallback(S=>{S!==L.current&&(L.current=S,P(S))},[]),N=s||h,M=i||x,F=z.useRef(null),L=z.useRef(null),b=z.useRef(u),g=a!=null,w=Qc(a),O=Qc(o),C=Qc(l),I=z.useCallback(()=>{if(!F.current||!L.current)return;const S={placement:t,strategy:n,middleware:p};O.current&&(S.platform=O.current),UE(F.current,L.current,S).then(B=>{const j={...B,isPositioned:C.current!==!1};k.current&&!ri(b.current,j)&&(b.current=j,jr.flushSync(()=>{f(j)}))})},[p,t,n,O,C]);ni(()=>{l===!1&&b.current.isPositioned&&(b.current.isPositioned=!1,f(S=>({...S,isPositioned:!1})))},[l]);const k=z.useRef(!1);ni(()=>(k.current=!0,()=>{k.current=!1}),[]),ni(()=>{if(N&&(F.current=N),M&&(L.current=M),N&&M){if(w.current)return w.current(N,M,I);I()}},[N,M,I,w,g]);const y=z.useMemo(()=>({reference:F,floating:L,setReference:E,setFloating:T}),[E,T]),A=z.useMemo(()=>({reference:N,floating:M}),[N,M]),D=z.useMemo(()=>{const S={position:n,left:0,top:0};if(!A.floating)return S;const B=Hp(A.floating,u.x),j=Hp(A.floating,u.y);return c?{...S,transform:"translate("+B+"px, "+j+"px)",...Vp(A.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:B,top:j}},[n,c,A.floating,u.x,u.y]);return z.useMemo(()=>({...u,update:I,refs:y,elements:A,floatingStyles:D}),[u,I,y,A,D])}const VE=e=>{function t(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:e,fn(n){const{element:r,padding:o}=typeof e=="function"?e(n):e;return r&&t(r)?r.current!=null?Wp({element:r.current,padding:o}).fn(n):{}:r?Wp({element:r,padding:o}).fn(n):{}}}},el=(e,t)=>({...FE(e),options:[e,t]}),qp=(e,t)=>({...RE(e),options:[e,t]}),Kp=(e,t)=>({...jE(e),options:[e,t]}),HE=(e,t)=>({...zE(e),options:[e,t]}),GE=(e,t)=>({...VE(e),options:[e,t]}),Zp={...z},qE=Zp.useInsertionEffect||(e=>e());function Yp(e){const t=z.useRef(()=>{if(process.env.NODE_ENV!=="production")throw new Error("Cannot call an event handler while rendering.")});return qE(()=>{t.current=e}),z.useCallback(function(){for(var n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return t.current==null?void 0:t.current(...r)},[])}var tl=typeof document<"u"?v.useLayoutEffect:v.useEffect;let Xp=!1,KE=0;const Jp=()=>"floating-ui-"+Math.random().toString(36).slice(2,6)+KE++;function ZE(){const[e,t]=z.useState(()=>Xp?Jp():void 0);return tl(()=>{e==null&&t(Jp())},[]),z.useEffect(()=>{Xp=!0},[]),e}const YE=Zp.useId||ZE;let Vo;process.env.NODE_ENV!=="production"&&(Vo=new Set);function XE(){for(var e,t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];const o="Floating UI: "+n.join(" ");if(!((e=Vo)!=null&&e.has(o))){var s;(s=Vo)==null||s.add(o),console.warn(o)}}function JE(){for(var e,t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];const o="Floating UI: "+n.join(" ");if(!((e=Vo)!=null&&e.has(o))){var s;(s=Vo)==null||s.add(o),console.error(o)}}function QE(){const e=new Map;return{emit(t,n){var r;(r=e.get(t))==null||r.forEach(o=>o(n))},on(t,n){e.set(t,[...e.get(t)||[],n])},off(t,n){var r;e.set(t,((r=e.get(t))==null?void 0:r.filter(o=>o!==n))||[])}}}const e8=z.createContext(null),t8=z.createContext(null),n8=()=>{var e;return((e=z.useContext(e8))==null?void 0:e.id)||null},r8=()=>z.useContext(t8),o8="data-floating-ui-focusable";function s8(e){const{open:t=!1,onOpenChange:n,elements:r}=e,o=YE(),s=z.useRef({}),[i]=z.useState(()=>QE()),c=n8()!=null;if(process.env.NODE_ENV!=="production"){const d=r.reference;d&&!be(d)&&JE("Cannot pass a virtual element to the `elements.reference` option,","as it must be a real DOM element. Use `refs.setPositionReference()`","instead.")}const[a,l]=z.useState(r.reference),u=Yp((d,h,m)=>{s.current.openEvent=d?h:void 0,i.emit("openchange",{open:d,event:h,reason:m,nested:c}),n==null||n(d,h,m)}),f=z.useMemo(()=>({setPositionReference:l}),[]),p=z.useMemo(()=>({reference:a||r.reference||null,floating:r.floating||null,domReference:r.reference}),[a,r.reference,r.floating]);return z.useMemo(()=>({dataRef:s,open:t,onOpenChange:u,elements:p,events:i,floatingId:o,refs:f}),[t,u,p,i,o,f])}function i8(e){e===void 0&&(e={});const{nodeId:t}=e,n=s8({...e,elements:{reference:null,floating:null,...e.elements}}),r=e.rootContext||n,o=r.elements,[s,i]=z.useState(null),[c,a]=z.useState(null),u=(o==null?void 0:o.domReference)||s,f=z.useRef(null),p=r8();tl(()=>{u&&(f.current=u)},[u]);const d=Gp({...e,elements:{...o,...c&&{reference:c}}}),h=z.useCallback(T=>{const N=be(T)?{getBoundingClientRect:()=>T.getBoundingClientRect(),contextElement:T}:T;a(N),d.refs.setReference(N)},[d.refs]),m=z.useCallback(T=>{(be(T)||T===null)&&(f.current=T,i(T)),(be(d.refs.reference.current)||d.refs.reference.current===null||T!==null&&!be(T))&&d.refs.setReference(T)},[d.refs]),x=z.useMemo(()=>({...d.refs,setReference:m,setPositionReference:h,domReference:f}),[d.refs,m,h]),P=z.useMemo(()=>({...d.elements,domReference:u}),[d.elements,u]),E=z.useMemo(()=>({...d,...r,refs:x,elements:P,nodeId:t}),[d,x,P,t,r]);return tl(()=>{r.dataRef.current.floatingContext=E;const T=p==null?void 0:p.nodesRef.current.find(N=>N.id===t);T&&(T.context=E)}),z.useMemo(()=>({...d,context:E,refs:x,elements:P}),[d,x,P,E])}const Qp="active",eh="selected";function nl(e,t,n){const r=new Map,o=n==="item";let s=e;if(o&&e){const{[Qp]:i,[eh]:c,...a}=e;s=a}return{...n==="floating"&&{tabIndex:-1,[o8]:""},...s,...t.map(i=>{const c=i?i[n]:null;return typeof c=="function"?e?c(e):null:c}).concat(e).reduce((i,c)=>(c&&Object.entries(c).forEach(a=>{let[l,u]=a;if(!(o&&[Qp,eh].includes(l)))if(l.indexOf("on")===0){if(r.has(l)||r.set(l,[]),typeof u=="function"){var f;(f=r.get(l))==null||f.push(u),i[l]=function(){for(var p,d=arguments.length,h=new Array(d),m=0;m<d;m++)h[m]=arguments[m];return(p=r.get(l))==null?void 0:p.map(x=>x(...h)).find(x=>x!==void 0)}}}else i[l]=u}),i),{})}}function a8(e){e===void 0&&(e=[]);const t=e.map(c=>c==null?void 0:c.reference),n=e.map(c=>c==null?void 0:c.floating),r=e.map(c=>c==null?void 0:c.item),o=z.useCallback(c=>nl(c,e,"reference"),t),s=z.useCallback(c=>nl(c,e,"floating"),n),i=z.useCallback(c=>nl(c,e,"item"),r);return z.useMemo(()=>({getReferenceProps:o,getFloatingProps:s,getItemProps:i}),[o,s,i])}function th(e,t){return{...e,rects:{...e.rects,floating:{...e.rects.floating,height:t}}}}const c8=e=>({name:"inner",options:e,async fn(t){const{listRef:n,overflowRef:r,onFallbackChange:o,offset:s=0,index:i=0,minItemsVisible:c=4,referenceOverflowThreshold:a=0,scrollRef:l,...u}=Qn(e,t),{rects:f,elements:{floating:p}}=t,d=n.current[i],h=(l==null?void 0:l.current)||p,m=p.clientTop||h.clientTop,x=p.clientTop!==0,P=h.clientTop!==0,E=p===h;if(process.env.NODE_ENV!=="production"&&(t.placement.startsWith("bottom")||XE('`placement` side must be "bottom" when using the `inner`',"middleware.")),!d)return{};const T={...t,...await el(-d.offsetTop-p.clientTop-f.reference.height/2-d.offsetHeight/2-s).fn(t)},N=await Jc(th(T,h.scrollHeight+m+p.clientTop),u),M=await Jc(T,{...u,elementContext:"reference"}),F=Be(0,N.top),L=T.y+F,w=(h.scrollHeight>h.clientHeight?O=>O:Uo)(Be(0,h.scrollHeight+(x&&E||P?m*2:0)-F-Be(0,N.bottom)));if(h.style.maxHeight=w+"px",h.scrollTop=F,o){const O=h.offsetHeight<d.offsetHeight*hn(c,n.current.length)-1||M.top>=-a||M.bottom>=-a;jr.flushSync(()=>o(O))}return r&&(r.current=await Jc(th({...T,y:L},h.offsetHeight+m+p.clientTop),u)),{y:L}}});function l8(e,t){const{open:n,elements:r}=e,{enabled:o=!0,overflowRef:s,scrollRef:i,onChange:c}=t,a=Yp(c),l=z.useRef(!1),u=z.useRef(null),f=z.useRef(null);z.useEffect(()=>{if(!o)return;function d(m){if(m.ctrlKey||!h||s.current==null)return;const x=m.deltaY,P=s.current.top>=-.5,E=s.current.bottom>=-.5,T=h.scrollHeight-h.clientHeight,N=x<0?-1:1,M=x<0?"max":"min";h.scrollHeight<=h.clientHeight||(!P&&x>0||!E&&x<0?(m.preventDefault(),jr.flushSync(()=>{a(F=>F+Math[M](x,T*N))})):/firefox/i.test(z2())&&(h.scrollTop+=x))}const h=(i==null?void 0:i.current)||r.floating;if(n&&h)return h.addEventListener("wheel",d),requestAnimationFrame(()=>{u.current=h.scrollTop,s.current!=null&&(f.current={...s.current})}),()=>{u.current=null,f.current=null,h.removeEventListener("wheel",d)}},[o,n,r.floating,s,i,a]);const p=z.useMemo(()=>({onKeyDown(){l.current=!0},onWheel(){l.current=!1},onPointerMove(){l.current=!1},onScroll(){const d=(i==null?void 0:i.current)||r.floating;if(!(!s.current||!d||!l.current)){if(u.current!==null){const h=d.scrollTop-u.current;(s.current.bottom<-.5&&h<-1||s.current.top<-.5&&h>1)&&jr.flushSync(()=>a(m=>m+h))}requestAnimationFrame(()=>{u.current=d.scrollTop})}}}),[r.floating,a,s,i]);return z.useMemo(()=>o?{floating:p}:{},[o,p])}let Dr=v.createContext({styles:void 0,setReference:()=>{},setFloating:()=>{},getReferenceProps:()=>({}),getFloatingProps:()=>({}),slot:{}});Dr.displayName="FloatingContext";let rl=v.createContext(null);rl.displayName="PlacementContext";function u8(e){return v.useMemo(()=>e?typeof e=="string"?{to:e}:e:null,[e])}function f8(){return v.useContext(Dr).setReference}function d8(){return v.useContext(Dr).getReferenceProps}function p8(){let{getFloatingProps:e,slot:t}=v.useContext(Dr);return v.useCallback((...n)=>Object.assign({},e(...n),{"data-anchor":t.anchor}),[e,t])}function h8(e=null){e===!1&&(e=null),typeof e=="string"&&(e={to:e});let t=v.useContext(rl),n=v.useMemo(()=>e,[JSON.stringify(e,(o,s)=>{var i;return(i=s==null?void 0:s.outerHTML)!=null?i:s})]);Te(()=>{t==null||t(n??null)},[t,n]);let r=v.useContext(Dr);return v.useMemo(()=>[r.setFloating,e?r.styles:{}],[r.setFloating,e,r.styles])}let nh=4;function m8({children:e,enabled:t=!0}){let[n,r]=v.useState(null),[o,s]=v.useState(0),i=v.useRef(null),[c,a]=v.useState(null);b8(c);let l=t&&n!==null&&c!==null,{to:u="bottom",gap:f=0,offset:p=0,padding:d=0,inner:h}=g8(n,c),[m,x="center"]=u.split(" ");Te(()=>{l&&s(0)},[l]);let{refs:P,floatingStyles:E,context:T}=i8({open:l,placement:m==="selection"?x==="center"?"bottom":`bottom-${x}`:x==="center"?`${m}`:`${m}-${x}`,strategy:"absolute",transform:!1,middleware:[el({mainAxis:m==="selection"?0:f,crossAxis:p}),qp({padding:d}),m!=="selection"&&Kp({padding:d}),m==="selection"&&h?c8({...h,padding:d,overflowRef:i,offset:o,minItemsVisible:nh,referenceOverflowThreshold:d,onFallbackChange(O){var C,I;if(!O)return;let k=T.elements.floating;if(!k)return;let y=parseFloat(getComputedStyle(k).scrollPaddingBottom)||0,A=Math.min(nh,k.childElementCount),D=0,S=0;for(let B of(I=(C=T.elements.floating)==null?void 0:C.childNodes)!=null?I:[])if(fn(B)){let j=B.offsetTop,_=j+B.clientHeight+y,W=k.scrollTop,q=W+k.clientHeight;if(j>=W&&_<=q)A--;else{S=Math.max(0,Math.min(_,q)-Math.max(j,W)),D=B.clientHeight;break}}A>=1&&s(B=>{let j=D*A-S+y;return B>=j?B:j})}}):null,HE({padding:d,apply({availableWidth:O,availableHeight:C,elements:I}){Object.assign(I.floating.style,{overflow:"auto",maxWidth:`${O}px`,maxHeight:`min(var(--anchor-max-height, 100vh), ${C}px)`})}})].filter(Boolean),whileElementsMounted:_p}),[N=m,M=x]=T.placement.split("-");m==="selection"&&(N="selection");let F=v.useMemo(()=>({anchor:[N,M].filter(Boolean).join(" ")}),[N,M]),L=l8(T,{overflowRef:i,onChange:s}),{getReferenceProps:b,getFloatingProps:g}=a8([L]),w=me(O=>{a(O),P.setFloating(O)});return z.createElement(rl.Provider,{value:r},z.createElement(Dr.Provider,{value:{setFloating:w,setReference:P.setReference,styles:E,getReferenceProps:b,getFloatingProps:g,slot:F}},e))}function b8(e){Te(()=>{if(!e)return;let t=new MutationObserver(()=>{let n=window.getComputedStyle(e).maxHeight,r=parseFloat(n);if(isNaN(r))return;let o=parseInt(n);isNaN(o)||r!==o&&(e.style.maxHeight=`${Math.ceil(r)}px`)});return t.observe(e,{attributes:!0,attributeFilter:["style"]}),()=>{t.disconnect()}},[e])}function g8(e,t){var n,r,o;let s=ol((n=e==null?void 0:e.gap)!=null?n:"var(--anchor-gap, 0)",t),i=ol((r=e==null?void 0:e.offset)!=null?r:"var(--anchor-offset, 0)",t),c=ol((o=e==null?void 0:e.padding)!=null?o:"var(--anchor-padding, 0)",t);return{...e,gap:s,offset:i,padding:c}}function ol(e,t,n=void 0){let r=Yn(),o=me((a,l)=>{if(a==null)return[n,null];if(typeof a=="number")return[a,null];if(typeof a=="string"){if(!l)return[n,null];let u=oh(a,l);return[u,f=>{let p=rh(a);{let d=p.map(h=>window.getComputedStyle(l).getPropertyValue(h));r.requestAnimationFrame(function h(){r.nextFrame(h);let m=!1;for(let[P,E]of p.entries()){let T=window.getComputedStyle(l).getPropertyValue(E);if(d[P]!==T){d[P]=T,m=!0;break}}if(!m)return;let x=oh(a,l);u!==x&&(f(x),u=x)})}return r.dispose}]}return[n,null]}),s=v.useMemo(()=>o(e,t)[0],[e,t]),[i=s,c]=v.useState();return Te(()=>{let[a,l]=o(e,t);if(c(a),!!l)return l(c)},[e,t]),i}function rh(e){let t=/var\((.*)\)/.exec(e);if(t){let n=t[1].indexOf(",");if(n===-1)return[t[1]];let r=t[1].slice(0,n).trim(),o=t[1].slice(n+1).trim();return o?[r,...rh(o)]:[r]}return[]}function oh(e,t){let n=document.createElement("div");t.appendChild(n),n.style.setProperty("margin-top","0px","important"),n.style.setProperty("margin-top",e,"important");let r=parseFloat(window.getComputedStyle(n).marginTop)||0;return t.removeChild(n),r}function y8({children:e,freeze:t},n){let r=sh(t,e);return v.isValidElement(r)?v.cloneElement(r,{ref:n}):v.createElement(v.Fragment,null,r)}v.forwardRef(y8);function sh(e,t){let[n,r]=v.useState(t);return!e&&n!==t&&r(t),e?n:t}let sl=v.createContext(null);sl.displayName="OpenClosedContext";var Mt=(e=>(e[e.Open=1]="Open",e[e.Closed=2]="Closed",e[e.Closing=4]="Closing",e[e.Opening=8]="Opening",e))(Mt||{});function il(){return v.useContext(sl)}function ih({value:e,children:t}){return v.createElement(sl.Provider,{value:e},t)}function v8(e){throw new Error("Unexpected object: "+e)}var Se=(e=>(e[e.First=0]="First",e[e.Previous=1]="Previous",e[e.Next=2]="Next",e[e.Last=3]="Last",e[e.Specific=4]="Specific",e[e.Nothing=5]="Nothing",e))(Se||{});function oi(e,t){let n=t.resolveItems();if(n.length<=0)return null;let r=t.resolveActiveIndex(),o=r??-1;switch(e.focus){case 0:{for(let s=0;s<n.length;++s)if(!t.resolveDisabled(n[s],s,n))return s;return r}case 1:{o===-1&&(o=n.length);for(let s=o-1;s>=0;--s)if(!t.resolveDisabled(n[s],s,n))return s;return r}case 2:{for(let s=o+1;s<n.length;++s)if(!t.resolveDisabled(n[s],s,n))return s;return r}case 3:{for(let s=n.length-1;s>=0;--s)if(!t.resolveDisabled(n[s],s,n))return s;return r}case 4:{for(let s=0;s<n.length;++s)if(t.resolveId(n[s],s,n)===e.id)return s;return r}case 5:return null;default:v8(e)}}function ah(e){let t=me(e),n=v.useRef(!1);v.useEffect(()=>(n.current=!1,()=>{n.current=!0,C0(()=>{n.current&&t()})}),[t])}let w8=v.createContext(!1);function x8(){return v.useContext(w8)}function E8(e){let t=x8(),n=v.useContext(lh),[r,o]=v.useState(()=>{var s;if(!t&&n!==null)return(s=n.current)!=null?s:null;if(_t.isServer)return null;let i=e==null?void 0:e.getElementById("headlessui-portal-root");if(i)return i;if(e===null)return null;let c=e.createElement("div");return c.setAttribute("id","headlessui-portal-root"),e.body.appendChild(c)});return v.useEffect(()=>{r!==null&&(e!=null&&e.body.contains(r)||e==null||e.body.appendChild(r))},[r,e]),v.useEffect(()=>{t||n!==null&&o(n.current)},[n,o,t]),r}let ch=v.Fragment,S8=Ke(function(e,t){let{ownerDocument:n=null,...r}=e,o=v.useRef(null),s=gt(Cx(p=>{o.current=p}),t),i=jc(o.current),c=n??i,a=E8(c),l=v.useContext(N8),u=Yn(),f=at();return ah(()=>{var p;a&&a.childNodes.length<=0&&((p=a.parentElement)==null||p.removeChild(a))}),a?Ue.createPortal(v.createElement("div",{"data-headlessui-portal":"",ref:p=>{u.dispose(),l&&p&&u.add(l.register(p))}},f({ourProps:{ref:s},theirProps:r,slot:{},defaultTag:ch,name:"Portal"})),a):null});function P8(e,t){let n=gt(t),{enabled:r=!0,ownerDocument:o,...s}=e,i=at();return r?v.createElement(S8,{...s,ownerDocument:o,ref:n}):i({ourProps:{ref:n},theirProps:s,slot:{},defaultTag:ch,name:"Portal"})}let T8=v.Fragment,lh=v.createContext(null);function A8(e,t){let{target:n,...r}=e,o={ref:gt(t)},s=at();return v.createElement(lh.Provider,{value:n},s({ourProps:o,theirProps:r,defaultTag:T8,name:"Popover.Group"}))}let N8=v.createContext(null),C8=Ke(P8),O8=Ke(A8),I8=Object.assign(C8,{Group:O8});const si={Idle:{kind:"Idle"},Tracked:e=>({kind:"Tracked",position:e}),Moved:{kind:"Moved"}};function uh(e){let t=e.getBoundingClientRect();return`${t.x},${t.y}`}function $8(e,t,n){let r=it();if(t.kind==="Tracked"){let o=function(){s!==uh(e)&&(r.dispose(),n())},{position:s}=t,i=new ResizeObserver(o);i.observe(e),r.add(()=>i.disconnect()),r.addEventListener(window,"scroll",o,{passive:!0}),r.addEventListener(window,"resize",o)}return()=>r.dispose()}function k8(){let e=typeof document>"u";return"useSyncExternalStore"in z?(t=>t.useSyncExternalStore)(z)(()=>()=>{},()=>!1,()=>!e):!1}function fh(){let e=k8(),[t,n]=z.useState(_t.isHandoffComplete);return t&&_t.isHandoffComplete===!1&&n(!1),z.useEffect(()=>{t!==!0&&n(!0)},[t]),z.useEffect(()=>_t.handoff(),[]),e?!1:t}function D8(){let e=v.useRef(!1);return Te(()=>(e.current=!0,()=>{e.current=!1}),[]),e}function dh(e){var t;return!!(e.enter||e.enterFrom||e.enterTo||e.leave||e.leaveFrom||e.leaveTo)||!Lo((t=e.as)!=null?t:hh)||v.Children.count(e.children)===1}let ii=v.createContext(null);ii.displayName="TransitionContext";var M8=(e=>(e.Visible="visible",e.Hidden="hidden",e))(M8||{});function B8(){let e=v.useContext(ii);if(e===null)throw new Error("A <Transition.Child /> is used but it is missing a parent <Transition /> or <Transition.Root />.");return e}function L8(){let e=v.useContext(ai);if(e===null)throw new Error("A <Transition.Child /> is used but it is missing a parent <Transition /> or <Transition.Root />.");return e}let ai=v.createContext(null);ai.displayName="NestingContext";function ci(e){return"children"in e?ci(e.children):e.current.filter(({el:t})=>t.current!==null).filter(({state:t})=>t==="visible").length>0}function ph(e,t){let n=Xn(e),r=v.useRef([]),o=D8(),s=Yn(),i=me((d,h=On.Hidden)=>{let m=r.current.findIndex(({el:x})=>x===d);m!==-1&&(bt(h,{[On.Unmount](){r.current.splice(m,1)},[On.Hidden](){r.current[m].state="hidden"}}),s.microTask(()=>{var x;!ci(r)&&o.current&&((x=n.current)==null||x.call(n))}))}),c=me(d=>{let h=r.current.find(({el:m})=>m===d);return h?h.state!=="visible"&&(h.state="visible"):r.current.push({el:d,state:"visible"}),()=>i(d,On.Unmount)}),a=v.useRef([]),l=v.useRef(Promise.resolve()),u=v.useRef({enter:[],leave:[]}),f=me((d,h,m)=>{a.current.splice(0),t&&(t.chains.current[h]=t.chains.current[h].filter(([x])=>x!==d)),t==null||t.chains.current[h].push([d,new Promise(x=>{a.current.push(x)})]),t==null||t.chains.current[h].push([d,new Promise(x=>{Promise.all(u.current[h].map(([P,E])=>E)).then(()=>x())})]),h==="enter"?l.current=l.current.then(()=>t==null?void 0:t.wait.current).then(()=>m(h)):m(h)}),p=me((d,h,m)=>{Promise.all(u.current[h].splice(0).map(([x,P])=>P)).then(()=>{var x;(x=a.current.shift())==null||x()}).then(()=>m(h))});return v.useMemo(()=>({children:r,register:c,unregister:i,onStart:f,onStop:p,wait:l,chains:u}),[c,i,r,f,p,u,l])}let hh=v.Fragment,mh=Us.RenderStrategy;function F8(e,t){var n,r;let{transition:o=!0,beforeEnter:s,afterEnter:i,beforeLeave:c,afterLeave:a,enter:l,enterFrom:u,enterTo:f,entered:p,leave:d,leaveFrom:h,leaveTo:m,...x}=e,[P,E]=v.useState(null),T=v.useRef(null),N=dh(e),M=gt(...N?[T,t,E]:t===null?[]:[t]),F=(n=x.unmount)==null||n?On.Unmount:On.Hidden,{show:L,appear:b,initial:g}=B8(),[w,O]=v.useState(L?"visible":"hidden"),C=L8(),{register:I,unregister:k}=C;Te(()=>I(T),[I,T]),Te(()=>{if(F===On.Hidden&&T.current){if(L&&w!=="visible"){O("visible");return}return bt(w,{hidden:()=>k(T),visible:()=>I(T)})}},[w,T,I,k,L,F]);let y=fh();Te(()=>{if(N&&y&&w==="visible"&&T.current===null)throw new Error("Did you forget to passthrough the `ref` to the actual DOM node?")},[T,w,y,N]);let A=g&&!b,D=b&&L&&g,S=v.useRef(!1),B=ph(()=>{S.current||(O("hidden"),k(T))},C),j=me(J=>{S.current=!0;let K=J?"enter":"leave";B.onStart(T,K,ee=>{ee==="enter"?s==null||s():ee==="leave"&&(c==null||c())})}),_=me(J=>{let K=J?"enter":"leave";S.current=!1,B.onStop(T,K,ee=>{ee==="enter"?i==null||i():ee==="leave"&&(a==null||a())}),K==="leave"&&!ci(B)&&(O("hidden"),k(T))});v.useEffect(()=>{N&&o||(j(L),_(L))},[L,N,o]);let W=!(!o||!N||!y||A),[,q]=yp(W,P,L,{start:j,end:_}),Z=In({ref:M,className:((r=Pc(x.className,D&&l,D&&u,q.enter&&l,q.enter&&q.closed&&u,q.enter&&!q.closed&&f,q.leave&&d,q.leave&&!q.closed&&h,q.leave&&q.closed&&m,!q.transition&&L&&p))==null?void 0:r.trim())||void 0,...gp(q)}),H=0;w==="visible"&&(H|=Mt.Open),w==="hidden"&&(H|=Mt.Closed),L&&w==="hidden"&&(H|=Mt.Opening),!L&&w==="visible"&&(H|=Mt.Closing);let U=at();return v.createElement(ai.Provider,{value:B},v.createElement(ih,{value:H},U({ourProps:Z,theirProps:x,defaultTag:hh,features:mh,visible:w==="visible",name:"Transition.Child"})))}function R8(e,t){let{show:n,appear:r=!1,unmount:o=!0,...s}=e,i=v.useRef(null),c=dh(e),a=gt(...c?[i,t]:t===null?[]:[t]);fh();let l=il();if(n===void 0&&l!==null&&(n=(l&Mt.Open)===Mt.Open),n===void 0)throw new Error("A <Transition /> is used but it is missing a `show={true | false}` prop.");let[u,f]=v.useState(n?"visible":"hidden"),p=ph(()=>{n||f("hidden")}),[d,h]=v.useState(!0),m=v.useRef([n]);Te(()=>{d!==!1&&m.current[m.current.length-1]!==n&&(m.current.push(n),h(!1))},[m,n]);let x=v.useMemo(()=>({show:n,appear:r,initial:d}),[n,r,d]);Te(()=>{n?f("visible"):!ci(p)&&i.current!==null&&f("hidden")},[n,p]);let P={unmount:o},E=me(()=>{var M;d&&h(!1),(M=e.beforeEnter)==null||M.call(e)}),T=me(()=>{var M;d&&h(!1),(M=e.beforeLeave)==null||M.call(e)}),N=at();return v.createElement(ai.Provider,{value:p},v.createElement(ii.Provider,{value:x},N({ourProps:{...P,as:v.Fragment,children:v.createElement(bh,{ref:a,...P,...s,beforeEnter:E,beforeLeave:T})},theirProps:{},defaultTag:v.Fragment,features:mh,visible:u==="visible",name:"Transition"})))}function j8(e,t){let n=v.useContext(ii)!==null,r=il()!==null;return v.createElement(v.Fragment,null,!n&&r?v.createElement(al,{ref:t,...e}):v.createElement(bh,{ref:t,...e}))}let al=Ke(R8),bh=Ke(F8),z8=Ke(j8),cl=Object.assign(al,{Child:z8,Root:al}),gh=/([\u2700-\u27BF]|[\uE000-\uF8FF]|\uD83C[\uDC00-\uDFFF]|\uD83D[\uDC00-\uDFFF]|[\u2011-\u26FF]|\uD83E[\uDD10-\uDDFF])/g;function yh(e){var t,n;let r=(t=e.innerText)!=null?t:"",o=e.cloneNode(!0);if(!fn(o))return r;let s=!1;for(let c of o.querySelectorAll('[hidden],[aria-hidden],[role="img"]'))c.remove(),s=!0;let i=s?(n=o.innerText)!=null?n:"":r;return gh.test(i)&&(i=i.replace(gh,"")),i}function U8(e){let t=e.getAttribute("aria-label");if(typeof t=="string")return t.trim();let n=e.getAttribute("aria-labelledby");if(n){let r=n.split(" ").map(o=>{let s=document.getElementById(o);if(s){let i=s.getAttribute("aria-label");return typeof i=="string"?i.trim():yh(s).trim()}return null}).filter(Boolean);if(r.length>0)return r.join(", ")}return yh(e).trim()}function _8(e){let t=v.useRef(""),n=v.useRef("");return me(()=>{let r=e.current;if(!r)return"";let o=r.innerText;if(t.current===o)return n.current;let s=U8(r).trim().toLowerCase();return t.current=o,n.current=s,s})}var W8=Object.defineProperty,V8=(e,t,n)=>t in e?W8(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,vh=(e,t,n)=>(V8(e,typeof t!="symbol"?t+"":t,n),n),Le=(e=>(e[e.Open=0]="Open",e[e.Closed=1]="Closed",e))(Le||{}),Dn=(e=>(e[e.Single=0]="Single",e[e.Multi=1]="Multi",e))(Dn||{}),li=(e=>(e[e.Pointer=0]="Pointer",e[e.Other=1]="Other",e))(li||{}),wh=(e=>(e[e.OpenListbox=0]="OpenListbox",e[e.CloseListbox=1]="CloseListbox",e[e.GoToOption=2]="GoToOption",e[e.Search=3]="Search",e[e.ClearSearch=4]="ClearSearch",e[e.SelectOption=5]="SelectOption",e[e.RegisterOptions=6]="RegisterOptions",e[e.UnregisterOptions=7]="UnregisterOptions",e[e.SetButtonElement=8]="SetButtonElement",e[e.SetOptionsElement=9]="SetOptionsElement",e[e.SortOptions=10]="SortOptions",e[e.MarkButtonAsMoved=11]="MarkButtonAsMoved",e))(wh||{});function xh(e,t=n=>n){let n=e.activeOptionIndex!==null?e.options[e.activeOptionIndex]:null,r=cp(t(e.options.slice()),s=>s.dataRef.current.domRef.current),o=n?r.indexOf(n):null;return o===-1&&(o=null),{options:r,activeOptionIndex:o}}let H8={1(e){if(e.dataRef.current.disabled||e.listboxState===1)return e;let t=e.buttonElement?si.Tracked(uh(e.buttonElement)):e.buttonPositionState;return{...e,activeOptionIndex:null,pendingFocus:{focus:Se.Nothing},listboxState:1,__demoMode:!1,buttonPositionState:t}},0(e,t){if(e.dataRef.current.disabled||e.listboxState===0)return e;let n=e.activeOptionIndex,{isSelected:r}=e.dataRef.current,o=e.options.findIndex(s=>r(s.dataRef.current.value));return o!==-1&&(n=o),{...e,frozenValue:!1,pendingFocus:t.focus,listboxState:0,activeOptionIndex:n,__demoMode:!1,buttonPositionState:si.Idle}},2(e,t){var n,r,o,s,i;if(e.dataRef.current.disabled||e.listboxState===1)return e;let c={...e,searchQuery:"",activationTrigger:(n=t.trigger)!=null?n:1,__demoMode:!1};if(t.focus===Se.Nothing)return{...c,activeOptionIndex:null};if(t.focus===Se.Specific)return{...c,activeOptionIndex:e.options.findIndex(u=>u.id===t.id)};if(t.focus===Se.Previous){let u=e.activeOptionIndex;if(u!==null){let f=e.options[u].dataRef.current.domRef,p=oi(t,{resolveItems:()=>e.options,resolveActiveIndex:()=>e.activeOptionIndex,resolveId:d=>d.id,resolveDisabled:d=>d.dataRef.current.disabled});if(p!==null){let d=e.options[p].dataRef.current.domRef;if(((r=f.current)==null?void 0:r.previousElementSibling)===d.current||((o=d.current)==null?void 0:o.previousElementSibling)===null)return{...c,activeOptionIndex:p}}}}else if(t.focus===Se.Next){let u=e.activeOptionIndex;if(u!==null){let f=e.options[u].dataRef.current.domRef,p=oi(t,{resolveItems:()=>e.options,resolveActiveIndex:()=>e.activeOptionIndex,resolveId:d=>d.id,resolveDisabled:d=>d.dataRef.current.disabled});if(p!==null){let d=e.options[p].dataRef.current.domRef;if(((s=f.current)==null?void 0:s.nextElementSibling)===d.current||((i=d.current)==null?void 0:i.nextElementSibling)===null)return{...c,activeOptionIndex:p}}}}let a=xh(e),l=oi(t,{resolveItems:()=>a.options,resolveActiveIndex:()=>a.activeOptionIndex,resolveId:u=>u.id,resolveDisabled:u=>u.dataRef.current.disabled});return{...c,...a,activeOptionIndex:l}},3:(e,t)=>{if(e.dataRef.current.disabled||e.listboxState===1)return e;let n=e.searchQuery!==""?0:1,r=e.searchQuery+t.value.toLowerCase(),o=(e.activeOptionIndex!==null?e.options.slice(e.activeOptionIndex+n).concat(e.options.slice(0,e.activeOptionIndex+n)):e.options).find(i=>{var c;return!i.dataRef.current.disabled&&((c=i.dataRef.current.textValue)==null?void 0:c.startsWith(r))}),s=o?e.options.indexOf(o):-1;return s===-1||s===e.activeOptionIndex?{...e,searchQuery:r}:{...e,searchQuery:r,activeOptionIndex:s,activationTrigger:1}},4(e){return e.dataRef.current.disabled||e.listboxState===1||e.searchQuery===""?e:{...e,searchQuery:""}},5(e){return e.dataRef.current.mode===0?{...e,frozenValue:!0}:{...e}},6:(e,t)=>{let n=e.options.concat(t.options),r=e.activeOptionIndex;if(e.pendingFocus.focus!==Se.Nothing&&(r=oi(e.pendingFocus,{resolveItems:()=>n,resolveActiveIndex:()=>e.activeOptionIndex,resolveId:o=>o.id,resolveDisabled:o=>o.dataRef.current.disabled})),e.activeOptionIndex===null){let{isSelected:o}=e.dataRef.current;if(o){let s=n.findIndex(i=>o==null?void 0:o(i.dataRef.current.value));s!==-1&&(r=s)}}return{...e,options:n,activeOptionIndex:r,pendingFocus:{focus:Se.Nothing},pendingShouldSort:!0}},7:(e,t)=>{let n=e.options,r=[],o=new Set(t.options);for(let[s,i]of n.entries())if(o.has(i.id)&&(r.push(s),o.delete(i.id),o.size===0))break;if(r.length>0){n=n.slice();for(let s of r.reverse())n.splice(s,1)}return{...e,options:n,activationTrigger:1}},8:(e,t)=>e.buttonElement===t.element?e:{...e,buttonElement:t.element},9:(e,t)=>e.optionsElement===t.element?e:{...e,optionsElement:t.element},10:e=>e.pendingShouldSort?{...e,...xh(e),pendingShouldSort:!1}:e,11(e){return e.buttonPositionState.kind!=="Tracked"?e:{...e,buttonPositionState:si.Moved}}};class ll extends Y0{constructor(t){super(t),vh(this,"actions",{onChange:n=>{let{onChange:r,compare:o,mode:s,value:i}=this.state.dataRef.current;return bt(s,{0:()=>r==null?void 0:r(n),1:()=>{let c=i.slice(),a=c.findIndex(l=>o(l,n));return a===-1?c.push(n):c.splice(a,1),r==null?void 0:r(c)}})},registerOption:Ic(()=>{let n=[],r=new Set;return[(o,s)=>{r.has(s)||(r.add(s),n.push({id:o,dataRef:s}))},()=>(r.clear(),this.send({type:6,options:n.splice(0)}))]}),unregisterOption:Ic(()=>{let n=[];return[r=>n.push(r),()=>{this.send({type:7,options:n.splice(0)})}]}),goToOption:Ic(()=>{let n=null;return[(r,o)=>{n={type:2,...r,trigger:o}},()=>n&&this.send(n)]}),closeListbox:()=>{this.send({type:1})},openListbox:n=>{this.send({type:0,focus:n})},selectActiveOption:()=>{var n;if(this.state.activeOptionIndex!==null){let{dataRef:r}=this.state.options[this.state.activeOptionIndex];this.actions.selectOption(r.current.value)}else this.state.dataRef.current.mode===0&&(this.actions.closeListbox(),(n=this.state.buttonElement)==null||n.focus({preventScroll:!0}))},selectOption:n=>{this.send({type:5,value:n})},search:n=>{this.send({type:3,value:n})},clearSearch:()=>{this.send({type:4})},setButtonElement:n=>{this.send({type:8,element:n})},setOptionsElement:n=>{this.send({type:9,element:n})}}),vh(this,"selectors",{activeDescendantId(n){var r;let o=n.activeOptionIndex,s=n.options;return o===null||(r=s[o])==null?void 0:r.id},isActive(n,r){var o;let s=n.activeOptionIndex,i=n.options;return s!==null?((o=i[s])==null?void 0:o.id)===r:!1},hasFrozenValue(n){return n.frozenValue},shouldScrollIntoView(n,r){return n.__demoMode||n.listboxState!==0||n.activationTrigger===0?!1:this.isActive(n,r)},didButtonMove(n){return n.buttonPositionState.kind==="Moved"}}),this.on(6,()=>{requestAnimationFrame(()=>{this.send({type:10})})});{let n=this.state.id,r=$c.get(null);this.disposables.add(r.on(ep.Push,o=>{!r.selectors.isTop(o,n)&&this.state.listboxState===0&&this.actions.closeListbox()})),this.on(0,()=>r.actions.push(n)),this.on(1,()=>r.actions.pop(n))}this.disposables.group(n=>{this.on(1,r=>{r.buttonElement&&(n.dispose(),n.add($8(r.buttonElement,r.buttonPositionState,()=>{this.send({type:11})})))})}),this.on(5,(n,r)=>{var o;this.actions.onChange(r.value),this.state.dataRef.current.mode===0&&(this.actions.closeListbox(),(o=this.state.buttonElement)==null||o.focus({preventScroll:!0}))})}static new({id:t,__demoMode:n=!1}){return new ll({id:t,dataRef:{current:{}},listboxState:n?0:1,options:[],searchQuery:"",activeOptionIndex:null,activationTrigger:1,buttonElement:null,optionsElement:null,pendingShouldSort:!1,pendingFocus:{focus:Se.Nothing},frozenValue:!1,__demoMode:n,buttonPositionState:si.Idle})}reduce(t,n){return bt(n.type,H8,t,n)}}const Eh=v.createContext(null);function ul(e){let t=v.useContext(Eh);if(t===null){let n=new Error(`<${e} /> is missing a parent <Listbox /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,Sh),n}return t}function Sh({id:e,__demoMode:t=!1}){let n=v.useMemo(()=>ll.new({id:e,__demoMode:t}),[]);return ah(()=>n.dispose()),n}let ui=v.createContext(null);ui.displayName="ListboxDataContext";function Ho(e){let t=v.useContext(ui);if(t===null){let n=new Error(`<${e} /> is missing a parent <Listbox /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,Ho),n}return t}let G8=v.Fragment;function q8(e,t){let n=v.useId(),r=Sc(),{value:o,defaultValue:s,form:i,name:c,onChange:a,by:l,invalid:u=!1,disabled:f=r||!1,horizontal:p=!1,multiple:d=!1,__demoMode:h=!1,...m}=e;const x=p?"horizontal":"vertical";let P=gt(t),E=px(s),[T=d?[]:void 0,N]=dx(o,a,E),M=Sh({id:n,__demoMode:h}),F=v.useRef({static:!1,hold:!1}),L=v.useRef(new Map),b=jx(l),g=v.useCallback(W=>bt(w.mode,{[Dn.Multi]:()=>T.some(q=>b(q,W)),[Dn.Single]:()=>b(T,W)}),[T]),w=Cn({value:T,disabled:f,invalid:u,mode:d?Dn.Multi:Dn.Single,orientation:x,onChange:N,compare:b,isSelected:g,optionsPropsRef:F,listRef:L});Te(()=>{M.state.dataRef.current=w},[w]);let O=Ze(M,W=>W.listboxState),C=$c.get(null),I=Ze(C,v.useCallback(W=>C.selectors.isTop(W,n),[C,n])),[k,y]=Ze(M,W=>[W.buttonElement,W.optionsElement]);d2(I,[k,y],(W,q)=>{M.send({type:wh.CloseListbox}),ap(q,Rc.Loose)||(W.preventDefault(),k==null||k.focus())});let A=Cn({open:O===Le.Open,disabled:f,invalid:u,value:T}),[D,S]=Dx({inherit:!0}),B={ref:P},j=v.useCallback(()=>{if(E!==void 0)return N==null?void 0:N(E)},[N,E]),_=at();return v.createElement(S,{value:D,props:{htmlFor:k==null?void 0:k.id},slot:{open:O===Le.Open,disabled:f}},v.createElement(m8,null,v.createElement(Eh.Provider,{value:M},v.createElement(ui.Provider,{value:w},v.createElement(ih,{value:bt(O,{[Le.Open]:Mt.Open,[Le.Closed]:Mt.Closed})},c!=null&&T!=null&&v.createElement(wx,{disabled:f,data:{[c]:T},form:i,onReset:j}),_({ourProps:B,theirProps:m,slot:A,defaultTag:G8,name:"Listbox"}))))))}let K8="button";function Z8(e,t){let n=v.useId(),r=B0(),o=Ho("Listbox.Button"),s=ul("Listbox.Button"),{id:i=r||`headlessui-listbox-button-${n}`,disabled:c=o.disabled||!1,autoFocus:a=!1,...l}=e,u=gt(t,f8(),s.actions.setButtonElement),f=d8(),[p,d,h]=Ze(s,y=>[y.listboxState,y.buttonElement,y.optionsElement]),m=p===Le.Open;m2(m,{trigger:d,action:v.useCallback(y=>{if(d!=null&&d.contains(y.target))return Hs.Ignore;let A=y.target.closest('[role="option"]:not([data-disabled])');return fn(A)?Hs.Select(A):h!=null&&h.contains(y.target)?Hs.Ignore:Hs.Close},[d,h]),close:s.actions.closeListbox,select:s.actions.selectActiveOption});let x=me(y=>{switch(y.key){case ke.Enter:hx(y.currentTarget);break;case ke.Space:case ke.ArrowDown:y.preventDefault(),s.actions.openListbox({focus:o.value?Se.Nothing:Se.First});break;case ke.ArrowUp:y.preventDefault(),s.actions.openListbox({focus:o.value?Se.Nothing:Se.Last});break}}),P=me(y=>{switch(y.key){case ke.Space:y.preventDefault();break}}),E=Ux(y=>{var A;s.state.listboxState===Le.Open?(Ue.flushSync(()=>s.actions.closeListbox()),(A=s.state.buttonElement)==null||A.focus({preventScroll:!0})):(y.preventDefault(),s.actions.openListbox({focus:Se.Nothing}))}),T=me(y=>y.preventDefault()),N=V0([i]),M=Ox(),{isFocusVisible:F,focusProps:L}=J5({autoFocus:a}),{isHovered:b,hoverProps:g}=X5({isDisabled:c}),{pressed:w,pressProps:O}=sx({disabled:c}),C=Cn({open:p===Le.Open,active:w||p===Le.Open,disabled:c,invalid:o.invalid,value:o.value,hover:b,focus:F,autofocus:a}),I=Ze(s,y=>y.listboxState===Le.Open),k=I0(f(),{ref:u,id:i,type:b2(e,d),"aria-haspopup":"listbox","aria-controls":h==null?void 0:h.id,"aria-expanded":I,"aria-labelledby":N,"aria-describedby":M,disabled:c||void 0,autoFocus:a,onKeyDown:x,onKeyUp:P,onKeyPress:T},E,L,g,O);return at()({ourProps:k,theirProps:l,slot:C,defaultTag:K8,name:"Listbox.Button"})}let Ph=v.createContext(!1),Y8="div",X8=Us.RenderStrategy|Us.Static;function J8(e,t){let n=v.useId(),{id:r=`headlessui-listbox-options-${n}`,anchor:o,portal:s=!1,modal:i=!0,transition:c=!1,...a}=e,l=u8(o),[u,f]=v.useState(null);l&&(s=!0);let p=Ho("Listbox.Options"),d=ul("Listbox.Options"),[h,m,x,P]=Ze(d,U=>[U.listboxState,U.buttonElement,U.optionsElement,U.__demoMode]),E=jc(m),T=jc(x),N=il(),[M,F]=yp(c,u,N!==null?(N&Mt.Open)===Mt.Open:h===Le.Open);e2(M,m,d.actions.closeListbox);let L=P?!1:i&&h===Le.Open;S2(L,T);let b=P?!1:i&&h===Le.Open;Qx(b,{allowed:v.useCallback(()=>[m,x],[m,x])});let g=Ze(d,d.selectors.didButtonMove)?!1:M,w=Ze(d,d.selectors.hasFrozenValue)&&!e.static,O=sh(w,p.value),C=v.useCallback(U=>p.compare(O,U),[p.compare,O]),I=Ze(d,U=>{var J;if(l==null||!((J=l==null?void 0:l.to)!=null&&J.includes("selection")))return null;let K=U.options.findIndex(ee=>C(ee.dataRef.current.value));return K===-1&&(K=0),K}),k=(()=>{if(l==null)return;if(I===null)return{...l,inner:void 0};let U=Array.from(p.listRef.current.values());return{...l,inner:{listRef:{current:U},index:I}}})(),[y,A]=h8(k),D=p8(),S=gt(t,l?y:null,d.actions.setOptionsElement,f),B=Yn();v.useEffect(()=>{let U=x;U&&h===Le.Open&&(nx(U)||U==null||U.focus({preventScroll:!0}))},[h,x]);let j=me(U=>{var J;switch(B.dispose(),U.key){case ke.Space:if(d.state.searchQuery!=="")return U.preventDefault(),U.stopPropagation(),d.actions.search(U.key);case ke.Enter:U.preventDefault(),U.stopPropagation(),d.actions.selectActiveOption();break;case bt(p.orientation,{vertical:ke.ArrowDown,horizontal:ke.ArrowRight}):return U.preventDefault(),U.stopPropagation(),d.actions.goToOption({focus:Se.Next});case bt(p.orientation,{vertical:ke.ArrowUp,horizontal:ke.ArrowLeft}):return U.preventDefault(),U.stopPropagation(),d.actions.goToOption({focus:Se.Previous});case ke.Home:case ke.PageUp:return U.preventDefault(),U.stopPropagation(),d.actions.goToOption({focus:Se.First});case ke.End:case ke.PageDown:return U.preventDefault(),U.stopPropagation(),d.actions.goToOption({focus:Se.Last});case ke.Escape:U.preventDefault(),U.stopPropagation(),Ue.flushSync(()=>d.actions.closeListbox()),(J=d.state.buttonElement)==null||J.focus({preventScroll:!0});return;case ke.Tab:U.preventDefault(),U.stopPropagation(),Ue.flushSync(()=>d.actions.closeListbox()),c2(d.state.buttonElement,U.shiftKey?Fc.Previous:Fc.Next);break;default:U.key.length===1&&(d.actions.search(U.key),B.setTimeout(()=>d.actions.clearSearch(),350));break}}),_=Ze(d,U=>{var J;return(J=U.buttonElement)==null?void 0:J.id}),W=Cn({open:h===Le.Open}),q=I0(l?D():{},{id:r,ref:S,"aria-activedescendant":Ze(d,d.selectors.activeDescendantId),"aria-multiselectable":p.mode===Dn.Multi?!0:void 0,"aria-labelledby":_,"aria-orientation":p.orientation,onKeyDown:j,role:"listbox",tabIndex:h===Le.Open?0:void 0,style:{...a.style,...A,"--button-width":zx(M,m,!0).width},...gp(F)}),Z=at(),H=v.useMemo(()=>p.mode===Dn.Multi?p:{...p,isSelected:C},[p,C]);return v.createElement(I8,{enabled:s?e.static||M:!1,ownerDocument:E},v.createElement(ui.Provider,{value:H},Z({ourProps:q,theirProps:a,slot:W,defaultTag:Y8,features:X8,visible:g,name:"Listbox.Options"})))}let Q8="div";function e3(e,t){let n=v.useId(),{id:r=`headlessui-listbox-option-${n}`,disabled:o=!1,value:s,...i}=e,c=v.useContext(Ph)===!0,a=Ho("Listbox.Option"),l=ul("Listbox.Option"),u=Ze(l,w=>l.selectors.isActive(w,r)),f=a.isSelected(s),p=v.useRef(null),d=_8(p),h=Xn({disabled:o,value:s,domRef:p,get textValue(){return d()}}),m=gt(t,p,w=>{w?a.listRef.current.set(r,w):a.listRef.current.delete(r)}),x=Ze(l,w=>l.selectors.shouldScrollIntoView(w,r));Te(()=>{if(x)return it().requestAnimationFrame(()=>{var w,O;(O=(w=p.current)==null?void 0:w.scrollIntoView)==null||O.call(w,{block:"nearest"})})},[x,p]),Te(()=>{if(!c)return l.actions.registerOption(r,h),()=>l.actions.unregisterOption(r)},[h,r,c]);let P=me(w=>{if(o)return w.preventDefault();l.actions.selectOption(s)}),E=me(()=>{if(o)return l.actions.goToOption({focus:Se.Nothing});l.actions.goToOption({focus:Se.Specific,id:r})}),T=P2(),N=me(w=>T.update(w)),M=me(w=>{T.wasMoved(w)&&(o||u&&l.state.activationTrigger===li.Pointer||l.actions.goToOption({focus:Se.Specific,id:r},li.Pointer))}),F=me(w=>{T.wasMoved(w)&&(o||u&&l.state.activationTrigger===li.Pointer&&l.actions.goToOption({focus:Se.Nothing}))}),L=Cn({active:u,focus:u,selected:f,disabled:o,selectedOption:f&&c}),b=c?{}:{id:r,ref:m,role:"option",tabIndex:o===!0?void 0:-1,"aria-disabled":o===!0?!0:void 0,"aria-selected":f,disabled:void 0,onClick:P,onFocus:E,onPointerEnter:N,onMouseEnter:N,onPointerMove:M,onMouseMove:M,onPointerLeave:F,onMouseLeave:F},g=at();return!f&&c?null:g({ourProps:b,theirProps:i,slot:L,defaultTag:Q8,name:"Listbox.Option"})}let t3=v.Fragment;function n3(e,t){let{options:n,placeholder:r,...o}=e,s={ref:gt(t)},i=Ho("ListboxSelectedOption"),c=Cn({}),a=i.value===void 0||i.value===null||i.mode===Dn.Multi&&Array.isArray(i.value)&&i.value.length===0,l=at();return v.createElement(Ph.Provider,{value:!0},l({ourProps:s,theirProps:{...o,children:v.createElement(v.Fragment,null,r&&a?r:n)},slot:c,defaultTag:t3,name:"ListboxSelectedOption"}))}let r3=Ke(q8),o3=Ke(Z8),s3=Fx,i3=Ke(J8),a3=Ke(e3),c3=Ke(n3),wt=Object.assign(r3,{Button:o3,Label:s3,Options:i3,Option:a3,SelectedOption:c3});const l3=()=>$.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",children:[$.jsx("g",{clipPath:"url(#clip0_active)",children:$.jsx("path",{d:"M4.63791 6.91929H2.62541C2.36266 6.91929 2.18141 6.65629 2.27491 6.41091L4.27466 1.16191C4.30172 1.0909 4.34971 1.02978 4.41228 0.986649C4.47485 0.943521 4.54905 0.920422 4.62504 0.92041H7.99954C8.26579 0.92041 8.44729 1.19016 8.34679 1.43679L7.18241 4.29479H9.37441C9.69679 4.29479 9.86879 4.67479 9.65616 4.91704L4.28191 11.0408C4.02066 11.3385 3.53629 11.0805 3.63766 10.6977L4.63791 6.91929Z",fill:"#22FD73"})}),$.jsx("defs",{children:$.jsx("clipPath",{id:"clip0_active",children:$.jsx("rect",{width:"12",height:"12",fill:"white",transform:"translate(0 0.0454102)"})})})]}),u3=()=>$.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",children:[$.jsx("g",{clipPath:"url(#clip0_inactive)",children:$.jsx("path",{d:"M4.63791 6.91929H2.62541C2.36266 6.91929 2.18141 6.65629 2.27491 6.41091L4.27466 1.16191C4.30172 1.0909 4.34971 1.02978 4.41228 0.986649C4.47485 0.943521 4.54905 0.920422 4.62504 0.92041H7.99954C8.26579 0.92041 8.44729 1.19016 8.34679 1.43679L7.18241 4.29479H9.37441C9.69679 4.29479 9.86879 4.67479 9.65616 4.91704L4.28191 11.0408C4.02066 11.3385 3.53629 11.0805 3.63766 10.6977L4.63791 6.91929Z",fill:"#F9F9F9"})}),$.jsx("defs",{children:$.jsx("clipPath",{id:"clip0_inactive",children:$.jsx("rect",{width:"12",height:"12",fill:"white",transform:"translate(0 0.0454102)"})})})]}),Go=({selectedLevel:e,maxLevel:t,className:n=""})=>{const r=Array.from({length:t},(o,s)=>s+1);return $.jsx("div",{className:`flex items-center ${n}`,children:r.map(o=>$.jsx("div",{className:"flex items-center justify-center",children:o>t-e?$.jsx(l3,{}):$.jsx(u3,{})},o))})};class Bt{}Xo(Bt,"FAST",3),Xo(Bt,"Medium",2),Xo(Bt,"SLOW",1),Xo(Bt,"NONE",0);const f3=Object.values({MAINNET:1,SEPOLIA:11155111}),bn=e=>{const t=typeof e=="string"?parseInt(e,10):e;return f3.includes(t)},d3={USDT:!0},Th=(e,t)=>{const n=typeof e=="string"?parseInt(e,10):e;return n===1||n===11155111?!1:(n===42161||n===421614)&&t?t.toUpperCase()==="ETH"?!1:!d3[t.toUpperCase()]:!0},p3=({chains:e,selectedChain:t,onChainChange:n,disabled:r=!1,className:o="",walletType:s="mpc"})=>{const{t:i}=Pt();return $.jsx("div",{className:`relative ${o}`,children:$.jsx(wt,{value:t,onChange:n,disabled:r,children:({open:c})=>$.jsxs($.Fragment,{children:[$.jsxs(wt.Button,{className:`
|
|
131
140
|
relative w-full h-9 text-text-primary bg-fill-input-primary
|
|
132
141
|
items-center justify-between flex px-3 rounded-lg
|
|
133
142
|
focus:outline-none
|
|
134
143
|
${r?"opacity-50 cursor-not-allowed":"cursor-pointer hover:bg-fill-btn-secondary-hover"}
|
|
135
144
|
${c?"ring-1 ring-white":""}
|
|
136
|
-
`,children:[
|
|
145
|
+
`,children:[$.jsx("span",{className:"text-sm leading-[18px] font-medium",children:i("deposit.chain")}),$.jsxs("div",{className:"flex items-center space-x-2",children:[t.chainIconUrl?$.jsx("img",{src:t.chainIconUrl,alt:t.chain,className:"w-4 h-4 rounded-full"}):$.jsx("div",{className:"w-4 h-4 rounded-full bg-blue-500 flex items-center justify-center",children:$.jsx("span",{className:"text-xs text-white font-bold",children:t.chain.charAt(0)})}),$.jsx("span",{className:"text-sm text-white ml-1",children:t.chain}),$.jsxs("svg",{className:`w-3 h-3 ml-2 transition-transform duration-200 ${c?"rotate-180":""}`,xmlns:"http://www.w3.org/2000/svg",width:"10",height:"11",viewBox:"0 0 10 11",fill:"none",children:[$.jsx("g",{clipPath:"url(#clip0_12919_27745)",children:$.jsx("path",{d:"M5.32733 7.6716C5.13944 7.83432 4.86056 7.83432 4.67267 7.6716L1.68366 5.08304C1.33371 4.77997 1.54804 4.20508 2.01099 4.20508L7.98901 4.20508C8.45196 4.20508 8.66629 4.77998 8.31634 5.08304L5.32733 7.6716Z",fill:"#F9F9F9"})}),$.jsx("defs",{children:$.jsx("clipPath",{id:"clip0_12919_27745",children:$.jsx("rect",{width:"10",height:"10",fill:"white",transform:"translate(0 0.955078)"})})})]})]})]}),$.jsx(cl,{as:v.Fragment,enter:"transition ease-out duration-100",enterFrom:"transform opacity-0 scale-95",enterTo:"transform opacity-100 scale-100",leave:"transition ease-in duration-75",leaveFrom:"transform opacity-100 scale-100",leaveTo:"transform opacity-0 scale-95",children:$.jsx(wt.Options,{className:`
|
|
137
146
|
absolute z-50 mt-1 w-full max-h-60 overflow-auto rounded-lg
|
|
138
147
|
bg-fill-input-primary border border-line-divider-secondary shadow-lg
|
|
139
148
|
focus:outline-none
|
|
140
|
-
`,children:e.filter(a=>a[s==="mpc"?"allowAaDeposit":"allowDeposit"]!==!1).map(a
|
|
149
|
+
`,children:e.filter(a=>a[s==="mpc"?"allowAaDeposit":"allowDeposit"]!==!1).map(a=>$.jsx(wt.Option,{value:a,className:({active:l,selected:u})=>`relative cursor-pointer select-none py-3 px-3 ${u?"bg-fill-btn-secondary":l?"bg-fill-input-secondary":""}`,children:({selected:l,active:u})=>$.jsx($.Fragment,{children:$.jsxs("div",{className:"flex items-center justify-between",children:[$.jsxs("div",{className:"flex items-center space-x-3",children:[a.chainIconUrl?$.jsx("img",{src:a.chainIconUrl,alt:a.chain,className:"w-5 h-5 rounded-full"}):$.jsx("div",{className:"w-5 h-5 rounded-full bg-blue-500 flex items-center justify-center",children:$.jsx("span",{className:"text-xs text-white font-bold",children:a.chain.charAt(0)})}),$.jsx("div",{className:"flex flex-col",children:$.jsx("span",{className:`text-sm font-medium ${l||u?"text-text-primary":"text-text-tertiary"}`,children:a.chain})})]}),$.jsx("div",{className:"w-12 bg-fill-page-secondary p-1 h-5 flex rounded",children:$.jsx(Go,{className:"w-full justify-between",selectedLevel:bn(a.chainId)?Bt.SLOW:Bt.FAST,maxLevel:3})})]})})},a.chainId))})})]})})})},h3=({tokens:e,selectedToken:t,onTokenChange:n,disabled:r=!1,className:o="",walletType:s,accountType:i})=>{const{t:c}=Pt(),a=l=>l.token||l.symbol;return $.jsx("div",{className:`relative ${o}`,children:$.jsx(wt,{value:t,onChange:n,disabled:r,children:({open:l})=>$.jsxs($.Fragment,{children:[$.jsxs(wt.Button,{className:`
|
|
141
150
|
relative w-full h-9 text-text-primary bg-fill-input-primary
|
|
142
151
|
items-center justify-between flex px-3 rounded-lg
|
|
143
152
|
focus:outline-none
|
|
144
153
|
${r?"opacity-50 cursor-not-allowed":"cursor-pointer hover:bg-fill-btn-secondary-hover"}
|
|
145
|
-
${
|
|
146
|
-
`,children:[
|
|
147
|
-
absolute z-50 mt-1 w-full max-h-
|
|
154
|
+
${l?"ring-1 ring-white":""}
|
|
155
|
+
`,children:[$.jsx("span",{className:"text-sm leading-[18px] font-medium",children:c("deposit.asset")}),$.jsxs("div",{className:"flex items-center space-x-2",children:[$.jsx("img",{src:t.iconUrl,alt:a(t),className:"w-4 h-4 rounded-full"}),$.jsx("span",{className:"text-sm text-white ml-1",children:a(t)}),$.jsxs("svg",{className:`w-3 h-3 ml-2 transition-transform duration-200 ${l?"rotate-180":""}`,xmlns:"http://www.w3.org/2000/svg",width:"10",height:"11",viewBox:"0 0 10 11",fill:"none",children:[$.jsx("g",{clipPath:"url(#clip0_asset_selector)",children:$.jsx("path",{d:"M5.32733 7.6716C5.13944 7.83432 4.86056 7.83432 4.67267 7.6716L1.68366 5.08304C1.33371 4.77997 1.54804 4.20508 2.01099 4.20508L7.98901 4.20508C8.45196 4.20508 8.66629 4.77998 8.31634 5.08304L5.32733 7.6716Z",fill:"#F9F9F9"})}),$.jsx("defs",{children:$.jsx("clipPath",{id:"clip0_asset_selector",children:$.jsx("rect",{width:"10",height:"10",fill:"white",transform:"translate(0 0.955078)"})})})]})]})]}),$.jsx(cl,{as:v.Fragment,enter:"transition ease-out duration-100",enterFrom:"transform opacity-0 scale-95",enterTo:"transform opacity-100 scale-100",leave:"transition ease-in duration-75",leaveFrom:"transform opacity-100 scale-100",leaveTo:"transform opacity-0 scale-95",children:$.jsx(wt.Options,{className:`
|
|
156
|
+
absolute z-50 mt-1 w-full max-h-[230px] overflow-y-auto rounded-lg
|
|
148
157
|
bg-fill-input-primary border border-line-divider-secondary shadow-lg
|
|
149
158
|
focus:outline-none
|
|
150
|
-
`,children:e.map(
|
|
159
|
+
`,children:e.map(u=>$.jsx(wt.Option,{value:u,className:({active:f,selected:p})=>`relative cursor-pointer select-none py-3 px-3 ${p?"bg-fill-btn-secondary":f?"bg-fill-input-secondary":""}`,children:({selected:f,active:p})=>$.jsxs("div",{className:"flex items-center space-x-3",children:[$.jsx("img",{src:u.iconUrl,alt:a(u),className:"w-5 h-5 rounded-full"}),$.jsxs("div",{className:"flex flex-col",children:[$.jsx("span",{className:`text-sm font-medium ${f||p?"text-text-primary":"text-text-tertiary"}`,children:a(u)}),s===ln&&i==="perpetual"&&u.token==="USDC"&&$.jsx("p",{className:"mt-2 text-xs text-text-tertiary whitespace-pre-line",children:c("deposit.defaultSpotNotice")})]})]})},a(u)))})})]})})})},Ah=({currentActiveChain:e,chainList:t,onChainChange:n,curSelectToken:r,onTokenChange:o,walletType:s=ln,txType:i="deposit",accountType:c})=>{const a=v.useCallback(x=>i==="withdraw"?s===ln?x.allowAaWithdraw!==!1:x.allowWithdraw!==!1:s===ln?x.allowAaDeposit!==!1:x.allowDeposit!==!1,[i,s]),l=v.useMemo(()=>{const x=new Set,P=[];for(const E of t)if(a(E))for(const T of E.tokenList||[]){const N=T.symbol||T.token;!N||!(i!=="withdraw"||T.withdrawEnable===!0&&T.pullOff===!1)||x.has(N)||(x.add(N),P.push({token:N,symbol:N,iconUrl:T.iconUrl,decimals:T.decimals,tokenAddress:T.tokenAddress}))}return P},[t,a,i]),u=x=>{n(x.chainId)},f=x=>{const P=x.symbol||x.token;o(P);const E=[];for(const T of t){if(!a(T))continue;(T.tokenList||[]).some(M=>(M.symbol||M.token)===P)&&E.push(T.chainId)}!E.includes(e.chainId)&&E[0]!==void 0&&n(E[0])},p=v.useMemo(()=>{var E,T;const x=r||((E=l[0])==null?void 0:E.symbol)||((T=l[0])==null?void 0:T.token);if(!x)return[];const P=[];for(const N of t){if(!a(N))continue;const M=(N.tokenList||[]).find(F=>(F.symbol||F.token)===x?i==="withdraw"?F.withdrawEnable===!0&&F.pullOff===!1:!0:!1);M&&P.push({...N,tokenList:[{token:M.token,symbol:M.symbol,iconUrl:M.iconUrl,decimals:M.decimals,tokenAddress:M.tokenAddress}]})}return P},[t,r,l,a,i]),d=v.useMemo(()=>p.find(x=>x.chainId===e.chainId)||p[0],[p,e.chainId]),h=v.useMemo(()=>l,[l]),m=v.useMemo(()=>{if(h.length!==0)return h.find(x=>x.token===r||x.symbol===r)||h[0]},[h,r]);return v.useEffect(()=>{if(h.length===0)return;if(!h.some(P=>(P.symbol||P.token)===r)){const P=h[0];o(P.symbol||P.token)}},[h,r,o]),v.useEffect(()=>{if(p.length===0)return;p.some(P=>P.chainId===e.chainId)||n(p[0].chainId)},[p,e.chainId,n]),$.jsxs("div",{className:"space-y-4",children:[h.length>0&&m&&$.jsx(h3,{tokens:h,selectedToken:m,onTokenChange:f,walletType:s,accountType:c}),$.jsx(p3,{chains:p,selectedChain:d,onChainChange:x=>{const P=t.find(E=>E.chainId===x.chainId);P&&u(P)},walletType:s,className:"w-full"})]})},m3=({options:e})=>$.jsx($.Fragment,{children:e.map(t=>$.jsx(wt.Option,{value:t.value,className:({active:n,selected:r})=>`relative cursor-pointer select-none py-3 px-3 ${r?"bg-fill-btn-secondary":n?"bg-fill-input-secondary":""}`,children:({selected:n,active:r})=>$.jsx("div",{className:"flex items-center justify-between",children:$.jsx("div",{className:"flex items-center space-x-3",children:$.jsx("div",{className:"flex flex-col",children:$.jsx("span",{className:`text-sm font-medium ${n||r?"text-text-primary":"text-text-tertiary"}`,children:t.label})})})})},t.value))}),Nh=({selectedAccount:e,onAccountChange:t,options:n,disabled:r=!1,className:o=""})=>{var d;const{t:s}=Pt(),i=v.useMemo(()=>[{value:"spot",label:s("account.spot")},{value:"perpetual",label:s("account.perpetual-v1")}],[s]),c=n&&n.length>0?n:i,a=((d=c.find(h=>h.value===(e??"spot")))==null?void 0:d.label)||"",[l,u]=v.useState(e??"spot"),f=e??l,p=h=>{t==null||t(h),e||u(h)};return $.jsx("div",{className:`relative mb-4 ${o}`,children:$.jsx(wt,{value:f,onChange:p,disabled:r,children:({open:h})=>$.jsxs($.Fragment,{children:[$.jsxs(wt.Button,{className:`
|
|
151
160
|
relative w-full h-9 text-text-primary bg-fill-input-primary
|
|
152
161
|
items-center justify-between flex px-3 rounded-lg
|
|
153
162
|
focus:outline-none
|
|
154
|
-
${
|
|
155
|
-
${
|
|
156
|
-
`,children:[
|
|
163
|
+
${r?"opacity-50 cursor-not-allowed":"cursor-pointer hover:bg-fill-btn-secondary-hover"}
|
|
164
|
+
${h?"ring-1 ring-white":""}
|
|
165
|
+
`,children:[$.jsx("span",{className:"text-sm leading-[18px] font-medium",children:s("account.title")}),$.jsxs("div",{className:"flex items-center space-x-2",children:[$.jsx("span",{className:"text-sm text-white ml-1",children:a}),$.jsxs("svg",{className:`w-3 h-3 ml-2 transition-transform duration-200 ${h?"rotate-180":""}`,xmlns:"http://www.w3.org/2000/svg",width:"10",height:"11",viewBox:"0 0 10 11",fill:"none",children:[$.jsx("g",{clipPath:"url(#clip0_asset_selector)",children:$.jsx("path",{d:"M5.32733 7.6716C5.13944 7.83432 4.86056 7.83432 4.67267 7.6716L1.68366 5.08304C1.33371 4.77997 1.54804 4.20508 2.01099 4.20508L7.98901 4.20508C8.45196 4.20508 8.66629 4.77998 8.31634 5.08304L5.32733 7.6716Z",fill:"#F9F9F9"})}),$.jsx("defs",{children:$.jsx("clipPath",{id:"clip0_asset_selector",children:$.jsx("rect",{width:"10",height:"10",fill:"white",transform:"translate(0 0.955078)"})})})]})]})]}),$.jsx(cl,{as:v.Fragment,enter:"transition ease-out duration-100",enterFrom:"transform opacity-0 scale-95",enterTo:"transform opacity-100 scale-100",leave:"transition ease-in duration-75",leaveFrom:"transform opacity-100 scale-100",leaveTo:"transform opacity-0 scale-95",children:$.jsx(wt.Options,{className:`
|
|
157
166
|
absolute z-50 mt-1 w-full max-h-60 overflow-auto rounded-lg
|
|
158
167
|
bg-fill-input-primary border border-line-divider-secondary shadow-lg
|
|
159
168
|
focus:outline-none
|
|
160
|
-
`,children
|
|
169
|
+
`,children:$.jsx(m3,{options:c})})})]})})})};var fi={},b3=function(){var e=document.getSelection();if(!e.rangeCount)return function(){};for(var t=document.activeElement,n=[],r=0;r<e.rangeCount;r++)n.push(e.getRangeAt(r));switch(t.tagName.toUpperCase()){case"INPUT":case"TEXTAREA":t.blur();break;default:t=null;break}return e.removeAllRanges(),function(){e.type==="Caret"&&e.removeAllRanges(),e.rangeCount||n.forEach(function(o){e.addRange(o)}),t&&t.focus()}},g3=b3,Ch={"text/plain":"Text","text/html":"Url",default:"Text"},y3="Copy to clipboard: #{key}, Enter";function v3(e){var t=(/mac os x/i.test(navigator.userAgent)?"⌘":"Ctrl")+"+C";return e.replace(/#{\s*key\s*}/g,t)}function w3(e,t){var n,r,o,s,i,c,a=!1;t||(t={}),n=t.debug||!1;try{o=g3(),s=document.createRange(),i=document.getSelection(),c=document.createElement("span"),c.textContent=e,c.ariaHidden="true",c.style.all="unset",c.style.position="fixed",c.style.top=0,c.style.clip="rect(0, 0, 0, 0)",c.style.whiteSpace="pre",c.style.webkitUserSelect="text",c.style.MozUserSelect="text",c.style.msUserSelect="text",c.style.userSelect="text",c.addEventListener("copy",function(u){if(u.stopPropagation(),t.format)if(u.preventDefault(),typeof u.clipboardData>"u"){n&&console.warn("unable to use e.clipboardData"),n&&console.warn("trying IE specific stuff"),window.clipboardData.clearData();var f=Ch[t.format]||Ch.default;window.clipboardData.setData(f,e)}else u.clipboardData.clearData(),u.clipboardData.setData(t.format,e);t.onCopy&&(u.preventDefault(),t.onCopy(u.clipboardData))}),document.body.appendChild(c),s.selectNodeContents(c),i.addRange(s);var l=document.execCommand("copy");if(!l)throw new Error("copy command was unsuccessful");a=!0}catch(u){n&&console.error("unable to copy using execCommand: ",u),n&&console.warn("trying IE specific stuff");try{window.clipboardData.setData(t.format||"text",e),t.onCopy&&t.onCopy(window.clipboardData),a=!0}catch(f){n&&console.error("unable to copy using clipboardData: ",f),n&&console.error("falling back to prompt"),r=v3("message"in t?t.message:y3),window.prompt(r,e)}}finally{i&&(typeof i.removeRange=="function"?i.removeRange(s):i.removeAllRanges()),c&&document.body.removeChild(c),o()}return a}var x3=w3;function fl(e){"@babel/helpers - typeof";return fl=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},fl(e)}Object.defineProperty(fi,"__esModule",{value:!0}),fi.CopyToClipboard=void 0;var di=Oh(v),E3=Oh(x3),S3=["text","onCopy","options","children"];function Oh(e){return e&&e.__esModule?e:{default:e}}function Ih(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),n.push.apply(n,r)}return n}function $h(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Ih(Object(n),!0).forEach(function(r){pl(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ih(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function P3(e,t){if(e==null)return{};var n=T3(e,t),r,o;if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(o=0;o<s.length;o++)r=s[o],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function T3(e,t){if(e==null)return{};var n={},r=Object.keys(e),o,s;for(s=0;s<r.length;s++)o=r[s],!(t.indexOf(o)>=0)&&(n[o]=e[o]);return n}function A3(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function N3(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function C3(e,t,n){return t&&N3(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function O3(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&dl(e,t)}function dl(e,t){return dl=Object.setPrototypeOf||function(r,o){return r.__proto__=o,r},dl(e,t)}function I3(e){var t=k3();return function(){var r=pi(e),o;if(t){var s=pi(this).constructor;o=Reflect.construct(r,arguments,s)}else o=r.apply(this,arguments);return $3(this,o)}}function $3(e,t){if(t&&(fl(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return kh(e)}function kh(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function k3(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function pi(e){return pi=Object.setPrototypeOf?Object.getPrototypeOf:function(n){return n.__proto__||Object.getPrototypeOf(n)},pi(e)}function pl(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Dh=function(e){O3(n,e);var t=I3(n);function n(){var r;A3(this,n);for(var o=arguments.length,s=new Array(o),i=0;i<o;i++)s[i]=arguments[i];return r=t.call.apply(t,[this].concat(s)),pl(kh(r),"onClick",function(c){var a=r.props,l=a.text,u=a.onCopy,f=a.children,p=a.options,d=di.default.Children.only(f),h=(0,E3.default)(l,p);u&&u(l,h),d&&d.props&&typeof d.props.onClick=="function"&&d.props.onClick(c)}),r}return C3(n,[{key:"render",value:function(){var o=this.props;o.text,o.onCopy,o.options;var s=o.children,i=P3(o,S3),c=di.default.Children.only(s);return di.default.cloneElement(c,$h($h({},i),{},{onClick:this.onClick}))}}]),n}(di.default.PureComponent);fi.CopyToClipboard=Dh,pl(Dh,"defaultProps",{onCopy:void 0,options:void 0});var D3=fi,hl=D3.CopyToClipboard;hl.CopyToClipboard=hl;var M3=hl;const B3=zm(M3);var L3=Object.defineProperty,hi=Object.getOwnPropertySymbols,Mh=Object.prototype.hasOwnProperty,Bh=Object.prototype.propertyIsEnumerable,Lh=(e,t,n)=>t in e?L3(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,ml=(e,t)=>{for(var n in t||(t={}))Mh.call(t,n)&&Lh(e,n,t[n]);if(hi)for(var n of hi(t))Bh.call(t,n)&&Lh(e,n,t[n]);return e},bl=(e,t)=>{var n={};for(var r in e)Mh.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&hi)for(var r of hi(e))t.indexOf(r)<0&&Bh.call(e,r)&&(n[r]=e[r]);return n};/**
|
|
161
170
|
* @license QR Code generator library (TypeScript)
|
|
162
171
|
* Copyright (c) Project Nayuki.
|
|
163
172
|
* SPDX-License-Identifier: MIT
|
|
164
|
-
*/var Gn;(e=>{const t=class ie{constructor(a,u,l,f){if(this.version=a,this.errorCorrectionLevel=u,this.modules=[],this.isFunction=[],a<ie.MIN_VERSION||a>ie.MAX_VERSION)throw new RangeError("Version value out of range");if(f<-1||f>7)throw new RangeError("Mask value out of range");this.size=a*4+17;let p=[];for(let h=0;h<this.size;h++)p.push(!1);for(let h=0;h<this.size;h++)this.modules.push(p.slice()),this.isFunction.push(p.slice());this.drawFunctionPatterns();const d=this.addEccAndInterleave(l);if(this.drawCodewords(d),f==-1){let h=1e9;for(let m=0;m<8;m++){this.applyMask(m),this.drawFormatBits(m);const v=this.getPenaltyScore();v<h&&(f=m,h=v),this.applyMask(m)}}o(0<=f&&f<=7),this.mask=f,this.applyMask(f),this.drawFormatBits(f),this.isFunction=[]}static encodeText(a,u){const l=e.QrSegment.makeSegments(a);return ie.encodeSegments(l,u)}static encodeBinary(a,u){const l=e.QrSegment.makeBytes(a);return ie.encodeSegments([l],u)}static encodeSegments(a,u,l=1,f=40,p=-1,d=!0){if(!(ie.MIN_VERSION<=l&&l<=f&&f<=ie.MAX_VERSION)||p<-1||p>7)throw new RangeError("Invalid value");let h,m;for(h=l;;h++){const T=ie.getNumDataCodewords(h,u)*8,B=i.getTotalBits(a,h);if(B<=T){m=B;break}if(h>=f)throw new RangeError("Data too long")}for(const T of[ie.Ecc.MEDIUM,ie.Ecc.QUARTILE,ie.Ecc.HIGH])d&&m<=ie.getNumDataCodewords(h,T)*8&&(u=T);let v=[];for(const T of a){n(T.mode.modeBits,4,v),n(T.numChars,T.mode.numCharCountBits(h),v);for(const B of T.getData())v.push(B)}o(v.length==m);const A=ie.getNumDataCodewords(h,u)*8;o(v.length<=A),n(0,Math.min(4,A-v.length),v),n(0,(8-v.length%8)%8,v),o(v.length%8==0);for(let T=236;v.length<A;T^=253)n(T,8,v);let w=[];for(;w.length*8<v.length;)w.push(0);return v.forEach((T,B)=>w[B>>>3]|=T<<7-(B&7)),new ie(h,u,w,p)}getModule(a,u){return 0<=a&&a<this.size&&0<=u&&u<this.size&&this.modules[u][a]}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 a=this.getAlignmentPatternPositions(),u=a.length;for(let l=0;l<u;l++)for(let f=0;f<u;f++)l==0&&f==0||l==0&&f==u-1||l==u-1&&f==0||this.drawAlignmentPattern(a[l],a[f]);this.drawFormatBits(0),this.drawVersion()}drawFormatBits(a){const u=this.errorCorrectionLevel.formatBits<<3|a;let l=u;for(let p=0;p<10;p++)l=l<<1^(l>>>9)*1335;const f=(u<<10|l)^21522;o(f>>>15==0);for(let p=0;p<=5;p++)this.setFunctionModule(8,p,r(f,p));this.setFunctionModule(8,7,r(f,6)),this.setFunctionModule(8,8,r(f,7)),this.setFunctionModule(7,8,r(f,8));for(let p=9;p<15;p++)this.setFunctionModule(14-p,8,r(f,p));for(let p=0;p<8;p++)this.setFunctionModule(this.size-1-p,8,r(f,p));for(let p=8;p<15;p++)this.setFunctionModule(8,this.size-15+p,r(f,p));this.setFunctionModule(8,this.size-8,!0)}drawVersion(){if(this.version<7)return;let a=this.version;for(let l=0;l<12;l++)a=a<<1^(a>>>11)*7973;const u=this.version<<12|a;o(u>>>18==0);for(let l=0;l<18;l++){const f=r(u,l),p=this.size-11+l%3,d=Math.floor(l/3);this.setFunctionModule(p,d,f),this.setFunctionModule(d,p,f)}}drawFinderPattern(a,u){for(let l=-4;l<=4;l++)for(let f=-4;f<=4;f++){const p=Math.max(Math.abs(f),Math.abs(l)),d=a+f,h=u+l;0<=d&&d<this.size&&0<=h&&h<this.size&&this.setFunctionModule(d,h,p!=2&&p!=4)}}drawAlignmentPattern(a,u){for(let l=-2;l<=2;l++)for(let f=-2;f<=2;f++)this.setFunctionModule(a+f,u+l,Math.max(Math.abs(f),Math.abs(l))!=1)}setFunctionModule(a,u,l){this.modules[u][a]=l,this.isFunction[u][a]=!0}addEccAndInterleave(a){const u=this.version,l=this.errorCorrectionLevel;if(a.length!=ie.getNumDataCodewords(u,l))throw new RangeError("Invalid argument");const f=ie.NUM_ERROR_CORRECTION_BLOCKS[l.ordinal][u],p=ie.ECC_CODEWORDS_PER_BLOCK[l.ordinal][u],d=Math.floor(ie.getNumRawDataModules(u)/8),h=f-d%f,m=Math.floor(d/f);let v=[];const A=ie.reedSolomonComputeDivisor(p);for(let T=0,B=0;T<f;T++){let F=a.slice(B,B+m-p+(T<h?0:1));B+=F.length;const R=ie.reedSolomonComputeRemainder(F,A);T<h&&F.push(0),v.push(F.concat(R))}let w=[];for(let T=0;T<v[0].length;T++)v.forEach((B,F)=>{(T!=m-p||F>=h)&&w.push(B[T])});return o(w.length==d),w}drawCodewords(a){if(a.length!=Math.floor(ie.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 f=0;f<this.size;f++)for(let p=0;p<2;p++){const d=l-p,m=(l+1&2)==0?this.size-1-f:f;!this.isFunction[m][d]&&u<a.length*8&&(this.modules[m][d]=r(a[u>>>3],7-(u&7)),u++)}}o(u==a.length*8)}applyMask(a){if(a<0||a>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 f;switch(a){case 0:f=(l+u)%2==0;break;case 1:f=u%2==0;break;case 2:f=l%3==0;break;case 3:f=(l+u)%3==0;break;case 4:f=(Math.floor(l/3)+Math.floor(u/2))%2==0;break;case 5:f=l*u%2+l*u%3==0;break;case 6:f=(l*u%2+l*u%3)%2==0;break;case 7:f=((l+u)%2+l*u%3)%2==0;break;default:throw new Error("Unreachable")}!this.isFunction[u][l]&&f&&(this.modules[u][l]=!this.modules[u][l])}}getPenaltyScore(){let a=0;for(let p=0;p<this.size;p++){let d=!1,h=0,m=[0,0,0,0,0,0,0];for(let v=0;v<this.size;v++)this.modules[p][v]==d?(h++,h==5?a+=ie.PENALTY_N1:h>5&&a++):(this.finderPenaltyAddHistory(h,m),d||(a+=this.finderPenaltyCountPatterns(m)*ie.PENALTY_N3),d=this.modules[p][v],h=1);a+=this.finderPenaltyTerminateAndCount(d,h,m)*ie.PENALTY_N3}for(let p=0;p<this.size;p++){let d=!1,h=0,m=[0,0,0,0,0,0,0];for(let v=0;v<this.size;v++)this.modules[v][p]==d?(h++,h==5?a+=ie.PENALTY_N1:h>5&&a++):(this.finderPenaltyAddHistory(h,m),d||(a+=this.finderPenaltyCountPatterns(m)*ie.PENALTY_N3),d=this.modules[v][p],h=1);a+=this.finderPenaltyTerminateAndCount(d,h,m)*ie.PENALTY_N3}for(let p=0;p<this.size-1;p++)for(let d=0;d<this.size-1;d++){const h=this.modules[p][d];h==this.modules[p][d+1]&&h==this.modules[p+1][d]&&h==this.modules[p+1][d+1]&&(a+=ie.PENALTY_N2)}let u=0;for(const p of this.modules)u=p.reduce((d,h)=>d+(h?1:0),u);const l=this.size*this.size,f=Math.ceil(Math.abs(u*20-l*10)/l)-1;return o(0<=f&&f<=9),a+=f*ie.PENALTY_N4,o(0<=a&&a<=2568888),a}getAlignmentPatternPositions(){if(this.version==1)return[];{const a=Math.floor(this.version/7)+2,u=this.version==32?26:Math.ceil((this.version*4+4)/(a*2-2))*2;let l=[6];for(let f=this.size-7;l.length<a;f-=u)l.splice(1,0,f);return l}}static getNumRawDataModules(a){if(a<ie.MIN_VERSION||a>ie.MAX_VERSION)throw new RangeError("Version number out of range");let u=(16*a+128)*a+64;if(a>=2){const l=Math.floor(a/7)+2;u-=(25*l-10)*l-55,a>=7&&(u-=36)}return o(208<=u&&u<=29648),u}static getNumDataCodewords(a,u){return Math.floor(ie.getNumRawDataModules(a)/8)-ie.ECC_CODEWORDS_PER_BLOCK[u.ordinal][a]*ie.NUM_ERROR_CORRECTION_BLOCKS[u.ordinal][a]}static reedSolomonComputeDivisor(a){if(a<1||a>255)throw new RangeError("Degree out of range");let u=[];for(let f=0;f<a-1;f++)u.push(0);u.push(1);let l=1;for(let f=0;f<a;f++){for(let p=0;p<u.length;p++)u[p]=ie.reedSolomonMultiply(u[p],l),p+1<u.length&&(u[p]^=u[p+1]);l=ie.reedSolomonMultiply(l,2)}return u}static reedSolomonComputeRemainder(a,u){let l=u.map(f=>0);for(const f of a){const p=f^l.shift();l.push(0),u.forEach((d,h)=>l[h]^=ie.reedSolomonMultiply(d,p))}return l}static reedSolomonMultiply(a,u){if(a>>>8||u>>>8)throw new RangeError("Byte out of range");let l=0;for(let f=7;f>=0;f--)l=l<<1^(l>>>7)*285,l^=(u>>>f&1)*a;return o(l>>>8==0),l}finderPenaltyCountPatterns(a){const u=a[1];o(u<=this.size*3);const l=u>0&&a[2]==u&&a[3]==u*3&&a[4]==u&&a[5]==u;return(l&&a[0]>=u*4&&a[6]>=u?1:0)+(l&&a[6]>=u*4&&a[0]>=u?1:0)}finderPenaltyTerminateAndCount(a,u,l){return a&&(this.finderPenaltyAddHistory(u,l),u=0),u+=this.size,this.finderPenaltyAddHistory(u,l),this.finderPenaltyCountPatterns(l)}finderPenaltyAddHistory(a,u){u[0]==0&&(a+=this.size),u.pop(),u.unshift(a)}};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(c,a,u){if(a<0||a>31||c>>>a)throw new RangeError("Value out of range");for(let l=a-1;l>=0;l--)u.push(c>>>l&1)}function r(c,a){return(c>>>a&1)!=0}function o(c){if(!c)throw new Error("Assertion error")}const s=class Ee{constructor(a,u,l){if(this.mode=a,this.numChars=u,this.bitData=l,u<0)throw new RangeError("Invalid argument");this.bitData=l.slice()}static makeBytes(a){let u=[];for(const l of a)n(l,8,u);return new Ee(Ee.Mode.BYTE,a.length,u)}static makeNumeric(a){if(!Ee.isNumeric(a))throw new RangeError("String contains non-numeric characters");let u=[];for(let l=0;l<a.length;){const f=Math.min(a.length-l,3);n(parseInt(a.substring(l,l+f),10),f*3+1,u),l+=f}return new Ee(Ee.Mode.NUMERIC,a.length,u)}static makeAlphanumeric(a){if(!Ee.isAlphanumeric(a))throw new RangeError("String contains unencodable characters in alphanumeric mode");let u=[],l;for(l=0;l+2<=a.length;l+=2){let f=Ee.ALPHANUMERIC_CHARSET.indexOf(a.charAt(l))*45;f+=Ee.ALPHANUMERIC_CHARSET.indexOf(a.charAt(l+1)),n(f,11,u)}return l<a.length&&n(Ee.ALPHANUMERIC_CHARSET.indexOf(a.charAt(l)),6,u),new Ee(Ee.Mode.ALPHANUMERIC,a.length,u)}static makeSegments(a){return a==""?[]:Ee.isNumeric(a)?[Ee.makeNumeric(a)]:Ee.isAlphanumeric(a)?[Ee.makeAlphanumeric(a)]:[Ee.makeBytes(Ee.toUtf8ByteArray(a))]}static makeEci(a){let u=[];if(a<0)throw new RangeError("ECI assignment value out of range");if(a<128)n(a,8,u);else if(a<16384)n(2,2,u),n(a,14,u);else if(a<1e6)n(6,3,u),n(a,21,u);else throw new RangeError("ECI assignment value out of range");return new Ee(Ee.Mode.ECI,0,u)}static isNumeric(a){return Ee.NUMERIC_REGEX.test(a)}static isAlphanumeric(a){return Ee.ALPHANUMERIC_REGEX.test(a)}getData(){return this.bitData.slice()}static getTotalBits(a,u){let l=0;for(const f of a){const p=f.mode.numCharCountBits(u);if(f.numChars>=1<<p)return 1/0;l+=4+p+f.bitData.length}return l}static toUtf8ByteArray(a){a=encodeURI(a);let u=[];for(let l=0;l<a.length;l++)a.charAt(l)!="%"?u.push(a.charCodeAt(l)):(u.push(parseInt(a.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 i=s;e.QrSegment=s})(Gn||(Gn={})),(e=>{(t=>{const n=class{constructor(o,s){this.ordinal=o,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={}))})(Gn||(Gn={})),(e=>{(t=>{const n=class{constructor(o,s){this.modeBits=o,this.numBitsCharCount=s}numCharCountBits(o){return this.numBitsCharCount[Math.floor((o+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={}))})(Gn||(Gn={}));var Pr=Gn;/**
|
|
173
|
+
*/var tr;(e=>{const t=class fe{constructor(a,l,u,f){if(this.version=a,this.errorCorrectionLevel=l,this.modules=[],this.isFunction=[],a<fe.MIN_VERSION||a>fe.MAX_VERSION)throw new RangeError("Version value out of range");if(f<-1||f>7)throw new RangeError("Mask value out of range");this.size=a*4+17;let p=[];for(let h=0;h<this.size;h++)p.push(!1);for(let h=0;h<this.size;h++)this.modules.push(p.slice()),this.isFunction.push(p.slice());this.drawFunctionPatterns();const d=this.addEccAndInterleave(u);if(this.drawCodewords(d),f==-1){let h=1e9;for(let m=0;m<8;m++){this.applyMask(m),this.drawFormatBits(m);const x=this.getPenaltyScore();x<h&&(f=m,h=x),this.applyMask(m)}}o(0<=f&&f<=7),this.mask=f,this.applyMask(f),this.drawFormatBits(f),this.isFunction=[]}static encodeText(a,l){const u=e.QrSegment.makeSegments(a);return fe.encodeSegments(u,l)}static encodeBinary(a,l){const u=e.QrSegment.makeBytes(a);return fe.encodeSegments([u],l)}static encodeSegments(a,l,u=1,f=40,p=-1,d=!0){if(!(fe.MIN_VERSION<=u&&u<=f&&f<=fe.MAX_VERSION)||p<-1||p>7)throw new RangeError("Invalid value");let h,m;for(h=u;;h++){const T=fe.getNumDataCodewords(h,l)*8,N=i.getTotalBits(a,h);if(N<=T){m=N;break}if(h>=f)throw new RangeError("Data too long")}for(const T of[fe.Ecc.MEDIUM,fe.Ecc.QUARTILE,fe.Ecc.HIGH])d&&m<=fe.getNumDataCodewords(h,T)*8&&(l=T);let x=[];for(const T of a){n(T.mode.modeBits,4,x),n(T.numChars,T.mode.numCharCountBits(h),x);for(const N of T.getData())x.push(N)}o(x.length==m);const P=fe.getNumDataCodewords(h,l)*8;o(x.length<=P),n(0,Math.min(4,P-x.length),x),n(0,(8-x.length%8)%8,x),o(x.length%8==0);for(let T=236;x.length<P;T^=253)n(T,8,x);let E=[];for(;E.length*8<x.length;)E.push(0);return x.forEach((T,N)=>E[N>>>3]|=T<<7-(N&7)),new fe(h,l,E,p)}getModule(a,l){return 0<=a&&a<this.size&&0<=l&&l<this.size&&this.modules[l][a]}getModules(){return this.modules}drawFunctionPatterns(){for(let u=0;u<this.size;u++)this.setFunctionModule(6,u,u%2==0),this.setFunctionModule(u,6,u%2==0);this.drawFinderPattern(3,3),this.drawFinderPattern(this.size-4,3),this.drawFinderPattern(3,this.size-4);const a=this.getAlignmentPatternPositions(),l=a.length;for(let u=0;u<l;u++)for(let f=0;f<l;f++)u==0&&f==0||u==0&&f==l-1||u==l-1&&f==0||this.drawAlignmentPattern(a[u],a[f]);this.drawFormatBits(0),this.drawVersion()}drawFormatBits(a){const l=this.errorCorrectionLevel.formatBits<<3|a;let u=l;for(let p=0;p<10;p++)u=u<<1^(u>>>9)*1335;const f=(l<<10|u)^21522;o(f>>>15==0);for(let p=0;p<=5;p++)this.setFunctionModule(8,p,r(f,p));this.setFunctionModule(8,7,r(f,6)),this.setFunctionModule(8,8,r(f,7)),this.setFunctionModule(7,8,r(f,8));for(let p=9;p<15;p++)this.setFunctionModule(14-p,8,r(f,p));for(let p=0;p<8;p++)this.setFunctionModule(this.size-1-p,8,r(f,p));for(let p=8;p<15;p++)this.setFunctionModule(8,this.size-15+p,r(f,p));this.setFunctionModule(8,this.size-8,!0)}drawVersion(){if(this.version<7)return;let a=this.version;for(let u=0;u<12;u++)a=a<<1^(a>>>11)*7973;const l=this.version<<12|a;o(l>>>18==0);for(let u=0;u<18;u++){const f=r(l,u),p=this.size-11+u%3,d=Math.floor(u/3);this.setFunctionModule(p,d,f),this.setFunctionModule(d,p,f)}}drawFinderPattern(a,l){for(let u=-4;u<=4;u++)for(let f=-4;f<=4;f++){const p=Math.max(Math.abs(f),Math.abs(u)),d=a+f,h=l+u;0<=d&&d<this.size&&0<=h&&h<this.size&&this.setFunctionModule(d,h,p!=2&&p!=4)}}drawAlignmentPattern(a,l){for(let u=-2;u<=2;u++)for(let f=-2;f<=2;f++)this.setFunctionModule(a+f,l+u,Math.max(Math.abs(f),Math.abs(u))!=1)}setFunctionModule(a,l,u){this.modules[l][a]=u,this.isFunction[l][a]=!0}addEccAndInterleave(a){const l=this.version,u=this.errorCorrectionLevel;if(a.length!=fe.getNumDataCodewords(l,u))throw new RangeError("Invalid argument");const f=fe.NUM_ERROR_CORRECTION_BLOCKS[u.ordinal][l],p=fe.ECC_CODEWORDS_PER_BLOCK[u.ordinal][l],d=Math.floor(fe.getNumRawDataModules(l)/8),h=f-d%f,m=Math.floor(d/f);let x=[];const P=fe.reedSolomonComputeDivisor(p);for(let T=0,N=0;T<f;T++){let M=a.slice(N,N+m-p+(T<h?0:1));N+=M.length;const F=fe.reedSolomonComputeRemainder(M,P);T<h&&M.push(0),x.push(M.concat(F))}let E=[];for(let T=0;T<x[0].length;T++)x.forEach((N,M)=>{(T!=m-p||M>=h)&&E.push(N[T])});return o(E.length==d),E}drawCodewords(a){if(a.length!=Math.floor(fe.getNumRawDataModules(this.version)/8))throw new RangeError("Invalid argument");let l=0;for(let u=this.size-1;u>=1;u-=2){u==6&&(u=5);for(let f=0;f<this.size;f++)for(let p=0;p<2;p++){const d=u-p,m=(u+1&2)==0?this.size-1-f:f;!this.isFunction[m][d]&&l<a.length*8&&(this.modules[m][d]=r(a[l>>>3],7-(l&7)),l++)}}o(l==a.length*8)}applyMask(a){if(a<0||a>7)throw new RangeError("Mask value out of range");for(let l=0;l<this.size;l++)for(let u=0;u<this.size;u++){let f;switch(a){case 0:f=(u+l)%2==0;break;case 1:f=l%2==0;break;case 2:f=u%3==0;break;case 3:f=(u+l)%3==0;break;case 4:f=(Math.floor(u/3)+Math.floor(l/2))%2==0;break;case 5:f=u*l%2+u*l%3==0;break;case 6:f=(u*l%2+u*l%3)%2==0;break;case 7:f=((u+l)%2+u*l%3)%2==0;break;default:throw new Error("Unreachable")}!this.isFunction[l][u]&&f&&(this.modules[l][u]=!this.modules[l][u])}}getPenaltyScore(){let a=0;for(let p=0;p<this.size;p++){let d=!1,h=0,m=[0,0,0,0,0,0,0];for(let x=0;x<this.size;x++)this.modules[p][x]==d?(h++,h==5?a+=fe.PENALTY_N1:h>5&&a++):(this.finderPenaltyAddHistory(h,m),d||(a+=this.finderPenaltyCountPatterns(m)*fe.PENALTY_N3),d=this.modules[p][x],h=1);a+=this.finderPenaltyTerminateAndCount(d,h,m)*fe.PENALTY_N3}for(let p=0;p<this.size;p++){let d=!1,h=0,m=[0,0,0,0,0,0,0];for(let x=0;x<this.size;x++)this.modules[x][p]==d?(h++,h==5?a+=fe.PENALTY_N1:h>5&&a++):(this.finderPenaltyAddHistory(h,m),d||(a+=this.finderPenaltyCountPatterns(m)*fe.PENALTY_N3),d=this.modules[x][p],h=1);a+=this.finderPenaltyTerminateAndCount(d,h,m)*fe.PENALTY_N3}for(let p=0;p<this.size-1;p++)for(let d=0;d<this.size-1;d++){const h=this.modules[p][d];h==this.modules[p][d+1]&&h==this.modules[p+1][d]&&h==this.modules[p+1][d+1]&&(a+=fe.PENALTY_N2)}let l=0;for(const p of this.modules)l=p.reduce((d,h)=>d+(h?1:0),l);const u=this.size*this.size,f=Math.ceil(Math.abs(l*20-u*10)/u)-1;return o(0<=f&&f<=9),a+=f*fe.PENALTY_N4,o(0<=a&&a<=2568888),a}getAlignmentPatternPositions(){if(this.version==1)return[];{const a=Math.floor(this.version/7)+2,l=this.version==32?26:Math.ceil((this.version*4+4)/(a*2-2))*2;let u=[6];for(let f=this.size-7;u.length<a;f-=l)u.splice(1,0,f);return u}}static getNumRawDataModules(a){if(a<fe.MIN_VERSION||a>fe.MAX_VERSION)throw new RangeError("Version number out of range");let l=(16*a+128)*a+64;if(a>=2){const u=Math.floor(a/7)+2;l-=(25*u-10)*u-55,a>=7&&(l-=36)}return o(208<=l&&l<=29648),l}static getNumDataCodewords(a,l){return Math.floor(fe.getNumRawDataModules(a)/8)-fe.ECC_CODEWORDS_PER_BLOCK[l.ordinal][a]*fe.NUM_ERROR_CORRECTION_BLOCKS[l.ordinal][a]}static reedSolomonComputeDivisor(a){if(a<1||a>255)throw new RangeError("Degree out of range");let l=[];for(let f=0;f<a-1;f++)l.push(0);l.push(1);let u=1;for(let f=0;f<a;f++){for(let p=0;p<l.length;p++)l[p]=fe.reedSolomonMultiply(l[p],u),p+1<l.length&&(l[p]^=l[p+1]);u=fe.reedSolomonMultiply(u,2)}return l}static reedSolomonComputeRemainder(a,l){let u=l.map(f=>0);for(const f of a){const p=f^u.shift();u.push(0),l.forEach((d,h)=>u[h]^=fe.reedSolomonMultiply(d,p))}return u}static reedSolomonMultiply(a,l){if(a>>>8||l>>>8)throw new RangeError("Byte out of range");let u=0;for(let f=7;f>=0;f--)u=u<<1^(u>>>7)*285,u^=(l>>>f&1)*a;return o(u>>>8==0),u}finderPenaltyCountPatterns(a){const l=a[1];o(l<=this.size*3);const u=l>0&&a[2]==l&&a[3]==l*3&&a[4]==l&&a[5]==l;return(u&&a[0]>=l*4&&a[6]>=l?1:0)+(u&&a[6]>=l*4&&a[0]>=l?1:0)}finderPenaltyTerminateAndCount(a,l,u){return a&&(this.finderPenaltyAddHistory(l,u),l=0),l+=this.size,this.finderPenaltyAddHistory(l,u),this.finderPenaltyCountPatterns(u)}finderPenaltyAddHistory(a,l){l[0]==0&&(a+=this.size),l.pop(),l.unshift(a)}};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(c,a,l){if(a<0||a>31||c>>>a)throw new RangeError("Value out of range");for(let u=a-1;u>=0;u--)l.push(c>>>u&1)}function r(c,a){return(c>>>a&1)!=0}function o(c){if(!c)throw new Error("Assertion error")}const s=class Pe{constructor(a,l,u){if(this.mode=a,this.numChars=l,this.bitData=u,l<0)throw new RangeError("Invalid argument");this.bitData=u.slice()}static makeBytes(a){let l=[];for(const u of a)n(u,8,l);return new Pe(Pe.Mode.BYTE,a.length,l)}static makeNumeric(a){if(!Pe.isNumeric(a))throw new RangeError("String contains non-numeric characters");let l=[];for(let u=0;u<a.length;){const f=Math.min(a.length-u,3);n(parseInt(a.substring(u,u+f),10),f*3+1,l),u+=f}return new Pe(Pe.Mode.NUMERIC,a.length,l)}static makeAlphanumeric(a){if(!Pe.isAlphanumeric(a))throw new RangeError("String contains unencodable characters in alphanumeric mode");let l=[],u;for(u=0;u+2<=a.length;u+=2){let f=Pe.ALPHANUMERIC_CHARSET.indexOf(a.charAt(u))*45;f+=Pe.ALPHANUMERIC_CHARSET.indexOf(a.charAt(u+1)),n(f,11,l)}return u<a.length&&n(Pe.ALPHANUMERIC_CHARSET.indexOf(a.charAt(u)),6,l),new Pe(Pe.Mode.ALPHANUMERIC,a.length,l)}static makeSegments(a){return a==""?[]:Pe.isNumeric(a)?[Pe.makeNumeric(a)]:Pe.isAlphanumeric(a)?[Pe.makeAlphanumeric(a)]:[Pe.makeBytes(Pe.toUtf8ByteArray(a))]}static makeEci(a){let l=[];if(a<0)throw new RangeError("ECI assignment value out of range");if(a<128)n(a,8,l);else if(a<16384)n(2,2,l),n(a,14,l);else if(a<1e6)n(6,3,l),n(a,21,l);else throw new RangeError("ECI assignment value out of range");return new Pe(Pe.Mode.ECI,0,l)}static isNumeric(a){return Pe.NUMERIC_REGEX.test(a)}static isAlphanumeric(a){return Pe.ALPHANUMERIC_REGEX.test(a)}getData(){return this.bitData.slice()}static getTotalBits(a,l){let u=0;for(const f of a){const p=f.mode.numCharCountBits(l);if(f.numChars>=1<<p)return 1/0;u+=4+p+f.bitData.length}return u}static toUtf8ByteArray(a){a=encodeURI(a);let l=[];for(let u=0;u<a.length;u++)a.charAt(u)!="%"?l.push(a.charCodeAt(u)):(l.push(parseInt(a.substring(u+1,u+3),16)),u+=2);return l}};s.NUMERIC_REGEX=/^[0-9]*$/,s.ALPHANUMERIC_REGEX=/^[A-Z0-9 $%*+.\/:-]*$/,s.ALPHANUMERIC_CHARSET="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:";let i=s;e.QrSegment=s})(tr||(tr={})),(e=>{(t=>{const n=class{constructor(o,s){this.ordinal=o,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={}))})(tr||(tr={})),(e=>{(t=>{const n=class{constructor(o,s){this.modeBits=o,this.numBitsCharCount=s}numCharCountBits(o){return this.numBitsCharCount[Math.floor((o+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={}))})(tr||(tr={}));var Mr=tr;/**
|
|
165
174
|
* @license qrcode.react
|
|
166
175
|
* Copyright (c) Paul O'Shannessy
|
|
167
176
|
* SPDX-License-Identifier: ISC
|
|
168
|
-
*/var sS={L:Pr.QrCode.Ecc.LOW,M:Pr.QrCode.Ecc.MEDIUM,Q:Pr.QrCode.Ecc.QUARTILE,H:Pr.QrCode.Ecc.HIGH},Yh=128,Xh="L",Qh="#FFFFFF",Jh="#000000",e0=!1,t0=1,iS=4,aS=0,cS=.1;function n0(e,t=0){const n=[];return e.forEach(function(r,o){let s=null;r.forEach(function(i,c){if(!i&&s!==null){n.push(`M${s+t} ${o+t}h${c-s}v1H${s+t}z`),s=null;return}if(c===r.length-1){if(!i)return;s===null?n.push(`M${c+t},${o+t} h1v1H${c+t}z`):n.push(`M${s+t},${o+t} h${c+1-s}v1H${s+t}z`);return}i&&s===null&&(s=c)})}),n.join("")}function r0(e,t){return e.slice().map((n,r)=>r<t.y||r>=t.y+t.h?n:n.map((o,s)=>s<t.x||s>=t.x+t.w?o:!1))}function uS(e,t,n,r){if(r==null)return null;const o=e.length+n*2,s=Math.floor(t*cS),i=o/t,c=(r.width||s)*i,a=(r.height||s)*i,u=r.x==null?e.length/2-c/2:r.x*i,l=r.y==null?e.length/2-a/2:r.y*i,f=r.opacity==null?1:r.opacity;let p=null;if(r.excavate){let h=Math.floor(u),m=Math.floor(l),v=Math.ceil(c+u-h),A=Math.ceil(a+l-m);p={x:h,y:m,w:v,h:A}}const d=r.crossOrigin;return{x:u,y:l,h:a,w:c,excavation:p,opacity:f,crossOrigin:d}}function lS(e,t){return t!=null?Math.max(Math.floor(t),0):e?iS:aS}function o0({value:e,level:t,minVersion:n,includeMargin:r,marginSize:o,imageSettings:s,size:i,boostLevel:c}){let a=x.useMemo(()=>{const h=(Array.isArray(e)?e:[e]).reduce((m,v)=>(m.push(...Pr.QrSegment.makeSegments(v)),m),[]);return Pr.QrCode.encodeSegments(h,sS[t],n,void 0,void 0,c)},[e,t,n,c]);const{cells:u,margin:l,numCells:f,calculatedImageSettings:p}=x.useMemo(()=>{let d=a.getModules();const h=lS(r,o),m=d.length+h*2,v=uS(d,i,h,s);return{cells:d,margin:h,numCells:m,calculatedImageSettings:v}},[a,i,s,r,o]);return{qrcode:a,margin:l,cells:u,numCells:f,calculatedImageSettings:p}}var fS=function(){try{new Path2D().addPath(new Path2D)}catch{return!1}return!0}(),dS=x.forwardRef(function(t,n){const r=t,{value:o,size:s=Yh,level:i=Xh,bgColor:c=Qh,fgColor:a=Jh,includeMargin:u=e0,minVersion:l=t0,boostLevel:f,marginSize:p,imageSettings:d}=r,m=_c(r,["value","size","level","bgColor","fgColor","includeMargin","minVersion","boostLevel","marginSize","imageSettings"]),{style:v}=m,A=_c(m,["style"]),w=d==null?void 0:d.src,T=x.useRef(null),B=x.useRef(null),F=x.useCallback(S=>{T.current=S,typeof n=="function"?n(S):n&&(n.current=S)},[n]),[R,j]=x.useState(!1),{margin:g,cells:y,numCells:$,calculatedImageSettings:k}=o0({value:o,level:i,minVersion:l,boostLevel:f,includeMargin:u,marginSize:p,imageSettings:d,size:s});x.useEffect(()=>{if(T.current!=null){const S=T.current,E=S.getContext("2d");if(!E)return;let C=y;const O=B.current,b=k!=null&&O!==null&&O.complete&&O.naturalHeight!==0&&O.naturalWidth!==0;b&&k.excavation!=null&&(C=r0(y,k.excavation));const M=window.devicePixelRatio||1;S.height=S.width=s*M;const D=s/$*M;E.scale(D,D),E.fillStyle=c,E.fillRect(0,0,$,$),E.fillStyle=a,fS?E.fill(new Path2D(n0(C,g))):y.forEach(function(_,U){_.forEach(function(W,K){W&&E.fillRect(K+g,U+g,1,1)})}),k&&(E.globalAlpha=k.opacity),b&&E.drawImage(O,k.x+g,k.y+g,k.w,k.h)}}),x.useEffect(()=>{j(!1)},[w]);const N=jc({height:s,width:s},v);let P=null;return w!=null&&(P=x.createElement("img",{src:w,key:w,style:{display:"none"},onLoad:()=>{j(!0)},ref:B,crossOrigin:k==null?void 0:k.crossOrigin})),x.createElement(x.Fragment,null,x.createElement("canvas",jc({style:N,height:s,width:s,ref:F,role:"img"},A)),P)});dS.displayName="QRCodeCanvas";var s0=x.forwardRef(function(t,n){const r=t,{value:o,size:s=Yh,level:i=Xh,bgColor:c=Qh,fgColor:a=Jh,includeMargin:u=e0,minVersion:l=t0,boostLevel:f,title:p,marginSize:d,imageSettings:h}=r,m=_c(r,["value","size","level","bgColor","fgColor","includeMargin","minVersion","boostLevel","title","marginSize","imageSettings"]),{margin:v,cells:A,numCells:w,calculatedImageSettings:T}=o0({value:o,level:i,minVersion:l,boostLevel:f,includeMargin:u,marginSize:d,imageSettings:h,size:s});let B=A,F=null;h!=null&&T!=null&&(T.excavation!=null&&(B=r0(A,T.excavation)),F=x.createElement("image",{href:h.src,height:T.h,width:T.w,x:T.x+v,y:T.y+v,preserveAspectRatio:"none",opacity:T.opacity,crossOrigin:T.crossOrigin}));const R=n0(B,v);return x.createElement("svg",jc({height:s,width:s,viewBox:`0 0 ${w} ${w}`,ref:n,role:"img"},m),!!p&&x.createElement("title",null,p),x.createElement("path",{fill:c,d:`M0,0 h${w}v${w}H0z`,shapeRendering:"crispEdges"}),x.createElement("path",{fill:a,d:R,shapeRendering:"crispEdges"}),F)});s0.displayName="QRCodeSVG";function pS(){const e=navigator.userAgentData;return e!=null&&e.platform?e.platform:navigator.platform}function hS(){const e=navigator.userAgentData;return e&&Array.isArray(e.brands)?e.brands.map(t=>{let{brand:n,version:r}=t;return n+"/"+r}).join(" "):navigator.userAgent}function i0(){return/apple/i.test(navigator.vendor)}function mS(){return pS().toLowerCase().startsWith("mac")&&!navigator.maxTouchPoints}function gS(){return hS().includes("jsdom/")}const a0="data-floating-ui-focusable",bS="input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])";function Uc(e){let t=e.activeElement;for(;((n=t)==null||(n=n.shadowRoot)==null?void 0:n.activeElement)!=null;){var n;t=t.shadowRoot.activeElement}return t}function $r(e,t){if(!e||!t)return!1;const n=t.getRootNode==null?void 0:t.getRootNode();if(e.contains(t))return!0;if(n&&fc(n)){let r=t;for(;r;){if(e===r)return!0;r=r.parentNode||r.host}}return!1}function Tr(e){return"composedPath"in e?e.composedPath()[0]:e.target}function zc(e,t){if(t==null)return!1;if("composedPath"in e)return e.composedPath().includes(t);const n=e;return n.target!=null&&t.contains(n.target)}function yS(e){return e.matches("html,body")}function jt(e){return(e==null?void 0:e.ownerDocument)||document}function c0(e){return Fe(e)&&e.matches(bS)}function wS(e){if(!e||gS())return!0;try{return e.matches(":focus-visible")}catch{return!0}}function vS(e){return e?e.hasAttribute(a0)?e:e.querySelector("["+a0+"]")||e:null}function Zs(e,t,n){return n===void 0&&(n=!0),e.filter(o=>{var s;return o.parentId===t&&(!n||((s=o.context)==null?void 0:s.open))}).flatMap(o=>[o,...Zs(e,o.id,n)])}function xS(e){return"nativeEvent"in e}function No(e,t){const n=["mouse","pen"];return t||n.push("",void 0),n.includes(e)}var ES=typeof document<"u",SS=function(){},_t=ES?x.useLayoutEffect:SS;const PS={...z};function Ks(e){const t=z.useRef(e);return _t(()=>{t.current=e}),t}const $S=PS.useInsertionEffect||(e=>e());function Ut(e){const t=z.useRef(()=>{if(process.env.NODE_ENV!=="production")throw new Error("Cannot call an event handler while rendering.")});return $S(()=>{t.current=e}),z.useCallback(function(){for(var n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return t.current==null?void 0:t.current(...r)},[])}const u0=()=>({getShadowRoot:!0,displayCheck:typeof ResizeObserver=="function"&&ResizeObserver.toString().includes("[native code]")?"full":"none"});function l0(e,t){const n=Gp(e,u0()),r=n.length;if(r===0)return;const o=Uc(jt(e)),s=n.indexOf(o),i=s===-1?t===1?0:r-1:s+t;return n[i]}function TS(e){return l0(jt(e).body,1)||e}function AS(e){return l0(jt(e).body,-1)||e}function Hc(e,t){const n=t||e.currentTarget,r=e.relatedTarget;return!r||!$r(n,r)}function OS(e){Gp(e,u0()).forEach(n=>{n.dataset.tabindex=n.getAttribute("tabindex")||"",n.setAttribute("tabindex","-1")})}function f0(e){e.querySelectorAll("[data-tabindex]").forEach(n=>{const r=n.dataset.tabindex;delete n.dataset.tabindex,r?n.setAttribute("tabindex",r):n.removeAttribute("tabindex")})}const CS="data-floating-ui-focusable",d0="active",p0="selected",NS={...z};let h0=!1,IS=0;const m0=()=>"floating-ui-"+Math.random().toString(36).slice(2,6)+IS++;function MS(){const[e,t]=z.useState(()=>h0?m0():void 0);return _t(()=>{e==null&&t(m0())},[]),z.useEffect(()=>{h0=!0},[]),e}const Wc=NS.useId||MS;let Vc;process.env.NODE_ENV!=="production"&&(Vc=new Set);function kS(){for(var e,t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];const o="Floating UI: "+n.join(" ");if(!((e=Vc)!=null&&e.has(o))){var s;(s=Vc)==null||s.add(o),console.error(o)}}function BS(){const e=new Map;return{emit(t,n){var r;(r=e.get(t))==null||r.forEach(o=>o(n))},on(t,n){e.has(t)||e.set(t,new Set),e.get(t).add(n)},off(t,n){var r;(r=e.get(t))==null||r.delete(n)}}}const LS=z.createContext(null),FS=z.createContext(null),Gc=()=>{var e;return((e=z.useContext(LS))==null?void 0:e.id)||null},qc=()=>z.useContext(FS);function Io(e){return"data-floating-ui-"+e}function lt(e){e.current!==-1&&(clearTimeout(e.current),e.current=-1)}const g0=Io("safe-polygon");function Zc(e,t,n){if(n&&!No(n))return 0;if(typeof e=="number")return e;if(typeof e=="function"){const r=e();return typeof r=="number"?r:r==null?void 0:r[t]}return e==null?void 0:e[t]}function Kc(e){return typeof e=="function"?e():e}function DS(e,t){t===void 0&&(t={});const{open:n,onOpenChange:r,dataRef:o,events:s,elements:i}=e,{enabled:c=!0,delay:a=0,handleClose:u=null,mouseOnly:l=!1,restMs:f=0,move:p=!0}=t,d=qc(),h=Gc(),m=Ks(u),v=Ks(a),A=Ks(n),w=Ks(f),T=z.useRef(),B=z.useRef(-1),F=z.useRef(),R=z.useRef(-1),j=z.useRef(!0),g=z.useRef(!1),y=z.useRef(()=>{}),$=z.useRef(!1),k=Ut(()=>{var O;const b=(O=o.current.openEvent)==null?void 0:O.type;return(b==null?void 0:b.includes("mouse"))&&b!=="mousedown"});z.useEffect(()=>{if(!c)return;function O(b){let{open:M}=b;M||(lt(B),lt(R),j.current=!0,$.current=!1)}return s.on("openchange",O),()=>{s.off("openchange",O)}},[c,s]),z.useEffect(()=>{if(!c||!m.current||!n)return;function O(M){k()&&r(!1,M,"hover")}const b=jt(i.floating).documentElement;return b.addEventListener("mouseleave",O),()=>{b.removeEventListener("mouseleave",O)}},[i.floating,n,r,c,m,k]);const N=z.useCallback(function(O,b,M){b===void 0&&(b=!0),M===void 0&&(M="hover");const D=Zc(v.current,"close",T.current);D&&!F.current?(lt(B),B.current=window.setTimeout(()=>r(!1,O,M),D)):b&&(lt(B),r(!1,O,M))},[v,r]),P=Ut(()=>{y.current(),F.current=void 0}),S=Ut(()=>{if(g.current){const O=jt(i.floating).body;O.style.pointerEvents="",O.removeAttribute(g0),g.current=!1}}),E=Ut(()=>o.current.openEvent?["click","mousedown"].includes(o.current.openEvent.type):!1);z.useEffect(()=>{if(!c)return;function O(U){if(lt(B),j.current=!1,l&&!No(T.current)||Kc(w.current)>0&&!Zc(v.current,"open"))return;const W=Zc(v.current,"open",T.current);W?B.current=window.setTimeout(()=>{A.current||r(!0,U,"hover")},W):n||r(!0,U,"hover")}function b(U){if(E()){S();return}y.current();const W=jt(i.floating);if(lt(R),$.current=!1,m.current&&o.current.floatingContext){n||lt(B),F.current=m.current({...o.current.floatingContext,tree:d,x:U.clientX,y:U.clientY,onClose(){S(),P(),E()||N(U,!0,"safe-polygon")}});const V=F.current;W.addEventListener("mousemove",V),y.current=()=>{W.removeEventListener("mousemove",V)};return}(T.current==="touch"?!$r(i.floating,U.relatedTarget):!0)&&N(U)}function M(U){E()||o.current.floatingContext&&(m.current==null||m.current({...o.current.floatingContext,tree:d,x:U.clientX,y:U.clientY,onClose(){S(),P(),E()||N(U)}})(U))}function D(){lt(B)}function _(U){E()||N(U,!1)}if(fe(i.domReference)){const U=i.domReference,W=i.floating;return n&&U.addEventListener("mouseleave",M),p&&U.addEventListener("mousemove",O,{once:!0}),U.addEventListener("mouseenter",O),U.addEventListener("mouseleave",b),W&&(W.addEventListener("mouseleave",M),W.addEventListener("mouseenter",D),W.addEventListener("mouseleave",_)),()=>{n&&U.removeEventListener("mouseleave",M),p&&U.removeEventListener("mousemove",O),U.removeEventListener("mouseenter",O),U.removeEventListener("mouseleave",b),W&&(W.removeEventListener("mouseleave",M),W.removeEventListener("mouseenter",D),W.removeEventListener("mouseleave",_))}}},[i,c,e,l,p,N,P,S,r,n,A,d,v,m,o,E,w]),_t(()=>{var O;if(c&&n&&(O=m.current)!=null&&(O=O.__options)!=null&&O.blockPointerEvents&&k()){g.current=!0;const M=i.floating;if(fe(i.domReference)&&M){var b;const D=jt(i.floating).body;D.setAttribute(g0,"");const _=i.domReference,U=d==null||(b=d.nodesRef.current.find(W=>W.id===h))==null||(b=b.context)==null?void 0:b.elements.floating;return U&&(U.style.pointerEvents=""),D.style.pointerEvents="none",_.style.pointerEvents="auto",M.style.pointerEvents="auto",()=>{D.style.pointerEvents="",_.style.pointerEvents="",M.style.pointerEvents=""}}}},[c,n,h,i,d,m,k]),_t(()=>{n||(T.current=void 0,$.current=!1,P(),S())},[n,P,S]),z.useEffect(()=>()=>{P(),lt(B),lt(R),S()},[c,i.domReference,P,S]);const C=z.useMemo(()=>{function O(b){T.current=b.pointerType}return{onPointerDown:O,onPointerEnter:O,onMouseMove(b){const{nativeEvent:M}=b;function D(){!j.current&&!A.current&&r(!0,M,"hover")}l&&!No(T.current)||n||Kc(w.current)===0||$.current&&b.movementX**2+b.movementY**2<2||(lt(R),T.current==="touch"?D():($.current=!0,R.current=window.setTimeout(D,Kc(w.current))))}}},[l,r,n,A,w]);return z.useMemo(()=>c?{reference:C}:{},[c,C])}const b0={border:0,clip:"rect(0 0 0 0)",height:"1px",margin:"-1px",overflow:"hidden",padding:0,position:"fixed",whiteSpace:"nowrap",width:"1px",top:0,left:0},y0=z.forwardRef(function(t,n){const[r,o]=z.useState();_t(()=>{i0()&&o("button")},[]);const s={ref:n,tabIndex:0,role:r,"aria-hidden":r?void 0:!0,[Io("focus-guard")]:"",style:b0};return I.jsx("span",{...t,...s})}),w0=z.createContext(null),v0=Io("portal");function RS(e){e===void 0&&(e={});const{id:t,root:n}=e,r=Wc(),o=_S(),[s,i]=z.useState(null),c=z.useRef(null);return _t(()=>()=>{s==null||s.remove(),queueMicrotask(()=>{c.current=null})},[s]),_t(()=>{if(!r||c.current)return;const a=t?document.getElementById(t):null;if(!a)return;const u=document.createElement("div");u.id=r,u.setAttribute(v0,""),a.appendChild(u),c.current=u,i(u)},[t,r]),_t(()=>{if(n===null||!r||c.current)return;let a=n||(o==null?void 0:o.portalNode);a&&!lc(a)&&(a=a.current),a=a||document.body;let u=null;t&&(u=document.createElement("div"),u.id=t,a.appendChild(u));const l=document.createElement("div");l.id=r,l.setAttribute(v0,""),a=u||a,a.appendChild(l),c.current=l,i(l)},[t,n,r,o]),s}function jS(e){const{children:t,id:n,root:r,preserveTabOrder:o=!0}=e,s=RS({id:n,root:r}),[i,c]=z.useState(null),a=z.useRef(null),u=z.useRef(null),l=z.useRef(null),f=z.useRef(null),p=i==null?void 0:i.modal,d=i==null?void 0:i.open,h=!!i&&!i.modal&&i.open&&o&&!!(r||s);return z.useEffect(()=>{if(!s||!o||p)return;function m(v){s&&Hc(v)&&(v.type==="focusin"?f0:OS)(s)}return s.addEventListener("focusin",m,!0),s.addEventListener("focusout",m,!0),()=>{s.removeEventListener("focusin",m,!0),s.removeEventListener("focusout",m,!0)}},[s,o,p]),z.useEffect(()=>{s&&(d||f0(s))},[d,s]),I.jsxs(w0.Provider,{value:z.useMemo(()=>({preserveTabOrder:o,beforeOutsideRef:a,afterOutsideRef:u,beforeInsideRef:l,afterInsideRef:f,portalNode:s,setFocusManagerState:c}),[o,s]),children:[h&&s&&I.jsx(y0,{"data-type":"outside",ref:a,onFocus:m=>{if(Hc(m,s)){var v;(v=l.current)==null||v.focus()}else{const A=i?i.domReference:null,w=AS(A);w==null||w.focus()}}}),h&&s&&I.jsx("span",{"aria-owns":s.id,style:b0}),s&&Cr.createPortal(t,s),h&&s&&I.jsx(y0,{"data-type":"outside",ref:u,onFocus:m=>{if(Hc(m,s)){var v;(v=f.current)==null||v.focus()}else{const A=i?i.domReference:null,w=TS(A);w==null||w.focus(),i!=null&&i.closeOnFocusOut&&(i==null||i.onOpenChange(!1,m.nativeEvent,"focus-out"))}}})]})}const _S=()=>z.useContext(w0);function x0(e){return Fe(e.target)&&e.target.tagName==="BUTTON"}function US(e){return Fe(e.target)&&e.target.tagName==="A"}function E0(e){return c0(e)}function zS(e,t){t===void 0&&(t={});const{open:n,onOpenChange:r,dataRef:o,elements:{domReference:s}}=e,{enabled:i=!0,event:c="click",toggle:a=!0,ignoreMouse:u=!1,keyboardHandlers:l=!0,stickIfOpen:f=!0}=t,p=z.useRef(),d=z.useRef(!1),h=z.useMemo(()=>({onPointerDown(m){p.current=m.pointerType},onMouseDown(m){const v=p.current;m.button===0&&c!=="click"&&(No(v,!0)&&u||(n&&a&&(!(o.current.openEvent&&f)||o.current.openEvent.type==="mousedown")?r(!1,m.nativeEvent,"click"):(m.preventDefault(),r(!0,m.nativeEvent,"click"))))},onClick(m){const v=p.current;if(c==="mousedown"&&p.current){p.current=void 0;return}No(v,!0)&&u||(n&&a&&(!(o.current.openEvent&&f)||o.current.openEvent.type==="click")?r(!1,m.nativeEvent,"click"):r(!0,m.nativeEvent,"click"))},onKeyDown(m){p.current=void 0,!(m.defaultPrevented||!l||x0(m))&&(m.key===" "&&!E0(s)&&(m.preventDefault(),d.current=!0),!US(m)&&m.key==="Enter"&&r(!(n&&a),m.nativeEvent,"click"))},onKeyUp(m){m.defaultPrevented||!l||x0(m)||E0(s)||m.key===" "&&d.current&&(d.current=!1,r(!(n&&a),m.nativeEvent,"click"))}}),[o,s,c,u,l,r,n,f,a]);return z.useMemo(()=>i?{reference:h}:{},[i,h])}const HS={pointerdown:"onPointerDown",mousedown:"onMouseDown",click:"onClick"},WS={pointerdown:"onPointerDownCapture",mousedown:"onMouseDownCapture",click:"onClickCapture"},S0=e=>{var t,n;return{escapeKey:typeof e=="boolean"?e:(t=e==null?void 0:e.escapeKey)!=null?t:!1,outsidePress:typeof e=="boolean"?e:(n=e==null?void 0:e.outsidePress)!=null?n:!0}};function VS(e,t){t===void 0&&(t={});const{open:n,onOpenChange:r,elements:o,dataRef:s}=e,{enabled:i=!0,escapeKey:c=!0,outsidePress:a=!0,outsidePressEvent:u="pointerdown",referencePress:l=!1,referencePressEvent:f="pointerdown",ancestorScroll:p=!1,bubbles:d,capture:h}=t,m=qc(),v=Ut(typeof a=="function"?a:()=>!1),A=typeof a=="function"?v:a,w=z.useRef(!1),{escapeKey:T,outsidePress:B}=S0(d),{escapeKey:F,outsidePress:R}=S0(h),j=z.useRef(!1),g=Ut(S=>{var E;if(!n||!i||!c||S.key!=="Escape"||j.current)return;const C=(E=s.current.floatingContext)==null?void 0:E.nodeId,O=m?Zs(m.nodesRef.current,C):[];if(!T&&(S.stopPropagation(),O.length>0)){let b=!0;if(O.forEach(M=>{var D;if((D=M.context)!=null&&D.open&&!M.context.dataRef.current.__escapeKeyBubbles){b=!1;return}}),!b)return}r(!1,xS(S)?S.nativeEvent:S,"escape-key")}),y=Ut(S=>{var E;const C=()=>{var O;g(S),(O=Tr(S))==null||O.removeEventListener("keydown",C)};(E=Tr(S))==null||E.addEventListener("keydown",C)}),$=Ut(S=>{var E;const C=s.current.insideReactTree;s.current.insideReactTree=!1;const O=w.current;if(w.current=!1,u==="click"&&O||C||typeof A=="function"&&!A(S))return;const b=Tr(S),M="["+Io("inert")+"]",D=jt(o.floating).querySelectorAll(M);let _=fe(b)?b:null;for(;_&&!on(_);){const V=sn(_);if(on(V)||!fe(V))break;_=V}if(D.length&&fe(b)&&!yS(b)&&!$r(b,o.floating)&&Array.from(D).every(V=>!$r(_,V)))return;if(Fe(b)&&P){const V=on(b),Z=ct(b),H=/auto|scroll/,Q=V||H.test(Z.overflowX),X=V||H.test(Z.overflowY),se=Q&&b.clientWidth>0&&b.scrollWidth>b.clientWidth,me=X&&b.clientHeight>0&&b.scrollHeight>b.clientHeight,pe=Z.direction==="rtl",ue=me&&(pe?S.offsetX<=b.offsetWidth-b.clientWidth:S.offsetX>b.clientWidth),ge=se&&S.offsetY>b.clientHeight;if(ue||ge)return}const U=(E=s.current.floatingContext)==null?void 0:E.nodeId,W=m&&Zs(m.nodesRef.current,U).some(V=>{var Z;return zc(S,(Z=V.context)==null?void 0:Z.elements.floating)});if(zc(S,o.floating)||zc(S,o.domReference)||W)return;const K=m?Zs(m.nodesRef.current,U):[];if(K.length>0){let V=!0;if(K.forEach(Z=>{var H;if((H=Z.context)!=null&&H.open&&!Z.context.dataRef.current.__outsidePressBubbles){V=!1;return}}),!V)return}r(!1,S,"outside-press")}),k=Ut(S=>{var E;const C=()=>{var O;$(S),(O=Tr(S))==null||O.removeEventListener(u,C)};(E=Tr(S))==null||E.addEventListener(u,C)});z.useEffect(()=>{if(!n||!i)return;s.current.__escapeKeyBubbles=T,s.current.__outsidePressBubbles=B;let S=-1;function E(D){r(!1,D,"ancestor-scroll")}function C(){window.clearTimeout(S),j.current=!0}function O(){S=window.setTimeout(()=>{j.current=!1},As()?5:0)}const b=jt(o.floating);c&&(b.addEventListener("keydown",F?y:g,F),b.addEventListener("compositionstart",C),b.addEventListener("compositionend",O)),A&&b.addEventListener(u,R?k:$,R);let M=[];return p&&(fe(o.domReference)&&(M=vn(o.domReference)),fe(o.floating)&&(M=M.concat(vn(o.floating))),!fe(o.reference)&&o.reference&&o.reference.contextElement&&(M=M.concat(vn(o.reference.contextElement)))),M=M.filter(D=>{var _;return D!==((_=b.defaultView)==null?void 0:_.visualViewport)}),M.forEach(D=>{D.addEventListener("scroll",E,{passive:!0})}),()=>{c&&(b.removeEventListener("keydown",F?y:g,F),b.removeEventListener("compositionstart",C),b.removeEventListener("compositionend",O)),A&&b.removeEventListener(u,R?k:$,R),M.forEach(D=>{D.removeEventListener("scroll",E)}),window.clearTimeout(S)}},[s,o,c,A,u,n,r,p,i,T,B,g,F,y,$,R,k]),z.useEffect(()=>{s.current.insideReactTree=!1},[s,A,u]);const N=z.useMemo(()=>({onKeyDown:g,...l&&{[HS[f]]:S=>{r(!1,S.nativeEvent,"reference-press")},...f!=="click"&&{onClick(S){r(!1,S.nativeEvent,"reference-press")}}}}),[g,r,l,f]),P=z.useMemo(()=>({onKeyDown:g,onMouseDown(){w.current=!0},onMouseUp(){w.current=!0},[WS[u]]:()=>{s.current.insideReactTree=!0}}),[g,u,s]);return z.useMemo(()=>i?{reference:N,floating:P}:{},[i,N,P])}function GS(e){const{open:t=!1,onOpenChange:n,elements:r}=e,o=Wc(),s=z.useRef({}),[i]=z.useState(()=>BS()),c=Gc()!=null;if(process.env.NODE_ENV!=="production"){const d=r.reference;d&&!fe(d)&&kS("Cannot pass a virtual element to the `elements.reference` option,","as it must be a real DOM element. Use `refs.setPositionReference()`","instead.")}const[a,u]=z.useState(r.reference),l=Ut((d,h,m)=>{s.current.openEvent=d?h:void 0,i.emit("openchange",{open:d,event:h,reason:m,nested:c}),n==null||n(d,h,m)}),f=z.useMemo(()=>({setPositionReference:u}),[]),p=z.useMemo(()=>({reference:a||r.reference||null,floating:r.floating||null,domReference:r.reference}),[a,r.reference,r.floating]);return z.useMemo(()=>({dataRef:s,open:t,onOpenChange:l,elements:p,events:i,floatingId:o,refs:f}),[t,l,p,i,o,f])}function qS(e){e===void 0&&(e={});const{nodeId:t}=e,n=GS({...e,elements:{reference:null,floating:null,...e.elements}}),r=e.rootContext||n,o=r.elements,[s,i]=z.useState(null),[c,a]=z.useState(null),l=(o==null?void 0:o.domReference)||s,f=z.useRef(null),p=qc();_t(()=>{l&&(f.current=l)},[l]);const d=ah({...e,elements:{...o,...c&&{reference:c}}}),h=z.useCallback(T=>{const B=fe(T)?{getBoundingClientRect:()=>T.getBoundingClientRect(),getClientRects:()=>T.getClientRects(),contextElement:T}:T;a(B),d.refs.setReference(B)},[d.refs]),m=z.useCallback(T=>{(fe(T)||T===null)&&(f.current=T,i(T)),(fe(d.refs.reference.current)||d.refs.reference.current===null||T!==null&&!fe(T))&&d.refs.setReference(T)},[d.refs]),v=z.useMemo(()=>({...d.refs,setReference:m,setPositionReference:h,domReference:f}),[d.refs,m,h]),A=z.useMemo(()=>({...d.elements,domReference:l}),[d.elements,l]),w=z.useMemo(()=>({...d,...r,refs:v,elements:A,nodeId:t}),[d,v,A,t,r]);return _t(()=>{r.dataRef.current.floatingContext=w;const T=p==null?void 0:p.nodesRef.current.find(B=>B.id===t);T&&(T.context=w)}),z.useMemo(()=>({...d,context:w,refs:v,elements:A}),[d,v,A,w])}function Yc(){return mS()&&i0()}function ZS(e,t){t===void 0&&(t={});const{open:n,onOpenChange:r,events:o,dataRef:s,elements:i}=e,{enabled:c=!0,visibleOnly:a=!0}=t,u=z.useRef(!1),l=z.useRef(-1),f=z.useRef(!0);z.useEffect(()=>{if(!c)return;const d=He(i.domReference);function h(){!n&&Fe(i.domReference)&&i.domReference===Uc(jt(i.domReference))&&(u.current=!0)}function m(){f.current=!0}function v(){f.current=!1}return d.addEventListener("blur",h),Yc()&&(d.addEventListener("keydown",m,!0),d.addEventListener("pointerdown",v,!0)),()=>{d.removeEventListener("blur",h),Yc()&&(d.removeEventListener("keydown",m,!0),d.removeEventListener("pointerdown",v,!0))}},[i.domReference,n,c]),z.useEffect(()=>{if(!c)return;function d(h){let{reason:m}=h;(m==="reference-press"||m==="escape-key")&&(u.current=!0)}return o.on("openchange",d),()=>{o.off("openchange",d)}},[o,c]),z.useEffect(()=>()=>{lt(l)},[]);const p=z.useMemo(()=>({onMouseLeave(){u.current=!1},onFocus(d){if(u.current)return;const h=Tr(d.nativeEvent);if(a&&fe(h)){if(Yc()&&!d.relatedTarget){if(!f.current&&!c0(h))return}else if(!wS(h))return}r(!0,d.nativeEvent,"focus")},onBlur(d){u.current=!1;const h=d.relatedTarget,m=d.nativeEvent,v=fe(h)&&h.hasAttribute(Io("focus-guard"))&&h.getAttribute("data-type")==="outside";l.current=window.setTimeout(()=>{var A;const w=Uc(i.domReference?i.domReference.ownerDocument:document);!h&&w===i.domReference||$r((A=s.current.floatingContext)==null?void 0:A.refs.floating.current,w)||$r(i.domReference,w)||v||r(!1,m,"focus")})}}),[s,i.domReference,r,a]);return z.useMemo(()=>c?{reference:p}:{},[c,p])}function Xc(e,t,n){const r=new Map,o=n==="item";let s=e;if(o&&e){const{[d0]:i,[p0]:c,...a}=e;s=a}return{...n==="floating"&&{tabIndex:-1,[CS]:""},...s,...t.map(i=>{const c=i?i[n]:null;return typeof c=="function"?e?c(e):null:c}).concat(e).reduce((i,c)=>(c&&Object.entries(c).forEach(a=>{let[u,l]=a;if(!(o&&[d0,p0].includes(u)))if(u.indexOf("on")===0){if(r.has(u)||r.set(u,[]),typeof l=="function"){var f;(f=r.get(u))==null||f.push(l),i[u]=function(){for(var p,d=arguments.length,h=new Array(d),m=0;m<d;m++)h[m]=arguments[m];return(p=r.get(u))==null?void 0:p.map(v=>v(...h)).find(v=>v!==void 0)}}}else i[u]=l}),i),{})}}function KS(e){e===void 0&&(e=[]);const t=e.map(c=>c==null?void 0:c.reference),n=e.map(c=>c==null?void 0:c.floating),r=e.map(c=>c==null?void 0:c.item),o=z.useCallback(c=>Xc(c,e,"reference"),t),s=z.useCallback(c=>Xc(c,e,"floating"),n),i=z.useCallback(c=>Xc(c,e,"item"),r);return z.useMemo(()=>({getReferenceProps:o,getFloatingProps:s,getItemProps:i}),[o,s,i])}const YS=new Map([["select","listbox"],["combobox","listbox"],["label",!1]]);function XS(e,t){var n,r;t===void 0&&(t={});const{open:o,elements:s,floatingId:i}=e,{enabled:c=!0,role:a="dialog"}=t,u=Wc(),l=((n=s.domReference)==null?void 0:n.id)||u,f=z.useMemo(()=>{var w;return((w=vS(s.floating))==null?void 0:w.id)||i},[s.floating,i]),p=(r=YS.get(a))!=null?r:a,h=Gc()!=null,m=z.useMemo(()=>p==="tooltip"||a==="label"?{["aria-"+(a==="label"?"labelledby":"describedby")]:o?f:void 0}:{"aria-expanded":o?"true":"false","aria-haspopup":p==="alertdialog"?"dialog":p,"aria-controls":o?f:void 0,...p==="listbox"&&{role:"combobox"},...p==="menu"&&{id:l},...p==="menu"&&h&&{role:"menuitem"},...a==="select"&&{"aria-autocomplete":"none"},...a==="combobox"&&{"aria-autocomplete":"list"}},[p,f,h,o,l,a]),v=z.useMemo(()=>{const w={id:f,...p&&{role:p}};return p==="tooltip"||a==="label"?w:{...w,...p==="menu"&&{"aria-labelledby":l}}},[p,f,l,a]),A=z.useCallback(w=>{let{active:T,selected:B}=w;const F={role:"option",...T&&{id:f+"-fui-option"}};switch(a){case"select":case"combobox":return{...F,"aria-selected":B}}return{}},[f,a]);return z.useMemo(()=>c?{reference:m,floating:v,item:A}:{},[c,m,v,A])}const P0=x.forwardRef(({placement:e,className:t=""},n)=>{const o=(s=>{switch(s.split("-")[0]){case"top":return{bottom:"-4px",left:"50%",transform:"translateX(-50%)",borderLeft:"4px solid transparent",borderRight:"4px solid transparent",borderTop:"4px solid #242424"};case"bottom":return{top:"-4px",left:"50%",transform:"translateX(-50%)",borderLeft:"4px solid transparent",borderRight:"4px solid transparent",borderBottom:"4px solid #242424"};case"left":return{right:"-4px",top:"50%",transform:"translateY(-50%)",borderTop:"4px solid transparent",borderBottom:"4px solid transparent",borderLeft:"4px solid #242424"};case"right":return{left:"-4px",top:"50%",transform:"translateY(-50%)",borderTop:"4px solid transparent",borderBottom:"4px solid transparent",borderRight:"4px solid #242424"};default:return{}}})(e);return I.jsx("div",{ref:n,className:`absolute w-0 h-0 ${t}`,style:o})});P0.displayName="TooltipArrow";const qn=({children:e,content:t,placement:n="top",delay:r=200,showArrow:o=!0,className:s="",disabled:i=!1,maxWidth:c="max-w-xs",trigger:a=["hover","focus"]})=>{const[u,l]=x.useState(!1),f=x.useRef(null),{refs:p,floatingStyles:d,context:h}=qS({open:u&&!i,onOpenChange:l,placement:n,whileElementsMounted:rh,middleware:[Sc(o?12:8),uh({fallbackAxisSideDirection:"start",padding:8}),ch({padding:8}),...o?[h6({element:f})]:[]]}),m=DS(h,{enabled:a.includes("hover"),delay:{open:r,close:150}}),v=ZS(h,{enabled:a.includes("focus")}),A=zS(h,{enabled:a.includes("click")}),w=VS(h),T=XS(h,{role:"tooltip"}),{getReferenceProps:B,getFloatingProps:F}=KS([m,v,A,w,T]);return i?I.jsx(I.Fragment,{children:e}):I.jsxs(I.Fragment,{children:[I.jsx("div",{ref:p.setReference,...B(),className:"cursor-help",children:e}),u&&I.jsx(jS,{children:I.jsxs("div",{ref:p.setFloating,...F(),style:{...d,zIndex:101},className:`
|
|
177
|
+
*/var F3={L:Mr.QrCode.Ecc.LOW,M:Mr.QrCode.Ecc.MEDIUM,Q:Mr.QrCode.Ecc.QUARTILE,H:Mr.QrCode.Ecc.HIGH},Fh=128,Rh="L",jh="#FFFFFF",zh="#000000",Uh=!1,_h=1,R3=4,j3=0,z3=.1;function Wh(e,t=0){const n=[];return e.forEach(function(r,o){let s=null;r.forEach(function(i,c){if(!i&&s!==null){n.push(`M${s+t} ${o+t}h${c-s}v1H${s+t}z`),s=null;return}if(c===r.length-1){if(!i)return;s===null?n.push(`M${c+t},${o+t} h1v1H${c+t}z`):n.push(`M${s+t},${o+t} h${c+1-s}v1H${s+t}z`);return}i&&s===null&&(s=c)})}),n.join("")}function Vh(e,t){return e.slice().map((n,r)=>r<t.y||r>=t.y+t.h?n:n.map((o,s)=>s<t.x||s>=t.x+t.w?o:!1))}function U3(e,t,n,r){if(r==null)return null;const o=e.length+n*2,s=Math.floor(t*z3),i=o/t,c=(r.width||s)*i,a=(r.height||s)*i,l=r.x==null?e.length/2-c/2:r.x*i,u=r.y==null?e.length/2-a/2:r.y*i,f=r.opacity==null?1:r.opacity;let p=null;if(r.excavate){let h=Math.floor(l),m=Math.floor(u),x=Math.ceil(c+l-h),P=Math.ceil(a+u-m);p={x:h,y:m,w:x,h:P}}const d=r.crossOrigin;return{x:l,y:u,h:a,w:c,excavation:p,opacity:f,crossOrigin:d}}function _3(e,t){return t!=null?Math.max(Math.floor(t),0):e?R3:j3}function Hh({value:e,level:t,minVersion:n,includeMargin:r,marginSize:o,imageSettings:s,size:i,boostLevel:c}){let a=v.useMemo(()=>{const h=(Array.isArray(e)?e:[e]).reduce((m,x)=>(m.push(...Mr.QrSegment.makeSegments(x)),m),[]);return Mr.QrCode.encodeSegments(h,F3[t],n,void 0,void 0,c)},[e,t,n,c]);const{cells:l,margin:u,numCells:f,calculatedImageSettings:p}=v.useMemo(()=>{let d=a.getModules();const h=_3(r,o),m=d.length+h*2,x=U3(d,i,h,s);return{cells:d,margin:h,numCells:m,calculatedImageSettings:x}},[a,i,s,r,o]);return{qrcode:a,margin:u,cells:l,numCells:f,calculatedImageSettings:p}}var W3=function(){try{new Path2D().addPath(new Path2D)}catch{return!1}return!0}(),V3=v.forwardRef(function(t,n){const r=t,{value:o,size:s=Fh,level:i=Rh,bgColor:c=jh,fgColor:a=zh,includeMargin:l=Uh,minVersion:u=_h,boostLevel:f,marginSize:p,imageSettings:d}=r,m=bl(r,["value","size","level","bgColor","fgColor","includeMargin","minVersion","boostLevel","marginSize","imageSettings"]),{style:x}=m,P=bl(m,["style"]),E=d==null?void 0:d.src,T=v.useRef(null),N=v.useRef(null),M=v.useCallback(k=>{T.current=k,typeof n=="function"?n(k):n&&(n.current=k)},[n]),[F,L]=v.useState(!1),{margin:b,cells:g,numCells:w,calculatedImageSettings:O}=Hh({value:o,level:i,minVersion:u,boostLevel:f,includeMargin:l,marginSize:p,imageSettings:d,size:s});v.useEffect(()=>{if(T.current!=null){const k=T.current,y=k.getContext("2d");if(!y)return;let A=g;const D=N.current,S=O!=null&&D!==null&&D.complete&&D.naturalHeight!==0&&D.naturalWidth!==0;S&&O.excavation!=null&&(A=Vh(g,O.excavation));const B=window.devicePixelRatio||1;k.height=k.width=s*B;const j=s/w*B;y.scale(j,j),y.fillStyle=c,y.fillRect(0,0,w,w),y.fillStyle=a,W3?y.fill(new Path2D(Wh(A,b))):g.forEach(function(_,W){_.forEach(function(q,Z){q&&y.fillRect(Z+b,W+b,1,1)})}),O&&(y.globalAlpha=O.opacity),S&&y.drawImage(D,O.x+b,O.y+b,O.w,O.h)}}),v.useEffect(()=>{L(!1)},[E]);const C=ml({height:s,width:s},x);let I=null;return E!=null&&(I=v.createElement("img",{src:E,key:E,style:{display:"none"},onLoad:()=>{L(!0)},ref:N,crossOrigin:O==null?void 0:O.crossOrigin})),v.createElement(v.Fragment,null,v.createElement("canvas",ml({style:C,height:s,width:s,ref:M,role:"img"},P)),I)});V3.displayName="QRCodeCanvas";var Gh=v.forwardRef(function(t,n){const r=t,{value:o,size:s=Fh,level:i=Rh,bgColor:c=jh,fgColor:a=zh,includeMargin:l=Uh,minVersion:u=_h,boostLevel:f,title:p,marginSize:d,imageSettings:h}=r,m=bl(r,["value","size","level","bgColor","fgColor","includeMargin","minVersion","boostLevel","title","marginSize","imageSettings"]),{margin:x,cells:P,numCells:E,calculatedImageSettings:T}=Hh({value:o,level:i,minVersion:u,boostLevel:f,includeMargin:l,marginSize:d,imageSettings:h,size:s});let N=P,M=null;h!=null&&T!=null&&(T.excavation!=null&&(N=Vh(P,T.excavation)),M=v.createElement("image",{href:h.src,height:T.h,width:T.w,x:T.x+x,y:T.y+x,preserveAspectRatio:"none",opacity:T.opacity,crossOrigin:T.crossOrigin}));const F=Wh(N,x);return v.createElement("svg",ml({height:s,width:s,viewBox:`0 0 ${E} ${E}`,ref:n,role:"img"},m),!!p&&v.createElement("title",null,p),v.createElement("path",{fill:c,d:`M0,0 h${E}v${E}H0z`,shapeRendering:"crispEdges"}),v.createElement("path",{fill:a,d:F,shapeRendering:"crispEdges"}),M)});Gh.displayName="QRCodeSVG";function H3(){const e=navigator.userAgentData;return e!=null&&e.platform?e.platform:navigator.platform}function G3(){const e=navigator.userAgentData;return e&&Array.isArray(e.brands)?e.brands.map(t=>{let{brand:n,version:r}=t;return n+"/"+r}).join(" "):navigator.userAgent}function qh(){return/apple/i.test(navigator.vendor)}function q3(){return H3().toLowerCase().startsWith("mac")&&!navigator.maxTouchPoints}function K3(){return G3().includes("jsdom/")}const Kh="data-floating-ui-focusable",Z3="input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])";function gl(e){let t=e.activeElement;for(;((n=t)==null||(n=n.shadowRoot)==null?void 0:n.activeElement)!=null;){var n;t=t.shadowRoot.activeElement}return t}function Br(e,t){if(!e||!t)return!1;const n=t.getRootNode==null?void 0:t.getRootNode();if(e.contains(t))return!0;if(n&&Uc(n)){let r=t;for(;r;){if(e===r)return!0;r=r.parentNode||r.host}}return!1}function Lr(e){return"composedPath"in e?e.composedPath()[0]:e.target}function yl(e,t){if(t==null)return!1;if("composedPath"in e)return e.composedPath().includes(t);const n=e;return n.target!=null&&t.contains(n.target)}function Y3(e){return e.matches("html,body")}function Gt(e){return(e==null?void 0:e.ownerDocument)||document}function Zh(e){return je(e)&&e.matches(Z3)}function X3(e){if(!e||K3())return!0;try{return e.matches(":focus-visible")}catch{return!0}}function J3(e){return e?e.hasAttribute(Kh)?e:e.querySelector("["+Kh+"]")||e:null}function mi(e,t,n){return n===void 0&&(n=!0),e.filter(o=>{var s;return o.parentId===t&&(!n||((s=o.context)==null?void 0:s.open))}).flatMap(o=>[o,...mi(e,o.id,n)])}function Q3(e){return"nativeEvent"in e}function qo(e,t){const n=["mouse","pen"];return t||n.push("",void 0),n.includes(e)}var eS=typeof document<"u",tS=function(){},qt=eS?v.useLayoutEffect:tS;const nS={...z};function bi(e){const t=z.useRef(e);return qt(()=>{t.current=e}),t}const rS=nS.useInsertionEffect||(e=>e());function Kt(e){const t=z.useRef(()=>{if(process.env.NODE_ENV!=="production")throw new Error("Cannot call an event handler while rendering.")});return rS(()=>{t.current=e}),z.useCallback(function(){for(var n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return t.current==null?void 0:t.current(...r)},[])}const Yh=()=>({getShadowRoot:!0,displayCheck:typeof ResizeObserver=="function"&&ResizeObserver.toString().includes("[native code]")?"full":"none"});function Xh(e,t){const n=$p(e,Yh()),r=n.length;if(r===0)return;const o=gl(Gt(e)),s=n.indexOf(o),i=s===-1?t===1?0:r-1:s+t;return n[i]}function oS(e){return Xh(Gt(e).body,1)||e}function sS(e){return Xh(Gt(e).body,-1)||e}function vl(e,t){const n=t||e.currentTarget,r=e.relatedTarget;return!r||!Br(n,r)}function iS(e){$p(e,Yh()).forEach(n=>{n.dataset.tabindex=n.getAttribute("tabindex")||"",n.setAttribute("tabindex","-1")})}function Jh(e){e.querySelectorAll("[data-tabindex]").forEach(n=>{const r=n.dataset.tabindex;delete n.dataset.tabindex,r?n.setAttribute("tabindex",r):n.removeAttribute("tabindex")})}const aS="data-floating-ui-focusable",Qh="active",em="selected",cS={...z};let tm=!1,lS=0;const nm=()=>"floating-ui-"+Math.random().toString(36).slice(2,6)+lS++;function uS(){const[e,t]=z.useState(()=>tm?nm():void 0);return qt(()=>{e==null&&t(nm())},[]),z.useEffect(()=>{tm=!0},[]),e}const wl=cS.useId||uS;let xl;process.env.NODE_ENV!=="production"&&(xl=new Set);function fS(){for(var e,t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];const o="Floating UI: "+n.join(" ");if(!((e=xl)!=null&&e.has(o))){var s;(s=xl)==null||s.add(o),console.error(o)}}function dS(){const e=new Map;return{emit(t,n){var r;(r=e.get(t))==null||r.forEach(o=>o(n))},on(t,n){e.has(t)||e.set(t,new Set),e.get(t).add(n)},off(t,n){var r;(r=e.get(t))==null||r.delete(n)}}}const pS=z.createContext(null),hS=z.createContext(null),El=()=>{var e;return((e=z.useContext(pS))==null?void 0:e.id)||null},Sl=()=>z.useContext(hS);function Ko(e){return"data-floating-ui-"+e}function xt(e){e.current!==-1&&(clearTimeout(e.current),e.current=-1)}const rm=Ko("safe-polygon");function Pl(e,t,n){if(n&&!qo(n))return 0;if(typeof e=="number")return e;if(typeof e=="function"){const r=e();return typeof r=="number"?r:r==null?void 0:r[t]}return e==null?void 0:e[t]}function Tl(e){return typeof e=="function"?e():e}function mS(e,t){t===void 0&&(t={});const{open:n,onOpenChange:r,dataRef:o,events:s,elements:i}=e,{enabled:c=!0,delay:a=0,handleClose:l=null,mouseOnly:u=!1,restMs:f=0,move:p=!0}=t,d=Sl(),h=El(),m=bi(l),x=bi(a),P=bi(n),E=bi(f),T=z.useRef(),N=z.useRef(-1),M=z.useRef(),F=z.useRef(-1),L=z.useRef(!0),b=z.useRef(!1),g=z.useRef(()=>{}),w=z.useRef(!1),O=Kt(()=>{var D;const S=(D=o.current.openEvent)==null?void 0:D.type;return(S==null?void 0:S.includes("mouse"))&&S!=="mousedown"});z.useEffect(()=>{if(!c)return;function D(S){let{open:B}=S;B||(xt(N),xt(F),L.current=!0,w.current=!1)}return s.on("openchange",D),()=>{s.off("openchange",D)}},[c,s]),z.useEffect(()=>{if(!c||!m.current||!n)return;function D(B){O()&&r(!1,B,"hover")}const S=Gt(i.floating).documentElement;return S.addEventListener("mouseleave",D),()=>{S.removeEventListener("mouseleave",D)}},[i.floating,n,r,c,m,O]);const C=z.useCallback(function(D,S,B){S===void 0&&(S=!0),B===void 0&&(B="hover");const j=Pl(x.current,"close",T.current);j&&!M.current?(xt(N),N.current=window.setTimeout(()=>r(!1,D,B),j)):S&&(xt(N),r(!1,D,B))},[x,r]),I=Kt(()=>{g.current(),M.current=void 0}),k=Kt(()=>{if(b.current){const D=Gt(i.floating).body;D.style.pointerEvents="",D.removeAttribute(rm),b.current=!1}}),y=Kt(()=>o.current.openEvent?["click","mousedown"].includes(o.current.openEvent.type):!1);z.useEffect(()=>{if(!c)return;function D(W){if(xt(N),L.current=!1,u&&!qo(T.current)||Tl(E.current)>0&&!Pl(x.current,"open"))return;const q=Pl(x.current,"open",T.current);q?N.current=window.setTimeout(()=>{P.current||r(!0,W,"hover")},q):n||r(!0,W,"hover")}function S(W){if(y()){k();return}g.current();const q=Gt(i.floating);if(xt(F),w.current=!1,m.current&&o.current.floatingContext){n||xt(N),M.current=m.current({...o.current.floatingContext,tree:d,x:W.clientX,y:W.clientY,onClose(){k(),I(),y()||C(W,!0,"safe-polygon")}});const H=M.current;q.addEventListener("mousemove",H),g.current=()=>{q.removeEventListener("mousemove",H)};return}(T.current==="touch"?!Br(i.floating,W.relatedTarget):!0)&&C(W)}function B(W){y()||o.current.floatingContext&&(m.current==null||m.current({...o.current.floatingContext,tree:d,x:W.clientX,y:W.clientY,onClose(){k(),I(),y()||C(W)}})(W))}function j(){xt(N)}function _(W){y()||C(W,!1)}if(be(i.domReference)){const W=i.domReference,q=i.floating;return n&&W.addEventListener("mouseleave",B),p&&W.addEventListener("mousemove",D,{once:!0}),W.addEventListener("mouseenter",D),W.addEventListener("mouseleave",S),q&&(q.addEventListener("mouseleave",B),q.addEventListener("mouseenter",j),q.addEventListener("mouseleave",_)),()=>{n&&W.removeEventListener("mouseleave",B),p&&W.removeEventListener("mousemove",D),W.removeEventListener("mouseenter",D),W.removeEventListener("mouseleave",S),q&&(q.removeEventListener("mouseleave",B),q.removeEventListener("mouseenter",j),q.removeEventListener("mouseleave",_))}}},[i,c,e,u,p,C,I,k,r,n,P,d,x,m,o,y,E]),qt(()=>{var D;if(c&&n&&(D=m.current)!=null&&(D=D.__options)!=null&&D.blockPointerEvents&&O()){b.current=!0;const B=i.floating;if(be(i.domReference)&&B){var S;const j=Gt(i.floating).body;j.setAttribute(rm,"");const _=i.domReference,W=d==null||(S=d.nodesRef.current.find(q=>q.id===h))==null||(S=S.context)==null?void 0:S.elements.floating;return W&&(W.style.pointerEvents=""),j.style.pointerEvents="none",_.style.pointerEvents="auto",B.style.pointerEvents="auto",()=>{j.style.pointerEvents="",_.style.pointerEvents="",B.style.pointerEvents=""}}}},[c,n,h,i,d,m,O]),qt(()=>{n||(T.current=void 0,w.current=!1,I(),k())},[n,I,k]),z.useEffect(()=>()=>{I(),xt(N),xt(F),k()},[c,i.domReference,I,k]);const A=z.useMemo(()=>{function D(S){T.current=S.pointerType}return{onPointerDown:D,onPointerEnter:D,onMouseMove(S){const{nativeEvent:B}=S;function j(){!L.current&&!P.current&&r(!0,B,"hover")}u&&!qo(T.current)||n||Tl(E.current)===0||w.current&&S.movementX**2+S.movementY**2<2||(xt(F),T.current==="touch"?j():(w.current=!0,F.current=window.setTimeout(j,Tl(E.current))))}}},[u,r,n,P,E]);return z.useMemo(()=>c?{reference:A}:{},[c,A])}const om={border:0,clip:"rect(0 0 0 0)",height:"1px",margin:"-1px",overflow:"hidden",padding:0,position:"fixed",whiteSpace:"nowrap",width:"1px",top:0,left:0},sm=z.forwardRef(function(t,n){const[r,o]=z.useState();qt(()=>{qh()&&o("button")},[]);const s={ref:n,tabIndex:0,role:r,"aria-hidden":r?void 0:!0,[Ko("focus-guard")]:"",style:om};return $.jsx("span",{...t,...s})}),im=z.createContext(null),am=Ko("portal");function bS(e){e===void 0&&(e={});const{id:t,root:n}=e,r=wl(),o=yS(),[s,i]=z.useState(null),c=z.useRef(null);return qt(()=>()=>{s==null||s.remove(),queueMicrotask(()=>{c.current=null})},[s]),qt(()=>{if(!r||c.current)return;const a=t?document.getElementById(t):null;if(!a)return;const l=document.createElement("div");l.id=r,l.setAttribute(am,""),a.appendChild(l),c.current=l,i(l)},[t,r]),qt(()=>{if(n===null||!r||c.current)return;let a=n||(o==null?void 0:o.portalNode);a&&!zc(a)&&(a=a.current),a=a||document.body;let l=null;t&&(l=document.createElement("div"),l.id=t,a.appendChild(l));const u=document.createElement("div");u.id=r,u.setAttribute(am,""),a=l||a,a.appendChild(u),c.current=u,i(u)},[t,n,r,o]),s}function gS(e){const{children:t,id:n,root:r,preserveTabOrder:o=!0}=e,s=bS({id:n,root:r}),[i,c]=z.useState(null),a=z.useRef(null),l=z.useRef(null),u=z.useRef(null),f=z.useRef(null),p=i==null?void 0:i.modal,d=i==null?void 0:i.open,h=!!i&&!i.modal&&i.open&&o&&!!(r||s);return z.useEffect(()=>{if(!s||!o||p)return;function m(x){s&&vl(x)&&(x.type==="focusin"?Jh:iS)(s)}return s.addEventListener("focusin",m,!0),s.addEventListener("focusout",m,!0),()=>{s.removeEventListener("focusin",m,!0),s.removeEventListener("focusout",m,!0)}},[s,o,p]),z.useEffect(()=>{s&&(d||Jh(s))},[d,s]),$.jsxs(im.Provider,{value:z.useMemo(()=>({preserveTabOrder:o,beforeOutsideRef:a,afterOutsideRef:l,beforeInsideRef:u,afterInsideRef:f,portalNode:s,setFocusManagerState:c}),[o,s]),children:[h&&s&&$.jsx(sm,{"data-type":"outside",ref:a,onFocus:m=>{if(vl(m,s)){var x;(x=u.current)==null||x.focus()}else{const P=i?i.domReference:null,E=sS(P);E==null||E.focus()}}}),h&&s&&$.jsx("span",{"aria-owns":s.id,style:om}),s&&jr.createPortal(t,s),h&&s&&$.jsx(sm,{"data-type":"outside",ref:l,onFocus:m=>{if(vl(m,s)){var x;(x=f.current)==null||x.focus()}else{const P=i?i.domReference:null,E=oS(P);E==null||E.focus(),i!=null&&i.closeOnFocusOut&&(i==null||i.onOpenChange(!1,m.nativeEvent,"focus-out"))}}})]})}const yS=()=>z.useContext(im);function cm(e){return je(e.target)&&e.target.tagName==="BUTTON"}function vS(e){return je(e.target)&&e.target.tagName==="A"}function lm(e){return Zh(e)}function wS(e,t){t===void 0&&(t={});const{open:n,onOpenChange:r,dataRef:o,elements:{domReference:s}}=e,{enabled:i=!0,event:c="click",toggle:a=!0,ignoreMouse:l=!1,keyboardHandlers:u=!0,stickIfOpen:f=!0}=t,p=z.useRef(),d=z.useRef(!1),h=z.useMemo(()=>({onPointerDown(m){p.current=m.pointerType},onMouseDown(m){const x=p.current;m.button===0&&c!=="click"&&(qo(x,!0)&&l||(n&&a&&(!(o.current.openEvent&&f)||o.current.openEvent.type==="mousedown")?r(!1,m.nativeEvent,"click"):(m.preventDefault(),r(!0,m.nativeEvent,"click"))))},onClick(m){const x=p.current;if(c==="mousedown"&&p.current){p.current=void 0;return}qo(x,!0)&&l||(n&&a&&(!(o.current.openEvent&&f)||o.current.openEvent.type==="click")?r(!1,m.nativeEvent,"click"):r(!0,m.nativeEvent,"click"))},onKeyDown(m){p.current=void 0,!(m.defaultPrevented||!u||cm(m))&&(m.key===" "&&!lm(s)&&(m.preventDefault(),d.current=!0),!vS(m)&&m.key==="Enter"&&r(!(n&&a),m.nativeEvent,"click"))},onKeyUp(m){m.defaultPrevented||!u||cm(m)||lm(s)||m.key===" "&&d.current&&(d.current=!1,r(!(n&&a),m.nativeEvent,"click"))}}),[o,s,c,l,u,r,n,f,a]);return z.useMemo(()=>i?{reference:h}:{},[i,h])}const xS={pointerdown:"onPointerDown",mousedown:"onMouseDown",click:"onClick"},ES={pointerdown:"onPointerDownCapture",mousedown:"onMouseDownCapture",click:"onClickCapture"},um=e=>{var t,n;return{escapeKey:typeof e=="boolean"?e:(t=e==null?void 0:e.escapeKey)!=null?t:!1,outsidePress:typeof e=="boolean"?e:(n=e==null?void 0:e.outsidePress)!=null?n:!0}};function SS(e,t){t===void 0&&(t={});const{open:n,onOpenChange:r,elements:o,dataRef:s}=e,{enabled:i=!0,escapeKey:c=!0,outsidePress:a=!0,outsidePressEvent:l="pointerdown",referencePress:u=!1,referencePressEvent:f="pointerdown",ancestorScroll:p=!1,bubbles:d,capture:h}=t,m=Sl(),x=Kt(typeof a=="function"?a:()=>!1),P=typeof a=="function"?x:a,E=z.useRef(!1),{escapeKey:T,outsidePress:N}=um(d),{escapeKey:M,outsidePress:F}=um(h),L=z.useRef(!1),b=Kt(k=>{var y;if(!n||!i||!c||k.key!=="Escape"||L.current)return;const A=(y=s.current.floatingContext)==null?void 0:y.nodeId,D=m?mi(m.nodesRef.current,A):[];if(!T&&(k.stopPropagation(),D.length>0)){let S=!0;if(D.forEach(B=>{var j;if((j=B.context)!=null&&j.open&&!B.context.dataRef.current.__escapeKeyBubbles){S=!1;return}}),!S)return}r(!1,Q3(k)?k.nativeEvent:k,"escape-key")}),g=Kt(k=>{var y;const A=()=>{var D;b(k),(D=Lr(k))==null||D.removeEventListener("keydown",A)};(y=Lr(k))==null||y.addEventListener("keydown",A)}),w=Kt(k=>{var y;const A=s.current.insideReactTree;s.current.insideReactTree=!1;const D=E.current;if(E.current=!1,l==="click"&&D||A||typeof P=="function"&&!P(k))return;const S=Lr(k),B="["+Ko("inert")+"]",j=Gt(o.floating).querySelectorAll(B);let _=be(S)?S:null;for(;_&&!dn(_);){const H=pn(_);if(dn(H)||!be(H))break;_=H}if(j.length&&be(S)&&!Y3(S)&&!Br(S,o.floating)&&Array.from(j).every(H=>!Br(_,H)))return;if(je(S)&&I){const H=dn(S),U=vt(S),J=/auto|scroll/,K=H||J.test(U.overflowX),ee=H||J.test(U.overflowY),ie=K&&S.clientWidth>0&&S.scrollWidth>S.clientWidth,Y=ee&&S.clientHeight>0&&S.scrollHeight>S.clientHeight,ne=U.direction==="rtl",Q=Y&&(ne?k.offsetX<=S.offsetWidth-S.clientWidth:k.offsetX>S.clientWidth),le=ie&&k.offsetY>S.clientHeight;if(Q||le)return}const W=(y=s.current.floatingContext)==null?void 0:y.nodeId,q=m&&mi(m.nodesRef.current,W).some(H=>{var U;return yl(k,(U=H.context)==null?void 0:U.elements.floating)});if(yl(k,o.floating)||yl(k,o.domReference)||q)return;const Z=m?mi(m.nodesRef.current,W):[];if(Z.length>0){let H=!0;if(Z.forEach(U=>{var J;if((J=U.context)!=null&&J.open&&!U.context.dataRef.current.__outsidePressBubbles){H=!1;return}}),!H)return}r(!1,k,"outside-press")}),O=Kt(k=>{var y;const A=()=>{var D;w(k),(D=Lr(k))==null||D.removeEventListener(l,A)};(y=Lr(k))==null||y.addEventListener(l,A)});z.useEffect(()=>{if(!n||!i)return;s.current.__escapeKeyBubbles=T,s.current.__outsidePressBubbles=N;let k=-1;function y(j){r(!1,j,"ancestor-scroll")}function A(){window.clearTimeout(k),L.current=!0}function D(){k=window.setTimeout(()=>{L.current=!1},Ks()?5:0)}const S=Gt(o.floating);c&&(S.addEventListener("keydown",M?g:b,M),S.addEventListener("compositionstart",A),S.addEventListener("compositionend",D)),P&&S.addEventListener(l,F?O:w,F);let B=[];return p&&(be(o.domReference)&&(B=$n(o.domReference)),be(o.floating)&&(B=B.concat($n(o.floating))),!be(o.reference)&&o.reference&&o.reference.contextElement&&(B=B.concat($n(o.reference.contextElement)))),B=B.filter(j=>{var _;return j!==((_=S.defaultView)==null?void 0:_.visualViewport)}),B.forEach(j=>{j.addEventListener("scroll",y,{passive:!0})}),()=>{c&&(S.removeEventListener("keydown",M?g:b,M),S.removeEventListener("compositionstart",A),S.removeEventListener("compositionend",D)),P&&S.removeEventListener(l,F?O:w,F),B.forEach(j=>{j.removeEventListener("scroll",y)}),window.clearTimeout(k)}},[s,o,c,P,l,n,r,p,i,T,N,b,M,g,w,F,O]),z.useEffect(()=>{s.current.insideReactTree=!1},[s,P,l]);const C=z.useMemo(()=>({onKeyDown:b,...u&&{[xS[f]]:k=>{r(!1,k.nativeEvent,"reference-press")},...f!=="click"&&{onClick(k){r(!1,k.nativeEvent,"reference-press")}}}}),[b,r,u,f]),I=z.useMemo(()=>({onKeyDown:b,onMouseDown(){E.current=!0},onMouseUp(){E.current=!0},[ES[l]]:()=>{s.current.insideReactTree=!0}}),[b,l,s]);return z.useMemo(()=>i?{reference:C,floating:I}:{},[i,C,I])}function PS(e){const{open:t=!1,onOpenChange:n,elements:r}=e,o=wl(),s=z.useRef({}),[i]=z.useState(()=>dS()),c=El()!=null;if(process.env.NODE_ENV!=="production"){const d=r.reference;d&&!be(d)&&fS("Cannot pass a virtual element to the `elements.reference` option,","as it must be a real DOM element. Use `refs.setPositionReference()`","instead.")}const[a,l]=z.useState(r.reference),u=Kt((d,h,m)=>{s.current.openEvent=d?h:void 0,i.emit("openchange",{open:d,event:h,reason:m,nested:c}),n==null||n(d,h,m)}),f=z.useMemo(()=>({setPositionReference:l}),[]),p=z.useMemo(()=>({reference:a||r.reference||null,floating:r.floating||null,domReference:r.reference}),[a,r.reference,r.floating]);return z.useMemo(()=>({dataRef:s,open:t,onOpenChange:u,elements:p,events:i,floatingId:o,refs:f}),[t,u,p,i,o,f])}function TS(e){e===void 0&&(e={});const{nodeId:t}=e,n=PS({...e,elements:{reference:null,floating:null,...e.elements}}),r=e.rootContext||n,o=r.elements,[s,i]=z.useState(null),[c,a]=z.useState(null),u=(o==null?void 0:o.domReference)||s,f=z.useRef(null),p=Sl();qt(()=>{u&&(f.current=u)},[u]);const d=Gp({...e,elements:{...o,...c&&{reference:c}}}),h=z.useCallback(T=>{const N=be(T)?{getBoundingClientRect:()=>T.getBoundingClientRect(),getClientRects:()=>T.getClientRects(),contextElement:T}:T;a(N),d.refs.setReference(N)},[d.refs]),m=z.useCallback(T=>{(be(T)||T===null)&&(f.current=T,i(T)),(be(d.refs.reference.current)||d.refs.reference.current===null||T!==null&&!be(T))&&d.refs.setReference(T)},[d.refs]),x=z.useMemo(()=>({...d.refs,setReference:m,setPositionReference:h,domReference:f}),[d.refs,m,h]),P=z.useMemo(()=>({...d.elements,domReference:u}),[d.elements,u]),E=z.useMemo(()=>({...d,...r,refs:x,elements:P,nodeId:t}),[d,x,P,t,r]);return qt(()=>{r.dataRef.current.floatingContext=E;const T=p==null?void 0:p.nodesRef.current.find(N=>N.id===t);T&&(T.context=E)}),z.useMemo(()=>({...d,context:E,refs:x,elements:P}),[d,x,P,E])}function Al(){return q3()&&qh()}function AS(e,t){t===void 0&&(t={});const{open:n,onOpenChange:r,events:o,dataRef:s,elements:i}=e,{enabled:c=!0,visibleOnly:a=!0}=t,l=z.useRef(!1),u=z.useRef(-1),f=z.useRef(!0);z.useEffect(()=>{if(!c)return;const d=Ye(i.domReference);function h(){!n&&je(i.domReference)&&i.domReference===gl(Gt(i.domReference))&&(l.current=!0)}function m(){f.current=!0}function x(){f.current=!1}return d.addEventListener("blur",h),Al()&&(d.addEventListener("keydown",m,!0),d.addEventListener("pointerdown",x,!0)),()=>{d.removeEventListener("blur",h),Al()&&(d.removeEventListener("keydown",m,!0),d.removeEventListener("pointerdown",x,!0))}},[i.domReference,n,c]),z.useEffect(()=>{if(!c)return;function d(h){let{reason:m}=h;(m==="reference-press"||m==="escape-key")&&(l.current=!0)}return o.on("openchange",d),()=>{o.off("openchange",d)}},[o,c]),z.useEffect(()=>()=>{xt(u)},[]);const p=z.useMemo(()=>({onMouseLeave(){l.current=!1},onFocus(d){if(l.current)return;const h=Lr(d.nativeEvent);if(a&&be(h)){if(Al()&&!d.relatedTarget){if(!f.current&&!Zh(h))return}else if(!X3(h))return}r(!0,d.nativeEvent,"focus")},onBlur(d){l.current=!1;const h=d.relatedTarget,m=d.nativeEvent,x=be(h)&&h.hasAttribute(Ko("focus-guard"))&&h.getAttribute("data-type")==="outside";u.current=window.setTimeout(()=>{var P;const E=gl(i.domReference?i.domReference.ownerDocument:document);!h&&E===i.domReference||Br((P=s.current.floatingContext)==null?void 0:P.refs.floating.current,E)||Br(i.domReference,E)||x||r(!1,m,"focus")})}}),[s,i.domReference,r,a]);return z.useMemo(()=>c?{reference:p}:{},[c,p])}function Nl(e,t,n){const r=new Map,o=n==="item";let s=e;if(o&&e){const{[Qh]:i,[em]:c,...a}=e;s=a}return{...n==="floating"&&{tabIndex:-1,[aS]:""},...s,...t.map(i=>{const c=i?i[n]:null;return typeof c=="function"?e?c(e):null:c}).concat(e).reduce((i,c)=>(c&&Object.entries(c).forEach(a=>{let[l,u]=a;if(!(o&&[Qh,em].includes(l)))if(l.indexOf("on")===0){if(r.has(l)||r.set(l,[]),typeof u=="function"){var f;(f=r.get(l))==null||f.push(u),i[l]=function(){for(var p,d=arguments.length,h=new Array(d),m=0;m<d;m++)h[m]=arguments[m];return(p=r.get(l))==null?void 0:p.map(x=>x(...h)).find(x=>x!==void 0)}}}else i[l]=u}),i),{})}}function NS(e){e===void 0&&(e=[]);const t=e.map(c=>c==null?void 0:c.reference),n=e.map(c=>c==null?void 0:c.floating),r=e.map(c=>c==null?void 0:c.item),o=z.useCallback(c=>Nl(c,e,"reference"),t),s=z.useCallback(c=>Nl(c,e,"floating"),n),i=z.useCallback(c=>Nl(c,e,"item"),r);return z.useMemo(()=>({getReferenceProps:o,getFloatingProps:s,getItemProps:i}),[o,s,i])}const CS=new Map([["select","listbox"],["combobox","listbox"],["label",!1]]);function OS(e,t){var n,r;t===void 0&&(t={});const{open:o,elements:s,floatingId:i}=e,{enabled:c=!0,role:a="dialog"}=t,l=wl(),u=((n=s.domReference)==null?void 0:n.id)||l,f=z.useMemo(()=>{var E;return((E=J3(s.floating))==null?void 0:E.id)||i},[s.floating,i]),p=(r=CS.get(a))!=null?r:a,h=El()!=null,m=z.useMemo(()=>p==="tooltip"||a==="label"?{["aria-"+(a==="label"?"labelledby":"describedby")]:o?f:void 0}:{"aria-expanded":o?"true":"false","aria-haspopup":p==="alertdialog"?"dialog":p,"aria-controls":o?f:void 0,...p==="listbox"&&{role:"combobox"},...p==="menu"&&{id:u},...p==="menu"&&h&&{role:"menuitem"},...a==="select"&&{"aria-autocomplete":"none"},...a==="combobox"&&{"aria-autocomplete":"list"}},[p,f,h,o,u,a]),x=z.useMemo(()=>{const E={id:f,...p&&{role:p}};return p==="tooltip"||a==="label"?E:{...E,...p==="menu"&&{"aria-labelledby":u}}},[p,f,u,a]),P=z.useCallback(E=>{let{active:T,selected:N}=E;const M={role:"option",...T&&{id:f+"-fui-option"}};switch(a){case"select":case"combobox":return{...M,"aria-selected":N}}return{}},[f,a]);return z.useMemo(()=>c?{reference:m,floating:x,item:P}:{},[c,m,x,P])}const fm=v.forwardRef(({placement:e,className:t=""},n)=>{const o=(s=>{switch(s.split("-")[0]){case"top":return{bottom:"-4px",left:"50%",transform:"translateX(-50%)",borderLeft:"4px solid transparent",borderRight:"4px solid transparent",borderTop:"4px solid #242424"};case"bottom":return{top:"-4px",left:"50%",transform:"translateX(-50%)",borderLeft:"4px solid transparent",borderRight:"4px solid transparent",borderBottom:"4px solid #242424"};case"left":return{right:"-4px",top:"50%",transform:"translateY(-50%)",borderTop:"4px solid transparent",borderBottom:"4px solid transparent",borderLeft:"4px solid #242424"};case"right":return{left:"-4px",top:"50%",transform:"translateY(-50%)",borderTop:"4px solid transparent",borderBottom:"4px solid transparent",borderRight:"4px solid #242424"};default:return{}}})(e);return $.jsx("div",{ref:n,className:`absolute w-0 h-0 ${t}`,style:o})});fm.displayName="TooltipArrow";const nr=({children:e,content:t,placement:n="top",delay:r=200,showArrow:o=!0,className:s="",disabled:i=!1,maxWidth:c="max-w-xs",trigger:a=["hover","focus"]})=>{const[l,u]=v.useState(!1),f=v.useRef(null),{refs:p,floatingStyles:d,context:h}=TS({open:l&&!i,onOpenChange:u,placement:n,whileElementsMounted:_p,middleware:[el(o?12:8),Kp({fallbackAxisSideDirection:"start",padding:8}),qp({padding:8}),...o?[GE({element:f})]:[]]}),m=mS(h,{enabled:a.includes("hover"),delay:{open:r,close:150}}),x=AS(h,{enabled:a.includes("focus")}),P=wS(h,{enabled:a.includes("click")}),E=SS(h),T=OS(h,{role:"tooltip"}),{getReferenceProps:N,getFloatingProps:M}=NS([m,x,P,E,T]);return i?$.jsx($.Fragment,{children:e}):$.jsxs($.Fragment,{children:[$.jsx("div",{ref:p.setReference,...N(),className:"cursor-help",children:e}),l&&$.jsx(gS,{children:$.jsxs("div",{ref:p.setFloating,...M(),style:{...d,zIndex:101},className:`
|
|
169
178
|
z-[101] px-3 py-2 cursor-help
|
|
170
179
|
bg-fill-page-secondary
|
|
171
180
|
text-text-primary text-sm font-medium
|
|
@@ -173,5 +182,6 @@ ${Eb(d)}`),super(t.shortMessage,{cause:t,docsPath:r,metaMessages:[...t.metaMessa
|
|
|
173
182
|
relative
|
|
174
183
|
${c}
|
|
175
184
|
${s}
|
|
176
|
-
`,children:[t,o&&I.jsx(P0,{ref:f,placement:h.placement||n})]})})]})},Mo="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAACXBIWXMAABYlAAAWJQFJUiTwAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAIcSURBVHgBxZc/T8JAGMafA4mDEXFw0DiQmDi4CP5JHGFx0qizg8QvIHwCZHYAvwEm7mji5CJuJv7DxcWYYMLmIEYXY/R8j6tQaBvuaCm/pOlbSu99+rZ97zlgwDBowvNLCdrF6NJ50891OvNC+wrL3JShgZIAnl+JAj97FKXoMNLl7ySGnQDBHMtcVeFGAM8nKNlnlsI0eoIVuwlhzsmXqcwoURSFK1iVRCSdRDDn5PwC3cutingsJOK60nkiYE0unrdi8uFRIDwFBSJiTKOqzgKMl00teXgS2D0Fto+BiVkoIMYs8Xws4iiAkmeVn/n0oqyA2NQEQI4dytoKMEqfQt/haZmrQ4C8e7/4TtsI4JvwDbYDswCjvXr1yakQMXI2KxCD/8RMAtx2ux5gcjIzBAT8LH8bAQwYbwR8fUAb/vtuEsAr0OX5Eng8o30ZqN1BHzFLAkPGkb4AcdfnObigkbM5HdN3+Qb/ekGdrNu4CMyd8Ag6iElo/QBYzcpYByYsm8QkIFSADmI2nEkAc2sUL0ALHsxZBEjLxA+hSu22tb0+KV9Gd18027M2SybNQui+f53R6g/b+gDLVMi7YQsND+c5dTtzamlE0jiyJLwVYZhSqzO27YRSxFD8v1m4Q4xh74gdBUgRQm2QKsH0Ps82xEs9EndK3sgDlWGkW96naANqSzMSHSy4XprZi2kuTqN09VjrBH9AD4vTgfMHJt+rxIFF7EgAAAAASUVORK5CYII=",QS=(e,t)=>Number(e)>Number(t),At=e=>{if(!e||e===""||isNaN(Number(e)))return"0.00";const t=Number(e);if(t===0)return"0.00";let n=t.toString();n.includes("e")&&(n=t.toFixed(20));const r=n.split("."),o=r[0];let s=r[1]||"";return s.length>6&&(s=s.substring(0,6)),s=s.replace(/0+$/,""),s?(s.length===1&&(s+="0"),o+"."+s):o+".00"},Qc=(e,t="0")=>{if(/[^0-9.]/.test(e))return{isValid:!1,formattedValue:"",errorType:"invalid_char"};if(e===".")return{isValid:!0,formattedValue:"0."};if((e.match(/\./g)||[]).length>1)return{isValid:!1,formattedValue:"",errorType:"invalid_char"};if(!e||e==="")return{isValid:!0,formattedValue:""};const o=e.split(".");if(o.length===2&&o[1].length>6){const a=o[0]+"."+o[1].substring(0,6);return Qc(a,t)}const s=parseFloat(e),i=parseFloat(t);return!isNaN(s)&&!isNaN(i)&&s>i?{isValid:!0,formattedValue:At(t),errorType:"auto_adjusted_to_max"}:{isValid:!0,formattedValue:e}},Ys={ETHEREUM:1,ARBITRUM:42161,ARBITRUM_SEPOLIA:421614,SEPOLIA:11155111},JS=[Ys.ETHEREUM,Ys.SEPOLIA,Ys.ARBITRUM,Ys.ARBITRUM_SEPOLIA],eP=e=>{if(e.chainId!==void 0){const t=typeof e.chainId=="string"?parseInt(e.chainId,10):e.chainId;return!JS.includes(t)}return!0},tP=({currentActiveChain:e,selectedToken:t,address:n,accountType:r,onDeposit:o,onCopy:s,onClose:i})=>{const{t:c}=ht(),a=x.useMemo(()=>eP(e||{}),[e]),u=x.useMemo(()=>{if(!e)return!1;const p=r===Wv,d=Number(e.chainId),h=!Number.isNaN(d)&&(d===42161||d===421614),m=(t||"").toUpperCase()==="ETH";return p&&h&&m},[r,e,t]),l=x.useMemo(()=>{var p;return(p=e==null?void 0:e.tokenList)==null?void 0:p.find(d=>d.token===t||d.symbol===t)},[e,t]),f=(l==null?void 0:l.minDepositSize)||"10";return I.jsxs(I.Fragment,{children:[I.jsx("div",{className:"flex justify-center mt-4 mb-3",children:n&&I.jsx("div",{className:"bg-white rounded-lg",children:I.jsx(s0,{value:n,size:120,level:"L",bgColor:"#ffffff",fgColor:"#000000",marginSize:0})})}),n&&I.jsxs("div",{className:"flex items-center justify-between bg-fill-input-primary rounded-lg py-2 px-3 mb-3",children:[I.jsx("span",{className:"flex-1 text-text-primary text-sm font-medium break-all mr-3",children:n}),I.jsx(rS,{onCopy:()=>{s&&s(n)},text:n,children:I.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:[I.jsx("rect",{x:"2.08496",y:"4.02295",width:"9.89893",height:"9.89893",rx:"2",stroke:"#F9F9F9"}),I.jsx("path",{d:"M5.85547 2.07861H11.415C12.7957 2.07861 13.915 3.1979 13.915 4.57861V10.0786",stroke:"#F9F9F9",strokeLinecap:"round"})]})},"copy")]}),I.jsxs("div",{className:"border-b border-dashed border-line-divider-secondary pb-4",children:[I.jsxs("div",{className:"flex items-start",children:[I.jsx("div",{className:"w-5",children:I.jsx("img",{src:Mo,className:"w-4 h-4",alt:"Warning"})}),I.jsx("div",{className:"flex-1",children:I.jsx("p",{className:"text-xs text-functional-orange-1",children:c(u?"deposit.crossChainDepositFeeTip":"deposit.depositAllTip",{coin:t,v:e==null?void 0:e.chain})})})]}),a&&I.jsxs(I.Fragment,{children:[I.jsx("div",{className:"my-2 ml-5 h-[1px] border-b border-dashed border-line-divider-secondary"}),I.jsx("div",{className:"flex items-start pl-5 text-functional-orange-1 text-xs",children:c("deposit.depositTipFor25w")})]})]}),I.jsxs("div",{className:"text-sm",children:[I.jsxs("div",{className:"flex justify-between items-center h-[18px] mt-4",children:[I.jsx("span",{className:"text-text-tertiary",children:c("deposit.arrivalTime")}),I.jsx(qn,{content:I.jsxs("div",{className:"grid flex-grow max-w-[300px] min-w-[80px] rounded-2xl flex-col gap-[10px]",children:[I.jsx("p",{children:c("deposit.arrivaltimeTooltip1",{v:(e==null?void 0:e.blockTime)*e.txConfirm/60,v1:e==null?void 0:e.txConfirm})}),I.jsx("p",{children:c("deposit.arrivaltimeTooltip2")})]}),placement:"top",children:I.jsx("span",{className:"text-text-primary font-medium text-right border-b-[2px] border-dashed border-line-divider-primary decoration-dashed",children:c("deposit.arrivalEstimated",{v:(e==null?void 0:e.blockTime)*e.txConfirm/60})})})]}),I.jsxs("div",{className:"flex justify-between items-center h-[18px] mt-1",children:[I.jsx("span",{className:"text-text-tertiary",children:c("deposit.minDeposit")}),I.jsxs("span",{className:"text-text-primary font-medium text-right",children:[f," ",t]})]}),I.jsxs("div",{className:"flex justify-between items-center h-[18px] mt-1",children:[I.jsx("span",{className:"text-text-tertiary",children:c("deposit.maxDeposit")}),I.jsxs("span",{className:"text-text-primary font-medium text-right",children:["200,000 ",t]})]})]}),I.jsx("button",{className:"w-full h-[38px] bg-fill-btn-primary rounded-xl text-sm font-medium text-text-on-sec-btn mt-4",onClick:()=>{o&&o({amount:"",chainId:e.chainId,tokenAddress:n,tokenSymbol:t}),i()},children:c("deposit.title")})]})},ko=({size:e="xs",color:t,className:n="",label:r="Loading...",inline:o=!1})=>{const s=t?`loading-${t}`:"",i=o?"loading-inline":"";return I.jsx("span",{className:`loading loading-${e} loading-spinner ${s} ${i} ${n}`.trim(),"aria-label":r,role:"status","aria-live":"polite"})},nP=(e,t,n)=>{const r=parseFloat(String(e)||"0"),o=parseFloat(String(t)||"0");if(o>0){const s=r-o,i=At(Math.max(0,s).toString());return I.jsxs("span",{className:"flex items-center gap-1",children:[At(e),I.jsx("span",{className:"text-sm font-edgex-harmony text-functional-green-1 leading-[18px] font-medium",children:"→"}),i," ",n]})}return`${At(e)} ${n}`},rP=(e,t,n)=>{if(!e||e===""||e==="0"||e==="0.00")return!1;const r=parseFloat(e),o=parseFloat(t);return!(isNaN(r)||isNaN(o)||r>o||!n)},oP=(e,t,n)=>{if(!Rh(e,n))return!1;try{const r=new Ne(t||"0"),o=new Ne("200000");return r.isNaN()||o.isNaN()?!1:r.gte(o)}catch{return!1}},sP=(e,t,n)=>{let r=t||"0";if(Rh(e,n))try{const o=new Ne(r),s=new Ne("200000");o.gt(s)&&(r="200000")}catch(o){console.warn("Error calculating max amount limit:",o)}try{const o=new Ne(r||"0");return o.isNaN()?r:o.decimalPlaces(6,Ne.ROUND_DOWN).toString()}catch{return r}},$0={chains:[],spotChains:[],currentActiveAccount:{wallet:"EVM",ethAddress:"",accountId:"",smartWalletAddress:""},defaultChainId:1,defaultAccountType:"perpetual",balances:{spot:{},perpetual:{}}};let We=null;const T0=x.forwardRef((e,t)=>{const[n,r]=x.useState(!1),[o,s]=x.useState(!1),[i,c]=x.useState($0),a=x.useCallback(h=>{c(h),r(!0)},[]),u=x.useCallback(h=>{c(m=>({...m,...h}))},[]),l=x.useCallback(()=>{r(!1),s(!1),i.onClose&&i.onClose()},[i.onClose]),f=x.useCallback(h=>{s(h)},[]),p=x.useCallback(()=>n,[n]),d=x.useCallback(()=>o,[o]);return x.useImperativeHandle(t,()=>({openDeposit:a,closeDeposit:l,updateDepositOptions:u,setDepositLoading:f,isOpen:p,isLoading:d}),[a,l,u,f,p,d]),x.useEffect(()=>(We={openDeposit:a,closeDeposit:l,updateDepositOptions:u,setDepositLoading:f,isOpen:p,isLoading:d},()=>{We=null}),[a,l,u,f,p,d]),n?I.jsx(M0,{isOpen:n,isLoading:o,onClose:l,currentActiveAccount:i.currentActiveAccount,chains:i.chains,spotChains:i.spotChains,defaultChainId:i.defaultChainId,defaultSymbol:i.defaultSymbol,defaultAccountType:i.defaultAccountType,balances:i.balances,wagmiHooks:i.wagmiHooks,onDeposit:i.onDeposit,onCopy:i.onCopy,onChainChange:h=>{var m;return(m=i.onChainChange)==null?void 0:m.call(i,h)},onTokenChange:h=>{var m;return(m=i.onTokenChange)==null?void 0:m.call(i,h)}}):null});T0.displayName="DepositManager";const A0=e=>{if(!We){console.error("DepositManager not initialized. Make sure to render <DepositManager /> in your app.");return}We.openDeposit(e||$0)},O0=()=>{if(!We){console.error("DepositManager not initialized. Make sure to render <DepositManager /> in your app.");return}We.closeDeposit()},C0=e=>{We&&We.updateDepositOptions(e)},Xs=e=>{if(!We){console.error("DepositManager not initialized. Make sure to render <DepositManager /> in your app.");return}We.setDepositLoading(e)},iP=()=>We?We.isOpen():!1,N0=()=>We?We.isLoading():!1,aP=()=>({openDeposit:A0,closeDeposit:O0,updateDepositOptions:C0,setDepositLoading:Xs,isOpen:iP,isLoading:N0}),cP=e=>{const{t}=ht(),{isNetworkMismatch:n,depositAmount:r,approved:o,currentTokenBalance:s,selectedToken:i,showLayerZeroTip:c,minDeposit:a=10}=e;return x.useMemo(()=>{if(n)return{text:t("deposit.switchNetwork"),disabled:!0,isNetworkSwitch:!0};const u=parseFloat(r||"0"),f=(i||"").toUpperCase()==="ETH"?.001:a,p=rP(r,s||"0",o);return!r||u===0||!o?{text:t(c?"deposit.layerZeroDepositButton":"deposit.confirmDeposit"),disabled:!0,isNetworkSwitch:!1}:u<f?{text:t("deposit.minDepositParsed",{amount:f,token:i}),disabled:!0,isNetworkSwitch:!1}:{text:t(c?"deposit.layerZeroDepositButton":"deposit.confirmDeposit"),disabled:!p,isNetworkSwitch:!1}},[n,r,o,s,i,c,a,t])};function uP(e){const{account:t,accountChainId:n,targetChainId:r,tokenInfo:o,amount:s}=e,{useReadContract:i,useWriteContract:c,usePublicClient:a,useSwitchChain:u}=e.wagmiHooks,l=o==null?void 0:o.tokenAddress,f=(o==null?void 0:o.decimals)??18,p=o==null?void 0:o.contractAddress,d=!l||l.toLowerCase()==="0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",{switchChainAsync:h}=u(),{writeContractAsync:m}=c(),v=a(),A=i({address:l,abi:lr,functionName:"allowance",args:[An(t||""),p],chainId:r,query:{enabled:!!(!d&&t&&r&&l&&p)}}),w=A!=null&&A.isSuccess?A.data:void 0,T=x.useMemo(()=>{if(d)return!0;if(!A.isSuccess||w===void 0||w===0n)return!1;try{const F=mw(String(Number(s||"0")||0),Number(f));return w>=F}catch{return!1}},[d,A.isSuccess,w,s,f]),B=x.useCallback(async()=>{try{if(r&&n&&+n!=+r&&await h({chainId:+r}),!m||!v||!l||!p)return;const R=An(l),j=An(p);if((w||0n)>0n){const $=await m({abi:lr,address:R,functionName:"approve",args:[j,0n]});await v.waitForTransactionReceipt({hash:$})}const y=await m({abi:lr,address:R,functionName:"approve",args:[j,Fl]});await v.waitForTransactionReceipt({hash:y}),A!=null&&A.refetch&&await A.refetch()}catch(F){console.error("[useApprove] onApprove failed:",F)}},[r,n,l,p,w,A,m,v,h]);return{approve:T,onApprove:B}}const lP=({token:e,account:t,chainId:n,wagmiHooks:r,onResult:o})=>{var i;const s=(i=r==null?void 0:r.useBalance)==null?void 0:i.call(r,{address:t,token:e.tokenAddress,chainId:n,query:{enabled:!!t&&!!n&&!!e.tokenAddress&&!!(r!=null&&r.useBalance)}});return x.useEffect(()=>{o(An(e.tokenAddress),{balance:s})},[s,e.tokenAddress,o]),null},fP=({account:e,chainId:t,contractAddress:n,tokens:r=[],wagmiHooks:o})=>{var w;const s=typeof t=="string"?Number.isFinite(Number(t))?Number(t):void 0:t,i=x.useMemo(()=>{const T="0x0000000000000000000000000000000000000000",B="0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee";return r.filter(F=>{const R=F.tokenAddress;if(!R)return!1;const j=R.toLowerCase();return!(R===T||j===B)})},[r]),[c,a]=x.useState({}),u=x.useCallback((T,B)=>{a(F=>({...F,[T]:B}))},[]),l=(w=o==null?void 0:o.useBalance)==null?void 0:w.call(o,{address:e,chainId:s,query:{enabled:!!e&&!!s&&!!(o!=null&&o.useBalance)}}),[f,p]=x.useState(0),d=x.useMemo(()=>i.map(T=>x.createElement(lP,{key:`${T.tokenAddress}-${f}`,token:T,account:e,chainId:s,contractAddress:n,wagmiHooks:o,onResult:u})),[i,e,s,n,o,u,f]),h=x.useMemo(()=>{const T=l!=null&&l.data?{value:l.data.value,formatted:l.data.formatted,decimals:l.data.decimals,symbol:l.data.symbol}:{value:BigInt(0),formatted:"0",decimals:18,symbol:"ETH"},B=i.map(R=>{const j=c[An(R.tokenAddress)],g=j==null?void 0:j.balance,y=g==null?void 0:g.data;return{address:An(R.tokenAddress),value:(y==null?void 0:y.value)||BigInt(0),formatted:(y==null?void 0:y.formatted)||"0",decimals:(y==null?void 0:y.decimals)||R.decimals}}).filter(R=>R.address),F=B.reduce((R,j)=>({...R,[j.address]:{balance:j}}),{});return{balanceList:B,baseTokenBalance:T,combinedData:F}},[l,c,i]),m=x.useCallback(async()=>h,[h]),v=x.useMemo(()=>{const T=(l==null?void 0:l.isLoading)||!1,B=Object.values(c).some(F=>{var R;return(R=F.balance)==null?void 0:R.isLoading});return T||B},[l==null?void 0:l.isLoading,c]),A=x.useCallback(()=>p(T=>T+1),[]);return{multicallRun:m,multicallRefresh:A,multicallResult:h,validErcTokens:i,isLoading:v,queryComponents:d}},dP=({address:e,currentActiveChain:t,selectedToken:n,accountType:r,platformBalance:o,isLoading:s,wagmiHooks:i,onChainChange:c,onDeposit:a})=>{const{t:u}=ht(),l=i.useAccount(),f=t.tokenList.find(_=>_.token===n||_.symbol===n),p=t.chainId,[d,h]=x.useState("");x.useEffect(()=>{h("")},[n,t.chainId]);const{multicallResult:m,queryComponents:v}=fP({account:e,chainId:t.chainId,contractAddress:(f==null?void 0:f.contractAddress)||(t==null?void 0:t.contractAddress),tokens:(t==null?void 0:t.tokenList)||[],wagmiHooks:i}),A=x.useMemo(()=>{var U;if(!f)return"0";if(!f.tokenAddress||f.tokenAddress.toLowerCase()==="0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee")return m.baseTokenBalance.formatted;const _=m.combinedData[f.tokenAddress];return((U=_==null?void 0:_.balance)==null?void 0:U.formatted)||"0"},[f,m]),w="0xfd086bc7cd5c481dcc9c85ebe478a1c0b69fcbb9",T="0xceeed84620e5eb9ab1d6dfc316867d2cda332e41",B=x.useMemo(()=>{var _,U;return jv({chain:_v,transport:g1(t.rpcUrl||((_=window==null?void 0:window.ENV)==null?void 0:_.CHAIN_RPC_URL_42161)||((U=window==null?void 0:window.ENV)==null?void 0:U.CHAIN_RPC_URL_421614))})},[t.rpcUrl]),F="1000000000000",{formatted:R}=Uv({client:B,tokenAddress:w,holder:T,decimals:6,fallbackFormatted:F,pollingInterval:12e3}),[j,g]=x.useState(!1),{approve:y,onApprove:$}=uP({account:e,accountChainId:l.chainId,targetChainId:+t.chainId,tokenInfo:f,amount:d,wagmiHooks:i}),k=x.useCallback(async()=>{if(!j)try{g(!0),await $()}catch(_){console.error("Approve failed:",_)}finally{g(!1)}},[j,$]),N=x.useMemo(()=>+l.chainId!=+t.chainId,[l.chainId,t.chainId]),P=x.useCallback(async()=>{c&&c(p)},[c,p]);x.useEffect(()=>{N&&P()},[N,P]);const{showLayerZeroTip:S,layerZeroTipKey:E}=x.useMemo(()=>{const _=+t.chainId==42161||+t.chainId==421614,U=(n==null?void 0:n.toUpperCase())==="USDT",W=new Ne(d||"0"),K=new Ne("200000");let V=!1,Z;if(_&&U&&d)if(W.gte(K))V=!0,Z="deposit.layerZeroDepositTipGte200k";else{const H=R;if(typeof H=="string"&&H.length>0){const X=new Ne(H);!X.isNaN()&&W.gte(X)&&(V=!0,Z="deposit.layerZeroDepositTipExceedPool")}}return{showLayerZeroTip:V,layerZeroTipKey:Z}},[t.chainId,n,d,R]),C=x.useCallback(()=>sP(+t.chainId,A||"0",n),[A,t==null?void 0:t.chainId,n]),O=x.useMemo(()=>oP(+t.chainId,d,n),[t==null?void 0:t.chainId,d,n]),b=cP({isNetworkMismatch:N,depositAmount:d,approved:y,currentTokenBalance:A,selectedToken:n,showLayerZeroTip:S,minDeposit:f!=null&&f.minDepositSize?parseFloat(f.minDepositSize):10}),M=_=>{const U=_.target.value,W=C(),K=Qc(U,W);if(K.isValid)h(K.formattedValue),K.errorType;else return K.errorType==="exceed_balance",void 0},D=x.useCallback(async()=>{Xs(!0);try{a&&a({amount:d,chainId:p,tokenAddress:(f==null?void 0:f.tokenAddress)||"",tokenSymbol:n,accountType:r})}catch(_){console.error("Deposit error:",_),Xs(!1)}},[a,d,p,f==null?void 0:f.tokenAddress,r,n]);return I.jsxs(I.Fragment,{children:[v,I.jsxs("div",{className:"bg-fill-input-primary rounded-lg px-3 py-3 my-4",children:[I.jsxs("div",{className:"flex justify-between items-center h-[18px] mb-3",children:[I.jsx("input",{type:"text",placeholder:u("deposit.amount"),value:d,onChange:M,className:"flex-1 bg-transparent text-text-primary text-sm font-medium placeholder-text-tertiary placeholder:font-normal focus:outline-none border-none p-0 h-full"}),I.jsx("button",{onClick:()=>{const _=C();h(_)},className:"text-theme-normal text-xs font-medium cursor-pointer hover:opacity-80 transition-opacity h-full flex items-center",children:u("deposit.max")})]}),I.jsx("div",{className:"h-[1px] bg-line-divider-secondary mb-2"}),I.jsxs("div",{className:"flex justify-between items-center",children:[I.jsx(qn,{content:u("deposit.availableDesc"),children:I.jsx("span",{className:"text-text-tertiary text-xs leading-[14px] border-b border-dashed border-line-divider-primary",children:u("deposit.available")})}),I.jsx("span",{className:"text-text-primary text-xs leading-[14px]",children:nP(A||"0",d,n)})]})]}),!y&&QS(d||"0",0)&&I.jsxs("div",{className:"flex justify-center flex-col items-center",children:[I.jsx("h3",{className:"text-text-primary text-sm leading-4 font-medium",children:u("deposit.enableSystemProWithToken",{token:n,network:t==null?void 0:t.chain})}),I.jsx("p",{className:"text-text-secondary text-xs leading-3 mt-4",children:u("deposit.enableTokenDesc",{token:n,network:t==null?void 0:t.chain})}),I.jsx("button",{className:"w-[180px] h-8 bg-fill-btn-primary hover:bg-fill-btn-primary-hover text-text-on-sec-btn rounded-xl text-sm font-medium transition-colors my-4 disabled:opacity-50 disabled:cursor-not-allowed flex items-center justify-center",onClick:k,disabled:j,children:j?I.jsx(ko,{size:"xs",inline:!0}):u("deposit.enableWithToken",{token:n})})]}),S&&I.jsxs(I.Fragment,{children:[I.jsxs("div",{className:"flex mb-4",children:[I.jsx("div",{className:"w-5",children:I.jsx("img",{src:Mo,className:"w-4 h-4",alt:"Warning"})}),I.jsx("div",{className:"flex-1 text-xs text-functional-orange-1",children:u(E||"deposit.layerZeroDepositTip")})]}),I.jsx("div",{className:"my-2 ml-5 h-[1px] border-b border-dashed border-line-divider-secondary"})]}),O&&I.jsxs("div",{className:"flex mb-4",children:[I.jsx("div",{className:"w-5",children:I.jsx("img",{src:Mo,className:"w-4 h-4",alt:"Warning"})}),I.jsx("div",{className:"flex-1 text-xs text-functional-orange-1",children:u("deposit.depositTipFor25w")})]}),O&&I.jsx("div",{className:"my-2 ml-5 h-[1px] border-b border-dashed border-line-divider-secondary"}),I.jsxs("div",{className:"flex mb-4",children:[I.jsx("div",{className:"w-5",children:!(O||S)&&I.jsx("img",{src:Mo,className:"w-4 h-4",alt:"Warning"})}),I.jsx("div",{className:"flex-1 text-xs text-functional-orange-1",children:u("deposit.noPrivateKeyWalletWarning")})]}),I.jsxs("div",{className:"border-t border-line-divider-secondary border-dashed py-4",children:[I.jsxs("div",{className:"flex justify-between items-center h-[18px] leading-4",children:[I.jsx("span",{className:"text-sm text-text-tertiary",children:u("deposit.arrivalTime")}),I.jsx(qn,{content:I.jsxs("div",{className:"grid flex-grow max-w-[300px] min-w-[80px] rounded-2xl flex-col gap-[10px]",children:[I.jsx("p",{children:u("deposit.arrivaltimeTooltip1",{v:(t==null?void 0:t.blockTime)*t.txConfirm/60,v1:t==null?void 0:t.txConfirm})}),I.jsx("p",{children:u("deposit.arrivaltimeTooltip2")})]}),placement:"top",children:I.jsx("span",{className:"text-text-primary font-medium text-right border-b-[2px] border-dashed border-line-divider-primary decoration-dashed text-sm",children:u("deposit.arrivalEstimated",{v:(t==null?void 0:t.blockTime)*t.txConfirm/60})})})]}),I.jsxs("div",{className:"flex justify-between items-center h-[18px] leading-4 mt-2",children:[I.jsx("span",{className:"text-sm text-text-tertiary",children:u("deposit.equity")}),I.jsx("span",{className:"text-sm text-text-primary font-medium",children:d?I.jsxs("span",{className:"flex items-center gap-1",children:[At(o),I.jsx("span",{className:"text-sm font-edgex-harmony text-functional-green-1 leading-[18px] font-medium",children:"→"}),At((parseFloat(o)+parseFloat(d)).toString())," ",n]}):`${At(o)} ${n}`})]})]}),I.jsxs("button",{className:`w-full h-[38px] text-sm rounded-xl font-medium transition-colors flex items-center justify-center gap-2 ${b.disabled||s?"bg-text-disabled text-text-secondary cursor-not-allowed":"bg-fill-btn-primary text-text-on-sec-btn"}`,onClick:D,disabled:b.disabled||s,children:[(s||N)&&I.jsx(ko,{size:"xs"}),b.text]})]})},I0=e=>e.toLocaleUpperCase()===jn?jn:Ba,Jc=e=>I0(e.wallet)===jn,pP=e=>I0(e.wallet)===Ba,M0=({isOpen:e,isLoading:t=!1,onClose:n,currentActiveAccount:r,chains:o,spotChains:s=[],defaultChainId:i,defaultSymbol:c,defaultAccountType:a="perpetual",balances:u,wagmiHooks:l,onDeposit:f,onCopy:p,onChainChange:d,onTokenChange:h})=>{const{t:m}=ht(),[v,A]=x.useState(a),w=x.useCallback(P=>P==="spot"&&s&&s.length>0?s:o,[o,s]),T=w(a),[B,F]=x.useState(()=>{var P;return!T||T.length===0?1:i||((P=T[0])==null?void 0:P.chainId)||1}),R=x.useMemo(()=>w(v),[v,w]),j=R.find(P=>P.chainId===B)||R[0],[g,y]=x.useState(()=>{var b;if(!T||T.length===0)return"";const P=i||((b=T[0])==null?void 0:b.chainId),S=T.find(M=>M.chainId===P)||T[0],E=((S==null?void 0:S.tokenList)||[]).length>0?S:T.find(M=>(M.tokenList||[]).length>0),C=(E==null?void 0:E.tokenList)||[];if(c&&C.length>0){const M=c.toUpperCase(),D=C.find(_=>(_.token||_.symbol||"").toUpperCase()===M);if(D)return D.token||D.symbol||""}const O=C[0];return(O==null?void 0:O.token)||(O==null?void 0:O.symbol)||""}),$=x.useCallback(P=>{F(P),d==null||d(P)},[d]),k=x.useCallback(P=>{y(P),h==null||h(P)},[h]),N=x.useMemo(()=>{const P=(g||"").toLowerCase();if(!P)return"0";const S=v==="spot"?u==null?void 0:u.spot:u==null?void 0:u.perpetual,E=S==null?void 0:S[P];return typeof E=="string"&&E.length>0?E:"0"},[u,v,g]);return e?ke.createPortal(I.jsx("div",{className:"fixed top-0 left-0 right-0 bottom-0 w-screen h-screen",style:{zIndex:98},children:I.jsx("div",{className:"fixed top-0 left-0 right-0 bottom-0 z-[99] flex items-center justify-center",style:{background:"rgba(0, 0, 0, 0.6)",backdropFilter:"blur(10px)",WebkitBackdropFilter:"blur(10px)"},onClick:()=>{n()},"aria-hidden":"true",children:I.jsxs("div",{className:"relative w-[420px] max-h-[85vh] bg-fill-page-secondary overflow-auto rounded-lg p-6 shadow-xl border-[2px] border-solid border-line-divider-secondary",onClick:P=>{P.stopPropagation()},children:[I.jsxs("div",{className:"flex items-center justify-between mb-4",children:[I.jsx("h2",{className:"text-lg font-semibold text-white",children:m("deposit.title")}),I.jsx("button",{className:"text-gray-400 hover:text-gray-200 transition-colors",onClick:n,"aria-label":"Close",children:I.jsx(Fd,{className:"h-4 w-4"})})]}),I.jsx(_h,{selectedAccount:v,onAccountChange:P=>{var U,W;const S=P||"perpetual";A(S);const E=w(S);if(!E||E.length===0)return;const C=E.find(K=>K.chainId===B),O=C?C.chainId:E[0].chainId;F(O),d==null||d(O);const b=E.find(K=>K.chainId===O),M=(b==null?void 0:b.tokenList)||[],_=M.some(K=>(K.symbol||K.token)===g)?g:((U=M[0])==null?void 0:U.symbol)||((W=M[0])==null?void 0:W.token)||"";_&&(y(_),h==null||h(_))},className:"w-full"}),I.jsx(jh,{currentActiveChain:j,chainList:R,onChainChange:$,curSelectToken:g,onTokenChange:k,walletType:Jc(r)?jn:Ba}),Jc(r)&&I.jsx(tP,{address:r.smartWalletAddress,currentActiveChain:j,selectedToken:g,accountType:v,onDeposit:f,onCopy:p,onClose:n}),pP(r)&&I.jsx(dP,{address:r.ethAddress,currentActiveChain:j,selectedToken:g,accountType:v,platformBalance:N,isLoading:t,wagmiHooks:l,onChainChange:$,onDeposit:f,onClose:n})]})})}),document.body):null},hP=e=>{if(e==null||e==="")return 2;const t=String(e),n=t.indexOf(".");if(n===-1)return 0;const r=t.length-n-1;return r>0?r:2},mP=({withdrawAmount:e,curSelectToken:t,tokenInfo:n,currentActiveChain:r,platformBalance:o="0",fee:s="0.00",walletType:i="evm",receiverAddress:c="",accountType:a="perpetual",onWithdrawAmountChange:u,onReceiverAddressChange:l,onAmountChanged:f,showPoolBalanceInsufficientTip:p=!1})=>{const{t:d}=ht(),h=x.useMemo(()=>{const R=hP(n==null?void 0:n.showStepSize);if(a==="spot"||!un(r==null?void 0:r.chainId)){const j=new Ne(e||"0").minus(s||"0").decimalPlaces(R,Ne.ROUND_DOWN);return j.isNegative()?"0.00":j.toString()}return e||"0"},[e,s,r==null?void 0:r.chainId,a,n==null?void 0:n.showStepSize]),m=x.useMemo(()=>o||"0",[o]),v=x.useMemo(()=>{const R=(n==null?void 0:n.feeRate)||(n==null?void 0:n.withdrawFeeRate)||(r==null?void 0:r.feeRate)||0;try{return new Ne(R||0).times(100).toString()}catch{return"0"}},[n==null?void 0:n.feeRate,n==null?void 0:n.withdrawFeeRate,r==null?void 0:r.feeRate]),A=x.useMemo(()=>v==="0",[v]),w=x.useMemo(()=>{const R=(t||"").toUpperCase();return R==="USDT"||R==="USDC"},[t]),T=R=>{const j=R.target.value,y=Qc(j,m||"0");if(y.isValid)u(y.formattedValue),y.errorType;else return y.errorType==="exceed_balance",void 0;f==null||f(y.formattedValue)},B=()=>{u(m),f==null||f(m)},F=()=>{const R=parseFloat(o||"0"),j=parseFloat(e||"0");if(j>0){const g=R-j,y=At(Math.max(0,g).toString());return I.jsxs("span",{className:"flex items-center gap-1",children:[At(o||"0"),I.jsx("span",{className:"text-sm font-edgex-harmony text-functional-green-1 leading-[18px] font-medium",children:"→"}),y," ",t]})}return`${At(o||"0")} ${t}`};return I.jsxs(I.Fragment,{children:[I.jsxs("div",{className:"bg-fill-input-primary rounded-lg px-3 py-3 my-4",children:[I.jsxs("div",{className:"flex justify-between items-center h-[18px] mb-3",children:[I.jsx("input",{type:"text",placeholder:d("deposit.amount"),value:e,onChange:T,className:"flex-1 bg-transparent text-text-primary text-sm font-medium placeholder-text-tertiary placeholder:font-normal focus:outline-none border-none p-0 h-full"}),I.jsx("button",{onClick:B,className:"text-theme-normal text-xs font-medium cursor-pointer hover:opacity-80 transition-opacity h-full flex items-center",children:d("deposit.max")})]}),I.jsx("div",{className:"h-[1px] bg-line-divider-secondary mb-2"}),I.jsxs("div",{className:"flex justify-between items-center",children:[I.jsx(qn,{content:d("withdraw.availableDesc"),children:I.jsx("span",{className:"text-text-tertiary text-xs leading-[14px] border-b border-dashed border-line-divider-primary",children:d("deposit.available")})}),I.jsx("span",{className:"text-text-primary text-xs leading-[14px]",children:F()})]})]}),i==="mpc"&&(a==="spot"||!un(r==null?void 0:r.chainId))?I.jsx("div",{className:"bg-fill-input-primary rounded-lg my-4 h-9 flex items-center px-3",children:I.jsx("input",{type:"text",placeholder:d("withdraw.receiverAddress"),value:c,onChange:R=>l==null?void 0:l(R.target.value),className:"flex-1 bg-transparent text-text-primary text-sm font-medium placeholder-text-tertiary placeholder:font-normal focus:outline-none border-none p-0 h-full"})}):null,I.jsx("div",{className:"bg-fill-page-secondary rounded-lg mb-4",children:un(r==null?void 0:r.chainId)?I.jsxs(I.Fragment,{children:[I.jsx("p",{className:"text-text-tertiary text-xs leading-[18px]",children:d("withdraw.noticeDesc")}),I.jsx("a",{className:"block text-xs leading-[18px] mt-1 text-theme-normal",href:"https://edgex-1.gitbook.io/edgeX-documentation/getting-started/deposits-and-withdrawals/withdrawals",rel:"noreferrer",target:"_blank",children:d("withdraw.commonWithdraw")})]}):I.jsx("p",{className:"text-text-tertiary text-xs leading-[18px]",children:d("withdraw.crossChainTips")})}),p&&I.jsxs("div",{className:"flex mb-4",children:[I.jsx("div",{className:"w-5",children:I.jsx("img",{src:Mo,className:"w-4 h-4",alt:"Warning"})}),I.jsx("div",{className:"flex-1 text-xs text-functional-orange-1",children:d("withdraw.poolBalanceInsufficientTip")})]}),I.jsxs("div",{className:"py-4 border-t border-line-divider-secondary border-dashed",children:[I.jsxs("div",{className:"flex items-center justify-between h-[18px] leading-[18px]",children:[I.jsx(qn,{content:I.jsxs("div",{children:[I.jsx("div",{children:d("withdraw.speedNote")}),I.jsxs("div",{className:"flex gap-1 items-center mt-1",children:[I.jsx(Co,{selectedLevel:Tt.FAST,maxLevel:3}),I.jsx("span",{children:d("withdraw.speedNoteSpeed1")})]}),I.jsxs("div",{className:"flex gap-1 items-center mt-1",children:[I.jsx(Co,{selectedLevel:Tt.Medium,maxLevel:3}),I.jsx("span",{children:d("withdraw.speedNoteSpeed2")})]}),I.jsxs("div",{className:"flex gap-1 items-center mt-1",children:[I.jsx(Co,{selectedLevel:Tt.SLOW,maxLevel:3}),I.jsx("span",{children:d("withdraw.speedNoteSpeed3")})]})]}),children:I.jsx("span",{className:"text-text-tertiary text-sm leading-4 border-b border-dashed border-line-divider-primary",children:d("withdraw.speed")})}),I.jsx("div",{className:"flex items-center",children:I.jsx(Co,{selectedLevel:un(r==null?void 0:r.chainId)?Tt.SLOW:Tt.FAST,maxLevel:3})})]}),(a==="spot"||!un(r==null?void 0:r.chainId))&&I.jsxs("div",{className:"flex items-center justify-between mt-2 h-[18px]",children:[A||!w?I.jsx("span",{className:"text-text-tertiary text-sm leading-4",children:A?d("withdraw.fee"):`${d("withdraw.fee")}/${d("withdraw.feeRate")}`}):I.jsx(qn,{content:d("withdraw.feeCalculationTip"),children:I.jsx("span",{className:"text-text-tertiary text-sm leading-4 border-b border-dashed border-line-divider-primary",children:`${d("withdraw.fee")}/${d("withdraw.feeRate")}`})}),I.jsxs("span",{className:"text-text-primary text-sm leading-4 font-medium",children:[s," ",t,!A&&` / ${v}%`]})]}),I.jsxs("div",{className:"flex items-center justify-between mt-2 h-[18px]",children:[I.jsx("span",{className:"text-text-tertiary text-sm leading-4",children:d(un(r==null?void 0:r.chainId)?"withdraw.withdrawlAmount":"withdraw.amountToReceive")}),I.jsxs("span",{className:"text-text-primary text-sm leading-4 font-medium",children:[At(h)," ",t]})]})]})]})},gP=[];let Ve=null;const k0=x.forwardRef((e,t)=>{const[n,r]=x.useState(!1),[o,s]=x.useState(!1),[i,c]=x.useState({chains:[],currentActiveAccount:{wallet:"EVM",ethAddress:"",accountId:"",smartWalletAddress:""}}),a=x.useCallback(h=>{c(h||{chains:[],currentActiveAccount:{wallet:"EVM",ethAddress:"",accountId:"",smartWalletAddress:""}}),r(!0)},[]),u=x.useCallback(h=>{c(m=>({...m,...h}))},[]),l=x.useCallback(()=>{r(!1),s(!1),i.onClose&&i.onClose()},[i.onClose]),f=x.useCallback(h=>{s(h)},[]),p=x.useCallback(()=>n,[n]),d=x.useCallback(()=>o,[o]);return x.useImperativeHandle(t,()=>({openWithdraw:a,closeWithdraw:l,updateWithdrawOptions:u,setWithdrawLoading:f,isOpen:p,isLoading:d}),[a,l,u,f,p,d]),x.useEffect(()=>(Ve={openWithdraw:a,closeWithdraw:l,updateWithdrawOptions:u,setWithdrawLoading:f,isOpen:p,isLoading:d},()=>{Ve=null}),[a,l,u,f,p,d]),n?I.jsx(R0,{isOpen:n,isLoading:o,onClose:l,config:i.config||{symbol:"USDT"},currentActiveAccount:i.currentActiveAccount,chains:i.chains||gP,spotChains:i.spotChains,balances:i.balances,defaultChainId:i.defaultChainId,defaultSymbol:i.defaultSymbol,defaultAmount:i.defaultAmount,defaultAccountType:i.defaultAccountType,currentEquity:i.currentEquity??5e3,platformBalance:i.platformBalance||"0",fee:i.fee,wagmiHooks:i.wagmiHooks,onWithdraw:i.onWithdraw,onAccountChange:i.onAccountChange,onChainChange:i.onChainChange,onTokenChange:i.onTokenChange,onAmountChanged:i.onAmountChanged}):null});k0.displayName="WithdrawManager";const B0=e=>{if(!Ve){console.error("WithdrawManager not initialized. Make sure to render <WithdrawManager /> in your app.");return}Ve.openWithdraw(e||{chains:[],currentActiveAccount:{wallet:"EVM",ethAddress:"",accountId:"",smartWalletAddress:""}})},L0=()=>{if(!Ve){console.error("WithdrawManager not initialized. Make sure to render <WithdrawManager /> in your app.");return}Ve.closeWithdraw()},F0=e=>{if(!Ve){console.error("WithdrawManager not initialized. Make sure to render <WithdrawManager /> in your app.");return}Ve.updateWithdrawOptions(e)},Qs=e=>{if(!Ve){console.error("WithdrawManager not initialized. Make sure to render <WithdrawManager /> in your app.");return}Ve.setWithdrawLoading(e)},bP=()=>Ve?Ve.isOpen():!1,D0=()=>Ve?Ve.isLoading():!1,yP=()=>({openWithdraw:B0,closeWithdraw:L0,updateWithdrawOptions:F0,setWithdrawLoading:Qs,isOpen:bP,isLoading:D0}),wP=({walletType:e,chains:t,spotChains:n=[],defaultChainId:r,defaultSymbol:o,defaultAmount:s="",defaultAccountType:i="perpetual",currentEquity:c,platformBalance:a="0",balances:u,fee:l="0.00",isLoading:f=!1,onWithdraw:p,onClose:d,onChainChange:h,onTokenChange:m,onAmountChanged:v,onAccountChange:A})=>{var Z;const{t:w}=ht(),[T,B]=x.useState(i),F=x.useCallback(H=>H==="spot"&&n&&n.length>0?n:t,[t,n]),R=x.useMemo(()=>F(T),[T,F]),j=x.useMemo(()=>{if(!R||R.length===0)return{chainId:1,tokenSymbol:""};const H=pe=>{const ue=pe||[];if(!ue.length)return"";const oe="USDC".toUpperCase(),En=ue.find(ft=>(ft.token||ft.symbol||"").toUpperCase()===oe)||ue[0];return En.token||En.symbol||""};if(o){const pe=o==null?void 0:o.toUpperCase();for(const ue of R){const ge=ue.tokenList||[];let oe;if(pe&&(oe=ge.find(Ge=>(Ge.token||Ge.symbol||"").toUpperCase()===pe)),oe){const Ge=oe.token||oe.symbol||o||"";return{chainId:ue.chainId,tokenSymbol:Ge}}}}if(r){const pe=R.find(oe=>oe.chainId===r)||R[0],ue=pe.tokenList||[],ge=H(ue);return{chainId:pe.chainId,tokenSymbol:ge}}const Q="USDC",X=pe=>Array.isArray(pe.tokenList)&&pe.tokenList.some(ue=>(ue.token||ue.symbol||"").toUpperCase()===Q),se=R.find(X)||R[0];if(!se)return{chainId:1,tokenSymbol:""};const me=H(se.tokenList);return{chainId:se.chainId,tokenSymbol:me}},[R,r,o]),[g,y]=x.useState(()=>j.chainId),[$,k]=x.useState(()=>j.tokenSymbol),[N,P]=x.useState(s),[S,E]=x.useState(""),C=x.useCallback(H=>{y(H),h==null||h(H)},[h]),O=x.useCallback(H=>{k(H),m==null||m(H)},[m]),b=x.useRef(!0),M=x.useRef($),D=x.useRef(g);x.useEffect(()=>{if(b.current){b.current=!1,M.current=$,D.current=g;return}(M.current!==$||D.current!==g)&&(P(""),M.current=$,D.current=g)},[$,g]);const _=R&&R.length>0?R.find(H=>H.chainId===g)||R[0]:null,U=(Z=_==null?void 0:_.tokenList)==null?void 0:Z.find(H=>H.token===$),W=x.useMemo(()=>{const H=new Ne(N||"0"),Q=new Ne(l||"0"),X=un(g);return!N||H.isZero()||!X&&H.isLessThan(Q)?{text:w("withdraw.confirmWithdraw"),disabled:!0}:U!=null&&U.minWithdrawSize&&H.lt(U.minWithdrawSize)?{text:w("withdraw.minWithdrawParsed",{amount:U.minWithdrawSize,token:U.symbol||U.token}),disabled:!0}:e==="mpc"&&(!X||T==="spot")&&!S.trim()?{text:w("withdraw.invalidReceiverAddress"),disabled:!0}:{text:w("withdraw.confirmWithdraw"),disabled:!1}},[w,g,N,e,S,l,T,U]),K=x.useMemo(()=>{const H=($||"").toLowerCase();if(!H)return a||"0";const Q=T==="spot"?u==null?void 0:u.spot:u==null?void 0:u.perpetual,X=Q==null?void 0:Q[H];return typeof X=="string"&&X.length>0?X:a||"0"},[u,T,$,a]),V=x.useCallback(async()=>{Qs(!0);try{if(p){const Q={amount:new Ne(N||"0").toString(),chainId:g,tokenAddress:(U==null?void 0:U.tokenAddress)||"",coinId:(U==null?void 0:U.coinId)||"",tokenSymbol:$,accountType:T,selectedToken:U};e==="mpc"&&(!un(g)||T==="spot")&&(Q.receiverAddress=S),p(Q)}}catch{Qs(!1)}},[p,T,U,N,g,$,e,S]);return!R||R.length===0?I.jsx("div",{className:"text-center py-8",children:I.jsx("p",{className:"text-gray-400",children:"No chains available"})}):_?I.jsxs(I.Fragment,{children:[I.jsx(_h,{selectedAccount:T,onAccountChange:H=>{var Ge,En;const Q=H||"perpetual";B(Q),A==null||A(Q);const X=F(Q);if(!X||X.length===0)return;const se=X.find(ft=>ft.chainId===g),me=se?se.chainId:X[0].chainId;y(me),h==null||h(me);const pe=X.find(ft=>ft.chainId===me),ue=(pe==null?void 0:pe.tokenList)||[],oe=ue.some(ft=>(ft.symbol||ft.token)===$)?$:((Ge=ue[0])==null?void 0:Ge.symbol)||((En=ue[0])==null?void 0:En.token)||"";oe&&(k(oe),m==null||m(oe))},className:"w-full"}),I.jsx(jh,{currentActiveChain:_,chainList:R,onChainChange:C,curSelectToken:$,onTokenChange:O,walletType:"EVM",txType:"withdraw"}),I.jsx(mP,{withdrawAmount:N,curSelectToken:$,tokenInfo:U,curSelectTokenData:{balance:U==null?void 0:U.balance,allowance:U==null?void 0:U.allowance},currentActiveChain:_,currentEquity:c||0,decimals:(U==null?void 0:U.decimals)||6,platformBalance:K,fee:l,walletType:e,accountType:T,receiverAddress:S,onWithdrawAmountChange:P,onReceiverAddressChange:E,onAmountChanged:v}),I.jsxs("button",{className:`w-full h-[38px] text-sm rounded-xl font-medium transition-colors flex items-center justify-center gap-2 ${W.disabled||f?"bg-text-disabled text-text-secondary cursor-not-allowed":"bg-fill-btn-primary text-text-on-sec-btn"}`,onClick:V,disabled:W.disabled||f,children:[f&&I.jsx(ko,{size:"xs"}),W.text]})]}):I.jsx("div",{className:"text-center py-8",children:I.jsx("p",{className:"text-gray-400",children:"Loading..."})})},R0=({isOpen:e,isLoading:t=!1,defaultAccountType:n="perpetual",onClose:r,config:o,currentActiveAccount:s,chains:i,spotChains:c=[],defaultChainId:a,defaultSymbol:u,defaultAmount:l="",currentEquity:f=5e3,platformBalance:p="0",balances:d,fee:h,wagmiHooks:m,onWithdraw:v,onChainChange:A,onTokenChange:w,onAmountChanged:T,onAccountChange:B})=>{const{t:F}=ht();return e?ke.createPortal(I.jsx("div",{className:"fixed top-0 left-0 right-0 bottom-0 w-screen h-screen",style:{zIndex:98},children:I.jsx("div",{className:"fixed top-0 left-0 right-0 bottom-0 z-[99] flex items-center justify-center",style:{background:"rgba(0, 0, 0, 0.6)",backdropFilter:"blur(10px)",WebkitBackdropFilter:"blur(10px)"},onClick:()=>{r()},"aria-hidden":"true",children:I.jsxs("div",{className:"relative w-[420px] max-h-[85vh] bg-fill-page-secondary overflow-auto rounded-lg p-6 shadow-xl",onClick:R=>{R.stopPropagation()},children:[I.jsxs("div",{className:"flex items-center justify-between mb-4",children:[I.jsx("h2",{className:"text-lg font-semibold text-white",children:F("withdraw.withdraw")}),I.jsx("button",{className:"text-gray-400 hover:text-gray-200 transition-colors",onClick:r,"aria-label":"Close",children:I.jsx(Fd,{className:"h-4 w-4"})})]}),I.jsx(wP,{chains:i,spotChains:c,walletType:Jc(s)?"mpc":"evm",defaultChainId:a,defaultSymbol:u,defaultAmount:l,defaultAccountType:n,currentEquity:f,platformBalance:p,balances:d,fee:h,isLoading:t,wagmiHooks:m,onWithdraw:v,onClose:r,onChainChange:A,onTokenChange:w,onAmountChanged:T,onAccountChange:B})]})})}),document.body):null};re.ChromeLoader=ko,re.ComponentProvider=um,re.DEFAULT_LOCALE=Lo,re.Deposit=M0,re.DepositManager=T0,re.LOCALE_NAMES=im,re.LoadingSpinner=ko,re.SUPPORTED_LOCALES=ti,re.Tooltip=qn,re.Withdraw=R0,re.WithdrawManager=k0,re.closeDeposit=O0,re.closeWithdraw=L0,re.formatThousands=fm,re.isDepositLoading=N0,re.isWithdrawLoading=D0,re.openDeposit=A0,re.openWithdraw=B0,re.setDepositLoading=Xs,re.setWithdrawLoading=Qs,re.updateDepositOptions=C0,re.updateWithdrawOptions=F0,re.useComponentConfig=du,re.useDeposit=zv,re.useDepositManager=aP,re.useTranslation=ht,re.useWithdraw=Hv,re.useWithdrawManager=yP,Object.defineProperty(re,Symbol.toStringTag,{value:"Module"})});
|
|
185
|
+
`,children:[t,o&&$.jsx(fm,{ref:f,placement:h.placement||n})]})})]})},Zo="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAACXBIWXMAABYlAAAWJQFJUiTwAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAIcSURBVHgBxZc/T8JAGMafA4mDEXFw0DiQmDi4CP5JHGFx0qizg8QvIHwCZHYAvwEm7mji5CJuJv7DxcWYYMLmIEYXY/R8j6tQaBvuaCm/pOlbSu99+rZ97zlgwDBowvNLCdrF6NJ50891OvNC+wrL3JShgZIAnl+JAj97FKXoMNLl7ySGnQDBHMtcVeFGAM8nKNlnlsI0eoIVuwlhzsmXqcwoURSFK1iVRCSdRDDn5PwC3cutingsJOK60nkiYE0unrdi8uFRIDwFBSJiTKOqzgKMl00teXgS2D0Fto+BiVkoIMYs8Xws4iiAkmeVn/n0oqyA2NQEQI4dytoKMEqfQt/haZmrQ4C8e7/4TtsI4JvwDbYDswCjvXr1yakQMXI2KxCD/8RMAtx2ux5gcjIzBAT8LH8bAQwYbwR8fUAb/vtuEsAr0OX5Eng8o30ZqN1BHzFLAkPGkb4AcdfnObigkbM5HdN3+Qb/ekGdrNu4CMyd8Ag6iElo/QBYzcpYByYsm8QkIFSADmI2nEkAc2sUL0ALHsxZBEjLxA+hSu22tb0+KV9Gd18027M2SybNQui+f53R6g/b+gDLVMi7YQsND+c5dTtzamlE0jiyJLwVYZhSqzO27YRSxFD8v1m4Q4xh74gdBUgRQm2QKsH0Ps82xEs9EndK3sgDlWGkW96naANqSzMSHSy4XprZi2kuTqN09VjrBH9AD4vTgfMHJt+rxIFF7EgAAAAASUVORK5CYII=",IS=({currentActiveChain:e,selectedToken:t,address:n,accountType:r,accountId:o,accountKey:s,onDeposit:i,onCopy:c,onClose:a})=>{const{t:l}=Pt(),u=r===E5,f=!u,p=v.useMemo(()=>{if(!e)return!1;const P=Number(e.chainId);return!Number.isNaN(P)&&(P===42161||P===421614)},[e]),d=u,h=v.useMemo(()=>{var P;return(P=e==null?void 0:e.tokenList)==null?void 0:P.find(E=>E.token===t||E.symbol===t)},[e,t]),m=v.useMemo(()=>{const P=(t||"").toUpperCase();if(!d&&P==="USDC")return l("deposit.defaultSpotToPerpNotice",{coin:t,v:e==null?void 0:e.chain});const N=l(d?"deposit.crossChainDepositFeeTip":"deposit.depositAllTip",{coin:t,v:e==null?void 0:e.chain});return d&&(!p||P==="USDC")?String(N).split(`
|
|
186
|
+
`)[0]:N},[l,t,e==null?void 0:e.chain,d,p]),x=(h==null?void 0:h.minDepositSize)||"10";return $.jsxs($.Fragment,{children:[$.jsx("div",{className:"flex justify-center mt-4 mb-3",children:n&&$.jsx("div",{className:"bg-white rounded-lg",children:$.jsx(Gh,{value:n,size:120,level:"L",bgColor:"#ffffff",fgColor:"#000000",marginSize:0})})}),n&&$.jsxs("div",{className:"flex items-center justify-between bg-fill-input-primary rounded-lg py-2 px-3 mb-3",children:[$.jsx("span",{className:"flex-1 text-text-primary text-sm font-medium break-all mr-3",children:n}),$.jsx(B3,{onCopy:()=>{c&&c(n)},text:n,children:$.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:[$.jsx("rect",{x:"2.08496",y:"4.02295",width:"9.89893",height:"9.89893",rx:"2",stroke:"#F9F9F9"}),$.jsx("path",{d:"M5.85547 2.07861H11.415C12.7957 2.07861 13.915 3.1979 13.915 4.57861V10.0786",stroke:"#F9F9F9",strokeLinecap:"round"})]})},"copy")]}),$.jsxs("div",{className:"border-b border-dashed border-line-divider-secondary pb-4",children:[$.jsxs("div",{className:"flex items-start",children:[$.jsx("div",{className:"w-5",children:$.jsx("img",{src:Zo,className:"w-4 h-4",alt:"Warning"})}),$.jsx("div",{className:"flex-1",children:$.jsx("p",{className:"text-xs text-functional-orange-1",children:m})})]}),f&&$.jsxs($.Fragment,{children:[$.jsx("div",{className:"my-2 ml-5 h-[1px] border-b border-dashed border-line-divider-secondary"}),$.jsx("div",{className:"flex items-start pl-5 text-functional-orange-1 text-xs",children:l("deposit.addressUpdatedNotice")})]})]}),$.jsxs("div",{className:"text-sm",children:[(u||t.toUpperCase()!=="USDC")&&$.jsxs("div",{className:"flex justify-between items-center h-[18px] mt-4",children:[$.jsx("span",{className:"text-text-tertiary",children:l("deposit.arrivalTime")}),$.jsx(nr,{content:$.jsxs("div",{className:"grid flex-grow max-w-[300px] min-w-[80px] rounded-2xl flex-col gap-[10px]",children:[$.jsx("p",{children:l("deposit.arrivaltimeTooltip1",{v:(e==null?void 0:e.blockTime)*e.txConfirm/60,v1:e==null?void 0:e.txConfirm})}),$.jsx("p",{children:l("deposit.arrivaltimeTooltip2")})]}),placement:"top",children:$.jsx("span",{className:"text-text-primary font-medium text-right border-b-[2px] border-dashed border-line-divider-primary decoration-dashed",children:l("deposit.arrivalEstimated",{v:(e==null?void 0:e.blockTime)*e.txConfirm/60})})})]}),$.jsxs("div",{className:`flex justify-between items-center h-[18px] ${u||t.toUpperCase()!=="USDC"?"mt-1":"mt-4"}`,children:[$.jsx("span",{className:"text-text-tertiary",children:l("deposit.minDeposit")}),$.jsxs("span",{className:"text-text-primary font-medium text-right",children:[x," ",t]})]}),f&&t.toUpperCase()!=="USDC"&&$.jsxs("div",{className:"flex justify-between items-center h-[18px] mt-1",children:[$.jsx("span",{className:"text-text-tertiary",children:l("deposit.maxDeposit")}),$.jsxs("span",{className:"text-text-primary font-medium text-right",children:["200,000 ",t]})]})]}),$.jsx("button",{className:"w-full h-[38px] bg-fill-btn-primary rounded-xl text-sm font-medium text-text-on-sec-btn mt-4",onClick:()=>{i&&i({amount:"",chainId:e.chainId,tokenAddress:n,tokenSymbol:t,accountType:r,accountId:o,key:s}),a()},children:l("deposit.title")})]})},Yo=({size:e="xs",color:t,className:n="",label:r="Loading...",inline:o=!1})=>{const s=t?`loading-${t}`:"",i=o?"loading-inline":"";return $.jsx("span",{className:`loading loading-${e} loading-spinner ${s} ${i} ${n}`.trim(),"aria-label":r,role:"status","aria-live":"polite"})},$S=(e,t)=>Number(e)>Number(t),Lt=e=>{if(!e||e===""||isNaN(Number(e)))return"0.00";const t=Number(e);if(t===0)return"0.00";let n=t.toString();n.includes("e")&&(n=t.toFixed(20));const r=n.split("."),o=r[0];let s=r[1]||"";return s.length>6&&(s=s.substring(0,6)),s=s.replace(/0+$/,""),s?(s.length===1&&(s+="0"),o+"."+s):o+".00"},gi=(e,t="0")=>{if(/[^0-9.]/.test(e))return{isValid:!1,formattedValue:"",errorType:"invalid_char"};if(e===".")return{isValid:!0,formattedValue:"0."};if((e.match(/\./g)||[]).length>1)return{isValid:!1,formattedValue:"",errorType:"invalid_char"};if(!e||e==="")return{isValid:!0,formattedValue:""};const o=e.split(".");if(o.length===2&&o[1].length>6){const a=o[0]+"."+o[1].substring(0,6);return gi(a,t)}const s=parseFloat(e),i=parseFloat(t);return!isNaN(s)&&!isNaN(i)&&s>i?{isValid:!0,formattedValue:Lt(t),errorType:"auto_adjusted_to_max"}:{isValid:!0,formattedValue:e}},kS=(e,t,n)=>{const r=parseFloat(String(e)||"0"),o=parseFloat(String(t)||"0");if(o>0){const s=r-o,i=Lt(Math.max(0,s).toString());return $.jsxs("span",{className:"flex items-center gap-1",children:[Lt(e),$.jsx("span",{className:"text-sm font-edgex-harmony text-functional-green-1 leading-[18px] font-medium",children:"→"}),i," ",n]})}return`${Lt(e)} ${n}`},DS=(e,t,n)=>{if(!e||e===""||e==="0"||e==="0.00")return!1;const r=parseFloat(e),o=parseFloat(t);return!(isNaN(r)||isNaN(o)||r>o||!n)},MS=(e,t,n)=>{if(!Th(e,n))return!1;try{const r=new De(t||"0"),o=new De("200000");return r.isNaN()||o.isNaN()?!1:r.gte(o)}catch{return!1}},BS=(e,t,n,r)=>{let o=t||"0";if(!(r==="spot")&&Th(e,n))try{const i=new De(o),c=new De("200000");i.gt(c)&&(o="200000")}catch(i){console.warn("Error calculating max amount limit:",i)}try{const i=new De(o||"0");return console.log("bn:",i),console.log("bn:",i.isNaN()),i.isNaN()?o:i.decimalPlaces(6,De.ROUND_DOWN).toString()}catch{return o}},dm={accountChains:[],defaultChainId:1,defaultAccountType:"",balances:{}};let Xe=null;const pm=v.forwardRef((e,t)=>{const[n,r]=v.useState(!1),[o,s]=v.useState(!1),[i,c]=v.useState(dm),a=v.useCallback(h=>{c(h),r(!0)},[]),l=v.useCallback(h=>{c(m=>({...m,...h}))},[]),u=v.useCallback(()=>{r(!1),s(!1),i.onClose&&i.onClose()},[i.onClose]),f=v.useCallback(h=>{s(h)},[]),p=v.useCallback(()=>n,[n]),d=v.useCallback(()=>o,[o]);return v.useImperativeHandle(t,()=>({openDeposit:a,closeDeposit:u,updateDepositOptions:l,setDepositLoading:f,isOpen:p,isLoading:d}),[a,u,l,f,p,d]),v.useEffect(()=>(Xe={openDeposit:a,closeDeposit:u,updateDepositOptions:l,setDepositLoading:f,isOpen:p,isLoading:d},()=>{Xe=null}),[a,u,l,f,p,d]),n?$.jsx(wm,{isOpen:n,isLoading:o,onClose:u,accountChains:i.accountChains,defaultChainId:i.defaultChainId,defaultSymbol:i.defaultSymbol,defaultAccountType:i.defaultAccountType,balances:i.balances,wagmiHooks:i.wagmiHooks,onDeposit:i.onDeposit,onCopy:i.onCopy,onChainChange:h=>{var m;return(m=i.onChainChange)==null?void 0:m.call(i,h)},onTokenChange:h=>{var m;return(m=i.onTokenChange)==null?void 0:m.call(i,h)}}):null});pm.displayName="DepositManager";const hm=e=>{if(!Xe){console.error("DepositManager not initialized. Make sure to render <DepositManager /> in your app.");return}Xe.openDeposit(e||dm)},mm=()=>{if(!Xe){console.error("DepositManager not initialized. Make sure to render <DepositManager /> in your app.");return}Xe.closeDeposit()},bm=e=>{Xe&&Xe.updateDepositOptions(e)},yi=e=>{if(!Xe){console.error("DepositManager not initialized. Make sure to render <DepositManager /> in your app.");return}Xe.setDepositLoading(e)},LS=()=>Xe?Xe.isOpen():!1,gm=()=>Xe?Xe.isLoading():!1,FS=()=>({openDeposit:hm,closeDeposit:mm,updateDepositOptions:bm,setDepositLoading:yi,isOpen:LS,isLoading:gm}),RS=e=>{const{t}=Pt(),{isNetworkMismatch:n,depositAmount:r,approved:o,currentTokenBalance:s,selectedToken:i,showLayerZeroTip:c,minDeposit:a=10}=e;return v.useMemo(()=>{if(n)return{text:t("deposit.switchNetwork"),disabled:!0,isNetworkSwitch:!0};const l=parseFloat(r||"0"),u=a,f=DS(r,s||"0",o);return!r||l===0||!o?{text:t(c?"deposit.layerZeroDepositButton":"deposit.confirmDeposit"),disabled:!0,isNetworkSwitch:!1}:l<u?{text:t("deposit.minDepositParsed",{amount:u,token:i}),disabled:!0,isNetworkSwitch:!1}:{text:t(c?"deposit.layerZeroDepositButton":"deposit.confirmDeposit"),disabled:!f,isNetworkSwitch:!1}},[n,r,o,s,i,c,a,t])};function jS(e){const{account:t,accountChainId:n,targetChainId:r,tokenInfo:o,amount:s}=e,{useReadContract:i,useWriteContract:c,usePublicClient:a,useSwitchChain:l}=e.wagmiHooks,u=o==null?void 0:o.tokenAddress,f=(o==null?void 0:o.decimals)??18,p=o==null?void 0:o.contractAddress,d=!u||u.toLowerCase()==="0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",{switchChainAsync:h}=l(),{writeContractAsync:m}=c(),x=a(),P=i({address:u,abi:Sr,functionName:"allowance",args:[xn(t||""),p],chainId:r,query:{enabled:!!(!d&&t&&r&&u&&p)}}),E=P!=null&&P.isSuccess?P.data:void 0,T=v.useMemo(()=>{if(d)return!0;if(!P.isSuccess||E===void 0||E===0n)return!1;try{const M=I6(String(Number(s||"0")||0),Number(f));return E>=M}catch{return!1}},[d,P.isSuccess,E,s,f]),N=v.useCallback(async()=>{try{if(r&&n&&+n!=+r&&await h({chainId:+r}),!m||!x||!u||!p)return;const F=xn(u),L=xn(p);if((E||0n)>0n){const w=await m({abi:Sr,address:F,functionName:"approve",args:[L,0n]});await x.waitForTransactionReceipt({hash:w})}const g=await m({abi:Sr,address:F,functionName:"approve",args:[L,sf]});await x.waitForTransactionReceipt({hash:g}),P!=null&&P.refetch&&await P.refetch()}catch(M){console.error("[useApprove] onApprove failed:",M)}},[r,n,u,p,E,P,m,x,h]);return{approve:T,onApprove:N}}const zS=({token:e,account:t,chainId:n,wagmiHooks:r,onResult:o})=>{var i;const s=(i=r==null?void 0:r.useBalance)==null?void 0:i.call(r,{address:t,token:e.tokenAddress,chainId:n,query:{enabled:!!t&&!!n&&!!e.tokenAddress&&!!(r!=null&&r.useBalance)}});return v.useEffect(()=>{o(xn(e.tokenAddress),{balance:s})},[s,e.tokenAddress,o]),null},US=({account:e,chainId:t,contractAddress:n,tokens:r=[],wagmiHooks:o})=>{var E;const s=typeof t=="string"?Number.isFinite(Number(t))?Number(t):void 0:t,i=v.useMemo(()=>{const T="0x0000000000000000000000000000000000000000",N="0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee";return r.filter(M=>{const F=M.tokenAddress;if(!F)return!1;const L=F.toLowerCase();return!(F===T||L===N)})},[r]),[c,a]=v.useState({}),l=v.useCallback((T,N)=>{a(M=>({...M,[T]:N}))},[]),u=(E=o==null?void 0:o.useBalance)==null?void 0:E.call(o,{address:e,chainId:s,query:{enabled:!!e&&!!s&&!!(o!=null&&o.useBalance)}}),[f,p]=v.useState(0),d=v.useMemo(()=>i.map(T=>v.createElement(zS,{key:`${T.tokenAddress}-${f}`,token:T,account:e,chainId:s,contractAddress:n,wagmiHooks:o,onResult:l})),[i,e,s,n,o,l,f]),h=v.useMemo(()=>{const T=u!=null&&u.data?{value:u.data.value,formatted:u.data.formatted,decimals:u.data.decimals,symbol:u.data.symbol}:{value:BigInt(0),formatted:"0",decimals:18,symbol:"ETH"},N=i.map(F=>{const L=c[xn(F.tokenAddress)],b=L==null?void 0:L.balance,g=b==null?void 0:b.data;return{address:xn(F.tokenAddress),value:(g==null?void 0:g.value)||BigInt(0),formatted:(g==null?void 0:g.formatted)||"0",decimals:(g==null?void 0:g.decimals)||F.decimals}}).filter(F=>F.address),M=N.reduce((F,L)=>({...F,[L.address]:{balance:L}}),{});return{balanceList:N,baseTokenBalance:T,combinedData:M}},[u,c,i]),m=v.useCallback(async()=>h,[h]),x=v.useMemo(()=>{const T=(u==null?void 0:u.isLoading)||!1,N=Object.values(c).some(M=>{var F;return(F=M.balance)==null?void 0:F.isLoading});return T||N},[u==null?void 0:u.isLoading,c]),P=v.useCallback(()=>p(T=>T+1),[]);return{multicallRun:m,multicallRefresh:P,multicallResult:h,validErcTokens:i,isLoading:x,queryComponents:d}},_S=({address:e,currentActiveChain:t,selectedToken:n,accountType:r,accountId:o,accountKey:s,platformBalance:i,isLoading:c,wagmiHooks:a,onChainChange:l,onDeposit:u})=>{const{t:f}=Pt(),p=a.useAccount(),d=t.tokenList.find(Z=>Z.token===n||Z.symbol===n),h=t.chainId,[m,x]=v.useState("");v.useEffect(()=>{x("")},[n,t.chainId]);const{multicallResult:P,queryComponents:E}=US({account:e,chainId:t.chainId,contractAddress:(d==null?void 0:d.contractAddress)||(t==null?void 0:t.contractAddress),tokens:(t==null?void 0:t.tokenList)||[],wagmiHooks:a}),T=v.useMemo(()=>{var H;if(!d)return"0";if(!d.tokenAddress||d.tokenAddress.toLowerCase()==="0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee")return P.baseTokenBalance.formatted;const Z=P.combinedData[d.tokenAddress];return((H=Z==null?void 0:Z.balance)==null?void 0:H.formatted)||"0"},[d,P]),N="0xfd086bc7cd5c481dcc9c85ebe478a1c0b69fcbb9",M="0xceeed84620e5eb9ab1d6dfc316867d2cda332e41",F=v.useMemo(()=>{var Z,H;return h5({chain:y5,transport:g5(t.rpcUrl||((Z=window==null?void 0:window.ENV)==null?void 0:Z.CHAIN_RPC_URL_42161)||((H=window==null?void 0:window.ENV)==null?void 0:H.CHAIN_RPC_URL_421614))})},[t.rpcUrl]),L="1000000000000",{formatted:b}=v5({client:F,tokenAddress:N,holder:M,decimals:6,fallbackFormatted:L,pollingInterval:12e3}),[g,w]=v.useState(!1),{approve:O,onApprove:C}=jS({account:e,accountChainId:p.chainId,targetChainId:+t.chainId,tokenInfo:d,amount:m,wagmiHooks:a}),I=v.useCallback(async()=>{if(!g)try{w(!0),await C()}catch(Z){console.error("Approve failed:",Z)}finally{w(!1)}},[g,C]),k=v.useMemo(()=>+p.chainId!=+t.chainId,[p.chainId,t.chainId]),y=v.useCallback(async()=>{l&&l(h)},[l,h]);v.useEffect(()=>{k&&y()},[k,y]);const{showLayerZeroTip:A,layerZeroTipKey:D}=v.useMemo(()=>{const Z=+t.chainId==42161||+t.chainId==421614,H=(n==null?void 0:n.toUpperCase())==="USDT",U=new De(m||"0"),J=new De("200000");let K=!1,ee;if(Z&&H&&m)if(U.gte(J))K=!0,ee="deposit.layerZeroDepositTipGte200k";else{const ie=b;if(typeof ie=="string"&&ie.length>0){const ne=new De(ie);!ne.isNaN()&&U.gte(ne)&&(K=!0,ee="deposit.layerZeroDepositTipExceedPool")}}return{showLayerZeroTip:K,layerZeroTipKey:ee}},[t.chainId,n,m,b]),S=v.useCallback(()=>BS(+t.chainId,T||"0",n,r),[T,t==null?void 0:t.chainId,n,r]),B=v.useMemo(()=>r!=="spot"&&MS(+t.chainId,m,n),[r,t==null?void 0:t.chainId,m,n]),j=v.useMemo(()=>"deposit.maxDepositSplitTip",[]),_=RS({isNetworkMismatch:k,depositAmount:m,approved:O,currentTokenBalance:T,selectedToken:n,showLayerZeroTip:A,minDeposit:d!=null&&d.minDepositSize?parseFloat(d.minDepositSize):10}),W=Z=>{const H=Z.target.value,U=S(),J=gi(H,U);if(J.isValid)x(J.formattedValue),J.errorType;else return J.errorType==="exceed_balance",void 0},q=v.useCallback(async()=>{yi(!0);try{u&&u({amount:m,chainId:h,tokenAddress:(d==null?void 0:d.tokenAddress)||"",tokenSymbol:n,accountType:r,accountId:o,key:s})}catch(Z){console.error("Deposit error:",Z),yi(!1)}},[u,m,h,d==null?void 0:d.tokenAddress,r,n]);return $.jsxs($.Fragment,{children:[E,$.jsxs("div",{className:"bg-fill-input-primary rounded-lg px-3 py-3 my-4",children:[$.jsxs("div",{className:"flex justify-between items-center h-[18px] mb-3",children:[$.jsx("input",{type:"text",placeholder:f("deposit.amount"),value:m,onChange:W,className:"flex-1 bg-transparent text-text-primary text-sm font-medium placeholder-text-tertiary placeholder:font-normal focus:outline-none border-none p-0 h-full"}),$.jsx("button",{onClick:()=>{const Z=S();x(Z)},className:"text-theme-normal text-xs font-medium cursor-pointer hover:opacity-80 transition-opacity h-full flex items-center",children:f("deposit.max")})]}),$.jsx("div",{className:"h-[1px] bg-line-divider-secondary mb-2"}),$.jsxs("div",{className:"flex justify-between items-center",children:[$.jsx(nr,{content:f("deposit.availableDesc"),children:$.jsx("span",{className:"text-text-tertiary text-xs leading-[14px] border-b border-dashed border-line-divider-primary",children:f("deposit.available")})}),$.jsx("span",{className:"text-text-primary text-xs leading-[14px]",children:kS(T||"0",m,n)})]})]}),!O&&$S(m||"0",0)&&$.jsxs("div",{className:"flex justify-center flex-col items-center",children:[$.jsx("h3",{className:"text-text-primary text-sm leading-4 font-medium",children:f("deposit.enableSystemProWithToken",{token:n,network:t==null?void 0:t.chain})}),$.jsx("p",{className:"text-text-secondary text-xs leading-3 mt-4",children:f("deposit.enableTokenDesc",{token:n,network:t==null?void 0:t.chain})}),$.jsx("button",{className:"w-[180px] h-8 bg-fill-btn-primary hover:bg-fill-btn-primary-hover text-text-on-sec-btn rounded-xl text-sm font-medium transition-colors my-4 disabled:opacity-50 disabled:cursor-not-allowed flex items-center justify-center",onClick:I,disabled:g,children:g?$.jsx(Yo,{size:"xs",inline:!0}):f("deposit.enableWithToken",{token:n})})]}),A&&$.jsxs($.Fragment,{children:[$.jsxs("div",{className:"flex mb-4",children:[$.jsx("div",{className:"w-5",children:$.jsx("img",{src:Zo,className:"w-4 h-4",alt:"Warning"})}),$.jsx("div",{className:"flex-1 text-xs text-functional-orange-1",children:f(D||"deposit.layerZeroDepositTip")})]}),$.jsx("div",{className:"my-2 ml-5 h-[1px] border-b border-dashed border-line-divider-secondary"})]}),B&&$.jsxs("div",{className:"flex mb-4",children:[$.jsx("div",{className:"w-5",children:$.jsx("img",{src:Zo,className:"w-4 h-4",alt:"Warning"})}),$.jsx("div",{className:"flex-1 text-xs text-functional-orange-1",children:f(j)})]}),B&&$.jsx("div",{className:"my-2 ml-5 h-[1px] border-b border-dashed border-line-divider-secondary"}),$.jsxs("div",{className:"flex mb-4",children:[$.jsx("div",{className:"w-5",children:!(B||A)&&$.jsx("img",{src:Zo,className:"w-4 h-4",alt:"Warning"})}),$.jsx("div",{className:"flex-1 text-xs text-functional-orange-1 whitespace-pre-line",children:f("deposit.noPrivateKeyWalletWarning")})]}),$.jsxs("div",{className:"border-t border-line-divider-secondary border-dashed py-4",children:[$.jsxs("div",{className:"flex justify-between items-center h-[18px] leading-4",children:[$.jsx("span",{className:"text-sm text-text-tertiary",children:f("deposit.arrivalTime")}),$.jsx(nr,{content:$.jsxs("div",{className:"grid flex-grow max-w-[300px] min-w-[80px] rounded-2xl flex-col gap-[10px]",children:[$.jsx("p",{children:f("deposit.arrivaltimeTooltip1",{v:(t==null?void 0:t.blockTime)*t.txConfirm/60,v1:t==null?void 0:t.txConfirm})}),$.jsx("p",{children:f("deposit.arrivaltimeTooltip2")})]}),placement:"top",children:$.jsx("span",{className:"text-text-primary font-medium text-right border-b-[2px] border-dashed border-line-divider-primary decoration-dashed text-sm",children:f("deposit.arrivalEstimated",{v:(t==null?void 0:t.blockTime)*t.txConfirm/60})})})]}),$.jsxs("div",{className:"flex justify-between items-center h-[18px] leading-4 mt-2",children:[$.jsx("span",{className:"text-sm text-text-tertiary",children:f("deposit.equity")}),$.jsx("span",{className:"text-sm text-text-primary font-medium",children:m?$.jsxs("span",{className:"flex items-center gap-1",children:[Lt(i),$.jsx("span",{className:"text-sm font-edgex-harmony text-functional-green-1 leading-[18px] font-medium",children:"→"}),Lt((parseFloat(i)+parseFloat(m)).toString())," ",n]}):`${Lt(i)} ${n}`})]})]}),$.jsxs("button",{className:`w-full h-[38px] text-sm rounded-xl font-medium transition-colors flex items-center justify-center gap-2 ${_.disabled||c?"bg-text-disabled text-text-secondary cursor-not-allowed":"bg-fill-btn-primary text-text-on-sec-btn"}`,onClick:q,disabled:_.disabled||c,children:[(c||k)&&$.jsx(Yo,{size:"xs"}),_.text]})]})},ym=e=>e.toLocaleUpperCase()===ln?ln:Ms,vi=e=>ym(e.wallet)===ln,vm=e=>ym(e.wallet)===Ms,wi=e=>e?e==="perp"?st.PERPETUAL:e==="perp-v2"||e==="perp_v2"?st.PERPETUALV2:e:"",WS="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGAAAAAoCAYAAAABk/85AAAACXBIWXMAABYlAAAWJQFJUiTwAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAABBMSURBVHgBvVt7kBTHef/17N77fRwSiNeBBAGBpVNJERKyoqOSuByiVLAScOKqJKAYJU4F8XCVY8d/cLiSkKSS4pDtKJKRdFhxYoNskTKS4jixFguEICAdiDtAvJb3cRzcg7u9vX1M5/t6puexO7u3Byd+VDOzPT3dPd/39ffqPoFbhJSymS5NVJ6yr7V2YfRRidrlMJWIECKC28Bnv5dslqZskjCeEhA0nvSPJ0SU5hQ1IA/DQGTPqqIIbgMLvjzcbAjxoBRoFlLSeKJWqjEFDY0++p6oCRmFFO2Aufvo1rIIbgFiLI3pA/mD11BZC/fjC0WUSoTKRp58IS80vyZrEylzjTDlLYxHYwgZKUqHNka+Uth4TWtlbWowvkZArjWlqBEikz4SNsmkdZXqB7WDaVrfV1SEje3/WhZFgSiIATbhN8Ai/HigDXkYwYRPJkwaT47PeAJt+RjBhE8PDm+QEGvpW/VLkglMUFeuFja13HvBtHHu1SOp3nktHMa3CmHEqAygDlniWzB2iR8NUVhMaPNWPv5yeo0hZcv4j0cqSsiN7z8XbvPWLlgVXwMz3UJk9I4nLekWmqD6t9WTUEzw1vme8zNqc84wzI0ff6+yLe+s8j2kwTdj/KQ+F1rpA9fxzRMvpTePm9TnhGjd+2chNd78Z2ObiVZrbYJaT4Ur4TYhhbMoPM8z7h3dZD+RVhU1MURrx9bydTlnE1Rpq5w3qTTjDqB/BO2//f10H825GXcAMiXb+z8c6SPiNXuIK7XOt+oE/WbVI2wmKBpLr9632nrbeVWVh7RSthfL5OL2trq+zLmEc8zxXSpN8cEBlFZW49OEGR/A2rcqmiBxxzDQmWgiowlbcO2RpUfStd6XnnpNfOsdVk26NfVFxDcVE/z92CsIsimOMAv04sy5hDIrbLWzlO9f+OJnkDwVwcRygVD9NIhwCcYDTPTBfa/jo3//W/z1OzGcLnsYdwqxaBLJ3rS6l9Z/mpD21ZJk3d4yspZIewjrFW/nfVtdaXXkukxWXePEpm/W9rT/3c+88/GpIBpsBV1e4/uO997B97+5QtUvnGpg4bQQyh9ejvJHlqFk1uO4FcTP7MPQwR2Id/wXdh/vxc/Ll+Hk45txpzByLYXBUwm49HFhMUPYasiRcjw6NyTmTQ9hLpUpDRa5bsYkjp03ceB4Cv93Ig29iiz1IzNtgcMEezWsO9FW0+q0cCYgZSMs1cNXbN/0PA698yOnq+oSgWfmh+lKy6ZuGioeXoayR5YjXDcV+cDSfvO9rRjcs9W6HwHeoolfMqbi6G+8gXjlNNwJmCMS/R1xpONewrvCyuLrld4vfLZI/OXSYiK6kbffSz0mvrMzgTf3JLXb6qwatz/nN3fdNyLMmVHbHngZwJK/Qv/esGQ22AZ4wUxYOM3AvInupKrvmYaiHJYkkSIDe/mC8/tYt4k950yMpCROLmpF96zluBVMrhK4bwJQWWz9HiSh7hoETvbkNiQ3T41gpDul7r06Ah5isYROmWBg06oylnyMBcyIP/77GC5eM7M8J3jcVNt4t57YVqM8Ix09NNLlrG49PNiPliVzcg7WNNnArzVaE2TiV1UEtxuIEROStPTpuw9cTOPwFWX5MEJSf3DpfowFVcUCyz4DLF9goDKHKeq6CXx4ReK1gxJXBl0KsPT3HBzSXjy0+pH2b9t7B6ua764pH1Xqc4GZ8BdbhnD8vDLejoekepd+25IwZB2vAj3SBm9HZZU1qJuUWzW0EyHbPkxhgNRJMuX6xV6kTYv4rHLe7Eg5xGecf+CrGAuWLxDY8YcGnn04N/EZk6qAJXOo7Ze4rauKh84n7ElK+5+tr/mhJBeGChP9dojP4Hf/ZU0FpkxwAzW+Sm1grHtlW8IpgwNc6NGaMzub9dCivIMNkFT9x5Ekjl0jlZLMfp5KWSrnh0dS6In5OTRwV2FGnKX+208beH5RfsIHgZm16XOGUlMjfZbqMSU0BRQbTJc6eP0bFbdFfA3uY9Oqcrtf6bsSo4XFCF4Npgo4Q3ZWMyv67O26gE8OvJt3MJbyMzekYsCcu/yT/8UnJn55Nq3aeDFw9yJcnrcKheDlpSHMv9sfKw7Sitp5XOLf2iVeOiDxzicS/3tGKjswoUz4GDWjVmCyMPHT90YCl6ntXuKZJ0uoFGO8MJVsJHlKov2UYryt87zRmVJFpfUPfH03m89m3AbYMM8OkJxG+viPuwSpIP+H999dmPSz5FZm0OTVQxI7jppKrWXio8sSL7xvSb5X/XScTtr6QCpt73go/M+0wtbnnynFeGPF50vQ9rO4urd4bzqT0oyn/x9kBjwY1EEhEbDlmobUNRMNFLz9Hj37cUfax4Sh+vkoBCzRq3elSQWFFCO+8XNTEXk0vHqI2l0R2PSbhvKMfvBBUqkaSwyl4/loLJwbyqt6/uqlIew/lrTesvjlfOzC+8P4h+cqA9/jPtmT2n+MV4H2sixPSKtB+rGYGdAY1AEb4nyYUmPg6TkGSsJOBtCXrmUwY5gJuyhY6RmyKuMVuY0763wmtvZgrty0mMB1J6+P3l6DGbXyJ2nFxP4B046CYPufAto956pH54aRDx8cS7BrCX/+3yZiZ36BWDi3CB90JlVbw9BRsnQibrp7ICcD7pm9QK0CbyxQWiQw9y6Be8lXnlLhl/ogBjCYCV+iYS4RA05fN7E/BwOUwf0dQ3kyq39qEsFdJgRhcqXVnsHtM5mg30vF0q7Ho77fjbbI/8H9M/IzwJFWx4UUlPuR0h/xBmPKRJ2qtvJFbqCm7rnzOv6CwLw7u6GfW/k1NNYbaL4vhBWPhvH1Xw/jdxeEMK0q/9hmgGDwO/xuqjhYtTExdXDF97Mn5B5DE5+ZxYXvuS4I6ZQJ1wtxvFHnd1XFaHR00wzS9SOd3/kwpSEEK2nnJPWk9Y7lDdFNTV6/6/EnFxHhQ8QAgxhhTXSQXErTDPhQT13QvPidwVjwhDMNbj4meImvMRoT7FnZc/O4h1JitCysJqAmupVW0JnS0WEzzJNZdQRBZVSZAX25XjbP78uqS5E9unot6ZSe6ylVEil3Qqm0dOq9bUdIJ1eaA1l9aoPb5VE3QUwIIr5GEBNmk9BUl7HKMLUfDouY0OaY9Hsa+cDvmaZmmss33U8+DMTs5eYpWgB4FdBtX14GpI7syKqrrRGorXLF9XSsjKRfIiTcxSQovuO6IzddD6Ga3qmnBVeB/sCxtMHNxYQg4nNbb3svE5j4fF9V7joJbnGlufNcEgVAuhJsFqyCOqNJn+qzm0tbHkAki7IFakeAIZZ9FyG7O7I6ZUPLTAiFi/DPp6bg7ct1+Js5ZzBLxOFkV6jN8eFqbDxzL5bc04uv3ncJFWUGeQJp3JfsxNWSYEOsmcCupya0ZgIHYJnE57YMb3vNBKXWKChjI3uBknBCZCbhLFvVGU0hHxbOK4Klsz3a2u5o4bxRPKjOhMNoT2paOHvKJqKskzgKzkrKp49sR2LX+sCOudNYnKS5jIKiZAjRvmLMqRlBSbGdbEsIXIoVYWJFGlVFaQzFQigrNYkBEj8pfRYvVm5APkyu8hM1E5r42tPJ1/6Vt2P41rabTiDmfIN95Zq9327A1LvGlv0cDRe703hi9TXAE/x5DY7tNW5ktrYHdRCkfjS4r9ISi9hM4AUNw1ltZtUm1DNGcbFFfMa96U6MhiB1pJFJ/NHaT58cdlSFzgFJjzvE95vfGMR4o5X6tG2v7UVJrxOlYJiIGPaJtSw7cHMIuNHvLxevmjh1LqVKF3E4aa9eZogmMCPkESZuc7k75bzXcHEvKgIMcSaCiBpE/NHav3w8RFupwklHuEbQTkXQdXskhn0dCYwXLtL3/uhdysUr1WVaW2vuzpieQzT6xuSIVmxbMjspvjc7Z1NeaqgOkrT5k0pbTBq28zJFYQ8D7F75GbfhZcjvsCtaVhrCb/W9gkLgJWo+4o/Wvmp6GVy6+11KvRrWf7dXqY3bBfexvOWGuueATRtvNZrUDFGRSITr9IYMB2O93o5GaP+256VlWQOkyN283ptCVSXtEZdZlB6umoqNb0fV/oDGPy2difJBazcsNky2YjCNhvowrQ6BIaMaz878GIWCdTy7qkFJuELamzTn87+46iRytAoQvpMjQs5vDIlXvlZP9iCMWwEb+y//Y6/siCZFwLkiexVYgV26yJjV9cPJUcOaiGAV5FsFvPEuSrOj1jAt54qKEEm5QLp+DmKPrcfBCcvw36clPrjolhMz/kg94zY8m4oKQxGfwSpoSX9hq4DBUlwo8YPaGzTn6hkV/kgW7j37+VKmBREOv7+hR6mQseL9oyNYRu92RBPK39KpB+m4Qa4Kov+3MfH5zrsnzKvgLDypid7t6xE7tN03EDOFmTMw6QkMl04EGRHsOfARtrz6A1+7P/2DZ/D55kUqE1k6fBU1V/epVSXjlv7nVbB6xl51vRPgVXDhl90wkzpkzzg5Iv0nGr64uALrlldh2iirgaV+665BbH2LDbl7CiIYSvrPmcWhxVkMsGfhc0ljB7ejd8d6RXC2CXz1Hkm5cOIIus8ew9Bw3I4yXVRVVqqIo+6eWZj1wK869cyEkdP7kKDrmzfmYduE/C7peKL/3BBuHB9w4gAb3vBApxOdnP1j95fIRQtKxPyZxaguh2rC0TMT/v2jcTLeI94TENAqx3vEUfWo9ZBhrOj68dRtevAsblFDPrOi9ivN4QHVwijNLaV917pw4tB7iMf8rlxpeSV+5ZEnUdswKee7fEzlOx9VYvvHo8T044jrx/vRFx2y9qjc7K0vV09fLC0CSmQfUXfgDYQ9u15SCH+44R5XlGi9snO675yoyNHzuxjDThkTP5MBlTX1CBcVts23eldhmy3jhcv7exDvtdxOLbkW9AlnJ0wLUCnek9LSlnT3eGOOtvSfPHxl54yHMqaS93AuM6EJdwB9cUSeft2shfpLlE8fZsKMnP6fy7RpKvRuoC267uFcr+rQGzBe2GLuBLlutKvfsy5WUxEpRfoL0Z0zs+KtwHQ0e0VUmFtb8OljS12ZWLz3udBDtFY/9fF4jH2rixd3/2fjQxDmC4A3X595isHNnsE5xKv1u5S+WELdet+z+jSEuaVr5/TFQcRn5N0PICawUV4J648pxhs8oXX2GAp7/rxoLdnylfzHFBh/0HjmOh5DV1zdOXMt6X7r+7wuqvSnj634zQngpOW2qsyozu/LrHaUziQXcN0VGiPfpAQKgH1yroXKn2B8wJLeYscfWXjsRdkYMpItJB/jMh5Lfbgk3BJZGTzepKVnG4mmGyg1sUK19xxVtKNW4VcvfrWUqaIMIbeUGUZLLqn3zQ1jgIcRTyHHXnIe6GCvNRfhM+EyIkTjqbHHNJ4wifCl4dZchM8EMyKdxgZaFc1Ez0b4AgVtI6zUjtc7Us8M9BMbtpQbRmshhNcYEwO8sA90cWFD1mgX75+pcuFM626+3vafqb6YbCaF2Qw2nEI02sLgGY/sFmQ7xaC7hSna93zl9v5MteHpk80U9z9FdqKJyNtIdG8kdtRa+wqil3R3vwlB34WINFOHe3bNjuAW8P/4M203oLS1YgAAAABJRU5ErkJggg==",VS="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGAAAAAoCAYAAAABk/85AAAACXBIWXMAABYlAAAWJQFJUiTwAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAA0WSURBVHgB1ZsNcFTVFYDPe7thd7NZsonIT6CwQWvAnwTaRNuxQoJ2SqpViW3RiiMgVq2dgcy0dnRqkwz9Ga0dNjOt2BYVi2hpVaSFBmyRRWBajUoIWIlYWERAhWE3xoT87O7rOfftDW/fu+9vEzrTb+bN7rvvvnd2z7n3nHN/ngR5kvh7US2AMkvKKHMBpFkgQRgUPAgJkvg9jtfjkj+yTy6cGgvVbI3BCFAUpRY/ZuExN/sZzh5EEo949tiHR0ySpBiMhG+ivAzQ/5qL/8UoT8rKU1CeDDF4IT95kpvKiY3hsFw0uFxRpBXDynZO3Ddlaaz/g3UtJfXJuJMbUOkkYzkeKwDcy8MjhkcLGiPu6I6bUZ48AnkSyiuAFvijQ3ng0ABM8YVDTYr6w0aEHJgG8piStcGrdpsqJqv4JhgFeVnWgpUhVMWPnjwJ5Tk0hK0Bul8JLFdAbs6jxdsR945vaCmavW6tthCVTy2wGWD05YFqhLU5pbegPOX8yYOXdPJ0WBqge1twlTJ6rVCIJ1AWDc051EjfUfmrwIG8gVQG9hw6DfHTvew8Mi4INeWlEPJ7wQFRNAKTBw3O5I2QKBqh0eyi0ADkcqTg0EZsGbXwP8AfaezwXbKSAmmtVT1SfOexbtj/YZJ910LKr5g4Fg1RAnac+RQ6LljKEoVaq3qzIviDLgeoiqjfw0G1PH4KozDafuc7GGQOAHTEwRoJOiANdfCylDReEpDcFtwLaqbhCsmLiVAq6fY2KPryP8ETusKyTtfJHmiPJ6Cnf4idH/l3J+zZvJF9r7luPlR84Sr2nQxRHSmFGZNCps+a/QNU2hFzWYvrAO7Eo/YycET8E/Q1f8JAs8OiEgXoF6U6Y7GOfN2O7J8GwZo2SJ15Dc6+c6/j+/wVj4Bv2v2m108kz0L7kQT7ZOeHD0H79q34+X5OvXGTJsP8O5ZBqKSUnZMhbpo92eCWGp9Cn7BFLIsUvmoJtrxyyAsyxJJfY694x7SKwR3lGCDxSnCxpMDT4BKufDkwlZ0PHn/WkRHGlC2CwOVPCK/19KdQ8Weg66Me9TxxBt7c3gYH33rD8pkVX7wSaq6tHzZExcTQcHygFkoKErH8BtTOEhgVmrE3tGwwvdyIRojyk2EDJNr8EUn2UCeKgAv0yufYGcHsPr2fH+g/C517YrB/90723SnV6JYqr64Fnz/AzicXj4Plvy9mrVRP07dRaQthVLEwQhIHeOU8Hnh46UN3+igjqAUXmCmRPXhsJV6fCqlTm4X3+mc8At7Sa3LKyM9v6TwJx870QTqjQNdbr8OWp5+AY+8dhHQqBW4gF/V+59vgCwTQPU2Bx/9WBAeO+gz1zofyCRY/JDVQ6/BjuR/ebdkGkO0B2dZ/BFxgpXwtop5A94bm5P6yTXtP2Pr5fPGPmwntvl8ayiPjMZivhvNK3U9MYkIGSqgXsAglezxNigKOMVO+kurGTKg4p2zM5EXsU2sE38UP5tShlk/KZ35+28twcN8+GE3eT39NWL6jBRxBKSdlTZR+EpEL1UDN01Irnv6+mnUle3UXZJboNDMDKC7yfTPlZ85+AL1v1oO35BpDYNUbwVsyJ+f6p9nUsuvt102VPzYUhBu/fh1UXFIOkydNgOMnP4aHV0Zh0cKbWJmW9Rv+AgffOzx83uurNDyPUk3qAVaQ0lo3q1mTQYHZZ5ALs3oOXVuBAb7ZGA/YiN+baGOzmhFwgJ3yM2ePwiAehJkRBk+ut3VbemZ8fjo8+fgvIBQ61+Ta1+xnhrhv2Xdyyjdt+YeqfB+WDfSi8q+AQY9RQ6Q4KyhY1zWBMGhzKKsi90I9ycoIy68XGiBMM64ydoVacEim/yikMc/PKdMonzN4Av3+AWMGlE7sZj3ELdFHf5yj5BMnP4HVa56De5fdllNOrF7zPGQq5kC6uoGdkwH0kPuwUhi1djvlc7ihkn3mdchVCQd1ON0tYxSuAhf0oRsZwsDK7hcon6M3An2nMk+oEtxALbxsUq62Hl65Cm66/jp2aCGjnPgsA5maBshUzgelbCacLZhueKbdCJfSRyfK51Dd1r9a16EpDQPo+mXMgyJWNzK3U93GPjlkhP7//NygfHI7voseGj7nRuDKV5/n3P1wF6OFXEzXocOGct4r0qh8JXQhK0vPuwcGC43D2rk2BlgbA9ewOGHRC2guyYAEVV4r/6/1+fTZ217P3BAxgAbQQsqnkS2HX+eKH35m4TRwCvl9LaqSn4fbMfDqe8Wj0d+h3y9k7odDhhj0jKWunkO40Fwm+XRRwLWD7nnmVXXiTkRC/Myw12yeXx9wRUbg6JXvz/YCvZEKsI4+TTVD5HpWr1nPBi6iXvHqzn+pv/PEu5BB18PJDBnnG638vxvXo2eF60kcCMumlyTn5QrGAidlTtc/zVzPpi3bDb2ip6dXDbzl1TgDdyHIu9fB/xPe7AK6oReQbycfz/w/tn6rgNufbenc/2t9vhYqoykIu15gpmQKuvpe8eyGTWrgvXYRZHpOg3fTT8Hz5ouYBd3CrssFiqEXWLkYu7GBFU0LzQM8nynVkSQXRJNCQjfEjRC47Ak2iNIqnxQ5GH982B1xI5ChtMovyLqmoWyZMpS0NIDY9TwndD3DgReDLQu8eKQr68HTuZXFAirzCAywL24+5cwXXvKJAzTgMosvMVGhBHF0QVIHWMCNYMh2pt6vxghNdkRG0Cu/EOvSwQ2R7tlvKqts4gShkqmVU84vDLyoZG3gzVD+PyYInld/y879xWmDHKsVLFI+KdItNCq2Cu47DwgKM3BUxnXYneACbcDlgVlrBA5XPocbIXVml+mzH1i2wFC29HsPwry5XzLk/Dzwput1y62YCaWwR0gYjIsP74LABcZZVIsFEwaNXN24IqprN7IWysSlShkU6x6QUx9dh34eR2QEvfKHy0u/gn66U/jsmkiJYfWKDaxwzueBFd/NKecxgf2mfVsNz6IBmIJBuS/2Bwj4PzNcp4m1mKhFZqFeYDe9wKE6dnXJ/wsNIENMLqn/LMYCsQNotlN1R7kZjtYIZsqnGNCHwTmV2MWeoyUUKIDq8tKcMu7fRTGBBV40DJPd9RpLPfWk6u4BamJFRzawQKznmRhYQgrd+1jWrwtmPamMgi7VsTMUrRcLiNNuuux6QFGzJCtN4BDaXMWzIy1kGNFEG1c+h7Ilv2bELOIudD1khLaNT+aUU9n8BUtzyijYpr71M3UCTvs70TgUCz6asRJO9cw2yNj7K5MRqg42HR0/N0bgcztOpqPpnvL7BBdo89aL0hJ1HOD3RsEF5wKzsSfo0SufGDz6G7CC/Hv72/vhhyvuNlxjgVeH1HMKU8+XDOUsE0J3VCW3gQhaoHcCVzgFWjpuvtKZ8gmzNWi2cw7ICyEldcmkokit4AIzI2gRKZ8gFzRgYgQ+3UBBl4KvFu2IV4+MqafeFY31pKHu9ruh4Y6FMK+q23AP+eVG96NXx5DrMQm+a/m2xXMjYZ+32Wks4FgZwUz5HJqm0McCgvz9oltvNKSj2sBrhkypJ64B+CQFrirug9smJWFmqQf/moz+WhG22uhmyx0MeUPKbxY/N85bPzG8KP/IM/39P7ptzIAkw3xwASmRFt4Lxn8DpAJ1gGWnfEZmAAcFA+Ad91XDpcrLZxjm+fe89wns7zoCp08eN32kNNgHM6d/Dm6sCMK0wBB4JXVbyvVVZXDR+AD4CwC2CXI+aqUUDIVTxnlgoXyiEf58biu7YXomsbUoKklsg6wreGBOJ16zV74Gu41ZBG1PeWqXumeA1o13vLAejusW7CdPvxiqr62HMvwkysIBtk2RPrWQy4mKN2o4SimtsN2YpUArbJRyNr2Jtya+EtyRz75QMoJorsgOMpx+i4oe2qBFO+T41sSut96A9u1qcL36hgYov1Rd+aKxxLyZ4w2K12K6UyGLk7VeLTSuaN1iuzWxA7Oe2cZiAYkd4bA0NLQj+2bIeWfMhAWxQNU6mo+yldf5YRI6j306bAgO+fnKzxXDFVPC7LsVp7ohNv4u9kaPpTyaL6LshxZwaJqBG4SnpTSnxAZ1NiNrti80DQscb87l5OuO3CD5p7QWz+1i3RKnRSgdtpXHty3y7enk52kgZ6f4LK2SlHUDC1CeBOf1/4ncjhbbKfpEW3CxpL49EoFRRCooSRZMvLWl8NLHcsYgaITFAKMvD9T3yOgFjdwxT8P5lafdByrC2StKbf4IyJ5mrHwnjBDawg5yUWsm+XFzyYKkMO1FI0RAfUtmxPKy0BinGZUvTrNvRnkSUBo+OvKo1dNbNy9Ltmm900UqhsYQ9KZixM29UkE4mRnoboV+b9RM8Xo0hnAtD9QWSIqPmipezzlD5C8vA1Eniue4MoAWtqFLhlp0T1Vo7Qhb3M99TTUp+yZ0pPs/3um94JqOUXpNlQ7aRhPJHtrXVOmgLJ+m1ztG6TXVWtq5wGQpAnmU2SgoT8bPPF9T/S+t/b7McgGVIAAAAABJRU5ErkJggg==",wm=({isOpen:e,isLoading:t=!1,onClose:n,accountChains:r,defaultChainId:o,defaultSymbol:s,defaultAccountType:i,balances:c,wagmiHooks:a,onDeposit:l,onCopy:u,onChainChange:f,onTokenChange:p})=>{const{t:d}=Pt(),h=v.useMemo(()=>r.map(K=>({...K,key:wi(K.key)})),[r]),m=v.useMemo(()=>wi(i),[i]),x=v.useMemo(()=>{var ee;if(!h||h.length===0)return m;const K=h.find(ie=>ie.key===m);return(K==null?void 0:K.key)||((ee=h[0])==null?void 0:ee.key)||m},[h,m]),[P,E]=v.useState(x),T=v.useCallback(K=>{var ee;return((ee=h.find(ie=>ie.key===K))==null?void 0:ee.chains)||[]},[h]),N=T(x),M=()=>{var le;if(!N||N.length===0)return{chainId:o||1,token:""};const K=o||((le=N[0])==null?void 0:le.chainId),ee=N.find(re=>re.chainId===K)||N[0],ie=(ee==null?void 0:ee.tokenList)||[],Y=(s||"").toUpperCase();if(Y&&ie.length>0){const re=ie.find(pe=>(pe.token||pe.symbol||"").toUpperCase()===Y);if(re)return{chainId:ee.chainId,token:re.token||re.symbol||""}}if(Y)for(const re of N){const ve=((re==null?void 0:re.tokenList)||[]).find(Qe=>(Qe.token||Qe.symbol||"").toUpperCase()===Y);if(ve)return{chainId:re.chainId,token:ve.token||ve.symbol||""}}const ne=ie.length>0?ee:N.find(re=>(re.tokenList||[]).length>0)||ee,Q=((ne==null?void 0:ne.tokenList)||[])[0];return{chainId:(ne==null?void 0:ne.chainId)||ee.chainId||1,token:(Q==null?void 0:Q.token)||(Q==null?void 0:Q.symbol)||""}},[{chainId:F,token:L}]=v.useState(()=>M()),[b,g]=v.useState(F),w=v.useMemo(()=>h.find(K=>K.key===P)||h[0],[h,P]),O=v.useMemo(()=>(w==null?void 0:w.chains)||[],[w]),C=v.useMemo(()=>{var ne,Q;if(!w||!vm(w.account)||!(P===st.SPOT||P===st.PERPETUALV2))return!1;const ie=!!((ne=w.walletOptions)!=null&&ne.evm),Y=!!((Q=w.walletOptions)!=null&&Q.mpc);return ie&&Y},[w,P]),I=v.useCallback(()=>{var K,ee;return(K=w==null?void 0:w.walletOptions)!=null&&K.evm?"evm":(ee=w==null?void 0:w.walletOptions)!=null&&ee.mpc||w!=null&&w.account&&vi(w.account)?"mpc":"evm"},[w]),[k,y]=v.useState(()=>C?null:I());v.useEffect(()=>{y(C?null:I())},[P,C,I]);const A=v.useMemo(()=>{if(!w)return;if(!C)return w.account;if(!k)return;const K=w.walletOptions;return k==="mpc"?(K==null?void 0:K.mpc)||w.account:(K==null?void 0:K.evm)||w.account},[w,k,C]),D=v.useMemo(()=>A&&vi(A)?ln:Ms,[A]),S=O.find(K=>K.chainId===b)||O[0],[B,j]=v.useState(L),_=v.useCallback(K=>{g(K),f==null||f(K)},[f]),W=v.useCallback(K=>{j(K),p==null||p(K)},[p]),q=v.useMemo(()=>{const K=(B||"").toLowerCase();if(!K)return"0";const ee=(c==null?void 0:c[P])||(P===st.PERPETUAL?c==null?void 0:c.perp:void 0),ie=ee==null?void 0:ee[K];return typeof ie=="string"&&ie.length>0?ie:"0"},[c,P,B]),[Z,H]=v.useState(!1),U=K=>{K.target===K.currentTarget?H(!0):H(!1)},J=K=>{Z&&K.target===K.currentTarget&&n(),H(!1)};return e?Ue.createPortal($.jsx("div",{className:"fixed top-0 left-0 right-0 bottom-0 w-screen h-screen",style:{zIndex:98},children:$.jsx("div",{className:"fixed top-0 left-0 right-0 bottom-0 z-[99] flex items-center justify-center",style:{background:"rgba(0, 0, 0, 0.6)",backdropFilter:"blur(10px)",WebkitBackdropFilter:"blur(10px)"},onMouseDown:U,onMouseUp:J,"aria-hidden":"true",children:$.jsxs("div",{className:"relative w-[420px] max-h-[85vh] bg-fill-page-secondary overflow-auto rounded-lg p-6 shadow-xl border-[2px] border-solid border-line-divider-secondary",onClick:K=>{K.stopPropagation()},children:[$.jsxs("div",{className:"flex items-center justify-between mb-4",children:[$.jsx("h2",{className:"text-lg font-semibold text-white",children:d("deposit.title")}),$.jsx("button",{className:"text-gray-400 hover:text-gray-200 transition-colors",onClick:n,"aria-label":"Close",children:$.jsx(h0,{className:"h-4 w-4"})})]}),$.jsx(Nh,{selectedAccount:P,options:h.map(K=>({value:K.key,label:K.key===st.SPOT?d("account.spot"):K.key===st.PERPETUAL?d("account.perpetual-v1"):K.key===st.PERPETUALV2?d("account.perpetual-v2"):K.key})),onAccountChange:K=>{var ve,Qe;const ee=K||P;E(ee);const ie=T(ee);if(!ie||ie.length===0)return;const Y=ie.find(we=>we.chainId===b),ne=Y?Y.chainId:ie[0].chainId;g(ne),f==null||f(ne);const Q=ie.find(we=>we.chainId===ne),le=(Q==null?void 0:Q.tokenList)||[],pe=le.some(we=>(we.symbol||we.token)===B)?B:((ve=le[0])==null?void 0:ve.symbol)||((Qe=le[0])==null?void 0:Qe.token)||"";pe&&(j(pe),p==null||p(pe))},className:"w-full"}),$.jsx(Ah,{currentActiveChain:S,chainList:O,onChainChange:_,curSelectToken:B,onTokenChange:W,walletType:D,accountType:P}),C&&!k&&$.jsxs("div",{className:"mb-4",children:[$.jsx("div",{className:"h-[1px] w-full bg-[#404040] my-4"}),$.jsx("button",{type:"button",onClick:()=>y("evm"),className:"w-full text-left rounded-lg px-3 py-[10px] bg-[#303030]",children:$.jsxs("div",{className:"flex flex-col gap-2",children:[$.jsxs("div",{className:"flex items-center justify-between gap-3",children:[$.jsx("div",{className:"text-text-primary font-edgex-harmony text-[14px] font-medium leading-[18px]",children:d("deposit.connectedWalletTitle")}),$.jsx("div",{className:"flex items-center gap-1 shrink-0",children:$.jsx("img",{src:WS,className:"w-12 h-5"})})]}),$.jsx("div",{className:"text-text-secondary font-edgex-harmony text-[12px] font-normal leading-[18px]",children:d("deposit.connectedWalletDesc")})]})}),$.jsxs("div",{className:"flex items-center my-2",children:[$.jsx("div",{className:"flex-1 border-t border-dashed border-[#242424]"}),$.jsx("span",{className:"mx-4 text-xs text-text-tertiary",children:d("deposit.or")}),$.jsx("div",{className:"flex-1 border-t border-dashed border-[#242424]"})]}),$.jsx("button",{type:"button",onClick:()=>y("mpc"),className:"w-full text-left rounded-lg px-3 py-[10px] bg-[#303030]",children:$.jsxs("div",{className:"flex flex-col gap-2",children:[$.jsxs("div",{className:"flex items-center justify-between gap-3",children:[$.jsx("div",{className:"text-text-primary font-edgex-harmony text-[14px] font-medium leading-[18px]",children:d("deposit.externalWalletTitle")}),$.jsx("div",{className:"flex items-center gap-1 shrink-0",children:$.jsx("img",{src:VS,className:"w-12 h-5"})})]}),$.jsx("div",{className:"text-text-secondary font-edgex-harmony text-[12px] font-normal leading-[18px]",children:d("deposit.externalWalletDesc")})]})})]}),(!C||k)&&$.jsxs($.Fragment,{children:[A&&vi(A)&&$.jsx(IS,{address:A.smartWalletAddress,currentActiveChain:S,selectedToken:B,accountType:P,accountId:A.accountId,accountKey:w==null?void 0:w.key,onDeposit:l,onCopy:u,onClose:n}),A&&vm(A)&&$.jsx(_S,{address:A.ethAddress,currentActiveChain:S,selectedToken:B,accountType:P,accountId:A.accountId,accountKey:w==null?void 0:w.key,platformBalance:q,isLoading:t,wagmiHooks:a,onChainChange:_,onDeposit:l,onClose:n})]})]})})}),document.body):null},HS=({withdrawAmount:e,curSelectToken:t,tokenInfo:n,currentActiveChain:r,platformBalance:o="0",fee:s="0.00",walletType:i="evm",receiverAddress:c="",accountType:a="perpetual",onWithdrawAmountChange:l,onReceiverAddressChange:u,onAmountChanged:f,showPoolBalanceInsufficientTip:p=!1})=>{const{t:d}=Pt(),h=v.useMemo(()=>{if(a==="spot"||!bn(r==null?void 0:r.chainId)){const F=new De(e||"0").minus(s||"0");if(F.isNegative()||F.isZero())return"0";const L=Math.min(F.decimalPlaces()??0,18);return F.decimalPlaces(L,De.ROUND_DOWN).toString()}return e||"0"},[e,s,r==null?void 0:r.chainId,a]),m=v.useMemo(()=>o||"0",[o]),x=v.useMemo(()=>{const F=(n==null?void 0:n.feeRate)||(n==null?void 0:n.withdrawFeeRate)||(r==null?void 0:r.feeRate)||0;try{return new De(F||0).times(100).toString()}catch{return"0"}},[n==null?void 0:n.feeRate,n==null?void 0:n.withdrawFeeRate,r==null?void 0:r.feeRate]),P=v.useMemo(()=>x==="0",[x]),E=v.useMemo(()=>{const F=(t||"").toUpperCase();return F==="USDT"||F==="USDC"},[t]),T=F=>{const L=F.target.value,g=gi(L,m||"0");if(g.isValid)l(g.formattedValue),g.errorType;else return g.errorType==="exceed_balance",void 0;f==null||f(g.formattedValue)},N=()=>{const F=m||"0",b=gi(F,F).formattedValue;l(b),f==null||f(b)},M=()=>{const F=parseFloat(o||"0"),L=parseFloat(e||"0");if(L>0){const b=F-L,g=Lt(Math.max(0,b).toString());return $.jsxs("span",{className:"flex items-center gap-1",children:[Lt(o||"0"),$.jsx("span",{className:"text-sm font-edgex-harmony text-functional-green-1 leading-[18px] font-medium",children:"→"}),g," ",t]})}return`${Lt(o||"0")} ${t}`};return $.jsxs($.Fragment,{children:[$.jsxs("div",{className:"bg-fill-input-primary rounded-lg px-3 py-3 my-4",children:[$.jsxs("div",{className:"flex justify-between items-center h-[18px] mb-3",children:[$.jsx("input",{type:"text",placeholder:d("deposit.amount"),value:e,onChange:T,className:"flex-1 bg-transparent text-text-primary text-sm font-medium placeholder-text-tertiary placeholder:font-normal focus:outline-none border-none p-0 h-full"}),$.jsx("button",{onClick:N,className:"text-theme-normal text-xs font-medium cursor-pointer hover:opacity-80 transition-opacity h-full flex items-center",children:d("deposit.max")})]}),$.jsx("div",{className:"h-[1px] bg-line-divider-secondary mb-2"}),$.jsxs("div",{className:"flex justify-between items-center",children:[$.jsx(nr,{content:d("withdraw.availableDesc"),children:$.jsx("span",{className:"text-text-tertiary text-xs leading-[14px] border-b border-dashed border-line-divider-primary",children:d("deposit.available")})}),$.jsx("span",{className:"text-text-primary text-xs leading-[14px]",children:M()})]})]}),i==="mpc"&&(a==="spot"||!bn(r==null?void 0:r.chainId))?$.jsx("div",{className:"bg-fill-input-primary rounded-lg my-4 h-9 flex items-center px-3",children:$.jsx("input",{type:"text",placeholder:d("withdraw.receiverAddress"),value:c,onChange:F=>u==null?void 0:u(F.target.value),className:"flex-1 bg-transparent text-text-primary text-sm font-medium placeholder-text-tertiary placeholder:font-normal focus:outline-none border-none p-0 h-full"})}):null,$.jsx("div",{className:"bg-fill-page-secondary rounded-lg mb-4",children:bn(r==null?void 0:r.chainId)?$.jsxs($.Fragment,{children:[$.jsx("p",{className:"text-text-tertiary text-xs leading-[18px]",children:d("withdraw.noticeDesc")}),$.jsx("a",{className:"block text-xs leading-[18px] mt-1 text-theme-normal",href:"https://edgex-1.gitbook.io/edgeX-documentation/getting-started/deposits-and-withdrawals/withdrawals",rel:"noreferrer",target:"_blank",children:d("withdraw.commonWithdraw")})]}):$.jsx("p",{className:"text-text-tertiary text-xs leading-[18px]",children:d("withdraw.crossChainTips")})}),p&&$.jsxs("div",{className:"flex mb-4",children:[$.jsx("div",{className:"w-5",children:$.jsx("img",{src:Zo,className:"w-4 h-4",alt:"Warning"})}),$.jsx("div",{className:"flex-1 text-xs text-functional-orange-1",children:d("withdraw.poolBalanceInsufficientTip")})]}),$.jsxs("div",{className:"py-4 border-t border-line-divider-secondary border-dashed",children:[$.jsxs("div",{className:"flex items-center justify-between h-[18px] leading-[18px]",children:[$.jsx(nr,{content:$.jsxs("div",{children:[$.jsx("div",{children:d("withdraw.speedNote")}),$.jsxs("div",{className:"flex gap-1 items-center mt-1",children:[$.jsx(Go,{selectedLevel:Bt.FAST,maxLevel:3}),$.jsx("span",{children:d("withdraw.speedNoteSpeed1")})]}),$.jsxs("div",{className:"flex gap-1 items-center mt-1",children:[$.jsx(Go,{selectedLevel:Bt.Medium,maxLevel:3}),$.jsx("span",{children:d("withdraw.speedNoteSpeed2")})]}),$.jsxs("div",{className:"flex gap-1 items-center mt-1",children:[$.jsx(Go,{selectedLevel:Bt.SLOW,maxLevel:3}),$.jsx("span",{children:d("withdraw.speedNoteSpeed3")})]})]}),children:$.jsx("span",{className:"text-text-tertiary text-sm leading-4 border-b border-dashed border-line-divider-primary",children:d("withdraw.speed")})}),$.jsx("div",{className:"flex items-center",children:$.jsx(Go,{selectedLevel:bn(r==null?void 0:r.chainId)?Bt.SLOW:Bt.FAST,maxLevel:3})})]}),(a==="spot"||!bn(r==null?void 0:r.chainId))&&$.jsxs("div",{className:"flex items-center justify-between mt-2 h-[18px]",children:[P||!E?$.jsx("span",{className:"text-text-tertiary text-sm leading-4",children:P?d("withdraw.fee"):`${d("withdraw.fee")}/${d("withdraw.feeRate")}`}):$.jsx(nr,{className:"w-[320px] font-normal flex items-center justify-center",content:$.jsx("span",{className:"flex items-center justify-center text-center",children:d("withdraw.feeCalculationTip")}),children:$.jsx("span",{className:"text-text-tertiary text-sm leading-4 border-b border-dashed border-line-divider-primary",children:`${d("withdraw.fee")}/${d("withdraw.feeRate")}`})}),$.jsxs("span",{className:"text-text-primary text-sm leading-4 font-medium",children:[s," ",t,!P&&` / ${x}%`]})]}),$.jsxs("div",{className:"flex items-center justify-between mt-2 h-[18px]",children:[$.jsx("span",{className:"text-text-tertiary text-sm leading-4",children:d(bn(r==null?void 0:r.chainId)?"withdraw.withdrawlAmount":"withdraw.amountToReceive")}),$.jsxs("span",{className:"text-text-primary text-sm leading-4 font-medium",children:[Lt(h)," ",t]})]})]})]})};let Je=null;const Cl={accountChains:[],defaultAccountType:""},xm=v.forwardRef((e,t)=>{const[n,r]=v.useState(!1),[o,s]=v.useState(!1),[i,c]=v.useState(Cl),a=v.useCallback(h=>{c(h||Cl),r(!0)},[]),l=v.useCallback(h=>{c(m=>({...m,...h}))},[]),u=v.useCallback(()=>{r(!1),s(!1),i.onClose&&i.onClose()},[i.onClose]),f=v.useCallback(h=>{s(h)},[]),p=v.useCallback(()=>n,[n]),d=v.useCallback(()=>o,[o]);return v.useImperativeHandle(t,()=>({openWithdraw:a,closeWithdraw:u,updateWithdrawOptions:l,setWithdrawLoading:f,isOpen:p,isLoading:d}),[a,u,l,f,p,d]),v.useEffect(()=>(Je={openWithdraw:a,closeWithdraw:u,updateWithdrawOptions:l,setWithdrawLoading:f,isOpen:p,isLoading:d},()=>{Je=null}),[a,u,l,f,p,d]),n?$.jsx(Am,{isOpen:n,isLoading:o,onClose:u,config:i.config||{symbol:"USDT"},accountChains:i.accountChains,balances:i.balances,defaultChainId:i.defaultChainId,defaultSymbol:i.defaultSymbol,defaultAmount:i.defaultAmount,defaultAccountType:i.defaultAccountType,currentEquity:i.currentEquity??5e3,platformBalance:i.platformBalance||"0",fee:i.fee,wagmiHooks:i.wagmiHooks,onWithdraw:i.onWithdraw,onAccountChange:i.onAccountChange,onChainChange:i.onChainChange,onTokenChange:i.onTokenChange,onAmountChanged:i.onAmountChanged}):null});xm.displayName="WithdrawManager";const Em=e=>{if(!Je){console.error("WithdrawManager not initialized. Make sure to render <WithdrawManager /> in your app.");return}Je.openWithdraw(e||Cl)},Sm=()=>{if(!Je){console.error("WithdrawManager not initialized. Make sure to render <WithdrawManager /> in your app.");return}Je.closeWithdraw()},Pm=e=>{if(!Je){console.error("WithdrawManager not initialized. Make sure to render <WithdrawManager /> in your app.");return}Je.updateWithdrawOptions(e)},xi=e=>{if(!Je){console.error("WithdrawManager not initialized. Make sure to render <WithdrawManager /> in your app.");return}Je.setWithdrawLoading(e)},GS=()=>Je?Je.isOpen():!1,Tm=()=>Je?Je.isLoading():!1,qS=()=>({openWithdraw:Em,closeWithdraw:Sm,updateWithdrawOptions:Pm,setWithdrawLoading:xi,isOpen:GS,isLoading:Tm}),KS=({accountChains:e,defaultChainId:t,defaultSymbol:n,defaultAmount:r="",defaultAccountType:o,currentEquity:s,platformBalance:i="0",balances:c,fee:a="0.00",isLoading:l=!1,onWithdraw:u,onClose:f,onChainChange:p,onTokenChange:d,onAmountChanged:h,onAccountChange:m})=>{var ie;const{t:x}=Pt(),P=v.useMemo(()=>e.map(Y=>({...Y,key:wi(Y.key)})),[e]),E=v.useMemo(()=>wi(o),[o]),T=v.useMemo(()=>{var ne;if(!P||P.length===0)return E;const Y=P.find(Q=>Q.key===E);return(Y==null?void 0:Y.key)||((ne=P[0])==null?void 0:ne.key)||E},[P,E]),[N,M]=v.useState(T),F=v.useCallback(Y=>{var ne;return((ne=P.find(Q=>Q.key===Y))==null?void 0:ne.chains)||[]},[P]),L=v.useMemo(()=>P.find(Y=>Y.key===N)||P[0],[P,N]),b=v.useMemo(()=>(L==null?void 0:L.chains)||[],[L]),g=v.useMemo(()=>L&&vi(L.account)?"mpc":"evm",[L]),w=g==="mpc"?ln:Ms,O=v.useMemo(()=>{if(!b||b.length===0)return{chainId:1,tokenSymbol:""};const Y=pe=>{const ve=pe||[];if(!ve.length)return"";const we="USDC".toUpperCase(),rr=ve.find(ct=>(ct.token||ct.symbol||"").toUpperCase()===we)||ve[0];return rr.token||rr.symbol||""};if(n){const pe=n==null?void 0:n.toUpperCase();for(const ve of b){const Qe=ve.tokenList||[];let we;if(pe&&(we=Qe.find(Zt=>(Zt.token||Zt.symbol||"").toUpperCase()===pe)),we){const Zt=we.token||we.symbol||n||"";return{chainId:ve.chainId,tokenSymbol:Zt}}}}if(t){const pe=b.find(we=>we.chainId===t)||b[0],ve=pe.tokenList||[],Qe=Y(ve);return{chainId:pe.chainId,tokenSymbol:Qe}}const ne="USDC",Q=pe=>Array.isArray(pe.tokenList)&&pe.tokenList.some(ve=>(ve.token||ve.symbol||"").toUpperCase()===ne),le=b.find(Q)||b[0];if(!le)return{chainId:1,tokenSymbol:""};const re=Y(le.tokenList);return{chainId:le.chainId,tokenSymbol:re}},[b,t,n]),[C,I]=v.useState(()=>O.chainId),[k,y]=v.useState(()=>O.tokenSymbol),[A,D]=v.useState(r),[S,B]=v.useState(""),j=v.useCallback(Y=>{I(Y),p==null||p(Y)},[p]),_=v.useCallback(Y=>{y(Y),d==null||d(Y)},[d]),W=v.useRef(!0),q=v.useRef(k),Z=v.useRef(C);v.useEffect(()=>{if(W.current){W.current=!1,q.current=k,Z.current=C;return}(q.current!==k||Z.current!==C)&&(D(""),q.current=k,Z.current=C)},[k,C]);const H=b&&b.length>0?b.find(Y=>Y.chainId===C)||b[0]:null,U=(ie=H==null?void 0:H.tokenList)==null?void 0:ie.find(Y=>Y.token===k),J=v.useMemo(()=>{const Y=new De(A||"0"),ne=new De(a||"0"),Q=bn(C);return U!=null&&U.minWithdrawSize&&Y.lt(U.minWithdrawSize)?{text:x("withdraw.minWithdrawParsed",{amount:U.minWithdrawSize,token:U.symbol||U.token}),disabled:!0}:!A||Y.isZero()||!Q&&Y.isLessThan(ne)?{text:x("withdraw.confirmWithdraw"),disabled:!0}:g==="mpc"&&(!Q||N==="spot")&&!S.trim()?{text:x("withdraw.invalidReceiverAddress"),disabled:!0}:{text:x("withdraw.confirmWithdraw"),disabled:!1}},[x,C,A,g,S,a,N,U]),K=v.useMemo(()=>{const Y=(k||"").toLowerCase();if(!Y)return i||"0";const ne=(c==null?void 0:c[N])||(N===st.PERPETUAL?c==null?void 0:c.perp:void 0),Q=ne==null?void 0:ne[Y];return typeof Q=="string"&&Q.length>0?Q:i||"0"},[c,N,k,i]),ee=v.useCallback(async()=>{xi(!0);try{if(u){const ne={amount:new De(A||"0").toString(),chainId:C,tokenAddress:(U==null?void 0:U.tokenAddress)||"",coinId:(U==null?void 0:U.coinId)||"",tokenSymbol:k,accountType:N,selectedToken:U};g==="mpc"&&(!bn(C)||N==="spot")&&(ne.receiverAddress=S),u(ne)}}catch{xi(!1)}},[u,N,U,A,C,k,g,S]);return!b||b.length===0?$.jsx("div",{className:"text-center py-8",children:$.jsx("p",{className:"text-gray-400",children:"No chains available"})}):H?$.jsxs($.Fragment,{children:[$.jsx(Nh,{selectedAccount:N,options:P.map(Y=>({value:Y.key,label:Y.key===st.SPOT?x("account.spot"):Y.key===st.PERPETUAL?x("account.perpetual-v1"):Y.key===st.PERPETUALV2?x("account.perpetual-v2"):Y.key})),onAccountChange:Y=>{var Zt,rr;const ne=Y||N;M(ne),m==null||m(ne);const Q=F(ne);if(!Q||Q.length===0)return;const le=Q.find(ct=>ct.chainId===C),re=le?le.chainId:Q[0].chainId;I(re),p==null||p(re);const pe=Q.find(ct=>ct.chainId===re),ve=(pe==null?void 0:pe.tokenList)||[],we=ve.some(ct=>(ct.symbol||ct.token)===k)?k:((Zt=ve[0])==null?void 0:Zt.symbol)||((rr=ve[0])==null?void 0:rr.token)||"";we&&(y(we),d==null||d(we))},className:"w-full"}),$.jsx(Ah,{currentActiveChain:H,chainList:b,onChainChange:j,curSelectToken:k,onTokenChange:_,walletType:w,txType:"withdraw"}),$.jsx(HS,{withdrawAmount:A,curSelectToken:k,tokenInfo:U,curSelectTokenData:{balance:U==null?void 0:U.balance,allowance:U==null?void 0:U.allowance},currentActiveChain:H,currentEquity:s||0,decimals:(U==null?void 0:U.decimals)||6,platformBalance:K,fee:a,walletType:g,accountType:N,receiverAddress:S,onWithdrawAmountChange:D,onReceiverAddressChange:B,onAmountChanged:h}),$.jsxs("button",{className:`w-full h-[38px] text-sm rounded-xl font-medium transition-colors flex items-center justify-center gap-2 ${J.disabled||l?"bg-text-disabled text-text-secondary cursor-not-allowed":"bg-fill-btn-primary text-text-on-sec-btn"}`,onClick:ee,disabled:J.disabled||l,children:[l&&$.jsx(Yo,{size:"xs"}),J.text]})]}):$.jsx("div",{className:"text-center py-8",children:$.jsx("p",{className:"text-gray-400",children:"Loading..."})})},Am=({isOpen:e,isLoading:t=!1,defaultAccountType:n,onClose:r,config:o,accountChains:s,defaultChainId:i,defaultSymbol:c,defaultAmount:a="",currentEquity:l=5e3,platformBalance:u="0",balances:f,fee:p,wagmiHooks:d,onWithdraw:h,onChainChange:m,onTokenChange:x,onAmountChanged:P,onAccountChange:E})=>{const{t:T}=Pt(),[N,M]=v.useState(!1),F=b=>{b.target===b.currentTarget?M(!0):M(!1)},L=b=>{N&&b.target===b.currentTarget&&r(),M(!1)};return e?Ue.createPortal($.jsx("div",{className:"fixed top-0 left-0 right-0 bottom-0 w-screen h-screen",style:{zIndex:98},children:$.jsx("div",{className:"fixed top-0 left-0 right-0 bottom-0 z-[99] flex items-center justify-center",style:{background:"rgba(0, 0, 0, 0.6)",backdropFilter:"blur(10px)",WebkitBackdropFilter:"blur(10px)"},onMouseDown:F,onMouseUp:L,"aria-hidden":"true",children:$.jsxs("div",{className:"relative w-[420px] max-h-[85vh] bg-fill-page-secondary overflow-auto rounded-lg p-6 shadow-xl",onClick:b=>{b.stopPropagation()},children:[$.jsxs("div",{className:"flex items-center justify-between mb-4",children:[$.jsx("h2",{className:"text-lg font-semibold text-white",children:T("withdraw.withdraw")}),$.jsx("button",{className:"text-gray-400 hover:text-gray-200 transition-colors",onClick:r,"aria-label":"Close",children:$.jsx(h0,{className:"h-4 w-4"})})]}),$.jsx(KS,{accountChains:s,defaultChainId:i,defaultSymbol:c,defaultAmount:a,defaultAccountType:n,currentEquity:l,platformBalance:u,balances:f,fee:p,isLoading:t,wagmiHooks:d,onWithdraw:h,onClose:r,onChainChange:m,onTokenChange:x,onAmountChanged:P,onAccountChange:E})]})})}),document.body):null};ce.ChromeLoader=Yo,ce.ComponentProvider=tb,ce.DEFAULT_LOCALE=Jo,ce.Deposit=wm,ce.DepositManager=pm,ce.LOCALE_NAMES=Jm,ce.LoadingSpinner=Yo,ce.SUPPORTED_LOCALES=Si,ce.Tooltip=nr,ce.Withdraw=Am,ce.WithdrawManager=xm,ce.closeDeposit=mm,ce.closeWithdraw=Sm,ce.formatThousands=rb,ce.isDepositLoading=gm,ce.isWithdrawLoading=Tm,ce.openDeposit=hm,ce.openWithdraw=Em,ce.setDepositLoading=yi,ce.setWithdrawLoading=xi,ce.updateDepositOptions=bm,ce.updateWithdrawOptions=Pm,ce.useComponentConfig=zl,ce.useDeposit=w5,ce.useDepositManager=FS,ce.useTranslation=Pt,ce.useWithdraw=x5,ce.useWithdrawManager=qS,Object.defineProperty(ce,Symbol.toStringTag,{value:"Module"})});
|
|
177
187
|
//# sourceMappingURL=index.umd.js.map
|