@edgex-web/components 0.1.0-beta.34 → 0.1.0-beta.36

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.
Files changed (40) hide show
  1. package/dist/{ccip-CzJY05H7.mjs → ccip-oG01dD8F.mjs} +2 -2
  2. package/dist/{ccip-CzJY05H7.mjs.map → ccip-oG01dD8F.mjs.map} +1 -1
  3. package/dist/components/Deposit/src/evm/WalletView.d.ts.map +1 -1
  4. package/dist/components/Deposit/src/index.d.ts.map +1 -1
  5. package/dist/components/Deposit/src/selector/AssetTabs.d.ts +17 -0
  6. package/dist/components/Deposit/src/selector/AssetTabs.d.ts.map +1 -0
  7. package/dist/components/Deposit/src/selector/Chain.d.ts.map +1 -1
  8. package/dist/components/Deposit/src/selector/index.d.ts +1 -0
  9. package/dist/components/Deposit/src/selector/index.d.ts.map +1 -1
  10. package/dist/components/Tabs/index.d.ts +6 -0
  11. package/dist/components/Tabs/index.d.ts.map +1 -0
  12. package/dist/components/Tabs/src/Tab.d.ts +5 -0
  13. package/dist/components/Tabs/src/Tab.d.ts.map +1 -0
  14. package/dist/components/Tabs/src/Tabs.d.ts +5 -0
  15. package/dist/components/Tabs/src/Tabs.d.ts.map +1 -0
  16. package/dist/components/Tabs/src/TabsList.d.ts +5 -0
  17. package/dist/components/Tabs/src/TabsList.d.ts.map +1 -0
  18. package/dist/components/Tabs/src/TabsPanel.d.ts +5 -0
  19. package/dist/components/Tabs/src/TabsPanel.d.ts.map +1 -0
  20. package/dist/components/Tabs/src/context.d.ts +16 -0
  21. package/dist/components/Tabs/src/context.d.ts.map +1 -0
  22. package/dist/components/Tabs/src/index.d.ts +6 -0
  23. package/dist/components/Tabs/src/index.d.ts.map +1 -0
  24. package/dist/components/Tabs/types/index.d.ts +28 -0
  25. package/dist/components/Tabs/types/index.d.ts.map +1 -0
  26. package/dist/components/Withdraw/src/Speed.d.ts.map +1 -1
  27. package/dist/components/Withdraw/src/constants.d.ts +1 -1
  28. package/dist/components/Withdraw/src/evm/index.d.ts.map +1 -1
  29. package/dist/components/Withdraw/src/index.d.ts.map +1 -1
  30. package/dist/{index-DvVzNKgE.mjs → index-zCcWmHkS.mjs} +5899 -5931
  31. package/dist/index-zCcWmHkS.mjs.map +1 -0
  32. package/dist/index.esm.js +1 -1
  33. package/dist/index.umd.js +62 -72
  34. package/dist/index.umd.js.map +1 -1
  35. package/package.json +1 -1
  36. package/dist/components/Deposit/test-arbitrum-token-limits.d.ts +0 -5
  37. package/dist/components/Deposit/test-arbitrum-token-limits.d.ts.map +0 -1
  38. package/dist/components/Deposit/test-arbitrum-unlimited.d.ts +0 -5
  39. package/dist/components/Deposit/test-arbitrum-unlimited.d.ts.map +0 -1
  40. package/dist/index-DvVzNKgE.mjs.map +0 -1
package/dist/index.umd.js CHANGED
@@ -1,4 +1,4 @@
1
- (function(re,E){typeof exports=="object"&&typeof module<"u"?E(exports,require("react"),require("react-dom")):typeof define=="function"&&define.amd?define(["exports","react","react-dom"],E):(re=typeof globalThis<"u"?globalThis:re||self,E(re.EdgeXComponents={},re.React,re.ReactDOM))})(this,function(re,E,Me){"use strict";var jP=Object.defineProperty;var _P=(re,E,Me)=>E in re?jP(re,E,{enumerable:!0,configurable:!0,writable:!0,value:Me}):re[E]=Me;var Xe=(re,E,Me)=>_P(re,typeof E!="symbol"?E+"":E,Me);function au(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 _=au(E),Ar=au(Me);function Q0(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Qs={exports:{}},Tr={};/**
1
+ (function(re,E){typeof exports=="object"&&typeof module<"u"?E(exports,require("react"),require("react-dom")):typeof define=="function"&&define.amd?define(["exports","react","react-dom"],E):(re=typeof globalThis<"u"?globalThis:re||self,E(re.EdgeXComponents={},re.React,re.ReactDOM))})(this,function(re,E,Me){"use strict";var DP=Object.defineProperty;var FP=(re,E,Me)=>E in re?DP(re,E,{enumerable:!0,configurable:!0,writable:!0,value:Me}):re[E]=Me;var Xe=(re,E,Me)=>FP(re,typeof E!="symbol"?E+"":E,Me);function au(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 U=au(E),Tr=au(Me);function Y0(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Qs={exports:{}},Ar={};/**
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 cu;function J0(){if(cu)return Tr;cu=1;var e=E,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,u){var l,f={},p=null,d=null;u!==void 0&&(p=""+u),a.key!==void 0&&(p=""+a.key),a.ref!==void 0&&(d=a.ref);for(l in a)r.call(a,l)&&!s.hasOwnProperty(l)&&(f[l]=a[l]);if(c&&c.defaultProps)for(l in a=c.defaultProps,a)f[l]===void 0&&(f[l]=a[l]);return{$$typeof:t,type:c,key:p,ref:d,props:f,_owner:o.current}}return Tr.Fragment=n,Tr.jsx=i,Tr.jsxs=i,Tr}var Cr={};/**
9
+ */var cu;function X0(){if(cu)return Ar;cu=1;var e=E,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,u){var l,f={},p=null,d=null;u!==void 0&&(p=""+u),a.key!==void 0&&(p=""+a.key),a.ref!==void 0&&(d=a.ref);for(l in a)r.call(a,l)&&!s.hasOwnProperty(l)&&(f[l]=a[l]);if(c&&c.defaultProps)for(l in a=c.defaultProps,a)f[l]===void 0&&(f[l]=a[l]);return{$$typeof:t,type:c,key:p,ref:d,props:f,_owner:o.current}}return Ar.Fragment=n,Ar.jsx=i,Ar.jsxs=i,Ar}var Cr={};/**
10
10
  * @license React
11
11
  * react-jsx-runtime.development.js
12
12
  *
@@ -14,53 +14,53 @@
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 uu;function em(){return uu||(uu=1,process.env.NODE_ENV!=="production"&&function(){var e=E,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"),u=Symbol.for("react.suspense"),l=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 v(R){if(R===null||typeof R!="object")return null;var q=h&&R[h]||R[m];return typeof q=="function"?q:null}var C=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function y(R){{for(var q=arguments.length,Y=new Array(q>1?q-1:0),te=1;te<q;te++)Y[te-1]=arguments[te];$("error",R,Y)}}function $(R,q,Y){{var te=C.ReactDebugCurrentFrame,pe=te.getStackAddendum();pe!==""&&(q+="%s",Y=Y.concat([pe]));var me=Y.map(function(ue){return String(ue)});me.unshift("Warning: "+q),Function.prototype.apply.call(console[R],console,me)}}var B=!1,k=!1,D=!1,j=!1,g=!1,w;w=Symbol.for("react.module.reference");function A(R){return!!(typeof R=="string"||typeof R=="function"||R===r||R===s||g||R===o||R===u||R===l||j||R===d||B||k||D||typeof R=="object"&&R!==null&&(R.$$typeof===p||R.$$typeof===f||R.$$typeof===i||R.$$typeof===c||R.$$typeof===a||R.$$typeof===w||R.getModuleId!==void 0))}function I(R,q,Y){var te=R.displayName;if(te)return te;var pe=q.displayName||q.name||"";return pe!==""?Y+"("+pe+")":Y}function N(R){return R.displayName||"Context"}function P(R){if(R==null)return null;if(typeof R.tag=="number"&&y("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 u:return"Suspense";case l:return"SuspenseList"}if(typeof R=="object")switch(R.$$typeof){case c:var q=R;return N(q)+".Consumer";case i:var Y=R;return N(Y._context)+".Provider";case a:return I(R,R.render,"ForwardRef");case f:var te=R.displayName||null;return te!==null?te:P(R.type)||"Memo";case p:{var pe=R,me=pe._payload,ue=pe._init;try{return P(ue(me))}catch{return null}}}return null}var S=Object.assign,x=0,T,O,b,L,F,U,z;function V(){}V.__reactDisabledLog=!0;function Z(){{if(x===0){T=console.log,O=console.info,b=console.warn,L=console.error,F=console.group,U=console.groupCollapsed,z=console.groupEnd;var R={configurable:!0,enumerable:!0,value:V,writable:!0};Object.defineProperties(console,{info:R,log:R,warn:R,error:R,group:R,groupCollapsed:R,groupEnd:R})}x++}}function W(){{if(x--,x===0){var R={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:S({},R,{value:T}),info:S({},R,{value:O}),warn:S({},R,{value:b}),error:S({},R,{value:L}),group:S({},R,{value:F}),groupCollapsed:S({},R,{value:U}),groupEnd:S({},R,{value:z})})}x<0&&y("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var K=C.ReactCurrentDispatcher,G;function X(R,q,Y){{if(G===void 0)try{throw Error()}catch(pe){var te=pe.stack.trim().match(/\n( *(at )?)/);G=te&&te[1]||""}return`
17
+ */var uu;function Q0(){return uu||(uu=1,process.env.NODE_ENV!=="production"&&function(){var e=E,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"),u=Symbol.for("react.suspense"),l=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 y(R){if(R===null||typeof R!="object")return null;var q=h&&R[h]||R[m];return typeof q=="function"?q:null}var A=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function g(R){{for(var q=arguments.length,Y=new Array(q>1?q-1:0),te=1;te<q;te++)Y[te-1]=arguments[te];P("error",R,Y)}}function P(R,q,Y){{var te=A.ReactDebugCurrentFrame,pe=te.getStackAddendum();pe!==""&&(q+="%s",Y=Y.concat([pe]));var me=Y.map(function(ue){return String(ue)});me.unshift("Warning: "+q),Function.prototype.apply.call(console[R],console,me)}}var k=!1,B=!1,F=!1,j=!1,b=!1,w;w=Symbol.for("react.module.reference");function T(R){return!!(typeof R=="string"||typeof R=="function"||R===r||R===s||b||R===o||R===u||R===l||j||R===d||k||B||F||typeof R=="object"&&R!==null&&(R.$$typeof===p||R.$$typeof===f||R.$$typeof===i||R.$$typeof===c||R.$$typeof===a||R.$$typeof===w||R.getModuleId!==void 0))}function N(R,q,Y){var te=R.displayName;if(te)return te;var pe=q.displayName||q.name||"";return pe!==""?Y+"("+pe+")":Y}function I(R){return R.displayName||"Context"}function $(R){if(R==null)return null;if(typeof R.tag=="number"&&g("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 u:return"Suspense";case l:return"SuspenseList"}if(typeof R=="object")switch(R.$$typeof){case c:var q=R;return I(q)+".Consumer";case i:var Y=R;return I(Y._context)+".Provider";case a:return N(R,R.render,"ForwardRef");case f:var te=R.displayName||null;return te!==null?te:$(R.type)||"Memo";case p:{var pe=R,me=pe._payload,ue=pe._init;try{return $(ue(me))}catch{return null}}}return null}var S=Object.assign,x=0,C,O,v,M,D,_,z;function V(){}V.__reactDisabledLog=!0;function Z(){{if(x===0){C=console.log,O=console.info,v=console.warn,M=console.error,D=console.group,_=console.groupCollapsed,z=console.groupEnd;var R={configurable:!0,enumerable:!0,value:V,writable:!0};Object.defineProperties(console,{info:R,log:R,warn:R,error:R,group:R,groupCollapsed:R,groupEnd:R})}x++}}function W(){{if(x--,x===0){var R={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:S({},R,{value:C}),info:S({},R,{value:O}),warn:S({},R,{value:v}),error:S({},R,{value:M}),group:S({},R,{value:D}),groupCollapsed:S({},R,{value:_}),groupEnd:S({},R,{value:z})})}x<0&&g("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var K=A.ReactCurrentDispatcher,G;function X(R,q,Y){{if(G===void 0)try{throw Error()}catch(pe){var te=pe.stack.trim().match(/\n( *(at )?)/);G=te&&te[1]||""}return`
18
18
  `+G+R}}var ee=!1,le;{var xe=typeof WeakMap=="function"?WeakMap:Map;le=new xe}function oe(R,q){if(!R||ee)return"";{var Y=le.get(R);if(Y!==void 0)return Y}var te;ee=!0;var pe=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var me;me=K.current,K.current=null,Z();try{if(q){var ue=function(){throw Error()};if(Object.defineProperty(ue.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(ue,[])}catch(qe){te=qe}Reflect.construct(R,[],ue)}else{try{ue.call()}catch(qe){te=qe}R.call(ue.prototype)}}else{try{throw Error()}catch(qe){te=qe}R()}}catch(qe){if(qe&&te&&typeof qe.stack=="string"){for(var ie=qe.stack.split(`
19
- `),Fe=te.stack.split(`
20
- `),Se=ie.length-1,Pe=Fe.length-1;Se>=1&&Pe>=0&&ie[Se]!==Fe[Pe];)Pe--;for(;Se>=1&&Pe>=0;Se--,Pe--)if(ie[Se]!==Fe[Pe]){if(Se!==1||Pe!==1)do if(Se--,Pe--,Pe<0||ie[Se]!==Fe[Pe]){var ft=`
21
- `+ie[Se].replace(" at new "," at ");return R.displayName&&ft.includes("<anonymous>")&&(ft=ft.replace("<anonymous>",R.displayName)),typeof R=="function"&&le.set(R,ft),ft}while(Se>=1&&Pe>=0);break}}}finally{ee=!1,K.current=me,W(),Error.prepareStackTrace=pe}var $r=R?R.displayName||R.name:"",Hn=$r?X($r):"";return typeof R=="function"&&le.set(R,Hn),Hn}function fe(R,q,Y){return oe(R,!1)}function he(R){var q=R.prototype;return!!(q&&q.isReactComponent)}function ce(R,q,Y){if(R==null)return"";if(typeof R=="function")return oe(R,he(R));if(typeof R=="string")return X(R);switch(R){case u:return X("Suspense");case l:return X("SuspenseList")}if(typeof R=="object")switch(R.$$typeof){case a:return fe(R.render);case f:return ce(R.type,q,Y);case p:{var te=R,pe=te._payload,me=te._init;try{return ce(me(pe),q,Y)}catch{}}}return""}var Ge=Object.prototype.hasOwnProperty,Er={},Sr=C.ReactDebugCurrentFrame;function No(R){if(R){var q=R._owner,Y=ce(R.type,R._source,q?q.type:null);Sr.setExtraStackFrame(Y)}else Sr.setExtraStackFrame(null)}function Xs(R,q,Y,te,pe){{var me=Function.call.bind(Ge);for(var ue in R)if(me(R,ue)){var ie=void 0;try{if(typeof R[ue]!="function"){var Fe=Error((te||"React class")+": "+Y+" type `"+ue+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof R[ue]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw Fe.name="Invariant Violation",Fe}ie=R[ue](q,ue,te,Y,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(Se){ie=Se}ie&&!(ie instanceof Error)&&(No(pe),y("%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).",te||"React class",Y,ue,typeof ie),No(null)),ie instanceof Error&&!(ie.message in Er)&&(Er[ie.message]=!0,No(pe),y("Failed %s type: %s",Y,ie.message),No(null))}}}var yP=Array.isArray;function eu(R){return yP(R)}function vP(R){{var q=typeof Symbol=="function"&&Symbol.toStringTag,Y=q&&R[Symbol.toStringTag]||R.constructor.name||"Object";return Y}}function wP(R){try{return j0(R),!1}catch{return!0}}function j0(R){return""+R}function _0(R){if(wP(R))return y("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",vP(R)),j0(R)}var U0=C.ReactCurrentOwner,xP={key:!0,ref:!0,__self:!0,__source:!0},z0,W0;function EP(R){if(Ge.call(R,"ref")){var q=Object.getOwnPropertyDescriptor(R,"ref").get;if(q&&q.isReactWarning)return!1}return R.ref!==void 0}function SP(R){if(Ge.call(R,"key")){var q=Object.getOwnPropertyDescriptor(R,"key").get;if(q&&q.isReactWarning)return!1}return R.key!==void 0}function PP(R,q){typeof R.ref=="string"&&U0.current}function $P(R,q){{var Y=function(){z0||(z0=!0,y("%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)",q))};Y.isReactWarning=!0,Object.defineProperty(R,"key",{get:Y,configurable:!0})}}function AP(R,q){{var Y=function(){W0||(W0=!0,y("%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)",q))};Y.isReactWarning=!0,Object.defineProperty(R,"ref",{get:Y,configurable:!0})}}var TP=function(R,q,Y,te,pe,me,ue){var ie={$$typeof:t,type:R,key:q,ref:Y,props:ue,_owner:me};return ie._store={},Object.defineProperty(ie._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(ie,"_self",{configurable:!1,enumerable:!1,writable:!1,value:te}),Object.defineProperty(ie,"_source",{configurable:!1,enumerable:!1,writable:!1,value:pe}),Object.freeze&&(Object.freeze(ie.props),Object.freeze(ie)),ie};function CP(R,q,Y,te,pe){{var me,ue={},ie=null,Fe=null;Y!==void 0&&(_0(Y),ie=""+Y),SP(q)&&(_0(q.key),ie=""+q.key),EP(q)&&(Fe=q.ref,PP(q,pe));for(me in q)Ge.call(q,me)&&!xP.hasOwnProperty(me)&&(ue[me]=q[me]);if(R&&R.defaultProps){var Se=R.defaultProps;for(me in Se)ue[me]===void 0&&(ue[me]=Se[me])}if(ie||Fe){var Pe=typeof R=="function"?R.displayName||R.name||"Unknown":R;ie&&$P(ue,Pe),Fe&&AP(ue,Pe)}return TP(R,ie,Fe,pe,te,U0.current,ue)}}var tu=C.ReactCurrentOwner,H0=C.ReactDebugCurrentFrame;function Pr(R){if(R){var q=R._owner,Y=ce(R.type,R._source,q?q.type:null);H0.setExtraStackFrame(Y)}else H0.setExtraStackFrame(null)}var nu;nu=!1;function ru(R){return typeof R=="object"&&R!==null&&R.$$typeof===t}function V0(){{if(tu.current){var R=P(tu.current.type);if(R)return`
19
+ `),De=te.stack.split(`
20
+ `),Se=ie.length-1,Pe=De.length-1;Se>=1&&Pe>=0&&ie[Se]!==De[Pe];)Pe--;for(;Se>=1&&Pe>=0;Se--,Pe--)if(ie[Se]!==De[Pe]){if(Se!==1||Pe!==1)do if(Se--,Pe--,Pe<0||ie[Se]!==De[Pe]){var ft=`
21
+ `+ie[Se].replace(" at new "," at ");return R.displayName&&ft.includes("<anonymous>")&&(ft=ft.replace("<anonymous>",R.displayName)),typeof R=="function"&&le.set(R,ft),ft}while(Se>=1&&Pe>=0);break}}}finally{ee=!1,K.current=me,W(),Error.prepareStackTrace=pe}var $r=R?R.displayName||R.name:"",Wn=$r?X($r):"";return typeof R=="function"&&le.set(R,Wn),Wn}function fe(R,q,Y){return oe(R,!1)}function he(R){var q=R.prototype;return!!(q&&q.isReactComponent)}function ce(R,q,Y){if(R==null)return"";if(typeof R=="function")return oe(R,he(R));if(typeof R=="string")return X(R);switch(R){case u:return X("Suspense");case l:return X("SuspenseList")}if(typeof R=="object")switch(R.$$typeof){case a:return fe(R.render);case f:return ce(R.type,q,Y);case p:{var te=R,pe=te._payload,me=te._init;try{return ce(me(pe),q,Y)}catch{}}}return""}var Ge=Object.prototype.hasOwnProperty,Er={},Sr=A.ReactDebugCurrentFrame;function Io(R){if(R){var q=R._owner,Y=ce(R.type,R._source,q?q.type:null);Sr.setExtraStackFrame(Y)}else Sr.setExtraStackFrame(null)}function Xs(R,q,Y,te,pe){{var me=Function.call.bind(Ge);for(var ue in R)if(me(R,ue)){var ie=void 0;try{if(typeof R[ue]!="function"){var De=Error((te||"React class")+": "+Y+" type `"+ue+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof R[ue]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw De.name="Invariant Violation",De}ie=R[ue](q,ue,te,Y,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(Se){ie=Se}ie&&!(ie instanceof Error)&&(Io(pe),g("%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).",te||"React class",Y,ue,typeof ie),Io(null)),ie instanceof Error&&!(ie.message in Er)&&(Er[ie.message]=!0,Io(pe),g("Failed %s type: %s",Y,ie.message),Io(null))}}}var gP=Array.isArray;function eu(R){return gP(R)}function bP(R){{var q=typeof Symbol=="function"&&Symbol.toStringTag,Y=q&&R[Symbol.toStringTag]||R.constructor.name||"Object";return Y}}function yP(R){try{return D0(R),!1}catch{return!0}}function D0(R){return""+R}function F0(R){if(yP(R))return g("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",bP(R)),D0(R)}var j0=A.ReactCurrentOwner,vP={key:!0,ref:!0,__self:!0,__source:!0},_0,U0;function wP(R){if(Ge.call(R,"ref")){var q=Object.getOwnPropertyDescriptor(R,"ref").get;if(q&&q.isReactWarning)return!1}return R.ref!==void 0}function xP(R){if(Ge.call(R,"key")){var q=Object.getOwnPropertyDescriptor(R,"key").get;if(q&&q.isReactWarning)return!1}return R.key!==void 0}function EP(R,q){typeof R.ref=="string"&&j0.current}function SP(R,q){{var Y=function(){_0||(_0=!0,g("%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)",q))};Y.isReactWarning=!0,Object.defineProperty(R,"key",{get:Y,configurable:!0})}}function PP(R,q){{var Y=function(){U0||(U0=!0,g("%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)",q))};Y.isReactWarning=!0,Object.defineProperty(R,"ref",{get:Y,configurable:!0})}}var $P=function(R,q,Y,te,pe,me,ue){var ie={$$typeof:t,type:R,key:q,ref:Y,props:ue,_owner:me};return ie._store={},Object.defineProperty(ie._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(ie,"_self",{configurable:!1,enumerable:!1,writable:!1,value:te}),Object.defineProperty(ie,"_source",{configurable:!1,enumerable:!1,writable:!1,value:pe}),Object.freeze&&(Object.freeze(ie.props),Object.freeze(ie)),ie};function TP(R,q,Y,te,pe){{var me,ue={},ie=null,De=null;Y!==void 0&&(F0(Y),ie=""+Y),xP(q)&&(F0(q.key),ie=""+q.key),wP(q)&&(De=q.ref,EP(q,pe));for(me in q)Ge.call(q,me)&&!vP.hasOwnProperty(me)&&(ue[me]=q[me]);if(R&&R.defaultProps){var Se=R.defaultProps;for(me in Se)ue[me]===void 0&&(ue[me]=Se[me])}if(ie||De){var Pe=typeof R=="function"?R.displayName||R.name||"Unknown":R;ie&&SP(ue,Pe),De&&PP(ue,Pe)}return $P(R,ie,De,pe,te,j0.current,ue)}}var tu=A.ReactCurrentOwner,z0=A.ReactDebugCurrentFrame;function Pr(R){if(R){var q=R._owner,Y=ce(R.type,R._source,q?q.type:null);z0.setExtraStackFrame(Y)}else z0.setExtraStackFrame(null)}var nu;nu=!1;function ru(R){return typeof R=="object"&&R!==null&&R.$$typeof===t}function W0(){{if(tu.current){var R=$(tu.current.type);if(R)return`
22
22
 
23
- Check the render method of \``+R+"`."}return""}}function OP(R){return""}var G0={};function NP(R){{var q=V0();if(!q){var Y=typeof R=="string"?R:R.displayName||R.name;Y&&(q=`
23
+ Check the render method of \``+R+"`."}return""}}function AP(R){return""}var H0={};function CP(R){{var q=W0();if(!q){var Y=typeof R=="string"?R:R.displayName||R.name;Y&&(q=`
24
24
 
25
- Check the top-level render call using <`+Y+">.")}return q}}function q0(R,q){{if(!R._store||R._store.validated||R.key!=null)return;R._store.validated=!0;var Y=NP(q);if(G0[Y])return;G0[Y]=!0;var te="";R&&R._owner&&R._owner!==tu.current&&(te=" It was passed a child from "+P(R._owner.type)+"."),Pr(R),y('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',Y,te),Pr(null)}}function Z0(R,q){{if(typeof R!="object")return;if(eu(R))for(var Y=0;Y<R.length;Y++){var te=R[Y];ru(te)&&q0(te,q)}else if(ru(R))R._store&&(R._store.validated=!0);else if(R){var pe=v(R);if(typeof pe=="function"&&pe!==R.entries)for(var me=pe.call(R),ue;!(ue=me.next()).done;)ru(ue.value)&&q0(ue.value,q)}}}function IP(R){{var q=R.type;if(q==null||typeof q=="string")return;var Y;if(typeof q=="function")Y=q.propTypes;else if(typeof q=="object"&&(q.$$typeof===a||q.$$typeof===f))Y=q.propTypes;else return;if(Y){var te=P(q);Xs(Y,R.props,"prop",te,R)}else if(q.PropTypes!==void 0&&!nu){nu=!0;var pe=P(q);y("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",pe||"Unknown")}typeof q.getDefaultProps=="function"&&!q.getDefaultProps.isReactClassApproved&&y("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function MP(R){{for(var q=Object.keys(R.props),Y=0;Y<q.length;Y++){var te=q[Y];if(te!=="children"&&te!=="key"){Pr(R),y("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",te),Pr(null);break}}R.ref!==null&&(Pr(R),y("Invalid attribute `ref` supplied to `React.Fragment`."),Pr(null))}}var K0={};function Y0(R,q,Y,te,pe,me){{var ue=A(R);if(!ue){var ie="";(R===void 0||typeof R=="object"&&R!==null&&Object.keys(R).length===0)&&(ie+=" 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 Fe=OP();Fe?ie+=Fe:ie+=V0();var Se;R===null?Se="null":eu(R)?Se="array":R!==void 0&&R.$$typeof===t?(Se="<"+(P(R.type)||"Unknown")+" />",ie=" Did you accidentally export a JSX literal instead of a component?"):Se=typeof R,y("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",Se,ie)}var Pe=CP(R,q,Y,pe,me);if(Pe==null)return Pe;if(ue){var ft=q.children;if(ft!==void 0)if(te)if(eu(ft)){for(var $r=0;$r<ft.length;$r++)Z0(ft[$r],R);Object.freeze&&Object.freeze(ft)}else y("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 Z0(ft,R)}if(Ge.call(q,"key")){var Hn=P(R),qe=Object.keys(q).filter(function(DP){return DP!=="key"}),ou=qe.length>0?"{key: someKey, "+qe.join(": ..., ")+": ...}":"{key: someKey}";if(!K0[Hn+ou]){var FP=qe.length>0?"{"+qe.join(": ..., ")+": ...}":"{}";y(`A props object containing a "key" prop is being spread into JSX:
25
+ Check the top-level render call using <`+Y+">.")}return q}}function V0(R,q){{if(!R._store||R._store.validated||R.key!=null)return;R._store.validated=!0;var Y=CP(q);if(H0[Y])return;H0[Y]=!0;var te="";R&&R._owner&&R._owner!==tu.current&&(te=" It was passed a child from "+$(R._owner.type)+"."),Pr(R),g('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',Y,te),Pr(null)}}function G0(R,q){{if(typeof R!="object")return;if(eu(R))for(var Y=0;Y<R.length;Y++){var te=R[Y];ru(te)&&V0(te,q)}else if(ru(R))R._store&&(R._store.validated=!0);else if(R){var pe=y(R);if(typeof pe=="function"&&pe!==R.entries)for(var me=pe.call(R),ue;!(ue=me.next()).done;)ru(ue.value)&&V0(ue.value,q)}}}function OP(R){{var q=R.type;if(q==null||typeof q=="string")return;var Y;if(typeof q=="function")Y=q.propTypes;else if(typeof q=="object"&&(q.$$typeof===a||q.$$typeof===f))Y=q.propTypes;else return;if(Y){var te=$(q);Xs(Y,R.props,"prop",te,R)}else if(q.PropTypes!==void 0&&!nu){nu=!0;var pe=$(q);g("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",pe||"Unknown")}typeof q.getDefaultProps=="function"&&!q.getDefaultProps.isReactClassApproved&&g("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function IP(R){{for(var q=Object.keys(R.props),Y=0;Y<q.length;Y++){var te=q[Y];if(te!=="children"&&te!=="key"){Pr(R),g("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",te),Pr(null);break}}R.ref!==null&&(Pr(R),g("Invalid attribute `ref` supplied to `React.Fragment`."),Pr(null))}}var q0={};function Z0(R,q,Y,te,pe,me){{var ue=T(R);if(!ue){var ie="";(R===void 0||typeof R=="object"&&R!==null&&Object.keys(R).length===0)&&(ie+=" 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 De=AP();De?ie+=De:ie+=W0();var Se;R===null?Se="null":eu(R)?Se="array":R!==void 0&&R.$$typeof===t?(Se="<"+($(R.type)||"Unknown")+" />",ie=" Did you accidentally export a JSX literal instead of a component?"):Se=typeof R,g("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",Se,ie)}var Pe=TP(R,q,Y,pe,me);if(Pe==null)return Pe;if(ue){var ft=q.children;if(ft!==void 0)if(te)if(eu(ft)){for(var $r=0;$r<ft.length;$r++)G0(ft[$r],R);Object.freeze&&Object.freeze(ft)}else g("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 G0(ft,R)}if(Ge.call(q,"key")){var Wn=$(R),qe=Object.keys(q).filter(function(RP){return RP!=="key"}),ou=qe.length>0?"{key: someKey, "+qe.join(": ..., ")+": ...}":"{key: someKey}";if(!q0[Wn+ou]){var BP=qe.length>0?"{"+qe.join(": ..., ")+": ...}":"{}";g(`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} />`,ou,Hn,FP,Hn),K0[Hn+ou]=!0}}return R===r?MP(Pe):IP(Pe),Pe}}function LP(R,q,Y){return Y0(R,q,Y,!0)}function BP(R,q,Y){return Y0(R,q,Y,!1)}var kP=BP,RP=LP;Cr.Fragment=r,Cr.jsx=kP,Cr.jsxs=RP}()),Cr}process.env.NODE_ENV==="production"?Qs.exports=J0():Qs.exports=em();var M=Qs.exports;const tm={deposit:{title:"充值",chain:"链",asset:"资产",amount:"数量",available:"可用",equity:"总资产",confirmDeposit:"充值确认",switchNetwork:"切换网络",max:"最大",arrivalTime:"到账时间",minDeposit:"最小充值金额",minDepositParsed:"最少充值 {{amount}} {{token}}",maxDeposit:"最大充值金额",depositTipFor25w:"单笔充值金额上限为 200,000。若充值金额大于200,000,请使用Ethereum链充值。",depositAllTip:`仅支持发送 {{coin}} ({{v}}) 资产到此地址。
31
- 充值金额大于 200,000 时,到账时间存在一定延迟,请耐心等待。`,enableSystemProWithToken:"在{{network}}上启用{{token}}",enableTokenDesc:"您首次在{{network}}上存款时必须启用{{token}}。",enableWithToken:"启用 {{token}}",arrivaltimeTooltip1:"您可以在约 {{v}} 分钟 (达到 {{v1}} 个区块确认后) 提走已到账的资金",arrivaltimeTooltip2:"预计时间是根据历史数据计算所得,仅供参考。网络拥堵可能会导致实际到账时间变长。",arrivalEstimated:"≈ {{v}}分钟",availableDesc:"您可以提取的最大金额。当 available 为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:"手续费",withdrawlAmount:"提现金额",amountToReceive:"到账金额",invalidReceiverAddress:"接收地址不合法"}},nm={deposit:{title:"Deposit",chain:"Chain",asset:"Asset",amount:"Amount",available:"Available",equity:"Equity",confirmDeposit:"Confirm Deposit",switchNetwork:"Switch Network",max:"Max",arrivalTime:"Arrival Time",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.
32
- If the deposit amount exceeds 200,000, there may be a delay in the arrival time. Please be patient.`,enableSystemProWithToken:"Enable {{token}} on {{network}}",enableTokenDesc:"You must enable {{token}} the first time you deposit on {{network}}.",enableWithToken:"Enable {{token}}",arrivaltimeTooltip1:"You can withdraw the arrived funds 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:"Max. amount you can withdraw. When the available amount shown is 0 or negative, you are not allowed to make withdrawals.",noPrivateKeyWalletWarning:"Deposits from wallets without private keys are not supported at the moment. If you are using such a wallet, please do not make a deposit.",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",withdrawlAmount:"Withdrawal amount",amountToReceive:"Amount to Receive",invalidReceiverAddress:"Invalid receiver address"}},rm={deposit:{title:"入金",chain:"チェーン",asset:"資産",amount:"数量",available:"利用可能",equity:"総資産",confirmDeposit:"入金確認",switchNetwork:"ネットワークを切り替え",max:"最大",arrivalTime:"着金予定時間",minDeposit:"最低入金額",minDepositParsed:"最低入金額 {{amount}} {{token}}",maxDeposit:"最大入金額",depositTipFor25w:"1回の入金上限額は200,000です。200,000を超える場合は、Ethereumチェーンでの入金をご利用ください。",depositAllTip:`このアドレスは{{coin}}({{v}})専用です。他通貨は送金しないでください。
33
- 入金金額が 200,000 を超える場合、反映までに時間がかかることがあります。しばらくお待ちください。`,enableSystemProWithToken:"{{network}} 上で {{token}} を有効化",enableTokenDesc:"初めて {{network}} に入金する際は、{{token}} の有効化が必要です。",enableWithToken:"{{token}} を有効化",arrivaltimeTooltip1:"{{v1}} ブロック確認後、おおよそ {{v}} 分以内に引き出し可能となります",arrivaltimeTooltip2:"着金時間は過去データに基づいた目安であり、ネットワーク状況により遅延する場合があります。",arrivalEstimated:"≈ {{v}}分",availableDesc:"出金可能な最大金額です。 available が0またはマイナスの場合、出金は行えません。",noPrivateKeyWalletWarning:"現在、秘密鍵のないウォレットからの入金はサポートされていません。該当ウォレットをご利用の場合は、入金しないでください。",layerZeroDepositTip:"システムは入金資金の実際の状況に基づき、LayerZeroを通じて入金を完了します。",layerZeroDepositTipExceedPool:"入金額がプールを超えているため、LayerZero を通じて入金が完了します。",layerZeroDepositTipGte200k:"入金額が 200,000 USDT 以上のため、LayerZero を通じて入金が完了します。",layerZeroDepositButton:"LayerZeroで入金"},withdraw:{noticeDesc:"通常出金は2ステップで行われます。このステップで出金リクエストを送信し、Layer2で処理されます。資金の準備が完了すると(最大4時間かかる場合があります)、出金の通知が届きます。チェーンの同期などの影響により、所要時間は最長で48時間かかる場合があります。ガス代はユーザー負担です。",crossChainTips:"クロスチェーン出金はL2上(ゼロ知識証明経由)で検証が必要です。出金処理には最大2時間ほどかかる場合があります。対応するチェーンの資産プールに十分な流動性が必要であり、ガス代も発生します。edgeXはそのコストを補うため、一定の手数料を徴収します。",commonWithdraw:"出金ガイド",withdraw:"出金",speed:"出金時間",confirmWithdraw:"出金確認",speedNote:"処理時間:",speedNoteSpeed1:"約8分",speedNoteSpeed2:"約2~4時間",speedNoteSpeed3:"約4時間",receiverAddress:"受取アドレス",fee:"手数料",withdrawlAmount:"出金額",amountToReceive:"受け取り金額",invalidReceiverAddress:"無効な受け取りアドレス"}},om={deposit:{title:"Депозит",chain:"Сеть",asset:"Актив",amount:"Сумма",available:"Доступно",equity:"Капитал",confirmDeposit:"Подтвердить депозит",switchNetwork:"Сменить сеть",max:"Максимум",arrivalTime:"Время поступления",minDeposit:"Минимальная сумма депозита",minDepositParsed:"Мин. депозит {{amount}} {{token}}",maxDeposit:"Максимальная сумма депозита",depositTipFor25w:"Максимальная сумма одного пополнения — 200 000. Если сумма превышает 200 000, пожалуйста, используйте сеть Ethereum для пополнения.",depositAllTip:`На этот адрес можно внести только {{coin}} ({{v}}).
34
- Если сумма депозита превышает 200 000, время поступления может быть увеличено. Пожалуйста, ожидайте.`,enableSystemProWithToken:"Включить {{token}} в сети {{network}}",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:"Вывод средств происходит в два этапа: сначала подаётся заявка на вывод (обрабатывается на Layer 2), затем - перевод на кошелёк после подготовки средств (до 14 часов). Из-за синхронизации цепочки и других факторов процесс может занять до 48 часов. За gas-комиссии отвечает пользователь.",crossChainTips:"• Кроссчейн выводы требуют проверки на L2 (через ZK доказательства) и могут занять до 2 часов. Для вывода нужны средства в пуле соответствующей цепи. Также взимается комиссия за газ. edgeX взимает плату за обслуживание.",commonWithdraw:"Часто задаваемые вопросы по выводу",withdraw:"Вывод",speed:"Скорость",confirmWithdraw:"Подтвердить вывод",speedNote:"Время обработки:",speedNoteSpeed1:"Прибл. 8 минут",speedNoteSpeed2:"Прибл. 2-4 часа",speedNoteSpeed3:"Прибл. 4 часа",receiverAddress:"Адрес получателя",fee:"Комиссия",withdrawlAmount:"Сумма вывода",amountToReceive:"Сумма к получению",invalidReceiverAddress:"Неверный адрес получателя"}},sm={deposit:{title:"充值",chain:"鏈",asset:"資產",amount:"數量",available:"可用",equity:"總資產",confirmDeposit:"充值確認",switchNetwork:"切換網絡",max:"最大",arrivalTime:"到帳時間",minDeposit:"最小儲值金額",minDepositParsed:"最少充值 {{amount}} {{token}}",maxDeposit:"最大儲值金額",depositTipFor25w:"單筆充值金額上限為 200,000。若充值金額大於 200,000,請使用 Ethereum 鏈充值。",depositAllTip:`僅支援發送 {{coin}} ({{v}}) 資產到此位址。
35
- 充值金額大於 200,000 時,到账時間可能會有延遲,請耐心等待。`,enableSystemProWithToken:"在{{network}}上啓用{{token}}",enableTokenDesc:"您首次在{{network}}上存款時必須啓用{{token}}。",enableWithToken:"啓用 {{token}}",arrivaltimeTooltip1:"您可以在約 {{v}} 分鐘 (達到 {{v1}} 個區塊確認後) 提走已到帳的資金",arrivaltimeTooltip2:"預計時間是根據歷史資料計算所得,僅供參考。網路壅塞可能會導致實際到帳時間變長。",arrivalEstimated:"≈ {{v}}分鐘",availableDesc:"您可以提取的最大金額。當 available 爲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:"手續費",withdrawlAmount:"提現金額",amountToReceive:"到账金額",invalidReceiverAddress:"接收地址不合法"}},Js=["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},Io="en-US",im={"en-US":"English","zh-CN":"简体中文","zh-TW":"繁體中文","ja-JP":"日本語","ru-RU":"Русский"},am=e=>Js.includes(e)?lu[e]:lu[Io],cm=e=>Js.includes(e),fu=E.createContext(null),um=({config:e,children:t})=>{const n=E.useMemo(()=>{const r=e.locale||Io,o=cm(r)?r:Io,s=am(o);return{...e,currentLocale:o,translations:s}},[e]);return M.jsx(fu.Provider,{value:n,children:t})},du=()=>{const e=E.useContext(fu);if(!e)throw new Error("useComponentConfig must be used within ComponentProvider");return e};var lm=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,ei=Math.ceil,Qe=Math.floor,De="[BigNumber Error] ",pu=De+"Number primitive has more than 15 significant digits: ",dt=1e14,ne=14,ti=9007199254740991,ni=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],un=1e7,Te=1e9;function hu(e){var t,n,r,o=y.prototype={constructor:y,toString:null,valueOf:null},s=new y(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",C=!0;function y(g,w){var A,I,N,P,S,x,T,O,b=this;if(!(b instanceof y))return new y(g,w);if(w==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((x=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,x);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(ye(w,2,v.length,"Base"),w==10&&C)return b=new y(g),D(b,i+b.e+1,c);if(O=String(g),x=typeof g=="number"){if(g*0!=0)return r(b,O,x,w);if(b.s=1/g<0?(O=O.slice(1),-1):1,y.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(A=v.slice(0,w),P=S=0,T=O.length;S<T;S++)if(A.indexOf(I=O.charAt(S))<0){if(I=="."){if(S>P){P=T;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),x,w)}x=!1,O=n(O,w,10,b.s),(P=O.indexOf("."))>-1?O=O.replace(".",""):P=O.length}for(S=0;O.charCodeAt(S)===48;S++);for(T=O.length;O.charCodeAt(--T)===48;);if(O=O.slice(S,++T)){if(T-=S,x&&y.DEBUG&&T>15&&(g>ti||g!==Qe(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<T){for(S&&b.c.push(+O.slice(0,S)),T-=ne;S<T;)b.c.push(+O.slice(S,S+=ne));S=ne-(O=O.slice(S)).length}else S-=T;for(;S--;O+="0");b.c.push(+O)}}else b.c=[b.e=0]}y.clone=hu,y.ROUND_UP=0,y.ROUND_DOWN=1,y.ROUND_CEIL=2,y.ROUND_FLOOR=3,y.ROUND_HALF_UP=4,y.ROUND_HALF_DOWN=5,y.ROUND_HALF_EVEN=6,y.ROUND_HALF_CEIL=7,y.ROUND_HALF_FLOOR=8,y.EUCLID=9,y.config=y.set=function(g){var w,A;if(g!=null)if(typeof g=="object"){if(g.hasOwnProperty(w="DECIMAL_PLACES")&&(A=g[w],ye(A,0,Te,w),i=A),g.hasOwnProperty(w="ROUNDING_MODE")&&(A=g[w],ye(A,0,8,w),c=A),g.hasOwnProperty(w="EXPONENTIAL_AT")&&(A=g[w],A&&A.pop?(ye(A[0],-Te,0,w),ye(A[1],0,Te,w),a=A[0],u=A[1]):(ye(A,-Te,Te,w),a=-(u=A<0?-A:A))),g.hasOwnProperty(w="RANGE"))if(A=g[w],A&&A.pop)ye(A[0],-Te,-1,w),ye(A[1],1,Te,w),l=A[0],f=A[1];else if(ye(A,-Te,Te,w),A)l=-(f=A<0?-A:A);else throw Error(De+w+" cannot be zero: "+A);if(g.hasOwnProperty(w="CRYPTO"))if(A=g[w],A===!!A)if(A)if(typeof crypto<"u"&&crypto&&(crypto.getRandomValues||crypto.randomBytes))p=A;else throw p=!A,Error(De+"crypto unavailable");else p=A;else throw Error(De+w+" not true or false: "+A);if(g.hasOwnProperty(w="MODULO_MODE")&&(A=g[w],ye(A,0,9,w),d=A),g.hasOwnProperty(w="POW_PRECISION")&&(A=g[w],ye(A,0,Te,w),h=A),g.hasOwnProperty(w="FORMAT"))if(A=g[w],typeof A=="object")m=A;else throw Error(De+w+" not an object: "+A);if(g.hasOwnProperty(w="ALPHABET"))if(A=g[w],typeof A=="string"&&!/^.?$|[+\-.\s]|(.).*\1/.test(A))C=A.slice(0,10)=="0123456789",v=A;else throw Error(De+w+" invalid: "+A)}else throw Error(De+"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}},y.isBigNumber=function(g){if(!g||g._isBigNumber!==!0)return!1;if(!y.DEBUG)return!0;var w,A,I=g.c,N=g.e,P=g.s;e:if({}.toString.call(I)=="[object Array]"){if((P===1||P===-1)&&N>=-Te&&N<=Te&&N===Qe(N)){if(I[0]===0){if(N===0&&I.length===1)return!0;break e}if(w=(N+1)%ne,w<1&&(w+=ne),String(I[0]).length==w){for(w=0;w<I.length;w++)if(A=I[w],A<0||A>=dt||A!==Qe(A))break e;if(A!==0)return!0}}}else if(I===null&&N===null&&(P===null||P===1||P===-1))return!0;throw Error(De+"Invalid BigNumber: "+g)},y.maximum=y.max=function(){return B(arguments,-1)},y.minimum=y.min=function(){return B(arguments,1)},y.random=function(){var g=9007199254740992,w=Math.random()*g&2097151?function(){return Qe(Math.random()*g)}:function(){return(Math.random()*1073741824|0)*8388608+(Math.random()*8388608|0)};return function(A){var I,N,P,S,x,T=0,O=[],b=new y(s);if(A==null?A=i:ye(A,0,Te),S=ei(A/ne),p)if(crypto.getRandomValues){for(I=crypto.getRandomValues(new Uint32Array(S*=2));T<S;)x=I[T]*131072+(I[T+1]>>>11),x>=9e15?(N=crypto.getRandomValues(new Uint32Array(2)),I[T]=N[0],I[T+1]=N[1]):(O.push(x%1e14),T+=2);T=S/2}else if(crypto.randomBytes){for(I=crypto.randomBytes(S*=7);T<S;)x=(I[T]&31)*281474976710656+I[T+1]*1099511627776+I[T+2]*4294967296+I[T+3]*16777216+(I[T+4]<<16)+(I[T+5]<<8)+I[T+6],x>=9e15?crypto.randomBytes(7).copy(I,T):(O.push(x%1e14),T+=7);T=S/7}else throw p=!1,Error(De+"crypto unavailable");if(!p)for(;T<S;)x=w(),x<9e15&&(O[T++]=x%1e14);for(S=O[--T],A%=ne,S&&A&&(x=ni[ne-A],O[T]=Qe(S/x)*x);O[T]===0;O.pop(),T--);if(T<0)O=[P=0];else{for(P=-1;O[0]===0;O.splice(0,1),P-=ne);for(T=1,x=O[0];x>=10;x/=10,T++);T<ne&&(P-=ne-T)}return b.e=P,b.c=O,b}}(),y.sum=function(){for(var g=1,w=arguments,A=new y(w[0]);g<w.length;)A=A.plus(w[g++]);return A},n=function(){var g="0123456789";function w(A,I,N,P){for(var S,x=[0],T,O=0,b=A.length;O<b;){for(T=x.length;T--;x[T]*=I);for(x[0]+=P.indexOf(A.charAt(O++)),S=0;S<x.length;S++)x[S]>N-1&&(x[S+1]==null&&(x[S+1]=0),x[S+1]+=x[S]/N|0,x[S]%=N)}return x.reverse()}return function(A,I,N,P,S){var x,T,O,b,L,F,U,z,V=A.indexOf("."),Z=i,W=c;for(V>=0&&(b=h,h=0,A=A.replace(".",""),z=new y(I),F=z.pow(A.length-V),h=b,z.c=w(_t(et(F.c),F.e,"0"),10,N,g),z.e=z.c.length),U=w(A,I,N,S?(x=v,g):(x=g,v)),O=b=U.length;U[--b]==0;U.pop());if(!U[0])return x.charAt(0);if(V<0?--O:(F.c=U,F.e=O,F.s=P,F=t(F,z,Z,W,N),U=F.c,L=F.r,O=F.e),T=O+Z+1,V=U[T],b=N/2,L=L||T<0||U[T+1]!=null,L=W<4?(V!=null||L)&&(W==0||W==(F.s<0?3:2)):V>b||V==b&&(W==4||L||W==6&&U[T-1]&1||W==(F.s<0?8:7)),T<1||!U[0])A=L?_t(x.charAt(1),-Z,x.charAt(0)):x.charAt(0);else{if(U.length=T,L)for(--N;++U[--T]>N;)U[T]=0,T||(++O,U=[1].concat(U));for(b=U.length;!U[--b];);for(V=0,A="";V<=b;A+=x.charAt(U[V++]));A=_t(A,O,x.charAt(0))}return A}}(),t=function(){function g(I,N,P){var S,x,T,O,b=0,L=I.length,F=N%un,U=N/un|0;for(I=I.slice();L--;)T=I[L]%un,O=I[L]/un|0,S=U*T+O*F,x=F*T+S%un*un+b,b=(x/P|0)+(S/un|0)+U*O,I[L]=x%P;return b&&(I=[b].concat(I)),I}function w(I,N,P,S){var x,T;if(P!=S)T=P>S?1:-1;else for(x=T=0;x<P;x++)if(I[x]!=N[x]){T=I[x]>N[x]?1:-1;break}return T}function A(I,N,P,S){for(var x=0;P--;)I[P]-=x,x=I[P]<N[P]?1:0,I[P]=x*S+I[P]-N[P];for(;!I[0]&&I.length>1;I.splice(0,1));}return function(I,N,P,S,x){var T,O,b,L,F,U,z,V,Z,W,K,G,X,ee,le,xe,oe,fe=I.s==N.s?1:-1,he=I.c,ce=N.c;if(!he||!he[0]||!ce||!ce[0])return new y(!I.s||!N.s||(he?ce&&he[0]==ce[0]:!ce)?NaN:he&&he[0]==0||!ce?fe*0:fe/0);for(V=new y(fe),Z=V.c=[],O=I.e-N.e,fe=P+O+1,x||(x=dt,O=Je(I.e/ne)-Je(N.e/ne),fe=fe/ne|0),b=0;ce[b]==(he[b]||0);b++);if(ce[b]>(he[b]||0)&&O--,fe<0)Z.push(1),L=!0;else{for(ee=he.length,xe=ce.length,b=0,fe+=2,F=Qe(x/(ce[0]+1)),F>1&&(ce=g(ce,F,x),he=g(he,F,x),xe=ce.length,ee=he.length),X=xe,W=he.slice(0,xe),K=W.length;K<xe;W[K++]=0);oe=ce.slice(),oe=[0].concat(oe),le=ce[0],ce[1]>=x/2&&le++;do{if(F=0,T=w(ce,W,xe,K),T<0){if(G=W[0],xe!=K&&(G=G*x+(W[1]||0)),F=Qe(G/le),F>1)for(F>=x&&(F=x-1),U=g(ce,F,x),z=U.length,K=W.length;w(U,W,z,K)==1;)F--,A(U,xe<z?oe:ce,z,x),z=U.length,T=1;else F==0&&(T=F=1),U=ce.slice(),z=U.length;if(z<K&&(U=[0].concat(U)),A(W,U,K,x),K=W.length,T==-1)for(;w(ce,W,xe,K)<1;)F++,A(W,xe<K?oe:ce,K,x),K=W.length}else T===0&&(F++,W=[0]);Z[b++]=F,W[0]?W[K++]=he[X]||0:(W=[he[X]],K=1)}while((X++<ee||W[0]!=null)&&fe--);L=W[0]!=null,Z[0]||Z.splice(0,1)}if(x==dt){for(b=1,fe=Z[0];fe>=10;fe/=10,b++);D(V,P+(V.e=b+O*ne-1)+1,S,L)}else V.e=O,V.r=+L;return V}}();function $(g,w,A,I){var N,P,S,x,T;if(A==null?A=c:ye(A,0,8),!g.c)return g.toString();if(N=g.c[0],S=g.e,w==null)T=et(g.c),T=I==1||I==2&&(S<=a||S>=u)?Lo(T,S):_t(T,S,"0");else if(g=D(new y(g),w,A),P=g.e,T=et(g.c),x=T.length,I==1||I==2&&(w<=P||P<=a)){for(;x<w;T+="0",x++);T=Lo(T,P)}else if(w-=S+(I===2&&P>S),T=_t(T,P,"0"),P+1>x){if(--w>0)for(T+=".";w--;T+="0");}else if(w+=P-x,w>0)for(P+1==x&&(T+=".");w--;T+="0");return g.s<0&&N?"-"+T:T}function B(g,w){for(var A,I,N=1,P=new y(g[0]);N<g.length;N++)I=new y(g[N]),(!I.s||(A=En(P,I))===w||A===0&&P.s===w)&&(P=I);return P}function k(g,w,A){for(var I=1,N=w.length;!w[--N];w.pop());for(N=w[0];N>=10;N/=10,I++);return(A=I+A*ne-1)>f?g.c=g.e=null:A<l?g.c=[g.e=0]:(g.e=A,g.c=w),g}r=function(){var g=/^(-?)0([xbo])(?=\w[\w.]*$)/i,w=/^([^.]+)\.$/,A=/^\.([^.]+)$/,I=/^-?(Infinity|NaN)$/,N=/^\s*\+(?=[\w.])|^\s+|\s+$/g;return function(P,S,x,T){var O,b=x?S:S.replace(N,"");if(I.test(b))P.s=isNaN(b)?null:b<0?-1:1;else{if(!x&&(b=b.replace(g,function(L,F,U){return O=(U=U.toLowerCase())=="x"?16:U=="b"?2:8,!T||T==O?F:L}),T&&(O=T,b=b.replace(w,"$1").replace(A,"0.$1")),S!=b))return new y(b,O);if(y.DEBUG)throw Error(De+"Not a"+(T?" base "+T:"")+" number: "+S);P.s=null}P.c=P.e=null}}();function D(g,w,A,I){var N,P,S,x,T,O,b,L=g.c,F=ni;if(L){e:{for(N=1,x=L[0];x>=10;x/=10,N++);if(P=w-N,P<0)P+=ne,S=w,T=L[O=0],b=Qe(T/F[N-S-1]%10);else if(O=ei((P+1)/ne),O>=L.length)if(I){for(;L.length<=O;L.push(0));T=b=0,N=1,P%=ne,S=P-ne+1}else break e;else{for(T=x=L[O],N=1;x>=10;x/=10,N++);P%=ne,S=P-ne+N,b=S<0?0:Qe(T/F[N-S-1]%10)}if(I=I||w<0||L[O+1]!=null||(S<0?T:T%F[N-S-1]),I=A<4?(b||I)&&(A==0||A==(g.s<0?3:2)):b>5||b==5&&(A==4||I||A==6&&(P>0?S>0?T/F[N-S]:0:L[O-1])%10&1||A==(g.s<0?8:7)),w<1||!L[0])return L.length=0,I?(w-=g.e+1,L[0]=F[(ne-w%ne)%ne],g.e=-w||0):L[0]=g.e=0,g;if(P==0?(L.length=O,x=1,O--):(L.length=O+1,x=F[ne-P],L[O]=S>0?Qe(T/F[N-S]%F[S])*x:0),I)for(;;)if(O==0){for(P=1,S=L[0];S>=10;S/=10,P++);for(S=L[0]+=x,x=1;S>=10;S/=10,x++);P!=x&&(g.e++,L[0]==dt&&(L[0]=1));break}else{if(L[O]+=x,L[O]!=dt)break;L[O--]=0,x=1}for(P=L.length;L[--P]===0;L.pop());}g.e>f?g.c=g.e=null:g.e<l&&(g.c=[g.e=0])}return g}function j(g){var w,A=g.e;return A===null?g.toString():(w=et(g.c),w=A<=a||A>=u?Lo(w,A):_t(w,A,"0"),g.s<0?"-"+w:w)}return o.absoluteValue=o.abs=function(){var g=new y(this);return g.s<0&&(g.s=1),g},o.comparedTo=function(g,w){return En(this,new y(g,w))},o.decimalPlaces=o.dp=function(g,w){var A,I,N,P=this;if(g!=null)return ye(g,0,Te),w==null?w=c:ye(w,0,8),D(new y(P),g+P.e+1,w);if(!(A=P.c))return null;if(I=((N=A.length-1)-Je(this.e/ne))*ne,N=A[N])for(;N%10==0;N/=10,I--);return I<0&&(I=0),I},o.dividedBy=o.div=function(g,w){return t(this,new y(g,w),i,c)},o.dividedToIntegerBy=o.idiv=function(g,w){return t(this,new y(g,w),0,1)},o.exponentiatedBy=o.pow=function(g,w){var A,I,N,P,S,x,T,O,b,L=this;if(g=new y(g),g.c&&!g.isInteger())throw Error(De+"Exponent not an integer: "+j(g));if(w!=null&&(w=new y(w)),x=g.e>14,!L.c||!L.c[0]||L.c[0]==1&&!L.e&&L.c.length==1||!g.c||!g.c[0])return b=new y(Math.pow(+j(L),x?g.s*(2-Mo(g)):+j(g))),w?b.mod(w):b;if(T=g.s<0,w){if(w.c?!w.c[0]:!w.s)return new y(NaN);I=!T&&L.isInteger()&&w.isInteger(),I&&(L=L.mod(w))}else{if(g.e>9&&(L.e>0||L.e<-1||(L.e==0?L.c[0]>1||x&&L.c[1]>=24e7:L.c[0]<8e13||x&&L.c[0]<=9999975e7)))return P=L.s<0&&Mo(g)?-0:0,L.e>-1&&(P=1/P),new y(T?1/P:P);h&&(P=ei(h/ne+2))}for(x?(A=new y(.5),T&&(g.s=1),O=Mo(g)):(N=Math.abs(+j(g)),O=N%2),b=new y(s);;){if(O){if(b=b.times(L),!b.c)break;P?b.c.length>P&&(b.c.length=P):I&&(b=b.mod(w))}if(N){if(N=Qe(N/2),N===0)break;O=N%2}else if(g=g.times(A),D(g,g.e+1,1),g.e>14)O=Mo(g);else{if(N=+j(g),N===0)break;O=N%2}L=L.times(L),P?L.c&&L.c.length>P&&(L.c.length=P):I&&(L=L.mod(w))}return I?b:(T&&(b=s.div(b)),w?b.mod(w):P?D(b,h,c,S):b)},o.integerValue=function(g){var w=new y(this);return g==null?g=c:ye(g,0,8),D(w,w.e+1,g)},o.isEqualTo=o.eq=function(g,w){return En(this,new y(g,w))===0},o.isFinite=function(){return!!this.c},o.isGreaterThan=o.gt=function(g,w){return En(this,new y(g,w))>0},o.isGreaterThanOrEqualTo=o.gte=function(g,w){return(w=En(this,new y(g,w)))===1||w===0},o.isInteger=function(){return!!this.c&&Je(this.e/ne)>this.c.length-2},o.isLessThan=o.lt=function(g,w){return En(this,new y(g,w))<0},o.isLessThanOrEqualTo=o.lte=function(g,w){return(w=En(this,new y(g,w)))===-1||w===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,w){var A,I,N,P,S=this,x=S.s;if(g=new y(g,w),w=g.s,!x||!w)return new y(NaN);if(x!=w)return g.s=-w,S.plus(g);var T=S.e/ne,O=g.e/ne,b=S.c,L=g.c;if(!T||!O){if(!b||!L)return b?(g.s=-w,g):new y(L?S:NaN);if(!b[0]||!L[0])return L[0]?(g.s=-w,g):new y(b[0]?S:c==3?-0:0)}if(T=Je(T),O=Je(O),b=b.slice(),x=T-O){for((P=x<0)?(x=-x,N=b):(O=T,N=L),N.reverse(),w=x;w--;N.push(0));N.reverse()}else for(I=(P=(x=b.length)<(w=L.length))?x:w,x=w=0;w<I;w++)if(b[w]!=L[w]){P=b[w]<L[w];break}if(P&&(N=b,b=L,L=N,g.s=-g.s),w=(I=L.length)-(A=b.length),w>0)for(;w--;b[A++]=0);for(w=dt-1;I>x;){if(b[--I]<L[I]){for(A=I;A&&!b[--A];b[A]=w);--b[A],b[I]+=dt}b[I]-=L[I]}for(;b[0]==0;b.splice(0,1),--O);return b[0]?k(g,b,O):(g.s=c==3?-1:1,g.c=[g.e=0],g)},o.modulo=o.mod=function(g,w){var A,I,N=this;return g=new y(g,w),!N.c||!g.s||g.c&&!g.c[0]?new y(NaN):!g.c||N.c&&!N.c[0]?new y(N):(d==9?(I=g.s,g.s=1,A=t(N,g,0,3),g.s=I,A.s*=I):A=t(N,g,0,d),g=N.minus(A.times(g)),!g.c[0]&&d==1&&(g.s=N.s),g)},o.multipliedBy=o.times=function(g,w){var A,I,N,P,S,x,T,O,b,L,F,U,z,V,Z,W=this,K=W.c,G=(g=new y(g,w)).c;if(!K||!G||!K[0]||!G[0])return!W.s||!g.s||K&&!K[0]&&!G||G&&!G[0]&&!K?g.c=g.e=g.s=null:(g.s*=W.s,!K||!G?g.c=g.e=null:(g.c=[0],g.e=0)),g;for(I=Je(W.e/ne)+Je(g.e/ne),g.s*=W.s,T=K.length,L=G.length,T<L&&(z=K,K=G,G=z,N=T,T=L,L=N),N=T+L,z=[];N--;z.push(0));for(V=dt,Z=un,N=L;--N>=0;){for(A=0,F=G[N]%Z,U=G[N]/Z|0,S=T,P=N+S;P>N;)O=K[--S]%Z,b=K[S]/Z|0,x=U*O+b*F,O=F*O+x%Z*Z+z[P]+A,A=(O/V|0)+(x/Z|0)+U*b,z[P--]=O%V;z[P]=A}return A?++I:z.splice(0,1),k(g,z,I)},o.negated=function(){var g=new y(this);return g.s=-g.s||null,g},o.plus=function(g,w){var A,I=this,N=I.s;if(g=new y(g,w),w=g.s,!N||!w)return new y(NaN);if(N!=w)return g.s=-w,I.minus(g);var P=I.e/ne,S=g.e/ne,x=I.c,T=g.c;if(!P||!S){if(!x||!T)return new y(N/0);if(!x[0]||!T[0])return T[0]?g:new y(x[0]?I:N*0)}if(P=Je(P),S=Je(S),x=x.slice(),N=P-S){for(N>0?(S=P,A=T):(N=-N,A=x),A.reverse();N--;A.push(0));A.reverse()}for(N=x.length,w=T.length,N-w<0&&(A=T,T=x,x=A,w=N),N=0;w;)N=(x[--w]=x[w]+T[w]+N)/dt|0,x[w]=dt===x[w]?0:x[w]%dt;return N&&(x=[N].concat(x),++S),k(g,x,S)},o.precision=o.sd=function(g,w){var A,I,N,P=this;if(g!=null&&g!==!!g)return ye(g,1,Te),w==null?w=c:ye(w,0,8),D(new y(P),g,w);if(!(A=P.c))return null;if(N=A.length-1,I=N*ne+1,N=A[N]){for(;N%10==0;N/=10,I--);for(N=A[0];N>=10;N/=10,I++);}return g&&P.e+1>I&&(I=P.e+1),I},o.shiftedBy=function(g){return ye(g,-ti,ti),this.times("1e"+g)},o.squareRoot=o.sqrt=function(){var g,w,A,I,N,P=this,S=P.c,x=P.s,T=P.e,O=i+4,b=new y("0.5");if(x!==1||!S||!S[0])return new y(!x||x<0&&(!S||S[0])?NaN:S?P:1/0);if(x=Math.sqrt(+j(P)),x==0||x==1/0?(w=et(S),(w.length+T)%2==0&&(w+="0"),x=Math.sqrt(+w),T=Je((T+1)/2)-(T<0||T%2),x==1/0?w="5e"+T:(w=x.toExponential(),w=w.slice(0,w.indexOf("e")+1)+T),A=new y(w)):A=new y(x+""),A.c[0]){for(T=A.e,x=T+O,x<3&&(x=0);;)if(N=A,A=b.times(N.plus(t(P,N,O,1))),et(N.c).slice(0,x)===(w=et(A.c)).slice(0,x))if(A.e<T&&--x,w=w.slice(x-3,x+1),w=="9999"||!I&&w=="4999"){if(!I&&(D(N,N.e+i+2,0),N.times(N).eq(P))){A=N;break}O+=4,x+=4,I=1}else{(!+w||!+w.slice(1)&&w.charAt(0)=="5")&&(D(A,A.e+i+2,1),g=!A.times(A).eq(P));break}}return D(A,A.e+i+1,c,g)},o.toExponential=function(g,w){return g!=null&&(ye(g,0,Te),g++),$(this,g,w,1)},o.toFixed=function(g,w){return g!=null&&(ye(g,0,Te),g=g+this.e+1),$(this,g,w)},o.toFormat=function(g,w,A){var I,N=this;if(A==null)g!=null&&w&&typeof w=="object"?(A=w,w=null):g&&typeof g=="object"?(A=g,g=w=null):A=m;else if(typeof A!="object")throw Error(De+"Argument not an object: "+A);if(I=N.toFixed(g,w),N.c){var P,S=I.split("."),x=+A.groupSize,T=+A.secondaryGroupSize,O=A.groupSeparator||"",b=S[0],L=S[1],F=N.s<0,U=F?b.slice(1):b,z=U.length;if(T&&(P=x,x=T,T=P,z-=P),x>0&&z>0){for(P=z%x||x,b=U.substr(0,P);P<z;P+=x)b+=O+U.substr(P,x);T>0&&(b+=O+U.slice(P)),F&&(b="-"+b)}I=L?b+(A.decimalSeparator||"")+((T=+A.fractionGroupSize)?L.replace(new RegExp("\\d{"+T+"}\\B","g"),"$&"+(A.fractionGroupSeparator||"")):L):b}return(A.prefix||"")+I+(A.suffix||"")},o.toFraction=function(g){var w,A,I,N,P,S,x,T,O,b,L,F,U=this,z=U.c;if(g!=null&&(x=new y(g),!x.isInteger()&&(x.c||x.s!==1)||x.lt(s)))throw Error(De+"Argument "+(x.isInteger()?"out of range: ":"not an integer: ")+j(x));if(!z)return new y(U);for(w=new y(s),O=A=new y(s),I=T=new y(s),F=et(z),P=w.e=F.length-U.e-1,w.c[0]=ni[(S=P%ne)<0?ne+S:S],g=!g||x.comparedTo(w)>0?P>0?w:O:x,S=f,f=1/0,x=new y(F),T.c[0]=0;b=t(x,w,0,1),N=A.plus(b.times(I)),N.comparedTo(g)!=1;)A=I,I=N,O=T.plus(b.times(N=O)),T=N,w=x.minus(b.times(N=w)),x=N;return N=t(g.minus(A),I,0,1),T=T.plus(N.times(O)),A=A.plus(N.times(I)),T.s=O.s=U.s,P=P*2,L=t(O,I,P,c).minus(U).abs().comparedTo(t(T,A,P,c).minus(U).abs())<1?[O,I]:[T,A],f=S,L},o.toNumber=function(){return+j(this)},o.toPrecision=function(g,w){return g!=null&&ye(g,1,Te),$(this,g,w,2)},o.toString=function(g){var w,A=this,I=A.s,N=A.e;return N===null?I?(w="Infinity",I<0&&(w="-"+w)):w="NaN":(g==null?w=N<=a||N>=u?Lo(et(A.c),N):_t(et(A.c),N,"0"):g===10&&C?(A=D(new y(A),i+N+1,c),w=_t(et(A.c),A.e,"0")):(ye(g,2,v.length,"Base"),w=n(_t(et(A.c),N,"0"),10,g,I,!0)),I<0&&A.c[0]&&(w="-"+w)),w},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&&y.set(e),y}function Je(e){var t=e|0;return e>0||e===t?t:t-1}function et(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 En(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 ye(e,t,n,r){if(e<t||e>n||e!==Qe(e))throw Error(De+(r||"Argument")+(typeof e=="number"?e<t||e>n?" out of range: ":" not an integer: ":" not a primitive number: ")+String(e))}function Mo(e){var t=e.c.length-1;return Je(e.e/ne)==t&&e.c[t]%2!=0}function Lo(e,t){return(e.length>1?e.charAt(0)+"."+e.slice(1):e)+(t<0?"e":"e+")+t}function _t(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 Le=hu();const fm=(e,t=6)=>{try{const n=new Le(e||"0");if(n.isNaN())return"0";const r=n.decimalPlaces(t,Le.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}=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=()=>({openDeposit:E.useCallback(t=>{},[])}),pm=()=>({openWithdraw:E.useCallback(t=>{},[])});/**
30
+ <%s key={someKey} {...props} />`,ou,Wn,BP,Wn),q0[Wn+ou]=!0}}return R===r?IP(Pe):OP(Pe),Pe}}function NP(R,q,Y){return Z0(R,q,Y,!0)}function MP(R,q,Y){return Z0(R,q,Y,!1)}var kP=MP,LP=NP;Cr.Fragment=r,Cr.jsx=kP,Cr.jsxs=LP}()),Cr}process.env.NODE_ENV==="production"?Qs.exports=X0():Qs.exports=Q0();var L=Qs.exports;const J0={deposit:{title:"充值",chain:"链",asset:"资产",amount:"数量",available:"可用",equity:"总资产",confirmDeposit:"充值确认",switchNetwork:"切换网络",max:"最大",arrivalTime:"到账时间",minDeposit:"最小充值金额",minDepositParsed:"最少充值 {{amount}} {{token}}",maxDeposit:"最大充值金额",depositTipFor25w:"单笔充值金额上限为 200,000。若充值金额大于200,000,请使用Ethereum链充值。",depositAllTip:`仅支持发送 {{coin}} ({{v}}) 资产到此地址。
31
+ 充值金额大于 200,000 时,到账时间存在一定延迟,请耐心等待。`,enableSystemProWithToken:"在{{network}}上启用{{token}}",enableTokenDesc:"您首次在{{network}}上存款时必须启用{{token}}。",enableWithToken:"启用 {{token}}",arrivaltimeTooltip1:"您可以在约 {{v}} 分钟 (达到 {{v1}} 个区块确认后) 提走已到账的资金",arrivaltimeTooltip2:"预计时间是根据历史数据计算所得,仅供参考。网络拥堵可能会导致实际到账时间变长。",arrivalEstimated:"≈ {{v}}分钟",availableDesc:"您可以提取的最大金额。当 available 为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:"手续费",withdrawlAmount:"提现金额",amountToReceive:"到账金额",invalidReceiverAddress:"接收地址不合法"}},em={deposit:{title:"Deposit",chain:"Chain",asset:"Asset",amount:"Amount",available:"Available",equity:"Equity",confirmDeposit:"Confirm Deposit",switchNetwork:"Switch Network",max:"Max",arrivalTime:"Arrival Time",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.
32
+ If the deposit amount exceeds 200,000, there may be a delay in the arrival time. Please be patient.`,enableSystemProWithToken:"Enable {{token}} on {{network}}",enableTokenDesc:"You must enable {{token}} the first time you deposit on {{network}}.",enableWithToken:"Enable {{token}}",arrivaltimeTooltip1:"You can withdraw the arrived funds 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:"Max. amount you can withdraw. When the available amount shown is 0 or negative, you are not allowed to make withdrawals.",noPrivateKeyWalletWarning:"Deposits from wallets without private keys are not supported at the moment. If you are using such a wallet, please do not make a deposit.",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",withdrawlAmount:"Withdrawal amount",amountToReceive:"Amount to Receive",invalidReceiverAddress:"Invalid receiver address"}},tm={deposit:{title:"入金",chain:"チェーン",asset:"資産",amount:"数量",available:"利用可能",equity:"総資産",confirmDeposit:"入金確認",switchNetwork:"ネットワークを切り替え",max:"最大",arrivalTime:"着金予定時間",minDeposit:"最低入金額",minDepositParsed:"最低入金額 {{amount}} {{token}}",maxDeposit:"最大入金額",depositTipFor25w:"1回の入金上限額は200,000です。200,000を超える場合は、Ethereumチェーンでの入金をご利用ください。",depositAllTip:`このアドレスは{{coin}}({{v}})専用です。他通貨は送金しないでください。
33
+ 入金金額が 200,000 を超える場合、反映までに時間がかかることがあります。しばらくお待ちください。`,enableSystemProWithToken:"{{network}} 上で {{token}} を有効化",enableTokenDesc:"初めて {{network}} に入金する際は、{{token}} の有効化が必要です。",enableWithToken:"{{token}} を有効化",arrivaltimeTooltip1:"{{v1}} ブロック確認後、おおよそ {{v}} 分以内に引き出し可能となります",arrivaltimeTooltip2:"着金時間は過去データに基づいた目安であり、ネットワーク状況により遅延する場合があります。",arrivalEstimated:"≈ {{v}}分",availableDesc:"出金可能な最大金額です。 available が0またはマイナスの場合、出金は行えません。",noPrivateKeyWalletWarning:"現在、秘密鍵のないウォレットからの入金はサポートされていません。該当ウォレットをご利用の場合は、入金しないでください。",layerZeroDepositTip:"システムは入金資金の実際の状況に基づき、LayerZeroを通じて入金を完了します。",layerZeroDepositTipExceedPool:"入金額がプールを超えているため、LayerZero を通じて入金が完了します。",layerZeroDepositTipGte200k:"入金額が 200,000 USDT 以上のため、LayerZero を通じて入金が完了します。",layerZeroDepositButton:"LayerZeroで入金"},withdraw:{noticeDesc:"通常出金は2ステップで行われます。このステップで出金リクエストを送信し、Layer2で処理されます。資金の準備が完了すると(最大4時間かかる場合があります)、出金の通知が届きます。チェーンの同期などの影響により、所要時間は最長で48時間かかる場合があります。ガス代はユーザー負担です。",crossChainTips:"クロスチェーン出金はL2上(ゼロ知識証明経由)で検証が必要です。出金処理には最大2時間ほどかかる場合があります。対応するチェーンの資産プールに十分な流動性が必要であり、ガス代も発生します。edgeXはそのコストを補うため、一定の手数料を徴収します。",commonWithdraw:"出金ガイド",withdraw:"出金",speed:"出金時間",confirmWithdraw:"出金確認",speedNote:"処理時間:",speedNoteSpeed1:"約8分",speedNoteSpeed2:"約2~4時間",speedNoteSpeed3:"約4時間",receiverAddress:"受取アドレス",fee:"手数料",withdrawlAmount:"出金額",amountToReceive:"受け取り金額",invalidReceiverAddress:"無効な受け取りアドレス"}},nm={deposit:{title:"Депозит",chain:"Сеть",asset:"Актив",amount:"Сумма",available:"Доступно",equity:"Капитал",confirmDeposit:"Подтвердить депозит",switchNetwork:"Сменить сеть",max:"Максимум",arrivalTime:"Время поступления",minDeposit:"Минимальная сумма депозита",minDepositParsed:"Мин. депозит {{amount}} {{token}}",maxDeposit:"Максимальная сумма депозита",depositTipFor25w:"Максимальная сумма одного пополнения — 200 000. Если сумма превышает 200 000, пожалуйста, используйте сеть Ethereum для пополнения.",depositAllTip:`На этот адрес можно внести только {{coin}} ({{v}}).
34
+ Если сумма депозита превышает 200 000, время поступления может быть увеличено. Пожалуйста, ожидайте.`,enableSystemProWithToken:"Включить {{token}} в сети {{network}}",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:"Вывод средств происходит в два этапа: сначала подаётся заявка на вывод (обрабатывается на Layer 2), затем - перевод на кошелёк после подготовки средств (до 14 часов). Из-за синхронизации цепочки и других факторов процесс может занять до 48 часов. За gas-комиссии отвечает пользователь.",crossChainTips:"• Кроссчейн выводы требуют проверки на L2 (через ZK доказательства) и могут занять до 2 часов. Для вывода нужны средства в пуле соответствующей цепи. Также взимается комиссия за газ. edgeX взимает плату за обслуживание.",commonWithdraw:"Часто задаваемые вопросы по выводу",withdraw:"Вывод",speed:"Скорость",confirmWithdraw:"Подтвердить вывод",speedNote:"Время обработки:",speedNoteSpeed1:"Прибл. 8 минут",speedNoteSpeed2:"Прибл. 2-4 часа",speedNoteSpeed3:"Прибл. 4 часа",receiverAddress:"Адрес получателя",fee:"Комиссия",withdrawlAmount:"Сумма вывода",amountToReceive:"Сумма к получению",invalidReceiverAddress:"Неверный адрес получателя"}},rm={deposit:{title:"充值",chain:"鏈",asset:"資產",amount:"數量",available:"可用",equity:"總資產",confirmDeposit:"充值確認",switchNetwork:"切換網絡",max:"最大",arrivalTime:"到帳時間",minDeposit:"最小儲值金額",minDepositParsed:"最少充值 {{amount}} {{token}}",maxDeposit:"最大儲值金額",depositTipFor25w:"單筆充值金額上限為 200,000。若充值金額大於 200,000,請使用 Ethereum 鏈充值。",depositAllTip:`僅支援發送 {{coin}} ({{v}}) 資產到此位址。
35
+ 充值金額大於 200,000 時,到账時間可能會有延遲,請耐心等待。`,enableSystemProWithToken:"在{{network}}上啓用{{token}}",enableTokenDesc:"您首次在{{network}}上存款時必須啓用{{token}}。",enableWithToken:"啓用 {{token}}",arrivaltimeTooltip1:"您可以在約 {{v}} 分鐘 (達到 {{v1}} 個區塊確認後) 提走已到帳的資金",arrivaltimeTooltip2:"預計時間是根據歷史資料計算所得,僅供參考。網路壅塞可能會導致實際到帳時間變長。",arrivalEstimated:"≈ {{v}}分鐘",availableDesc:"您可以提取的最大金額。當 available 爲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:"手續費",withdrawlAmount:"提現金額",amountToReceive:"到账金額",invalidReceiverAddress:"接收地址不合法"}},Js=["en-US","ja-JP","ru-RU","zh-CN","zh-TW"],lu={"en-US":em,"ja-JP":tm,"ru-RU":nm,"zh-CN":J0,"zh-TW":rm},No="en-US",om={"en-US":"English","zh-CN":"简体中文","zh-TW":"繁體中文","ja-JP":"日本語","ru-RU":"Русский"},sm=e=>Js.includes(e)?lu[e]:lu[No],im=e=>Js.includes(e),fu=E.createContext(null),am=({config:e,children:t})=>{const n=E.useMemo(()=>{const r=e.locale||No,o=im(r)?r:No,s=sm(o);return{...e,currentLocale:o,translations:s}},[e]);return L.jsx(fu.Provider,{value:n,children:t})},du=()=>{const e=E.useContext(fu);if(!e)throw new Error("useComponentConfig must be used within ComponentProvider");return e};var cm=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,ei=Math.ceil,Qe=Math.floor,Fe="[BigNumber Error] ",pu=Fe+"Number primitive has more than 15 significant digits: ",dt=1e14,ne=14,ti=9007199254740991,ni=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],un=1e7,Ae=1e9;function hu(e){var t,n,r,o=g.prototype={constructor:g,toString:null,valueOf:null},s=new g(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:""},y="0123456789abcdefghijklmnopqrstuvwxyz",A=!0;function g(b,w){var T,N,I,$,S,x,C,O,v=this;if(!(v instanceof g))return new g(b,w);if(w==null){if(b&&b._isBigNumber===!0){v.s=b.s,!b.c||b.e>f?v.c=v.e=null:b.e<l?v.c=[v.e=0]:(v.e=b.e,v.c=b.c.slice());return}if((x=typeof b=="number")&&b*0==0){if(v.s=1/b<0?(b=-b,-1):1,b===~~b){for($=0,S=b;S>=10;S/=10,$++);$>f?v.c=v.e=null:(v.e=$,v.c=[b]);return}O=String(b)}else{if(!cm.test(O=String(b)))return r(v,O,x);v.s=O.charCodeAt(0)==45?(O=O.slice(1),-1):1}($=O.indexOf("."))>-1&&(O=O.replace(".","")),(S=O.search(/e/i))>0?($<0&&($=S),$+=+O.slice(S+1),O=O.substring(0,S)):$<0&&($=O.length)}else{if(ye(w,2,y.length,"Base"),w==10&&A)return v=new g(b),F(v,i+v.e+1,c);if(O=String(b),x=typeof b=="number"){if(b*0!=0)return r(v,O,x,w);if(v.s=1/b<0?(O=O.slice(1),-1):1,g.DEBUG&&O.replace(/^0\.0*|\./,"").length>15)throw Error(pu+b)}else v.s=O.charCodeAt(0)===45?(O=O.slice(1),-1):1;for(T=y.slice(0,w),$=S=0,C=O.length;S<C;S++)if(T.indexOf(N=O.charAt(S))<0){if(N=="."){if(S>$){$=C;continue}}else if(!I&&(O==O.toUpperCase()&&(O=O.toLowerCase())||O==O.toLowerCase()&&(O=O.toUpperCase()))){I=!0,S=-1,$=0;continue}return r(v,String(b),x,w)}x=!1,O=n(O,w,10,v.s),($=O.indexOf("."))>-1?O=O.replace(".",""):$=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,x&&g.DEBUG&&C>15&&(b>ti||b!==Qe(b)))throw Error(pu+v.s*b);if(($=$-S-1)>f)v.c=v.e=null;else if($<l)v.c=[v.e=0];else{if(v.e=$,v.c=[],S=($+1)%ne,$<0&&(S+=ne),S<C){for(S&&v.c.push(+O.slice(0,S)),C-=ne;S<C;)v.c.push(+O.slice(S,S+=ne));S=ne-(O=O.slice(S)).length}else S-=C;for(;S--;O+="0");v.c.push(+O)}}else v.c=[v.e=0]}g.clone=hu,g.ROUND_UP=0,g.ROUND_DOWN=1,g.ROUND_CEIL=2,g.ROUND_FLOOR=3,g.ROUND_HALF_UP=4,g.ROUND_HALF_DOWN=5,g.ROUND_HALF_EVEN=6,g.ROUND_HALF_CEIL=7,g.ROUND_HALF_FLOOR=8,g.EUCLID=9,g.config=g.set=function(b){var w,T;if(b!=null)if(typeof b=="object"){if(b.hasOwnProperty(w="DECIMAL_PLACES")&&(T=b[w],ye(T,0,Ae,w),i=T),b.hasOwnProperty(w="ROUNDING_MODE")&&(T=b[w],ye(T,0,8,w),c=T),b.hasOwnProperty(w="EXPONENTIAL_AT")&&(T=b[w],T&&T.pop?(ye(T[0],-Ae,0,w),ye(T[1],0,Ae,w),a=T[0],u=T[1]):(ye(T,-Ae,Ae,w),a=-(u=T<0?-T:T))),b.hasOwnProperty(w="RANGE"))if(T=b[w],T&&T.pop)ye(T[0],-Ae,-1,w),ye(T[1],1,Ae,w),l=T[0],f=T[1];else if(ye(T,-Ae,Ae,w),T)l=-(f=T<0?-T:T);else throw Error(Fe+w+" cannot be zero: "+T);if(b.hasOwnProperty(w="CRYPTO"))if(T=b[w],T===!!T)if(T)if(typeof crypto<"u"&&crypto&&(crypto.getRandomValues||crypto.randomBytes))p=T;else throw p=!T,Error(Fe+"crypto unavailable");else p=T;else throw Error(Fe+w+" not true or false: "+T);if(b.hasOwnProperty(w="MODULO_MODE")&&(T=b[w],ye(T,0,9,w),d=T),b.hasOwnProperty(w="POW_PRECISION")&&(T=b[w],ye(T,0,Ae,w),h=T),b.hasOwnProperty(w="FORMAT"))if(T=b[w],typeof T=="object")m=T;else throw Error(Fe+w+" not an object: "+T);if(b.hasOwnProperty(w="ALPHABET"))if(T=b[w],typeof T=="string"&&!/^.?$|[+\-.\s]|(.).*\1/.test(T))A=T.slice(0,10)=="0123456789",y=T;else throw Error(Fe+w+" invalid: "+T)}else throw Error(Fe+"Object expected: "+b);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:y}},g.isBigNumber=function(b){if(!b||b._isBigNumber!==!0)return!1;if(!g.DEBUG)return!0;var w,T,N=b.c,I=b.e,$=b.s;e:if({}.toString.call(N)=="[object Array]"){if(($===1||$===-1)&&I>=-Ae&&I<=Ae&&I===Qe(I)){if(N[0]===0){if(I===0&&N.length===1)return!0;break e}if(w=(I+1)%ne,w<1&&(w+=ne),String(N[0]).length==w){for(w=0;w<N.length;w++)if(T=N[w],T<0||T>=dt||T!==Qe(T))break e;if(T!==0)return!0}}}else if(N===null&&I===null&&($===null||$===1||$===-1))return!0;throw Error(Fe+"Invalid BigNumber: "+b)},g.maximum=g.max=function(){return k(arguments,-1)},g.minimum=g.min=function(){return k(arguments,1)},g.random=function(){var b=9007199254740992,w=Math.random()*b&2097151?function(){return Qe(Math.random()*b)}:function(){return(Math.random()*1073741824|0)*8388608+(Math.random()*8388608|0)};return function(T){var N,I,$,S,x,C=0,O=[],v=new g(s);if(T==null?T=i:ye(T,0,Ae),S=ei(T/ne),p)if(crypto.getRandomValues){for(N=crypto.getRandomValues(new Uint32Array(S*=2));C<S;)x=N[C]*131072+(N[C+1]>>>11),x>=9e15?(I=crypto.getRandomValues(new Uint32Array(2)),N[C]=I[0],N[C+1]=I[1]):(O.push(x%1e14),C+=2);C=S/2}else if(crypto.randomBytes){for(N=crypto.randomBytes(S*=7);C<S;)x=(N[C]&31)*281474976710656+N[C+1]*1099511627776+N[C+2]*4294967296+N[C+3]*16777216+(N[C+4]<<16)+(N[C+5]<<8)+N[C+6],x>=9e15?crypto.randomBytes(7).copy(N,C):(O.push(x%1e14),C+=7);C=S/7}else throw p=!1,Error(Fe+"crypto unavailable");if(!p)for(;C<S;)x=w(),x<9e15&&(O[C++]=x%1e14);for(S=O[--C],T%=ne,S&&T&&(x=ni[ne-T],O[C]=Qe(S/x)*x);O[C]===0;O.pop(),C--);if(C<0)O=[$=0];else{for($=-1;O[0]===0;O.splice(0,1),$-=ne);for(C=1,x=O[0];x>=10;x/=10,C++);C<ne&&($-=ne-C)}return v.e=$,v.c=O,v}}(),g.sum=function(){for(var b=1,w=arguments,T=new g(w[0]);b<w.length;)T=T.plus(w[b++]);return T},n=function(){var b="0123456789";function w(T,N,I,$){for(var S,x=[0],C,O=0,v=T.length;O<v;){for(C=x.length;C--;x[C]*=N);for(x[0]+=$.indexOf(T.charAt(O++)),S=0;S<x.length;S++)x[S]>I-1&&(x[S+1]==null&&(x[S+1]=0),x[S+1]+=x[S]/I|0,x[S]%=I)}return x.reverse()}return function(T,N,I,$,S){var x,C,O,v,M,D,_,z,V=T.indexOf("."),Z=i,W=c;for(V>=0&&(v=h,h=0,T=T.replace(".",""),z=new g(N),D=z.pow(T.length-V),h=v,z.c=w(zt(et(D.c),D.e,"0"),10,I,b),z.e=z.c.length),_=w(T,N,I,S?(x=y,b):(x=b,y)),O=v=_.length;_[--v]==0;_.pop());if(!_[0])return x.charAt(0);if(V<0?--O:(D.c=_,D.e=O,D.s=$,D=t(D,z,Z,W,I),_=D.c,M=D.r,O=D.e),C=O+Z+1,V=_[C],v=I/2,M=M||C<0||_[C+1]!=null,M=W<4?(V!=null||M)&&(W==0||W==(D.s<0?3:2)):V>v||V==v&&(W==4||M||W==6&&_[C-1]&1||W==(D.s<0?8:7)),C<1||!_[0])T=M?zt(x.charAt(1),-Z,x.charAt(0)):x.charAt(0);else{if(_.length=C,M)for(--I;++_[--C]>I;)_[C]=0,C||(++O,_=[1].concat(_));for(v=_.length;!_[--v];);for(V=0,T="";V<=v;T+=x.charAt(_[V++]));T=zt(T,O,x.charAt(0))}return T}}(),t=function(){function b(N,I,$){var S,x,C,O,v=0,M=N.length,D=I%un,_=I/un|0;for(N=N.slice();M--;)C=N[M]%un,O=N[M]/un|0,S=_*C+O*D,x=D*C+S%un*un+v,v=(x/$|0)+(S/un|0)+_*O,N[M]=x%$;return v&&(N=[v].concat(N)),N}function w(N,I,$,S){var x,C;if($!=S)C=$>S?1:-1;else for(x=C=0;x<$;x++)if(N[x]!=I[x]){C=N[x]>I[x]?1:-1;break}return C}function T(N,I,$,S){for(var x=0;$--;)N[$]-=x,x=N[$]<I[$]?1:0,N[$]=x*S+N[$]-I[$];for(;!N[0]&&N.length>1;N.splice(0,1));}return function(N,I,$,S,x){var C,O,v,M,D,_,z,V,Z,W,K,G,X,ee,le,xe,oe,fe=N.s==I.s?1:-1,he=N.c,ce=I.c;if(!he||!he[0]||!ce||!ce[0])return new g(!N.s||!I.s||(he?ce&&he[0]==ce[0]:!ce)?NaN:he&&he[0]==0||!ce?fe*0:fe/0);for(V=new g(fe),Z=V.c=[],O=N.e-I.e,fe=$+O+1,x||(x=dt,O=Je(N.e/ne)-Je(I.e/ne),fe=fe/ne|0),v=0;ce[v]==(he[v]||0);v++);if(ce[v]>(he[v]||0)&&O--,fe<0)Z.push(1),M=!0;else{for(ee=he.length,xe=ce.length,v=0,fe+=2,D=Qe(x/(ce[0]+1)),D>1&&(ce=b(ce,D,x),he=b(he,D,x),xe=ce.length,ee=he.length),X=xe,W=he.slice(0,xe),K=W.length;K<xe;W[K++]=0);oe=ce.slice(),oe=[0].concat(oe),le=ce[0],ce[1]>=x/2&&le++;do{if(D=0,C=w(ce,W,xe,K),C<0){if(G=W[0],xe!=K&&(G=G*x+(W[1]||0)),D=Qe(G/le),D>1)for(D>=x&&(D=x-1),_=b(ce,D,x),z=_.length,K=W.length;w(_,W,z,K)==1;)D--,T(_,xe<z?oe:ce,z,x),z=_.length,C=1;else D==0&&(C=D=1),_=ce.slice(),z=_.length;if(z<K&&(_=[0].concat(_)),T(W,_,K,x),K=W.length,C==-1)for(;w(ce,W,xe,K)<1;)D++,T(W,xe<K?oe:ce,K,x),K=W.length}else C===0&&(D++,W=[0]);Z[v++]=D,W[0]?W[K++]=he[X]||0:(W=[he[X]],K=1)}while((X++<ee||W[0]!=null)&&fe--);M=W[0]!=null,Z[0]||Z.splice(0,1)}if(x==dt){for(v=1,fe=Z[0];fe>=10;fe/=10,v++);F(V,$+(V.e=v+O*ne-1)+1,S,M)}else V.e=O,V.r=+M;return V}}();function P(b,w,T,N){var I,$,S,x,C;if(T==null?T=c:ye(T,0,8),!b.c)return b.toString();if(I=b.c[0],S=b.e,w==null)C=et(b.c),C=N==1||N==2&&(S<=a||S>=u)?ko(C,S):zt(C,S,"0");else if(b=F(new g(b),w,T),$=b.e,C=et(b.c),x=C.length,N==1||N==2&&(w<=$||$<=a)){for(;x<w;C+="0",x++);C=ko(C,$)}else if(w-=S+(N===2&&$>S),C=zt(C,$,"0"),$+1>x){if(--w>0)for(C+=".";w--;C+="0");}else if(w+=$-x,w>0)for($+1==x&&(C+=".");w--;C+="0");return b.s<0&&I?"-"+C:C}function k(b,w){for(var T,N,I=1,$=new g(b[0]);I<b.length;I++)N=new g(b[I]),(!N.s||(T=xn($,N))===w||T===0&&$.s===w)&&($=N);return $}function B(b,w,T){for(var N=1,I=w.length;!w[--I];w.pop());for(I=w[0];I>=10;I/=10,N++);return(T=N+T*ne-1)>f?b.c=b.e=null:T<l?b.c=[b.e=0]:(b.e=T,b.c=w),b}r=function(){var b=/^(-?)0([xbo])(?=\w[\w.]*$)/i,w=/^([^.]+)\.$/,T=/^\.([^.]+)$/,N=/^-?(Infinity|NaN)$/,I=/^\s*\+(?=[\w.])|^\s+|\s+$/g;return function($,S,x,C){var O,v=x?S:S.replace(I,"");if(N.test(v))$.s=isNaN(v)?null:v<0?-1:1;else{if(!x&&(v=v.replace(b,function(M,D,_){return O=(_=_.toLowerCase())=="x"?16:_=="b"?2:8,!C||C==O?D:M}),C&&(O=C,v=v.replace(w,"$1").replace(T,"0.$1")),S!=v))return new g(v,O);if(g.DEBUG)throw Error(Fe+"Not a"+(C?" base "+C:"")+" number: "+S);$.s=null}$.c=$.e=null}}();function F(b,w,T,N){var I,$,S,x,C,O,v,M=b.c,D=ni;if(M){e:{for(I=1,x=M[0];x>=10;x/=10,I++);if($=w-I,$<0)$+=ne,S=w,C=M[O=0],v=Qe(C/D[I-S-1]%10);else if(O=ei(($+1)/ne),O>=M.length)if(N){for(;M.length<=O;M.push(0));C=v=0,I=1,$%=ne,S=$-ne+1}else break e;else{for(C=x=M[O],I=1;x>=10;x/=10,I++);$%=ne,S=$-ne+I,v=S<0?0:Qe(C/D[I-S-1]%10)}if(N=N||w<0||M[O+1]!=null||(S<0?C:C%D[I-S-1]),N=T<4?(v||N)&&(T==0||T==(b.s<0?3:2)):v>5||v==5&&(T==4||N||T==6&&($>0?S>0?C/D[I-S]:0:M[O-1])%10&1||T==(b.s<0?8:7)),w<1||!M[0])return M.length=0,N?(w-=b.e+1,M[0]=D[(ne-w%ne)%ne],b.e=-w||0):M[0]=b.e=0,b;if($==0?(M.length=O,x=1,O--):(M.length=O+1,x=D[ne-$],M[O]=S>0?Qe(C/D[I-S]%D[S])*x:0),N)for(;;)if(O==0){for($=1,S=M[0];S>=10;S/=10,$++);for(S=M[0]+=x,x=1;S>=10;S/=10,x++);$!=x&&(b.e++,M[0]==dt&&(M[0]=1));break}else{if(M[O]+=x,M[O]!=dt)break;M[O--]=0,x=1}for($=M.length;M[--$]===0;M.pop());}b.e>f?b.c=b.e=null:b.e<l&&(b.c=[b.e=0])}return b}function j(b){var w,T=b.e;return T===null?b.toString():(w=et(b.c),w=T<=a||T>=u?ko(w,T):zt(w,T,"0"),b.s<0?"-"+w:w)}return o.absoluteValue=o.abs=function(){var b=new g(this);return b.s<0&&(b.s=1),b},o.comparedTo=function(b,w){return xn(this,new g(b,w))},o.decimalPlaces=o.dp=function(b,w){var T,N,I,$=this;if(b!=null)return ye(b,0,Ae),w==null?w=c:ye(w,0,8),F(new g($),b+$.e+1,w);if(!(T=$.c))return null;if(N=((I=T.length-1)-Je(this.e/ne))*ne,I=T[I])for(;I%10==0;I/=10,N--);return N<0&&(N=0),N},o.dividedBy=o.div=function(b,w){return t(this,new g(b,w),i,c)},o.dividedToIntegerBy=o.idiv=function(b,w){return t(this,new g(b,w),0,1)},o.exponentiatedBy=o.pow=function(b,w){var T,N,I,$,S,x,C,O,v,M=this;if(b=new g(b),b.c&&!b.isInteger())throw Error(Fe+"Exponent not an integer: "+j(b));if(w!=null&&(w=new g(w)),x=b.e>14,!M.c||!M.c[0]||M.c[0]==1&&!M.e&&M.c.length==1||!b.c||!b.c[0])return v=new g(Math.pow(+j(M),x?b.s*(2-Mo(b)):+j(b))),w?v.mod(w):v;if(C=b.s<0,w){if(w.c?!w.c[0]:!w.s)return new g(NaN);N=!C&&M.isInteger()&&w.isInteger(),N&&(M=M.mod(w))}else{if(b.e>9&&(M.e>0||M.e<-1||(M.e==0?M.c[0]>1||x&&M.c[1]>=24e7:M.c[0]<8e13||x&&M.c[0]<=9999975e7)))return $=M.s<0&&Mo(b)?-0:0,M.e>-1&&($=1/$),new g(C?1/$:$);h&&($=ei(h/ne+2))}for(x?(T=new g(.5),C&&(b.s=1),O=Mo(b)):(I=Math.abs(+j(b)),O=I%2),v=new g(s);;){if(O){if(v=v.times(M),!v.c)break;$?v.c.length>$&&(v.c.length=$):N&&(v=v.mod(w))}if(I){if(I=Qe(I/2),I===0)break;O=I%2}else if(b=b.times(T),F(b,b.e+1,1),b.e>14)O=Mo(b);else{if(I=+j(b),I===0)break;O=I%2}M=M.times(M),$?M.c&&M.c.length>$&&(M.c.length=$):N&&(M=M.mod(w))}return N?v:(C&&(v=s.div(v)),w?v.mod(w):$?F(v,h,c,S):v)},o.integerValue=function(b){var w=new g(this);return b==null?b=c:ye(b,0,8),F(w,w.e+1,b)},o.isEqualTo=o.eq=function(b,w){return xn(this,new g(b,w))===0},o.isFinite=function(){return!!this.c},o.isGreaterThan=o.gt=function(b,w){return xn(this,new g(b,w))>0},o.isGreaterThanOrEqualTo=o.gte=function(b,w){return(w=xn(this,new g(b,w)))===1||w===0},o.isInteger=function(){return!!this.c&&Je(this.e/ne)>this.c.length-2},o.isLessThan=o.lt=function(b,w){return xn(this,new g(b,w))<0},o.isLessThanOrEqualTo=o.lte=function(b,w){return(w=xn(this,new g(b,w)))===-1||w===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,w){var T,N,I,$,S=this,x=S.s;if(b=new g(b,w),w=b.s,!x||!w)return new g(NaN);if(x!=w)return b.s=-w,S.plus(b);var C=S.e/ne,O=b.e/ne,v=S.c,M=b.c;if(!C||!O){if(!v||!M)return v?(b.s=-w,b):new g(M?S:NaN);if(!v[0]||!M[0])return M[0]?(b.s=-w,b):new g(v[0]?S:c==3?-0:0)}if(C=Je(C),O=Je(O),v=v.slice(),x=C-O){for(($=x<0)?(x=-x,I=v):(O=C,I=M),I.reverse(),w=x;w--;I.push(0));I.reverse()}else for(N=($=(x=v.length)<(w=M.length))?x:w,x=w=0;w<N;w++)if(v[w]!=M[w]){$=v[w]<M[w];break}if($&&(I=v,v=M,M=I,b.s=-b.s),w=(N=M.length)-(T=v.length),w>0)for(;w--;v[T++]=0);for(w=dt-1;N>x;){if(v[--N]<M[N]){for(T=N;T&&!v[--T];v[T]=w);--v[T],v[N]+=dt}v[N]-=M[N]}for(;v[0]==0;v.splice(0,1),--O);return v[0]?B(b,v,O):(b.s=c==3?-1:1,b.c=[b.e=0],b)},o.modulo=o.mod=function(b,w){var T,N,I=this;return b=new g(b,w),!I.c||!b.s||b.c&&!b.c[0]?new g(NaN):!b.c||I.c&&!I.c[0]?new g(I):(d==9?(N=b.s,b.s=1,T=t(I,b,0,3),b.s=N,T.s*=N):T=t(I,b,0,d),b=I.minus(T.times(b)),!b.c[0]&&d==1&&(b.s=I.s),b)},o.multipliedBy=o.times=function(b,w){var T,N,I,$,S,x,C,O,v,M,D,_,z,V,Z,W=this,K=W.c,G=(b=new g(b,w)).c;if(!K||!G||!K[0]||!G[0])return!W.s||!b.s||K&&!K[0]&&!G||G&&!G[0]&&!K?b.c=b.e=b.s=null:(b.s*=W.s,!K||!G?b.c=b.e=null:(b.c=[0],b.e=0)),b;for(N=Je(W.e/ne)+Je(b.e/ne),b.s*=W.s,C=K.length,M=G.length,C<M&&(z=K,K=G,G=z,I=C,C=M,M=I),I=C+M,z=[];I--;z.push(0));for(V=dt,Z=un,I=M;--I>=0;){for(T=0,D=G[I]%Z,_=G[I]/Z|0,S=C,$=I+S;$>I;)O=K[--S]%Z,v=K[S]/Z|0,x=_*O+v*D,O=D*O+x%Z*Z+z[$]+T,T=(O/V|0)+(x/Z|0)+_*v,z[$--]=O%V;z[$]=T}return T?++N:z.splice(0,1),B(b,z,N)},o.negated=function(){var b=new g(this);return b.s=-b.s||null,b},o.plus=function(b,w){var T,N=this,I=N.s;if(b=new g(b,w),w=b.s,!I||!w)return new g(NaN);if(I!=w)return b.s=-w,N.minus(b);var $=N.e/ne,S=b.e/ne,x=N.c,C=b.c;if(!$||!S){if(!x||!C)return new g(I/0);if(!x[0]||!C[0])return C[0]?b:new g(x[0]?N:I*0)}if($=Je($),S=Je(S),x=x.slice(),I=$-S){for(I>0?(S=$,T=C):(I=-I,T=x),T.reverse();I--;T.push(0));T.reverse()}for(I=x.length,w=C.length,I-w<0&&(T=C,C=x,x=T,w=I),I=0;w;)I=(x[--w]=x[w]+C[w]+I)/dt|0,x[w]=dt===x[w]?0:x[w]%dt;return I&&(x=[I].concat(x),++S),B(b,x,S)},o.precision=o.sd=function(b,w){var T,N,I,$=this;if(b!=null&&b!==!!b)return ye(b,1,Ae),w==null?w=c:ye(w,0,8),F(new g($),b,w);if(!(T=$.c))return null;if(I=T.length-1,N=I*ne+1,I=T[I]){for(;I%10==0;I/=10,N--);for(I=T[0];I>=10;I/=10,N++);}return b&&$.e+1>N&&(N=$.e+1),N},o.shiftedBy=function(b){return ye(b,-ti,ti),this.times("1e"+b)},o.squareRoot=o.sqrt=function(){var b,w,T,N,I,$=this,S=$.c,x=$.s,C=$.e,O=i+4,v=new g("0.5");if(x!==1||!S||!S[0])return new g(!x||x<0&&(!S||S[0])?NaN:S?$:1/0);if(x=Math.sqrt(+j($)),x==0||x==1/0?(w=et(S),(w.length+C)%2==0&&(w+="0"),x=Math.sqrt(+w),C=Je((C+1)/2)-(C<0||C%2),x==1/0?w="5e"+C:(w=x.toExponential(),w=w.slice(0,w.indexOf("e")+1)+C),T=new g(w)):T=new g(x+""),T.c[0]){for(C=T.e,x=C+O,x<3&&(x=0);;)if(I=T,T=v.times(I.plus(t($,I,O,1))),et(I.c).slice(0,x)===(w=et(T.c)).slice(0,x))if(T.e<C&&--x,w=w.slice(x-3,x+1),w=="9999"||!N&&w=="4999"){if(!N&&(F(I,I.e+i+2,0),I.times(I).eq($))){T=I;break}O+=4,x+=4,N=1}else{(!+w||!+w.slice(1)&&w.charAt(0)=="5")&&(F(T,T.e+i+2,1),b=!T.times(T).eq($));break}}return F(T,T.e+i+1,c,b)},o.toExponential=function(b,w){return b!=null&&(ye(b,0,Ae),b++),P(this,b,w,1)},o.toFixed=function(b,w){return b!=null&&(ye(b,0,Ae),b=b+this.e+1),P(this,b,w)},o.toFormat=function(b,w,T){var N,I=this;if(T==null)b!=null&&w&&typeof w=="object"?(T=w,w=null):b&&typeof b=="object"?(T=b,b=w=null):T=m;else if(typeof T!="object")throw Error(Fe+"Argument not an object: "+T);if(N=I.toFixed(b,w),I.c){var $,S=N.split("."),x=+T.groupSize,C=+T.secondaryGroupSize,O=T.groupSeparator||"",v=S[0],M=S[1],D=I.s<0,_=D?v.slice(1):v,z=_.length;if(C&&($=x,x=C,C=$,z-=$),x>0&&z>0){for($=z%x||x,v=_.substr(0,$);$<z;$+=x)v+=O+_.substr($,x);C>0&&(v+=O+_.slice($)),D&&(v="-"+v)}N=M?v+(T.decimalSeparator||"")+((C=+T.fractionGroupSize)?M.replace(new RegExp("\\d{"+C+"}\\B","g"),"$&"+(T.fractionGroupSeparator||"")):M):v}return(T.prefix||"")+N+(T.suffix||"")},o.toFraction=function(b){var w,T,N,I,$,S,x,C,O,v,M,D,_=this,z=_.c;if(b!=null&&(x=new g(b),!x.isInteger()&&(x.c||x.s!==1)||x.lt(s)))throw Error(Fe+"Argument "+(x.isInteger()?"out of range: ":"not an integer: ")+j(x));if(!z)return new g(_);for(w=new g(s),O=T=new g(s),N=C=new g(s),D=et(z),$=w.e=D.length-_.e-1,w.c[0]=ni[(S=$%ne)<0?ne+S:S],b=!b||x.comparedTo(w)>0?$>0?w:O:x,S=f,f=1/0,x=new g(D),C.c[0]=0;v=t(x,w,0,1),I=T.plus(v.times(N)),I.comparedTo(b)!=1;)T=N,N=I,O=C.plus(v.times(I=O)),C=I,w=x.minus(v.times(I=w)),x=I;return I=t(b.minus(T),N,0,1),C=C.plus(I.times(O)),T=T.plus(I.times(N)),C.s=O.s=_.s,$=$*2,M=t(O,N,$,c).minus(_).abs().comparedTo(t(C,T,$,c).minus(_).abs())<1?[O,N]:[C,T],f=S,M},o.toNumber=function(){return+j(this)},o.toPrecision=function(b,w){return b!=null&&ye(b,1,Ae),P(this,b,w,2)},o.toString=function(b){var w,T=this,N=T.s,I=T.e;return I===null?N?(w="Infinity",N<0&&(w="-"+w)):w="NaN":(b==null?w=I<=a||I>=u?ko(et(T.c),I):zt(et(T.c),I,"0"):b===10&&A?(T=F(new g(T),i+I+1,c),w=zt(et(T.c),T.e,"0")):(ye(b,2,y.length,"Base"),w=n(zt(et(T.c),I,"0"),10,b,N,!0)),N<0&&T.c[0]&&(w="-"+w)),w},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&&g.set(e),g}function Je(e){var t=e|0;return e>0||e===t?t:t-1}function et(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 xn(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 ye(e,t,n,r){if(e<t||e>n||e!==Qe(e))throw Error(Fe+(r||"Argument")+(typeof e=="number"?e<t||e>n?" out of range: ":" not an integer: ":" not a primitive number: ")+String(e))}function Mo(e){var t=e.c.length-1;return Je(e.e/ne)==t&&e.c[t]%2!=0}function ko(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 ke=hu();const um=(e,t=6)=>{try{const n=new ke(e||"0");if(n.isNaN())return"0";const r=n.decimalPlaces(t,ke.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"}},Tt=()=>{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}}}},lm=()=>({openDeposit:E.useCallback(t=>{},[])}),fm=()=>({openWithdraw:E.useCallback(t=>{},[])});/**
36
36
  * @license lucide-react v0.540.0 - ISC
37
37
  *
38
38
  * This source code is licensed under the ISC license.
39
39
  * See the LICENSE file in the root directory of this source tree.
40
- */const hm=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),mm=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,n,r)=>r?r.toUpperCase():n.toLowerCase()),mu=e=>{const t=mm(e);return t.charAt(0).toUpperCase()+t.slice(1)},gu=(...e)=>e.filter((t,n,r)=>!!t&&t.trim()!==""&&r.indexOf(t)===n).join(" ").trim(),gm=e=>{for(const t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0};/**
40
+ */const dm=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),pm=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,n,r)=>r?r.toUpperCase():n.toLowerCase()),mu=e=>{const t=pm(e);return t.charAt(0).toUpperCase()+t.slice(1)},gu=(...e)=>e.filter((t,n,r)=>!!t&&t.trim()!==""&&r.indexOf(t)===n).join(" ").trim(),hm=e=>{for(const t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0};/**
41
41
  * @license lucide-react v0.540.0 - ISC
42
42
  *
43
43
  * This source code is licensed under the ISC license.
44
44
  * See the LICENSE file in the root directory of this source tree.
45
- */var bm={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"};/**
45
+ */var mm={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"};/**
46
46
  * @license lucide-react v0.540.0 - ISC
47
47
  *
48
48
  * This source code is licensed under the ISC license.
49
49
  * See the LICENSE file in the root directory of this source tree.
50
- */const ym=E.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:o="",children:s,iconNode:i,...c},a)=>E.createElement("svg",{ref:a,...bm,width:t,height:t,stroke:e,strokeWidth:r?Number(n)*24/Number(t):n,className:gu("lucide",o),...!s&&!gm(c)&&{"aria-hidden":"true"},...c},[...i.map(([u,l])=>E.createElement(u,l)),...Array.isArray(s)?s:[s]]));/**
50
+ */const gm=E.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:o="",children:s,iconNode:i,...c},a)=>E.createElement("svg",{ref:a,...mm,width:t,height:t,stroke:e,strokeWidth:r?Number(n)*24/Number(t):n,className:gu("lucide",o),...!s&&!hm(c)&&{"aria-hidden":"true"},...c},[...i.map(([u,l])=>E.createElement(u,l)),...Array.isArray(s)?s:[s]]));/**
51
51
  * @license lucide-react v0.540.0 - ISC
52
52
  *
53
53
  * This source code is licensed under the ISC license.
54
54
  * See the LICENSE file in the root directory of this source tree.
55
- */const vm=(e,t)=>{const n=E.forwardRef(({className:r,...o},s)=>E.createElement(ym,{ref:s,iconNode:t,className:gu(`lucide-${hm(mu(e))}`,`lucide-${e}`,r),...o}));return n.displayName=mu(e),n};/**
55
+ */const bm=(e,t)=>{const n=E.forwardRef(({className:r,...o},s)=>E.createElement(gm,{ref:s,iconNode:t,className:gu(`lucide-${dm(mu(e))}`,`lucide-${e}`,r),...o}));return n.displayName=mu(e),n};/**
56
56
  * @license lucide-react v0.540.0 - ISC
57
57
  *
58
58
  * This source code is licensed under the ISC license.
59
59
  * See the LICENSE file in the root directory of this source tree.
60
- */const bu=vm("x",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);class yu{constructor(){Xe(this,"state");this.state={isLoading:!1,isApproving:!1,isDepositing:!1,error:null,txHash:null}}getState(){return{...this.state}}setState(t){this.state={...this.state,...t}}}class wm extends yu{constructor(n,r){super();Xe(this,"smartWallet");Xe(this,"currentActiveAccount");this.smartWallet=n,this.currentActiveAccount=r}getWalletType(){return"mpc"}getDisplayAddress(){var n;return((n=this.smartWallet)==null?void 0:n.address)||""}isApprovalRequired(){return!1}getApprovalStatus(){return!0}async connect(){this.setState({isLoading:!0,error:null});try{this.setState({isLoading:!1})}catch(n){throw this.setState({isLoading:!1,error:n instanceof Error?n.message:"Connection failed"}),n}}async disconnect(){}async switchChain(n){}async getBalance(n){return"0"}async approve(n,r){return""}async deposit(n,r){this.setState({isDepositing:!0,error:null});try{const o=`mpc_deposit_${Date.now()}`;return this.setState({isDepositing:!1,txHash:o}),o}catch(o){throw this.setState({isDepositing:!1,error:o instanceof Error?o.message:"Deposit failed"}),o}}async signMessage(n){return`mpc_signature_${Date.now()}`}getAAWalletAddress(){var n,r;return((n=this.smartWallet)==null?void 0:n.address)||((r=this.currentActiveAccount)==null?void 0:r.ethAddress)||""}}class xm extends yu{constructor(n,r,o,s="0",i="0"){super();Xe(this,"currentActiveAccount");Xe(this,"approved");Xe(this,"chainId");Xe(this,"balance");Xe(this,"allowance");this.currentActiveAccount=n,this.approved=r,this.chainId=o,this.balance=s,this.allowance=i}getWalletType(){return"evm"}getDisplayAddress(){var n;return((n=this.currentActiveAccount)==null?void 0:n.ethAddress)||""}isApprovalRequired(){return!0}getApprovalStatus(){return this.approved}async connect(){this.setState({isLoading:!0,error:null});try{this.setState({isLoading:!1})}catch(n){throw this.setState({isLoading:!1,error:n instanceof Error?n.message:"Connection failed"}),n}}async disconnect(){}async switchChain(n){this.setState({isLoading:!0,error:null});try{this.chainId=n,this.setState({isLoading:!1})}catch(r){throw this.setState({isLoading:!1,error:r instanceof Error?r.message:"Chain switch failed"}),r}}async getBalance(n){return this.balance}async approve(n,r){this.setState({isApproving:!0,error:null});try{const o=`evm_approve_${Date.now()}`;return this.approved=!0,this.setState({isApproving:!1,txHash:o}),o}catch(o){throw this.setState({isApproving:!1,error:o instanceof Error?o.message:"Approval failed"}),o}}async deposit(n,r){this.setState({isDepositing:!0,error:null});try{if(!this.approved)throw new Error("Token approval required");const o=`evm_deposit_${Date.now()}`;return this.setState({isDepositing:!1,txHash:o}),o}catch(o){throw this.setState({isDepositing:!1,error:o instanceof Error?o.message:"Deposit failed"}),o}}async signMessage(n){return`evm_signature_${Date.now()}`}updateApprovalStatus(n){this.approved=n}updateBalance(n){this.balance=n}updateAllowance(n){this.allowance=n}}function vu(e,t,n,r,o,s){switch(e==null?void 0:e.wallet){case"mpc":return new wm(t,e);default:return new xm(e,!1,r||1,o,s)}}const wu=typeof document<"u"?E.useLayoutEffect:()=>{};var ri;const Em=(ri=E.useInsertionEffect)!==null&&ri!==void 0?ri:wu;function Sm(e){const t=E.useRef(null);return Em(()=>{t.current=e},[e]),E.useCallback((...n)=>{const r=t.current;return r==null?void 0:r(...n)},[])}const ln=e=>{var t;return(t=e==null?void 0:e.ownerDocument)!==null&&t!==void 0?t:document},Sn=e=>e&&"window"in e&&e.window===e?e:ln(e).defaultView||window;function Pm(e){return e!==null&&typeof e=="object"&&"nodeType"in e&&typeof e.nodeType=="number"}function $m(e){return Pm(e)&&e.nodeType===Node.DOCUMENT_FRAGMENT_NODE&&"host"in e}let Am=!1;function oi(){return Am}function xu(e,t){if(!oi())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:$m(n)?n=n.host:n=n.parentNode}return!1}const si=(e=document)=>{var t;if(!oi())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 Eu(e){return oi()&&e.target.shadowRoot&&e.composedPath?e.composedPath()[0]:e.target}function Bo(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 ii(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 Ut(e){if(process.env.NODE_ENV==="test")return e;let t=null;return()=>(t==null&&(t=e()),t)}const ai=Ut(function(){return ii(/^Mac/i)}),Tm=Ut(function(){return ii(/^iPhone/i)}),Cm=Ut(function(){return ii(/^iPad/i)||ai()&&navigator.maxTouchPoints>1}),Om=Ut(function(){return Tm()||Cm()});Ut(function(){return ai()||Om()}),Ut(function(){return Bo(/AppleWebKit/i)&&!Nm()});const Nm=Ut(function(){return Bo(/Chrome/i)}),Im=Ut(function(){return Bo(/Android/i)});Ut(function(){return Bo(/Firefox/i)});function Su(){let e=E.useRef(new Map),t=E.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=E.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=E.useCallback(()=>{e.current.forEach((o,s)=>{n(o.eventTarget,o.type,s,o.options)})},[n]);return E.useEffect(()=>r,[r]),{addGlobalListener:t,removeGlobalListener:n,removeAllGlobalListeners:r}}function Mm(e){return e.mozInputSource===0&&e.isTrusted?!0:Im()&&e.pointerType?e.type==="click"&&e.buttons===1:e.detail===0&&!e.pointerType}function Pu(e){let t=e;return t.nativeEvent=e,t.isDefaultPrevented=()=>t.defaultPrevented,t.isPropagationStopped=()=>t.cancelBubble,t.persist=()=>{},t}function Lm(e,t){Object.defineProperty(e,"target",{value:t}),Object.defineProperty(e,"currentTarget",{value:t})}function $u(e){let t=E.useRef({isFocused:!1,observer:null});wu(()=>{const r=t.current;return()=>{r.observer&&(r.observer.disconnect(),r.observer=null)}},[]);let n=Sm(r=>{e==null||e(r)});return E.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=Pu(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 Bm=!1,Or=null,ci=new Set,Nr=new Map,Pn=!1,ui=!1;const km={Tab:!0,Escape:!0};function li(e,t){for(let n of ci)n(e,t)}function Rm(e){return!(e.metaKey||!ai()&&e.altKey||e.ctrlKey||e.key==="Control"||e.key==="Shift"||e.key==="Meta")}function ko(e){Pn=!0,Rm(e)&&(Or="keyboard",li("keyboard",e))}function tt(e){Or="pointer",(e.type==="mousedown"||e.type==="pointerdown")&&(Pn=!0,li("pointer",e))}function Au(e){Mm(e)&&(Pn=!0,Or="virtual")}function Tu(e){e.target===window||e.target===document||Bm||!e.isTrusted||(!Pn&&!ui&&(Or="virtual",li("virtual",e)),Pn=!1,ui=!1)}function Cu(){Pn=!1,ui=!0}function fi(e){if(typeof window>"u"||typeof document>"u"||Nr.get(Sn(e)))return;const t=Sn(e),n=ln(e);let r=t.HTMLElement.prototype.focus;t.HTMLElement.prototype.focus=function(){Pn=!0,r.apply(this,arguments)},n.addEventListener("keydown",ko,!0),n.addEventListener("keyup",ko,!0),n.addEventListener("click",Au,!0),t.addEventListener("focus",Tu,!0),t.addEventListener("blur",Cu,!1),typeof PointerEvent<"u"?(n.addEventListener("pointerdown",tt,!0),n.addEventListener("pointermove",tt,!0),n.addEventListener("pointerup",tt,!0)):process.env.NODE_ENV==="test"&&(n.addEventListener("mousedown",tt,!0),n.addEventListener("mousemove",tt,!0),n.addEventListener("mouseup",tt,!0)),t.addEventListener("beforeunload",()=>{Ou(e)},{once:!0}),Nr.set(t,{focus:r})}const Ou=(e,t)=>{const n=Sn(e),r=ln(e);t&&r.removeEventListener("DOMContentLoaded",t),Nr.has(n)&&(n.HTMLElement.prototype.focus=Nr.get(n).focus,r.removeEventListener("keydown",ko,!0),r.removeEventListener("keyup",ko,!0),r.removeEventListener("click",Au,!0),n.removeEventListener("focus",Tu,!0),n.removeEventListener("blur",Cu,!1),typeof PointerEvent<"u"?(r.removeEventListener("pointerdown",tt,!0),r.removeEventListener("pointermove",tt,!0),r.removeEventListener("pointerup",tt,!0)):process.env.NODE_ENV==="test"&&(r.removeEventListener("mousedown",tt,!0),r.removeEventListener("mousemove",tt,!0),r.removeEventListener("mouseup",tt,!0)),Nr.delete(n))};function Fm(e){const t=ln(e);let n;return t.readyState!=="loading"?fi(e):(n=()=>{fi(e)},t.addEventListener("DOMContentLoaded",n)),()=>Ou(e,n)}typeof document<"u"&&Fm();function Nu(){return Or!=="pointer"}const Dm=new Set(["checkbox","radio","range","color","file","image","button","submit","reset"]);function jm(e,t,n){let r=ln(n==null?void 0:n.target);const o=typeof window<"u"?Sn(n==null?void 0:n.target).HTMLInputElement:HTMLInputElement,s=typeof window<"u"?Sn(n==null?void 0:n.target).HTMLTextAreaElement:HTMLTextAreaElement,i=typeof window<"u"?Sn(n==null?void 0:n.target).HTMLElement:HTMLElement,c=typeof window<"u"?Sn(n==null?void 0:n.target).KeyboardEvent:KeyboardEvent;return e=e||r.activeElement instanceof o&&!Dm.has(r.activeElement.type)||r.activeElement instanceof s||r.activeElement instanceof i&&r.activeElement.isContentEditable,!(e&&t==="keyboard"&&n instanceof c&&!km[n.key])}function _m(e,t,n){fi(),E.useEffect(()=>{let r=(o,s)=>{jm(!!(n!=null&&n.isTextInput),o,s)&&e(Nu())};return ci.add(r),()=>{ci.delete(r)}},t)}function Um(e){let{isDisabled:t,onFocus:n,onBlur:r,onFocusChange:o}=e;const s=E.useCallback(a=>{if(a.target===a.currentTarget)return r&&r(a),o&&o(!1),!0},[r,o]),i=$u(s),c=E.useCallback(a=>{const u=ln(a.target),l=u?si(u):si();a.target===a.currentTarget&&l===Eu(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 zm(e){let{isDisabled:t,onBlurWithin:n,onFocusWithin:r,onFocusWithinChange:o}=e,s=E.useRef({isFocusWithin:!1}),{addGlobalListener:i,removeAllGlobalListeners:c}=Su(),a=E.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=$u(a),l=E.useCallback(f=>{if(!f.currentTarget.contains(f.target))return;const p=ln(f.target),d=si(p);if(!s.current.isFocusWithin&&d===Eu(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&&!xu(h,m.target)){let v=new p.defaultView.FocusEvent("blur",{relatedTarget:m.target});Lm(v,h);let C=Pu(v);a(C)}},{capture:!0})}},[r,o,u,i,a]);return t?{focusWithinProps:{onFocus:void 0,onBlur:void 0}}:{focusWithinProps:{onFocus:l,onBlur:a}}}let Ro=!1,Fo=0;function di(){Ro=!0,setTimeout(()=>{Ro=!1},50)}function Iu(e){e.pointerType==="touch"&&di()}function Wm(){if(!(typeof document>"u"))return Fo===0&&(typeof PointerEvent<"u"?document.addEventListener("pointerup",Iu):process.env.NODE_ENV==="test"&&document.addEventListener("touchend",di)),Fo++,()=>{Fo--,!(Fo>0)&&(typeof PointerEvent<"u"?document.removeEventListener("pointerup",Iu):process.env.NODE_ENV==="test"&&document.removeEventListener("touchend",di))}}function Hm(e){let{onHoverStart:t,onHoverChange:n,onHoverEnd:r,isDisabled:o}=e,[s,i]=E.useState(!1),c=E.useRef({isHovered:!1,ignoreEmulatedMouseEvents:!1,pointerType:"",target:null}).current;E.useEffect(Wm,[]);let{addGlobalListener:a,removeAllGlobalListeners:u}=Su(),{hoverProps:l,triggerHoverEnd:f}=E.useMemo(()=>{let p=(m,v)=>{if(c.pointerType=v,o||v==="touch"||c.isHovered||!m.currentTarget.contains(m.target))return;c.isHovered=!0;let C=m.currentTarget;c.target=C,a(ln(m.target),"pointerover",y=>{c.isHovered&&c.target&&!xu(c.target,y.target)&&d(y,y.pointerType)},{capture:!0}),t&&t({type:"hoverstart",target:C,pointerType:v}),n&&n(!0),i(!0)},d=(m,v)=>{let C=c.target;c.pointerType="",c.target=null,!(v==="touch"||!c.isHovered||!C)&&(c.isHovered=!1,u(),r&&r({type:"hoverend",target:C,pointerType:v}),n&&n(!1),i(!1))},h={};return typeof PointerEvent<"u"?(h.onPointerEnter=m=>{Ro&&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&&!Ro&&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 E.useEffect(()=>{o&&f({currentTarget:c.target},c.pointerType)},[o]),{hoverProps:l,isHovered:s}}function Vm(e={}){let{autoFocus:t=!1,isTextInput:n,within:r}=e,o=E.useRef({isFocused:!1,isFocusVisible:t||Nu()}),[s,i]=E.useState(!1),[c,a]=E.useState(()=>o.current.isFocused&&o.current.isFocusVisible),u=E.useCallback(()=>a(o.current.isFocused&&o.current.isFocusVisible),[]),l=E.useCallback(d=>{o.current.isFocused=d,i(d),u()},[u]);_m(d=>{o.current.isFocusVisible=d,u()},[],{isTextInput:n});let{focusProps:f}=Um({isDisabled:r,onFocusChange:l}),{focusWithinProps:p}=zm({isDisabled:!r,onFocusWithinChange:l});return{isFocused:s,isFocusVisible:c,focusProps:r?p:f}}var Gm=Object.defineProperty,qm=(e,t,n)=>t in e?Gm(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,pi=(e,t,n)=>(qm(e,typeof t!="symbol"?t+"":t,n),n);let Zm=class{constructor(){pi(this,"current",this.detect()),pi(this,"handoffState","pending"),pi(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"}},At=new Zm;function Ir(e){var t,n;return At.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 Mu(e){typeof queueMicrotask=="function"?queueMicrotask(e):Promise.resolve().then(e).catch(t=>setTimeout(()=>{throw t}))}function ht(){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 Mu(()=>{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=ht();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 Vn(){let[e]=E.useState(ht);return E.useEffect(()=>()=>e.dispose(),[e]),e}let ge=(e,t)=>{At.isServer?E.useEffect(e,t):E.useLayoutEffect(e,t)};function $n(e){let t=E.useRef(e);return ge(()=>{t.current=e},[e]),t}let ae=function(e){let t=$n(e);return E.useCallback((...n)=>t.current(...n),[t])};function Km(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 Ym(e,t){return!(!e||!t||e.right<t.left||e.left>t.right||e.bottom<t.top||e.top>t.bottom)}function Xm({disabled:e=!1}={}){let t=E.useRef(null),[n,r]=E.useState(!1),o=Vn(),s=ae(()=>{t.current=null,r(!1),o.dispose()}),i=ae(c=>{if(o.dispose(),t.current===null){t.current=c.currentTarget,r(!0);{let a=Ir(c.currentTarget);o.addEventListener(a,"pointerup",s,!1),o.addEventListener(a,"pointermove",u=>{if(t.current){let l=Km(u);r(Ym(l,t.current.getBoundingClientRect()))}},!1),o.addEventListener(a,"pointercancel",s,!1)}}});return{pressed:n,pressProps:e?{}:{onPointerDown:i,onPointerUp:s,onClick:s}}}let Qm=E.createContext(void 0);function hi(){return E.useContext(Qm)}function mi(...e){return Array.from(new Set(e.flatMap(t=>typeof t=="string"?t.split(" "):[]))).filter(Boolean).join(" ")}function nt(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,nt),r}var Do=(e=>(e[e.None=0]="None",e[e.RenderStrategy=1]="RenderStrategy",e[e.Static=2]="Static",e))(Do||{}),fn=(e=>(e[e.Unmount=0]="Unmount",e[e.Hidden=1]="Hidden",e))(fn||{});function Ze(){let e=eg();return E.useCallback(t=>Jm({mergeRefs:e,...t}),[e])}function Jm({ourProps:e,theirProps:t,slot:n,defaultTag:r,features:o,visible:s=!0,name:i,mergeRefs:c}){c=c??tg;let a=Lu(t,e);if(s)return jo(a,n,r,i,c);let u=o??0;if(u&2){let{static:l=!1,...f}=a;if(l)return jo(f,n,r,i,c)}if(u&1){let{unmount:l=!0,...f}=a;return nt(l?0:1,{0(){return null},1(){return jo({...f,hidden:!0,style:{display:"none"}},n,r,i,c)}})}return jo(a,n,r,i,c)}function jo(e,t={},n,r,o){let{as:s=n,children:i,refName:c="ref",...a}=gi(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===E.Fragment&&(Object.keys(dn(a)).length>0||Object.keys(dn(f)).length>0))if(!E.isValidElement(l)||Array.isArray(l)&&l.length>1){if(Object.keys(dn(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(dn(a)).concat(Object.keys(dn(f))).map(p=>` - ${p}`).join(`
60
+ */const bu=bm("x",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);class yu{constructor(){Xe(this,"state");this.state={isLoading:!1,isApproving:!1,isDepositing:!1,error:null,txHash:null}}getState(){return{...this.state}}setState(t){this.state={...this.state,...t}}}class ym extends yu{constructor(n,r){super();Xe(this,"smartWallet");Xe(this,"currentActiveAccount");this.smartWallet=n,this.currentActiveAccount=r}getWalletType(){return"mpc"}getDisplayAddress(){var n;return((n=this.smartWallet)==null?void 0:n.address)||""}isApprovalRequired(){return!1}getApprovalStatus(){return!0}async connect(){this.setState({isLoading:!0,error:null});try{this.setState({isLoading:!1})}catch(n){throw this.setState({isLoading:!1,error:n instanceof Error?n.message:"Connection failed"}),n}}async disconnect(){}async switchChain(n){}async getBalance(n){return"0"}async approve(n,r){return""}async deposit(n,r){this.setState({isDepositing:!0,error:null});try{const o=`mpc_deposit_${Date.now()}`;return this.setState({isDepositing:!1,txHash:o}),o}catch(o){throw this.setState({isDepositing:!1,error:o instanceof Error?o.message:"Deposit failed"}),o}}async signMessage(n){return`mpc_signature_${Date.now()}`}getAAWalletAddress(){var n,r;return((n=this.smartWallet)==null?void 0:n.address)||((r=this.currentActiveAccount)==null?void 0:r.ethAddress)||""}}class vm extends yu{constructor(n,r,o,s="0",i="0"){super();Xe(this,"currentActiveAccount");Xe(this,"approved");Xe(this,"chainId");Xe(this,"balance");Xe(this,"allowance");this.currentActiveAccount=n,this.approved=r,this.chainId=o,this.balance=s,this.allowance=i}getWalletType(){return"evm"}getDisplayAddress(){var n;return((n=this.currentActiveAccount)==null?void 0:n.ethAddress)||""}isApprovalRequired(){return!0}getApprovalStatus(){return this.approved}async connect(){this.setState({isLoading:!0,error:null});try{this.setState({isLoading:!1})}catch(n){throw this.setState({isLoading:!1,error:n instanceof Error?n.message:"Connection failed"}),n}}async disconnect(){}async switchChain(n){this.setState({isLoading:!0,error:null});try{this.chainId=n,this.setState({isLoading:!1})}catch(r){throw this.setState({isLoading:!1,error:r instanceof Error?r.message:"Chain switch failed"}),r}}async getBalance(n){return this.balance}async approve(n,r){this.setState({isApproving:!0,error:null});try{const o=`evm_approve_${Date.now()}`;return this.approved=!0,this.setState({isApproving:!1,txHash:o}),o}catch(o){throw this.setState({isApproving:!1,error:o instanceof Error?o.message:"Approval failed"}),o}}async deposit(n,r){this.setState({isDepositing:!0,error:null});try{if(!this.approved)throw new Error("Token approval required");const o=`evm_deposit_${Date.now()}`;return this.setState({isDepositing:!1,txHash:o}),o}catch(o){throw this.setState({isDepositing:!1,error:o instanceof Error?o.message:"Deposit failed"}),o}}async signMessage(n){return`evm_signature_${Date.now()}`}updateApprovalStatus(n){this.approved=n}updateBalance(n){this.balance=n}updateAllowance(n){this.allowance=n}}function vu(e,t,n,r,o,s){switch(e==null?void 0:e.wallet){case"mpc":return new ym(t,e);default:return new vm(e,!1,r||1,o,s)}}const wm=({tokens:e,selectedToken:t,onTokenChange:n})=>L.jsx("div",{className:"bg-fill-input-primary flex rounded-lg p-1",children:e.map(r=>L.jsxs("button",{className:`flex-1 font-medium rounded-md flex items-center justify-center text-sm h-[30px] ${t.token===r.token?"bg-fill-btn-primary text-text-black-static":"text-text-primary"}`,onClick:()=>n(r),children:[L.jsx("img",{src:r.iconUrl,alt:r.token,className:"w-4 h-4 rounded-full"}),L.jsx("span",{className:"ml-1",children:r.symbol||r.token})]},r.token))}),wu=typeof document<"u"?E.useLayoutEffect:()=>{};var ri;const xm=(ri=E.useInsertionEffect)!==null&&ri!==void 0?ri:wu;function Em(e){const t=E.useRef(null);return xm(()=>{t.current=e},[e]),E.useCallback((...n)=>{const r=t.current;return r==null?void 0:r(...n)},[])}const ln=e=>{var t;return(t=e==null?void 0:e.ownerDocument)!==null&&t!==void 0?t:document},En=e=>e&&"window"in e&&e.window===e?e:ln(e).defaultView||window;function Sm(e){return e!==null&&typeof e=="object"&&"nodeType"in e&&typeof e.nodeType=="number"}function Pm(e){return Sm(e)&&e.nodeType===Node.DOCUMENT_FRAGMENT_NODE&&"host"in e}let $m=!1;function oi(){return $m}function xu(e,t){if(!oi())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:Pm(n)?n=n.host:n=n.parentNode}return!1}const si=(e=document)=>{var t;if(!oi())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 Eu(e){return oi()&&e.target.shadowRoot&&e.composedPath?e.composedPath()[0]:e.target}function Lo(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 ii(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 Wt(e){if(process.env.NODE_ENV==="test")return e;let t=null;return()=>(t==null&&(t=e()),t)}const ai=Wt(function(){return ii(/^Mac/i)}),Tm=Wt(function(){return ii(/^iPhone/i)}),Am=Wt(function(){return ii(/^iPad/i)||ai()&&navigator.maxTouchPoints>1}),Cm=Wt(function(){return Tm()||Am()});Wt(function(){return ai()||Cm()}),Wt(function(){return Lo(/AppleWebKit/i)&&!Om()});const Om=Wt(function(){return Lo(/Chrome/i)}),Im=Wt(function(){return Lo(/Android/i)});Wt(function(){return Lo(/Firefox/i)});function Su(){let e=E.useRef(new Map),t=E.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=E.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=E.useCallback(()=>{e.current.forEach((o,s)=>{n(o.eventTarget,o.type,s,o.options)})},[n]);return E.useEffect(()=>r,[r]),{addGlobalListener:t,removeGlobalListener:n,removeAllGlobalListeners:r}}function Nm(e){return e.mozInputSource===0&&e.isTrusted?!0:Im()&&e.pointerType?e.type==="click"&&e.buttons===1:e.detail===0&&!e.pointerType}function Pu(e){let t=e;return t.nativeEvent=e,t.isDefaultPrevented=()=>t.defaultPrevented,t.isPropagationStopped=()=>t.cancelBubble,t.persist=()=>{},t}function Mm(e,t){Object.defineProperty(e,"target",{value:t}),Object.defineProperty(e,"currentTarget",{value:t})}function $u(e){let t=E.useRef({isFocused:!1,observer:null});wu(()=>{const r=t.current;return()=>{r.observer&&(r.observer.disconnect(),r.observer=null)}},[]);let n=Em(r=>{e==null||e(r)});return E.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=Pu(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 km=!1,Or=null,ci=new Set,Ir=new Map,Sn=!1,ui=!1;const Lm={Tab:!0,Escape:!0};function li(e,t){for(let n of ci)n(e,t)}function Bm(e){return!(e.metaKey||!ai()&&e.altKey||e.ctrlKey||e.key==="Control"||e.key==="Shift"||e.key==="Meta")}function Bo(e){Sn=!0,Bm(e)&&(Or="keyboard",li("keyboard",e))}function tt(e){Or="pointer",(e.type==="mousedown"||e.type==="pointerdown")&&(Sn=!0,li("pointer",e))}function Tu(e){Nm(e)&&(Sn=!0,Or="virtual")}function Au(e){e.target===window||e.target===document||km||!e.isTrusted||(!Sn&&!ui&&(Or="virtual",li("virtual",e)),Sn=!1,ui=!1)}function Cu(){Sn=!1,ui=!0}function fi(e){if(typeof window>"u"||typeof document>"u"||Ir.get(En(e)))return;const t=En(e),n=ln(e);let r=t.HTMLElement.prototype.focus;t.HTMLElement.prototype.focus=function(){Sn=!0,r.apply(this,arguments)},n.addEventListener("keydown",Bo,!0),n.addEventListener("keyup",Bo,!0),n.addEventListener("click",Tu,!0),t.addEventListener("focus",Au,!0),t.addEventListener("blur",Cu,!1),typeof PointerEvent<"u"?(n.addEventListener("pointerdown",tt,!0),n.addEventListener("pointermove",tt,!0),n.addEventListener("pointerup",tt,!0)):process.env.NODE_ENV==="test"&&(n.addEventListener("mousedown",tt,!0),n.addEventListener("mousemove",tt,!0),n.addEventListener("mouseup",tt,!0)),t.addEventListener("beforeunload",()=>{Ou(e)},{once:!0}),Ir.set(t,{focus:r})}const Ou=(e,t)=>{const n=En(e),r=ln(e);t&&r.removeEventListener("DOMContentLoaded",t),Ir.has(n)&&(n.HTMLElement.prototype.focus=Ir.get(n).focus,r.removeEventListener("keydown",Bo,!0),r.removeEventListener("keyup",Bo,!0),r.removeEventListener("click",Tu,!0),n.removeEventListener("focus",Au,!0),n.removeEventListener("blur",Cu,!1),typeof PointerEvent<"u"?(r.removeEventListener("pointerdown",tt,!0),r.removeEventListener("pointermove",tt,!0),r.removeEventListener("pointerup",tt,!0)):process.env.NODE_ENV==="test"&&(r.removeEventListener("mousedown",tt,!0),r.removeEventListener("mousemove",tt,!0),r.removeEventListener("mouseup",tt,!0)),Ir.delete(n))};function Rm(e){const t=ln(e);let n;return t.readyState!=="loading"?fi(e):(n=()=>{fi(e)},t.addEventListener("DOMContentLoaded",n)),()=>Ou(e,n)}typeof document<"u"&&Rm();function Iu(){return Or!=="pointer"}const Dm=new Set(["checkbox","radio","range","color","file","image","button","submit","reset"]);function Fm(e,t,n){let r=ln(n==null?void 0:n.target);const o=typeof window<"u"?En(n==null?void 0:n.target).HTMLInputElement:HTMLInputElement,s=typeof window<"u"?En(n==null?void 0:n.target).HTMLTextAreaElement:HTMLTextAreaElement,i=typeof window<"u"?En(n==null?void 0:n.target).HTMLElement:HTMLElement,c=typeof window<"u"?En(n==null?void 0:n.target).KeyboardEvent:KeyboardEvent;return e=e||r.activeElement instanceof o&&!Dm.has(r.activeElement.type)||r.activeElement instanceof s||r.activeElement instanceof i&&r.activeElement.isContentEditable,!(e&&t==="keyboard"&&n instanceof c&&!Lm[n.key])}function jm(e,t,n){fi(),E.useEffect(()=>{let r=(o,s)=>{Fm(!!(n!=null&&n.isTextInput),o,s)&&e(Iu())};return ci.add(r),()=>{ci.delete(r)}},t)}function _m(e){let{isDisabled:t,onFocus:n,onBlur:r,onFocusChange:o}=e;const s=E.useCallback(a=>{if(a.target===a.currentTarget)return r&&r(a),o&&o(!1),!0},[r,o]),i=$u(s),c=E.useCallback(a=>{const u=ln(a.target),l=u?si(u):si();a.target===a.currentTarget&&l===Eu(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 Um(e){let{isDisabled:t,onBlurWithin:n,onFocusWithin:r,onFocusWithinChange:o}=e,s=E.useRef({isFocusWithin:!1}),{addGlobalListener:i,removeAllGlobalListeners:c}=Su(),a=E.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=$u(a),l=E.useCallback(f=>{if(!f.currentTarget.contains(f.target))return;const p=ln(f.target),d=si(p);if(!s.current.isFocusWithin&&d===Eu(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&&!xu(h,m.target)){let y=new p.defaultView.FocusEvent("blur",{relatedTarget:m.target});Mm(y,h);let A=Pu(y);a(A)}},{capture:!0})}},[r,o,u,i,a]);return t?{focusWithinProps:{onFocus:void 0,onBlur:void 0}}:{focusWithinProps:{onFocus:l,onBlur:a}}}let Ro=!1,Do=0;function di(){Ro=!0,setTimeout(()=>{Ro=!1},50)}function Nu(e){e.pointerType==="touch"&&di()}function zm(){if(!(typeof document>"u"))return Do===0&&(typeof PointerEvent<"u"?document.addEventListener("pointerup",Nu):process.env.NODE_ENV==="test"&&document.addEventListener("touchend",di)),Do++,()=>{Do--,!(Do>0)&&(typeof PointerEvent<"u"?document.removeEventListener("pointerup",Nu):process.env.NODE_ENV==="test"&&document.removeEventListener("touchend",di))}}function Wm(e){let{onHoverStart:t,onHoverChange:n,onHoverEnd:r,isDisabled:o}=e,[s,i]=E.useState(!1),c=E.useRef({isHovered:!1,ignoreEmulatedMouseEvents:!1,pointerType:"",target:null}).current;E.useEffect(zm,[]);let{addGlobalListener:a,removeAllGlobalListeners:u}=Su(),{hoverProps:l,triggerHoverEnd:f}=E.useMemo(()=>{let p=(m,y)=>{if(c.pointerType=y,o||y==="touch"||c.isHovered||!m.currentTarget.contains(m.target))return;c.isHovered=!0;let A=m.currentTarget;c.target=A,a(ln(m.target),"pointerover",g=>{c.isHovered&&c.target&&!xu(c.target,g.target)&&d(g,g.pointerType)},{capture:!0}),t&&t({type:"hoverstart",target:A,pointerType:y}),n&&n(!0),i(!0)},d=(m,y)=>{let A=c.target;c.pointerType="",c.target=null,!(y==="touch"||!c.isHovered||!A)&&(c.isHovered=!1,u(),r&&r({type:"hoverend",target:A,pointerType:y}),n&&n(!1),i(!1))},h={};return typeof PointerEvent<"u"?(h.onPointerEnter=m=>{Ro&&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&&!Ro&&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 E.useEffect(()=>{o&&f({currentTarget:c.target},c.pointerType)},[o]),{hoverProps:l,isHovered:s}}function Hm(e={}){let{autoFocus:t=!1,isTextInput:n,within:r}=e,o=E.useRef({isFocused:!1,isFocusVisible:t||Iu()}),[s,i]=E.useState(!1),[c,a]=E.useState(()=>o.current.isFocused&&o.current.isFocusVisible),u=E.useCallback(()=>a(o.current.isFocused&&o.current.isFocusVisible),[]),l=E.useCallback(d=>{o.current.isFocused=d,i(d),u()},[u]);jm(d=>{o.current.isFocusVisible=d,u()},[],{isTextInput:n});let{focusProps:f}=_m({isDisabled:r,onFocusChange:l}),{focusWithinProps:p}=Um({isDisabled:!r,onFocusWithinChange:l});return{isFocused:s,isFocusVisible:c,focusProps:r?p:f}}var Vm=Object.defineProperty,Gm=(e,t,n)=>t in e?Vm(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,pi=(e,t,n)=>(Gm(e,typeof t!="symbol"?t+"":t,n),n);let qm=class{constructor(){pi(this,"current",this.detect()),pi(this,"handoffState","pending"),pi(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"}},At=new qm;function Nr(e){var t,n;return At.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 Mu(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 Mu(()=>{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 Hn(){let[e]=E.useState(pt);return E.useEffect(()=>()=>e.dispose(),[e]),e}let ge=(e,t)=>{At.isServer?E.useEffect(e,t):E.useLayoutEffect(e,t)};function Pn(e){let t=E.useRef(e);return ge(()=>{t.current=e},[e]),t}let ae=function(e){let t=Pn(e);return E.useCallback((...n)=>t.current(...n),[t])};function Zm(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 Km(e,t){return!(!e||!t||e.right<t.left||e.left>t.right||e.bottom<t.top||e.top>t.bottom)}function Ym({disabled:e=!1}={}){let t=E.useRef(null),[n,r]=E.useState(!1),o=Hn(),s=ae(()=>{t.current=null,r(!1),o.dispose()}),i=ae(c=>{if(o.dispose(),t.current===null){t.current=c.currentTarget,r(!0);{let a=Nr(c.currentTarget);o.addEventListener(a,"pointerup",s,!1),o.addEventListener(a,"pointermove",u=>{if(t.current){let l=Zm(u);r(Km(l,t.current.getBoundingClientRect()))}},!1),o.addEventListener(a,"pointercancel",s,!1)}}});return{pressed:n,pressProps:e?{}:{onPointerDown:i,onPointerUp:s,onClick:s}}}let Xm=E.createContext(void 0);function hi(){return E.useContext(Xm)}function mi(...e){return Array.from(new Set(e.flatMap(t=>typeof t=="string"?t.split(" "):[]))).filter(Boolean).join(" ")}function nt(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,nt),r}var Fo=(e=>(e[e.None=0]="None",e[e.RenderStrategy=1]="RenderStrategy",e[e.Static=2]="Static",e))(Fo||{}),fn=(e=>(e[e.Unmount=0]="Unmount",e[e.Hidden=1]="Hidden",e))(fn||{});function Ze(){let e=Jm();return E.useCallback(t=>Qm({mergeRefs:e,...t}),[e])}function Qm({ourProps:e,theirProps:t,slot:n,defaultTag:r,features:o,visible:s=!0,name:i,mergeRefs:c}){c=c??eg;let a=ku(t,e);if(s)return jo(a,n,r,i,c);let u=o??0;if(u&2){let{static:l=!1,...f}=a;if(l)return jo(f,n,r,i,c)}if(u&1){let{unmount:l=!0,...f}=a;return nt(l?0:1,{0(){return null},1(){return jo({...f,hidden:!0,style:{display:"none"}},n,r,i,c)}})}return jo(a,n,r,i,c)}function jo(e,t={},n,r,o){let{as:s=n,children:i,refName:c="ref",...a}=gi(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,y=>`-${y.toLowerCase()}`));if(p){f["data-headlessui-state"]=d.join(" ");for(let h of d)f[`data-${h}`]=""}}if(s===E.Fragment&&(Object.keys(dn(a)).length>0||Object.keys(dn(f)).length>0))if(!E.isValidElement(l)||Array.isArray(l)&&l.length>1){if(Object.keys(dn(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(dn(a)).concat(Object.keys(dn(f))).map(p=>` - ${p}`).join(`
61
61
  `),"","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(`
62
62
  `)].join(`
63
- `))}else{let p=l.props,d=p==null?void 0:p.className,h=typeof d=="function"?(...C)=>mi(d(...C),a.className):mi(d,a.className),m=h?{className:h}:{},v=Lu(l.props,dn(gi(a,["ref"])));for(let C in f)C in v&&delete f[C];return E.cloneElement(l,Object.assign({},v,f,u,{ref:o(ng(l),u.ref)},m))}return E.createElement(s,Object.assign({},gi(a,["ref"]),s!==E.Fragment&&u,s!==E.Fragment&&f),l)}function eg(){let e=E.useRef([]),t=E.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 tg(...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 Lu(...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 Bu(...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 je(e){var t;return Object.assign(E.forwardRef(e),{displayName:(t=e.displayName)!=null?t:e.name})}function dn(e){let t=Object.assign({},e);for(let n in t)t[n]===void 0&&delete t[n];return t}function gi(e,t=[]){let n=Object.assign({},e);for(let r of t)r in n&&delete n[r];return n}function ng(e){return E.version.split(".")[0]>="19"?e.props.ref:e.ref}function rg(e,t,n){let[r,o]=E.useState(n),s=e!==void 0,i=E.useRef(s),c=E.useRef(!1),a=E.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,ae(u=>(s||o(u),t==null?void 0:t(u)))]}function og(e){let[t]=E.useState(e);return t}function ku(e={},t=null,n=[]){for(let[r,o]of Object.entries(e))Fu(n,Ru(t,r),o);return n}function Ru(e,t){return e?e+"["+t+"]":t}function Fu(e,t,n){if(Array.isArray(n))for(let[r,o]of n.entries())Fu(e,Ru(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,""]):ku(n,t,e)}function sg(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 ig="span";var bi=(e=>(e[e.None=1]="None",e[e.Focusable=2]="Focusable",e[e.Hidden=4]="Hidden",e))(bi||{});function ag(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 Ze()({ourProps:s,theirProps:o,slot:{},defaultTag:ig,name:"Hidden"})}let Du=je(ag),cg=E.createContext(null);function ug({children:e}){let t=E.useContext(cg);if(!t)return E.createElement(E.Fragment,null,e);let{target:n}=t;return n?Me.createPortal(E.createElement(E.Fragment,null,e),n):null}function lg({data:e,form:t,disabled:n,onReset:r,overrides:o}){let[s,i]=E.useState(null),c=Vn();return E.useEffect(()=>{if(r&&s)return c.addEventListener(s,"reset",r)},[s,t,r]),E.createElement(ug,null,E.createElement(fg,{setForm:i,formId:t}),ku(e).map(([a,u])=>E.createElement(Du,{features:bi.Hidden,...dn({key:a,as:"input",type:"hidden",hidden:!0,readOnly:!0,form:t,disabled:n,name:a,value:u,...o})})))}function fg({setForm:e,formId:t}){return E.useEffect(()=>{if(t){let n=document.getElementById(t);n&&e(n)}},[e,t]),t?null:E.createElement(Du,{features:bi.Hidden,as:"input",type:"hidden",hidden:!0,readOnly:!0,ref:n=>{if(!n)return;let r=n.closest("form");r&&e(r)}})}let dg=E.createContext(void 0);function ju(){return E.useContext(dg)}function yi(e){return typeof e!="object"||e===null?!1:"nodeType"in e}function _o(e){return yi(e)&&"tagName"in e}function zt(e){return _o(e)&&"accessKey"in e}function Gn(e){return _o(e)&&"tabIndex"in e}function pg(e){return _o(e)&&"style"in e}function hg(e){return zt(e)&&e.nodeName==="IFRAME"}function _u(e){return zt(e)&&e.nodeName==="INPUT"}function Uu(e){return zt(e)&&e.nodeName==="LABEL"}function mg(e){return zt(e)&&e.nodeName==="FIELDSET"}function zu(e){return zt(e)&&e.nodeName==="LEGEND"}function gg(e){return _o(e)?e.matches('a[href],audio[controls],button,details,embed,iframe,img[usemap],input:not([type="hidden"]),label,select,textarea,video[controls]'):!1}function bg(e){let t=e.parentElement,n=null;for(;t&&!mg(t);)zu(t)&&(n=t),t=t.parentElement;let r=(t==null?void 0:t.getAttribute("disabled"))==="";return r&&yg(n)?!1:r}function yg(e){if(!e)return!1;let t=e.previousElementSibling;for(;t!==null;){if(zu(t))return!1;t=t.previousElementSibling}return!0}let Wu=Symbol();function vg(e,t=!0){return Object.assign(e,{[Wu]:t})}function rt(...e){let t=E.useRef(e);E.useEffect(()=>{t.current=e},[e]);let n=ae(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[Wu]))?void 0:n}let vi=E.createContext(null);vi.displayName="DescriptionContext";function Hu(){let e=E.useContext(vi);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,Hu),t}return e}function wg(){var e,t;return(t=(e=E.useContext(vi))==null?void 0:e.value)!=null?t:void 0}let xg="p";function Eg(e,t){let n=E.useId(),r=hi(),{id:o=`headlessui-description-${n}`,...s}=e,i=Hu(),c=rt(t);ge(()=>i.register(o),[o,i.register]);let a=r||!1,u=E.useMemo(()=>({...i.slot,disabled:a}),[i.slot,a]),l={ref:c,...i.props,id:o};return Ze()({ourProps:l,theirProps:s,slot:u,defaultTag:xg,name:i.name||"Description"})}let Sg=je(Eg);Object.assign(Sg,{});var Ce=(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))(Ce||{});let Uo=E.createContext(null);Uo.displayName="LabelContext";function Vu(){let e=E.useContext(Uo);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,Vu),t}return e}function Gu(e){var t,n,r;let o=(n=(t=E.useContext(Uo))==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 Pg({inherit:e=!1}={}){let t=Gu(),[n,r]=E.useState([]),o=e?[t,...n].filter(Boolean):n;return[o.length>0?o.join(" "):void 0,E.useMemo(()=>function(s){let i=ae(a=>(r(u=>[...u,a]),()=>r(u=>{let l=u.slice(),f=l.indexOf(a);return f!==-1&&l.splice(f,1),l}))),c=E.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 E.createElement(Uo.Provider,{value:c},s.children)},[r])]}let $g="label";function Ag(e,t){var n;let r=E.useId(),o=Vu(),s=ju(),i=hi(),{id:c=`headlessui-label-${r}`,htmlFor:a=s??((n=o.props)==null?void 0:n.htmlFor),passive:u=!1,...l}=e,f=rt(t);ge(()=>o.register(c),[c,o.register]);let p=ae(v=>{let C=v.currentTarget;if(!(v.target!==v.currentTarget&&gg(v.target))&&(Uu(C)&&v.preventDefault(),o.props&&"onClick"in o.props&&typeof o.props.onClick=="function"&&o.props.onClick(v),Uu(C))){let y=document.getElementById(C.htmlFor);if(y){let $=y.getAttribute("disabled");if($==="true"||$==="")return;let B=y.getAttribute("aria-disabled");if(B==="true"||B==="")return;(_u(y)&&(y.type==="file"||y.type==="radio"||y.type==="checkbox")||y.role==="radio"||y.role==="checkbox"||y.role==="switch")&&y.click(),y.focus({preventScroll:!0})}}}),d=i||!1,h=E.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),Ze()({ourProps:m,theirProps:l,slot:h,defaultTag:a?$g:"div",name:o.name||"Label"})}let Tg=je(Ag),Cg=Object.assign(Tg,{});function Og(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 Ng(e=Og){return E.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 Ig(e){if(e===null)return{width:0,height:0};let{width:t,height:n}=e.getBoundingClientRect();return{width:t,height:n}}function Mg(e,t=!1){let[n,r]=E.useReducer(()=>({}),{}),o=E.useMemo(()=>Ig(e),[e,n]);return ge(()=>{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 qu=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 Lg=Object.defineProperty,Bg=(e,t,n)=>t in e?Lg(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,kg=(e,t,n)=>(Bg(e,t+"",n),n),Zu=(e,t,n)=>{if(!t.has(e))throw TypeError("Cannot "+n)},ot=(e,t,n)=>(Zu(e,t,"read from private field"),n?n.call(e):t.get(e)),wi=(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)},Ku=(e,t,n,r)=>(Zu(e,t,"write to private field"),t.set(e,n),n),Tt,Mr,Lr;let Yu=class{constructor(t){wi(this,Tt,{}),wi(this,Mr,new qu(()=>new Set)),wi(this,Lr,new Set),kg(this,"disposables",ht()),Ku(this,Tt,t),At.isServer&&this.disposables.microTask(()=>{this.dispose()})}dispose(){this.disposables.dispose()}get state(){return ot(this,Tt)}subscribe(t,n){if(At.isServer)return()=>{};let r={selector:t,callback:n,current:t(ot(this,Tt))};return ot(this,Lr).add(r),this.disposables.add(()=>{ot(this,Lr).delete(r)})}on(t,n){return At.isServer?()=>{}:(ot(this,Mr).get(t).add(n),this.disposables.add(()=>{ot(this,Mr).get(t).delete(n)}))}send(t){let n=this.reduce(ot(this,Tt),t);if(n!==ot(this,Tt)){Ku(this,Tt,n);for(let r of ot(this,Lr)){let o=r.selector(ot(this,Tt));Xu(r.current,o)||(r.current=o,r.callback(o))}for(let r of ot(this,Mr).get(t.type))r(ot(this,Tt),t)}}};Tt=new WeakMap,Mr=new WeakMap,Lr=new WeakMap;function Xu(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:xi(e[Symbol.iterator](),t[Symbol.iterator]()):e instanceof Map&&t instanceof Map||e instanceof Set&&t instanceof Set?e.size!==t.size?!1:xi(e.entries(),t.entries()):Qu(e)&&Qu(t)?xi(Object.entries(e)[Symbol.iterator](),Object.entries(t)[Symbol.iterator]()):!1}function xi(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 Qu(e){if(Object.prototype.toString.call(e)!=="[object Object]")return!1;let t=Object.getPrototypeOf(e);return t===null||Object.getPrototypeOf(t)===null}function Ei(e){let[t,n]=e(),r=ht();return(...o)=>{t(...o),r.dispose(),r.microTask(n)}}var Rg=Object.defineProperty,Fg=(e,t,n)=>t in e?Rg(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Ju=(e,t,n)=>(Fg(e,typeof t!="symbol"?t+"":t,n),n),el=(e=>(e[e.Push=0]="Push",e[e.Pop=1]="Pop",e))(el||{});let Dg={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}}},jg=class X0 extends Yu{constructor(){super(...arguments),Ju(this,"actions",{push:t=>this.send({type:0,id:t}),pop:t=>this.send({type:1,id:t})}),Ju(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 nt(n.type,Dg,t,n)}};const Si=new qu(()=>jg.new());var Pi={exports:{}},$i={};/**
63
+ `))}else{let p=l.props,d=p==null?void 0:p.className,h=typeof d=="function"?(...A)=>mi(d(...A),a.className):mi(d,a.className),m=h?{className:h}:{},y=ku(l.props,dn(gi(a,["ref"])));for(let A in f)A in y&&delete f[A];return E.cloneElement(l,Object.assign({},y,f,u,{ref:o(tg(l),u.ref)},m))}return E.createElement(s,Object.assign({},gi(a,["ref"]),s!==E.Fragment&&u,s!==E.Fragment&&f),l)}function Jm(){let e=E.useRef([]),t=E.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 eg(...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 ku(...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 Lu(...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 je(e){var t;return Object.assign(E.forwardRef(e),{displayName:(t=e.displayName)!=null?t:e.name})}function dn(e){let t=Object.assign({},e);for(let n in t)t[n]===void 0&&delete t[n];return t}function gi(e,t=[]){let n=Object.assign({},e);for(let r of t)r in n&&delete n[r];return n}function tg(e){return E.version.split(".")[0]>="19"?e.props.ref:e.ref}function ng(e,t,n){let[r,o]=E.useState(n),s=e!==void 0,i=E.useRef(s),c=E.useRef(!1),a=E.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,ae(u=>(s||o(u),t==null?void 0:t(u)))]}function rg(e){let[t]=E.useState(e);return t}function Bu(e={},t=null,n=[]){for(let[r,o]of Object.entries(e))Du(n,Ru(t,r),o);return n}function Ru(e,t){return e?e+"["+t+"]":t}function Du(e,t,n){if(Array.isArray(n))for(let[r,o]of n.entries())Du(e,Ru(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,""]):Bu(n,t,e)}function og(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 sg="span";var bi=(e=>(e[e.None=1]="None",e[e.Focusable=2]="Focusable",e[e.Hidden=4]="Hidden",e))(bi||{});function ig(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 Ze()({ourProps:s,theirProps:o,slot:{},defaultTag:sg,name:"Hidden"})}let Fu=je(ig),ag=E.createContext(null);function cg({children:e}){let t=E.useContext(ag);if(!t)return E.createElement(E.Fragment,null,e);let{target:n}=t;return n?Me.createPortal(E.createElement(E.Fragment,null,e),n):null}function ug({data:e,form:t,disabled:n,onReset:r,overrides:o}){let[s,i]=E.useState(null),c=Hn();return E.useEffect(()=>{if(r&&s)return c.addEventListener(s,"reset",r)},[s,t,r]),E.createElement(cg,null,E.createElement(lg,{setForm:i,formId:t}),Bu(e).map(([a,u])=>E.createElement(Fu,{features:bi.Hidden,...dn({key:a,as:"input",type:"hidden",hidden:!0,readOnly:!0,form:t,disabled:n,name:a,value:u,...o})})))}function lg({setForm:e,formId:t}){return E.useEffect(()=>{if(t){let n=document.getElementById(t);n&&e(n)}},[e,t]),t?null:E.createElement(Fu,{features:bi.Hidden,as:"input",type:"hidden",hidden:!0,readOnly:!0,ref:n=>{if(!n)return;let r=n.closest("form");r&&e(r)}})}let fg=E.createContext(void 0);function ju(){return E.useContext(fg)}function yi(e){return typeof e!="object"||e===null?!1:"nodeType"in e}function _o(e){return yi(e)&&"tagName"in e}function Ht(e){return _o(e)&&"accessKey"in e}function Vn(e){return _o(e)&&"tabIndex"in e}function dg(e){return _o(e)&&"style"in e}function pg(e){return Ht(e)&&e.nodeName==="IFRAME"}function _u(e){return Ht(e)&&e.nodeName==="INPUT"}function Uu(e){return Ht(e)&&e.nodeName==="LABEL"}function hg(e){return Ht(e)&&e.nodeName==="FIELDSET"}function zu(e){return Ht(e)&&e.nodeName==="LEGEND"}function mg(e){return _o(e)?e.matches('a[href],audio[controls],button,details,embed,iframe,img[usemap],input:not([type="hidden"]),label,select,textarea,video[controls]'):!1}function gg(e){let t=e.parentElement,n=null;for(;t&&!hg(t);)zu(t)&&(n=t),t=t.parentElement;let r=(t==null?void 0:t.getAttribute("disabled"))==="";return r&&bg(n)?!1:r}function bg(e){if(!e)return!1;let t=e.previousElementSibling;for(;t!==null;){if(zu(t))return!1;t=t.previousElementSibling}return!0}let Wu=Symbol();function yg(e,t=!0){return Object.assign(e,{[Wu]:t})}function rt(...e){let t=E.useRef(e);E.useEffect(()=>{t.current=e},[e]);let n=ae(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[Wu]))?void 0:n}let vi=E.createContext(null);vi.displayName="DescriptionContext";function Hu(){let e=E.useContext(vi);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,Hu),t}return e}function vg(){var e,t;return(t=(e=E.useContext(vi))==null?void 0:e.value)!=null?t:void 0}let wg="p";function xg(e,t){let n=E.useId(),r=hi(),{id:o=`headlessui-description-${n}`,...s}=e,i=Hu(),c=rt(t);ge(()=>i.register(o),[o,i.register]);let a=r||!1,u=E.useMemo(()=>({...i.slot,disabled:a}),[i.slot,a]),l={ref:c,...i.props,id:o};return Ze()({ourProps:l,theirProps:s,slot:u,defaultTag:wg,name:i.name||"Description"})}let Eg=je(xg);Object.assign(Eg,{});var Ce=(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))(Ce||{});let Uo=E.createContext(null);Uo.displayName="LabelContext";function Vu(){let e=E.useContext(Uo);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,Vu),t}return e}function Gu(e){var t,n,r;let o=(n=(t=E.useContext(Uo))==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 Sg({inherit:e=!1}={}){let t=Gu(),[n,r]=E.useState([]),o=e?[t,...n].filter(Boolean):n;return[o.length>0?o.join(" "):void 0,E.useMemo(()=>function(s){let i=ae(a=>(r(u=>[...u,a]),()=>r(u=>{let l=u.slice(),f=l.indexOf(a);return f!==-1&&l.splice(f,1),l}))),c=E.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 E.createElement(Uo.Provider,{value:c},s.children)},[r])]}let Pg="label";function $g(e,t){var n;let r=E.useId(),o=Vu(),s=ju(),i=hi(),{id:c=`headlessui-label-${r}`,htmlFor:a=s??((n=o.props)==null?void 0:n.htmlFor),passive:u=!1,...l}=e,f=rt(t);ge(()=>o.register(c),[c,o.register]);let p=ae(y=>{let A=y.currentTarget;if(!(y.target!==y.currentTarget&&mg(y.target))&&(Uu(A)&&y.preventDefault(),o.props&&"onClick"in o.props&&typeof o.props.onClick=="function"&&o.props.onClick(y),Uu(A))){let g=document.getElementById(A.htmlFor);if(g){let P=g.getAttribute("disabled");if(P==="true"||P==="")return;let k=g.getAttribute("aria-disabled");if(k==="true"||k==="")return;(_u(g)&&(g.type==="file"||g.type==="radio"||g.type==="checkbox")||g.role==="radio"||g.role==="checkbox"||g.role==="switch")&&g.click(),g.focus({preventScroll:!0})}}}),d=i||!1,h=E.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),Ze()({ourProps:m,theirProps:l,slot:h,defaultTag:a?Pg:"div",name:o.name||"Label"})}let Tg=je($g),Ag=Object.assign(Tg,{});function Cg(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 Og(e=Cg){return E.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 Ig(e){if(e===null)return{width:0,height:0};let{width:t,height:n}=e.getBoundingClientRect();return{width:t,height:n}}function Ng(e,t=!1){let[n,r]=E.useReducer(()=>({}),{}),o=E.useMemo(()=>Ig(e),[e,n]);return ge(()=>{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 qu=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 Mg=Object.defineProperty,kg=(e,t,n)=>t in e?Mg(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Lg=(e,t,n)=>(kg(e,t+"",n),n),Zu=(e,t,n)=>{if(!t.has(e))throw TypeError("Cannot "+n)},ot=(e,t,n)=>(Zu(e,t,"read from private field"),n?n.call(e):t.get(e)),wi=(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)},Ku=(e,t,n,r)=>(Zu(e,t,"write to private field"),t.set(e,n),n),Ct,Mr,kr;let Yu=class{constructor(t){wi(this,Ct,{}),wi(this,Mr,new qu(()=>new Set)),wi(this,kr,new Set),Lg(this,"disposables",pt()),Ku(this,Ct,t),At.isServer&&this.disposables.microTask(()=>{this.dispose()})}dispose(){this.disposables.dispose()}get state(){return ot(this,Ct)}subscribe(t,n){if(At.isServer)return()=>{};let r={selector:t,callback:n,current:t(ot(this,Ct))};return ot(this,kr).add(r),this.disposables.add(()=>{ot(this,kr).delete(r)})}on(t,n){return At.isServer?()=>{}:(ot(this,Mr).get(t).add(n),this.disposables.add(()=>{ot(this,Mr).get(t).delete(n)}))}send(t){let n=this.reduce(ot(this,Ct),t);if(n!==ot(this,Ct)){Ku(this,Ct,n);for(let r of ot(this,kr)){let o=r.selector(ot(this,Ct));Xu(r.current,o)||(r.current=o,r.callback(o))}for(let r of ot(this,Mr).get(t.type))r(ot(this,Ct),t)}}};Ct=new WeakMap,Mr=new WeakMap,kr=new WeakMap;function Xu(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:xi(e[Symbol.iterator](),t[Symbol.iterator]()):e instanceof Map&&t instanceof Map||e instanceof Set&&t instanceof Set?e.size!==t.size?!1:xi(e.entries(),t.entries()):Qu(e)&&Qu(t)?xi(Object.entries(e)[Symbol.iterator](),Object.entries(t)[Symbol.iterator]()):!1}function xi(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 Qu(e){if(Object.prototype.toString.call(e)!=="[object Object]")return!1;let t=Object.getPrototypeOf(e);return t===null||Object.getPrototypeOf(t)===null}function Ei(e){let[t,n]=e(),r=pt();return(...o)=>{t(...o),r.dispose(),r.microTask(n)}}var Bg=Object.defineProperty,Rg=(e,t,n)=>t in e?Bg(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Ju=(e,t,n)=>(Rg(e,typeof t!="symbol"?t+"":t,n),n),el=(e=>(e[e.Push=0]="Push",e[e.Pop=1]="Pop",e))(el||{});let Dg={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}}},Fg=class K0 extends Yu{constructor(){super(...arguments),Ju(this,"actions",{push:t=>this.send({type:0,id:t}),pop:t=>this.send({type:1,id:t})}),Ju(this,"selectors",{isTop:(t,n)=>t.stack[t.stack.length-1]===n,inStack:(t,n)=>t.stack.includes(n)})}static new(){return new K0({stack:[]})}reduce(t,n){return nt(n.type,Dg,t,n)}};const Si=new qu(()=>Fg.new());var Pi={exports:{}},$i={};/**
64
64
  * @license React
65
65
  * use-sync-external-store-with-selector.production.js
66
66
  *
@@ -68,7 +68,7 @@ React keys must be passed directly to JSX without using spread:
68
68
  *
69
69
  * This source code is licensed under the MIT license found in the
70
70
  * LICENSE file in the root directory of this source tree.
71
- */var tl;function _g(){if(tl)return $i;tl=1;var e=E;function t(a,u){return a===u&&(a!==0||1/a===1/u)||a!==a&&u!==u}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 $i.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(k){if(!C){if(C=!0,y=k,k=f(k),p!==void 0&&h.hasValue){var D=h.value;if(p(D,k))return $=D}return $=k}if(D=$,n(y,k))return D;var j=f(k);return p!==void 0&&p(D,j)?(y=k,D):(y=k,$=j)}var C=!1,y,$,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},$i}var Ai={};/**
71
+ */var tl;function jg(){if(tl)return $i;tl=1;var e=E;function t(a,u){return a===u&&(a!==0||1/a===1/u)||a!==a&&u!==u}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 $i.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 y(B){if(!A){if(A=!0,g=B,B=f(B),p!==void 0&&h.hasValue){var F=h.value;if(p(F,B))return P=F}return P=B}if(F=P,n(g,B))return F;var j=f(B);return p!==void 0&&p(F,j)?(g=B,F):(g=B,P=j)}var A=!1,g,P,k=l===void 0?null:l;return[function(){return y(u())},k===null?void 0:function(){return y(k())}]},[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},$i}var Ti={};/**
72
72
  * @license React
73
73
  * use-sync-external-store-with-selector.development.js
74
74
  *
@@ -76,39 +76,29 @@ React keys must be passed directly to JSX without using spread:
76
76
  *
77
77
  * This source code is licensed under the MIT license found in the
78
78
  * LICENSE file in the root directory of this source tree.
79
- */var nl;function Ug(){return nl||(nl=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=E,n=typeof Object.is=="function"?Object.is:e,r=t.useSyncExternalStore,o=t.useRef,s=t.useEffect,i=t.useMemo,c=t.useDebugValue;Ai.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(k){if(!C){if(C=!0,y=k,k=f(k),p!==void 0&&h.hasValue){var D=h.value;if(p(D,k))return $=D}return $=k}if(D=$,n(y,k))return D;var j=f(k);return p!==void 0&&p(D,j)?(y=k,D):(y=k,$=j)}var C=!1,y,$,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())}()),Ai}process.env.NODE_ENV==="production"?Pi.exports=_g():Pi.exports=Ug();var zg=Pi.exports;function st(e,t,n=Xu){return zg.useSyncExternalStoreWithSelector(ae(r=>e.subscribe(Wg,r)),ae(()=>e.state),ae(()=>e.state),ae(t),n)}function Wg(e){return e}function rl(e,t){let n=E.useId(),r=Si.get(t),[o,s]=st(r,E.useCallback(i=>[r.selectors.isTop(i,n),r.selectors.inStack(i,n)],[r,n]));return ge(()=>{if(e)return r.actions.push(n),()=>r.actions.pop(n)},[r,e,n]),e?s?o:!0:!1}let Ti=new Map,Br=new Map;function ol(e){var t;let n=(t=Br.get(e))!=null?t:0;return Br.set(e,n+1),n!==0?()=>sl(e):(Ti.set(e,{"aria-hidden":e.getAttribute("aria-hidden"),inert:e.inert}),e.setAttribute("aria-hidden","true"),e.inert=!0,()=>sl(e))}function sl(e){var t;let n=(t=Br.get(e))!=null?t:1;if(n===1?Br.delete(e):Br.set(e,n-1),n!==1)return;let r=Ti.get(e);r&&(r["aria-hidden"]===null?e.removeAttribute("aria-hidden"):e.setAttribute("aria-hidden",r["aria-hidden"]),e.inert=r.inert,Ti.delete(e))}function Hg(e,{allowed:t,disallowed:n}={}){let r=rl(e,"inert-others");ge(()=>{var o,s;if(!r)return;let i=ht();for(let a of(o=n==null?void 0:n())!=null?o:[])a&&i.add(ol(a));let c=(s=t==null?void 0:t())!=null?s:[];for(let a of c){if(!a)continue;let u=Ir(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(ol(f));l=l.parentElement}}return i.dispose},[r,t,n])}function Vg(e,t,n){let r=$n(o=>{let s=o.getBoundingClientRect();s.x===0&&s.y===0&&s.width===0&&s.height===0&&n()});E.useEffect(()=>{if(!e)return;let o=t===null?null:zt(t)?t:t.current;if(!o)return;let s=ht();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 Ci=["[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(","),Gg=["[data-autofocus]"].map(e=>`${e}:not([tabindex='-1'])`).join(",");var Oi=(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))(Oi||{}),qg=(e=>(e[e.Error=0]="Error",e[e.Overflow=1]="Overflow",e[e.Success=2]="Success",e[e.Underflow=3]="Underflow",e))(qg||{}),Zg=(e=>(e[e.Previous=-1]="Previous",e[e.Next=1]="Next",e))(Zg||{});function il(e=document.body){return e==null?[]:Array.from(e.querySelectorAll(Ci)).sort((t,n)=>Math.sign((t.tabIndex||Number.MAX_SAFE_INTEGER)-(n.tabIndex||Number.MAX_SAFE_INTEGER)))}function Kg(e=document.body){return e==null?[]:Array.from(e.querySelectorAll(Gg)).sort((t,n)=>Math.sign((t.tabIndex||Number.MAX_SAFE_INTEGER)-(n.tabIndex||Number.MAX_SAFE_INTEGER)))}var Ni=(e=>(e[e.Strict=0]="Strict",e[e.Loose=1]="Loose",e))(Ni||{});function al(e,t=0){var n;return e===((n=Ir(e))==null?void 0:n.body)?!1:nt(t,{0(){return e.matches(Ci)},1(){let r=e;for(;r!==null;){if(r.matches(Ci))return!0;r=r.parentElement}return!1}})}var Yg=(e=>(e[e.Keyboard=0]="Keyboard",e[e.Mouse=1]="Mouse",e))(Yg||{});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 Xg=["textarea","input"].join(",");function Qg(e){var t,n;return(n=(t=e==null?void 0:e.matches)==null?void 0:t.call(e,Xg))!=null?n:!1}function cl(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 Jg(e,t){return eb(il(),t,{relativeTo:e})}function eb(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?cl(e):e:t&64?Kg(e):il(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&&Qg(p)&&p.select(),2}function ul(){return/iPhone/gi.test(window.navigator.platform)||/Mac/gi.test(window.navigator.platform)&&window.navigator.maxTouchPoints>0}function tb(){return/Android/gi.test(window.navigator.userAgent)}function ll(){return ul()||tb()}function qn(e,t,n,r){let o=$n(n);E.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 nb(e,t,n,r){let o=$n(n);E.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 fl=30;function rb(e,t,n){let r=$n(n),o=E.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!al(u,Ni.Loose)&&u.tabIndex!==-1&&c.preventDefault(),r.current(c,u)},[r,t]),s=E.useRef(null);qn(e,"pointerdown",c=>{var a,u;ll()||(s.current=((u=(a=c.composedPath)==null?void 0:a.call(c))==null?void 0:u[0])||c.target)},!0),qn(e,"pointerup",c=>{if(ll()||!s.current)return;let a=s.current;return s.current=null,o(c,()=>a)},!0);let i=E.useRef({x:0,y:0});qn(e,"touchstart",c=>{i.current.x=c.touches[0].clientX,i.current.y=c.touches[0].clientY},!0),qn(e,"touchend",c=>{let a={x:c.changedTouches[0].clientX,y:c.changedTouches[0].clientY};if(!(Math.abs(a.x-i.current.x)>=fl||Math.abs(a.y-i.current.y)>=fl))return o(c,()=>Gn(c.target)?c.target:null)},!0),nb(e,"blur",c=>o(c,()=>hg(window.document.activeElement)?window.document.activeElement:null),!0)}function Ii(...e){return E.useMemo(()=>Ir(...e),[...e])}var ob=(e=>(e[e.Ignore=0]="Ignore",e[e.Select=1]="Select",e[e.Close=2]="Close",e))(ob||{});const zo={Ignore:{kind:0},Select:e=>({kind:1,target:e}),Close:{kind:2}},sb=200,dl=5;function ib(e,{trigger:t,action:n,close:r,select:o}){let s=E.useRef(null),i=E.useRef(null),c=E.useRef(null);qn(e&&t!==null,"pointerdown",a=>{yi(a==null?void 0:a.target)&&t!=null&&t.contains(a.target)&&(i.current=a.x,c.current=a.y,s.current=a.timeStamp)}),qn(e&&t!==null,"pointerup",a=>{var u,l;let f=s.current;if(f===null||(s.current=null,!Gn(a.target))||Math.abs(a.x-((u=i.current)!=null?u:a.x))<dl&&Math.abs(a.y-((l=c.current)!=null?l:a.y))<dl)return;let p=n(a);switch(p.kind){case 0:return;case 1:{a.timeStamp-f>sb&&(o(p.target),r());break}case 2:{r();break}}},{capture:!0})}function ab(e,t){return E.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 cb(e){return E.useSyncExternalStore(e.subscribe,e.getSnapshot,e.getSnapshot)}function ub(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 lb(){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 fb(){return ul()?{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=ht();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(Gn(c.target))try{let a=c.target.closest("a");if(!a)return;let{hash:u}=new URL(a.href),l=e.querySelector(u);Gn(l)&&!r(l)&&(i=l)}catch{}},!0),t.addEventListener(e,"touchstart",c=>{if(Gn(c.target)&&pg(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(Gn(c.target)){if(_u(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 db(){return{before({doc:e,d:t}){t.style(e.documentElement,"overflow","hidden")}}}function pb(e){let t={};for(let n of e)Object.assign(t,n(t));return t}let An=ub(()=>new Map,{PUSH(e,t){var n;let r=(n=this.get(e))!=null?n:{doc:e,count:0,d:ht(),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:pb(n)},o=[fb(),lb(),db()];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)}});An.subscribe(()=>{let e=An.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)&&An.dispatch(n.count>0?"SCROLL_PREVENT":"SCROLL_ALLOW",n),n.count===0&&An.dispatch("TEARDOWN",n)}});function hb(e,t,n=()=>({containers:[]})){let r=cb(An),o=t?r.get(t):void 0,s=o?o.count>0:!1;return ge(()=>{if(!(!t||!e))return An.dispatch("PUSH",t,n),()=>An.dispatch("POP",t,n)},[e,t]),s}function mb(e,t,n=()=>[document.body]){let r=rl(e,"scroll-lock");hb(r,t,o=>{var s;return{containers:[...(s=o.containers)!=null?s:[],n]}})}function pl(e){return[e.screenX,e.screenY]}function gb(){let e=E.useRef([-1,-1]);return{wasMoved(t){let n=pl(t);return e.current[0]===n[0]&&e.current[1]===n[1]?!1:(e.current=n,!0)},update(t){e.current=pl(t)}}}function bb(e=0){let[t,n]=E.useState(e),r=E.useCallback(a=>n(a),[t]),o=E.useCallback(a=>n(u=>u|a),[t]),s=E.useCallback(a=>(t&a)===a,[t]),i=E.useCallback(a=>n(u=>u&~a),[n]),c=E.useCallback(a=>n(u=>u^a),[n]);return{flags:t,setFlag:r,addFlag:o,hasFlag:s,removeFlag:i,toggleFlag:c}}var hl,ml;typeof process<"u"&&typeof globalThis<"u"&&typeof Element<"u"&&((hl=process==null?void 0:process.env)==null?void 0:hl.NODE_ENV)==="test"&&typeof((ml=Element==null?void 0:Element.prototype)==null?void 0:ml.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(`
80
- `)),[]});var yb=(e=>(e[e.None=0]="None",e[e.Closed=1]="Closed",e[e.Enter=2]="Enter",e[e.Leave=4]="Leave",e))(yb||{});function gl(e){let t={};for(let n in e)e[n]===!0&&(t[`data-${n}`]="");return t}function bl(e,t,n,r){let[o,s]=E.useState(n),{hasFlag:i,addFlag:c,removeFlag:a}=bb(e&&o?3:0),u=E.useRef(!1),l=E.useRef(!1),f=Vn();return ge(()=>{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),vb(t,{inFlight:u,prepare(){l.current?l.current=!1:l.current=u.current,u.current=!0,!l.current&&(n?(c(3),a(4)):(c(4),a(2)))},run(){l.current?n?(a(3),c(4)):(a(4),c(3)):n?a(1):c(1)},done(){var d;l.current&&typeof t.getAnimations=="function"&&t.getAnimations().length>0||(u.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 vb(e,{prepare:t,run:n,done:r,inFlight:o}){let s=ht();return xb(e,{prepare:t,inFlight:o}),s.nextFrame(()=>{n(),s.requestAnimationFrame(()=>{s.add(wb(e,r))})}),s.dispose}function wb(e,t){var n,r;let o=ht();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 xb(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 Wo(){return typeof window<"u"}function Zn(e){return Mi(e)?(e.nodeName||"").toLowerCase():"#document"}function _e(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Ct(e){var t;return(t=(Mi(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function Mi(e){return Wo()?e instanceof Node||e instanceof _e(e).Node:!1}function de(e){return Wo()?e instanceof Element||e instanceof _e(e).Element:!1}function Be(e){return Wo()?e instanceof HTMLElement||e instanceof _e(e).HTMLElement:!1}function Li(e){return!Wo()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof _e(e).ShadowRoot}const Eb=new Set(["inline","contents"]);function kr(e){const{overflow:t,overflowX:n,overflowY:r,display:o}=it(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!Eb.has(o)}const Sb=new Set(["table","td","th"]);function Pb(e){return Sb.has(Zn(e))}const $b=[":popover-open",":modal"];function Ho(e){return $b.some(t=>{try{return e.matches(t)}catch{return!1}})}const Ab=["transform","translate","scale","rotate","perspective"],Tb=["transform","translate","scale","rotate","perspective","filter"],Cb=["paint","layout","strict","content"];function Bi(e){const t=Vo(),n=de(e)?it(e):e;return Ab.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)||Tb.some(r=>(n.willChange||"").includes(r))||Cb.some(r=>(n.contain||"").includes(r))}function Ob(e){let t=Ht(e);for(;Be(t)&&!Wt(t);){if(Bi(t))return t;if(Ho(t))return null;t=Ht(t)}return null}function Vo(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const Nb=new Set(["html","body","#document"]);function Wt(e){return Nb.has(Zn(e))}function it(e){return _e(e).getComputedStyle(e)}function Go(e){return de(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Ht(e){if(Zn(e)==="html")return e;const t=e.assignedSlot||e.parentNode||Li(e)&&e.host||Ct(e);return Li(t)?t.host:t}function yl(e){const t=Ht(e);return Wt(t)?e.ownerDocument?e.ownerDocument.body:e.body:Be(t)&&kr(t)?t:yl(t)}function pn(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const o=yl(e),s=o===((r=e.ownerDocument)==null?void 0:r.body),i=_e(o);if(s){const c=ki(i);return t.concat(i,i.visualViewport||[],kr(o)?o:[],c&&n?pn(c):[])}return t.concat(o,pn(o,[],n))}function ki(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function Ib(){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 Vt=Math.min,Ie=Math.max,Rr=Math.round,qo=Math.floor,Ot=e=>({x:e,y:e}),Mb={left:"right",right:"left",bottom:"top",top:"bottom"},Lb={start:"end",end:"start"};function Ri(e,t,n){return Ie(e,Vt(t,n))}function Tn(e,t){return typeof e=="function"?e(t):e}function hn(e){return e.split("-")[0]}function Kn(e){return e.split("-")[1]}function vl(e){return e==="x"?"y":"x"}function Fi(e){return e==="y"?"height":"width"}const Bb=new Set(["top","bottom"]);function Gt(e){return Bb.has(hn(e))?"y":"x"}function Di(e){return vl(Gt(e))}function kb(e,t,n){n===void 0&&(n=!1);const r=Kn(e),o=Di(e),s=Fi(o);let i=o==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[s]>t.floating[s]&&(i=Zo(i)),[i,Zo(i)]}function Rb(e){const t=Zo(e);return[ji(e),t,ji(t)]}function ji(e){return e.replace(/start|end/g,t=>Lb[t])}const wl=["left","right"],xl=["right","left"],Fb=["top","bottom"],Db=["bottom","top"];function jb(e,t,n){switch(e){case"top":case"bottom":return n?t?xl:wl:t?wl:xl;case"left":case"right":return t?Fb:Db;default:return[]}}function _b(e,t,n,r){const o=Kn(e);let s=jb(hn(e),n==="start",r);return o&&(s=s.map(i=>i+"-"+o),t&&(s=s.concat(s.map(ji)))),s}function Zo(e){return e.replace(/left|right|bottom|top/g,t=>Mb[t])}function Ub(e){return{top:0,right:0,bottom:0,left:0,...e}}function El(e){return typeof e!="number"?Ub(e):{top:e,right:e,bottom:e,left:e}}function Ko(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}}/*!
79
+ */var nl;function _g(){return nl||(nl=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=E,n=typeof Object.is=="function"?Object.is:e,r=t.useSyncExternalStore,o=t.useRef,s=t.useEffect,i=t.useMemo,c=t.useDebugValue;Ti.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 y(B){if(!A){if(A=!0,g=B,B=f(B),p!==void 0&&h.hasValue){var F=h.value;if(p(F,B))return P=F}return P=B}if(F=P,n(g,B))return F;var j=f(B);return p!==void 0&&p(F,j)?(g=B,F):(g=B,P=j)}var A=!1,g,P,k=l===void 0?null:l;return[function(){return y(u())},k===null?void 0:function(){return y(k())}]},[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())}()),Ti}process.env.NODE_ENV==="production"?Pi.exports=jg():Pi.exports=_g();var Ug=Pi.exports;function st(e,t,n=Xu){return Ug.useSyncExternalStoreWithSelector(ae(r=>e.subscribe(zg,r)),ae(()=>e.state),ae(()=>e.state),ae(t),n)}function zg(e){return e}function rl(e,t){let n=E.useId(),r=Si.get(t),[o,s]=st(r,E.useCallback(i=>[r.selectors.isTop(i,n),r.selectors.inStack(i,n)],[r,n]));return ge(()=>{if(e)return r.actions.push(n),()=>r.actions.pop(n)},[r,e,n]),e?s?o:!0:!1}let Ai=new Map,Lr=new Map;function ol(e){var t;let n=(t=Lr.get(e))!=null?t:0;return Lr.set(e,n+1),n!==0?()=>sl(e):(Ai.set(e,{"aria-hidden":e.getAttribute("aria-hidden"),inert:e.inert}),e.setAttribute("aria-hidden","true"),e.inert=!0,()=>sl(e))}function sl(e){var t;let n=(t=Lr.get(e))!=null?t:1;if(n===1?Lr.delete(e):Lr.set(e,n-1),n!==1)return;let r=Ai.get(e);r&&(r["aria-hidden"]===null?e.removeAttribute("aria-hidden"):e.setAttribute("aria-hidden",r["aria-hidden"]),e.inert=r.inert,Ai.delete(e))}function Wg(e,{allowed:t,disallowed:n}={}){let r=rl(e,"inert-others");ge(()=>{var o,s;if(!r)return;let i=pt();for(let a of(o=n==null?void 0:n())!=null?o:[])a&&i.add(ol(a));let c=(s=t==null?void 0:t())!=null?s:[];for(let a of c){if(!a)continue;let u=Nr(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(ol(f));l=l.parentElement}}return i.dispose},[r,t,n])}function Hg(e,t,n){let r=Pn(o=>{let s=o.getBoundingClientRect();s.x===0&&s.y===0&&s.width===0&&s.height===0&&n()});E.useEffect(()=>{if(!e)return;let o=t===null?null:Ht(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 Ci=["[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(","),Vg=["[data-autofocus]"].map(e=>`${e}:not([tabindex='-1'])`).join(",");var Oi=(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))(Oi||{}),Gg=(e=>(e[e.Error=0]="Error",e[e.Overflow=1]="Overflow",e[e.Success=2]="Success",e[e.Underflow=3]="Underflow",e))(Gg||{}),qg=(e=>(e[e.Previous=-1]="Previous",e[e.Next=1]="Next",e))(qg||{});function il(e=document.body){return e==null?[]:Array.from(e.querySelectorAll(Ci)).sort((t,n)=>Math.sign((t.tabIndex||Number.MAX_SAFE_INTEGER)-(n.tabIndex||Number.MAX_SAFE_INTEGER)))}function Zg(e=document.body){return e==null?[]:Array.from(e.querySelectorAll(Vg)).sort((t,n)=>Math.sign((t.tabIndex||Number.MAX_SAFE_INTEGER)-(n.tabIndex||Number.MAX_SAFE_INTEGER)))}var Ii=(e=>(e[e.Strict=0]="Strict",e[e.Loose=1]="Loose",e))(Ii||{});function al(e,t=0){var n;return e===((n=Nr(e))==null?void 0:n.body)?!1:nt(t,{0(){return e.matches(Ci)},1(){let r=e;for(;r!==null;){if(r.matches(Ci))return!0;r=r.parentElement}return!1}})}var Kg=(e=>(e[e.Keyboard=0]="Keyboard",e[e.Mouse=1]="Mouse",e))(Kg||{});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 Yg=["textarea","input"].join(",");function Xg(e){var t,n;return(n=(t=e==null?void 0:e.matches)==null?void 0:t.call(e,Yg))!=null?n:!1}function cl(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 Qg(e,t){return Jg(il(),t,{relativeTo:e})}function Jg(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?cl(e):e:t&64?Zg(e):il(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&&Xg(p)&&p.select(),2}function ul(){return/iPhone/gi.test(window.navigator.platform)||/Mac/gi.test(window.navigator.platform)&&window.navigator.maxTouchPoints>0}function eb(){return/Android/gi.test(window.navigator.userAgent)}function ll(){return ul()||eb()}function Gn(e,t,n,r){let o=Pn(n);E.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 tb(e,t,n,r){let o=Pn(n);E.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 fl=30;function nb(e,t,n){let r=Pn(n),o=E.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!al(u,Ii.Loose)&&u.tabIndex!==-1&&c.preventDefault(),r.current(c,u)},[r,t]),s=E.useRef(null);Gn(e,"pointerdown",c=>{var a,u;ll()||(s.current=((u=(a=c.composedPath)==null?void 0:a.call(c))==null?void 0:u[0])||c.target)},!0),Gn(e,"pointerup",c=>{if(ll()||!s.current)return;let a=s.current;return s.current=null,o(c,()=>a)},!0);let i=E.useRef({x:0,y:0});Gn(e,"touchstart",c=>{i.current.x=c.touches[0].clientX,i.current.y=c.touches[0].clientY},!0),Gn(e,"touchend",c=>{let a={x:c.changedTouches[0].clientX,y:c.changedTouches[0].clientY};if(!(Math.abs(a.x-i.current.x)>=fl||Math.abs(a.y-i.current.y)>=fl))return o(c,()=>Vn(c.target)?c.target:null)},!0),tb(e,"blur",c=>o(c,()=>pg(window.document.activeElement)?window.document.activeElement:null),!0)}function Ni(...e){return E.useMemo(()=>Nr(...e),[...e])}var rb=(e=>(e[e.Ignore=0]="Ignore",e[e.Select=1]="Select",e[e.Close=2]="Close",e))(rb||{});const zo={Ignore:{kind:0},Select:e=>({kind:1,target:e}),Close:{kind:2}},ob=200,dl=5;function sb(e,{trigger:t,action:n,close:r,select:o}){let s=E.useRef(null),i=E.useRef(null),c=E.useRef(null);Gn(e&&t!==null,"pointerdown",a=>{yi(a==null?void 0:a.target)&&t!=null&&t.contains(a.target)&&(i.current=a.x,c.current=a.y,s.current=a.timeStamp)}),Gn(e&&t!==null,"pointerup",a=>{var u,l;let f=s.current;if(f===null||(s.current=null,!Vn(a.target))||Math.abs(a.x-((u=i.current)!=null?u:a.x))<dl&&Math.abs(a.y-((l=c.current)!=null?l:a.y))<dl)return;let p=n(a);switch(p.kind){case 0:return;case 1:{a.timeStamp-f>ob&&(o(p.target),r());break}case 2:{r();break}}},{capture:!0})}function ib(e,t){return E.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 ab(e){return E.useSyncExternalStore(e.subscribe,e.getSnapshot,e.getSnapshot)}function cb(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 ub(){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 lb(){return ul()?{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(Vn(c.target))try{let a=c.target.closest("a");if(!a)return;let{hash:u}=new URL(a.href),l=e.querySelector(u);Vn(l)&&!r(l)&&(i=l)}catch{}},!0),t.addEventListener(e,"touchstart",c=>{if(Vn(c.target)&&dg(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(Vn(c.target)){if(_u(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 fb(){return{before({doc:e,d:t}){t.style(e.documentElement,"overflow","hidden")}}}function db(e){let t={};for(let n of e)Object.assign(t,n(t));return t}let $n=cb(()=>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:db(n)},o=[lb(),ub(),fb()];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)}});$n.subscribe(()=>{let e=$n.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)&&$n.dispatch(n.count>0?"SCROLL_PREVENT":"SCROLL_ALLOW",n),n.count===0&&$n.dispatch("TEARDOWN",n)}});function pb(e,t,n=()=>({containers:[]})){let r=ab($n),o=t?r.get(t):void 0,s=o?o.count>0:!1;return ge(()=>{if(!(!t||!e))return $n.dispatch("PUSH",t,n),()=>$n.dispatch("POP",t,n)},[e,t]),s}function hb(e,t,n=()=>[document.body]){let r=rl(e,"scroll-lock");pb(r,t,o=>{var s;return{containers:[...(s=o.containers)!=null?s:[],n]}})}function pl(e){return[e.screenX,e.screenY]}function mb(){let e=E.useRef([-1,-1]);return{wasMoved(t){let n=pl(t);return e.current[0]===n[0]&&e.current[1]===n[1]?!1:(e.current=n,!0)},update(t){e.current=pl(t)}}}function gb(e=0){let[t,n]=E.useState(e),r=E.useCallback(a=>n(a),[t]),o=E.useCallback(a=>n(u=>u|a),[t]),s=E.useCallback(a=>(t&a)===a,[t]),i=E.useCallback(a=>n(u=>u&~a),[n]),c=E.useCallback(a=>n(u=>u^a),[n]);return{flags:t,setFlag:r,addFlag:o,hasFlag:s,removeFlag:i,toggleFlag:c}}var hl,ml;typeof process<"u"&&typeof globalThis<"u"&&typeof Element<"u"&&((hl=process==null?void 0:process.env)==null?void 0:hl.NODE_ENV)==="test"&&typeof((ml=Element==null?void 0:Element.prototype)==null?void 0:ml.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(`
80
+ `)),[]});var bb=(e=>(e[e.None=0]="None",e[e.Closed=1]="Closed",e[e.Enter=2]="Enter",e[e.Leave=4]="Leave",e))(bb||{});function gl(e){let t={};for(let n in e)e[n]===!0&&(t[`data-${n}`]="");return t}function bl(e,t,n,r){let[o,s]=E.useState(n),{hasFlag:i,addFlag:c,removeFlag:a}=gb(e&&o?3:0),u=E.useRef(!1),l=E.useRef(!1),f=Hn();return ge(()=>{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),yb(t,{inFlight:u,prepare(){l.current?l.current=!1:l.current=u.current,u.current=!0,!l.current&&(n?(c(3),a(4)):(c(4),a(2)))},run(){l.current?n?(a(3),c(4)):(a(4),c(3)):n?a(1):c(1)},done(){var d;l.current&&typeof t.getAnimations=="function"&&t.getAnimations().length>0||(u.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 yb(e,{prepare:t,run:n,done:r,inFlight:o}){let s=pt();return wb(e,{prepare:t,inFlight:o}),s.nextFrame(()=>{n(),s.requestAnimationFrame(()=>{s.add(vb(e,r))})}),s.dispose}function vb(e,t){var n,r;let o=pt();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 wb(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 Wo(){return typeof window<"u"}function qn(e){return Mi(e)?(e.nodeName||"").toLowerCase():"#document"}function _e(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Ot(e){var t;return(t=(Mi(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function Mi(e){return Wo()?e instanceof Node||e instanceof _e(e).Node:!1}function de(e){return Wo()?e instanceof Element||e instanceof _e(e).Element:!1}function Le(e){return Wo()?e instanceof HTMLElement||e instanceof _e(e).HTMLElement:!1}function ki(e){return!Wo()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof _e(e).ShadowRoot}const xb=new Set(["inline","contents"]);function Br(e){const{overflow:t,overflowX:n,overflowY:r,display:o}=it(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!xb.has(o)}const Eb=new Set(["table","td","th"]);function Sb(e){return Eb.has(qn(e))}const Pb=[":popover-open",":modal"];function Ho(e){return Pb.some(t=>{try{return e.matches(t)}catch{return!1}})}const $b=["transform","translate","scale","rotate","perspective"],Tb=["transform","translate","scale","rotate","perspective","filter"],Ab=["paint","layout","strict","content"];function Li(e){const t=Vo(),n=de(e)?it(e):e;return $b.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)||Tb.some(r=>(n.willChange||"").includes(r))||Ab.some(r=>(n.contain||"").includes(r))}function Cb(e){let t=Gt(e);for(;Le(t)&&!Vt(t);){if(Li(t))return t;if(Ho(t))return null;t=Gt(t)}return null}function Vo(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const Ob=new Set(["html","body","#document"]);function Vt(e){return Ob.has(qn(e))}function it(e){return _e(e).getComputedStyle(e)}function Go(e){return de(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Gt(e){if(qn(e)==="html")return e;const t=e.assignedSlot||e.parentNode||ki(e)&&e.host||Ot(e);return ki(t)?t.host:t}function yl(e){const t=Gt(e);return Vt(t)?e.ownerDocument?e.ownerDocument.body:e.body:Le(t)&&Br(t)?t:yl(t)}function pn(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const o=yl(e),s=o===((r=e.ownerDocument)==null?void 0:r.body),i=_e(o);if(s){const c=Bi(i);return t.concat(i,i.visualViewport||[],Br(o)?o:[],c&&n?pn(c):[])}return t.concat(o,pn(o,[],n))}function Bi(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function Ib(){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 qt=Math.min,Ne=Math.max,Rr=Math.round,qo=Math.floor,It=e=>({x:e,y:e}),Nb={left:"right",right:"left",bottom:"top",top:"bottom"},Mb={start:"end",end:"start"};function Ri(e,t,n){return Ne(e,qt(t,n))}function Tn(e,t){return typeof e=="function"?e(t):e}function hn(e){return e.split("-")[0]}function Zn(e){return e.split("-")[1]}function vl(e){return e==="x"?"y":"x"}function Di(e){return e==="y"?"height":"width"}const kb=new Set(["top","bottom"]);function Zt(e){return kb.has(hn(e))?"y":"x"}function Fi(e){return vl(Zt(e))}function Lb(e,t,n){n===void 0&&(n=!1);const r=Zn(e),o=Fi(e),s=Di(o);let i=o==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[s]>t.floating[s]&&(i=Zo(i)),[i,Zo(i)]}function Bb(e){const t=Zo(e);return[ji(e),t,ji(t)]}function ji(e){return e.replace(/start|end/g,t=>Mb[t])}const wl=["left","right"],xl=["right","left"],Rb=["top","bottom"],Db=["bottom","top"];function Fb(e,t,n){switch(e){case"top":case"bottom":return n?t?xl:wl:t?wl:xl;case"left":case"right":return t?Rb:Db;default:return[]}}function jb(e,t,n,r){const o=Zn(e);let s=Fb(hn(e),n==="start",r);return o&&(s=s.map(i=>i+"-"+o),t&&(s=s.concat(s.map(ji)))),s}function Zo(e){return e.replace(/left|right|bottom|top/g,t=>Nb[t])}function _b(e){return{top:0,right:0,bottom:0,left:0,...e}}function El(e){return typeof e!="number"?_b(e):{top:e,right:e,bottom:e,left:e}}function Ko(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}}/*!
81
81
  * tabbable 6.2.0
82
82
  * @license MIT, https://github.com/focus-trap/tabbable/blob/master/LICENSE
83
- */var zb=["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])"],_i=zb.join(","),Sl=typeof Element>"u",Fr=Sl?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,Yo=!Sl&&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},Xo=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},Wb=function(t){var n,r=t==null||(n=t.getAttribute)===null||n===void 0?void 0:n.call(t,"contenteditable");return r===""||r==="true"},Hb=function(t,n,r){if(Xo(t))return[];var o=Array.prototype.slice.apply(t.querySelectorAll(_i));return n&&Fr.call(t,_i)&&o.unshift(t),o=o.filter(r),o},Vb=function e(t,n,r){for(var o=[],s=Array.from(t);s.length;){var i=s.shift();if(!Xo(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=Fr.call(i,_i);l&&r.filter(i)&&(n||!t.includes(i))&&o.push(i);var f=i.shadowRoot||typeof r.getShadowRoot=="function"&&r.getShadowRoot(i),p=!Xo(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},Pl=function(t){return!isNaN(parseInt(t.getAttribute("tabindex"),10))},$l=function(t){if(!t)throw new Error("No node provided");return t.tabIndex<0&&(/^(AUDIO|VIDEO|DETAILS)$/.test(t.tagName)||Wb(t))&&!Pl(t)?0:t.tabIndex},Gb=function(t,n){var r=$l(t);return r<0&&n&&!Pl(t)?0:r},qb=function(t,n){return t.tabIndex===n.tabIndex?t.documentOrder-n.documentOrder:t.tabIndex-n.tabIndex},Al=function(t){return t.tagName==="INPUT"},Zb=function(t){return Al(t)&&t.type==="hidden"},Kb=function(t){var n=t.tagName==="DETAILS"&&Array.prototype.slice.apply(t.children).some(function(r){return r.tagName==="SUMMARY"});return n},Yb=function(t,n){for(var r=0;r<t.length;r++)if(t[r].checked&&t[r].form===n)return t[r]},Xb=function(t){if(!t.name)return!0;var n=t.form||Yo(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=Yb(o,t.form);return!s||s===t},Qb=function(t){return Al(t)&&t.type==="radio"},Jb=function(t){return Qb(t)&&!Xb(t)},ey=function(t){var n,r=t&&Yo(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=Yo(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},Tl=function(t){var n=t.getBoundingClientRect(),r=n.width,o=n.height;return r===0&&o===0},ty=function(t,n){var r=n.displayCheck,o=n.getShadowRoot;if(getComputedStyle(t).visibility==="hidden")return!0;var s=Fr.call(t,"details>summary:first-of-type"),i=s?t.parentElement:t;if(Fr.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=Yo(t);if(a&&!a.shadowRoot&&o(a)===!0)return Tl(t);t.assignedSlot?t=t.assignedSlot:!a&&u!==t.ownerDocument?t=u.host:t=a}t=c}if(ey(t))return!t.getClientRects().length;if(r!=="legacy-full")return!0}else if(r==="non-zero-area")return Tl(t);return!1},ny=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 Fr.call(n,"fieldset[disabled] *")?!0:!o.contains(t)}return!0}n=n.parentElement}return!1},ry=function(t,n){return!(n.disabled||Xo(n)||Zb(n)||ty(n,t)||Kb(n)||ny(n))},Cl=function(t,n){return!(Jb(n)||$l(n)<0||!ry(t,n))},oy=function(t){var n=parseInt(t.getAttribute("tabindex"),10);return!!(isNaN(n)||n>=0)},sy=function e(t){var n=[],r=[];return t.forEach(function(o,s){var i=!!o.scopeParent,c=i?o.scopeParent:o,a=Gb(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(qb).reduce(function(o,s){return s.isScope?o.push.apply(o,s.content):o.push(s.content),o},[]).concat(n)},Ol=function(t,n){n=n||{};var r;return n.getShadowRoot?r=Vb([t],n.includeContainer,{filter:Cl.bind(null,n),flatten:!1,getShadowRoot:n.getShadowRoot,shadowRootFilter:oy}):r=Hb(t,n.includeContainer,Cl.bind(null,n)),sy(r)};function Nl(e,t,n){let{reference:r,floating:o}=e;const s=Gt(t),i=Di(t),c=Fi(i),a=hn(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(Kn(t)){case"start":d[i]-=p*(n&&u?-1:1);break;case"end":d[i]+=p*(n&&u?-1:1);break}return d}const iy=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}=Nl(u,r,a),p=r,d={},h=0;for(let m=0;m<c.length;m++){const{name:v,fn:C}=c[m],{x:y,y:$,data:B,reset:k}=await C({x:l,y:f,initialPlacement:r,placement:p,strategy:o,middlewareData:d,rects:u,platform:i,elements:{reference:e,floating:t}});l=y??l,f=$??f,d={...d,[v]:{...d[v],...B}},k&&h<=50&&(h++,typeof k=="object"&&(k.placement&&(p=k.placement),k.rects&&(u=k.rects===!0?await i.getElementRects({reference:e,floating:t,strategy:o}):k.rects),{x:l,y:f}=Nl(u,p,a)),m=-1)}return{x:l,y:f,placement:p,strategy:o,middlewareData:d}};async function Qo(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}=Tn(t,e),h=El(d),v=c[p?f==="floating"?"reference":"floating":f],C=Ko(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})),y=f==="floating"?{x:r,y:o,width:i.floating.width,height:i.floating.height}:i.reference,$=await(s.getOffsetParent==null?void 0:s.getOffsetParent(c.floating)),B=await(s.isElement==null?void 0:s.isElement($))?await(s.getScale==null?void 0:s.getScale($))||{x:1,y:1}:{x:1,y:1},k=Ko(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:c,rect:y,offsetParent:$,strategy:a}):y);return{top:(C.top-k.top+h.top)/B.y,bottom:(k.bottom-C.bottom+h.bottom)/B.y,left:(C.left-k.left+h.left)/B.x,right:(k.right-C.right+h.right)/B.x}}const ay=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}=Tn(e,t)||{};if(u==null)return{};const f=El(l),p={x:n,y:r},d=Di(o),h=Fi(d),m=await i.getDimensions(u),v=d==="y",C=v?"top":"left",y=v?"bottom":"right",$=v?"clientHeight":"clientWidth",B=s.reference[h]+s.reference[d]-p[d]-s.floating[h],k=p[d]-s.reference[d],D=await(i.getOffsetParent==null?void 0:i.getOffsetParent(u));let j=D?D[$]:0;(!j||!await(i.isElement==null?void 0:i.isElement(D)))&&(j=c.floating[$]||s.floating[h]);const g=B/2-k/2,w=j/2-m[h]/2-1,A=Vt(f[C],w),I=Vt(f[y],w),N=A,P=j-m[h]-I,S=j/2-m[h]/2+g,x=Ri(N,S,P),T=!a.arrow&&Kn(o)!=null&&S!==x&&s.reference[h]/2-(S<N?A:I)-m[h]/2<0,O=T?S<N?S-N:S-P:0;return{[d]:p[d]+O,data:{[d]:x,centerOffset:S-x-O,...T&&{alignmentOffset:O}},reset:T}}}),cy=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}=Tn(e,t);if((n=s.arrow)!=null&&n.alignmentOffset)return{};const C=hn(o),y=Gt(c),$=hn(c)===c,B=await(a.isRTL==null?void 0:a.isRTL(u.floating)),k=p||($||!m?[Zo(c)]:Rb(c)),D=h!=="none";!p&&D&&k.push(..._b(c,m,h,B));const j=[c,...k],g=await Qo(t,v),w=[];let A=((r=s.flip)==null?void 0:r.overflows)||[];if(l&&w.push(g[C]),f){const S=kb(o,i,B);w.push(g[S[0]],g[S[1]])}if(A=[...A,{placement:o,overflows:w}],!w.every(S=>S<=0)){var I,N;const S=(((I=s.flip)==null?void 0:I.index)||0)+1,x=j[S];if(x&&(!(f==="alignment"?y!==Gt(x):!1)||A.every(b=>Gt(b.placement)===y?b.overflows[0]>0:!0)))return{data:{index:S,overflows:A},reset:{placement:x}};let T=(N=A.filter(O=>O.overflows[0]<=0).sort((O,b)=>O.overflows[1]-b.overflows[1])[0])==null?void 0:N.placement;if(!T)switch(d){case"bestFit":{var P;const O=(P=A.filter(b=>{if(D){const L=Gt(b.placement);return L===y||L==="y"}return!0}).map(b=>[b.placement,b.overflows.filter(L=>L>0).reduce((L,F)=>L+F,0)]).sort((b,L)=>b[1]-L[1])[0])==null?void 0:P[0];O&&(T=O);break}case"initialPlacement":T=c;break}if(o!==T)return{reset:{placement:T}}}return{}}}},uy=new Set(["left","top"]);async function ly(e,t){const{placement:n,platform:r,elements:o}=e,s=await(r.isRTL==null?void 0:r.isRTL(o.floating)),i=hn(n),c=Kn(n),a=Gt(n)==="y",u=uy.has(i)?-1:1,l=s&&a?-1:1,f=Tn(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 fy=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 ly(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}}}}},dy=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:C,y}=v;return{x:C,y}}},...a}=Tn(e,t),u={x:n,y:r},l=await Qo(t,a),f=Gt(hn(o)),p=vl(f);let d=u[p],h=u[f];if(s){const v=p==="y"?"top":"left",C=p==="y"?"bottom":"right",y=d+l[v],$=d-l[C];d=Ri(y,d,$)}if(i){const v=f==="y"?"top":"left",C=f==="y"?"bottom":"right",y=h+l[v],$=h-l[C];h=Ri(y,h,$)}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}}}}}},py=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}=Tn(e,t),l=await Qo(t,u),f=hn(o),p=Kn(o),d=Gt(o)==="y",{width:h,height:m}=s.floating;let v,C;f==="top"||f==="bottom"?(v=f,C=p===(await(i.isRTL==null?void 0:i.isRTL(c.floating))?"start":"end")?"left":"right"):(C=f,v=p==="end"?"top":"bottom");const y=m-l.top-l.bottom,$=h-l.left-l.right,B=Vt(m-l[v],y),k=Vt(h-l[C],$),D=!t.middlewareData.shift;let j=B,g=k;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(g=$),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(j=y),D&&!p){const A=Ie(l.left,0),I=Ie(l.right,0),N=Ie(l.top,0),P=Ie(l.bottom,0);d?g=h-2*(A!==0||I!==0?A+I:Ie(l.left,l.right)):j=m-2*(N!==0||P!==0?N+P:Ie(l.top,l.bottom))}await a({...t,availableWidth:g,availableHeight:j});const w=await i.getDimensions(c.floating);return h!==w.width||m!==w.height?{reset:{rects:!0}}:{}}}};function Il(e){const t=it(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const o=Be(e),s=o?e.offsetWidth:n,i=o?e.offsetHeight:r,c=Rr(n)!==s||Rr(r)!==i;return c&&(n=s,r=i),{width:n,height:r,$:c}}function Ui(e){return de(e)?e:e.contextElement}function Yn(e){const t=Ui(e);if(!Be(t))return Ot(1);const n=t.getBoundingClientRect(),{width:r,height:o,$:s}=Il(t);let i=(s?Rr(n.width):n.width)/r,c=(s?Rr(n.height):n.height)/o;return(!i||!Number.isFinite(i))&&(i=1),(!c||!Number.isFinite(c))&&(c=1),{x:i,y:c}}const hy=Ot(0);function Ml(e){const t=_e(e);return!Vo()||!t.visualViewport?hy:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function my(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==_e(e)?!1:t}function Cn(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const o=e.getBoundingClientRect(),s=Ui(e);let i=Ot(1);t&&(r?de(r)&&(i=Yn(r)):i=Yn(e));const c=my(s,n,r)?Ml(s):Ot(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=_e(s),d=r&&de(r)?_e(r):r;let h=p,m=ki(h);for(;m&&r&&d!==h;){const v=Yn(m),C=m.getBoundingClientRect(),y=it(m),$=C.left+(m.clientLeft+parseFloat(y.paddingLeft))*v.x,B=C.top+(m.clientTop+parseFloat(y.paddingTop))*v.y;a*=v.x,u*=v.y,l*=v.x,f*=v.y,a+=$,u+=B,h=_e(m),m=ki(h)}}return Ko({width:l,height:f,x:a,y:u})}function Jo(e,t){const n=Go(e).scrollLeft;return t?t.left+n:Cn(Ct(e)).left+n}function Ll(e,t){const n=e.getBoundingClientRect(),r=n.left+t.scrollLeft-Jo(e,n),o=n.top+t.scrollTop;return{x:r,y:o}}function gy(e){let{elements:t,rect:n,offsetParent:r,strategy:o}=e;const s=o==="fixed",i=Ct(r),c=t?Ho(t.floating):!1;if(r===i||c&&s)return n;let a={scrollLeft:0,scrollTop:0},u=Ot(1);const l=Ot(0),f=Be(r);if((f||!f&&!s)&&((Zn(r)!=="body"||kr(i))&&(a=Go(r)),Be(r))){const d=Cn(r);u=Yn(r),l.x=d.x+r.clientLeft,l.y=d.y+r.clientTop}const p=i&&!f&&!s?Ll(i,a):Ot(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 by(e){return Array.from(e.getClientRects())}function yy(e){const t=Ct(e),n=Go(e),r=e.ownerDocument.body,o=Ie(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),s=Ie(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let i=-n.scrollLeft+Jo(e);const c=-n.scrollTop;return it(r).direction==="rtl"&&(i+=Ie(t.clientWidth,r.clientWidth)-o),{width:o,height:s,x:i,y:c}}const Bl=25;function vy(e,t){const n=_e(e),r=Ct(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=Vo();(!l||l&&t==="fixed")&&(c=o.offsetLeft,a=o.offsetTop)}const u=Jo(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<=Bl&&(s-=h)}else u<=Bl&&(s+=u);return{width:s,height:i,x:c,y:a}}const wy=new Set(["absolute","fixed"]);function xy(e,t){const n=Cn(e,!0,t==="fixed"),r=n.top+e.clientTop,o=n.left+e.clientLeft,s=Be(e)?Yn(e):Ot(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 kl(e,t,n){let r;if(t==="viewport")r=vy(e,n);else if(t==="document")r=yy(Ct(e));else if(de(t))r=xy(t,n);else{const o=Ml(e);r={x:t.x-o.x,y:t.y-o.y,width:t.width,height:t.height}}return Ko(r)}function Rl(e,t){const n=Ht(e);return n===t||!de(n)||Wt(n)?!1:it(n).position==="fixed"||Rl(n,t)}function Ey(e,t){const n=t.get(e);if(n)return n;let r=pn(e,[],!1).filter(c=>de(c)&&Zn(c)!=="body"),o=null;const s=it(e).position==="fixed";let i=s?Ht(e):e;for(;de(i)&&!Wt(i);){const c=it(i),a=Bi(i);!a&&c.position==="fixed"&&(o=null),(s?!a&&!o:!a&&c.position==="static"&&!!o&&wy.has(o.position)||kr(i)&&!a&&Rl(e,i))?r=r.filter(l=>l!==i):o=c,i=Ht(i)}return t.set(e,r),r}function Sy(e){let{element:t,boundary:n,rootBoundary:r,strategy:o}=e;const i=[...n==="clippingAncestors"?Ho(t)?[]:Ey(t,this._c):[].concat(n),r],c=i[0],a=i.reduce((u,l)=>{const f=kl(t,l,o);return u.top=Ie(f.top,u.top),u.right=Vt(f.right,u.right),u.bottom=Vt(f.bottom,u.bottom),u.left=Ie(f.left,u.left),u},kl(t,c,o));return{width:a.right-a.left,height:a.bottom-a.top,x:a.left,y:a.top}}function Py(e){const{width:t,height:n}=Il(e);return{width:t,height:n}}function $y(e,t,n){const r=Be(t),o=Ct(t),s=n==="fixed",i=Cn(e,!0,s,t);let c={scrollLeft:0,scrollTop:0};const a=Ot(0);function u(){a.x=Jo(o)}if(r||!r&&!s)if((Zn(t)!=="body"||kr(o))&&(c=Go(t)),r){const d=Cn(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?Ll(o,c):Ot(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 zi(e){return it(e).position==="static"}function Fl(e,t){if(!Be(e)||it(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return Ct(e)===n&&(n=n.ownerDocument.body),n}function Dl(e,t){const n=_e(e);if(Ho(e))return n;if(!Be(e)){let o=Ht(e);for(;o&&!Wt(o);){if(de(o)&&!zi(o))return o;o=Ht(o)}return n}let r=Fl(e,t);for(;r&&Pb(r)&&zi(r);)r=Fl(r,t);return r&&Wt(r)&&zi(r)&&!Bi(r)?n:r||Ob(e)||n}const Ay=async function(e){const t=this.getOffsetParent||Dl,n=this.getDimensions,r=await n(e.floating);return{reference:$y(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function Ty(e){return it(e).direction==="rtl"}const Cy={convertOffsetParentRelativeRectToViewportRelativeRect:gy,getDocumentElement:Ct,getClippingRect:Sy,getOffsetParent:Dl,getElementRects:Ay,getClientRects:by,getDimensions:Py,getScale:Yn,isElement:de,isRTL:Ty};function jl(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function Oy(e,t){let n=null,r;const o=Ct(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=qo(f),m=qo(o.clientWidth-(l+p)),v=qo(o.clientHeight-(f+d)),C=qo(l),$={rootMargin:-h+"px "+-m+"px "+-v+"px "+-C+"px",threshold:Ie(0,Vt(1,a))||1};let B=!0;function k(D){const j=D[0].intersectionRatio;if(j!==a){if(!B)return i();j?i(!1,j):r=setTimeout(()=>{i(!1,1e-7)},1e3)}j===1&&!jl(u,e.getBoundingClientRect())&&i(),B=!1}try{n=new IntersectionObserver(k,{...$,root:o.ownerDocument})}catch{n=new IntersectionObserver(k,$)}n.observe(e)}return i(!0),s}function _l(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=Ui(e),l=o||s?[...u?pn(u):[],...pn(t)]:[];l.forEach(C=>{o&&C.addEventListener("scroll",n,{passive:!0}),s&&C.addEventListener("resize",n)});const f=u&&c?Oy(u,n):null;let p=-1,d=null;i&&(d=new ResizeObserver(C=>{let[y]=C;y&&y.target===u&&d&&(d.unobserve(t),cancelAnimationFrame(p),p=requestAnimationFrame(()=>{var $;($=d)==null||$.observe(t)})),n()}),u&&!a&&d.observe(u),d.observe(t));let h,m=a?Cn(e):null;a&&v();function v(){const C=Cn(e);m&&!jl(m,C)&&n(),m=C,h=requestAnimationFrame(v)}return n(),()=>{var C;l.forEach(y=>{o&&y.removeEventListener("scroll",n),s&&y.removeEventListener("resize",n)}),f==null||f(),(C=d)==null||C.disconnect(),d=null,a&&cancelAnimationFrame(h)}}const Wi=Qo,Ny=fy,Iy=dy,My=cy,Ly=py,Ul=ay,By=(e,t,n)=>{const r=new Map,o={platform:Cy,...n},s={...o.platform,_c:r};return iy(e,t,{...o,platform:s})};var ky=typeof document<"u",Ry=function(){},es=ky?E.useLayoutEffect:Ry;function ts(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(!ts(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)&&!ts(e[s],t[s]))return!1}return!0}return e!==e&&t!==t}function zl(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Wl(e,t){const n=zl(e);return Math.round(t*n)/n}function Hi(e){const t=_.useRef(e);return es(()=>{t.current=e}),t}function Hl(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]=_.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[p,d]=_.useState(r);ts(p,r)||d(r);const[h,m]=_.useState(null),[v,C]=_.useState(null),y=_.useCallback(b=>{b!==D.current&&(D.current=b,m(b))},[]),$=_.useCallback(b=>{b!==j.current&&(j.current=b,C(b))},[]),B=s||h,k=i||v,D=_.useRef(null),j=_.useRef(null),g=_.useRef(l),w=a!=null,A=Hi(a),I=Hi(o),N=Hi(u),P=_.useCallback(()=>{if(!D.current||!j.current)return;const b={placement:t,strategy:n,middleware:p};I.current&&(b.platform=I.current),By(D.current,j.current,b).then(L=>{const F={...L,isPositioned:N.current!==!1};S.current&&!ts(g.current,F)&&(g.current=F,Ar.flushSync(()=>{f(F)}))})},[p,t,n,I,N]);es(()=>{u===!1&&g.current.isPositioned&&(g.current.isPositioned=!1,f(b=>({...b,isPositioned:!1})))},[u]);const S=_.useRef(!1);es(()=>(S.current=!0,()=>{S.current=!1}),[]),es(()=>{if(B&&(D.current=B),k&&(j.current=k),B&&k){if(A.current)return A.current(B,k,P);P()}},[B,k,P,A,w]);const x=_.useMemo(()=>({reference:D,floating:j,setReference:y,setFloating:$}),[y,$]),T=_.useMemo(()=>({reference:B,floating:k}),[B,k]),O=_.useMemo(()=>{const b={position:n,left:0,top:0};if(!T.floating)return b;const L=Wl(T.floating,l.x),F=Wl(T.floating,l.y);return c?{...b,transform:"translate("+L+"px, "+F+"px)",...zl(T.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:L,top:F}},[n,c,T.floating,l.x,l.y]);return _.useMemo(()=>({...l,update:P,refs:x,elements:T,floatingStyles:O}),[l,P,x,T,O])}const Fy=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?Ul({element:r.current,padding:o}).fn(n):{}:r?Ul({element:r,padding:o}).fn(n):{}}}},Vi=(e,t)=>({...Ny(e),options:[e,t]}),Vl=(e,t)=>({...Iy(e),options:[e,t]}),Gl=(e,t)=>({...My(e),options:[e,t]}),Dy=(e,t)=>({...Ly(e),options:[e,t]}),jy=(e,t)=>({...Fy(e),options:[e,t]}),ql={..._},_y=ql.useInsertionEffect||(e=>e());function Zl(e){const t=_.useRef(()=>{if(process.env.NODE_ENV!=="production")throw new Error("Cannot call an event handler while rendering.")});return _y(()=>{t.current=e}),_.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 Gi=typeof document<"u"?E.useLayoutEffect:E.useEffect;let Kl=!1,Uy=0;const Yl=()=>"floating-ui-"+Math.random().toString(36).slice(2,6)+Uy++;function zy(){const[e,t]=_.useState(()=>Kl?Yl():void 0);return Gi(()=>{e==null&&t(Yl())},[]),_.useEffect(()=>{Kl=!0},[]),e}const Wy=ql.useId||zy;let Dr;process.env.NODE_ENV!=="production"&&(Dr=new Set);function Hy(){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=Dr)!=null&&e.has(o))){var s;(s=Dr)==null||s.add(o),console.warn(o)}}function Vy(){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=Dr)!=null&&e.has(o))){var s;(s=Dr)==null||s.add(o),console.error(o)}}function Gy(){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 qy=_.createContext(null),Zy=_.createContext(null),Ky=()=>{var e;return((e=_.useContext(qy))==null?void 0:e.id)||null},Yy=()=>_.useContext(Zy),Xy="data-floating-ui-focusable";function Qy(e){const{open:t=!1,onOpenChange:n,elements:r}=e,o=Wy(),s=_.useRef({}),[i]=_.useState(()=>Gy()),c=Ky()!=null;if(process.env.NODE_ENV!=="production"){const d=r.reference;d&&!de(d)&&Vy("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]=_.useState(r.reference),l=Zl((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=_.useMemo(()=>({setPositionReference:u}),[]),p=_.useMemo(()=>({reference:a||r.reference||null,floating:r.floating||null,domReference:r.reference}),[a,r.reference,r.floating]);return _.useMemo(()=>({dataRef:s,open:t,onOpenChange:l,elements:p,events:i,floatingId:o,refs:f}),[t,l,p,i,o,f])}function Jy(e){e===void 0&&(e={});const{nodeId:t}=e,n=Qy({...e,elements:{reference:null,floating:null,...e.elements}}),r=e.rootContext||n,o=r.elements,[s,i]=_.useState(null),[c,a]=_.useState(null),l=(o==null?void 0:o.domReference)||s,f=_.useRef(null),p=Yy();Gi(()=>{l&&(f.current=l)},[l]);const d=Hl({...e,elements:{...o,...c&&{reference:c}}}),h=_.useCallback($=>{const B=de($)?{getBoundingClientRect:()=>$.getBoundingClientRect(),contextElement:$}:$;a(B),d.refs.setReference(B)},[d.refs]),m=_.useCallback($=>{(de($)||$===null)&&(f.current=$,i($)),(de(d.refs.reference.current)||d.refs.reference.current===null||$!==null&&!de($))&&d.refs.setReference($)},[d.refs]),v=_.useMemo(()=>({...d.refs,setReference:m,setPositionReference:h,domReference:f}),[d.refs,m,h]),C=_.useMemo(()=>({...d.elements,domReference:l}),[d.elements,l]),y=_.useMemo(()=>({...d,...r,refs:v,elements:C,nodeId:t}),[d,v,C,t,r]);return Gi(()=>{r.dataRef.current.floatingContext=y;const $=p==null?void 0:p.nodesRef.current.find(B=>B.id===t);$&&($.context=y)}),_.useMemo(()=>({...d,context:y,refs:v,elements:C}),[d,v,C,y])}const Xl="active",Ql="selected";function qi(e,t,n){const r=new Map,o=n==="item";let s=e;if(o&&e){const{[Xl]:i,[Ql]:c,...a}=e;s=a}return{...n==="floating"&&{tabIndex:-1,[Xy]:""},...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&&[Xl,Ql].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 ev(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=_.useCallback(c=>qi(c,e,"reference"),t),s=_.useCallback(c=>qi(c,e,"floating"),n),i=_.useCallback(c=>qi(c,e,"item"),r);return _.useMemo(()=>({getReferenceProps:o,getFloatingProps:s,getItemProps:i}),[o,s,i])}function Jl(e,t){return{...e,rects:{...e.rects,floating:{...e.rects.floating,height:t}}}}const tv=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}=Tn(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,C=h.clientTop!==0,y=p===h;if(process.env.NODE_ENV!=="production"&&(t.placement.startsWith("bottom")||Hy('`placement` side must be "bottom" when using the `inner`',"middleware.")),!d)return{};const $={...t,...await Vi(-d.offsetTop-p.clientTop-f.reference.height/2-d.offsetHeight/2-s).fn(t)},B=await Wi(Jl($,h.scrollHeight+m+p.clientTop),l),k=await Wi($,{...l,elementContext:"reference"}),D=Ie(0,B.top),j=$.y+D,A=(h.scrollHeight>h.clientHeight?I=>I:Rr)(Ie(0,h.scrollHeight+(v&&y||C?m*2:0)-D-Ie(0,B.bottom)));if(h.style.maxHeight=A+"px",h.scrollTop=D,o){const I=h.offsetHeight<d.offsetHeight*Vt(c,n.current.length)-1||k.top>=-a||k.bottom>=-a;Ar.flushSync(()=>o(I))}return r&&(r.current=await Wi(Jl({...$,y:j},h.offsetHeight+m+p.clientTop),l)),{y:j}}});function nv(e,t){const{open:n,elements:r}=e,{enabled:o=!0,overflowRef:s,scrollRef:i,onChange:c}=t,a=Zl(c),u=_.useRef(!1),l=_.useRef(null),f=_.useRef(null);_.useEffect(()=>{if(!o)return;function d(m){if(m.ctrlKey||!h||s.current==null)return;const v=m.deltaY,C=s.current.top>=-.5,y=s.current.bottom>=-.5,$=h.scrollHeight-h.clientHeight,B=v<0?-1:1,k=v<0?"max":"min";h.scrollHeight<=h.clientHeight||(!C&&v>0||!y&&v<0?(m.preventDefault(),Ar.flushSync(()=>{a(D=>D+Math[k](v,$*B))})):/firefox/i.test(Ib())&&(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=_.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)&&Ar.flushSync(()=>a(m=>m+h))}requestAnimationFrame(()=>{l.current=d.scrollTop})}}}),[r.floating,a,s,i]);return _.useMemo(()=>o?{floating:p}:{},[o,p])}let Xn=E.createContext({styles:void 0,setReference:()=>{},setFloating:()=>{},getReferenceProps:()=>({}),getFloatingProps:()=>({}),slot:{}});Xn.displayName="FloatingContext";let Zi=E.createContext(null);Zi.displayName="PlacementContext";function rv(e){return E.useMemo(()=>e?typeof e=="string"?{to:e}:e:null,[e])}function ov(){return E.useContext(Xn).setReference}function sv(){return E.useContext(Xn).getReferenceProps}function iv(){let{getFloatingProps:e,slot:t}=E.useContext(Xn);return E.useCallback((...n)=>Object.assign({},e(...n),{"data-anchor":t.anchor}),[e,t])}function av(e=null){e===!1&&(e=null),typeof e=="string"&&(e={to:e});let t=E.useContext(Zi),n=E.useMemo(()=>e,[JSON.stringify(e,(o,s)=>{var i;return(i=s==null?void 0:s.outerHTML)!=null?i:s})]);ge(()=>{t==null||t(n??null)},[t,n]);let r=E.useContext(Xn);return E.useMemo(()=>[r.setFloating,e?r.styles:{}],[r.setFloating,e,r.styles])}let ef=4;function cv({children:e,enabled:t=!0}){let[n,r]=E.useState(null),[o,s]=E.useState(0),i=E.useRef(null),[c,a]=E.useState(null);uv(c);let u=t&&n!==null&&c!==null,{to:l="bottom",gap:f=0,offset:p=0,padding:d=0,inner:h}=lv(n,c),[m,v="center"]=l.split(" ");ge(()=>{u&&s(0)},[u]);let{refs:C,floatingStyles:y,context:$}=Jy({open:u,placement:m==="selection"?v==="center"?"bottom":`bottom-${v}`:v==="center"?`${m}`:`${m}-${v}`,strategy:"absolute",transform:!1,middleware:[Vi({mainAxis:m==="selection"?0:f,crossAxis:p}),Vl({padding:d}),m!=="selection"&&Gl({padding:d}),m==="selection"&&h?tv({...h,padding:d,overflowRef:i,offset:o,minItemsVisible:ef,referenceOverflowThreshold:d,onFallbackChange(I){var N,P;if(!I)return;let S=$.elements.floating;if(!S)return;let x=parseFloat(getComputedStyle(S).scrollPaddingBottom)||0,T=Math.min(ef,S.childElementCount),O=0,b=0;for(let L of(P=(N=$.elements.floating)==null?void 0:N.childNodes)!=null?P:[])if(zt(L)){let F=L.offsetTop,U=F+L.clientHeight+x,z=S.scrollTop,V=z+S.clientHeight;if(F>=z&&U<=V)T--;else{b=Math.max(0,Math.min(U,V)-Math.max(F,z)),O=L.clientHeight;break}}T>=1&&s(L=>{let F=O*T-b+x;return L>=F?L:F})}}):null,Dy({padding:d,apply({availableWidth:I,availableHeight:N,elements:P}){Object.assign(P.floating.style,{overflow:"auto",maxWidth:`${I}px`,maxHeight:`min(var(--anchor-max-height, 100vh), ${N}px)`})}})].filter(Boolean),whileElementsMounted:_l}),[B=m,k=v]=$.placement.split("-");m==="selection"&&(B="selection");let D=E.useMemo(()=>({anchor:[B,k].filter(Boolean).join(" ")}),[B,k]),j=nv($,{overflowRef:i,onChange:s}),{getReferenceProps:g,getFloatingProps:w}=ev([j]),A=ae(I=>{a(I),C.setFloating(I)});return _.createElement(Zi.Provider,{value:r},_.createElement(Xn.Provider,{value:{setFloating:A,setReference:C.setReference,styles:y,getReferenceProps:g,getFloatingProps:w,slot:D}},e))}function uv(e){ge(()=>{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 lv(e,t){var n,r,o;let s=Ki((n=e==null?void 0:e.gap)!=null?n:"var(--anchor-gap, 0)",t),i=Ki((r=e==null?void 0:e.offset)!=null?r:"var(--anchor-offset, 0)",t),c=Ki((o=e==null?void 0:e.padding)!=null?o:"var(--anchor-padding, 0)",t);return{...e,gap:s,offset:i,padding:c}}function Ki(e,t,n=void 0){let r=Vn(),o=ae((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=nf(a,u);return[l,f=>{let p=tf(a);{let d=p.map(h=>window.getComputedStyle(u).getPropertyValue(h));r.requestAnimationFrame(function h(){r.nextFrame(h);let m=!1;for(let[C,y]of p.entries()){let $=window.getComputedStyle(u).getPropertyValue(y);if(d[C]!==$){d[C]=$,m=!0;break}}if(!m)return;let v=nf(a,u);l!==v&&(f(v),l=v)})}return r.dispose}]}return[n,null]}),s=E.useMemo(()=>o(e,t)[0],[e,t]),[i=s,c]=E.useState();return ge(()=>{let[a,u]=o(e,t);if(c(a),!!u)return u(c)},[e,t]),i}function tf(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,...tf(o)]:[r]}return[]}function nf(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 fv(e,t){let[n,r]=E.useState(t);return!e&&n!==t&&r(t),e?n:t}let Yi=E.createContext(null);Yi.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 Xi(){return E.useContext(Yi)}function rf({value:e,children:t}){return E.createElement(Yi.Provider,{value:e},t)}function dv(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 ns(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:dv(e)}}var of=(e=>(e[e.Left=0]="Left",e[e.Right=2]="Right",e))(of||{});function sf(e){let t=ae(e),n=E.useRef(!1);E.useEffect(()=>(n.current=!1,()=>{n.current=!0,Mu(()=>{n.current&&t()})}),[t])}function pv(){let e=typeof document>"u";return"useSyncExternalStore"in _?(t=>t.useSyncExternalStore)(_)(()=>()=>{},()=>!1,()=>!e):!1}function Qi(){let e=pv(),[t,n]=_.useState(At.isHandoffComplete);return t&&At.isHandoffComplete===!1&&n(!1),_.useEffect(()=>{t!==!0&&n(!0)},[t]),_.useEffect(()=>At.handoff(),[]),e?!1:t}let hv=E.createContext(!1);function mv(){return E.useContext(hv)}function gv(e){let t=mv(),n=E.useContext(cf),[r,o]=E.useState(()=>{var s;if(!t&&n!==null)return(s=n.current)!=null?s:null;if(At.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 E.useEffect(()=>{r!==null&&(e!=null&&e.body.contains(r)||e==null||e.body.appendChild(r))},[r,e]),E.useEffect(()=>{t||n!==null&&o(n.current)},[n,o,t]),r}let af=E.Fragment,bv=je(function(e,t){let{ownerDocument:n=null,...r}=e,o=E.useRef(null),s=rt(vg(d=>{o.current=d}),t),i=Ii(o),c=n??i,a=gv(c),[u]=E.useState(()=>{var d;return At.isServer?null:(d=c==null?void 0:c.createElement("div"))!=null?d:null}),l=E.useContext(xv),f=Qi();ge(()=>{!a||!u||a.contains(u)||(u.setAttribute("data-headlessui-portal",""),a.appendChild(u))},[a,u]),ge(()=>{if(u&&l)return l.register(u)},[l,u]),sf(()=>{var d;!a||!u||(yi(u)&&a.contains(u)&&a.removeChild(u),a.childNodes.length<=0&&((d=a.parentElement)==null||d.removeChild(a)))});let p=Ze();return f?!a||!u?null:Me.createPortal(p({ourProps:{ref:s},theirProps:r,slot:{},defaultTag:af,name:"Portal"}),u):null});function yv(e,t){let n=rt(t),{enabled:r=!0,ownerDocument:o,...s}=e,i=Ze();return r?E.createElement(bv,{...s,ownerDocument:o,ref:n}):i({ourProps:{ref:n},theirProps:s,slot:{},defaultTag:af,name:"Portal"})}let vv=E.Fragment,cf=E.createContext(null);function wv(e,t){let{target:n,...r}=e,o={ref:rt(t)},s=Ze();return E.createElement(cf.Provider,{value:n},s({ourProps:o,theirProps:r,defaultTag:vv,name:"Popover.Group"}))}let xv=E.createContext(null),Ev=je(yv),Sv=je(wv),Pv=Object.assign(Ev,{Group:Sv});function $v(){let e=E.useRef(!1);return ge(()=>(e.current=!0,()=>{e.current=!1}),[]),e}function uf(e){var t;return!!(e.enter||e.enterFrom||e.enterTo||e.leave||e.leaveFrom||e.leaveTo)||((t=e.as)!=null?t:ff)!==E.Fragment||E.Children.count(e.children)===1}let rs=E.createContext(null);rs.displayName="TransitionContext";var Av=(e=>(e.Visible="visible",e.Hidden="hidden",e))(Av||{});function Tv(){let e=E.useContext(rs);if(e===null)throw new Error("A <Transition.Child /> is used but it is missing a parent <Transition /> or <Transition.Root />.");return e}function Cv(){let e=E.useContext(os);if(e===null)throw new Error("A <Transition.Child /> is used but it is missing a parent <Transition /> or <Transition.Root />.");return e}let os=E.createContext(null);os.displayName="NestingContext";function ss(e){return"children"in e?ss(e.children):e.current.filter(({el:t})=>t.current!==null).filter(({state:t})=>t==="visible").length>0}function lf(e,t){let n=$n(e),r=E.useRef([]),o=$v(),s=Vn(),i=ae((d,h=fn.Hidden)=>{let m=r.current.findIndex(({el:v})=>v===d);m!==-1&&(nt(h,{[fn.Unmount](){r.current.splice(m,1)},[fn.Hidden](){r.current[m].state="hidden"}}),s.microTask(()=>{var v;!ss(r)&&o.current&&((v=n.current)==null||v.call(n))}))}),c=ae(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,fn.Unmount)}),a=E.useRef([]),u=E.useRef(Promise.resolve()),l=E.useRef({enter:[],leave:[]}),f=ae((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(([C,y])=>y)).then(()=>v())})]),h==="enter"?u.current=u.current.then(()=>t==null?void 0:t.wait.current).then(()=>m(h)):m(h)}),p=ae((d,h,m)=>{Promise.all(l.current[h].splice(0).map(([v,C])=>C)).then(()=>{var v;(v=a.current.shift())==null||v()}).then(()=>m(h))});return E.useMemo(()=>({children:r,register:c,unregister:i,onStart:f,onStop:p,wait:u,chains:l}),[c,i,r,f,p,l,u])}let ff=E.Fragment,df=Do.RenderStrategy;function Ov(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,[C,y]=E.useState(null),$=E.useRef(null),B=uf(e),k=rt(...B?[$,t,y]:t===null?[]:[t]),D=(n=v.unmount)==null||n?fn.Unmount:fn.Hidden,{show:j,appear:g,initial:w}=Tv(),[A,I]=E.useState(j?"visible":"hidden"),N=Cv(),{register:P,unregister:S}=N;ge(()=>P($),[P,$]),ge(()=>{if(D===fn.Hidden&&$.current){if(j&&A!=="visible"){I("visible");return}return nt(A,{hidden:()=>S($),visible:()=>P($)})}},[A,$,P,S,j,D]);let x=Qi();ge(()=>{if(B&&x&&A==="visible"&&$.current===null)throw new Error("Did you forget to passthrough the `ref` to the actual DOM node?")},[$,A,x,B]);let T=w&&!g,O=g&&j&&w,b=E.useRef(!1),L=lf(()=>{b.current||(I("hidden"),S($))},N),F=ae(G=>{b.current=!0;let X=G?"enter":"leave";L.onStart($,X,ee=>{ee==="enter"?s==null||s():ee==="leave"&&(c==null||c())})}),U=ae(G=>{let X=G?"enter":"leave";b.current=!1,L.onStop($,X,ee=>{ee==="enter"?i==null||i():ee==="leave"&&(a==null||a())}),X==="leave"&&!ss(L)&&(I("hidden"),S($))});E.useEffect(()=>{B&&o||(F(j),U(j))},[j,B,o]);let z=!(!o||!B||!x||T),[,V]=bl(z,C,j,{start:F,end:U}),Z=dn({ref:k,className:((r=mi(v.className,O&&u,O&&l,V.enter&&u,V.enter&&V.closed&&l,V.enter&&!V.closed&&f,V.leave&&d,V.leave&&!V.closed&&h,V.leave&&V.closed&&m,!V.transition&&j&&p))==null?void 0:r.trim())||void 0,...gl(V)}),W=0;A==="visible"&&(W|=mt.Open),A==="hidden"&&(W|=mt.Closed),j&&A==="hidden"&&(W|=mt.Opening),!j&&A==="visible"&&(W|=mt.Closing);let K=Ze();return E.createElement(os.Provider,{value:L},E.createElement(rf,{value:W},K({ourProps:Z,theirProps:v,defaultTag:ff,features:df,visible:A==="visible",name:"Transition.Child"})))}function Nv(e,t){let{show:n,appear:r=!1,unmount:o=!0,...s}=e,i=E.useRef(null),c=uf(e),a=rt(...c?[i,t]:t===null?[]:[t]);Qi();let u=Xi();if(n===void 0&&u!==null&&(n=(u&mt.Open)===mt.Open),n===void 0)throw new Error("A <Transition /> is used but it is missing a `show={true | false}` prop.");let[l,f]=E.useState(n?"visible":"hidden"),p=lf(()=>{n||f("hidden")}),[d,h]=E.useState(!0),m=E.useRef([n]);ge(()=>{d!==!1&&m.current[m.current.length-1]!==n&&(m.current.push(n),h(!1))},[m,n]);let v=E.useMemo(()=>({show:n,appear:r,initial:d}),[n,r,d]);ge(()=>{n?f("visible"):!ss(p)&&i.current!==null&&f("hidden")},[n,p]);let C={unmount:o},y=ae(()=>{var k;d&&h(!1),(k=e.beforeEnter)==null||k.call(e)}),$=ae(()=>{var k;d&&h(!1),(k=e.beforeLeave)==null||k.call(e)}),B=Ze();return E.createElement(os.Provider,{value:p},E.createElement(rs.Provider,{value:v},B({ourProps:{...C,as:E.Fragment,children:E.createElement(pf,{ref:a,...C,...s,beforeEnter:y,beforeLeave:$})},theirProps:{},defaultTag:E.Fragment,features:df,visible:l==="visible",name:"Transition"})))}function Iv(e,t){let n=E.useContext(rs)!==null,r=Xi()!==null;return E.createElement(E.Fragment,null,!n&&r?E.createElement(Ji,{ref:t,...e}):E.createElement(pf,{ref:t,...e}))}let Ji=je(Nv),pf=je(Ov),Mv=je(Iv),hf=Object.assign(Ji,{Child:Mv,Root:Ji});function Lv(e,t){let n=E.useRef({left:0,top:0});if(ge(()=>{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 mf=/([\u2700-\u27BF]|[\uE000-\uF8FF]|\uD83C[\uDC00-\uDFFF]|\uD83D[\uDC00-\uDFFF]|[\u2011-\u26FF]|\uD83E[\uDD10-\uDDFF])/g;function gf(e){var t,n;let r=(t=e.innerText)!=null?t:"",o=e.cloneNode(!0);if(!zt(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 mf.test(i)&&(i=i.replace(mf,"")),i}function Bv(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():gf(s).trim()}return null}).filter(Boolean);if(r.length>0)return r.join(", ")}return gf(e).trim()}function kv(e){let t=E.useRef(""),n=E.useRef("");return ae(()=>{let r=e.current;if(!r)return"";let o=r.innerText;if(t.current===o)return n.current;let s=Bv(r).trim().toLowerCase();return t.current=o,n.current=s,s})}var Rv=Object.defineProperty,Fv=(e,t,n)=>t in e?Rv(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,bf=(e,t,n)=>(Fv(e,typeof t!="symbol"?t+"":t,n),n),Oe=(e=>(e[e.Open=0]="Open",e[e.Closed=1]="Closed",e))(Oe||{}),Nt=(e=>(e[e.Single=0]="Single",e[e.Multi=1]="Multi",e))(Nt||{}),is=(e=>(e[e.Pointer=0]="Pointer",e[e.Other=1]="Other",e))(is||{}),yf=(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))(yf||{});function vf(e,t=n=>n){let n=e.activeOptionIndex!==null?e.options[e.activeOptionIndex]:null,r=cl(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 Dv={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=ns(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=ns(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=vf(e),u=ns(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=ns(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,...vf(e),pendingShouldSort:!1}:e};class ea extends Yu{constructor(t){super(t),bf(this,"actions",{onChange:n=>{let{onChange:r,compare:o,mode:s,value:i}=this.state.dataRef.current;return nt(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:Ei(()=>{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:Ei(()=>{let n=[];return[r=>n.push(r),()=>{this.send({type:6,options:n.splice(0)})}]}),goToOption:Ei(()=>{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})}}),bf(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=Si.get(null);this.disposables.add(r.on(el.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 ea({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 nt(n.type,Dv,t,n)}}const wf=E.createContext(null);function ta(e){let t=E.useContext(wf);if(t===null){let n=new Error(`<${e} /> is missing a parent <Listbox /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,xf),n}return t}function xf({id:e,__demoMode:t=!1}){let n=E.useMemo(()=>ea.new({id:e,__demoMode:t}),[]);return sf(()=>n.dispose()),n}let as=E.createContext(null);as.displayName="ListboxDataContext";function jr(e){let t=E.useContext(as);if(t===null){let n=new Error(`<${e} /> is missing a parent <Listbox /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,jr),n}return t}let jv=E.Fragment;function _v(e,t){let n=E.useId(),r=hi(),{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 C=rt(t),y=og(s),[$=d?[]:void 0,B]=rg(o,a,y),k=xf({id:n,__demoMode:h}),D=E.useRef({static:!1,hold:!1}),j=E.useRef(new Map),g=Ng(u),w=E.useCallback(z=>nt(A.mode,{[Nt.Multi]:()=>$.some(V=>g(V,z)),[Nt.Single]:()=>g($,z)}),[$]),A=E.useMemo(()=>({value:$,disabled:f,invalid:l,mode:d?Nt.Multi:Nt.Single,orientation:v,onChange:B,compare:g,isSelected:w,optionsPropsRef:D,listRef:j}),[$,f,l,d,v,B,g,w,D,j]);ge(()=>{k.state.dataRef.current=A},[A]);let I=st(k,z=>z.listboxState),N=Si.get(null),P=st(N,E.useCallback(z=>N.selectors.isTop(z,n),[N,n])),[S,x]=st(k,z=>[z.buttonElement,z.optionsElement]);rb(P,[S,x],(z,V)=>{k.send({type:yf.CloseListbox}),al(V,Ni.Loose)||(z.preventDefault(),S==null||S.focus())});let T=E.useMemo(()=>({open:I===Oe.Open,disabled:f,invalid:l,value:$}),[I,f,l,$]),[O,b]=Pg({inherit:!0}),L={ref:C},F=E.useCallback(()=>{if(y!==void 0)return B==null?void 0:B(y)},[B,y]),U=Ze();return E.createElement(b,{value:O,props:{htmlFor:S==null?void 0:S.id},slot:{open:I===Oe.Open,disabled:f}},E.createElement(cv,null,E.createElement(wf.Provider,{value:k},E.createElement(as.Provider,{value:A},E.createElement(rf,{value:nt(I,{[Oe.Open]:mt.Open,[Oe.Closed]:mt.Closed})},c!=null&&$!=null&&E.createElement(lg,{disabled:f,data:{[c]:$},form:i,onReset:F}),U({ourProps:L,theirProps:m,slot:T,defaultTag:jv,name:"Listbox"}))))))}let Uv="button";function zv(e,t){let n=E.useId(),r=ju(),o=jr("Listbox.Button"),s=ta("Listbox.Button"),{id:i=r||`headlessui-listbox-button-${n}`,disabled:c=o.disabled||!1,autoFocus:a=!1,...u}=e,l=rt(t,ov(),s.actions.setButtonElement),f=sv(),[p,d,h]=st(s,b=>[b.listboxState,b.buttonElement,b.optionsElement]),m=p===Oe.Open;ib(m,{trigger:d,action:E.useCallback(b=>{if(d!=null&&d.contains(b.target))return zo.Ignore;let L=b.target.closest('[role="option"]:not([data-disabled])');return zt(L)?zo.Select(L):h!=null&&h.contains(b.target)?zo.Ignore:zo.Close},[d,h]),close:s.actions.closeListbox,select:s.actions.selectActiveOption});let v=ae(b=>{switch(b.key){case Ce.Enter:sg(b.currentTarget);break;case Ce.Space:case Ce.ArrowDown:b.preventDefault(),s.actions.openListbox({focus:o.value?ve.Nothing:ve.First});break;case Ce.ArrowUp:b.preventDefault(),s.actions.openListbox({focus:o.value?ve.Nothing:ve.Last});break}}),C=ae(b=>{switch(b.key){case Ce.Space:b.preventDefault();break}}),y=ae(b=>{var L;if(b.button===of.Left){if(bg(b.currentTarget))return b.preventDefault();s.state.listboxState===Oe.Open?(Me.flushSync(()=>s.actions.closeListbox()),(L=s.state.buttonElement)==null||L.focus({preventScroll:!0})):(b.preventDefault(),s.actions.openListbox({focus:ve.Nothing}))}}),$=E.useRef(null),B=ae(b=>{$.current=b.pointerType,b.pointerType==="mouse"&&y(b)}),k=ae(b=>{$.current!=="mouse"&&y(b)}),D=ae(b=>b.preventDefault()),j=Gu([i]),g=wg(),{isFocusVisible:w,focusProps:A}=Vm({autoFocus:a}),{isHovered:I,hoverProps:N}=Hm({isDisabled:c}),{pressed:P,pressProps:S}=Xm({disabled:c}),x=E.useMemo(()=>({open:p===Oe.Open,active:P||p===Oe.Open,disabled:c,invalid:o.invalid,value:o.value,hover:I,focus:w,autofocus:a}),[p,o.value,c,I,w,P,o.invalid,a]),T=st(s,b=>b.listboxState===Oe.Open),O=Bu(f(),{ref:l,id:i,type:ab(e,d),"aria-haspopup":"listbox","aria-controls":h==null?void 0:h.id,"aria-expanded":T,"aria-labelledby":j,"aria-describedby":g,disabled:c||void 0,autoFocus:a,onKeyDown:v,onKeyUp:C,onKeyPress:D,onPointerDown:B,onClick:k},A,N,S);return Ze()({ourProps:O,theirProps:u,slot:x,defaultTag:Uv,name:"Listbox.Button"})}let Ef=E.createContext(!1),Wv="div",Hv=Do.RenderStrategy|Do.Static;function Vv(e,t){let n=E.useId(),{id:r=`headlessui-listbox-options-${n}`,anchor:o,portal:s=!1,modal:i=!0,transition:c=!1,...a}=e,u=rv(o),[l,f]=E.useState(null);u&&(s=!0);let p=jr("Listbox.Options"),d=ta("Listbox.Options"),[h,m,v,C]=st(d,G=>[G.listboxState,G.buttonElement,G.optionsElement,G.__demoMode]),y=Ii(m),$=Ii(v),B=Xi(),[k,D]=bl(c,l,B!==null?(B&mt.Open)===mt.Open:h===Oe.Open);Vg(k,m,d.actions.closeListbox);let j=C?!1:i&&h===Oe.Open;mb(j,$);let g=C?!1:i&&h===Oe.Open;Hg(g,{allowed:E.useCallback(()=>[m,v],[m,v])});let w=h!==Oe.Open,A=Lv(w,m)?!1:k,I=k&&h===Oe.Closed,N=fv(I,p.value),P=ae(G=>p.compare(N,G)),S=st(d,G=>{var X;if(u==null||!((X=u==null?void 0:u.to)!=null&&X.includes("selection")))return null;let ee=G.options.findIndex(le=>P(le.dataRef.current.value));return ee===-1&&(ee=0),ee}),x=(()=>{if(u==null)return;if(S===null)return{...u,inner:void 0};let G=Array.from(p.listRef.current.values());return{...u,inner:{listRef:{current:G},index:S}}})(),[T,O]=av(x),b=iv(),L=rt(t,u?T:null,d.actions.setOptionsElement,f),F=Vn();E.useEffect(()=>{var G;let X=v;X&&h===Oe.Open&&X!==((G=Ir(X))==null?void 0:G.activeElement)&&(X==null||X.focus({preventScroll:!0}))},[h,v]);let U=ae(G=>{var X,ee;switch(F.dispose(),G.key){case Ce.Space:if(d.state.searchQuery!=="")return G.preventDefault(),G.stopPropagation(),d.actions.search(G.key);case Ce.Enter:if(G.preventDefault(),G.stopPropagation(),d.state.activeOptionIndex!==null){let{dataRef:le}=d.state.options[d.state.activeOptionIndex];d.actions.onChange(le.current.value)}p.mode===Nt.Single&&(Me.flushSync(()=>d.actions.closeListbox()),(X=d.state.buttonElement)==null||X.focus({preventScroll:!0}));break;case nt(p.orientation,{vertical:Ce.ArrowDown,horizontal:Ce.ArrowRight}):return G.preventDefault(),G.stopPropagation(),d.actions.goToOption({focus:ve.Next});case nt(p.orientation,{vertical:Ce.ArrowUp,horizontal:Ce.ArrowLeft}):return G.preventDefault(),G.stopPropagation(),d.actions.goToOption({focus:ve.Previous});case Ce.Home:case Ce.PageUp:return G.preventDefault(),G.stopPropagation(),d.actions.goToOption({focus:ve.First});case Ce.End:case Ce.PageDown:return G.preventDefault(),G.stopPropagation(),d.actions.goToOption({focus:ve.Last});case Ce.Escape:G.preventDefault(),G.stopPropagation(),Me.flushSync(()=>d.actions.closeListbox()),(ee=d.state.buttonElement)==null||ee.focus({preventScroll:!0});return;case Ce.Tab:G.preventDefault(),G.stopPropagation(),Me.flushSync(()=>d.actions.closeListbox()),Jg(d.state.buttonElement,G.shiftKey?Oi.Previous:Oi.Next);break;default:G.key.length===1&&(d.actions.search(G.key),F.setTimeout(()=>d.actions.clearSearch(),350));break}}),z=st(d,G=>{var X;return(X=G.buttonElement)==null?void 0:X.id}),V=E.useMemo(()=>({open:h===Oe.Open}),[h]),Z=Bu(u?b():{},{id:r,ref:L,"aria-activedescendant":st(d,d.selectors.activeDescendantId),"aria-multiselectable":p.mode===Nt.Multi?!0:void 0,"aria-labelledby":z,"aria-orientation":p.orientation,onKeyDown:U,role:"listbox",tabIndex:h===Oe.Open?0:void 0,style:{...a.style,...O,"--button-width":Mg(m,!0).width},...gl(D)}),W=Ze(),K=E.useMemo(()=>p.mode===Nt.Multi?p:{...p,isSelected:P},[p,P]);return E.createElement(Pv,{enabled:s?e.static||k:!1,ownerDocument:y},E.createElement(as.Provider,{value:K},W({ourProps:Z,theirProps:a,slot:V,defaultTag:Wv,features:Hv,visible:A,name:"Listbox.Options"})))}let Gv="div";function qv(e,t){let n=E.useId(),{id:r=`headlessui-listbox-option-${n}`,disabled:o=!1,value:s,...i}=e,c=E.useContext(Ef)===!0,a=jr("Listbox.Option"),u=ta("Listbox.Option"),l=st(u,A=>u.selectors.isActive(A,r)),f=a.isSelected(s),p=E.useRef(null),d=kv(p),h=$n({disabled:o,value:s,domRef:p,get textValue(){return d()}}),m=rt(t,p,A=>{A?a.listRef.current.set(r,A):a.listRef.current.delete(r)}),v=st(u,A=>u.selectors.shouldScrollIntoView(A,r));ge(()=>{if(v)return ht().requestAnimationFrame(()=>{var A,I;(I=(A=p.current)==null?void 0:A.scrollIntoView)==null||I.call(A,{block:"nearest"})})},[v,p]),ge(()=>{if(!c)return u.actions.registerOption(r,h),()=>u.actions.unregisterOption(r)},[h,r,c]);let C=ae(A=>{var I;if(o)return A.preventDefault();u.actions.onChange(s),a.mode===Nt.Single&&(Me.flushSync(()=>u.actions.closeListbox()),(I=u.state.buttonElement)==null||I.focus({preventScroll:!0}))}),y=ae(()=>{if(o)return u.actions.goToOption({focus:ve.Nothing});u.actions.goToOption({focus:ve.Specific,id:r})}),$=gb(),B=ae(A=>$.update(A)),k=ae(A=>{$.wasMoved(A)&&(o||l&&u.state.activationTrigger===is.Pointer||u.actions.goToOption({focus:ve.Specific,id:r},is.Pointer))}),D=ae(A=>{$.wasMoved(A)&&(o||l&&u.state.activationTrigger===is.Pointer&&u.actions.goToOption({focus:ve.Nothing}))}),j=E.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:C,onFocus:y,onPointerEnter:B,onMouseEnter:B,onPointerMove:k,onMouseMove:k,onPointerLeave:D,onMouseLeave:D},w=Ze();return!f&&c?null:w({ourProps:g,theirProps:i,slot:j,defaultTag:Gv,name:"Listbox.Option"})}let Zv=E.Fragment;function Kv(e,t){let{options:n,placeholder:r,...o}=e,s={ref:rt(t)},i=jr("ListboxSelectedOption"),c=E.useMemo(()=>({}),[]),a=i.value===void 0||i.value===null||i.mode===Nt.Multi&&Array.isArray(i.value)&&i.value.length===0,u=Ze();return E.createElement(Ef.Provider,{value:!0},u({ourProps:s,theirProps:{...o,children:E.createElement(E.Fragment,null,r&&a?r:n)},slot:c,defaultTag:Zv,name:"ListboxSelectedOption"}))}let Yv=je(_v),Xv=je(zv),Qv=Cg,Jv=je(Vv),e1=je(qv),t1=je(Kv),mn=Object.assign(Yv,{Button:Xv,Label:Qv,Options:Jv,Option:e1,SelectedOption:t1});function n1({title:e,titleId:t,...n},r){return _.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true","data-slot":"icon",ref:r,"aria-labelledby":t},n),e?_.createElement("title",{id:t},e):null,_.createElement("path",{fillRule:"evenodd",d:"M16.704 4.153a.75.75 0 0 1 .143 1.052l-8 10.5a.75.75 0 0 1-1.127.075l-4.5-4.5a.75.75 0 0 1 1.06-1.06l3.894 3.893 7.48-9.817a.75.75 0 0 1 1.05-.143Z",clipRule:"evenodd"}))}const Sf=_.forwardRef(n1),r1=({tokens:e,selectedToken:t,onTokenChange:n,disabled:r=!1,className:o=""})=>{const{t:s}=pt();return M.jsx("div",{className:`relative ${o}`,children:M.jsx(mn,{value:t,onChange:n,disabled:r,children:({open:i})=>M.jsxs(M.Fragment,{children:[M.jsxs(mn.Button,{className:`
84
- relative w-full h-9 text-text-primary bg-fill-input-primary
85
- items-center justify-between flex px-3 rounded-lg
86
- focus:outline-none
87
- ${r?"opacity-50 cursor-not-allowed":"cursor-pointer hover:bg-fill-btn-secondary-hover"}
88
- ${i?"ring-1 ring-white":""}
89
- `,children:[M.jsx("span",{className:"text-sm leading-[18px] font-medium",children:s("deposit.asset")}),M.jsxs("div",{className:"flex items-center",children:[t.iconUrl?M.jsx("img",{src:t.iconUrl,alt:t.token,className:"w-4 h-4 rounded-full"}):M.jsx("div",{className:"w-4 h-4 rounded-full bg-green-500 flex items-center justify-center",children:M.jsx("span",{className:"text-xs text-white font-bold",children:t.token.charAt(0)})}),M.jsx("span",{className:"text-sm text-white ml-1",children:t.symbol||t.token}),M.jsxs("svg",{className:`w-3 h-3 ml-2 transition-transform duration-200 ${i?"rotate-180":""}`,xmlns:"http://www.w3.org/2000/svg",width:"10",height:"11",viewBox:"0 0 10 11",fill:"none",children:[M.jsx("g",{clipPath:"url(#clip0_12919_27745)",children:M.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"})}),M.jsx("defs",{children:M.jsx("clipPath",{id:"clip0_12919_27745",children:M.jsx("rect",{width:"10",height:"10",fill:"white",transform:"translate(0 0.955078)"})})})]})]})]}),M.jsx(hf,{as:E.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:M.jsx(mn.Options,{className:`
90
- absolute z-50 mt-1 w-full max-h-60 overflow-auto rounded-lg
91
- bg-fill-input-primary border border-line-divider-secondary shadow-lg
92
- focus:outline-none
93
- `,children:e.map(c=>M.jsx(mn.Option,{value:c,className:({active:a,selected:u})=>`relative cursor-pointer select-none py-3 px-3 ${u?"bg-fill-btn-secondary":a?"bg-fill-input-secondary":""}`,children:({selected:a,active:u})=>M.jsxs("div",{className:"flex items-center justify-between",children:[M.jsxs("div",{className:"flex items-center space-x-3",children:[c.iconUrl?M.jsx("img",{src:c.iconUrl,alt:c.token,className:"w-5 h-5 rounded-full"}):M.jsx("div",{className:"w-5 h-5 rounded-full bg-green-500 flex items-center justify-center",children:M.jsx("span",{className:"text-xs text-white font-bold",children:c.token.charAt(0)})}),M.jsx("div",{className:"flex flex-col",children:M.jsx("span",{className:`text-sm font-medium ${a||u?"text-text-primary":"text-text-tertiary"}`,children:c.symbol||c.token})})]}),a&&M.jsx(Sf,{className:"w-4 h-4 text-blue-400"})]})},c.tokenAddress))})})]})})})},o1=({chains:e,selectedChain:t,onChainChange:n,disabled:r=!1,className:o="",walletType:s="mpc"})=>{const{t:i}=pt();return M.jsx("div",{className:`relative ${o}`,children:M.jsx(mn,{value:t,onChange:n,disabled:r,children:({open:c})=>M.jsxs(M.Fragment,{children:[M.jsxs(mn.Button,{className:`
83
+ */var Ub=["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])"],_i=Ub.join(","),Sl=typeof Element>"u",Dr=Sl?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,Yo=!Sl&&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},Xo=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},zb=function(t){var n,r=t==null||(n=t.getAttribute)===null||n===void 0?void 0:n.call(t,"contenteditable");return r===""||r==="true"},Wb=function(t,n,r){if(Xo(t))return[];var o=Array.prototype.slice.apply(t.querySelectorAll(_i));return n&&Dr.call(t,_i)&&o.unshift(t),o=o.filter(r),o},Hb=function e(t,n,r){for(var o=[],s=Array.from(t);s.length;){var i=s.shift();if(!Xo(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=Dr.call(i,_i);l&&r.filter(i)&&(n||!t.includes(i))&&o.push(i);var f=i.shadowRoot||typeof r.getShadowRoot=="function"&&r.getShadowRoot(i),p=!Xo(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},Pl=function(t){return!isNaN(parseInt(t.getAttribute("tabindex"),10))},$l=function(t){if(!t)throw new Error("No node provided");return t.tabIndex<0&&(/^(AUDIO|VIDEO|DETAILS)$/.test(t.tagName)||zb(t))&&!Pl(t)?0:t.tabIndex},Vb=function(t,n){var r=$l(t);return r<0&&n&&!Pl(t)?0:r},Gb=function(t,n){return t.tabIndex===n.tabIndex?t.documentOrder-n.documentOrder:t.tabIndex-n.tabIndex},Tl=function(t){return t.tagName==="INPUT"},qb=function(t){return Tl(t)&&t.type==="hidden"},Zb=function(t){var n=t.tagName==="DETAILS"&&Array.prototype.slice.apply(t.children).some(function(r){return r.tagName==="SUMMARY"});return n},Kb=function(t,n){for(var r=0;r<t.length;r++)if(t[r].checked&&t[r].form===n)return t[r]},Yb=function(t){if(!t.name)return!0;var n=t.form||Yo(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=Kb(o,t.form);return!s||s===t},Xb=function(t){return Tl(t)&&t.type==="radio"},Qb=function(t){return Xb(t)&&!Yb(t)},Jb=function(t){var n,r=t&&Yo(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=Yo(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},Al=function(t){var n=t.getBoundingClientRect(),r=n.width,o=n.height;return r===0&&o===0},ey=function(t,n){var r=n.displayCheck,o=n.getShadowRoot;if(getComputedStyle(t).visibility==="hidden")return!0;var s=Dr.call(t,"details>summary:first-of-type"),i=s?t.parentElement:t;if(Dr.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=Yo(t);if(a&&!a.shadowRoot&&o(a)===!0)return Al(t);t.assignedSlot?t=t.assignedSlot:!a&&u!==t.ownerDocument?t=u.host:t=a}t=c}if(Jb(t))return!t.getClientRects().length;if(r!=="legacy-full")return!0}else if(r==="non-zero-area")return Al(t);return!1},ty=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 Dr.call(n,"fieldset[disabled] *")?!0:!o.contains(t)}return!0}n=n.parentElement}return!1},ny=function(t,n){return!(n.disabled||Xo(n)||qb(n)||ey(n,t)||Zb(n)||ty(n))},Cl=function(t,n){return!(Qb(n)||$l(n)<0||!ny(t,n))},ry=function(t){var n=parseInt(t.getAttribute("tabindex"),10);return!!(isNaN(n)||n>=0)},oy=function e(t){var n=[],r=[];return t.forEach(function(o,s){var i=!!o.scopeParent,c=i?o.scopeParent:o,a=Vb(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(Gb).reduce(function(o,s){return s.isScope?o.push.apply(o,s.content):o.push(s.content),o},[]).concat(n)},Ol=function(t,n){n=n||{};var r;return n.getShadowRoot?r=Hb([t],n.includeContainer,{filter:Cl.bind(null,n),flatten:!1,getShadowRoot:n.getShadowRoot,shadowRootFilter:ry}):r=Wb(t,n.includeContainer,Cl.bind(null,n)),oy(r)};function Il(e,t,n){let{reference:r,floating:o}=e;const s=Zt(t),i=Fi(t),c=Di(i),a=hn(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(Zn(t)){case"start":d[i]-=p*(n&&u?-1:1);break;case"end":d[i]+=p*(n&&u?-1:1);break}return d}const sy=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}=Il(u,r,a),p=r,d={},h=0;for(let m=0;m<c.length;m++){const{name:y,fn:A}=c[m],{x:g,y:P,data:k,reset:B}=await A({x:l,y:f,initialPlacement:r,placement:p,strategy:o,middlewareData:d,rects:u,platform:i,elements:{reference:e,floating:t}});l=g??l,f=P??f,d={...d,[y]:{...d[y],...k}},B&&h<=50&&(h++,typeof B=="object"&&(B.placement&&(p=B.placement),B.rects&&(u=B.rects===!0?await i.getElementRects({reference:e,floating:t,strategy:o}):B.rects),{x:l,y:f}=Il(u,p,a)),m=-1)}return{x:l,y:f,placement:p,strategy:o,middlewareData:d}};async function Qo(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}=Tn(t,e),h=El(d),y=c[p?f==="floating"?"reference":"floating":f],A=Ko(await s.getClippingRect({element:(n=await(s.isElement==null?void 0:s.isElement(y)))==null||n?y:y.contextElement||await(s.getDocumentElement==null?void 0:s.getDocumentElement(c.floating)),boundary:u,rootBoundary:l,strategy:a})),g=f==="floating"?{x:r,y:o,width:i.floating.width,height:i.floating.height}:i.reference,P=await(s.getOffsetParent==null?void 0:s.getOffsetParent(c.floating)),k=await(s.isElement==null?void 0:s.isElement(P))?await(s.getScale==null?void 0:s.getScale(P))||{x:1,y:1}:{x:1,y:1},B=Ko(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:c,rect:g,offsetParent:P,strategy:a}):g);return{top:(A.top-B.top+h.top)/k.y,bottom:(B.bottom-A.bottom+h.bottom)/k.y,left:(A.left-B.left+h.left)/k.x,right:(B.right-A.right+h.right)/k.x}}const iy=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}=Tn(e,t)||{};if(u==null)return{};const f=El(l),p={x:n,y:r},d=Fi(o),h=Di(d),m=await i.getDimensions(u),y=d==="y",A=y?"top":"left",g=y?"bottom":"right",P=y?"clientHeight":"clientWidth",k=s.reference[h]+s.reference[d]-p[d]-s.floating[h],B=p[d]-s.reference[d],F=await(i.getOffsetParent==null?void 0:i.getOffsetParent(u));let j=F?F[P]:0;(!j||!await(i.isElement==null?void 0:i.isElement(F)))&&(j=c.floating[P]||s.floating[h]);const b=k/2-B/2,w=j/2-m[h]/2-1,T=qt(f[A],w),N=qt(f[g],w),I=T,$=j-m[h]-N,S=j/2-m[h]/2+b,x=Ri(I,S,$),C=!a.arrow&&Zn(o)!=null&&S!==x&&s.reference[h]/2-(S<I?T:N)-m[h]/2<0,O=C?S<I?S-I:S-$:0;return{[d]:p[d]+O,data:{[d]:x,centerOffset:S-x-O,...C&&{alignmentOffset:O}},reset:C}}}),ay=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,...y}=Tn(e,t);if((n=s.arrow)!=null&&n.alignmentOffset)return{};const A=hn(o),g=Zt(c),P=hn(c)===c,k=await(a.isRTL==null?void 0:a.isRTL(u.floating)),B=p||(P||!m?[Zo(c)]:Bb(c)),F=h!=="none";!p&&F&&B.push(...jb(c,m,h,k));const j=[c,...B],b=await Qo(t,y),w=[];let T=((r=s.flip)==null?void 0:r.overflows)||[];if(l&&w.push(b[A]),f){const S=Lb(o,i,k);w.push(b[S[0]],b[S[1]])}if(T=[...T,{placement:o,overflows:w}],!w.every(S=>S<=0)){var N,I;const S=(((N=s.flip)==null?void 0:N.index)||0)+1,x=j[S];if(x&&(!(f==="alignment"?g!==Zt(x):!1)||T.every(v=>Zt(v.placement)===g?v.overflows[0]>0:!0)))return{data:{index:S,overflows:T},reset:{placement:x}};let C=(I=T.filter(O=>O.overflows[0]<=0).sort((O,v)=>O.overflows[1]-v.overflows[1])[0])==null?void 0:I.placement;if(!C)switch(d){case"bestFit":{var $;const O=($=T.filter(v=>{if(F){const M=Zt(v.placement);return M===g||M==="y"}return!0}).map(v=>[v.placement,v.overflows.filter(M=>M>0).reduce((M,D)=>M+D,0)]).sort((v,M)=>v[1]-M[1])[0])==null?void 0:$[0];O&&(C=O);break}case"initialPlacement":C=c;break}if(o!==C)return{reset:{placement:C}}}return{}}}},cy=new Set(["left","top"]);async function uy(e,t){const{placement:n,platform:r,elements:o}=e,s=await(r.isRTL==null?void 0:r.isRTL(o.floating)),i=hn(n),c=Zn(n),a=Zt(n)==="y",u=cy.has(i)?-1:1,l=s&&a?-1:1,f=Tn(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 ly=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 uy(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}}}}},fy=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:y=>{let{x:A,y:g}=y;return{x:A,y:g}}},...a}=Tn(e,t),u={x:n,y:r},l=await Qo(t,a),f=Zt(hn(o)),p=vl(f);let d=u[p],h=u[f];if(s){const y=p==="y"?"top":"left",A=p==="y"?"bottom":"right",g=d+l[y],P=d-l[A];d=Ri(g,d,P)}if(i){const y=f==="y"?"top":"left",A=f==="y"?"bottom":"right",g=h+l[y],P=h-l[A];h=Ri(g,h,P)}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}}}}}},dy=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}=Tn(e,t),l=await Qo(t,u),f=hn(o),p=Zn(o),d=Zt(o)==="y",{width:h,height:m}=s.floating;let y,A;f==="top"||f==="bottom"?(y=f,A=p===(await(i.isRTL==null?void 0:i.isRTL(c.floating))?"start":"end")?"left":"right"):(A=f,y=p==="end"?"top":"bottom");const g=m-l.top-l.bottom,P=h-l.left-l.right,k=qt(m-l[y],g),B=qt(h-l[A],P),F=!t.middlewareData.shift;let j=k,b=B;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(b=P),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(j=g),F&&!p){const T=Ne(l.left,0),N=Ne(l.right,0),I=Ne(l.top,0),$=Ne(l.bottom,0);d?b=h-2*(T!==0||N!==0?T+N:Ne(l.left,l.right)):j=m-2*(I!==0||$!==0?I+$:Ne(l.top,l.bottom))}await a({...t,availableWidth:b,availableHeight:j});const w=await i.getDimensions(c.floating);return h!==w.width||m!==w.height?{reset:{rects:!0}}:{}}}};function Nl(e){const t=it(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const o=Le(e),s=o?e.offsetWidth:n,i=o?e.offsetHeight:r,c=Rr(n)!==s||Rr(r)!==i;return c&&(n=s,r=i),{width:n,height:r,$:c}}function Ui(e){return de(e)?e:e.contextElement}function Kn(e){const t=Ui(e);if(!Le(t))return It(1);const n=t.getBoundingClientRect(),{width:r,height:o,$:s}=Nl(t);let i=(s?Rr(n.width):n.width)/r,c=(s?Rr(n.height):n.height)/o;return(!i||!Number.isFinite(i))&&(i=1),(!c||!Number.isFinite(c))&&(c=1),{x:i,y:c}}const py=It(0);function Ml(e){const t=_e(e);return!Vo()||!t.visualViewport?py:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function hy(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==_e(e)?!1:t}function An(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const o=e.getBoundingClientRect(),s=Ui(e);let i=It(1);t&&(r?de(r)&&(i=Kn(r)):i=Kn(e));const c=hy(s,n,r)?Ml(s):It(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=_e(s),d=r&&de(r)?_e(r):r;let h=p,m=Bi(h);for(;m&&r&&d!==h;){const y=Kn(m),A=m.getBoundingClientRect(),g=it(m),P=A.left+(m.clientLeft+parseFloat(g.paddingLeft))*y.x,k=A.top+(m.clientTop+parseFloat(g.paddingTop))*y.y;a*=y.x,u*=y.y,l*=y.x,f*=y.y,a+=P,u+=k,h=_e(m),m=Bi(h)}}return Ko({width:l,height:f,x:a,y:u})}function Jo(e,t){const n=Go(e).scrollLeft;return t?t.left+n:An(Ot(e)).left+n}function kl(e,t){const n=e.getBoundingClientRect(),r=n.left+t.scrollLeft-Jo(e,n),o=n.top+t.scrollTop;return{x:r,y:o}}function my(e){let{elements:t,rect:n,offsetParent:r,strategy:o}=e;const s=o==="fixed",i=Ot(r),c=t?Ho(t.floating):!1;if(r===i||c&&s)return n;let a={scrollLeft:0,scrollTop:0},u=It(1);const l=It(0),f=Le(r);if((f||!f&&!s)&&((qn(r)!=="body"||Br(i))&&(a=Go(r)),Le(r))){const d=An(r);u=Kn(r),l.x=d.x+r.clientLeft,l.y=d.y+r.clientTop}const p=i&&!f&&!s?kl(i,a):It(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 gy(e){return Array.from(e.getClientRects())}function by(e){const t=Ot(e),n=Go(e),r=e.ownerDocument.body,o=Ne(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),s=Ne(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let i=-n.scrollLeft+Jo(e);const c=-n.scrollTop;return it(r).direction==="rtl"&&(i+=Ne(t.clientWidth,r.clientWidth)-o),{width:o,height:s,x:i,y:c}}const Ll=25;function yy(e,t){const n=_e(e),r=Ot(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=Vo();(!l||l&&t==="fixed")&&(c=o.offsetLeft,a=o.offsetTop)}const u=Jo(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<=Ll&&(s-=h)}else u<=Ll&&(s+=u);return{width:s,height:i,x:c,y:a}}const vy=new Set(["absolute","fixed"]);function wy(e,t){const n=An(e,!0,t==="fixed"),r=n.top+e.clientTop,o=n.left+e.clientLeft,s=Le(e)?Kn(e):It(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 Bl(e,t,n){let r;if(t==="viewport")r=yy(e,n);else if(t==="document")r=by(Ot(e));else if(de(t))r=wy(t,n);else{const o=Ml(e);r={x:t.x-o.x,y:t.y-o.y,width:t.width,height:t.height}}return Ko(r)}function Rl(e,t){const n=Gt(e);return n===t||!de(n)||Vt(n)?!1:it(n).position==="fixed"||Rl(n,t)}function xy(e,t){const n=t.get(e);if(n)return n;let r=pn(e,[],!1).filter(c=>de(c)&&qn(c)!=="body"),o=null;const s=it(e).position==="fixed";let i=s?Gt(e):e;for(;de(i)&&!Vt(i);){const c=it(i),a=Li(i);!a&&c.position==="fixed"&&(o=null),(s?!a&&!o:!a&&c.position==="static"&&!!o&&vy.has(o.position)||Br(i)&&!a&&Rl(e,i))?r=r.filter(l=>l!==i):o=c,i=Gt(i)}return t.set(e,r),r}function Ey(e){let{element:t,boundary:n,rootBoundary:r,strategy:o}=e;const i=[...n==="clippingAncestors"?Ho(t)?[]:xy(t,this._c):[].concat(n),r],c=i[0],a=i.reduce((u,l)=>{const f=Bl(t,l,o);return u.top=Ne(f.top,u.top),u.right=qt(f.right,u.right),u.bottom=qt(f.bottom,u.bottom),u.left=Ne(f.left,u.left),u},Bl(t,c,o));return{width:a.right-a.left,height:a.bottom-a.top,x:a.left,y:a.top}}function Sy(e){const{width:t,height:n}=Nl(e);return{width:t,height:n}}function Py(e,t,n){const r=Le(t),o=Ot(t),s=n==="fixed",i=An(e,!0,s,t);let c={scrollLeft:0,scrollTop:0};const a=It(0);function u(){a.x=Jo(o)}if(r||!r&&!s)if((qn(t)!=="body"||Br(o))&&(c=Go(t)),r){const d=An(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?kl(o,c):It(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 zi(e){return it(e).position==="static"}function Dl(e,t){if(!Le(e)||it(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return Ot(e)===n&&(n=n.ownerDocument.body),n}function Fl(e,t){const n=_e(e);if(Ho(e))return n;if(!Le(e)){let o=Gt(e);for(;o&&!Vt(o);){if(de(o)&&!zi(o))return o;o=Gt(o)}return n}let r=Dl(e,t);for(;r&&Sb(r)&&zi(r);)r=Dl(r,t);return r&&Vt(r)&&zi(r)&&!Li(r)?n:r||Cb(e)||n}const $y=async function(e){const t=this.getOffsetParent||Fl,n=this.getDimensions,r=await n(e.floating);return{reference:Py(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function Ty(e){return it(e).direction==="rtl"}const Ay={convertOffsetParentRelativeRectToViewportRelativeRect:my,getDocumentElement:Ot,getClippingRect:Ey,getOffsetParent:Fl,getElementRects:$y,getClientRects:gy,getDimensions:Sy,getScale:Kn,isElement:de,isRTL:Ty};function jl(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function Cy(e,t){let n=null,r;const o=Ot(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=qo(f),m=qo(o.clientWidth-(l+p)),y=qo(o.clientHeight-(f+d)),A=qo(l),P={rootMargin:-h+"px "+-m+"px "+-y+"px "+-A+"px",threshold:Ne(0,qt(1,a))||1};let k=!0;function B(F){const j=F[0].intersectionRatio;if(j!==a){if(!k)return i();j?i(!1,j):r=setTimeout(()=>{i(!1,1e-7)},1e3)}j===1&&!jl(u,e.getBoundingClientRect())&&i(),k=!1}try{n=new IntersectionObserver(B,{...P,root:o.ownerDocument})}catch{n=new IntersectionObserver(B,P)}n.observe(e)}return i(!0),s}function _l(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=Ui(e),l=o||s?[...u?pn(u):[],...pn(t)]:[];l.forEach(A=>{o&&A.addEventListener("scroll",n,{passive:!0}),s&&A.addEventListener("resize",n)});const f=u&&c?Cy(u,n):null;let p=-1,d=null;i&&(d=new ResizeObserver(A=>{let[g]=A;g&&g.target===u&&d&&(d.unobserve(t),cancelAnimationFrame(p),p=requestAnimationFrame(()=>{var P;(P=d)==null||P.observe(t)})),n()}),u&&!a&&d.observe(u),d.observe(t));let h,m=a?An(e):null;a&&y();function y(){const A=An(e);m&&!jl(m,A)&&n(),m=A,h=requestAnimationFrame(y)}return n(),()=>{var A;l.forEach(g=>{o&&g.removeEventListener("scroll",n),s&&g.removeEventListener("resize",n)}),f==null||f(),(A=d)==null||A.disconnect(),d=null,a&&cancelAnimationFrame(h)}}const Wi=Qo,Oy=ly,Iy=fy,Ny=ay,My=dy,Ul=iy,ky=(e,t,n)=>{const r=new Map,o={platform:Ay,...n},s={...o.platform,_c:r};return sy(e,t,{...o,platform:s})};var Ly=typeof document<"u",By=function(){},es=Ly?E.useLayoutEffect:By;function ts(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(!ts(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)&&!ts(e[s],t[s]))return!1}return!0}return e!==e&&t!==t}function zl(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Wl(e,t){const n=zl(e);return Math.round(t*n)/n}function Hi(e){const t=U.useRef(e);return es(()=>{t.current=e}),t}function Hl(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]=U.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[p,d]=U.useState(r);ts(p,r)||d(r);const[h,m]=U.useState(null),[y,A]=U.useState(null),g=U.useCallback(v=>{v!==F.current&&(F.current=v,m(v))},[]),P=U.useCallback(v=>{v!==j.current&&(j.current=v,A(v))},[]),k=s||h,B=i||y,F=U.useRef(null),j=U.useRef(null),b=U.useRef(l),w=a!=null,T=Hi(a),N=Hi(o),I=Hi(u),$=U.useCallback(()=>{if(!F.current||!j.current)return;const v={placement:t,strategy:n,middleware:p};N.current&&(v.platform=N.current),ky(F.current,j.current,v).then(M=>{const D={...M,isPositioned:I.current!==!1};S.current&&!ts(b.current,D)&&(b.current=D,Tr.flushSync(()=>{f(D)}))})},[p,t,n,N,I]);es(()=>{u===!1&&b.current.isPositioned&&(b.current.isPositioned=!1,f(v=>({...v,isPositioned:!1})))},[u]);const S=U.useRef(!1);es(()=>(S.current=!0,()=>{S.current=!1}),[]),es(()=>{if(k&&(F.current=k),B&&(j.current=B),k&&B){if(T.current)return T.current(k,B,$);$()}},[k,B,$,T,w]);const x=U.useMemo(()=>({reference:F,floating:j,setReference:g,setFloating:P}),[g,P]),C=U.useMemo(()=>({reference:k,floating:B}),[k,B]),O=U.useMemo(()=>{const v={position:n,left:0,top:0};if(!C.floating)return v;const M=Wl(C.floating,l.x),D=Wl(C.floating,l.y);return c?{...v,transform:"translate("+M+"px, "+D+"px)",...zl(C.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:M,top:D}},[n,c,C.floating,l.x,l.y]);return U.useMemo(()=>({...l,update:$,refs:x,elements:C,floatingStyles:O}),[l,$,x,C,O])}const Ry=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?Ul({element:r.current,padding:o}).fn(n):{}:r?Ul({element:r,padding:o}).fn(n):{}}}},Vi=(e,t)=>({...Oy(e),options:[e,t]}),Vl=(e,t)=>({...Iy(e),options:[e,t]}),Gl=(e,t)=>({...Ny(e),options:[e,t]}),Dy=(e,t)=>({...My(e),options:[e,t]}),Fy=(e,t)=>({...Ry(e),options:[e,t]}),ql={...U},jy=ql.useInsertionEffect||(e=>e());function Zl(e){const t=U.useRef(()=>{if(process.env.NODE_ENV!=="production")throw new Error("Cannot call an event handler while rendering.")});return jy(()=>{t.current=e}),U.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 Gi=typeof document<"u"?E.useLayoutEffect:E.useEffect;let Kl=!1,_y=0;const Yl=()=>"floating-ui-"+Math.random().toString(36).slice(2,6)+_y++;function Uy(){const[e,t]=U.useState(()=>Kl?Yl():void 0);return Gi(()=>{e==null&&t(Yl())},[]),U.useEffect(()=>{Kl=!0},[]),e}const zy=ql.useId||Uy;let Fr;process.env.NODE_ENV!=="production"&&(Fr=new Set);function Wy(){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=Fr)!=null&&e.has(o))){var s;(s=Fr)==null||s.add(o),console.warn(o)}}function Hy(){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=Fr)!=null&&e.has(o))){var s;(s=Fr)==null||s.add(o),console.error(o)}}function Vy(){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 Gy=U.createContext(null),qy=U.createContext(null),Zy=()=>{var e;return((e=U.useContext(Gy))==null?void 0:e.id)||null},Ky=()=>U.useContext(qy),Yy="data-floating-ui-focusable";function Xy(e){const{open:t=!1,onOpenChange:n,elements:r}=e,o=zy(),s=U.useRef({}),[i]=U.useState(()=>Vy()),c=Zy()!=null;if(process.env.NODE_ENV!=="production"){const d=r.reference;d&&!de(d)&&Hy("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]=U.useState(r.reference),l=Zl((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=U.useMemo(()=>({setPositionReference:u}),[]),p=U.useMemo(()=>({reference:a||r.reference||null,floating:r.floating||null,domReference:r.reference}),[a,r.reference,r.floating]);return U.useMemo(()=>({dataRef:s,open:t,onOpenChange:l,elements:p,events:i,floatingId:o,refs:f}),[t,l,p,i,o,f])}function Qy(e){e===void 0&&(e={});const{nodeId:t}=e,n=Xy({...e,elements:{reference:null,floating:null,...e.elements}}),r=e.rootContext||n,o=r.elements,[s,i]=U.useState(null),[c,a]=U.useState(null),l=(o==null?void 0:o.domReference)||s,f=U.useRef(null),p=Ky();Gi(()=>{l&&(f.current=l)},[l]);const d=Hl({...e,elements:{...o,...c&&{reference:c}}}),h=U.useCallback(P=>{const k=de(P)?{getBoundingClientRect:()=>P.getBoundingClientRect(),contextElement:P}:P;a(k),d.refs.setReference(k)},[d.refs]),m=U.useCallback(P=>{(de(P)||P===null)&&(f.current=P,i(P)),(de(d.refs.reference.current)||d.refs.reference.current===null||P!==null&&!de(P))&&d.refs.setReference(P)},[d.refs]),y=U.useMemo(()=>({...d.refs,setReference:m,setPositionReference:h,domReference:f}),[d.refs,m,h]),A=U.useMemo(()=>({...d.elements,domReference:l}),[d.elements,l]),g=U.useMemo(()=>({...d,...r,refs:y,elements:A,nodeId:t}),[d,y,A,t,r]);return Gi(()=>{r.dataRef.current.floatingContext=g;const P=p==null?void 0:p.nodesRef.current.find(k=>k.id===t);P&&(P.context=g)}),U.useMemo(()=>({...d,context:g,refs:y,elements:A}),[d,y,A,g])}const Xl="active",Ql="selected";function qi(e,t,n){const r=new Map,o=n==="item";let s=e;if(o&&e){const{[Xl]:i,[Ql]:c,...a}=e;s=a}return{...n==="floating"&&{tabIndex:-1,[Yy]:""},...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&&[Xl,Ql].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(y=>y(...h)).find(y=>y!==void 0)}}}else i[u]=l}),i),{})}}function Jy(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=U.useCallback(c=>qi(c,e,"reference"),t),s=U.useCallback(c=>qi(c,e,"floating"),n),i=U.useCallback(c=>qi(c,e,"item"),r);return U.useMemo(()=>({getReferenceProps:o,getFloatingProps:s,getItemProps:i}),[o,s,i])}function Jl(e,t){return{...e,rects:{...e.rects,floating:{...e.rects.floating,height:t}}}}const ev=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}=Tn(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,y=p.clientTop!==0,A=h.clientTop!==0,g=p===h;if(process.env.NODE_ENV!=="production"&&(t.placement.startsWith("bottom")||Wy('`placement` side must be "bottom" when using the `inner`',"middleware.")),!d)return{};const P={...t,...await Vi(-d.offsetTop-p.clientTop-f.reference.height/2-d.offsetHeight/2-s).fn(t)},k=await Wi(Jl(P,h.scrollHeight+m+p.clientTop),l),B=await Wi(P,{...l,elementContext:"reference"}),F=Ne(0,k.top),j=P.y+F,T=(h.scrollHeight>h.clientHeight?N=>N:Rr)(Ne(0,h.scrollHeight+(y&&g||A?m*2:0)-F-Ne(0,k.bottom)));if(h.style.maxHeight=T+"px",h.scrollTop=F,o){const N=h.offsetHeight<d.offsetHeight*qt(c,n.current.length)-1||B.top>=-a||B.bottom>=-a;Tr.flushSync(()=>o(N))}return r&&(r.current=await Wi(Jl({...P,y:j},h.offsetHeight+m+p.clientTop),l)),{y:j}}});function tv(e,t){const{open:n,elements:r}=e,{enabled:o=!0,overflowRef:s,scrollRef:i,onChange:c}=t,a=Zl(c),u=U.useRef(!1),l=U.useRef(null),f=U.useRef(null);U.useEffect(()=>{if(!o)return;function d(m){if(m.ctrlKey||!h||s.current==null)return;const y=m.deltaY,A=s.current.top>=-.5,g=s.current.bottom>=-.5,P=h.scrollHeight-h.clientHeight,k=y<0?-1:1,B=y<0?"max":"min";h.scrollHeight<=h.clientHeight||(!A&&y>0||!g&&y<0?(m.preventDefault(),Tr.flushSync(()=>{a(F=>F+Math[B](y,P*k))})):/firefox/i.test(Ib())&&(h.scrollTop+=y))}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=U.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)&&Tr.flushSync(()=>a(m=>m+h))}requestAnimationFrame(()=>{l.current=d.scrollTop})}}}),[r.floating,a,s,i]);return U.useMemo(()=>o?{floating:p}:{},[o,p])}let Yn=E.createContext({styles:void 0,setReference:()=>{},setFloating:()=>{},getReferenceProps:()=>({}),getFloatingProps:()=>({}),slot:{}});Yn.displayName="FloatingContext";let Zi=E.createContext(null);Zi.displayName="PlacementContext";function nv(e){return E.useMemo(()=>e?typeof e=="string"?{to:e}:e:null,[e])}function rv(){return E.useContext(Yn).setReference}function ov(){return E.useContext(Yn).getReferenceProps}function sv(){let{getFloatingProps:e,slot:t}=E.useContext(Yn);return E.useCallback((...n)=>Object.assign({},e(...n),{"data-anchor":t.anchor}),[e,t])}function iv(e=null){e===!1&&(e=null),typeof e=="string"&&(e={to:e});let t=E.useContext(Zi),n=E.useMemo(()=>e,[JSON.stringify(e,(o,s)=>{var i;return(i=s==null?void 0:s.outerHTML)!=null?i:s})]);ge(()=>{t==null||t(n??null)},[t,n]);let r=E.useContext(Yn);return E.useMemo(()=>[r.setFloating,e?r.styles:{}],[r.setFloating,e,r.styles])}let ef=4;function av({children:e,enabled:t=!0}){let[n,r]=E.useState(null),[o,s]=E.useState(0),i=E.useRef(null),[c,a]=E.useState(null);cv(c);let u=t&&n!==null&&c!==null,{to:l="bottom",gap:f=0,offset:p=0,padding:d=0,inner:h}=uv(n,c),[m,y="center"]=l.split(" ");ge(()=>{u&&s(0)},[u]);let{refs:A,floatingStyles:g,context:P}=Qy({open:u,placement:m==="selection"?y==="center"?"bottom":`bottom-${y}`:y==="center"?`${m}`:`${m}-${y}`,strategy:"absolute",transform:!1,middleware:[Vi({mainAxis:m==="selection"?0:f,crossAxis:p}),Vl({padding:d}),m!=="selection"&&Gl({padding:d}),m==="selection"&&h?ev({...h,padding:d,overflowRef:i,offset:o,minItemsVisible:ef,referenceOverflowThreshold:d,onFallbackChange(N){var I,$;if(!N)return;let S=P.elements.floating;if(!S)return;let x=parseFloat(getComputedStyle(S).scrollPaddingBottom)||0,C=Math.min(ef,S.childElementCount),O=0,v=0;for(let M of($=(I=P.elements.floating)==null?void 0:I.childNodes)!=null?$:[])if(Ht(M)){let D=M.offsetTop,_=D+M.clientHeight+x,z=S.scrollTop,V=z+S.clientHeight;if(D>=z&&_<=V)C--;else{v=Math.max(0,Math.min(_,V)-Math.max(D,z)),O=M.clientHeight;break}}C>=1&&s(M=>{let D=O*C-v+x;return M>=D?M:D})}}):null,Dy({padding:d,apply({availableWidth:N,availableHeight:I,elements:$}){Object.assign($.floating.style,{overflow:"auto",maxWidth:`${N}px`,maxHeight:`min(var(--anchor-max-height, 100vh), ${I}px)`})}})].filter(Boolean),whileElementsMounted:_l}),[k=m,B=y]=P.placement.split("-");m==="selection"&&(k="selection");let F=E.useMemo(()=>({anchor:[k,B].filter(Boolean).join(" ")}),[k,B]),j=tv(P,{overflowRef:i,onChange:s}),{getReferenceProps:b,getFloatingProps:w}=Jy([j]),T=ae(N=>{a(N),A.setFloating(N)});return U.createElement(Zi.Provider,{value:r},U.createElement(Yn.Provider,{value:{setFloating:T,setReference:A.setReference,styles:g,getReferenceProps:b,getFloatingProps:w,slot:F}},e))}function cv(e){ge(()=>{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 uv(e,t){var n,r,o;let s=Ki((n=e==null?void 0:e.gap)!=null?n:"var(--anchor-gap, 0)",t),i=Ki((r=e==null?void 0:e.offset)!=null?r:"var(--anchor-offset, 0)",t),c=Ki((o=e==null?void 0:e.padding)!=null?o:"var(--anchor-padding, 0)",t);return{...e,gap:s,offset:i,padding:c}}function Ki(e,t,n=void 0){let r=Hn(),o=ae((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=nf(a,u);return[l,f=>{let p=tf(a);{let d=p.map(h=>window.getComputedStyle(u).getPropertyValue(h));r.requestAnimationFrame(function h(){r.nextFrame(h);let m=!1;for(let[A,g]of p.entries()){let P=window.getComputedStyle(u).getPropertyValue(g);if(d[A]!==P){d[A]=P,m=!0;break}}if(!m)return;let y=nf(a,u);l!==y&&(f(y),l=y)})}return r.dispose}]}return[n,null]}),s=E.useMemo(()=>o(e,t)[0],[e,t]),[i=s,c]=E.useState();return ge(()=>{let[a,u]=o(e,t);if(c(a),!!u)return u(c)},[e,t]),i}function tf(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,...tf(o)]:[r]}return[]}function nf(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 lv(e,t){let[n,r]=E.useState(t);return!e&&n!==t&&r(t),e?n:t}let Yi=E.createContext(null);Yi.displayName="OpenClosedContext";var ht=(e=>(e[e.Open=1]="Open",e[e.Closed=2]="Closed",e[e.Closing=4]="Closing",e[e.Opening=8]="Opening",e))(ht||{});function Xi(){return E.useContext(Yi)}function rf({value:e,children:t}){return E.createElement(Yi.Provider,{value:e},t)}function fv(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 ns(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:fv(e)}}var of=(e=>(e[e.Left=0]="Left",e[e.Right=2]="Right",e))(of||{});function sf(e){let t=ae(e),n=E.useRef(!1);E.useEffect(()=>(n.current=!1,()=>{n.current=!0,Mu(()=>{n.current&&t()})}),[t])}function dv(){let e=typeof document>"u";return"useSyncExternalStore"in U?(t=>t.useSyncExternalStore)(U)(()=>()=>{},()=>!1,()=>!e):!1}function Qi(){let e=dv(),[t,n]=U.useState(At.isHandoffComplete);return t&&At.isHandoffComplete===!1&&n(!1),U.useEffect(()=>{t!==!0&&n(!0)},[t]),U.useEffect(()=>At.handoff(),[]),e?!1:t}let pv=E.createContext(!1);function hv(){return E.useContext(pv)}function mv(e){let t=hv(),n=E.useContext(cf),[r,o]=E.useState(()=>{var s;if(!t&&n!==null)return(s=n.current)!=null?s:null;if(At.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 E.useEffect(()=>{r!==null&&(e!=null&&e.body.contains(r)||e==null||e.body.appendChild(r))},[r,e]),E.useEffect(()=>{t||n!==null&&o(n.current)},[n,o,t]),r}let af=E.Fragment,gv=je(function(e,t){let{ownerDocument:n=null,...r}=e,o=E.useRef(null),s=rt(yg(d=>{o.current=d}),t),i=Ni(o),c=n??i,a=mv(c),[u]=E.useState(()=>{var d;return At.isServer?null:(d=c==null?void 0:c.createElement("div"))!=null?d:null}),l=E.useContext(wv),f=Qi();ge(()=>{!a||!u||a.contains(u)||(u.setAttribute("data-headlessui-portal",""),a.appendChild(u))},[a,u]),ge(()=>{if(u&&l)return l.register(u)},[l,u]),sf(()=>{var d;!a||!u||(yi(u)&&a.contains(u)&&a.removeChild(u),a.childNodes.length<=0&&((d=a.parentElement)==null||d.removeChild(a)))});let p=Ze();return f?!a||!u?null:Me.createPortal(p({ourProps:{ref:s},theirProps:r,slot:{},defaultTag:af,name:"Portal"}),u):null});function bv(e,t){let n=rt(t),{enabled:r=!0,ownerDocument:o,...s}=e,i=Ze();return r?E.createElement(gv,{...s,ownerDocument:o,ref:n}):i({ourProps:{ref:n},theirProps:s,slot:{},defaultTag:af,name:"Portal"})}let yv=E.Fragment,cf=E.createContext(null);function vv(e,t){let{target:n,...r}=e,o={ref:rt(t)},s=Ze();return E.createElement(cf.Provider,{value:n},s({ourProps:o,theirProps:r,defaultTag:yv,name:"Popover.Group"}))}let wv=E.createContext(null),xv=je(bv),Ev=je(vv),Sv=Object.assign(xv,{Group:Ev});function Pv(){let e=E.useRef(!1);return ge(()=>(e.current=!0,()=>{e.current=!1}),[]),e}function uf(e){var t;return!!(e.enter||e.enterFrom||e.enterTo||e.leave||e.leaveFrom||e.leaveTo)||((t=e.as)!=null?t:ff)!==E.Fragment||E.Children.count(e.children)===1}let rs=E.createContext(null);rs.displayName="TransitionContext";var $v=(e=>(e.Visible="visible",e.Hidden="hidden",e))($v||{});function Tv(){let e=E.useContext(rs);if(e===null)throw new Error("A <Transition.Child /> is used but it is missing a parent <Transition /> or <Transition.Root />.");return e}function Av(){let e=E.useContext(os);if(e===null)throw new Error("A <Transition.Child /> is used but it is missing a parent <Transition /> or <Transition.Root />.");return e}let os=E.createContext(null);os.displayName="NestingContext";function ss(e){return"children"in e?ss(e.children):e.current.filter(({el:t})=>t.current!==null).filter(({state:t})=>t==="visible").length>0}function lf(e,t){let n=Pn(e),r=E.useRef([]),o=Pv(),s=Hn(),i=ae((d,h=fn.Hidden)=>{let m=r.current.findIndex(({el:y})=>y===d);m!==-1&&(nt(h,{[fn.Unmount](){r.current.splice(m,1)},[fn.Hidden](){r.current[m].state="hidden"}}),s.microTask(()=>{var y;!ss(r)&&o.current&&((y=n.current)==null||y.call(n))}))}),c=ae(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,fn.Unmount)}),a=E.useRef([]),u=E.useRef(Promise.resolve()),l=E.useRef({enter:[],leave:[]}),f=ae((d,h,m)=>{a.current.splice(0),t&&(t.chains.current[h]=t.chains.current[h].filter(([y])=>y!==d)),t==null||t.chains.current[h].push([d,new Promise(y=>{a.current.push(y)})]),t==null||t.chains.current[h].push([d,new Promise(y=>{Promise.all(l.current[h].map(([A,g])=>g)).then(()=>y())})]),h==="enter"?u.current=u.current.then(()=>t==null?void 0:t.wait.current).then(()=>m(h)):m(h)}),p=ae((d,h,m)=>{Promise.all(l.current[h].splice(0).map(([y,A])=>A)).then(()=>{var y;(y=a.current.shift())==null||y()}).then(()=>m(h))});return E.useMemo(()=>({children:r,register:c,unregister:i,onStart:f,onStop:p,wait:u,chains:l}),[c,i,r,f,p,l,u])}let ff=E.Fragment,df=Fo.RenderStrategy;function Cv(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,...y}=e,[A,g]=E.useState(null),P=E.useRef(null),k=uf(e),B=rt(...k?[P,t,g]:t===null?[]:[t]),F=(n=y.unmount)==null||n?fn.Unmount:fn.Hidden,{show:j,appear:b,initial:w}=Tv(),[T,N]=E.useState(j?"visible":"hidden"),I=Av(),{register:$,unregister:S}=I;ge(()=>$(P),[$,P]),ge(()=>{if(F===fn.Hidden&&P.current){if(j&&T!=="visible"){N("visible");return}return nt(T,{hidden:()=>S(P),visible:()=>$(P)})}},[T,P,$,S,j,F]);let x=Qi();ge(()=>{if(k&&x&&T==="visible"&&P.current===null)throw new Error("Did you forget to passthrough the `ref` to the actual DOM node?")},[P,T,x,k]);let C=w&&!b,O=b&&j&&w,v=E.useRef(!1),M=lf(()=>{v.current||(N("hidden"),S(P))},I),D=ae(G=>{v.current=!0;let X=G?"enter":"leave";M.onStart(P,X,ee=>{ee==="enter"?s==null||s():ee==="leave"&&(c==null||c())})}),_=ae(G=>{let X=G?"enter":"leave";v.current=!1,M.onStop(P,X,ee=>{ee==="enter"?i==null||i():ee==="leave"&&(a==null||a())}),X==="leave"&&!ss(M)&&(N("hidden"),S(P))});E.useEffect(()=>{k&&o||(D(j),_(j))},[j,k,o]);let z=!(!o||!k||!x||C),[,V]=bl(z,A,j,{start:D,end:_}),Z=dn({ref:B,className:((r=mi(y.className,O&&u,O&&l,V.enter&&u,V.enter&&V.closed&&l,V.enter&&!V.closed&&f,V.leave&&d,V.leave&&!V.closed&&h,V.leave&&V.closed&&m,!V.transition&&j&&p))==null?void 0:r.trim())||void 0,...gl(V)}),W=0;T==="visible"&&(W|=ht.Open),T==="hidden"&&(W|=ht.Closed),j&&T==="hidden"&&(W|=ht.Opening),!j&&T==="visible"&&(W|=ht.Closing);let K=Ze();return E.createElement(os.Provider,{value:M},E.createElement(rf,{value:W},K({ourProps:Z,theirProps:y,defaultTag:ff,features:df,visible:T==="visible",name:"Transition.Child"})))}function Ov(e,t){let{show:n,appear:r=!1,unmount:o=!0,...s}=e,i=E.useRef(null),c=uf(e),a=rt(...c?[i,t]:t===null?[]:[t]);Qi();let u=Xi();if(n===void 0&&u!==null&&(n=(u&ht.Open)===ht.Open),n===void 0)throw new Error("A <Transition /> is used but it is missing a `show={true | false}` prop.");let[l,f]=E.useState(n?"visible":"hidden"),p=lf(()=>{n||f("hidden")}),[d,h]=E.useState(!0),m=E.useRef([n]);ge(()=>{d!==!1&&m.current[m.current.length-1]!==n&&(m.current.push(n),h(!1))},[m,n]);let y=E.useMemo(()=>({show:n,appear:r,initial:d}),[n,r,d]);ge(()=>{n?f("visible"):!ss(p)&&i.current!==null&&f("hidden")},[n,p]);let A={unmount:o},g=ae(()=>{var B;d&&h(!1),(B=e.beforeEnter)==null||B.call(e)}),P=ae(()=>{var B;d&&h(!1),(B=e.beforeLeave)==null||B.call(e)}),k=Ze();return E.createElement(os.Provider,{value:p},E.createElement(rs.Provider,{value:y},k({ourProps:{...A,as:E.Fragment,children:E.createElement(pf,{ref:a,...A,...s,beforeEnter:g,beforeLeave:P})},theirProps:{},defaultTag:E.Fragment,features:df,visible:l==="visible",name:"Transition"})))}function Iv(e,t){let n=E.useContext(rs)!==null,r=Xi()!==null;return E.createElement(E.Fragment,null,!n&&r?E.createElement(Ji,{ref:t,...e}):E.createElement(pf,{ref:t,...e}))}let Ji=je(Ov),pf=je(Cv),Nv=je(Iv),Mv=Object.assign(Ji,{Child:Nv,Root:Ji});function kv(e,t){let n=E.useRef({left:0,top:0});if(ge(()=>{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 hf=/([\u2700-\u27BF]|[\uE000-\uF8FF]|\uD83C[\uDC00-\uDFFF]|\uD83D[\uDC00-\uDFFF]|[\u2011-\u26FF]|\uD83E[\uDD10-\uDDFF])/g;function mf(e){var t,n;let r=(t=e.innerText)!=null?t:"",o=e.cloneNode(!0);if(!Ht(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 hf.test(i)&&(i=i.replace(hf,"")),i}function Lv(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():mf(s).trim()}return null}).filter(Boolean);if(r.length>0)return r.join(", ")}return mf(e).trim()}function Bv(e){let t=E.useRef(""),n=E.useRef("");return ae(()=>{let r=e.current;if(!r)return"";let o=r.innerText;if(t.current===o)return n.current;let s=Lv(r).trim().toLowerCase();return t.current=o,n.current=s,s})}var Rv=Object.defineProperty,Dv=(e,t,n)=>t in e?Rv(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,gf=(e,t,n)=>(Dv(e,typeof t!="symbol"?t+"":t,n),n),Oe=(e=>(e[e.Open=0]="Open",e[e.Closed=1]="Closed",e))(Oe||{}),Nt=(e=>(e[e.Single=0]="Single",e[e.Multi=1]="Multi",e))(Nt||{}),is=(e=>(e[e.Pointer=0]="Pointer",e[e.Other=1]="Other",e))(is||{}),bf=(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))(bf||{});function yf(e,t=n=>n){let n=e.activeOptionIndex!==null?e.options[e.activeOptionIndex]:null,r=cl(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 Fv={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=ns(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=ns(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=yf(e),u=ns(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=ns(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,...yf(e),pendingShouldSort:!1}:e};class ea extends Yu{constructor(t){super(t),gf(this,"actions",{onChange:n=>{let{onChange:r,compare:o,mode:s,value:i}=this.state.dataRef.current;return nt(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:Ei(()=>{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:Ei(()=>{let n=[];return[r=>n.push(r),()=>{this.send({type:6,options:n.splice(0)})}]}),goToOption:Ei(()=>{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})}}),gf(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=Si.get(null);this.disposables.add(r.on(el.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 ea({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 nt(n.type,Fv,t,n)}}const vf=E.createContext(null);function ta(e){let t=E.useContext(vf);if(t===null){let n=new Error(`<${e} /> is missing a parent <Listbox /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,wf),n}return t}function wf({id:e,__demoMode:t=!1}){let n=E.useMemo(()=>ea.new({id:e,__demoMode:t}),[]);return sf(()=>n.dispose()),n}let as=E.createContext(null);as.displayName="ListboxDataContext";function jr(e){let t=E.useContext(as);if(t===null){let n=new Error(`<${e} /> is missing a parent <Listbox /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,jr),n}return t}let jv=E.Fragment;function _v(e,t){let n=E.useId(),r=hi(),{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 y=p?"horizontal":"vertical";let A=rt(t),g=rg(s),[P=d?[]:void 0,k]=ng(o,a,g),B=wf({id:n,__demoMode:h}),F=E.useRef({static:!1,hold:!1}),j=E.useRef(new Map),b=Og(u),w=E.useCallback(z=>nt(T.mode,{[Nt.Multi]:()=>P.some(V=>b(V,z)),[Nt.Single]:()=>b(P,z)}),[P]),T=E.useMemo(()=>({value:P,disabled:f,invalid:l,mode:d?Nt.Multi:Nt.Single,orientation:y,onChange:k,compare:b,isSelected:w,optionsPropsRef:F,listRef:j}),[P,f,l,d,y,k,b,w,F,j]);ge(()=>{B.state.dataRef.current=T},[T]);let N=st(B,z=>z.listboxState),I=Si.get(null),$=st(I,E.useCallback(z=>I.selectors.isTop(z,n),[I,n])),[S,x]=st(B,z=>[z.buttonElement,z.optionsElement]);nb($,[S,x],(z,V)=>{B.send({type:bf.CloseListbox}),al(V,Ii.Loose)||(z.preventDefault(),S==null||S.focus())});let C=E.useMemo(()=>({open:N===Oe.Open,disabled:f,invalid:l,value:P}),[N,f,l,P]),[O,v]=Sg({inherit:!0}),M={ref:A},D=E.useCallback(()=>{if(g!==void 0)return k==null?void 0:k(g)},[k,g]),_=Ze();return E.createElement(v,{value:O,props:{htmlFor:S==null?void 0:S.id},slot:{open:N===Oe.Open,disabled:f}},E.createElement(av,null,E.createElement(vf.Provider,{value:B},E.createElement(as.Provider,{value:T},E.createElement(rf,{value:nt(N,{[Oe.Open]:ht.Open,[Oe.Closed]:ht.Closed})},c!=null&&P!=null&&E.createElement(ug,{disabled:f,data:{[c]:P},form:i,onReset:D}),_({ourProps:M,theirProps:m,slot:C,defaultTag:jv,name:"Listbox"}))))))}let Uv="button";function zv(e,t){let n=E.useId(),r=ju(),o=jr("Listbox.Button"),s=ta("Listbox.Button"),{id:i=r||`headlessui-listbox-button-${n}`,disabled:c=o.disabled||!1,autoFocus:a=!1,...u}=e,l=rt(t,rv(),s.actions.setButtonElement),f=ov(),[p,d,h]=st(s,v=>[v.listboxState,v.buttonElement,v.optionsElement]),m=p===Oe.Open;sb(m,{trigger:d,action:E.useCallback(v=>{if(d!=null&&d.contains(v.target))return zo.Ignore;let M=v.target.closest('[role="option"]:not([data-disabled])');return Ht(M)?zo.Select(M):h!=null&&h.contains(v.target)?zo.Ignore:zo.Close},[d,h]),close:s.actions.closeListbox,select:s.actions.selectActiveOption});let y=ae(v=>{switch(v.key){case Ce.Enter:og(v.currentTarget);break;case Ce.Space:case Ce.ArrowDown:v.preventDefault(),s.actions.openListbox({focus:o.value?ve.Nothing:ve.First});break;case Ce.ArrowUp:v.preventDefault(),s.actions.openListbox({focus:o.value?ve.Nothing:ve.Last});break}}),A=ae(v=>{switch(v.key){case Ce.Space:v.preventDefault();break}}),g=ae(v=>{var M;if(v.button===of.Left){if(gg(v.currentTarget))return v.preventDefault();s.state.listboxState===Oe.Open?(Me.flushSync(()=>s.actions.closeListbox()),(M=s.state.buttonElement)==null||M.focus({preventScroll:!0})):(v.preventDefault(),s.actions.openListbox({focus:ve.Nothing}))}}),P=E.useRef(null),k=ae(v=>{P.current=v.pointerType,v.pointerType==="mouse"&&g(v)}),B=ae(v=>{P.current!=="mouse"&&g(v)}),F=ae(v=>v.preventDefault()),j=Gu([i]),b=vg(),{isFocusVisible:w,focusProps:T}=Hm({autoFocus:a}),{isHovered:N,hoverProps:I}=Wm({isDisabled:c}),{pressed:$,pressProps:S}=Ym({disabled:c}),x=E.useMemo(()=>({open:p===Oe.Open,active:$||p===Oe.Open,disabled:c,invalid:o.invalid,value:o.value,hover:N,focus:w,autofocus:a}),[p,o.value,c,N,w,$,o.invalid,a]),C=st(s,v=>v.listboxState===Oe.Open),O=Lu(f(),{ref:l,id:i,type:ib(e,d),"aria-haspopup":"listbox","aria-controls":h==null?void 0:h.id,"aria-expanded":C,"aria-labelledby":j,"aria-describedby":b,disabled:c||void 0,autoFocus:a,onKeyDown:y,onKeyUp:A,onKeyPress:F,onPointerDown:k,onClick:B},T,I,S);return Ze()({ourProps:O,theirProps:u,slot:x,defaultTag:Uv,name:"Listbox.Button"})}let xf=E.createContext(!1),Wv="div",Hv=Fo.RenderStrategy|Fo.Static;function Vv(e,t){let n=E.useId(),{id:r=`headlessui-listbox-options-${n}`,anchor:o,portal:s=!1,modal:i=!0,transition:c=!1,...a}=e,u=nv(o),[l,f]=E.useState(null);u&&(s=!0);let p=jr("Listbox.Options"),d=ta("Listbox.Options"),[h,m,y,A]=st(d,G=>[G.listboxState,G.buttonElement,G.optionsElement,G.__demoMode]),g=Ni(m),P=Ni(y),k=Xi(),[B,F]=bl(c,l,k!==null?(k&ht.Open)===ht.Open:h===Oe.Open);Hg(B,m,d.actions.closeListbox);let j=A?!1:i&&h===Oe.Open;hb(j,P);let b=A?!1:i&&h===Oe.Open;Wg(b,{allowed:E.useCallback(()=>[m,y],[m,y])});let w=h!==Oe.Open,T=kv(w,m)?!1:B,N=B&&h===Oe.Closed,I=lv(N,p.value),$=ae(G=>p.compare(I,G)),S=st(d,G=>{var X;if(u==null||!((X=u==null?void 0:u.to)!=null&&X.includes("selection")))return null;let ee=G.options.findIndex(le=>$(le.dataRef.current.value));return ee===-1&&(ee=0),ee}),x=(()=>{if(u==null)return;if(S===null)return{...u,inner:void 0};let G=Array.from(p.listRef.current.values());return{...u,inner:{listRef:{current:G},index:S}}})(),[C,O]=iv(x),v=sv(),M=rt(t,u?C:null,d.actions.setOptionsElement,f),D=Hn();E.useEffect(()=>{var G;let X=y;X&&h===Oe.Open&&X!==((G=Nr(X))==null?void 0:G.activeElement)&&(X==null||X.focus({preventScroll:!0}))},[h,y]);let _=ae(G=>{var X,ee;switch(D.dispose(),G.key){case Ce.Space:if(d.state.searchQuery!=="")return G.preventDefault(),G.stopPropagation(),d.actions.search(G.key);case Ce.Enter:if(G.preventDefault(),G.stopPropagation(),d.state.activeOptionIndex!==null){let{dataRef:le}=d.state.options[d.state.activeOptionIndex];d.actions.onChange(le.current.value)}p.mode===Nt.Single&&(Me.flushSync(()=>d.actions.closeListbox()),(X=d.state.buttonElement)==null||X.focus({preventScroll:!0}));break;case nt(p.orientation,{vertical:Ce.ArrowDown,horizontal:Ce.ArrowRight}):return G.preventDefault(),G.stopPropagation(),d.actions.goToOption({focus:ve.Next});case nt(p.orientation,{vertical:Ce.ArrowUp,horizontal:Ce.ArrowLeft}):return G.preventDefault(),G.stopPropagation(),d.actions.goToOption({focus:ve.Previous});case Ce.Home:case Ce.PageUp:return G.preventDefault(),G.stopPropagation(),d.actions.goToOption({focus:ve.First});case Ce.End:case Ce.PageDown:return G.preventDefault(),G.stopPropagation(),d.actions.goToOption({focus:ve.Last});case Ce.Escape:G.preventDefault(),G.stopPropagation(),Me.flushSync(()=>d.actions.closeListbox()),(ee=d.state.buttonElement)==null||ee.focus({preventScroll:!0});return;case Ce.Tab:G.preventDefault(),G.stopPropagation(),Me.flushSync(()=>d.actions.closeListbox()),Qg(d.state.buttonElement,G.shiftKey?Oi.Previous:Oi.Next);break;default:G.key.length===1&&(d.actions.search(G.key),D.setTimeout(()=>d.actions.clearSearch(),350));break}}),z=st(d,G=>{var X;return(X=G.buttonElement)==null?void 0:X.id}),V=E.useMemo(()=>({open:h===Oe.Open}),[h]),Z=Lu(u?v():{},{id:r,ref:M,"aria-activedescendant":st(d,d.selectors.activeDescendantId),"aria-multiselectable":p.mode===Nt.Multi?!0:void 0,"aria-labelledby":z,"aria-orientation":p.orientation,onKeyDown:_,role:"listbox",tabIndex:h===Oe.Open?0:void 0,style:{...a.style,...O,"--button-width":Ng(m,!0).width},...gl(F)}),W=Ze(),K=E.useMemo(()=>p.mode===Nt.Multi?p:{...p,isSelected:$},[p,$]);return E.createElement(Sv,{enabled:s?e.static||B:!1,ownerDocument:g},E.createElement(as.Provider,{value:K},W({ourProps:Z,theirProps:a,slot:V,defaultTag:Wv,features:Hv,visible:T,name:"Listbox.Options"})))}let Gv="div";function qv(e,t){let n=E.useId(),{id:r=`headlessui-listbox-option-${n}`,disabled:o=!1,value:s,...i}=e,c=E.useContext(xf)===!0,a=jr("Listbox.Option"),u=ta("Listbox.Option"),l=st(u,T=>u.selectors.isActive(T,r)),f=a.isSelected(s),p=E.useRef(null),d=Bv(p),h=Pn({disabled:o,value:s,domRef:p,get textValue(){return d()}}),m=rt(t,p,T=>{T?a.listRef.current.set(r,T):a.listRef.current.delete(r)}),y=st(u,T=>u.selectors.shouldScrollIntoView(T,r));ge(()=>{if(y)return pt().requestAnimationFrame(()=>{var T,N;(N=(T=p.current)==null?void 0:T.scrollIntoView)==null||N.call(T,{block:"nearest"})})},[y,p]),ge(()=>{if(!c)return u.actions.registerOption(r,h),()=>u.actions.unregisterOption(r)},[h,r,c]);let A=ae(T=>{var N;if(o)return T.preventDefault();u.actions.onChange(s),a.mode===Nt.Single&&(Me.flushSync(()=>u.actions.closeListbox()),(N=u.state.buttonElement)==null||N.focus({preventScroll:!0}))}),g=ae(()=>{if(o)return u.actions.goToOption({focus:ve.Nothing});u.actions.goToOption({focus:ve.Specific,id:r})}),P=mb(),k=ae(T=>P.update(T)),B=ae(T=>{P.wasMoved(T)&&(o||l&&u.state.activationTrigger===is.Pointer||u.actions.goToOption({focus:ve.Specific,id:r},is.Pointer))}),F=ae(T=>{P.wasMoved(T)&&(o||l&&u.state.activationTrigger===is.Pointer&&u.actions.goToOption({focus:ve.Nothing}))}),j=E.useMemo(()=>({active:l,focus:l,selected:f,disabled:o,selectedOption:f&&c}),[l,f,o,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:A,onFocus:g,onPointerEnter:k,onMouseEnter:k,onPointerMove:B,onMouseMove:B,onPointerLeave:F,onMouseLeave:F},w=Ze();return!f&&c?null:w({ourProps:b,theirProps:i,slot:j,defaultTag:Gv,name:"Listbox.Option"})}let Zv=E.Fragment;function Kv(e,t){let{options:n,placeholder:r,...o}=e,s={ref:rt(t)},i=jr("ListboxSelectedOption"),c=E.useMemo(()=>({}),[]),a=i.value===void 0||i.value===null||i.mode===Nt.Multi&&Array.isArray(i.value)&&i.value.length===0,u=Ze();return E.createElement(xf.Provider,{value:!0},u({ourProps:s,theirProps:{...o,children:E.createElement(E.Fragment,null,r&&a?r:n)},slot:c,defaultTag:Zv,name:"ListboxSelectedOption"}))}let Yv=je(_v),Xv=je(zv),Qv=Ag,Jv=je(Vv),e1=je(qv),t1=je(Kv),cs=Object.assign(Yv,{Button:Xv,Label:Qv,Options:Jv,Option:e1,SelectedOption:t1});const n1=()=>L.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",children:[L.jsx("g",{clipPath:"url(#clip0_active)",children:L.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"})}),L.jsx("defs",{children:L.jsx("clipPath",{id:"clip0_active",children:L.jsx("rect",{width:"12",height:"12",fill:"white",transform:"translate(0 0.0454102)"})})})]}),r1=()=>L.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",children:[L.jsx("g",{clipPath:"url(#clip0_inactive)",children:L.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"})}),L.jsx("defs",{children:L.jsx("clipPath",{id:"clip0_inactive",children:L.jsx("rect",{width:"12",height:"12",fill:"white",transform:"translate(0 0.0454102)"})})})]}),_r=({selectedLevel:e,maxLevel:t,className:n=""})=>{const r=Array.from({length:t},(o,s)=>s+1);return L.jsx("div",{className:`flex items-center ${n}`,children:r.map(o=>L.jsx("div",{className:"flex items-center justify-center",children:o>t-e?L.jsx(n1,{}):L.jsx(r1,{})},o))})};class mt{}Xe(mt,"FAST",3),Xe(mt,"Medium",2),Xe(mt,"SLOW",1),Xe(mt,"NONE",0);const o1=Object.values({MAINNET:1,SEPOLIA:11155111}),Mt=e=>{const t=typeof e=="string"?parseInt(e,10):e;return o1.includes(t)},s1={USDT:!0},Ef=(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:!s1[t.toUpperCase()]:!0},i1=({chains:e,selectedChain:t,onChainChange:n,disabled:r=!1,className:o="",walletType:s="mpc"})=>{const{t:i}=Tt();return L.jsx("div",{className:`relative ${o}`,children:L.jsx(cs,{value:t,onChange:n,disabled:r,children:({open:c})=>L.jsxs(L.Fragment,{children:[L.jsxs(cs.Button,{className:`
94
84
  relative w-full h-9 text-text-primary bg-fill-input-primary
95
85
  items-center justify-between flex px-3 rounded-lg
96
86
  focus:outline-none
97
87
  ${r?"opacity-50 cursor-not-allowed":"cursor-pointer hover:bg-fill-btn-secondary-hover"}
98
88
  ${c?"ring-1 ring-white":""}
99
- `,children:[M.jsx("span",{className:"text-sm leading-[18px] font-medium",children:i("deposit.chain")}),M.jsxs("div",{className:"flex items-center space-x-2",children:[t.chainIconUrl?M.jsx("img",{src:t.chainIconUrl,alt:t.chain,className:"w-4 h-4 rounded-full"}):M.jsx("div",{className:"w-4 h-4 rounded-full bg-blue-500 flex items-center justify-center",children:M.jsx("span",{className:"text-xs text-white font-bold",children:t.chain.charAt(0)})}),M.jsx("span",{className:"text-sm text-white ml-1",children:t.chain}),M.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:[M.jsx("g",{clipPath:"url(#clip0_12919_27745)",children:M.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"})}),M.jsx("defs",{children:M.jsx("clipPath",{id:"clip0_12919_27745",children:M.jsx("rect",{width:"10",height:"10",fill:"white",transform:"translate(0 0.955078)"})})})]})]})]}),M.jsx(hf,{as:E.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:M.jsx(mn.Options,{className:`
89
+ `,children:[L.jsx("span",{className:"text-sm leading-[18px] font-medium",children:i("deposit.chain")}),L.jsxs("div",{className:"flex items-center space-x-2",children:[t.chainIconUrl?L.jsx("img",{src:t.chainIconUrl,alt:t.chain,className:"w-4 h-4 rounded-full"}):L.jsx("div",{className:"w-4 h-4 rounded-full bg-blue-500 flex items-center justify-center",children:L.jsx("span",{className:"text-xs text-white font-bold",children:t.chain.charAt(0)})}),L.jsx("span",{className:"text-sm text-white ml-1",children:t.chain}),L.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:[L.jsx("g",{clipPath:"url(#clip0_12919_27745)",children:L.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"})}),L.jsx("defs",{children:L.jsx("clipPath",{id:"clip0_12919_27745",children:L.jsx("rect",{width:"10",height:"10",fill:"white",transform:"translate(0 0.955078)"})})})]})]})]}),L.jsx(Mv,{as:E.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:L.jsx(cs.Options,{className:`
100
90
  absolute z-50 mt-1 w-full max-h-60 overflow-auto rounded-lg
101
91
  bg-fill-input-primary border border-line-divider-secondary shadow-lg
102
92
  focus:outline-none
103
- `,children:e.filter(a=>a[s==="mpc"?"allowAaDeposit":"allowDeposit"]!==!1).map(a=>M.jsx(mn.Option,{value:a,className:({active:u,selected:l})=>`relative cursor-pointer select-none py-3 px-3 ${l?"bg-fill-btn-secondary":u?"bg-fill-input-secondary":""}`,children:({selected:u,active:l})=>M.jsxs("div",{className:"flex items-center justify-between",children:[M.jsxs("div",{className:"flex items-center space-x-3",children:[a.chainIconUrl?M.jsx("img",{src:a.chainIconUrl,alt:a.chain,className:"w-5 h-5 rounded-full"}):M.jsx("div",{className:"w-5 h-5 rounded-full bg-blue-500 flex items-center justify-center",children:M.jsx("span",{className:"text-xs text-white font-bold",children:a.chain.charAt(0)})}),M.jsx("div",{className:"flex flex-col",children:M.jsx("span",{className:`text-sm font-medium ${u||l?"text-text-primary":"text-text-tertiary"}`,children:a.chain})})]}),u&&M.jsx(Sf,{className:"w-4 h-4 text-blue-400"})]})},a.chainId))})})]})})})},na=({currentActiveChain:e,chainList:t,onChainChange:n,curSelectToken:r,onTokenChange:o,walletType:s="mpc"})=>{const i=E.useMemo(()=>(e==null?void 0:e.tokenList)||[],[e]),c=d=>{if(n(d.chainId),d.tokenList&&d.tokenList.length>0&&!d.tokenList.some(m=>m.token===r||m.symbol===r)){const m=d.tokenList[0];o(m.symbol||m.token)}},a=d=>{o(d.symbol||d.token)},u=E.useMemo(()=>t.map(d=>d),[t]),l=E.useMemo(()=>u.find(d=>d.chainId===e.chainId)||u[0],[u,e.chainId]),f=E.useMemo(()=>i.map(d=>({token:d.token,symbol:d.symbol,iconUrl:d.iconUrl,decimals:d.decimals,tokenAddress:d.tokenAddress})),[i]),p=E.useMemo(()=>{if(f.length!==0)return f.find(d=>d.token===r||d.symbol===r)||f[0]},[f,r]);return M.jsxs("div",{className:"space-y-4",children:[M.jsx(o1,{chains:u,selectedChain:l,onChainChange:d=>{const h=t.find(m=>m.chainId===d.chainId);h&&c(h)},walletType:s,className:"w-full"}),f.length>0?p&&M.jsx(r1,{tokens:f,selectedToken:p,onTokenChange:a,className:"w-full"}):M.jsx("div",{className:"w-full h-9 bg-fill-input-primary rounded-lg flex items-center justify-center",children:M.jsx("span",{className:"text-sm text-gray-400",children:"No tokens available"})})]})},s1=(e,t)=>Number(e)>Number(t),gt=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"},ra=(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 ra(a,t)}const s=parseFloat(e),i=parseFloat(t);return!isNaN(s)&&!isNaN(i)&&s>i?{isValid:!0,formattedValue:gt(t),errorType:"auto_adjusted_to_max"}:{isValid:!0,formattedValue:e}},i1=(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)},cs={ETHEREUM:1,ARBITRUM:42161,ARBITRUM_SEPOLIA:421614,SEPOLIA:11155111},a1=[cs.ETHEREUM,cs.SEPOLIA,cs.ARBITRUM,cs.ARBITRUM_SEPOLIA],c1=e=>{if(e.chainId!==void 0){const t=typeof e.chainId=="string"?parseInt(e.chainId,10):e.chainId;return!a1.includes(t)}return!0},u1=[{chainId:1,chain:"Ethereum",chainIconUrl:"https://static.edgex.exchange/icons/logo/ethereum.svg",allowDeposit:!0,blockTime:12,txConfirm:12},{chainId:42161,chain:"Arbitrum",chainIconUrl:"https://static.edgex.exchange/icons/logo/arbitrum.svg",allowDeposit:!0,blockTime:1,txConfirm:1}],oa={wallet:"mpc",ethAddress:"",accountId:"",l2Key:""},sa={address:""},ia={multiChain:{minDeposit:10}};var us={},l1=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()}},f1=l1,Pf={"text/plain":"Text","text/html":"Url",default:"Text"},d1="Copy to clipboard: #{key}, Enter";function p1(e){var t=(/mac os x/i.test(navigator.userAgent)?"⌘":"Ctrl")+"+C";return e.replace(/#{\s*key\s*}/g,t)}function h1(e,t){var n,r,o,s,i,c,a=!1;t||(t={}),n=t.debug||!1;try{o=f1(),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(l){if(l.stopPropagation(),t.format)if(l.preventDefault(),typeof l.clipboardData>"u"){n&&console.warn("unable to use e.clipboardData"),n&&console.warn("trying IE specific stuff"),window.clipboardData.clearData();var f=Pf[t.format]||Pf.default;window.clipboardData.setData(f,e)}else l.clipboardData.clearData(),l.clipboardData.setData(t.format,e);t.onCopy&&(l.preventDefault(),t.onCopy(l.clipboardData))}),document.body.appendChild(c),s.selectNodeContents(c),i.addRange(s);var u=document.execCommand("copy");if(!u)throw new Error("copy command was unsuccessful");a=!0}catch(l){n&&console.error("unable to copy using execCommand: ",l),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=p1("message"in t?t.message:d1),window.prompt(r,e)}}finally{i&&(typeof i.removeRange=="function"?i.removeRange(s):i.removeAllRanges()),c&&document.body.removeChild(c),o()}return a}var m1=h1;function aa(e){"@babel/helpers - typeof";return aa=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},aa(e)}Object.defineProperty(us,"__esModule",{value:!0}),us.CopyToClipboard=void 0;var ls=$f(E),g1=$f(m1),b1=["text","onCopy","options","children"];function $f(e){return e&&e.__esModule?e:{default:e}}function Af(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 Tf(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Af(Object(n),!0).forEach(function(r){ua(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Af(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function y1(e,t){if(e==null)return{};var n=v1(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 v1(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 w1(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function x1(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 E1(e,t,n){return t&&x1(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function S1(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&&ca(e,t)}function ca(e,t){return ca=Object.setPrototypeOf||function(r,o){return r.__proto__=o,r},ca(e,t)}function P1(e){var t=A1();return function(){var r=fs(e),o;if(t){var s=fs(this).constructor;o=Reflect.construct(r,arguments,s)}else o=r.apply(this,arguments);return $1(this,o)}}function $1(e,t){if(t&&(aa(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Cf(e)}function Cf(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function A1(){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 fs(e){return fs=Object.setPrototypeOf?Object.getPrototypeOf:function(n){return n.__proto__||Object.getPrototypeOf(n)},fs(e)}function ua(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Of=function(e){S1(n,e);var t=P1(n);function n(){var r;w1(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)),ua(Cf(r),"onClick",function(c){var a=r.props,u=a.text,l=a.onCopy,f=a.children,p=a.options,d=ls.default.Children.only(f),h=(0,g1.default)(u,p);l&&l(u,h),d&&d.props&&typeof d.props.onClick=="function"&&d.props.onClick(c)}),r}return E1(n,[{key:"render",value:function(){var o=this.props;o.text,o.onCopy,o.options;var s=o.children,i=y1(o,b1),c=ls.default.Children.only(s);return ls.default.cloneElement(c,Tf(Tf({},i),{},{onClick:this.onClick}))}}]),n}(ls.default.PureComponent);us.CopyToClipboard=Of,ua(Of,"defaultProps",{onCopy:void 0,options:void 0});var T1=us,la=T1.CopyToClipboard;la.CopyToClipboard=la;var C1=la;const O1=Q0(C1);var N1=Object.defineProperty,ds=Object.getOwnPropertySymbols,Nf=Object.prototype.hasOwnProperty,If=Object.prototype.propertyIsEnumerable,Mf=(e,t,n)=>t in e?N1(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,fa=(e,t)=>{for(var n in t||(t={}))Nf.call(t,n)&&Mf(e,n,t[n]);if(ds)for(var n of ds(t))If.call(t,n)&&Mf(e,n,t[n]);return e},da=(e,t)=>{var n={};for(var r in e)Nf.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&ds)for(var r of ds(e))t.indexOf(r)<0&&If.call(e,r)&&(n[r]=e[r]);return n};/**
93
+ `,children:e.filter(a=>a[s==="mpc"?"allowAaDeposit":"allowDeposit"]!==!1).map(a=>L.jsx(cs.Option,{value:a,className:({active:u,selected:l})=>`relative cursor-pointer select-none py-3 px-3 ${l?"bg-fill-btn-secondary":u?"bg-fill-input-secondary":""}`,children:({selected:u,active:l})=>L.jsxs("div",{className:"flex items-center justify-between",children:[L.jsxs("div",{className:"flex items-center space-x-3",children:[a.chainIconUrl?L.jsx("img",{src:a.chainIconUrl,alt:a.chain,className:"w-5 h-5 rounded-full"}):L.jsx("div",{className:"w-5 h-5 rounded-full bg-blue-500 flex items-center justify-center",children:L.jsx("span",{className:"text-xs text-white font-bold",children:a.chain.charAt(0)})}),L.jsx("div",{className:"flex flex-col",children:L.jsx("span",{className:`text-sm font-medium ${u||l?"text-text-primary":"text-text-tertiary"}`,children:a.chain})})]}),L.jsx("div",{className:"w-12 bg-fill-page-secondary p-1 h-5 flex rounded",children:L.jsx(_r,{className:"w-full justify-between",selectedLevel:Mt(a.chainId)?mt.SLOW:mt.FAST,maxLevel:3})})]})},a.chainId))})})]})})})},na=({currentActiveChain:e,chainList:t,onChainChange:n,curSelectToken:r,onTokenChange:o,walletType:s="mpc",txType:i="deposit"})=>{const c=E.useCallback(m=>i==="withdraw"?s==="mpc"?m.allowAaWithdraw!==!1:m.allowWithdraw!==!1:s==="mpc"?m.allowAaDeposit!==!1:m.allowDeposit!==!1,[i,s]),a=E.useMemo(()=>{const m=new Set,y=[];for(const A of t)if(c(A))for(const g of A.tokenList||[]){const P=g.symbol||g.token;P&&(m.has(P)||(m.add(P),y.push({token:P,symbol:P,iconUrl:g.iconUrl,decimals:g.decimals,tokenAddress:g.tokenAddress})))}return y},[t,c]),u=m=>{n(m.chainId)},l=m=>{const y=m.symbol||m.token;o(y);const A=[];for(const g of t){if(!c(g))continue;(g.tokenList||[]).some(k=>(k.symbol||k.token)===y)&&A.push(g.chainId)}!A.includes(e.chainId)&&A[0]!==void 0&&n(A[0])},f=E.useMemo(()=>{var A,g;const m=r||((A=a[0])==null?void 0:A.symbol)||((g=a[0])==null?void 0:g.token);if(!m)return[];const y=[];for(const P of t){if(!c(P))continue;const k=(P.tokenList||[]).find(B=>(B.symbol||B.token)===m);k&&y.push({...P,tokenList:[{token:k.token,symbol:k.symbol,iconUrl:k.iconUrl,decimals:k.decimals,tokenAddress:k.tokenAddress}]})}return y},[t,r,a,c]),p=E.useMemo(()=>f.find(m=>m.chainId===e.chainId)||f[0],[f,e.chainId]),d=E.useMemo(()=>a,[a]),h=E.useMemo(()=>{if(d.length!==0)return d.find(m=>m.token===r||m.symbol===r)||d[0]},[d,r]);return E.useEffect(()=>{if(d.length===0)return;if(!d.some(y=>(y.symbol||y.token)===r)){const y=d[0];o(y.symbol||y.token)}},[d,r,o]),E.useEffect(()=>{if(f.length===0)return;f.some(y=>y.chainId===e.chainId)||n(f[0].chainId)},[f,e.chainId,n]),L.jsxs("div",{className:"space-y-4",children:[d.length>0&&h&&L.jsx(wm,{tokens:d,selectedToken:h,onTokenChange:l}),L.jsx(i1,{chains:f,selectedChain:p,onChainChange:m=>{const y=t.find(A=>A.chainId===m.chainId);y&&u(y)},walletType:s,className:"w-full"})]})},a1=(e,t)=>Number(e)>Number(t),gt=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"},ra=(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 ra(a,t)}const s=parseFloat(e),i=parseFloat(t);return!isNaN(s)&&!isNaN(i)&&s>i?{isValid:!0,formattedValue:gt(t),errorType:"auto_adjusted_to_max"}:{isValid:!0,formattedValue:e}},c1=(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)},us={ETHEREUM:1,ARBITRUM:42161,ARBITRUM_SEPOLIA:421614,SEPOLIA:11155111},u1=[us.ETHEREUM,us.SEPOLIA,us.ARBITRUM,us.ARBITRUM_SEPOLIA],l1=e=>{if(e.chainId!==void 0){const t=typeof e.chainId=="string"?parseInt(e.chainId,10):e.chainId;return!u1.includes(t)}return!0},f1=[{chainId:1,chain:"Ethereum",chainIconUrl:"https://static.edgex.exchange/icons/logo/ethereum.svg",allowDeposit:!0,blockTime:12,txConfirm:12},{chainId:42161,chain:"Arbitrum",chainIconUrl:"https://static.edgex.exchange/icons/logo/arbitrum.svg",allowDeposit:!0,blockTime:1,txConfirm:1}],oa={wallet:"mpc",ethAddress:"",accountId:"",l2Key:""},sa={address:""},ia={multiChain:{minDeposit:10}};var ls={},d1=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()}},p1=d1,Sf={"text/plain":"Text","text/html":"Url",default:"Text"},h1="Copy to clipboard: #{key}, Enter";function m1(e){var t=(/mac os x/i.test(navigator.userAgent)?"⌘":"Ctrl")+"+C";return e.replace(/#{\s*key\s*}/g,t)}function g1(e,t){var n,r,o,s,i,c,a=!1;t||(t={}),n=t.debug||!1;try{o=p1(),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(l){if(l.stopPropagation(),t.format)if(l.preventDefault(),typeof l.clipboardData>"u"){n&&console.warn("unable to use e.clipboardData"),n&&console.warn("trying IE specific stuff"),window.clipboardData.clearData();var f=Sf[t.format]||Sf.default;window.clipboardData.setData(f,e)}else l.clipboardData.clearData(),l.clipboardData.setData(t.format,e);t.onCopy&&(l.preventDefault(),t.onCopy(l.clipboardData))}),document.body.appendChild(c),s.selectNodeContents(c),i.addRange(s);var u=document.execCommand("copy");if(!u)throw new Error("copy command was unsuccessful");a=!0}catch(l){n&&console.error("unable to copy using execCommand: ",l),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=m1("message"in t?t.message:h1),window.prompt(r,e)}}finally{i&&(typeof i.removeRange=="function"?i.removeRange(s):i.removeAllRanges()),c&&document.body.removeChild(c),o()}return a}var b1=g1;function aa(e){"@babel/helpers - typeof";return aa=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},aa(e)}Object.defineProperty(ls,"__esModule",{value:!0}),ls.CopyToClipboard=void 0;var fs=Pf(E),y1=Pf(b1),v1=["text","onCopy","options","children"];function Pf(e){return e&&e.__esModule?e:{default:e}}function $f(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 Tf(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?$f(Object(n),!0).forEach(function(r){ua(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):$f(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function w1(e,t){if(e==null)return{};var n=x1(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 x1(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 E1(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function S1(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 P1(e,t,n){return t&&S1(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function $1(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&&ca(e,t)}function ca(e,t){return ca=Object.setPrototypeOf||function(r,o){return r.__proto__=o,r},ca(e,t)}function T1(e){var t=C1();return function(){var r=ds(e),o;if(t){var s=ds(this).constructor;o=Reflect.construct(r,arguments,s)}else o=r.apply(this,arguments);return A1(this,o)}}function A1(e,t){if(t&&(aa(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Af(e)}function Af(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function C1(){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 ds(e){return ds=Object.setPrototypeOf?Object.getPrototypeOf:function(n){return n.__proto__||Object.getPrototypeOf(n)},ds(e)}function ua(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Cf=function(e){$1(n,e);var t=T1(n);function n(){var r;E1(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)),ua(Af(r),"onClick",function(c){var a=r.props,u=a.text,l=a.onCopy,f=a.children,p=a.options,d=fs.default.Children.only(f),h=(0,y1.default)(u,p);l&&l(u,h),d&&d.props&&typeof d.props.onClick=="function"&&d.props.onClick(c)}),r}return P1(n,[{key:"render",value:function(){var o=this.props;o.text,o.onCopy,o.options;var s=o.children,i=w1(o,v1),c=fs.default.Children.only(s);return fs.default.cloneElement(c,Tf(Tf({},i),{},{onClick:this.onClick}))}}]),n}(fs.default.PureComponent);ls.CopyToClipboard=Cf,ua(Cf,"defaultProps",{onCopy:void 0,options:void 0});var O1=ls,la=O1.CopyToClipboard;la.CopyToClipboard=la;var I1=la;const N1=Y0(I1);var M1=Object.defineProperty,ps=Object.getOwnPropertySymbols,Of=Object.prototype.hasOwnProperty,If=Object.prototype.propertyIsEnumerable,Nf=(e,t,n)=>t in e?M1(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,fa=(e,t)=>{for(var n in t||(t={}))Of.call(t,n)&&Nf(e,n,t[n]);if(ps)for(var n of ps(t))If.call(t,n)&&Nf(e,n,t[n]);return e},da=(e,t)=>{var n={};for(var r in e)Of.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&ps)for(var r of ps(e))t.indexOf(r)<0&&If.call(e,r)&&(n[r]=e[r]);return n};/**
104
94
  * @license QR Code generator library (TypeScript)
105
95
  * Copyright (c) Project Nayuki.
106
96
  * SPDX-License-Identifier: MIT
107
- */var On;(e=>{const t=class se{constructor(a,u,l,f){if(this.version=a,this.errorCorrectionLevel=u,this.modules=[],this.isFunction=[],a<se.MIN_VERSION||a>se.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 se.encodeSegments(l,u)}static encodeBinary(a,u){const l=e.QrSegment.makeBytes(a);return se.encodeSegments([l],u)}static encodeSegments(a,u,l=1,f=40,p=-1,d=!0){if(!(se.MIN_VERSION<=l&&l<=f&&f<=se.MAX_VERSION)||p<-1||p>7)throw new RangeError("Invalid value");let h,m;for(h=l;;h++){const $=se.getNumDataCodewords(h,u)*8,B=i.getTotalBits(a,h);if(B<=$){m=B;break}if(h>=f)throw new RangeError("Data too long")}for(const $ of[se.Ecc.MEDIUM,se.Ecc.QUARTILE,se.Ecc.HIGH])d&&m<=se.getNumDataCodewords(h,$)*8&&(u=$);let v=[];for(const $ of a){n($.mode.modeBits,4,v),n($.numChars,$.mode.numCharCountBits(h),v);for(const B of $.getData())v.push(B)}o(v.length==m);const C=se.getNumDataCodewords(h,u)*8;o(v.length<=C),n(0,Math.min(4,C-v.length),v),n(0,(8-v.length%8)%8,v),o(v.length%8==0);for(let $=236;v.length<C;$^=253)n($,8,v);let y=[];for(;y.length*8<v.length;)y.push(0);return v.forEach(($,B)=>y[B>>>3]|=$<<7-(B&7)),new se(h,u,y,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!=se.getNumDataCodewords(u,l))throw new RangeError("Invalid argument");const f=se.NUM_ERROR_CORRECTION_BLOCKS[l.ordinal][u],p=se.ECC_CODEWORDS_PER_BLOCK[l.ordinal][u],d=Math.floor(se.getNumRawDataModules(u)/8),h=f-d%f,m=Math.floor(d/f);let v=[];const C=se.reedSolomonComputeDivisor(p);for(let $=0,B=0;$<f;$++){let k=a.slice(B,B+m-p+($<h?0:1));B+=k.length;const D=se.reedSolomonComputeRemainder(k,C);$<h&&k.push(0),v.push(k.concat(D))}let y=[];for(let $=0;$<v[0].length;$++)v.forEach((B,k)=>{($!=m-p||k>=h)&&y.push(B[$])});return o(y.length==d),y}drawCodewords(a){if(a.length!=Math.floor(se.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+=se.PENALTY_N1:h>5&&a++):(this.finderPenaltyAddHistory(h,m),d||(a+=this.finderPenaltyCountPatterns(m)*se.PENALTY_N3),d=this.modules[p][v],h=1);a+=this.finderPenaltyTerminateAndCount(d,h,m)*se.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+=se.PENALTY_N1:h>5&&a++):(this.finderPenaltyAddHistory(h,m),d||(a+=this.finderPenaltyCountPatterns(m)*se.PENALTY_N3),d=this.modules[v][p],h=1);a+=this.finderPenaltyTerminateAndCount(d,h,m)*se.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+=se.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*se.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<se.MIN_VERSION||a>se.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(se.getNumRawDataModules(a)/8)-se.ECC_CODEWORDS_PER_BLOCK[u.ordinal][a]*se.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]=se.reedSolomonMultiply(u[p],l),p+1<u.length&&(u[p]^=u[p+1]);l=se.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]^=se.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})(On||(On={})),(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={}))})(On||(On={})),(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={}))})(On||(On={}));var Qn=On;/**
97
+ */var Cn;(e=>{const t=class se{constructor(a,u,l,f){if(this.version=a,this.errorCorrectionLevel=u,this.modules=[],this.isFunction=[],a<se.MIN_VERSION||a>se.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 y=this.getPenaltyScore();y<h&&(f=m,h=y),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 se.encodeSegments(l,u)}static encodeBinary(a,u){const l=e.QrSegment.makeBytes(a);return se.encodeSegments([l],u)}static encodeSegments(a,u,l=1,f=40,p=-1,d=!0){if(!(se.MIN_VERSION<=l&&l<=f&&f<=se.MAX_VERSION)||p<-1||p>7)throw new RangeError("Invalid value");let h,m;for(h=l;;h++){const P=se.getNumDataCodewords(h,u)*8,k=i.getTotalBits(a,h);if(k<=P){m=k;break}if(h>=f)throw new RangeError("Data too long")}for(const P of[se.Ecc.MEDIUM,se.Ecc.QUARTILE,se.Ecc.HIGH])d&&m<=se.getNumDataCodewords(h,P)*8&&(u=P);let y=[];for(const P of a){n(P.mode.modeBits,4,y),n(P.numChars,P.mode.numCharCountBits(h),y);for(const k of P.getData())y.push(k)}o(y.length==m);const A=se.getNumDataCodewords(h,u)*8;o(y.length<=A),n(0,Math.min(4,A-y.length),y),n(0,(8-y.length%8)%8,y),o(y.length%8==0);for(let P=236;y.length<A;P^=253)n(P,8,y);let g=[];for(;g.length*8<y.length;)g.push(0);return y.forEach((P,k)=>g[k>>>3]|=P<<7-(k&7)),new se(h,u,g,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!=se.getNumDataCodewords(u,l))throw new RangeError("Invalid argument");const f=se.NUM_ERROR_CORRECTION_BLOCKS[l.ordinal][u],p=se.ECC_CODEWORDS_PER_BLOCK[l.ordinal][u],d=Math.floor(se.getNumRawDataModules(u)/8),h=f-d%f,m=Math.floor(d/f);let y=[];const A=se.reedSolomonComputeDivisor(p);for(let P=0,k=0;P<f;P++){let B=a.slice(k,k+m-p+(P<h?0:1));k+=B.length;const F=se.reedSolomonComputeRemainder(B,A);P<h&&B.push(0),y.push(B.concat(F))}let g=[];for(let P=0;P<y[0].length;P++)y.forEach((k,B)=>{(P!=m-p||B>=h)&&g.push(k[P])});return o(g.length==d),g}drawCodewords(a){if(a.length!=Math.floor(se.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 y=0;y<this.size;y++)this.modules[p][y]==d?(h++,h==5?a+=se.PENALTY_N1:h>5&&a++):(this.finderPenaltyAddHistory(h,m),d||(a+=this.finderPenaltyCountPatterns(m)*se.PENALTY_N3),d=this.modules[p][y],h=1);a+=this.finderPenaltyTerminateAndCount(d,h,m)*se.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 y=0;y<this.size;y++)this.modules[y][p]==d?(h++,h==5?a+=se.PENALTY_N1:h>5&&a++):(this.finderPenaltyAddHistory(h,m),d||(a+=this.finderPenaltyCountPatterns(m)*se.PENALTY_N3),d=this.modules[y][p],h=1);a+=this.finderPenaltyTerminateAndCount(d,h,m)*se.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+=se.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*se.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<se.MIN_VERSION||a>se.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(se.getNumRawDataModules(a)/8)-se.ECC_CODEWORDS_PER_BLOCK[u.ordinal][a]*se.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]=se.reedSolomonMultiply(u[p],l),p+1<u.length&&(u[p]^=u[p+1]);l=se.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]^=se.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})(Cn||(Cn={})),(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={}))})(Cn||(Cn={})),(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={}))})(Cn||(Cn={}));var Xn=Cn;/**
108
98
  * @license qrcode.react
109
99
  * Copyright (c) Paul O'Shannessy
110
100
  * SPDX-License-Identifier: ISC
111
- */var I1={L:Qn.QrCode.Ecc.LOW,M:Qn.QrCode.Ecc.MEDIUM,Q:Qn.QrCode.Ecc.QUARTILE,H:Qn.QrCode.Ecc.HIGH},Lf=128,Bf="L",kf="#FFFFFF",Rf="#000000",Ff=!1,Df=1,M1=4,L1=0,B1=.1;function jf(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 _f(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 k1(e,t,n,r){if(r==null)return null;const o=e.length+n*2,s=Math.floor(t*B1),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),C=Math.ceil(a+l-m);p={x:h,y:m,w:v,h:C}}const d=r.crossOrigin;return{x:u,y:l,h:a,w:c,excavation:p,opacity:f,crossOrigin:d}}function R1(e,t){return t!=null?Math.max(Math.floor(t),0):e?M1:L1}function Uf({value:e,level:t,minVersion:n,includeMargin:r,marginSize:o,imageSettings:s,size:i,boostLevel:c}){let a=E.useMemo(()=>{const h=(Array.isArray(e)?e:[e]).reduce((m,v)=>(m.push(...Qn.QrSegment.makeSegments(v)),m),[]);return Qn.QrCode.encodeSegments(h,I1[t],n,void 0,void 0,c)},[e,t,n,c]);const{cells:u,margin:l,numCells:f,calculatedImageSettings:p}=E.useMemo(()=>{let d=a.getModules();const h=R1(r,o),m=d.length+h*2,v=k1(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 F1=function(){try{new Path2D().addPath(new Path2D)}catch{return!1}return!0}(),D1=E.forwardRef(function(t,n){const r=t,{value:o,size:s=Lf,level:i=Bf,bgColor:c=kf,fgColor:a=Rf,includeMargin:u=Ff,minVersion:l=Df,boostLevel:f,marginSize:p,imageSettings:d}=r,m=da(r,["value","size","level","bgColor","fgColor","includeMargin","minVersion","boostLevel","marginSize","imageSettings"]),{style:v}=m,C=da(m,["style"]),y=d==null?void 0:d.src,$=E.useRef(null),B=E.useRef(null),k=E.useCallback(S=>{$.current=S,typeof n=="function"?n(S):n&&(n.current=S)},[n]),[D,j]=E.useState(!1),{margin:g,cells:w,numCells:A,calculatedImageSettings:I}=Uf({value:o,level:i,minVersion:l,boostLevel:f,includeMargin:u,marginSize:p,imageSettings:d,size:s});E.useEffect(()=>{if($.current!=null){const S=$.current,x=S.getContext("2d");if(!x)return;let T=w;const O=B.current,b=I!=null&&O!==null&&O.complete&&O.naturalHeight!==0&&O.naturalWidth!==0;b&&I.excavation!=null&&(T=_f(w,I.excavation));const L=window.devicePixelRatio||1;S.height=S.width=s*L;const F=s/A*L;x.scale(F,F),x.fillStyle=c,x.fillRect(0,0,A,A),x.fillStyle=a,F1?x.fill(new Path2D(jf(T,g))):w.forEach(function(U,z){U.forEach(function(V,Z){V&&x.fillRect(Z+g,z+g,1,1)})}),I&&(x.globalAlpha=I.opacity),b&&x.drawImage(O,I.x+g,I.y+g,I.w,I.h)}}),E.useEffect(()=>{j(!1)},[y]);const N=fa({height:s,width:s},v);let P=null;return y!=null&&(P=E.createElement("img",{src:y,key:y,style:{display:"none"},onLoad:()=>{j(!0)},ref:B,crossOrigin:I==null?void 0:I.crossOrigin})),E.createElement(E.Fragment,null,E.createElement("canvas",fa({style:N,height:s,width:s,ref:k,role:"img"},C)),P)});D1.displayName="QRCodeCanvas";var zf=E.forwardRef(function(t,n){const r=t,{value:o,size:s=Lf,level:i=Bf,bgColor:c=kf,fgColor:a=Rf,includeMargin:u=Ff,minVersion:l=Df,boostLevel:f,title:p,marginSize:d,imageSettings:h}=r,m=da(r,["value","size","level","bgColor","fgColor","includeMargin","minVersion","boostLevel","title","marginSize","imageSettings"]),{margin:v,cells:C,numCells:y,calculatedImageSettings:$}=Uf({value:o,level:i,minVersion:l,boostLevel:f,includeMargin:u,marginSize:d,imageSettings:h,size:s});let B=C,k=null;h!=null&&$!=null&&($.excavation!=null&&(B=_f(C,$.excavation)),k=E.createElement("image",{href:h.src,height:$.h,width:$.w,x:$.x+v,y:$.y+v,preserveAspectRatio:"none",opacity:$.opacity,crossOrigin:$.crossOrigin}));const D=jf(B,v);return E.createElement("svg",fa({height:s,width:s,viewBox:`0 0 ${y} ${y}`,ref:n,role:"img"},m),!!p&&E.createElement("title",null,p),E.createElement("path",{fill:c,d:`M0,0 h${y}v${y}H0z`,shapeRendering:"crispEdges"}),E.createElement("path",{fill:a,d:D,shapeRendering:"crispEdges"}),k)});zf.displayName="QRCodeSVG";function j1(){const e=navigator.userAgentData;return e!=null&&e.platform?e.platform:navigator.platform}function _1(){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 Wf(){return/apple/i.test(navigator.vendor)}function U1(){return j1().toLowerCase().startsWith("mac")&&!navigator.maxTouchPoints}function z1(){return _1().includes("jsdom/")}const Hf="data-floating-ui-focusable",W1="input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])";function pa(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 Jn(e,t){if(!e||!t)return!1;const n=t.getRootNode==null?void 0:t.getRootNode();if(e.contains(t))return!0;if(n&&Li(n)){let r=t;for(;r;){if(e===r)return!0;r=r.parentNode||r.host}}return!1}function er(e){return"composedPath"in e?e.composedPath()[0]:e.target}function ha(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 H1(e){return e.matches("html,body")}function It(e){return(e==null?void 0:e.ownerDocument)||document}function Vf(e){return Be(e)&&e.matches(W1)}function V1(e){if(!e||z1())return!0;try{return e.matches(":focus-visible")}catch{return!0}}function G1(e){return e?e.hasAttribute(Hf)?e:e.querySelector("["+Hf+"]")||e:null}function ps(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,...ps(e,o.id,n)])}function q1(e){return"nativeEvent"in e}function _r(e,t){const n=["mouse","pen"];return t||n.push("",void 0),n.includes(e)}var Z1=typeof document<"u",K1=function(){},Mt=Z1?E.useLayoutEffect:K1;const Y1={..._};function hs(e){const t=_.useRef(e);return Mt(()=>{t.current=e}),t}const X1=Y1.useInsertionEffect||(e=>e());function Lt(e){const t=_.useRef(()=>{if(process.env.NODE_ENV!=="production")throw new Error("Cannot call an event handler while rendering.")});return X1(()=>{t.current=e}),_.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 Gf=()=>({getShadowRoot:!0,displayCheck:typeof ResizeObserver=="function"&&ResizeObserver.toString().includes("[native code]")?"full":"none"});function qf(e,t){const n=Ol(e,Gf()),r=n.length;if(r===0)return;const o=pa(It(e)),s=n.indexOf(o),i=s===-1?t===1?0:r-1:s+t;return n[i]}function Q1(e){return qf(It(e).body,1)||e}function J1(e){return qf(It(e).body,-1)||e}function ma(e,t){const n=t||e.currentTarget,r=e.relatedTarget;return!r||!Jn(n,r)}function ew(e){Ol(e,Gf()).forEach(n=>{n.dataset.tabindex=n.getAttribute("tabindex")||"",n.setAttribute("tabindex","-1")})}function Zf(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 tw="data-floating-ui-focusable",Kf="active",Yf="selected",nw={..._};let Xf=!1,rw=0;const Qf=()=>"floating-ui-"+Math.random().toString(36).slice(2,6)+rw++;function ow(){const[e,t]=_.useState(()=>Xf?Qf():void 0);return Mt(()=>{e==null&&t(Qf())},[]),_.useEffect(()=>{Xf=!0},[]),e}const ga=nw.useId||ow;let ba;process.env.NODE_ENV!=="production"&&(ba=new Set);function sw(){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=ba)!=null&&e.has(o))){var s;(s=ba)==null||s.add(o),console.error(o)}}function iw(){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 aw=_.createContext(null),cw=_.createContext(null),ya=()=>{var e;return((e=_.useContext(aw))==null?void 0:e.id)||null},va=()=>_.useContext(cw);function Ur(e){return"data-floating-ui-"+e}function at(e){e.current!==-1&&(clearTimeout(e.current),e.current=-1)}const Jf=Ur("safe-polygon");function wa(e,t,n){if(n&&!_r(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 xa(e){return typeof e=="function"?e():e}function uw(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=va(),h=ya(),m=hs(u),v=hs(a),C=hs(n),y=hs(f),$=_.useRef(),B=_.useRef(-1),k=_.useRef(),D=_.useRef(-1),j=_.useRef(!0),g=_.useRef(!1),w=_.useRef(()=>{}),A=_.useRef(!1),I=Lt(()=>{var O;const b=(O=o.current.openEvent)==null?void 0:O.type;return(b==null?void 0:b.includes("mouse"))&&b!=="mousedown"});_.useEffect(()=>{if(!c)return;function O(b){let{open:L}=b;L||(at(B),at(D),j.current=!0,A.current=!1)}return s.on("openchange",O),()=>{s.off("openchange",O)}},[c,s]),_.useEffect(()=>{if(!c||!m.current||!n)return;function O(L){I()&&r(!1,L,"hover")}const b=It(i.floating).documentElement;return b.addEventListener("mouseleave",O),()=>{b.removeEventListener("mouseleave",O)}},[i.floating,n,r,c,m,I]);const N=_.useCallback(function(O,b,L){b===void 0&&(b=!0),L===void 0&&(L="hover");const F=wa(v.current,"close",$.current);F&&!k.current?(at(B),B.current=window.setTimeout(()=>r(!1,O,L),F)):b&&(at(B),r(!1,O,L))},[v,r]),P=Lt(()=>{w.current(),k.current=void 0}),S=Lt(()=>{if(g.current){const O=It(i.floating).body;O.style.pointerEvents="",O.removeAttribute(Jf),g.current=!1}}),x=Lt(()=>o.current.openEvent?["click","mousedown"].includes(o.current.openEvent.type):!1);_.useEffect(()=>{if(!c)return;function O(z){if(at(B),j.current=!1,l&&!_r($.current)||xa(y.current)>0&&!wa(v.current,"open"))return;const V=wa(v.current,"open",$.current);V?B.current=window.setTimeout(()=>{C.current||r(!0,z,"hover")},V):n||r(!0,z,"hover")}function b(z){if(x()){S();return}w.current();const V=It(i.floating);if(at(D),A.current=!1,m.current&&o.current.floatingContext){n||at(B),k.current=m.current({...o.current.floatingContext,tree:d,x:z.clientX,y:z.clientY,onClose(){S(),P(),x()||N(z,!0,"safe-polygon")}});const W=k.current;V.addEventListener("mousemove",W),w.current=()=>{V.removeEventListener("mousemove",W)};return}($.current==="touch"?!Jn(i.floating,z.relatedTarget):!0)&&N(z)}function L(z){x()||o.current.floatingContext&&(m.current==null||m.current({...o.current.floatingContext,tree:d,x:z.clientX,y:z.clientY,onClose(){S(),P(),x()||N(z)}})(z))}function F(){at(B)}function U(z){x()||N(z,!1)}if(de(i.domReference)){const z=i.domReference,V=i.floating;return n&&z.addEventListener("mouseleave",L),p&&z.addEventListener("mousemove",O,{once:!0}),z.addEventListener("mouseenter",O),z.addEventListener("mouseleave",b),V&&(V.addEventListener("mouseleave",L),V.addEventListener("mouseenter",F),V.addEventListener("mouseleave",U)),()=>{n&&z.removeEventListener("mouseleave",L),p&&z.removeEventListener("mousemove",O),z.removeEventListener("mouseenter",O),z.removeEventListener("mouseleave",b),V&&(V.removeEventListener("mouseleave",L),V.removeEventListener("mouseenter",F),V.removeEventListener("mouseleave",U))}}},[i,c,e,l,p,N,P,S,r,n,C,d,v,m,o,x,y]),Mt(()=>{var O;if(c&&n&&(O=m.current)!=null&&(O=O.__options)!=null&&O.blockPointerEvents&&I()){g.current=!0;const L=i.floating;if(de(i.domReference)&&L){var b;const F=It(i.floating).body;F.setAttribute(Jf,"");const U=i.domReference,z=d==null||(b=d.nodesRef.current.find(V=>V.id===h))==null||(b=b.context)==null?void 0:b.elements.floating;return z&&(z.style.pointerEvents=""),F.style.pointerEvents="none",U.style.pointerEvents="auto",L.style.pointerEvents="auto",()=>{F.style.pointerEvents="",U.style.pointerEvents="",L.style.pointerEvents=""}}}},[c,n,h,i,d,m,I]),Mt(()=>{n||($.current=void 0,A.current=!1,P(),S())},[n,P,S]),_.useEffect(()=>()=>{P(),at(B),at(D),S()},[c,i.domReference,P,S]);const T=_.useMemo(()=>{function O(b){$.current=b.pointerType}return{onPointerDown:O,onPointerEnter:O,onMouseMove(b){const{nativeEvent:L}=b;function F(){!j.current&&!C.current&&r(!0,L,"hover")}l&&!_r($.current)||n||xa(y.current)===0||A.current&&b.movementX**2+b.movementY**2<2||(at(D),$.current==="touch"?F():(A.current=!0,D.current=window.setTimeout(F,xa(y.current))))}}},[l,r,n,C,y]);return _.useMemo(()=>c?{reference:T}:{},[c,T])}const ed={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},td=_.forwardRef(function(t,n){const[r,o]=_.useState();Mt(()=>{Wf()&&o("button")},[]);const s={ref:n,tabIndex:0,role:r,"aria-hidden":r?void 0:!0,[Ur("focus-guard")]:"",style:ed};return M.jsx("span",{...t,...s})}),nd=_.createContext(null),rd=Ur("portal");function lw(e){e===void 0&&(e={});const{id:t,root:n}=e,r=ga(),o=dw(),[s,i]=_.useState(null),c=_.useRef(null);return Mt(()=>()=>{s==null||s.remove(),queueMicrotask(()=>{c.current=null})},[s]),Mt(()=>{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(rd,""),a.appendChild(u),c.current=u,i(u)},[t,r]),Mt(()=>{if(n===null||!r||c.current)return;let a=n||(o==null?void 0:o.portalNode);a&&!Mi(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(rd,""),a=u||a,a.appendChild(l),c.current=l,i(l)},[t,n,r,o]),s}function fw(e){const{children:t,id:n,root:r,preserveTabOrder:o=!0}=e,s=lw({id:n,root:r}),[i,c]=_.useState(null),a=_.useRef(null),u=_.useRef(null),l=_.useRef(null),f=_.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 _.useEffect(()=>{if(!s||!o||p)return;function m(v){s&&ma(v)&&(v.type==="focusin"?Zf:ew)(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]),_.useEffect(()=>{s&&(d||Zf(s))},[d,s]),M.jsxs(nd.Provider,{value:_.useMemo(()=>({preserveTabOrder:o,beforeOutsideRef:a,afterOutsideRef:u,beforeInsideRef:l,afterInsideRef:f,portalNode:s,setFocusManagerState:c}),[o,s]),children:[h&&s&&M.jsx(td,{"data-type":"outside",ref:a,onFocus:m=>{if(ma(m,s)){var v;(v=l.current)==null||v.focus()}else{const C=i?i.domReference:null,y=J1(C);y==null||y.focus()}}}),h&&s&&M.jsx("span",{"aria-owns":s.id,style:ed}),s&&Ar.createPortal(t,s),h&&s&&M.jsx(td,{"data-type":"outside",ref:u,onFocus:m=>{if(ma(m,s)){var v;(v=f.current)==null||v.focus()}else{const C=i?i.domReference:null,y=Q1(C);y==null||y.focus(),i!=null&&i.closeOnFocusOut&&(i==null||i.onOpenChange(!1,m.nativeEvent,"focus-out"))}}})]})}const dw=()=>_.useContext(nd);function od(e){return Be(e.target)&&e.target.tagName==="BUTTON"}function pw(e){return Be(e.target)&&e.target.tagName==="A"}function sd(e){return Vf(e)}function hw(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=_.useRef(),d=_.useRef(!1),h=_.useMemo(()=>({onPointerDown(m){p.current=m.pointerType},onMouseDown(m){const v=p.current;m.button===0&&c!=="click"&&(_r(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}_r(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||od(m))&&(m.key===" "&&!sd(s)&&(m.preventDefault(),d.current=!0),!pw(m)&&m.key==="Enter"&&r(!(n&&a),m.nativeEvent,"click"))},onKeyUp(m){m.defaultPrevented||!l||od(m)||sd(s)||m.key===" "&&d.current&&(d.current=!1,r(!(n&&a),m.nativeEvent,"click"))}}),[o,s,c,u,l,r,n,f,a]);return _.useMemo(()=>i?{reference:h}:{},[i,h])}const mw={pointerdown:"onPointerDown",mousedown:"onMouseDown",click:"onClick"},gw={pointerdown:"onPointerDownCapture",mousedown:"onMouseDownCapture",click:"onClickCapture"},id=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 bw(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=va(),v=Lt(typeof a=="function"?a:()=>!1),C=typeof a=="function"?v:a,y=_.useRef(!1),{escapeKey:$,outsidePress:B}=id(d),{escapeKey:k,outsidePress:D}=id(h),j=_.useRef(!1),g=Lt(S=>{var x;if(!n||!i||!c||S.key!=="Escape"||j.current)return;const T=(x=s.current.floatingContext)==null?void 0:x.nodeId,O=m?ps(m.nodesRef.current,T):[];if(!$&&(S.stopPropagation(),O.length>0)){let b=!0;if(O.forEach(L=>{var F;if((F=L.context)!=null&&F.open&&!L.context.dataRef.current.__escapeKeyBubbles){b=!1;return}}),!b)return}r(!1,q1(S)?S.nativeEvent:S,"escape-key")}),w=Lt(S=>{var x;const T=()=>{var O;g(S),(O=er(S))==null||O.removeEventListener("keydown",T)};(x=er(S))==null||x.addEventListener("keydown",T)}),A=Lt(S=>{var x;const T=s.current.insideReactTree;s.current.insideReactTree=!1;const O=y.current;if(y.current=!1,u==="click"&&O||T||typeof C=="function"&&!C(S))return;const b=er(S),L="["+Ur("inert")+"]",F=It(o.floating).querySelectorAll(L);let U=de(b)?b:null;for(;U&&!Wt(U);){const W=Ht(U);if(Wt(W)||!de(W))break;U=W}if(F.length&&de(b)&&!H1(b)&&!Jn(b,o.floating)&&Array.from(F).every(W=>!Jn(U,W)))return;if(Be(b)&&P){const W=Wt(b),K=it(b),G=/auto|scroll/,X=W||G.test(K.overflowX),ee=W||G.test(K.overflowY),le=X&&b.clientWidth>0&&b.scrollWidth>b.clientWidth,xe=ee&&b.clientHeight>0&&b.scrollHeight>b.clientHeight,oe=K.direction==="rtl",fe=xe&&(oe?S.offsetX<=b.offsetWidth-b.clientWidth:S.offsetX>b.clientWidth),he=le&&S.offsetY>b.clientHeight;if(fe||he)return}const z=(x=s.current.floatingContext)==null?void 0:x.nodeId,V=m&&ps(m.nodesRef.current,z).some(W=>{var K;return ha(S,(K=W.context)==null?void 0:K.elements.floating)});if(ha(S,o.floating)||ha(S,o.domReference)||V)return;const Z=m?ps(m.nodesRef.current,z):[];if(Z.length>0){let W=!0;if(Z.forEach(K=>{var G;if((G=K.context)!=null&&G.open&&!K.context.dataRef.current.__outsidePressBubbles){W=!1;return}}),!W)return}r(!1,S,"outside-press")}),I=Lt(S=>{var x;const T=()=>{var O;A(S),(O=er(S))==null||O.removeEventListener(u,T)};(x=er(S))==null||x.addEventListener(u,T)});_.useEffect(()=>{if(!n||!i)return;s.current.__escapeKeyBubbles=$,s.current.__outsidePressBubbles=B;let S=-1;function x(F){r(!1,F,"ancestor-scroll")}function T(){window.clearTimeout(S),j.current=!0}function O(){S=window.setTimeout(()=>{j.current=!1},Vo()?5:0)}const b=It(o.floating);c&&(b.addEventListener("keydown",k?w:g,k),b.addEventListener("compositionstart",T),b.addEventListener("compositionend",O)),C&&b.addEventListener(u,D?I:A,D);let L=[];return p&&(de(o.domReference)&&(L=pn(o.domReference)),de(o.floating)&&(L=L.concat(pn(o.floating))),!de(o.reference)&&o.reference&&o.reference.contextElement&&(L=L.concat(pn(o.reference.contextElement)))),L=L.filter(F=>{var U;return F!==((U=b.defaultView)==null?void 0:U.visualViewport)}),L.forEach(F=>{F.addEventListener("scroll",x,{passive:!0})}),()=>{c&&(b.removeEventListener("keydown",k?w:g,k),b.removeEventListener("compositionstart",T),b.removeEventListener("compositionend",O)),C&&b.removeEventListener(u,D?I:A,D),L.forEach(F=>{F.removeEventListener("scroll",x)}),window.clearTimeout(S)}},[s,o,c,C,u,n,r,p,i,$,B,g,k,w,A,D,I]),_.useEffect(()=>{s.current.insideReactTree=!1},[s,C,u]);const N=_.useMemo(()=>({onKeyDown:g,...l&&{[mw[f]]:S=>{r(!1,S.nativeEvent,"reference-press")},...f!=="click"&&{onClick(S){r(!1,S.nativeEvent,"reference-press")}}}}),[g,r,l,f]),P=_.useMemo(()=>({onKeyDown:g,onMouseDown(){y.current=!0},onMouseUp(){y.current=!0},[gw[u]]:()=>{s.current.insideReactTree=!0}}),[g,u,s]);return _.useMemo(()=>i?{reference:N,floating:P}:{},[i,N,P])}function yw(e){const{open:t=!1,onOpenChange:n,elements:r}=e,o=ga(),s=_.useRef({}),[i]=_.useState(()=>iw()),c=ya()!=null;if(process.env.NODE_ENV!=="production"){const d=r.reference;d&&!de(d)&&sw("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]=_.useState(r.reference),l=Lt((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=_.useMemo(()=>({setPositionReference:u}),[]),p=_.useMemo(()=>({reference:a||r.reference||null,floating:r.floating||null,domReference:r.reference}),[a,r.reference,r.floating]);return _.useMemo(()=>({dataRef:s,open:t,onOpenChange:l,elements:p,events:i,floatingId:o,refs:f}),[t,l,p,i,o,f])}function vw(e){e===void 0&&(e={});const{nodeId:t}=e,n=yw({...e,elements:{reference:null,floating:null,...e.elements}}),r=e.rootContext||n,o=r.elements,[s,i]=_.useState(null),[c,a]=_.useState(null),l=(o==null?void 0:o.domReference)||s,f=_.useRef(null),p=va();Mt(()=>{l&&(f.current=l)},[l]);const d=Hl({...e,elements:{...o,...c&&{reference:c}}}),h=_.useCallback($=>{const B=de($)?{getBoundingClientRect:()=>$.getBoundingClientRect(),getClientRects:()=>$.getClientRects(),contextElement:$}:$;a(B),d.refs.setReference(B)},[d.refs]),m=_.useCallback($=>{(de($)||$===null)&&(f.current=$,i($)),(de(d.refs.reference.current)||d.refs.reference.current===null||$!==null&&!de($))&&d.refs.setReference($)},[d.refs]),v=_.useMemo(()=>({...d.refs,setReference:m,setPositionReference:h,domReference:f}),[d.refs,m,h]),C=_.useMemo(()=>({...d.elements,domReference:l}),[d.elements,l]),y=_.useMemo(()=>({...d,...r,refs:v,elements:C,nodeId:t}),[d,v,C,t,r]);return Mt(()=>{r.dataRef.current.floatingContext=y;const $=p==null?void 0:p.nodesRef.current.find(B=>B.id===t);$&&($.context=y)}),_.useMemo(()=>({...d,context:y,refs:v,elements:C}),[d,v,C,y])}function Ea(){return U1()&&Wf()}function ww(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=_.useRef(!1),l=_.useRef(-1),f=_.useRef(!0);_.useEffect(()=>{if(!c)return;const d=_e(i.domReference);function h(){!n&&Be(i.domReference)&&i.domReference===pa(It(i.domReference))&&(u.current=!0)}function m(){f.current=!0}function v(){f.current=!1}return d.addEventListener("blur",h),Ea()&&(d.addEventListener("keydown",m,!0),d.addEventListener("pointerdown",v,!0)),()=>{d.removeEventListener("blur",h),Ea()&&(d.removeEventListener("keydown",m,!0),d.removeEventListener("pointerdown",v,!0))}},[i.domReference,n,c]),_.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]),_.useEffect(()=>()=>{at(l)},[]);const p=_.useMemo(()=>({onMouseLeave(){u.current=!1},onFocus(d){if(u.current)return;const h=er(d.nativeEvent);if(a&&de(h)){if(Ea()&&!d.relatedTarget){if(!f.current&&!Vf(h))return}else if(!V1(h))return}r(!0,d.nativeEvent,"focus")},onBlur(d){u.current=!1;const h=d.relatedTarget,m=d.nativeEvent,v=de(h)&&h.hasAttribute(Ur("focus-guard"))&&h.getAttribute("data-type")==="outside";l.current=window.setTimeout(()=>{var C;const y=pa(i.domReference?i.domReference.ownerDocument:document);!h&&y===i.domReference||Jn((C=s.current.floatingContext)==null?void 0:C.refs.floating.current,y)||Jn(i.domReference,y)||v||r(!1,m,"focus")})}}),[s,i.domReference,r,a]);return _.useMemo(()=>c?{reference:p}:{},[c,p])}function Sa(e,t,n){const r=new Map,o=n==="item";let s=e;if(o&&e){const{[Kf]:i,[Yf]:c,...a}=e;s=a}return{...n==="floating"&&{tabIndex:-1,[tw]:""},...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&&[Kf,Yf].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 xw(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=_.useCallback(c=>Sa(c,e,"reference"),t),s=_.useCallback(c=>Sa(c,e,"floating"),n),i=_.useCallback(c=>Sa(c,e,"item"),r);return _.useMemo(()=>({getReferenceProps:o,getFloatingProps:s,getItemProps:i}),[o,s,i])}const Ew=new Map([["select","listbox"],["combobox","listbox"],["label",!1]]);function Sw(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=ga(),l=((n=s.domReference)==null?void 0:n.id)||u,f=_.useMemo(()=>{var y;return((y=G1(s.floating))==null?void 0:y.id)||i},[s.floating,i]),p=(r=Ew.get(a))!=null?r:a,h=ya()!=null,m=_.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=_.useMemo(()=>{const y={id:f,...p&&{role:p}};return p==="tooltip"||a==="label"?y:{...y,...p==="menu"&&{"aria-labelledby":l}}},[p,f,l,a]),C=_.useCallback(y=>{let{active:$,selected:B}=y;const k={role:"option",...$&&{id:f+"-fui-option"}};switch(a){case"select":case"combobox":return{...k,"aria-selected":B}}return{}},[f,a]);return _.useMemo(()=>c?{reference:m,floating:v,item:C}:{},[c,m,v,C])}const ad=E.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 M.jsx("div",{ref:n,className:`absolute w-0 h-0 ${t}`,style:o})});ad.displayName="TooltipArrow";const zr=({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]=E.useState(!1),f=E.useRef(null),{refs:p,floatingStyles:d,context:h}=vw({open:u&&!i,onOpenChange:l,placement:n,whileElementsMounted:_l,middleware:[Vi(o?12:8),Gl({fallbackAxisSideDirection:"start",padding:8}),Vl({padding:8}),...o?[jy({element:f})]:[]]}),m=uw(h,{enabled:a.includes("hover"),delay:{open:r,close:150}}),v=ww(h,{enabled:a.includes("focus")}),C=hw(h,{enabled:a.includes("click")}),y=bw(h),$=Sw(h,{role:"tooltip"}),{getReferenceProps:B,getFloatingProps:k}=xw([m,v,C,y,$]);return i?M.jsx(M.Fragment,{children:e}):M.jsxs(M.Fragment,{children:[M.jsx("div",{ref:p.setReference,...B(),children:e}),u&&M.jsx(fw,{children:M.jsxs("div",{ref:p.setFloating,...k(),style:d,className:`
101
+ */var k1={L:Xn.QrCode.Ecc.LOW,M:Xn.QrCode.Ecc.MEDIUM,Q:Xn.QrCode.Ecc.QUARTILE,H:Xn.QrCode.Ecc.HIGH},Mf=128,kf="L",Lf="#FFFFFF",Bf="#000000",Rf=!1,Df=1,L1=4,B1=0,R1=.1;function Ff(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 jf(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 D1(e,t,n,r){if(r==null)return null;const o=e.length+n*2,s=Math.floor(t*R1),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),y=Math.ceil(c+u-h),A=Math.ceil(a+l-m);p={x:h,y:m,w:y,h:A}}const d=r.crossOrigin;return{x:u,y:l,h:a,w:c,excavation:p,opacity:f,crossOrigin:d}}function F1(e,t){return t!=null?Math.max(Math.floor(t),0):e?L1:B1}function _f({value:e,level:t,minVersion:n,includeMargin:r,marginSize:o,imageSettings:s,size:i,boostLevel:c}){let a=E.useMemo(()=>{const h=(Array.isArray(e)?e:[e]).reduce((m,y)=>(m.push(...Xn.QrSegment.makeSegments(y)),m),[]);return Xn.QrCode.encodeSegments(h,k1[t],n,void 0,void 0,c)},[e,t,n,c]);const{cells:u,margin:l,numCells:f,calculatedImageSettings:p}=E.useMemo(()=>{let d=a.getModules();const h=F1(r,o),m=d.length+h*2,y=D1(d,i,h,s);return{cells:d,margin:h,numCells:m,calculatedImageSettings:y}},[a,i,s,r,o]);return{qrcode:a,margin:l,cells:u,numCells:f,calculatedImageSettings:p}}var j1=function(){try{new Path2D().addPath(new Path2D)}catch{return!1}return!0}(),_1=E.forwardRef(function(t,n){const r=t,{value:o,size:s=Mf,level:i=kf,bgColor:c=Lf,fgColor:a=Bf,includeMargin:u=Rf,minVersion:l=Df,boostLevel:f,marginSize:p,imageSettings:d}=r,m=da(r,["value","size","level","bgColor","fgColor","includeMargin","minVersion","boostLevel","marginSize","imageSettings"]),{style:y}=m,A=da(m,["style"]),g=d==null?void 0:d.src,P=E.useRef(null),k=E.useRef(null),B=E.useCallback(S=>{P.current=S,typeof n=="function"?n(S):n&&(n.current=S)},[n]),[F,j]=E.useState(!1),{margin:b,cells:w,numCells:T,calculatedImageSettings:N}=_f({value:o,level:i,minVersion:l,boostLevel:f,includeMargin:u,marginSize:p,imageSettings:d,size:s});E.useEffect(()=>{if(P.current!=null){const S=P.current,x=S.getContext("2d");if(!x)return;let C=w;const O=k.current,v=N!=null&&O!==null&&O.complete&&O.naturalHeight!==0&&O.naturalWidth!==0;v&&N.excavation!=null&&(C=jf(w,N.excavation));const M=window.devicePixelRatio||1;S.height=S.width=s*M;const D=s/T*M;x.scale(D,D),x.fillStyle=c,x.fillRect(0,0,T,T),x.fillStyle=a,j1?x.fill(new Path2D(Ff(C,b))):w.forEach(function(_,z){_.forEach(function(V,Z){V&&x.fillRect(Z+b,z+b,1,1)})}),N&&(x.globalAlpha=N.opacity),v&&x.drawImage(O,N.x+b,N.y+b,N.w,N.h)}}),E.useEffect(()=>{j(!1)},[g]);const I=fa({height:s,width:s},y);let $=null;return g!=null&&($=E.createElement("img",{src:g,key:g,style:{display:"none"},onLoad:()=>{j(!0)},ref:k,crossOrigin:N==null?void 0:N.crossOrigin})),E.createElement(E.Fragment,null,E.createElement("canvas",fa({style:I,height:s,width:s,ref:B,role:"img"},A)),$)});_1.displayName="QRCodeCanvas";var Uf=E.forwardRef(function(t,n){const r=t,{value:o,size:s=Mf,level:i=kf,bgColor:c=Lf,fgColor:a=Bf,includeMargin:u=Rf,minVersion:l=Df,boostLevel:f,title:p,marginSize:d,imageSettings:h}=r,m=da(r,["value","size","level","bgColor","fgColor","includeMargin","minVersion","boostLevel","title","marginSize","imageSettings"]),{margin:y,cells:A,numCells:g,calculatedImageSettings:P}=_f({value:o,level:i,minVersion:l,boostLevel:f,includeMargin:u,marginSize:d,imageSettings:h,size:s});let k=A,B=null;h!=null&&P!=null&&(P.excavation!=null&&(k=jf(A,P.excavation)),B=E.createElement("image",{href:h.src,height:P.h,width:P.w,x:P.x+y,y:P.y+y,preserveAspectRatio:"none",opacity:P.opacity,crossOrigin:P.crossOrigin}));const F=Ff(k,y);return E.createElement("svg",fa({height:s,width:s,viewBox:`0 0 ${g} ${g}`,ref:n,role:"img"},m),!!p&&E.createElement("title",null,p),E.createElement("path",{fill:c,d:`M0,0 h${g}v${g}H0z`,shapeRendering:"crispEdges"}),E.createElement("path",{fill:a,d:F,shapeRendering:"crispEdges"}),B)});Uf.displayName="QRCodeSVG";function U1(){const e=navigator.userAgentData;return e!=null&&e.platform?e.platform:navigator.platform}function z1(){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 zf(){return/apple/i.test(navigator.vendor)}function W1(){return U1().toLowerCase().startsWith("mac")&&!navigator.maxTouchPoints}function H1(){return z1().includes("jsdom/")}const Wf="data-floating-ui-focusable",V1="input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])";function pa(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 Qn(e,t){if(!e||!t)return!1;const n=t.getRootNode==null?void 0:t.getRootNode();if(e.contains(t))return!0;if(n&&ki(n)){let r=t;for(;r;){if(e===r)return!0;r=r.parentNode||r.host}}return!1}function Jn(e){return"composedPath"in e?e.composedPath()[0]:e.target}function ha(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 G1(e){return e.matches("html,body")}function kt(e){return(e==null?void 0:e.ownerDocument)||document}function Hf(e){return Le(e)&&e.matches(V1)}function q1(e){if(!e||H1())return!0;try{return e.matches(":focus-visible")}catch{return!0}}function Z1(e){return e?e.hasAttribute(Wf)?e:e.querySelector("["+Wf+"]")||e:null}function hs(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,...hs(e,o.id,n)])}function K1(e){return"nativeEvent"in e}function Ur(e,t){const n=["mouse","pen"];return t||n.push("",void 0),n.includes(e)}var Y1=typeof document<"u",X1=function(){},Lt=Y1?E.useLayoutEffect:X1;const Q1={...U};function ms(e){const t=U.useRef(e);return Lt(()=>{t.current=e}),t}const J1=Q1.useInsertionEffect||(e=>e());function Bt(e){const t=U.useRef(()=>{if(process.env.NODE_ENV!=="production")throw new Error("Cannot call an event handler while rendering.")});return J1(()=>{t.current=e}),U.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 Vf=()=>({getShadowRoot:!0,displayCheck:typeof ResizeObserver=="function"&&ResizeObserver.toString().includes("[native code]")?"full":"none"});function Gf(e,t){const n=Ol(e,Vf()),r=n.length;if(r===0)return;const o=pa(kt(e)),s=n.indexOf(o),i=s===-1?t===1?0:r-1:s+t;return n[i]}function ew(e){return Gf(kt(e).body,1)||e}function tw(e){return Gf(kt(e).body,-1)||e}function ma(e,t){const n=t||e.currentTarget,r=e.relatedTarget;return!r||!Qn(n,r)}function nw(e){Ol(e,Vf()).forEach(n=>{n.dataset.tabindex=n.getAttribute("tabindex")||"",n.setAttribute("tabindex","-1")})}function qf(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 rw="data-floating-ui-focusable",Zf="active",Kf="selected",ow={...U};let Yf=!1,sw=0;const Xf=()=>"floating-ui-"+Math.random().toString(36).slice(2,6)+sw++;function iw(){const[e,t]=U.useState(()=>Yf?Xf():void 0);return Lt(()=>{e==null&&t(Xf())},[]),U.useEffect(()=>{Yf=!0},[]),e}const ga=ow.useId||iw;let ba;process.env.NODE_ENV!=="production"&&(ba=new Set);function aw(){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=ba)!=null&&e.has(o))){var s;(s=ba)==null||s.add(o),console.error(o)}}function cw(){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 uw=U.createContext(null),lw=U.createContext(null),ya=()=>{var e;return((e=U.useContext(uw))==null?void 0:e.id)||null},va=()=>U.useContext(lw);function zr(e){return"data-floating-ui-"+e}function at(e){e.current!==-1&&(clearTimeout(e.current),e.current=-1)}const Qf=zr("safe-polygon");function wa(e,t,n){if(n&&!Ur(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 xa(e){return typeof e=="function"?e():e}function fw(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=va(),h=ya(),m=ms(u),y=ms(a),A=ms(n),g=ms(f),P=U.useRef(),k=U.useRef(-1),B=U.useRef(),F=U.useRef(-1),j=U.useRef(!0),b=U.useRef(!1),w=U.useRef(()=>{}),T=U.useRef(!1),N=Bt(()=>{var O;const v=(O=o.current.openEvent)==null?void 0:O.type;return(v==null?void 0:v.includes("mouse"))&&v!=="mousedown"});U.useEffect(()=>{if(!c)return;function O(v){let{open:M}=v;M||(at(k),at(F),j.current=!0,T.current=!1)}return s.on("openchange",O),()=>{s.off("openchange",O)}},[c,s]),U.useEffect(()=>{if(!c||!m.current||!n)return;function O(M){N()&&r(!1,M,"hover")}const v=kt(i.floating).documentElement;return v.addEventListener("mouseleave",O),()=>{v.removeEventListener("mouseleave",O)}},[i.floating,n,r,c,m,N]);const I=U.useCallback(function(O,v,M){v===void 0&&(v=!0),M===void 0&&(M="hover");const D=wa(y.current,"close",P.current);D&&!B.current?(at(k),k.current=window.setTimeout(()=>r(!1,O,M),D)):v&&(at(k),r(!1,O,M))},[y,r]),$=Bt(()=>{w.current(),B.current=void 0}),S=Bt(()=>{if(b.current){const O=kt(i.floating).body;O.style.pointerEvents="",O.removeAttribute(Qf),b.current=!1}}),x=Bt(()=>o.current.openEvent?["click","mousedown"].includes(o.current.openEvent.type):!1);U.useEffect(()=>{if(!c)return;function O(z){if(at(k),j.current=!1,l&&!Ur(P.current)||xa(g.current)>0&&!wa(y.current,"open"))return;const V=wa(y.current,"open",P.current);V?k.current=window.setTimeout(()=>{A.current||r(!0,z,"hover")},V):n||r(!0,z,"hover")}function v(z){if(x()){S();return}w.current();const V=kt(i.floating);if(at(F),T.current=!1,m.current&&o.current.floatingContext){n||at(k),B.current=m.current({...o.current.floatingContext,tree:d,x:z.clientX,y:z.clientY,onClose(){S(),$(),x()||I(z,!0,"safe-polygon")}});const W=B.current;V.addEventListener("mousemove",W),w.current=()=>{V.removeEventListener("mousemove",W)};return}(P.current==="touch"?!Qn(i.floating,z.relatedTarget):!0)&&I(z)}function M(z){x()||o.current.floatingContext&&(m.current==null||m.current({...o.current.floatingContext,tree:d,x:z.clientX,y:z.clientY,onClose(){S(),$(),x()||I(z)}})(z))}function D(){at(k)}function _(z){x()||I(z,!1)}if(de(i.domReference)){const z=i.domReference,V=i.floating;return n&&z.addEventListener("mouseleave",M),p&&z.addEventListener("mousemove",O,{once:!0}),z.addEventListener("mouseenter",O),z.addEventListener("mouseleave",v),V&&(V.addEventListener("mouseleave",M),V.addEventListener("mouseenter",D),V.addEventListener("mouseleave",_)),()=>{n&&z.removeEventListener("mouseleave",M),p&&z.removeEventListener("mousemove",O),z.removeEventListener("mouseenter",O),z.removeEventListener("mouseleave",v),V&&(V.removeEventListener("mouseleave",M),V.removeEventListener("mouseenter",D),V.removeEventListener("mouseleave",_))}}},[i,c,e,l,p,I,$,S,r,n,A,d,y,m,o,x,g]),Lt(()=>{var O;if(c&&n&&(O=m.current)!=null&&(O=O.__options)!=null&&O.blockPointerEvents&&N()){b.current=!0;const M=i.floating;if(de(i.domReference)&&M){var v;const D=kt(i.floating).body;D.setAttribute(Qf,"");const _=i.domReference,z=d==null||(v=d.nodesRef.current.find(V=>V.id===h))==null||(v=v.context)==null?void 0:v.elements.floating;return z&&(z.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,N]),Lt(()=>{n||(P.current=void 0,T.current=!1,$(),S())},[n,$,S]),U.useEffect(()=>()=>{$(),at(k),at(F),S()},[c,i.domReference,$,S]);const C=U.useMemo(()=>{function O(v){P.current=v.pointerType}return{onPointerDown:O,onPointerEnter:O,onMouseMove(v){const{nativeEvent:M}=v;function D(){!j.current&&!A.current&&r(!0,M,"hover")}l&&!Ur(P.current)||n||xa(g.current)===0||T.current&&v.movementX**2+v.movementY**2<2||(at(F),P.current==="touch"?D():(T.current=!0,F.current=window.setTimeout(D,xa(g.current))))}}},[l,r,n,A,g]);return U.useMemo(()=>c?{reference:C}:{},[c,C])}const Jf={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},ed=U.forwardRef(function(t,n){const[r,o]=U.useState();Lt(()=>{zf()&&o("button")},[]);const s={ref:n,tabIndex:0,role:r,"aria-hidden":r?void 0:!0,[zr("focus-guard")]:"",style:Jf};return L.jsx("span",{...t,...s})}),td=U.createContext(null),nd=zr("portal");function dw(e){e===void 0&&(e={});const{id:t,root:n}=e,r=ga(),o=hw(),[s,i]=U.useState(null),c=U.useRef(null);return Lt(()=>()=>{s==null||s.remove(),queueMicrotask(()=>{c.current=null})},[s]),Lt(()=>{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(nd,""),a.appendChild(u),c.current=u,i(u)},[t,r]),Lt(()=>{if(n===null||!r||c.current)return;let a=n||(o==null?void 0:o.portalNode);a&&!Mi(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(nd,""),a=u||a,a.appendChild(l),c.current=l,i(l)},[t,n,r,o]),s}function pw(e){const{children:t,id:n,root:r,preserveTabOrder:o=!0}=e,s=dw({id:n,root:r}),[i,c]=U.useState(null),a=U.useRef(null),u=U.useRef(null),l=U.useRef(null),f=U.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 U.useEffect(()=>{if(!s||!o||p)return;function m(y){s&&ma(y)&&(y.type==="focusin"?qf:nw)(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]),U.useEffect(()=>{s&&(d||qf(s))},[d,s]),L.jsxs(td.Provider,{value:U.useMemo(()=>({preserveTabOrder:o,beforeOutsideRef:a,afterOutsideRef:u,beforeInsideRef:l,afterInsideRef:f,portalNode:s,setFocusManagerState:c}),[o,s]),children:[h&&s&&L.jsx(ed,{"data-type":"outside",ref:a,onFocus:m=>{if(ma(m,s)){var y;(y=l.current)==null||y.focus()}else{const A=i?i.domReference:null,g=tw(A);g==null||g.focus()}}}),h&&s&&L.jsx("span",{"aria-owns":s.id,style:Jf}),s&&Tr.createPortal(t,s),h&&s&&L.jsx(ed,{"data-type":"outside",ref:u,onFocus:m=>{if(ma(m,s)){var y;(y=f.current)==null||y.focus()}else{const A=i?i.domReference:null,g=ew(A);g==null||g.focus(),i!=null&&i.closeOnFocusOut&&(i==null||i.onOpenChange(!1,m.nativeEvent,"focus-out"))}}})]})}const hw=()=>U.useContext(td);function rd(e){return Le(e.target)&&e.target.tagName==="BUTTON"}function mw(e){return Le(e.target)&&e.target.tagName==="A"}function od(e){return Hf(e)}function gw(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=U.useRef(),d=U.useRef(!1),h=U.useMemo(()=>({onPointerDown(m){p.current=m.pointerType},onMouseDown(m){const y=p.current;m.button===0&&c!=="click"&&(Ur(y,!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 y=p.current;if(c==="mousedown"&&p.current){p.current=void 0;return}Ur(y,!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||rd(m))&&(m.key===" "&&!od(s)&&(m.preventDefault(),d.current=!0),!mw(m)&&m.key==="Enter"&&r(!(n&&a),m.nativeEvent,"click"))},onKeyUp(m){m.defaultPrevented||!l||rd(m)||od(s)||m.key===" "&&d.current&&(d.current=!1,r(!(n&&a),m.nativeEvent,"click"))}}),[o,s,c,u,l,r,n,f,a]);return U.useMemo(()=>i?{reference:h}:{},[i,h])}const bw={pointerdown:"onPointerDown",mousedown:"onMouseDown",click:"onClick"},yw={pointerdown:"onPointerDownCapture",mousedown:"onMouseDownCapture",click:"onClickCapture"},sd=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 vw(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=va(),y=Bt(typeof a=="function"?a:()=>!1),A=typeof a=="function"?y:a,g=U.useRef(!1),{escapeKey:P,outsidePress:k}=sd(d),{escapeKey:B,outsidePress:F}=sd(h),j=U.useRef(!1),b=Bt(S=>{var x;if(!n||!i||!c||S.key!=="Escape"||j.current)return;const C=(x=s.current.floatingContext)==null?void 0:x.nodeId,O=m?hs(m.nodesRef.current,C):[];if(!P&&(S.stopPropagation(),O.length>0)){let v=!0;if(O.forEach(M=>{var D;if((D=M.context)!=null&&D.open&&!M.context.dataRef.current.__escapeKeyBubbles){v=!1;return}}),!v)return}r(!1,K1(S)?S.nativeEvent:S,"escape-key")}),w=Bt(S=>{var x;const C=()=>{var O;b(S),(O=Jn(S))==null||O.removeEventListener("keydown",C)};(x=Jn(S))==null||x.addEventListener("keydown",C)}),T=Bt(S=>{var x;const C=s.current.insideReactTree;s.current.insideReactTree=!1;const O=g.current;if(g.current=!1,u==="click"&&O||C||typeof A=="function"&&!A(S))return;const v=Jn(S),M="["+zr("inert")+"]",D=kt(o.floating).querySelectorAll(M);let _=de(v)?v:null;for(;_&&!Vt(_);){const W=Gt(_);if(Vt(W)||!de(W))break;_=W}if(D.length&&de(v)&&!G1(v)&&!Qn(v,o.floating)&&Array.from(D).every(W=>!Qn(_,W)))return;if(Le(v)&&$){const W=Vt(v),K=it(v),G=/auto|scroll/,X=W||G.test(K.overflowX),ee=W||G.test(K.overflowY),le=X&&v.clientWidth>0&&v.scrollWidth>v.clientWidth,xe=ee&&v.clientHeight>0&&v.scrollHeight>v.clientHeight,oe=K.direction==="rtl",fe=xe&&(oe?S.offsetX<=v.offsetWidth-v.clientWidth:S.offsetX>v.clientWidth),he=le&&S.offsetY>v.clientHeight;if(fe||he)return}const z=(x=s.current.floatingContext)==null?void 0:x.nodeId,V=m&&hs(m.nodesRef.current,z).some(W=>{var K;return ha(S,(K=W.context)==null?void 0:K.elements.floating)});if(ha(S,o.floating)||ha(S,o.domReference)||V)return;const Z=m?hs(m.nodesRef.current,z):[];if(Z.length>0){let W=!0;if(Z.forEach(K=>{var G;if((G=K.context)!=null&&G.open&&!K.context.dataRef.current.__outsidePressBubbles){W=!1;return}}),!W)return}r(!1,S,"outside-press")}),N=Bt(S=>{var x;const C=()=>{var O;T(S),(O=Jn(S))==null||O.removeEventListener(u,C)};(x=Jn(S))==null||x.addEventListener(u,C)});U.useEffect(()=>{if(!n||!i)return;s.current.__escapeKeyBubbles=P,s.current.__outsidePressBubbles=k;let S=-1;function x(D){r(!1,D,"ancestor-scroll")}function C(){window.clearTimeout(S),j.current=!0}function O(){S=window.setTimeout(()=>{j.current=!1},Vo()?5:0)}const v=kt(o.floating);c&&(v.addEventListener("keydown",B?w:b,B),v.addEventListener("compositionstart",C),v.addEventListener("compositionend",O)),A&&v.addEventListener(u,F?N:T,F);let M=[];return p&&(de(o.domReference)&&(M=pn(o.domReference)),de(o.floating)&&(M=M.concat(pn(o.floating))),!de(o.reference)&&o.reference&&o.reference.contextElement&&(M=M.concat(pn(o.reference.contextElement)))),M=M.filter(D=>{var _;return D!==((_=v.defaultView)==null?void 0:_.visualViewport)}),M.forEach(D=>{D.addEventListener("scroll",x,{passive:!0})}),()=>{c&&(v.removeEventListener("keydown",B?w:b,B),v.removeEventListener("compositionstart",C),v.removeEventListener("compositionend",O)),A&&v.removeEventListener(u,F?N:T,F),M.forEach(D=>{D.removeEventListener("scroll",x)}),window.clearTimeout(S)}},[s,o,c,A,u,n,r,p,i,P,k,b,B,w,T,F,N]),U.useEffect(()=>{s.current.insideReactTree=!1},[s,A,u]);const I=U.useMemo(()=>({onKeyDown:b,...l&&{[bw[f]]:S=>{r(!1,S.nativeEvent,"reference-press")},...f!=="click"&&{onClick(S){r(!1,S.nativeEvent,"reference-press")}}}}),[b,r,l,f]),$=U.useMemo(()=>({onKeyDown:b,onMouseDown(){g.current=!0},onMouseUp(){g.current=!0},[yw[u]]:()=>{s.current.insideReactTree=!0}}),[b,u,s]);return U.useMemo(()=>i?{reference:I,floating:$}:{},[i,I,$])}function ww(e){const{open:t=!1,onOpenChange:n,elements:r}=e,o=ga(),s=U.useRef({}),[i]=U.useState(()=>cw()),c=ya()!=null;if(process.env.NODE_ENV!=="production"){const d=r.reference;d&&!de(d)&&aw("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]=U.useState(r.reference),l=Bt((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=U.useMemo(()=>({setPositionReference:u}),[]),p=U.useMemo(()=>({reference:a||r.reference||null,floating:r.floating||null,domReference:r.reference}),[a,r.reference,r.floating]);return U.useMemo(()=>({dataRef:s,open:t,onOpenChange:l,elements:p,events:i,floatingId:o,refs:f}),[t,l,p,i,o,f])}function xw(e){e===void 0&&(e={});const{nodeId:t}=e,n=ww({...e,elements:{reference:null,floating:null,...e.elements}}),r=e.rootContext||n,o=r.elements,[s,i]=U.useState(null),[c,a]=U.useState(null),l=(o==null?void 0:o.domReference)||s,f=U.useRef(null),p=va();Lt(()=>{l&&(f.current=l)},[l]);const d=Hl({...e,elements:{...o,...c&&{reference:c}}}),h=U.useCallback(P=>{const k=de(P)?{getBoundingClientRect:()=>P.getBoundingClientRect(),getClientRects:()=>P.getClientRects(),contextElement:P}:P;a(k),d.refs.setReference(k)},[d.refs]),m=U.useCallback(P=>{(de(P)||P===null)&&(f.current=P,i(P)),(de(d.refs.reference.current)||d.refs.reference.current===null||P!==null&&!de(P))&&d.refs.setReference(P)},[d.refs]),y=U.useMemo(()=>({...d.refs,setReference:m,setPositionReference:h,domReference:f}),[d.refs,m,h]),A=U.useMemo(()=>({...d.elements,domReference:l}),[d.elements,l]),g=U.useMemo(()=>({...d,...r,refs:y,elements:A,nodeId:t}),[d,y,A,t,r]);return Lt(()=>{r.dataRef.current.floatingContext=g;const P=p==null?void 0:p.nodesRef.current.find(k=>k.id===t);P&&(P.context=g)}),U.useMemo(()=>({...d,context:g,refs:y,elements:A}),[d,y,A,g])}function Ea(){return W1()&&zf()}function Ew(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=U.useRef(!1),l=U.useRef(-1),f=U.useRef(!0);U.useEffect(()=>{if(!c)return;const d=_e(i.domReference);function h(){!n&&Le(i.domReference)&&i.domReference===pa(kt(i.domReference))&&(u.current=!0)}function m(){f.current=!0}function y(){f.current=!1}return d.addEventListener("blur",h),Ea()&&(d.addEventListener("keydown",m,!0),d.addEventListener("pointerdown",y,!0)),()=>{d.removeEventListener("blur",h),Ea()&&(d.removeEventListener("keydown",m,!0),d.removeEventListener("pointerdown",y,!0))}},[i.domReference,n,c]),U.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]),U.useEffect(()=>()=>{at(l)},[]);const p=U.useMemo(()=>({onMouseLeave(){u.current=!1},onFocus(d){if(u.current)return;const h=Jn(d.nativeEvent);if(a&&de(h)){if(Ea()&&!d.relatedTarget){if(!f.current&&!Hf(h))return}else if(!q1(h))return}r(!0,d.nativeEvent,"focus")},onBlur(d){u.current=!1;const h=d.relatedTarget,m=d.nativeEvent,y=de(h)&&h.hasAttribute(zr("focus-guard"))&&h.getAttribute("data-type")==="outside";l.current=window.setTimeout(()=>{var A;const g=pa(i.domReference?i.domReference.ownerDocument:document);!h&&g===i.domReference||Qn((A=s.current.floatingContext)==null?void 0:A.refs.floating.current,g)||Qn(i.domReference,g)||y||r(!1,m,"focus")})}}),[s,i.domReference,r,a]);return U.useMemo(()=>c?{reference:p}:{},[c,p])}function Sa(e,t,n){const r=new Map,o=n==="item";let s=e;if(o&&e){const{[Zf]:i,[Kf]:c,...a}=e;s=a}return{...n==="floating"&&{tabIndex:-1,[rw]:""},...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&&[Zf,Kf].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(y=>y(...h)).find(y=>y!==void 0)}}}else i[u]=l}),i),{})}}function Sw(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=U.useCallback(c=>Sa(c,e,"reference"),t),s=U.useCallback(c=>Sa(c,e,"floating"),n),i=U.useCallback(c=>Sa(c,e,"item"),r);return U.useMemo(()=>({getReferenceProps:o,getFloatingProps:s,getItemProps:i}),[o,s,i])}const Pw=new Map([["select","listbox"],["combobox","listbox"],["label",!1]]);function $w(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=ga(),l=((n=s.domReference)==null?void 0:n.id)||u,f=U.useMemo(()=>{var g;return((g=Z1(s.floating))==null?void 0:g.id)||i},[s.floating,i]),p=(r=Pw.get(a))!=null?r:a,h=ya()!=null,m=U.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]),y=U.useMemo(()=>{const g={id:f,...p&&{role:p}};return p==="tooltip"||a==="label"?g:{...g,...p==="menu"&&{"aria-labelledby":l}}},[p,f,l,a]),A=U.useCallback(g=>{let{active:P,selected:k}=g;const B={role:"option",...P&&{id:f+"-fui-option"}};switch(a){case"select":case"combobox":return{...B,"aria-selected":k}}return{}},[f,a]);return U.useMemo(()=>c?{reference:m,floating:y,item:A}:{},[c,m,y,A])}const id=E.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 L.jsx("div",{ref:n,className:`absolute w-0 h-0 ${t}`,style:o})});id.displayName="TooltipArrow";const er=({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]=E.useState(!1),f=E.useRef(null),{refs:p,floatingStyles:d,context:h}=xw({open:u&&!i,onOpenChange:l,placement:n,whileElementsMounted:_l,middleware:[Vi(o?12:8),Gl({fallbackAxisSideDirection:"start",padding:8}),Vl({padding:8}),...o?[Fy({element:f})]:[]]}),m=fw(h,{enabled:a.includes("hover"),delay:{open:r,close:150}}),y=Ew(h,{enabled:a.includes("focus")}),A=gw(h,{enabled:a.includes("click")}),g=vw(h),P=$w(h,{role:"tooltip"}),{getReferenceProps:k,getFloatingProps:B}=Sw([m,y,A,g,P]);return i?L.jsx(L.Fragment,{children:e}):L.jsxs(L.Fragment,{children:[L.jsx("div",{ref:p.setReference,...k(),children:e}),u&&L.jsx(pw,{children:L.jsxs("div",{ref:p.setFloating,...B(),style:d,className:`
112
102
  z-50 px-3 py-2
113
103
  bg-fill-page-secondary
114
104
  text-text-primary text-sm font-medium
@@ -116,47 +106,47 @@ React keys must be passed directly to JSX without using spread:
116
106
  relative
117
107
  ${c}
118
108
  ${s}
119
- `,children:[t,o&&M.jsx(ad,{ref:f,placement:h.placement||n})]})})]})},ms="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=",Pw=({walletAdapter:e,curSelectToken:t,currentActiveChain:n,metadata:r,onCopy:o})=>{var c;const{t:s}=pt(),i=E.useMemo(()=>c1(n||{}),[n]);return M.jsxs(M.Fragment,{children:[M.jsx("div",{className:"flex justify-center mt-4 mb-3",children:(e==null?void 0:e.getDisplayAddress())&&M.jsx("div",{className:"bg-white rounded-lg",children:M.jsx(zf,{value:(e==null?void 0:e.getDisplayAddress())||"",size:120,level:"L",bgColor:"#ffffff",fgColor:"#000000",marginSize:0})})}),(e==null?void 0:e.getDisplayAddress())&&M.jsxs("div",{className:"flex items-center justify-between bg-fill-input-primary rounded-lg py-2 px-3 mb-3",children:[M.jsx("span",{className:"flex-1 text-text-primary text-sm font-medium break-all mr-3",children:e==null?void 0:e.getDisplayAddress()}),M.jsx(O1,{onCopy:()=>{const a=(e==null?void 0:e.getDisplayAddress())||"";o&&o(a)},text:e==null?void 0:e.getDisplayAddress(),children:M.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:[M.jsx("rect",{x:"2.08496",y:"4.02295",width:"9.89893",height:"9.89893",rx:"2",stroke:"#F9F9F9"}),M.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")]}),M.jsxs("div",{className:"border-b border-dashed border-line-divider-secondary pb-4",children:[M.jsxs("div",{className:"flex items-start",children:[M.jsx("div",{className:"w-5",children:M.jsx("img",{src:ms,className:"w-4 h-4",alt:"Warning"})}),M.jsx("div",{className:"flex-1",children:M.jsx("p",{className:"text-xs text-functional-orange-1",children:s("deposit.depositAllTip",{coin:t,v:n==null?void 0:n.chain})})})]}),i&&M.jsxs(M.Fragment,{children:[M.jsx("div",{className:"my-2 ml-5 h-[1px] border-b border-dashed border-line-divider-secondary"}),M.jsx("div",{className:"flex items-start pl-5 text-functional-orange-1 text-xs",children:s("deposit.depositTipFor25w")})]})]}),M.jsxs("div",{className:"text-sm",children:[M.jsxs("div",{className:"flex justify-between items-center h-[18px] mt-4",children:[M.jsx("span",{className:"text-text-tertiary",children:s("deposit.arrivalTime")}),M.jsx(zr,{content:M.jsxs("div",{className:"grid flex-grow max-w-[300px] min-w-[80px] rounded-2xl flex-col gap-[10px]",children:[M.jsx("p",{children:s("deposit.arrivaltimeTooltip1",{v:(n==null?void 0:n.blockTime)*n.txConfirm/60,v1:n==null?void 0:n.txConfirm})}),M.jsx("p",{children:s("deposit.arrivaltimeTooltip2")})]}),placement:"top",children:M.jsx("span",{className:"text-text-primary font-medium text-right border-b-[2px] border-dashed border-line-divider-primary decoration-dashed",children:s("deposit.arrivalEstimated",{v:(n==null?void 0:n.blockTime)*n.txConfirm/60})})})]}),M.jsxs("div",{className:"flex justify-between items-center h-[18px] mt-2",children:[M.jsx("span",{className:"text-text-tertiary",children:s("deposit.minDeposit")}),M.jsxs("span",{className:"text-text-primary font-medium text-right",children:[((c=r==null?void 0:r.multiChain)==null?void 0:c.minDeposit)||10," ",t]})]}),M.jsxs("div",{className:"flex justify-between items-center h-[18px] mt-2",children:[M.jsx("span",{className:"text-text-tertiary",children:s("deposit.maxDeposit")}),M.jsxs("span",{className:"text-text-primary font-medium text-right",children:["200,000 ",t]})]})]})]})},$w=({chains:e,defaultChainId:t,defaultTokenAddress:n,walletAdapter:r,metadata:o,onDeposit:s,onCopy:i,onClose:c})=>{var m;const{t:a}=pt(),[u,l]=E.useState(()=>{var v;return!e||e.length===0?1:t||((v=e[0])==null?void 0:v.chainId)||1}),[f,p]=E.useState(()=>{var $;if(!e||e.length===0)return"";const v=t||(($=e[0])==null?void 0:$.chainId),C=e.find(B=>B.chainId===v);if(!C||!C.tokenList||C.tokenList.length===0)return"";const y=C.tokenList.find(B=>B.tokenAddress===n)||C.tokenList[0];return(y==null?void 0:y.token)||""}),d=e&&e.length>0?e.find(v=>v.chainId===u)||e[0]:null,h=(m=d==null?void 0:d.tokenList)==null?void 0:m.find(v=>v.token===f);return!e||e.length===0?M.jsx("div",{className:"text-center py-8",children:M.jsx("p",{className:"text-gray-400",children:"No chains available"})}):d?M.jsxs(M.Fragment,{children:[M.jsx(na,{currentActiveChain:d,chainList:e,onChainChange:l,curSelectToken:f,onTokenChange:p,walletType:"mpc"}),M.jsx(Pw,{walletAdapter:r,curSelectToken:f,currentActiveChain:d,metadata:o,onCopy:i}),M.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:()=>{s&&s({amount:"",chainId:u,tokenAddress:(h==null?void 0:h.tokenAddress)||"",tokenSymbol:f}),c()},children:a("deposit.title")})]}):M.jsx("div",{className:"text-center py-8",children:M.jsx("p",{className:"text-gray-400",children:"Loading..."})})},Aw="1.0.8";let Ke=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@${Aw}`].join(`
120
- `);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 qt(e,t){const n=e.exec(t);return n==null?void 0:n.groups}const cd=/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/,ud=/^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)?$/,ld=/^\(.+?\).*?$/,fd=/^tuple(?<array>(\[(\d*)\])*)$/;function Pa(e){let t=e.type;if(fd.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+=Pa(s),o<n-1&&(t+=", ")}const r=qt(fd,e.type);return t+=`)${(r==null?void 0:r.array)??""}`,Pa({...e,type:t})}return"indexed"in e&&e.indexed&&(t=`${t} indexed`),e.name?`${t} ${e.name}`:t}function Wr(e){let t="";const n=e.length;for(let r=0;r<n;r++){const o=e[r];t+=Pa(o),r!==n-1&&(t+=", ")}return t}function gs(e){var t;return e.type==="function"?`function ${e.name}(${Wr(e.inputs)})${e.stateMutability&&e.stateMutability!=="nonpayable"?` ${e.stateMutability}`:""}${(t=e.outputs)!=null&&t.length?` returns (${Wr(e.outputs)})`:""}`:e.type==="event"?`event ${e.name}(${Wr(e.inputs)})`:e.type==="error"?`error ${e.name}(${Wr(e.inputs)})`:e.type==="constructor"?`constructor(${Wr(e.inputs)})${e.stateMutability==="payable"?" payable":""}`:e.type==="fallback"?`fallback() external${e.stateMutability==="payable"?" payable":""}`:"receive() external payable"}const dd=/^error (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*)\((?<parameters>.*?)\)$/;function Tw(e){return dd.test(e)}function Cw(e){return qt(dd,e)}const pd=/^event (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*)\((?<parameters>.*?)\)$/;function Ow(e){return pd.test(e)}function Nw(e){return qt(pd,e)}const hd=/^function (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*)\((?<parameters>.*?)\)(?: (?<scope>external|public{1}))?(?: (?<stateMutability>pure|view|nonpayable|payable{1}))?(?: returns\s?\((?<returns>.*?)\))?$/;function Iw(e){return hd.test(e)}function Mw(e){return qt(hd,e)}const md=/^struct (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*) \{(?<properties>.*?)\}$/;function $a(e){return md.test(e)}function Lw(e){return qt(md,e)}const gd=/^constructor\((?<parameters>.*?)\)(?:\s(?<stateMutability>payable{1}))?$/;function Bw(e){return gd.test(e)}function kw(e){return qt(gd,e)}const bd=/^fallback\(\) external(?:\s(?<stateMutability>payable{1}))?$/;function Rw(e){return bd.test(e)}function Fw(e){return qt(bd,e)}const Dw=/^receive\(\) external payable$/;function jw(e){return Dw.test(e)}const _w=new Set(["indexed"]),Aa=new Set(["calldata","memory","storage"]);class Uw extends Ke{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 zw extends Ke{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 Ww extends Ke{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 Hw extends Ke{constructor({param:t}){super("Invalid ABI parameter.",{details:t}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidParameterError"})}}class Vw extends Ke{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 Gw extends Ke{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 qw extends Ke{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 Zw extends Ke{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 tr extends Ke{constructor({signature:t,type:n}){super(`Invalid ${n} signature.`,{details:t}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidSignatureError"})}}class Kw extends Ke{constructor({signature:t}){super("Unknown signature.",{details:t}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"UnknownSignatureError"})}}class Yw extends Ke{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 Xw extends Ke{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 Qw extends Ke{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 Jw(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 Ta=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 Ca(e,t={}){if(Iw(e))return ex(e,t);if(Ow(e))return tx(e,t);if(Tw(e))return nx(e,t);if(Bw(e))return rx(e,t);if(Rw(e))return ox(e);if(jw(e))return{type:"receive",stateMutability:"payable"};throw new Kw({signature:e})}function ex(e,t={}){const n=Mw(e);if(!n)throw new tr({signature:e,type:"function"});const r=bt(n.parameters),o=[],s=r.length;for(let c=0;c<s;c++)o.push(Nn(r[c],{modifiers:Aa,structs:t,type:"function"}));const i=[];if(n.returns){const c=bt(n.returns),a=c.length;for(let u=0;u<a;u++)i.push(Nn(c[u],{modifiers:Aa,structs:t,type:"function"}))}return{name:n.name,type:"function",stateMutability:n.stateMutability??"nonpayable",inputs:o,outputs:i}}function tx(e,t={}){const n=Nw(e);if(!n)throw new tr({signature:e,type:"event"});const r=bt(n.parameters),o=[],s=r.length;for(let i=0;i<s;i++)o.push(Nn(r[i],{modifiers:_w,structs:t,type:"event"}));return{name:n.name,type:"event",inputs:o}}function nx(e,t={}){const n=Cw(e);if(!n)throw new tr({signature:e,type:"error"});const r=bt(n.parameters),o=[],s=r.length;for(let i=0;i<s;i++)o.push(Nn(r[i],{structs:t,type:"error"}));return{name:n.name,type:"error",inputs:o}}function rx(e,t={}){const n=kw(e);if(!n)throw new tr({signature:e,type:"constructor"});const r=bt(n.parameters),o=[],s=r.length;for(let i=0;i<s;i++)o.push(Nn(r[i],{structs:t,type:"constructor"}));return{type:"constructor",stateMutability:n.stateMutability??"nonpayable",inputs:o}}function ox(e){const t=Fw(e);if(!t)throw new tr({signature:e,type:"fallback"});return{type:"fallback",stateMutability:t.stateMutability??"nonpayable"}}const sx=/^(?<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$_]*))?$/,ix=/^\((?<type>.+?)\)(?<array>(?:\[\d*?\])+?)?(?:\s(?<modifier>calldata|indexed|memory|storage{1}))?(?:\s(?<name>[a-zA-Z$_][a-zA-Z0-9$_]*))?$/,ax=/^u?int$/;function Nn(e,t){var f,p;const n=Jw(e,t==null?void 0:t.type,t==null?void 0:t.structs);if(Ta.has(n))return Ta.get(n);const r=ld.test(e),o=qt(r?ix:sx,e);if(!o)throw new Hw({param:e});if(o.name&&ux(o.name))throw new Vw({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=bt(o.type),h=[],m=d.length;for(let v=0;v<m;v++)h.push(Nn(d[v],{structs:c}));u={components:h}}else if(o.type in c)a="tuple",u={components:c[o.type]};else if(ax.test(o.type))a=`${o.type}256`;else if(a=o.type,(t==null?void 0:t.type)!=="struct"&&!yd(a))throw new Ww({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 Gw({param:e,type:t==null?void 0:t.type,modifier:o.modifier});if(Aa.has(o.modifier)&&!lx(a,!!o.array))throw new qw({param:e,type:t==null?void 0:t.type,modifier:o.modifier})}const l={type:`${a}${o.array??""}`,...s,...i,...u};return Ta.set(n,l),l}function bt(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?bt(c,[...t,n.trim()]):bt(c,t,`${n}${i}`,r);case"(":return bt(c,t,`${n}${i}`,r+1);case")":return bt(c,t,`${n}${i}`,r-1);default:return bt(c,t,`${n}${i}`,r)}}if(n==="")return t;if(r!==0)throw new Qw({current:n,depth:r});return t.push(n.trim()),t}function yd(e){return e==="address"||e==="bool"||e==="function"||e==="string"||cd.test(e)||ud.test(e)}const cx=/^(?: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 ux(e){return e==="address"||e==="bool"||e==="function"||e==="string"||e==="tuple"||cd.test(e)||ud.test(e)||cx.test(e)}function lx(e,t){return t||e==="bytes"||e==="string"||e==="tuple"}function vd(e){const t={},n=e.length;for(let i=0;i<n;i++){const c=e[i];if(!$a(c))continue;const a=Lw(c);if(!a)throw new tr({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=Nn(h,{type:"struct"});l.push(m)}if(!l.length)throw new Yw({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]=wd(a,t)}return r}const fx=/^(?<type>[a-zA-Z$_][a-zA-Z0-9$_]*)(?<array>(?:\[\d*?\])+?)?$/;function wd(e,t,n=new Set){const r=[],o=e.length;for(let s=0;s<o;s++){const i=e[s];if(ld.test(i.type))r.push(i);else{const a=qt(fx,i.type);if(!(a!=null&&a.type))throw new Zw({abiParameter:i});const{array:u,type:l}=a;if(l in t){if(n.has(l))throw new Xw({type:l});r.push({...i,type:`tuple${u??""}`,components:wd(t[l]??[],t,new Set([...n,l]))})}else if(yd(l))r.push(i);else throw new zw({type:l})}}return r}function xd(e){const t=vd(e),n=[],r=e.length;for(let o=0;o<r;o++){const s=e[o];$a(s)||n.push(Ca(s,t))}return n}function Ed(e){let t;if(typeof e=="string")t=Ca(e);else{const n=vd(e),r=e.length;for(let o=0;o<r;o++){const s=e[o];if(!$a(s)){t=Ca(s,n);break}}}if(!t)throw new Uw({signature:e});return t}function J(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 yt(e,{includeName:t=!1}={}){if(e.type!=="function"&&e.type!=="event"&&e.type!=="error")throw new Px(e.type);return`${e.name}(${bs(e.inputs,{includeName:t})})`}function bs(e,{includeName:t=!1}={}){return e?e.map(n=>dx(n,{includeName:t})).join(t?", ":","):""}function dx(e,{includeName:t}){return e.type.startsWith("tuple")?`(${bs(e.components,{includeName:t})})${e.type.slice(5)}`:e.type+(t&&e.name?` ${e.name}`:"")}function vt(e,{strict:t=!0}={}){return!e||typeof e!="string"?!1:t?/^0x[0-9a-fA-F]*$/.test(e):e.startsWith("0x")}function we(e){return vt(e,{strict:!1})?Math.ceil((e.length-2)/2):e.length}const Sd="2.34.0";let Hr={getDocsUrl:({docsBaseUrl:e,docsPath:t="",docsSlug:n})=>t?`${e??"https://viem.sh"}${t}${n?`#${n}`:""}`:void 0,version:`viem@${Sd}`},H=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=Hr.getDocsUrl)==null?void 0:c.call(Hr,{...n,docsPath:o}),i=[t||"An error occurred.","",...n.metaMessages?[...n.metaMessages,""]:[],...s?[`Docs: ${s}`]:[],...r?[`Details: ${r}`]:[],...Hr.version?[`Version: ${Hr.version}`]:[]].join(`
121
- `);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=Sd}walk(t){return Pd(this,t)}};function Pd(e,t){return t!=null&&t(e)?e:e&&typeof e=="object"&&"cause"in e&&e.cause!==void 0?Pd(e.cause,t):t?null:e}class px extends H{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(`
122
- `),{docsPath:t,name:"AbiConstructorNotFoundError"})}}class $d extends H{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(`
123
- `),{docsPath:t,name:"AbiConstructorParamsNotFoundError"})}}class Ad extends H{constructor({data:t,params:n,size:r}){super([`Data size of ${r} bytes is too small for given parameters.`].join(`
124
- `),{metaMessages:[`Params: (${bs(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 Vr extends H{constructor(){super('Cannot decode zero data ("0x") with ABI parameters.',{name:"AbiDecodingZeroDataError"})}}class hx extends H{constructor({expectedLength:t,givenLength:n,type:r}){super([`ABI encoding array length mismatch for type ${r}.`,`Expected length: ${t}`,`Given length: ${n}`].join(`
125
- `),{name:"AbiEncodingArrayLengthMismatchError"})}}class mx extends H{constructor({expectedSize:t,value:n}){super(`Size of bytes "${n}" (bytes${we(n)}) does not match expected size (bytes${t}).`,{name:"AbiEncodingBytesSizeMismatchError"})}}class gx extends H{constructor({expectedLength:t,givenLength:n}){super(["ABI encoding params/values length mismatch.",`Expected length (params): ${t}`,`Given length (values): ${n}`].join(`
126
- `),{name:"AbiEncodingLengthMismatchError"})}}class bx extends H{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(`
109
+ `,children:[t,o&&L.jsx(id,{ref:f,placement:h.placement||n})]})})]})},gs="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=",Tw=({walletAdapter:e,curSelectToken:t,currentActiveChain:n,metadata:r,onCopy:o})=>{var c;const{t:s}=Tt(),i=E.useMemo(()=>l1(n||{}),[n]);return L.jsxs(L.Fragment,{children:[L.jsx("div",{className:"flex justify-center mt-4 mb-3",children:(e==null?void 0:e.getDisplayAddress())&&L.jsx("div",{className:"bg-white rounded-lg",children:L.jsx(Uf,{value:(e==null?void 0:e.getDisplayAddress())||"",size:120,level:"L",bgColor:"#ffffff",fgColor:"#000000",marginSize:0})})}),(e==null?void 0:e.getDisplayAddress())&&L.jsxs("div",{className:"flex items-center justify-between bg-fill-input-primary rounded-lg py-2 px-3 mb-3",children:[L.jsx("span",{className:"flex-1 text-text-primary text-sm font-medium break-all mr-3",children:e==null?void 0:e.getDisplayAddress()}),L.jsx(N1,{onCopy:()=>{const a=(e==null?void 0:e.getDisplayAddress())||"";o&&o(a)},text:e==null?void 0:e.getDisplayAddress(),children:L.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:[L.jsx("rect",{x:"2.08496",y:"4.02295",width:"9.89893",height:"9.89893",rx:"2",stroke:"#F9F9F9"}),L.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")]}),L.jsxs("div",{className:"border-b border-dashed border-line-divider-secondary pb-4",children:[L.jsxs("div",{className:"flex items-start",children:[L.jsx("div",{className:"w-5",children:L.jsx("img",{src:gs,className:"w-4 h-4",alt:"Warning"})}),L.jsx("div",{className:"flex-1",children:L.jsx("p",{className:"text-xs text-functional-orange-1",children:s("deposit.depositAllTip",{coin:t,v:n==null?void 0:n.chain})})})]}),i&&L.jsxs(L.Fragment,{children:[L.jsx("div",{className:"my-2 ml-5 h-[1px] border-b border-dashed border-line-divider-secondary"}),L.jsx("div",{className:"flex items-start pl-5 text-functional-orange-1 text-xs",children:s("deposit.depositTipFor25w")})]})]}),L.jsxs("div",{className:"text-sm",children:[L.jsxs("div",{className:"flex justify-between items-center h-[18px] mt-4",children:[L.jsx("span",{className:"text-text-tertiary",children:s("deposit.arrivalTime")}),L.jsx(er,{content:L.jsxs("div",{className:"grid flex-grow max-w-[300px] min-w-[80px] rounded-2xl flex-col gap-[10px]",children:[L.jsx("p",{children:s("deposit.arrivaltimeTooltip1",{v:(n==null?void 0:n.blockTime)*n.txConfirm/60,v1:n==null?void 0:n.txConfirm})}),L.jsx("p",{children:s("deposit.arrivaltimeTooltip2")})]}),placement:"top",children:L.jsx("span",{className:"text-text-primary font-medium text-right border-b-[2px] border-dashed border-line-divider-primary decoration-dashed",children:s("deposit.arrivalEstimated",{v:(n==null?void 0:n.blockTime)*n.txConfirm/60})})})]}),L.jsxs("div",{className:"flex justify-between items-center h-[18px] mt-1",children:[L.jsx("span",{className:"text-text-tertiary",children:s("deposit.minDeposit")}),L.jsxs("span",{className:"text-text-primary font-medium text-right",children:[((c=r==null?void 0:r.multiChain)==null?void 0:c.minDeposit)||10," ",t]})]}),L.jsxs("div",{className:"flex justify-between items-center h-[18px] mt-1",children:[L.jsx("span",{className:"text-text-tertiary",children:s("deposit.maxDeposit")}),L.jsxs("span",{className:"text-text-primary font-medium text-right",children:["200,000 ",t]})]})]})]})},Aw=({chains:e,defaultChainId:t,defaultTokenAddress:n,walletAdapter:r,metadata:o,onDeposit:s,onCopy:i,onClose:c})=>{var m;const{t:a}=Tt(),[u,l]=E.useState(()=>{var y;return!e||e.length===0?1:t||((y=e[0])==null?void 0:y.chainId)||1}),[f,p]=E.useState(()=>{var P;if(!e||e.length===0)return"";const y=t||((P=e[0])==null?void 0:P.chainId),A=e.find(k=>k.chainId===y);if(!A||!A.tokenList||A.tokenList.length===0)return"";const g=A.tokenList.find(k=>k.tokenAddress===n)||A.tokenList[0];return(g==null?void 0:g.token)||""}),d=e&&e.length>0?e.find(y=>y.chainId===u)||e[0]:null,h=(m=d==null?void 0:d.tokenList)==null?void 0:m.find(y=>y.token===f);return!e||e.length===0?L.jsx("div",{className:"text-center py-8",children:L.jsx("p",{className:"text-gray-400",children:"No chains available"})}):d?L.jsxs(L.Fragment,{children:[L.jsx(na,{currentActiveChain:d,chainList:e,onChainChange:l,curSelectToken:f,onTokenChange:p,walletType:"mpc"}),L.jsx(Tw,{walletAdapter:r,curSelectToken:f,currentActiveChain:d,metadata:o,onCopy:i}),L.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:()=>{s&&s({amount:"",chainId:u,tokenAddress:(h==null?void 0:h.tokenAddress)||"",tokenSymbol:f}),c()},children:a("deposit.title")})]}):L.jsx("div",{className:"text-center py-8",children:L.jsx("p",{className:"text-gray-400",children:"Loading..."})})},Cw="1.0.8";let Ke=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@${Cw}`].join(`
110
+ `);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 Kt(e,t){const n=e.exec(t);return n==null?void 0:n.groups}const ad=/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/,cd=/^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)?$/,ud=/^\(.+?\).*?$/,ld=/^tuple(?<array>(\[(\d*)\])*)$/;function Pa(e){let t=e.type;if(ld.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+=Pa(s),o<n-1&&(t+=", ")}const r=Kt(ld,e.type);return t+=`)${(r==null?void 0:r.array)??""}`,Pa({...e,type:t})}return"indexed"in e&&e.indexed&&(t=`${t} indexed`),e.name?`${t} ${e.name}`:t}function Wr(e){let t="";const n=e.length;for(let r=0;r<n;r++){const o=e[r];t+=Pa(o),r!==n-1&&(t+=", ")}return t}function bs(e){var t;return e.type==="function"?`function ${e.name}(${Wr(e.inputs)})${e.stateMutability&&e.stateMutability!=="nonpayable"?` ${e.stateMutability}`:""}${(t=e.outputs)!=null&&t.length?` returns (${Wr(e.outputs)})`:""}`:e.type==="event"?`event ${e.name}(${Wr(e.inputs)})`:e.type==="error"?`error ${e.name}(${Wr(e.inputs)})`:e.type==="constructor"?`constructor(${Wr(e.inputs)})${e.stateMutability==="payable"?" payable":""}`:e.type==="fallback"?`fallback() external${e.stateMutability==="payable"?" payable":""}`:"receive() external payable"}const fd=/^error (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*)\((?<parameters>.*?)\)$/;function Ow(e){return fd.test(e)}function Iw(e){return Kt(fd,e)}const dd=/^event (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*)\((?<parameters>.*?)\)$/;function Nw(e){return dd.test(e)}function Mw(e){return Kt(dd,e)}const pd=/^function (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*)\((?<parameters>.*?)\)(?: (?<scope>external|public{1}))?(?: (?<stateMutability>pure|view|nonpayable|payable{1}))?(?: returns\s?\((?<returns>.*?)\))?$/;function kw(e){return pd.test(e)}function Lw(e){return Kt(pd,e)}const hd=/^struct (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*) \{(?<properties>.*?)\}$/;function $a(e){return hd.test(e)}function Bw(e){return Kt(hd,e)}const md=/^constructor\((?<parameters>.*?)\)(?:\s(?<stateMutability>payable{1}))?$/;function Rw(e){return md.test(e)}function Dw(e){return Kt(md,e)}const gd=/^fallback\(\) external(?:\s(?<stateMutability>payable{1}))?$/;function Fw(e){return gd.test(e)}function jw(e){return Kt(gd,e)}const _w=/^receive\(\) external payable$/;function Uw(e){return _w.test(e)}const zw=new Set(["indexed"]),Ta=new Set(["calldata","memory","storage"]);class Ww extends Ke{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 Hw extends Ke{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 Vw extends Ke{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 Gw extends Ke{constructor({param:t}){super("Invalid ABI parameter.",{details:t}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidParameterError"})}}class qw extends Ke{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 Zw extends Ke{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 Kw extends Ke{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 Yw extends Ke{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 tr extends Ke{constructor({signature:t,type:n}){super(`Invalid ${n} signature.`,{details:t}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidSignatureError"})}}class Xw extends Ke{constructor({signature:t}){super("Unknown signature.",{details:t}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"UnknownSignatureError"})}}class Qw extends Ke{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 Jw extends Ke{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 ex extends Ke{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 tx(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 Aa=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 Ca(e,t={}){if(kw(e))return nx(e,t);if(Nw(e))return rx(e,t);if(Ow(e))return ox(e,t);if(Rw(e))return sx(e,t);if(Fw(e))return ix(e);if(Uw(e))return{type:"receive",stateMutability:"payable"};throw new Xw({signature:e})}function nx(e,t={}){const n=Lw(e);if(!n)throw new tr({signature:e,type:"function"});const r=bt(n.parameters),o=[],s=r.length;for(let c=0;c<s;c++)o.push(On(r[c],{modifiers:Ta,structs:t,type:"function"}));const i=[];if(n.returns){const c=bt(n.returns),a=c.length;for(let u=0;u<a;u++)i.push(On(c[u],{modifiers:Ta,structs:t,type:"function"}))}return{name:n.name,type:"function",stateMutability:n.stateMutability??"nonpayable",inputs:o,outputs:i}}function rx(e,t={}){const n=Mw(e);if(!n)throw new tr({signature:e,type:"event"});const r=bt(n.parameters),o=[],s=r.length;for(let i=0;i<s;i++)o.push(On(r[i],{modifiers:zw,structs:t,type:"event"}));return{name:n.name,type:"event",inputs:o}}function ox(e,t={}){const n=Iw(e);if(!n)throw new tr({signature:e,type:"error"});const r=bt(n.parameters),o=[],s=r.length;for(let i=0;i<s;i++)o.push(On(r[i],{structs:t,type:"error"}));return{name:n.name,type:"error",inputs:o}}function sx(e,t={}){const n=Dw(e);if(!n)throw new tr({signature:e,type:"constructor"});const r=bt(n.parameters),o=[],s=r.length;for(let i=0;i<s;i++)o.push(On(r[i],{structs:t,type:"constructor"}));return{type:"constructor",stateMutability:n.stateMutability??"nonpayable",inputs:o}}function ix(e){const t=jw(e);if(!t)throw new tr({signature:e,type:"fallback"});return{type:"fallback",stateMutability:t.stateMutability??"nonpayable"}}const ax=/^(?<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$_]*))?$/,cx=/^\((?<type>.+?)\)(?<array>(?:\[\d*?\])+?)?(?:\s(?<modifier>calldata|indexed|memory|storage{1}))?(?:\s(?<name>[a-zA-Z$_][a-zA-Z0-9$_]*))?$/,ux=/^u?int$/;function On(e,t){var f,p;const n=tx(e,t==null?void 0:t.type,t==null?void 0:t.structs);if(Aa.has(n))return Aa.get(n);const r=ud.test(e),o=Kt(r?cx:ax,e);if(!o)throw new Gw({param:e});if(o.name&&fx(o.name))throw new qw({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=bt(o.type),h=[],m=d.length;for(let y=0;y<m;y++)h.push(On(d[y],{structs:c}));u={components:h}}else if(o.type in c)a="tuple",u={components:c[o.type]};else if(ux.test(o.type))a=`${o.type}256`;else if(a=o.type,(t==null?void 0:t.type)!=="struct"&&!bd(a))throw new Vw({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 Zw({param:e,type:t==null?void 0:t.type,modifier:o.modifier});if(Ta.has(o.modifier)&&!dx(a,!!o.array))throw new Kw({param:e,type:t==null?void 0:t.type,modifier:o.modifier})}const l={type:`${a}${o.array??""}`,...s,...i,...u};return Aa.set(n,l),l}function bt(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?bt(c,[...t,n.trim()]):bt(c,t,`${n}${i}`,r);case"(":return bt(c,t,`${n}${i}`,r+1);case")":return bt(c,t,`${n}${i}`,r-1);default:return bt(c,t,`${n}${i}`,r)}}if(n==="")return t;if(r!==0)throw new ex({current:n,depth:r});return t.push(n.trim()),t}function bd(e){return e==="address"||e==="bool"||e==="function"||e==="string"||ad.test(e)||cd.test(e)}const lx=/^(?: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 fx(e){return e==="address"||e==="bool"||e==="function"||e==="string"||e==="tuple"||ad.test(e)||cd.test(e)||lx.test(e)}function dx(e,t){return t||e==="bytes"||e==="string"||e==="tuple"}function yd(e){const t={},n=e.length;for(let i=0;i<n;i++){const c=e[i];if(!$a(c))continue;const a=Bw(c);if(!a)throw new tr({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=On(h,{type:"struct"});l.push(m)}if(!l.length)throw new Qw({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]=vd(a,t)}return r}const px=/^(?<type>[a-zA-Z$_][a-zA-Z0-9$_]*)(?<array>(?:\[\d*?\])+?)?$/;function vd(e,t,n=new Set){const r=[],o=e.length;for(let s=0;s<o;s++){const i=e[s];if(ud.test(i.type))r.push(i);else{const a=Kt(px,i.type);if(!(a!=null&&a.type))throw new Yw({abiParameter:i});const{array:u,type:l}=a;if(l in t){if(n.has(l))throw new Jw({type:l});r.push({...i,type:`tuple${u??""}`,components:vd(t[l]??[],t,new Set([...n,l]))})}else if(bd(l))r.push(i);else throw new Hw({type:l})}}return r}function wd(e){const t=yd(e),n=[],r=e.length;for(let o=0;o<r;o++){const s=e[o];$a(s)||n.push(Ca(s,t))}return n}function xd(e){let t;if(typeof e=="string")t=Ca(e);else{const n=yd(e),r=e.length;for(let o=0;o<r;o++){const s=e[o];if(!$a(s)){t=Ca(s,n);break}}}if(!t)throw new Ww({signature:e});return t}function J(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 yt(e,{includeName:t=!1}={}){if(e.type!=="function"&&e.type!=="event"&&e.type!=="error")throw new Tx(e.type);return`${e.name}(${ys(e.inputs,{includeName:t})})`}function ys(e,{includeName:t=!1}={}){return e?e.map(n=>hx(n,{includeName:t})).join(t?", ":","):""}function hx(e,{includeName:t}){return e.type.startsWith("tuple")?`(${ys(e.components,{includeName:t})})${e.type.slice(5)}`:e.type+(t&&e.name?` ${e.name}`:"")}function vt(e,{strict:t=!0}={}){return!e||typeof e!="string"?!1:t?/^0x[0-9a-fA-F]*$/.test(e):e.startsWith("0x")}function we(e){return vt(e,{strict:!1})?Math.ceil((e.length-2)/2):e.length}const Ed="2.34.0";let Hr={getDocsUrl:({docsBaseUrl:e,docsPath:t="",docsSlug:n})=>t?`${e??"https://viem.sh"}${t}${n?`#${n}`:""}`:void 0,version:`viem@${Ed}`},H=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=Hr.getDocsUrl)==null?void 0:c.call(Hr,{...n,docsPath:o}),i=[t||"An error occurred.","",...n.metaMessages?[...n.metaMessages,""]:[],...s?[`Docs: ${s}`]:[],...r?[`Details: ${r}`]:[],...Hr.version?[`Version: ${Hr.version}`]:[]].join(`
111
+ `);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=Ed}walk(t){return Sd(this,t)}};function Sd(e,t){return t!=null&&t(e)?e:e&&typeof e=="object"&&"cause"in e&&e.cause!==void 0?Sd(e.cause,t):t?null:e}class mx extends H{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(`
112
+ `),{docsPath:t,name:"AbiConstructorNotFoundError"})}}class Pd extends H{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(`
113
+ `),{docsPath:t,name:"AbiConstructorParamsNotFoundError"})}}class $d extends H{constructor({data:t,params:n,size:r}){super([`Data size of ${r} bytes is too small for given parameters.`].join(`
114
+ `),{metaMessages:[`Params: (${ys(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 Vr extends H{constructor(){super('Cannot decode zero data ("0x") with ABI parameters.',{name:"AbiDecodingZeroDataError"})}}class gx extends H{constructor({expectedLength:t,givenLength:n,type:r}){super([`ABI encoding array length mismatch for type ${r}.`,`Expected length: ${t}`,`Given length: ${n}`].join(`
115
+ `),{name:"AbiEncodingArrayLengthMismatchError"})}}class bx extends H{constructor({expectedSize:t,value:n}){super(`Size of bytes "${n}" (bytes${we(n)}) does not match expected size (bytes${t}).`,{name:"AbiEncodingBytesSizeMismatchError"})}}class yx extends H{constructor({expectedLength:t,givenLength:n}){super(["ABI encoding params/values length mismatch.",`Expected length (params): ${t}`,`Given length (values): ${n}`].join(`
116
+ `),{name:"AbiEncodingLengthMismatchError"})}}class vx extends H{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(`
127
117
  `),{docsPath:n,name:"AbiErrorInputsNotFoundError"})}}class Td extends H{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(`
128
- `),{docsPath:n,name:"AbiErrorNotFoundError"})}}class Cd extends H{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(`
129
- `),{docsPath:n,name:"AbiErrorSignatureNotFoundError"}),Object.defineProperty(this,"signature",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.signature=t}}class yx extends H{constructor({docsPath:t}){super("Cannot extract event signature from empty topics.",{docsPath:t,name:"AbiEventSignatureEmptyTopicsError"})}}class Od extends H{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(`
130
- `),{docsPath:n,name:"AbiEventSignatureNotFoundError"})}}class Nd extends H{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(`
118
+ `),{docsPath:n,name:"AbiErrorNotFoundError"})}}class Ad extends H{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(`
119
+ `),{docsPath:n,name:"AbiErrorSignatureNotFoundError"}),Object.defineProperty(this,"signature",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.signature=t}}class wx extends H{constructor({docsPath:t}){super("Cannot extract event signature from empty topics.",{docsPath:t,name:"AbiEventSignatureEmptyTopicsError"})}}class Cd extends H{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(`
120
+ `),{docsPath:n,name:"AbiEventSignatureNotFoundError"})}}class Od extends H{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(`
131
121
  `),{docsPath:n,name:"AbiEventNotFoundError"})}}class nr extends H{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(`
132
122
  `),{docsPath:n,name:"AbiFunctionNotFoundError"})}}class Id extends H{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(`
133
- `),{docsPath:n,name:"AbiFunctionOutputsNotFoundError"})}}class vx extends H{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(`
134
- `),{docsPath:n,name:"AbiFunctionSignatureNotFoundError"})}}class wx extends H{constructor(t,n){super("Found ambiguous types in overloaded ABI items.",{metaMessages:[`\`${t.type}\` in \`${yt(t.abiItem)}\`, and`,`\`${n.type}\` in \`${yt(n.abiItem)}\``,"","These types encode differently and cannot be distinguished at runtime.","Remove one of the ambiguous items in the ABI."],name:"AbiItemAmbiguityError"})}}let xx=class extends H{constructor({expectedSize:t,givenSize:n}){super(`Expected bytes${t}, got bytes${n}.`,{name:"BytesSizeMismatchError"})}};class Gr extends H{constructor({abiItem:t,data:n,params:r,size:o}){super([`Data size of ${o} bytes is too small for non-indexed event parameters.`].join(`
135
- `),{metaMessages:[`Params: (${bs(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 ys extends H{constructor({abiItem:t,param:n}){super([`Expected a topic for indexed event parameter${n.name?` "${n.name}"`:""} on event "${yt(t,{includeName:!0})}".`].join(`
136
- `),{name:"DecodeLogTopicsMismatch"}),Object.defineProperty(this,"abiItem",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.abiItem=t}}class Ex extends H{constructor(t,{docsPath:n}){super([`Type "${t}" is not a valid encoding type.`,"Please provide a valid ABI type."].join(`
137
- `),{docsPath:n,name:"InvalidAbiEncodingType"})}}class Sx extends H{constructor(t,{docsPath:n}){super([`Type "${t}" is not a valid decoding type.`,"Please provide a valid ABI type."].join(`
138
- `),{docsPath:n,name:"InvalidAbiDecodingType"})}}let Md=class extends H{constructor(t){super([`Value "${t}" is not a valid array.`].join(`
139
- `),{name:"InvalidArrayError"})}};class Px extends H{constructor(t){super([`"${t}" is not a valid definition type.`,'Valid types: "function", "event", "error"'].join(`
140
- `),{name:"InvalidDefinitionTypeError"})}}class $x extends H{constructor(t){super(`Filter type "${t}" is not supported.`,{name:"FilterTypeNotSupportedError"})}}let Ld=class extends H{constructor({offset:t,position:n,size:r}){super(`Slice ${n==="start"?"starting":"ending"} at offset "${t}" is out-of-bounds (size: ${r}).`,{name:"SliceOffsetOutOfBoundsError"})}},Bd=class extends H{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 kd extends H{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 rr(e,{dir:t,size:n=32}={}){return typeof e=="string"?gn(e,{dir:t,size:n}):Ax(e,{dir:t,size:n})}function gn(e,{dir:t,size:n=32}={}){if(n===null)return e;const r=e.replace("0x","");if(r.length>n*2)throw new Bd({size:Math.ceil(r.length/2),targetSize:n,type:"hex"});return`0x${r[t==="right"?"padEnd":"padStart"](n*2,"0")}`}function Ax(e,{dir:t,size:n=32}={}){if(n===null)return e;if(e.length>n)throw new Bd({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 Rd=class extends H{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 Tx extends H{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 Cx extends H{constructor(t){super(`Hex value "${t}" is not a valid boolean. The hex value must be "0x0" (false) or "0x1" (true).`,{name:"InvalidHexBooleanError"})}}let Ox=class extends H{constructor({givenSize:t,maxSize:n}){super(`Size cannot exceed ${n} bytes. Given size: ${t} bytes.`,{name:"SizeOverflowError"})}};function In(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 wt(e,{size:t}){if(we(e)>t)throw new Ox({givenSize:we(e),maxSize:t})}function Bt(e,t={}){const{signed:n}=t;t.size&&wt(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 Nx(e,t={}){let n=e;if(t.size&&(wt(n,{size:t.size}),n=In(n)),In(n)==="0x00")return!1;if(In(n)==="0x01")return!0;throw new Cx(n)}function Zt(e,t={}){return Number(Bt(e,t))}const Ix=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function Kt(e,t={}){return typeof e=="number"||typeof e=="bigint"?Q(e,t):typeof e=="string"?qr(e,t):typeof e=="boolean"?Fd(e,t):$e(e,t)}function Fd(e,t={}){const n=`0x${Number(e)}`;return typeof t.size=="number"?(wt(n,{size:t.size}),rr(n,{size:t.size})):n}function $e(e,t={}){let n="";for(let o=0;o<e.length;o++)n+=Ix[e[o]];const r=`0x${n}`;return typeof t.size=="number"?(wt(r,{size:t.size}),rr(r,{dir:"right",size:t.size})):r}function Q(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 Rd({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?rr(c,{size:r}):c}const Mx=new TextEncoder;function qr(e,t={}){const n=Mx.encode(e);return $e(n,t)}const Lx=new TextEncoder;function or(e,t={}){return typeof e=="number"||typeof e=="bigint"?kx(e,t):typeof e=="boolean"?Bx(e,t):vt(e)?xt(e,t):Mn(e,t)}function Bx(e,t={}){const n=new Uint8Array(1);return n[0]=Number(e),typeof t.size=="number"?(wt(n,{size:t.size}),rr(n,{size:t.size})):n}const Yt={zero:48,nine:57,A:65,F:70,a:97,f:102};function Dd(e){if(e>=Yt.zero&&e<=Yt.nine)return e-Yt.zero;if(e>=Yt.A&&e<=Yt.F)return e-(Yt.A-10);if(e>=Yt.a&&e<=Yt.f)return e-(Yt.a-10)}function xt(e,t={}){let n=e;t.size&&(wt(n,{size:t.size}),n=rr(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=Dd(r.charCodeAt(c++)),u=Dd(r.charCodeAt(c++));if(a===void 0||u===void 0)throw new H(`Invalid byte sequence ("${r[c-2]}${r[c-1]}" in "${r}").`);s[i]=a*16+u}return s}function kx(e,t){const n=Q(e,t);return xt(n)}function Mn(e,t={}){const n=Lx.encode(e);return typeof t.size=="number"?(wt(n,{size:t.size}),rr(n,{dir:"right",size:t.size})):n}const vs=BigInt(2**32-1),jd=BigInt(32);function Rx(e,t=!1){return t?{h:Number(e&vs),l:Number(e>>jd&vs)}:{h:Number(e>>jd&vs)|0,l:Number(e&vs)|0}}function Fx(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}=Rx(e[s],t);[r[s],o[s]]=[i,c]}return[r,o]}const Dx=(e,t,n)=>e<<n|t>>>32-n,jx=(e,t,n)=>t<<n|e>>>32-n,_x=(e,t,n)=>t<<n-32|e>>>64-n,Ux=(e,t,n)=>e<<n-32|t>>>64-n,sr=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0;/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */function ws(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array"}function Zr(e){if(!Number.isSafeInteger(e)||e<0)throw new Error("positive integer expected, got "+e)}function Xt(e,...t){if(!ws(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 _d(e){if(typeof e!="function"||typeof e.create!="function")throw new Error("Hash should be wrapped by utils.createHasher");Zr(e.outputLen),Zr(e.blockLen)}function ir(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 Ud(e,t){Xt(e);const n=t.outputLen;if(e.length<n)throw new Error("digestInto() expects output buffer of length at least "+n)}function zx(e){return new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4))}function ar(...e){for(let t=0;t<e.length;t++)e[t].fill(0)}function Oa(e){return new DataView(e.buffer,e.byteOffset,e.byteLength)}function kt(e,t){return e<<32-t|e>>>t}const Wx=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;function Hx(e){return e<<24&4278190080|e<<8&16711680|e>>>8&65280|e>>>24&255}function Vx(e){for(let t=0;t<e.length;t++)e[t]=Hx(e[t]);return e}const zd=Wx?e=>e:Vx,Wd=typeof Uint8Array.from([]).toHex=="function"&&typeof Uint8Array.fromHex=="function",Gx=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function cr(e){if(Xt(e),Wd)return e.toHex();let t="";for(let n=0;n<e.length;n++)t+=Gx[e[n]];return t}const Qt={_0:48,_9:57,A:65,F:70,a:97,f:102};function Hd(e){if(e>=Qt._0&&e<=Qt._9)return e-Qt._0;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 xs(e){if(typeof e!="string")throw new Error("hex string expected, got "+typeof e);if(Wd)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=Hd(e.charCodeAt(s)),c=Hd(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 qx(e){if(typeof e!="string")throw new Error("string expected");return new Uint8Array(new TextEncoder().encode(e))}function Es(e){return typeof e=="string"&&(e=qx(e)),Xt(e),e}function bn(...e){let t=0;for(let r=0;r<e.length;r++){const o=e[r];Xt(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 Na{}function Vd(e){const t=r=>e().update(Es(r)).digest(),n=e();return t.outputLen=n.outputLen,t.blockLen=n.blockLen,t.create=()=>e(),t}function Gd(e=32){if(sr&&typeof sr.getRandomValues=="function")return sr.getRandomValues(new Uint8Array(e));if(sr&&typeof sr.randomBytes=="function")return Uint8Array.from(sr.randomBytes(e));throw new Error("crypto.getRandomValues must be defined")}const Zx=BigInt(0),Kr=BigInt(1),Kx=BigInt(2),Yx=BigInt(7),Xx=BigInt(256),Qx=BigInt(113),qd=[],Zd=[],Kd=[];for(let e=0,t=Kr,n=1,r=0;e<24;e++){[n,r]=[r,(2*n+3*r)%5],qd.push(2*(5*r+n)),Zd.push((e+1)*(e+2)/2%64);let o=Zx;for(let s=0;s<7;s++)t=(t<<Kr^(t>>Yx)*Qx)%Xx,t&Kx&&(o^=Kr<<(Kr<<BigInt(s))-Kr);Kd.push(o)}const Yd=Fx(Kd,!0),Jx=Yd[0],eE=Yd[1],Xd=(e,t,n)=>n>32?_x(e,t,n):Dx(e,t,n),Qd=(e,t,n)=>n>32?Ux(e,t,n):jx(e,t,n);function tE(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=Xd(u,l,1)^n[c],p=Qd(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=Zd[i],a=Xd(o,s,c),u=Qd(o,s,c),l=qd[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]^=Jx[r],e[1]^=eE[r]}ar(n)}class Ia extends Na{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,Zr(r),!(0<t&&t<200))throw new Error("only keccak-f1600 function is supported");this.state=new Uint8Array(200),this.state32=zx(this.state)}clone(){return this._cloneInto()}keccak(){zd(this.state32),tE(this.state32,this.rounds),zd(this.state32),this.posOut=0,this.pos=0}update(t){ir(this),t=Es(t),Xt(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){ir(this,!1),Xt(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 Zr(t),this.xofInto(new Uint8Array(t))}digestInto(t){if(Ud(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,ar(this.state)}_cloneInto(t){const{blockLen:n,suffix:r,outputLen:o,rounds:s,enableXOF:i}=this;return t||(t=new Ia(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 nE=(e,t,n)=>Vd(()=>new Ia(t,e,n)),Jd=nE(1,136,256/8);function Ne(e,t){const n=t||"hex",r=Jd(vt(e,{strict:!1})?or(e):e);return n==="bytes"?r:Kt(r)}const rE=e=>Ne(or(e));function oE(e){return rE(e)}function sE(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 H("Unable to normalize signature.");return o}const iE=e=>{const t=typeof e=="string"?e:gs(e);return sE(t)};function ep(e){return oE(iE(e))}const Ss=ep;let yn=class extends H{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"})}},Ma=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 La=new Ma(8192);function Ps(e,t){if(La.has(`${e}.${t}`))return La.get(`${e}.${t}`);const n=e.substring(2).toLowerCase(),r=Ne(Mn(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 La.set(`${e}.${t}`,s),s}function aE(e,t){if(!ct(e,{strict:!1}))throw new yn({address:e});return Ps(e,t)}const cE=/^0x[a-fA-F0-9]{40}$/,Ba=new Ma(8192);function ct(e,t){const{strict:n=!0}=t??{},r=`${e}.${n}`;if(Ba.has(r))return Ba.get(r);const o=cE.test(e)?e.toLowerCase()===e?!0:n?Ps(e)===e:!0:!1;return Ba.set(r,o),o}function Et(e){return typeof e[0]=="string"?ur(e):uE(e)}function uE(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 ur(e){return`0x${e.reduce((t,n)=>t+n.replace("0x",""),"")}`}function lr(e,t,n,{strict:r}={}){return vt(e,{strict:!1})?op(e,t,n,{strict:r}):rp(e,t,n,{strict:r})}function tp(e,t){if(typeof t=="number"&&t>0&&t>we(e)-1)throw new Ld({offset:t,position:"start",size:we(e)})}function np(e,t,n){if(typeof t=="number"&&typeof n=="number"&&we(e)!==n-t)throw new Ld({offset:n,position:"end",size:we(e)})}function rp(e,t,n,{strict:r}={}){tp(e,t);const o=e.slice(t,n);return r&&np(o,t,n),o}function op(e,t,n,{strict:r}={}){tp(e,t);const o=`0x${e.replace("0x","").slice((t??0)*2,(n??e.length)*2)}`;return r&&np(o,t,n),o}const lE=/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/,sp=/^(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 Jt(e,t){if(e.length!==t.length)throw new gx({expectedLength:e.length,givenLength:t.length});const n=fE({params:e,values:t}),r=Ra(n);return r.length===0?"0x":r}function fE({params:e,values:t}){const n=[];for(let r=0;r<e.length;r++)n.push(ka({param:e[r],value:t[r]}));return n}function ka({param:e,value:t}){const n=Fa(e.type);if(n){const[r,o]=n;return pE(t,{length:r,param:{...e,type:o}})}if(e.type==="tuple")return yE(t,{param:e});if(e.type==="address")return dE(t);if(e.type==="bool")return mE(t);if(e.type.startsWith("uint")||e.type.startsWith("int")){const r=e.type.startsWith("int"),[,,o="256"]=sp.exec(e.type)??[];return gE(t,{signed:r,size:Number(o)})}if(e.type.startsWith("bytes"))return hE(t,{param:e});if(e.type==="string")return bE(t);throw new Ex(e.type,{docsPath:"/docs/contract/encodeAbiParameters"})}function Ra(e){let t=0;for(let s=0;s<e.length;s++){const{dynamic:i,encoded:c}=e[s];i?t+=32:t+=we(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(Q(t+o,{size:32})),r.push(c),o+=we(c)):n.push(c)}return Et([...n,...r])}function dE(e){if(!ct(e))throw new yn({address:e});return{dynamic:!1,encoded:gn(e.toLowerCase())}}function pE(e,{length:t,param:n}){const r=t===null;if(!Array.isArray(e))throw new Md(e);if(!r&&e.length!==t)throw new hx({expectedLength:t,givenLength:e.length,type:`${n.type}[${t}]`});let o=!1;const s=[];for(let i=0;i<e.length;i++){const c=ka({param:n,value:e[i]});c.dynamic&&(o=!0),s.push(c)}if(r||o){const i=Ra(s);if(r){const c=Q(s.length,{size:32});return{dynamic:!0,encoded:s.length>0?Et([c,i]):c}}if(o)return{dynamic:!0,encoded:i}}return{dynamic:!1,encoded:Et(s.map(({encoded:i})=>i))}}function hE(e,{param:t}){const[,n]=t.type.split("bytes"),r=we(e);if(!n){let o=e;return r%32!==0&&(o=gn(o,{dir:"right",size:Math.ceil((e.length-2)/2/32)*32})),{dynamic:!0,encoded:Et([gn(Q(r,{size:32})),o])}}if(r!==Number.parseInt(n))throw new mx({expectedSize:Number.parseInt(n),value:e});return{dynamic:!1,encoded:gn(e,{dir:"right"})}}function mE(e){if(typeof e!="boolean")throw new H(`Invalid boolean value: "${e}" (type: ${typeof e}). Expected: \`true\` or \`false\`.`);return{dynamic:!1,encoded:gn(Fd(e))}}function gE(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 Rd({max:r.toString(),min:o.toString(),signed:t,size:n/8,value:e.toString()})}return{dynamic:!1,encoded:Q(e,{size:32,signed:t})}}function bE(e){const t=qr(e),n=Math.ceil(we(t)/32),r=[];for(let o=0;o<n;o++)r.push(gn(lr(t,o*32,(o+1)*32),{dir:"right"}));return{dynamic:!0,encoded:Et([gn(Q(we(t),{size:32})),...r])}}function yE(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=ka({param:s,value:e[i]});r.push(c),c.dynamic&&(n=!0)}return{dynamic:n,encoded:n?Ra(r):Et(r.map(({encoded:o})=>o))}}function Fa(e){const t=e.match(/^(.*)\[(\d+)?\]$/);return t?[t[2]?Number(t[2]):null,t[1]]:void 0}const Yr=e=>lr(ep(e),0,4);function Ln(e){const{abi:t,args:n=[],name:r}=e,o=vt(r,{strict:!1}),s=t.filter(c=>o?c.type==="function"?Yr(c)===r:c.type==="event"?Ss(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?Da(u,f):!1})){if(i&&"inputs"in i&&i.inputs){const u=ip(c.inputs,i.inputs,n);if(u)throw new wx({abiItem:c,type:u[0]},{abiItem:i,type:u[1]})}i=c}}return i||s[0]}function Da(e,t){const n=typeof e,r=t.type;switch(r){case"address":return ct(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)=>Da(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=>Da(o,{...t,type:r.replace(/(\[[0-9]{0,}\])$/,"")})):!1}}function ip(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 ip(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")?ct(n[r],{strict:!1}):i.includes("address")&&i.includes("bytes")?ct(n[r],{strict:!1}):!1)return i}}const ap="/docs/contract/encodeEventTopics";function Xr(e){var a;const{abi:t,eventName:n,args:r}=e;let o=t[0];if(n){const u=Ln({abi:t,name:n});if(!u)throw new Nd(n,{docsPath:ap});o=u}if(o.type!=="event")throw new Nd(void 0,{docsPath:ap});const s=yt(o),i=Ss(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)=>cp({param:f,value:l[p][h]})):typeof l[p]<"u"&&l[p]!==null?cp({param:f,value:l[p]}):null))??[])}return[i,...c]}function cp({param:e,value:t}){if(e.type==="string"||e.type==="bytes")return Ne(or(t));if(e.type==="tuple"||e.type.match(/^(.*)\[(\d+)?\]$/))throw new $x(e.type);return Jt([e],[t])}function $s(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 up(e,t){const{address:n,abi:r,args:o,eventName:s,fromBlock:i,strict:c,toBlock:a}=t,u=$s(e,{method:"eth_newFilter"}),l=s?Xr({abi:r,args:o,eventName:s}):void 0,f=await e.request({method:"eth_newFilter",params:[{address:n,fromBlock:typeof i=="bigint"?Q(i):i,toBlock:typeof a=="bigint"?Q(a):a,topics:l}]});return{abi:r,args:o,eventName:s,id:f,request:u(f),strict:!!c,type:"event"}}function St(e){return typeof e=="string"?{address:e,type:"json-rpc"}:e}const lp="/docs/contract/encodeFunctionData";function vE(e){const{abi:t,args:n,functionName:r}=e;let o=t[0];if(r){const s=Ln({abi:t,args:n,name:r});if(!s)throw new nr(r,{docsPath:lp});o=s}if(o.type!=="function")throw new nr(void 0,{docsPath:lp});return{abi:[o],functionName:Yr(yt(o))}}function Rt(e){const{args:t}=e,{abi:n,functionName:r}=(()=>{var c;return e.abi.length===1&&((c=e.functionName)!=null&&c.startsWith("0x"))?e:vE(e)})(),o=n[0],s=r,i="inputs"in o&&o.inputs?Jt(o.inputs,t??[]):void 0;return ur([s,i??"0x"])}const fp={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."},dp={inputs:[{name:"message",type:"string"}],name:"Error",type:"error"},wE={inputs:[{name:"reason",type:"uint256"}],name:"Panic",type:"error"};class pp extends H{constructor({offset:t}){super(`Offset \`${t}\` cannot be negative.`,{name:"NegativeOffsetError"})}}class hp extends H{constructor({length:t,position:n}){super(`Position \`${n}\` is out of bounds (\`0 < position < ${t}\`).`,{name:"PositionOutOfBoundsError"})}}class xE extends H{constructor({count:t,limit:n}){super(`Recursive read limit of \`${n}\` exceeded (recursive read count: \`${t}\`).`,{name:"RecursiveReadLimitExceededError"})}}const EE={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 xE({count:this.recursiveReadCount+1,limit:this.recursiveReadLimit})},assertPosition(e){if(e<0||e>this.bytes.length-1)throw new hp({length:this.bytes.length,position:e})},decrementPosition(e){if(e<0)throw new pp({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 pp({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 ja(e,{recursiveReadLimit:t=8192}={}){const n=Object.create(EE);return n.bytes=e,n.dataView=new DataView(e.buffer,e.byteOffset,e.byteLength),n.positionReadCount=new Map,n.recursiveReadLimit=t,n}function SE(e,t={}){typeof t.size<"u"&&wt(e,{size:t.size});const n=$e(e,t);return Bt(n,t)}function PE(e,t={}){let n=e;if(typeof t.size<"u"&&(wt(n,{size:t.size}),n=In(n)),n.length>1||n[0]>1)throw new Tx(n);return!!n[0]}function en(e,t={}){typeof t.size<"u"&&wt(e,{size:t.size});const n=$e(e,t);return Zt(n,t)}function $E(e,t={}){let n=e;return typeof t.size<"u"&&(wt(n,{size:t.size}),n=In(n,{dir:"right"})),new TextDecoder().decode(n)}function Qr(e,t){const n=typeof t=="string"?xt(t):t,r=ja(n);if(we(n)===0&&e.length>0)throw new Vr;if(we(t)&&we(t)<32)throw new Ad({data:typeof t=="string"?t:$e(t),params:e,size:we(t)});let o=0;const s=[];for(let i=0;i<e.length;++i){const c=e[i];r.setPosition(o);const[a,u]=fr(r,c,{staticPosition:0});o+=u,s.push(a)}return s}function fr(e,t,{staticPosition:n}){const r=Fa(t.type);if(r){const[o,s]=r;return TE(e,{...t,type:s},{length:o,staticPosition:n})}if(t.type==="tuple")return IE(e,t,{staticPosition:n});if(t.type==="address")return AE(e);if(t.type==="bool")return CE(e);if(t.type.startsWith("bytes"))return OE(e,t,{staticPosition:n});if(t.type.startsWith("uint")||t.type.startsWith("int"))return NE(e,t);if(t.type==="string")return ME(e,{staticPosition:n});throw new Sx(t.type,{docsPath:"/docs/contract/decodeAbiParameters"})}const mp=32,_a=32;function AE(e){const t=e.readBytes(32);return[Ps($e(rp(t,-20))),32]}function TE(e,t,{length:n,staticPosition:r}){if(!n){const i=en(e.readBytes(_a)),c=r+i,a=c+mp;e.setPosition(c);const u=en(e.readBytes(mp)),l=Jr(t);let f=0;const p=[];for(let d=0;d<u;++d){e.setPosition(a+(l?d*32:f));const[h,m]=fr(e,t,{staticPosition:a});f+=m,p.push(h)}return e.setPosition(r+32),[p,32]}if(Jr(t)){const i=en(e.readBytes(_a)),c=r+i,a=[];for(let u=0;u<n;++u){e.setPosition(c+u*32);const[l]=fr(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]=fr(e,t,{staticPosition:r+o});o+=a,s.push(c)}return[s,o]}function CE(e){return[PE(e.readBytes(32),{size:32}),32]}function OE(e,t,{staticPosition:n}){const[r,o]=t.type.split("bytes");if(!o){const i=en(e.readBytes(32));e.setPosition(n+i);const c=en(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 NE(e,t){const n=t.type.startsWith("int"),r=Number.parseInt(t.type.split("int")[1]||"256"),o=e.readBytes(32);return[r>48?SE(o,{signed:n}):en(o,{signed:n}),32]}function IE(e,t,{staticPosition:n}){const r=t.components.length===0||t.components.some(({name:i})=>!i),o=r?[]:{};let s=0;if(Jr(t)){const i=en(e.readBytes(_a)),c=n+i;for(let a=0;a<t.components.length;++a){const u=t.components[a];e.setPosition(c+s);const[l,f]=fr(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]=fr(e,c,{staticPosition:n});o[r?i:c==null?void 0:c.name]=a,s+=u}return[o,s]}function ME(e,{staticPosition:t}){const n=en(e.readBytes(32)),r=t+n;e.setPosition(r);const o=en(e.readBytes(32));if(o===0)return e.setPosition(t+32),["",32];const s=e.readBytes(o,32),i=$E(In(s));return e.setPosition(t+32),[i,32]}function Jr(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(Jr);const n=Fa(e.type);return!!(n&&Jr({...e,type:n[1]}))}function gp(e){const{abi:t,data:n}=e,r=lr(n,0,4);if(r==="0x")throw new Vr;const s=[...t||[],dp,wE].find(i=>i.type==="error"&&r===Yr(yt(i)));if(!s)throw new Cd(r,{docsPath:"/docs/contract/decodeErrorResult"});return{abiItem:s,args:"inputs"in s&&s.inputs&&s.inputs.length>0?Qr(s.inputs,lr(n,4)):void 0,errorName:s.name}}const Ae=(e,t,n)=>JSON.stringify(e,(r,o)=>typeof o=="bigint"?o.toString():o,n);function bp({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"?Ae(t[s]):t[s]}`).join(", ")})`}const LE={gwei:9,wei:18},BE={ether:-9,wei:9};function Ua(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 yp(e,t="wei"){return Ua(e,LE[t])}function Pt(e,t="wei"){return Ua(e,BE[t])}class kE extends H{constructor({address:t}){super(`State for account "${t}" is set multiple times.`,{name:"AccountStateConflictError"})}}class RE extends H{constructor(){super("state and stateDiff are set on the same account.",{name:"StateAssignmentConflictError"})}}function vp(e){return e.reduce((t,{slot:n,value:r})=>`${t} ${n}: ${r}
141
- `,"")}function FE(e){return e.reduce((t,{address:n,...r})=>{let o=`${t} ${n}:
123
+ `),{docsPath:n,name:"AbiFunctionOutputsNotFoundError"})}}class xx extends H{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(`
124
+ `),{docsPath:n,name:"AbiFunctionSignatureNotFoundError"})}}class Ex extends H{constructor(t,n){super("Found ambiguous types in overloaded ABI items.",{metaMessages:[`\`${t.type}\` in \`${yt(t.abiItem)}\`, and`,`\`${n.type}\` in \`${yt(n.abiItem)}\``,"","These types encode differently and cannot be distinguished at runtime.","Remove one of the ambiguous items in the ABI."],name:"AbiItemAmbiguityError"})}}let Sx=class extends H{constructor({expectedSize:t,givenSize:n}){super(`Expected bytes${t}, got bytes${n}.`,{name:"BytesSizeMismatchError"})}};class Gr extends H{constructor({abiItem:t,data:n,params:r,size:o}){super([`Data size of ${o} bytes is too small for non-indexed event parameters.`].join(`
125
+ `),{metaMessages:[`Params: (${ys(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 vs extends H{constructor({abiItem:t,param:n}){super([`Expected a topic for indexed event parameter${n.name?` "${n.name}"`:""} on event "${yt(t,{includeName:!0})}".`].join(`
126
+ `),{name:"DecodeLogTopicsMismatch"}),Object.defineProperty(this,"abiItem",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.abiItem=t}}class Px extends H{constructor(t,{docsPath:n}){super([`Type "${t}" is not a valid encoding type.`,"Please provide a valid ABI type."].join(`
127
+ `),{docsPath:n,name:"InvalidAbiEncodingType"})}}class $x extends H{constructor(t,{docsPath:n}){super([`Type "${t}" is not a valid decoding type.`,"Please provide a valid ABI type."].join(`
128
+ `),{docsPath:n,name:"InvalidAbiDecodingType"})}}let Nd=class extends H{constructor(t){super([`Value "${t}" is not a valid array.`].join(`
129
+ `),{name:"InvalidArrayError"})}};class Tx extends H{constructor(t){super([`"${t}" is not a valid definition type.`,'Valid types: "function", "event", "error"'].join(`
130
+ `),{name:"InvalidDefinitionTypeError"})}}class Ax extends H{constructor(t){super(`Filter type "${t}" is not supported.`,{name:"FilterTypeNotSupportedError"})}}let Md=class extends H{constructor({offset:t,position:n,size:r}){super(`Slice ${n==="start"?"starting":"ending"} at offset "${t}" is out-of-bounds (size: ${r}).`,{name:"SliceOffsetOutOfBoundsError"})}},kd=class extends H{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 Ld extends H{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 rr(e,{dir:t,size:n=32}={}){return typeof e=="string"?mn(e,{dir:t,size:n}):Cx(e,{dir:t,size:n})}function mn(e,{dir:t,size:n=32}={}){if(n===null)return e;const r=e.replace("0x","");if(r.length>n*2)throw new kd({size:Math.ceil(r.length/2),targetSize:n,type:"hex"});return`0x${r[t==="right"?"padEnd":"padStart"](n*2,"0")}`}function Cx(e,{dir:t,size:n=32}={}){if(n===null)return e;if(e.length>n)throw new kd({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 Bd=class extends H{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 Ox extends H{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 Ix extends H{constructor(t){super(`Hex value "${t}" is not a valid boolean. The hex value must be "0x0" (false) or "0x1" (true).`,{name:"InvalidHexBooleanError"})}}let Nx=class extends H{constructor({givenSize:t,maxSize:n}){super(`Size cannot exceed ${n} bytes. Given size: ${t} bytes.`,{name:"SizeOverflowError"})}};function In(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 wt(e,{size:t}){if(we(e)>t)throw new Nx({givenSize:we(e),maxSize:t})}function Rt(e,t={}){const{signed:n}=t;t.size&&wt(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 Mx(e,t={}){let n=e;if(t.size&&(wt(n,{size:t.size}),n=In(n)),In(n)==="0x00")return!1;if(In(n)==="0x01")return!0;throw new Ix(n)}function Yt(e,t={}){return Number(Rt(e,t))}const kx=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function Xt(e,t={}){return typeof e=="number"||typeof e=="bigint"?Q(e,t):typeof e=="string"?qr(e,t):typeof e=="boolean"?Rd(e,t):$e(e,t)}function Rd(e,t={}){const n=`0x${Number(e)}`;return typeof t.size=="number"?(wt(n,{size:t.size}),rr(n,{size:t.size})):n}function $e(e,t={}){let n="";for(let o=0;o<e.length;o++)n+=kx[e[o]];const r=`0x${n}`;return typeof t.size=="number"?(wt(r,{size:t.size}),rr(r,{dir:"right",size:t.size})):r}function Q(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 Bd({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?rr(c,{size:r}):c}const Lx=new TextEncoder;function qr(e,t={}){const n=Lx.encode(e);return $e(n,t)}const Bx=new TextEncoder;function or(e,t={}){return typeof e=="number"||typeof e=="bigint"?Dx(e,t):typeof e=="boolean"?Rx(e,t):vt(e)?xt(e,t):Nn(e,t)}function Rx(e,t={}){const n=new Uint8Array(1);return n[0]=Number(e),typeof t.size=="number"?(wt(n,{size:t.size}),rr(n,{size:t.size})):n}const Qt={zero:48,nine:57,A:65,F:70,a:97,f:102};function Dd(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 xt(e,t={}){let n=e;t.size&&(wt(n,{size:t.size}),n=rr(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=Dd(r.charCodeAt(c++)),u=Dd(r.charCodeAt(c++));if(a===void 0||u===void 0)throw new H(`Invalid byte sequence ("${r[c-2]}${r[c-1]}" in "${r}").`);s[i]=a*16+u}return s}function Dx(e,t){const n=Q(e,t);return xt(n)}function Nn(e,t={}){const n=Bx.encode(e);return typeof t.size=="number"?(wt(n,{size:t.size}),rr(n,{dir:"right",size:t.size})):n}const ws=BigInt(2**32-1),Fd=BigInt(32);function Fx(e,t=!1){return t?{h:Number(e&ws),l:Number(e>>Fd&ws)}:{h:Number(e>>Fd&ws)|0,l:Number(e&ws)|0}}function jx(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}=Fx(e[s],t);[r[s],o[s]]=[i,c]}return[r,o]}const _x=(e,t,n)=>e<<n|t>>>32-n,Ux=(e,t,n)=>t<<n|e>>>32-n,zx=(e,t,n)=>t<<n-32|e>>>64-n,Wx=(e,t,n)=>e<<n-32|t>>>64-n,sr=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0;/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */function xs(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array"}function Zr(e){if(!Number.isSafeInteger(e)||e<0)throw new Error("positive integer expected, got "+e)}function Jt(e,...t){if(!xs(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 jd(e){if(typeof e!="function"||typeof e.create!="function")throw new Error("Hash should be wrapped by utils.createHasher");Zr(e.outputLen),Zr(e.blockLen)}function ir(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 _d(e,t){Jt(e);const n=t.outputLen;if(e.length<n)throw new Error("digestInto() expects output buffer of length at least "+n)}function Hx(e){return new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4))}function ar(...e){for(let t=0;t<e.length;t++)e[t].fill(0)}function Oa(e){return new DataView(e.buffer,e.byteOffset,e.byteLength)}function Dt(e,t){return e<<32-t|e>>>t}const Vx=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;function Gx(e){return e<<24&4278190080|e<<8&16711680|e>>>8&65280|e>>>24&255}function qx(e){for(let t=0;t<e.length;t++)e[t]=Gx(e[t]);return e}const Ud=Vx?e=>e:qx,zd=typeof Uint8Array.from([]).toHex=="function"&&typeof Uint8Array.fromHex=="function",Zx=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function cr(e){if(Jt(e),zd)return e.toHex();let t="";for(let n=0;n<e.length;n++)t+=Zx[e[n]];return t}const en={_0:48,_9:57,A:65,F:70,a:97,f:102};function Wd(e){if(e>=en._0&&e<=en._9)return e-en._0;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 Es(e){if(typeof e!="string")throw new Error("hex string expected, got "+typeof e);if(zd)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=Wd(e.charCodeAt(s)),c=Wd(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 Kx(e){if(typeof e!="string")throw new Error("string expected");return new Uint8Array(new TextEncoder().encode(e))}function Ss(e){return typeof e=="string"&&(e=Kx(e)),Jt(e),e}function gn(...e){let t=0;for(let r=0;r<e.length;r++){const o=e[r];Jt(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 Ia{}function Hd(e){const t=r=>e().update(Ss(r)).digest(),n=e();return t.outputLen=n.outputLen,t.blockLen=n.blockLen,t.create=()=>e(),t}function Vd(e=32){if(sr&&typeof sr.getRandomValues=="function")return sr.getRandomValues(new Uint8Array(e));if(sr&&typeof sr.randomBytes=="function")return Uint8Array.from(sr.randomBytes(e));throw new Error("crypto.getRandomValues must be defined")}const Yx=BigInt(0),Kr=BigInt(1),Xx=BigInt(2),Qx=BigInt(7),Jx=BigInt(256),eE=BigInt(113),Gd=[],qd=[],Zd=[];for(let e=0,t=Kr,n=1,r=0;e<24;e++){[n,r]=[r,(2*n+3*r)%5],Gd.push(2*(5*r+n)),qd.push((e+1)*(e+2)/2%64);let o=Yx;for(let s=0;s<7;s++)t=(t<<Kr^(t>>Qx)*eE)%Jx,t&Xx&&(o^=Kr<<(Kr<<BigInt(s))-Kr);Zd.push(o)}const Kd=jx(Zd,!0),tE=Kd[0],nE=Kd[1],Yd=(e,t,n)=>n>32?zx(e,t,n):_x(e,t,n),Xd=(e,t,n)=>n>32?Wx(e,t,n):Ux(e,t,n);function rE(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=Yd(u,l,1)^n[c],p=Xd(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=qd[i],a=Yd(o,s,c),u=Xd(o,s,c),l=Gd[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]^=tE[r],e[1]^=nE[r]}ar(n)}class Na extends Ia{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,Zr(r),!(0<t&&t<200))throw new Error("only keccak-f1600 function is supported");this.state=new Uint8Array(200),this.state32=Hx(this.state)}clone(){return this._cloneInto()}keccak(){Ud(this.state32),rE(this.state32,this.rounds),Ud(this.state32),this.posOut=0,this.pos=0}update(t){ir(this),t=Ss(t),Jt(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){ir(this,!1),Jt(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 Zr(t),this.xofInto(new Uint8Array(t))}digestInto(t){if(_d(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,ar(this.state)}_cloneInto(t){const{blockLen:n,suffix:r,outputLen:o,rounds:s,enableXOF:i}=this;return t||(t=new Na(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 oE=(e,t,n)=>Hd(()=>new Na(t,e,n)),Qd=oE(1,136,256/8);function Ie(e,t){const n=t||"hex",r=Qd(vt(e,{strict:!1})?or(e):e);return n==="bytes"?r:Xt(r)}const sE=e=>Ie(or(e));function iE(e){return sE(e)}function aE(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 H("Unable to normalize signature.");return o}const cE=e=>{const t=typeof e=="string"?e:bs(e);return aE(t)};function Jd(e){return iE(cE(e))}const Ps=Jd;let bn=class extends H{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"})}},Ma=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 ka=new Ma(8192);function $s(e,t){if(ka.has(`${e}.${t}`))return ka.get(`${e}.${t}`);const n=e.substring(2).toLowerCase(),r=Ie(Nn(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 ka.set(`${e}.${t}`,s),s}function uE(e,t){if(!ct(e,{strict:!1}))throw new bn({address:e});return $s(e,t)}const lE=/^0x[a-fA-F0-9]{40}$/,La=new Ma(8192);function ct(e,t){const{strict:n=!0}=t??{},r=`${e}.${n}`;if(La.has(r))return La.get(r);const o=lE.test(e)?e.toLowerCase()===e?!0:n?$s(e)===e:!0:!1;return La.set(r,o),o}function Et(e){return typeof e[0]=="string"?ur(e):fE(e)}function fE(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 ur(e){return`0x${e.reduce((t,n)=>t+n.replace("0x",""),"")}`}function lr(e,t,n,{strict:r}={}){return vt(e,{strict:!1})?rp(e,t,n,{strict:r}):np(e,t,n,{strict:r})}function ep(e,t){if(typeof t=="number"&&t>0&&t>we(e)-1)throw new Md({offset:t,position:"start",size:we(e)})}function tp(e,t,n){if(typeof t=="number"&&typeof n=="number"&&we(e)!==n-t)throw new Md({offset:n,position:"end",size:we(e)})}function np(e,t,n,{strict:r}={}){ep(e,t);const o=e.slice(t,n);return r&&tp(o,t,n),o}function rp(e,t,n,{strict:r}={}){ep(e,t);const o=`0x${e.replace("0x","").slice((t??0)*2,(n??e.length)*2)}`;return r&&tp(o,t,n),o}const dE=/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/,op=/^(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 tn(e,t){if(e.length!==t.length)throw new yx({expectedLength:e.length,givenLength:t.length});const n=pE({params:e,values:t}),r=Ra(n);return r.length===0?"0x":r}function pE({params:e,values:t}){const n=[];for(let r=0;r<e.length;r++)n.push(Ba({param:e[r],value:t[r]}));return n}function Ba({param:e,value:t}){const n=Da(e.type);if(n){const[r,o]=n;return mE(t,{length:r,param:{...e,type:o}})}if(e.type==="tuple")return wE(t,{param:e});if(e.type==="address")return hE(t);if(e.type==="bool")return bE(t);if(e.type.startsWith("uint")||e.type.startsWith("int")){const r=e.type.startsWith("int"),[,,o="256"]=op.exec(e.type)??[];return yE(t,{signed:r,size:Number(o)})}if(e.type.startsWith("bytes"))return gE(t,{param:e});if(e.type==="string")return vE(t);throw new Px(e.type,{docsPath:"/docs/contract/encodeAbiParameters"})}function Ra(e){let t=0;for(let s=0;s<e.length;s++){const{dynamic:i,encoded:c}=e[s];i?t+=32:t+=we(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(Q(t+o,{size:32})),r.push(c),o+=we(c)):n.push(c)}return Et([...n,...r])}function hE(e){if(!ct(e))throw new bn({address:e});return{dynamic:!1,encoded:mn(e.toLowerCase())}}function mE(e,{length:t,param:n}){const r=t===null;if(!Array.isArray(e))throw new Nd(e);if(!r&&e.length!==t)throw new gx({expectedLength:t,givenLength:e.length,type:`${n.type}[${t}]`});let o=!1;const s=[];for(let i=0;i<e.length;i++){const c=Ba({param:n,value:e[i]});c.dynamic&&(o=!0),s.push(c)}if(r||o){const i=Ra(s);if(r){const c=Q(s.length,{size:32});return{dynamic:!0,encoded:s.length>0?Et([c,i]):c}}if(o)return{dynamic:!0,encoded:i}}return{dynamic:!1,encoded:Et(s.map(({encoded:i})=>i))}}function gE(e,{param:t}){const[,n]=t.type.split("bytes"),r=we(e);if(!n){let o=e;return r%32!==0&&(o=mn(o,{dir:"right",size:Math.ceil((e.length-2)/2/32)*32})),{dynamic:!0,encoded:Et([mn(Q(r,{size:32})),o])}}if(r!==Number.parseInt(n))throw new bx({expectedSize:Number.parseInt(n),value:e});return{dynamic:!1,encoded:mn(e,{dir:"right"})}}function bE(e){if(typeof e!="boolean")throw new H(`Invalid boolean value: "${e}" (type: ${typeof e}). Expected: \`true\` or \`false\`.`);return{dynamic:!1,encoded:mn(Rd(e))}}function yE(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 Bd({max:r.toString(),min:o.toString(),signed:t,size:n/8,value:e.toString()})}return{dynamic:!1,encoded:Q(e,{size:32,signed:t})}}function vE(e){const t=qr(e),n=Math.ceil(we(t)/32),r=[];for(let o=0;o<n;o++)r.push(mn(lr(t,o*32,(o+1)*32),{dir:"right"}));return{dynamic:!0,encoded:Et([mn(Q(we(t),{size:32})),...r])}}function wE(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=Ba({param:s,value:e[i]});r.push(c),c.dynamic&&(n=!0)}return{dynamic:n,encoded:n?Ra(r):Et(r.map(({encoded:o})=>o))}}function Da(e){const t=e.match(/^(.*)\[(\d+)?\]$/);return t?[t[2]?Number(t[2]):null,t[1]]:void 0}const Yr=e=>lr(Jd(e),0,4);function Mn(e){const{abi:t,args:n=[],name:r}=e,o=vt(r,{strict:!1}),s=t.filter(c=>o?c.type==="function"?Yr(c)===r:c.type==="event"?Ps(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?Fa(u,f):!1})){if(i&&"inputs"in i&&i.inputs){const u=sp(c.inputs,i.inputs,n);if(u)throw new Ex({abiItem:c,type:u[0]},{abiItem:i,type:u[1]})}i=c}}return i||s[0]}function Fa(e,t){const n=typeof e,r=t.type;switch(r){case"address":return ct(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)=>Fa(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=>Fa(o,{...t,type:r.replace(/(\[[0-9]{0,}\])$/,"")})):!1}}function sp(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 sp(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")?ct(n[r],{strict:!1}):i.includes("address")&&i.includes("bytes")?ct(n[r],{strict:!1}):!1)return i}}const ip="/docs/contract/encodeEventTopics";function Xr(e){var a;const{abi:t,eventName:n,args:r}=e;let o=t[0];if(n){const u=Mn({abi:t,name:n});if(!u)throw new Od(n,{docsPath:ip});o=u}if(o.type!=="event")throw new Od(void 0,{docsPath:ip});const s=yt(o),i=Ps(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)=>ap({param:f,value:l[p][h]})):typeof l[p]<"u"&&l[p]!==null?ap({param:f,value:l[p]}):null))??[])}return[i,...c]}function ap({param:e,value:t}){if(e.type==="string"||e.type==="bytes")return Ie(or(t));if(e.type==="tuple"||e.type.match(/^(.*)\[(\d+)?\]$/))throw new Ax(e.type);return tn([e],[t])}function Ts(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 cp(e,t){const{address:n,abi:r,args:o,eventName:s,fromBlock:i,strict:c,toBlock:a}=t,u=Ts(e,{method:"eth_newFilter"}),l=s?Xr({abi:r,args:o,eventName:s}):void 0,f=await e.request({method:"eth_newFilter",params:[{address:n,fromBlock:typeof i=="bigint"?Q(i):i,toBlock:typeof a=="bigint"?Q(a):a,topics:l}]});return{abi:r,args:o,eventName:s,id:f,request:u(f),strict:!!c,type:"event"}}function St(e){return typeof e=="string"?{address:e,type:"json-rpc"}:e}const up="/docs/contract/encodeFunctionData";function xE(e){const{abi:t,args:n,functionName:r}=e;let o=t[0];if(r){const s=Mn({abi:t,args:n,name:r});if(!s)throw new nr(r,{docsPath:up});o=s}if(o.type!=="function")throw new nr(void 0,{docsPath:up});return{abi:[o],functionName:Yr(yt(o))}}function Ft(e){const{args:t}=e,{abi:n,functionName:r}=(()=>{var c;return e.abi.length===1&&((c=e.functionName)!=null&&c.startsWith("0x"))?e:xE(e)})(),o=n[0],s=r,i="inputs"in o&&o.inputs?tn(o.inputs,t??[]):void 0;return ur([s,i??"0x"])}const lp={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."},fp={inputs:[{name:"message",type:"string"}],name:"Error",type:"error"},EE={inputs:[{name:"reason",type:"uint256"}],name:"Panic",type:"error"};class dp extends H{constructor({offset:t}){super(`Offset \`${t}\` cannot be negative.`,{name:"NegativeOffsetError"})}}class pp extends H{constructor({length:t,position:n}){super(`Position \`${n}\` is out of bounds (\`0 < position < ${t}\`).`,{name:"PositionOutOfBoundsError"})}}class SE extends H{constructor({count:t,limit:n}){super(`Recursive read limit of \`${n}\` exceeded (recursive read count: \`${t}\`).`,{name:"RecursiveReadLimitExceededError"})}}const PE={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 SE({count:this.recursiveReadCount+1,limit:this.recursiveReadLimit})},assertPosition(e){if(e<0||e>this.bytes.length-1)throw new pp({length:this.bytes.length,position:e})},decrementPosition(e){if(e<0)throw new dp({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 dp({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 ja(e,{recursiveReadLimit:t=8192}={}){const n=Object.create(PE);return n.bytes=e,n.dataView=new DataView(e.buffer,e.byteOffset,e.byteLength),n.positionReadCount=new Map,n.recursiveReadLimit=t,n}function $E(e,t={}){typeof t.size<"u"&&wt(e,{size:t.size});const n=$e(e,t);return Rt(n,t)}function TE(e,t={}){let n=e;if(typeof t.size<"u"&&(wt(n,{size:t.size}),n=In(n)),n.length>1||n[0]>1)throw new Ox(n);return!!n[0]}function nn(e,t={}){typeof t.size<"u"&&wt(e,{size:t.size});const n=$e(e,t);return Yt(n,t)}function AE(e,t={}){let n=e;return typeof t.size<"u"&&(wt(n,{size:t.size}),n=In(n,{dir:"right"})),new TextDecoder().decode(n)}function Qr(e,t){const n=typeof t=="string"?xt(t):t,r=ja(n);if(we(n)===0&&e.length>0)throw new Vr;if(we(t)&&we(t)<32)throw new $d({data:typeof t=="string"?t:$e(t),params:e,size:we(t)});let o=0;const s=[];for(let i=0;i<e.length;++i){const c=e[i];r.setPosition(o);const[a,u]=fr(r,c,{staticPosition:0});o+=u,s.push(a)}return s}function fr(e,t,{staticPosition:n}){const r=Da(t.type);if(r){const[o,s]=r;return OE(e,{...t,type:s},{length:o,staticPosition:n})}if(t.type==="tuple")return kE(e,t,{staticPosition:n});if(t.type==="address")return CE(e);if(t.type==="bool")return IE(e);if(t.type.startsWith("bytes"))return NE(e,t,{staticPosition:n});if(t.type.startsWith("uint")||t.type.startsWith("int"))return ME(e,t);if(t.type==="string")return LE(e,{staticPosition:n});throw new $x(t.type,{docsPath:"/docs/contract/decodeAbiParameters"})}const hp=32,_a=32;function CE(e){const t=e.readBytes(32);return[$s($e(np(t,-20))),32]}function OE(e,t,{length:n,staticPosition:r}){if(!n){const i=nn(e.readBytes(_a)),c=r+i,a=c+hp;e.setPosition(c);const u=nn(e.readBytes(hp)),l=Jr(t);let f=0;const p=[];for(let d=0;d<u;++d){e.setPosition(a+(l?d*32:f));const[h,m]=fr(e,t,{staticPosition:a});f+=m,p.push(h)}return e.setPosition(r+32),[p,32]}if(Jr(t)){const i=nn(e.readBytes(_a)),c=r+i,a=[];for(let u=0;u<n;++u){e.setPosition(c+u*32);const[l]=fr(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]=fr(e,t,{staticPosition:r+o});o+=a,s.push(c)}return[s,o]}function IE(e){return[TE(e.readBytes(32),{size:32}),32]}function NE(e,t,{staticPosition:n}){const[r,o]=t.type.split("bytes");if(!o){const i=nn(e.readBytes(32));e.setPosition(n+i);const c=nn(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 ME(e,t){const n=t.type.startsWith("int"),r=Number.parseInt(t.type.split("int")[1]||"256"),o=e.readBytes(32);return[r>48?$E(o,{signed:n}):nn(o,{signed:n}),32]}function kE(e,t,{staticPosition:n}){const r=t.components.length===0||t.components.some(({name:i})=>!i),o=r?[]:{};let s=0;if(Jr(t)){const i=nn(e.readBytes(_a)),c=n+i;for(let a=0;a<t.components.length;++a){const u=t.components[a];e.setPosition(c+s);const[l,f]=fr(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]=fr(e,c,{staticPosition:n});o[r?i:c==null?void 0:c.name]=a,s+=u}return[o,s]}function LE(e,{staticPosition:t}){const n=nn(e.readBytes(32)),r=t+n;e.setPosition(r);const o=nn(e.readBytes(32));if(o===0)return e.setPosition(t+32),["",32];const s=e.readBytes(o,32),i=AE(In(s));return e.setPosition(t+32),[i,32]}function Jr(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(Jr);const n=Da(e.type);return!!(n&&Jr({...e,type:n[1]}))}function mp(e){const{abi:t,data:n}=e,r=lr(n,0,4);if(r==="0x")throw new Vr;const s=[...t||[],fp,EE].find(i=>i.type==="error"&&r===Yr(yt(i)));if(!s)throw new Ad(r,{docsPath:"/docs/contract/decodeErrorResult"});return{abiItem:s,args:"inputs"in s&&s.inputs&&s.inputs.length>0?Qr(s.inputs,lr(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 gp({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 BE={gwei:9,wei:18},RE={ether:-9,wei:9};function Ua(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 bp(e,t="wei"){return Ua(e,BE[t])}function Pt(e,t="wei"){return Ua(e,RE[t])}class DE extends H{constructor({address:t}){super(`State for account "${t}" is set multiple times.`,{name:"AccountStateConflictError"})}}class FE extends H{constructor(){super("state and stateDiff are set on the same account.",{name:"StateAssignmentConflictError"})}}function yp(e){return e.reduce((t,{slot:n,value:r})=>`${t} ${n}: ${r}
131
+ `,"")}function jE(e){return e.reduce((t,{address:n,...r})=>{let o=`${t} ${n}:
142
132
  `;return r.nonce&&(o+=` nonce: ${r.nonce}
143
133
  `),r.balance&&(o+=` balance: ${r.balance}
144
134
  `),r.code&&(o+=` code: ${r.code}
145
135
  `),r.state&&(o+=` state:
146
- `,o+=vp(r.state)),r.stateDiff&&(o+=` stateDiff:
147
- `,o+=vp(r.stateDiff)),o},` State Override:
136
+ `,o+=yp(r.state)),r.stateDiff&&(o+=` stateDiff:
137
+ `,o+=yp(r.stateDiff)),o},` State Override:
148
138
  `).slice(0,-1)}function As(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(`
149
- `)}class DE extends H{constructor(){super(["Cannot specify both a `gasPrice` and a `maxFeePerGas`/`maxPriorityFeePerGas`.","Use `maxFeePerGas`/`maxPriorityFeePerGas` for EIP-1559 compatible networks, and `gasPrice` for others."].join(`
150
- `),{name:"FeeConflictError"})}}class jE extends H{constructor({transaction:t}){super("Cannot infer a transaction type from provided transaction.",{metaMessages:["Provided Transaction:","{",As(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 wp extends H{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 xp extends H{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 _E extends H{constructor({hash:t}){super(`Timed out while waiting for transaction with hash "${t}" to be confirmed.`,{name:"WaitForTransactionReceiptTimeoutError"})}}const UE=e=>e,eo=e=>e;class Ep extends H{constructor(t,{account:n,docsPath:r,chain:o,data:s,gas:i,gasPrice:c,maxFeePerGas:a,maxPriorityFeePerGas:u,nonce:l,to:f,value:p,stateOverride:d}){var v;const h=n?St(n):void 0;let m=As({from:h==null?void 0:h.address,to:f,value:typeof p<"u"&&`${yp(p)} ${((v=o==null?void 0:o.nativeCurrency)==null?void 0:v.symbol)||"ETH"}`,data:s,gas:i,gasPrice:typeof c<"u"&&`${Pt(c)} gwei`,maxFeePerGas:typeof a<"u"&&`${Pt(a)} gwei`,maxPriorityFeePerGas:typeof u<"u"&&`${Pt(u)} gwei`,nonce:l});d&&(m+=`
151
- ${FE(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 zE extends H{constructor(t,{abi:n,args:r,contractAddress:o,docsPath:s,functionName:i,sender:c}){const a=Ln({abi:n,args:r,name:i}),u=a?bp({abiItem:a,args:r,includeFunctionName:!1,includeName:!1}):void 0,l=a?yt(a,{includeName:!0}):void 0,f=As({address:o&&UE(o),function:l,args:u&&u!=="()"&&`${[...Array((i==null?void 0:i.length)??0).keys()].map(()=>" ").join("")}${u}`,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 za extends H{constructor({abi:t,data:n,functionName:r,message:o}){let s,i,c,a;if(n&&n!=="0x")try{i=gp({abi:t,data:n});const{abiItem:l,errorName:f,args:p}=i;if(f==="Error")a=p[0];else if(f==="Panic"){const[d]=p;a=fp[d]}else{const d=l?yt(l,{includeName:!0}):void 0,h=l&&p?bp({abiItem:l,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(l){s=l}else o&&(a=o);let u;s instanceof Cd&&(u=s.signature,c=[`Unable to decode signature "${u}" 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=${u}.`]),super(a&&a!=="execution reverted"||u?[`The contract function "${r}" reverted with the following ${u?"signature":"reason"}:`,a||u].join(`
152
- `):`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=u}}class WE extends H{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 HE extends H{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 Ts extends H{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 Bn extends H{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: ${eo(i)}`,t&&`Request body: ${Ae(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 Wa extends H{constructor({body:t,error:n,url:r}){super("RPC Request failed.",{cause:n,details:n.message,metaMessages:[`URL: ${eo(r)}`,`Request body: ${Ae(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}),this.code=n.code,this.data=n.data}}class Sp extends H{constructor({body:t,url:n}){super("The request took too long to respond.",{details:"The request timed out.",metaMessages:[`URL: ${eo(n)}`,`Request body: ${Ae(t)}`],name:"TimeoutError"})}}const VE=-1;class Ue extends H{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 Wa?t.code:n??VE}}class Ye extends Ue{constructor(t,n){super(t,n),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.data=n.data}}class to extends Ue{constructor(t){super(t,{code:to.code,name:"ParseRpcError",shortMessage:"Invalid JSON was received by the server. An error occurred on the server while parsing the JSON text."})}}Object.defineProperty(to,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32700});class no extends Ue{constructor(t){super(t,{code:no.code,name:"InvalidRequestRpcError",shortMessage:"JSON is not a valid request object."})}}Object.defineProperty(no,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32600});class ro extends Ue{constructor(t,{method:n}={}){super(t,{code:ro.code,name:"MethodNotFoundRpcError",shortMessage:`The method${n?` "${n}"`:""} does not exist / is not available.`})}}Object.defineProperty(ro,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32601});class oo extends Ue{constructor(t){super(t,{code:oo.code,name:"InvalidParamsRpcError",shortMessage:["Invalid parameters were provided to the RPC method.","Double check you have provided the correct parameters."].join(`
153
- `)})}}Object.defineProperty(oo,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32602});class kn extends Ue{constructor(t){super(t,{code:kn.code,name:"InternalRpcError",shortMessage:"An internal error was received."})}}Object.defineProperty(kn,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32603});class Rn extends Ue{constructor(t){super(t,{code:Rn.code,name:"InvalidInputRpcError",shortMessage:["Missing or invalid parameters.","Double check you have provided the correct parameters."].join(`
154
- `)})}}Object.defineProperty(Rn,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32e3});class so extends Ue{constructor(t){super(t,{code:so.code,name:"ResourceNotFoundRpcError",shortMessage:"Requested resource not found."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ResourceNotFoundRpcError"})}}Object.defineProperty(so,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32001});class io extends Ue{constructor(t){super(t,{code:io.code,name:"ResourceUnavailableRpcError",shortMessage:"Requested resource not available."})}}Object.defineProperty(io,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32002});class ao extends Ue{constructor(t){super(t,{code:ao.code,name:"TransactionRejectedRpcError",shortMessage:"Transaction creation failed."})}}Object.defineProperty(ao,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32003});class Fn extends Ue{constructor(t,{method:n}={}){super(t,{code:Fn.code,name:"MethodNotSupportedRpcError",shortMessage:`Method${n?` "${n}"`:""} is not supported.`})}}Object.defineProperty(Fn,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32004});class dr extends Ue{constructor(t){super(t,{code:dr.code,name:"LimitExceededRpcError",shortMessage:"Request exceeds defined limit."})}}Object.defineProperty(dr,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32005});class co extends Ue{constructor(t){super(t,{code:co.code,name:"JsonRpcVersionUnsupportedError",shortMessage:"Version of JSON-RPC protocol is not supported."})}}Object.defineProperty(co,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32006});class pr extends Ye{constructor(t){super(t,{code:pr.code,name:"UserRejectedRequestError",shortMessage:"User rejected the request."})}}Object.defineProperty(pr,"code",{enumerable:!0,configurable:!0,writable:!0,value:4001});class uo extends Ye{constructor(t){super(t,{code:uo.code,name:"UnauthorizedProviderError",shortMessage:"The requested method and/or account has not been authorized by the user."})}}Object.defineProperty(uo,"code",{enumerable:!0,configurable:!0,writable:!0,value:4100});class lo extends Ye{constructor(t,{method:n}={}){super(t,{code:lo.code,name:"UnsupportedProviderMethodError",shortMessage:`The Provider does not support the requested method${n?` " ${n}"`:""}.`})}}Object.defineProperty(lo,"code",{enumerable:!0,configurable:!0,writable:!0,value:4200});class fo extends Ye{constructor(t){super(t,{code:fo.code,name:"ProviderDisconnectedError",shortMessage:"The Provider is disconnected from all chains."})}}Object.defineProperty(fo,"code",{enumerable:!0,configurable:!0,writable:!0,value:4900});class po extends Ye{constructor(t){super(t,{code:po.code,name:"ChainDisconnectedError",shortMessage:"The Provider is not connected to the requested chain."})}}Object.defineProperty(po,"code",{enumerable:!0,configurable:!0,writable:!0,value:4901});class ho extends Ye{constructor(t){super(t,{code:ho.code,name:"SwitchChainError",shortMessage:"An error occurred when attempting to switch chain."})}}Object.defineProperty(ho,"code",{enumerable:!0,configurable:!0,writable:!0,value:4902});class mo extends Ye{constructor(t){super(t,{code:mo.code,name:"UnsupportedNonOptionalCapabilityError",shortMessage:"This Wallet does not support a capability that was not marked as optional."})}}Object.defineProperty(mo,"code",{enumerable:!0,configurable:!0,writable:!0,value:5700});class go extends Ye{constructor(t){super(t,{code:go.code,name:"UnsupportedChainIdError",shortMessage:"This Wallet does not support the requested chain ID."})}}Object.defineProperty(go,"code",{enumerable:!0,configurable:!0,writable:!0,value:5710});class bo extends Ye{constructor(t){super(t,{code:bo.code,name:"DuplicateIdError",shortMessage:"There is already a bundle submitted with this ID."})}}Object.defineProperty(bo,"code",{enumerable:!0,configurable:!0,writable:!0,value:5720});class yo extends Ye{constructor(t){super(t,{code:yo.code,name:"UnknownBundleIdError",shortMessage:"This bundle id is unknown / has not been submitted"})}}Object.defineProperty(yo,"code",{enumerable:!0,configurable:!0,writable:!0,value:5730});class vo extends Ye{constructor(t){super(t,{code:vo.code,name:"BundleTooLargeError",shortMessage:"The call bundle is too large for the Wallet to process."})}}Object.defineProperty(vo,"code",{enumerable:!0,configurable:!0,writable:!0,value:5740});class wo extends Ye{constructor(t){super(t,{code:wo.code,name:"AtomicReadyWalletRejectedUpgradeError",shortMessage:"The Wallet can support atomicity after an upgrade, but the user rejected the upgrade."})}}Object.defineProperty(wo,"code",{enumerable:!0,configurable:!0,writable:!0,value:5750});class xo extends Ye{constructor(t){super(t,{code:xo.code,name:"AtomicityNotSupportedError",shortMessage:"The wallet does not support atomic execution but the request requires it."})}}Object.defineProperty(xo,"code",{enumerable:!0,configurable:!0,writable:!0,value:5760});class GE extends Ue{constructor(t){super(t,{name:"UnknownRpcError",shortMessage:"An unknown RPC error occurred."})}}const qE=3;function hr(e,{abi:t,address:n,args:r,docsPath:o,functionName:s,sender:i}){const c=e instanceof Ts?e:e instanceof H?e.walk(h=>"data"in h)||e.walk():{},{code:a,data:u,details:l,message:f,shortMessage:p}=c,d=e instanceof Vr?new WE({functionName:s}):[qE,kn.code].includes(a)&&(u||l||f||p)?new za({abi:t,data:typeof u=="object"?u.data:u,functionName:s,message:c instanceof Wa?l:p??f}):e;return new zE(d,{abi:t,args:r,contractAddress:n,docsPath:o,functionName:s,sender:i})}function ZE(e){const t=Ne(`0x${e.substring(4)}`).substring(26);return Ps(`0x${t}`)}async function KE({hash:e,signature:t}){const n=vt(e)?e:Kt(e),{secp256k1:r}=await Promise.resolve().then(()=>DS);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=Pp(d);return new r.Signature(Bt(u),Bt(l)).addRecoveryBit(h)}const i=vt(t)?t:Kt(t);if(we(i)!==65)throw new Error("invalid signature length");const c=Zt(`0x${i.slice(130)}`),a=Pp(c);return r.Signature.fromCompact(i.substring(2,130)).addRecoveryBit(a)})().recoverPublicKey(n.substring(2)).toHex(!1)}`}function Pp(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 $p({hash:e,signature:t}){return ZE(await KE({hash:e,signature:t}))}function YE(e,t="hex"){const n=Ap(e),r=ja(new Uint8Array(n.length));return n.encode(r),t==="hex"?$e(r.bytes):r.bytes}function Ap(e){return Array.isArray(e)?XE(e.map(t=>Ap(t))):QE(e)}function XE(e){const t=e.reduce((o,s)=>o+s.length,0),n=Tp(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 QE(e){const t=typeof e=="string"?xt(e):e,n=Tp(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 Tp(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 H("Length is too large.")}function JE(e){const{chainId:t,nonce:n,to:r}=e,o=e.contractAddress??e.address,s=Ne(ur(["0x05",YE([t?Q(t):"0x",o,n?Q(n):"0x"])]));return r==="bytes"?xt(s):s}async function e2(e){const{authorization:t,signature:n}=e;return $p({hash:JE(t),signature:n??t})}class t2 extends H{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=As({from:n==null?void 0:n.address,to:f,value:typeof p<"u"&&`${yp(p)} ${((h=o==null?void 0:o.nativeCurrency)==null?void 0:h.symbol)||"ETH"}`,data:s,gas:i,gasPrice:typeof c<"u"&&`${Pt(c)} gwei`,maxFeePerGas:typeof a<"u"&&`${Pt(a)} gwei`,maxPriorityFeePerGas:typeof u<"u"&&`${Pt(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 mr extends H{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(mr,"code",{enumerable:!0,configurable:!0,writable:!0,value:3}),Object.defineProperty(mr,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/execution reverted/});class Cs extends H{constructor({cause:t,maxFeePerGas:n}={}){super(`The fee cap (\`maxFeePerGas\`${n?` = ${Pt(n)} gwei`:""}) cannot be higher than the maximum allowed value (2^256-1).`,{cause:t,name:"FeeCapTooHighError"})}}Object.defineProperty(Cs,"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 Ha extends H{constructor({cause:t,maxFeePerGas:n}={}){super(`The fee cap (\`maxFeePerGas\`${n?` = ${Pt(n)}`:""} gwei) cannot be lower than the block base fee.`,{cause:t,name:"FeeCapTooLowError"})}}Object.defineProperty(Ha,"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 Va extends H{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(Va,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/nonce too high/});class Ga extends H{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(`
139
+ `)}class _E extends H{constructor(){super(["Cannot specify both a `gasPrice` and a `maxFeePerGas`/`maxPriorityFeePerGas`.","Use `maxFeePerGas`/`maxPriorityFeePerGas` for EIP-1559 compatible networks, and `gasPrice` for others."].join(`
140
+ `),{name:"FeeConflictError"})}}class UE extends H{constructor({transaction:t}){super("Cannot infer a transaction type from provided transaction.",{metaMessages:["Provided Transaction:","{",As(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 vp extends H{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 wp extends H{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 zE extends H{constructor({hash:t}){super(`Timed out while waiting for transaction with hash "${t}" to be confirmed.`,{name:"WaitForTransactionReceiptTimeoutError"})}}const WE=e=>e,eo=e=>e;class xp extends H{constructor(t,{account:n,docsPath:r,chain:o,data:s,gas:i,gasPrice:c,maxFeePerGas:a,maxPriorityFeePerGas:u,nonce:l,to:f,value:p,stateOverride:d}){var y;const h=n?St(n):void 0;let m=As({from:h==null?void 0:h.address,to:f,value:typeof p<"u"&&`${bp(p)} ${((y=o==null?void 0:o.nativeCurrency)==null?void 0:y.symbol)||"ETH"}`,data:s,gas:i,gasPrice:typeof c<"u"&&`${Pt(c)} gwei`,maxFeePerGas:typeof a<"u"&&`${Pt(a)} gwei`,maxPriorityFeePerGas:typeof u<"u"&&`${Pt(u)} gwei`,nonce:l});d&&(m+=`
141
+ ${jE(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 HE extends H{constructor(t,{abi:n,args:r,contractAddress:o,docsPath:s,functionName:i,sender:c}){const a=Mn({abi:n,args:r,name:i}),u=a?gp({abiItem:a,args:r,includeFunctionName:!1,includeName:!1}):void 0,l=a?yt(a,{includeName:!0}):void 0,f=As({address:o&&WE(o),function:l,args:u&&u!=="()"&&`${[...Array((i==null?void 0:i.length)??0).keys()].map(()=>" ").join("")}${u}`,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 za extends H{constructor({abi:t,data:n,functionName:r,message:o}){let s,i,c,a;if(n&&n!=="0x")try{i=mp({abi:t,data:n});const{abiItem:l,errorName:f,args:p}=i;if(f==="Error")a=p[0];else if(f==="Panic"){const[d]=p;a=lp[d]}else{const d=l?yt(l,{includeName:!0}):void 0,h=l&&p?gp({abiItem:l,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(l){s=l}else o&&(a=o);let u;s instanceof Ad&&(u=s.signature,c=[`Unable to decode signature "${u}" 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=${u}.`]),super(a&&a!=="execution reverted"||u?[`The contract function "${r}" reverted with the following ${u?"signature":"reason"}:`,a||u].join(`
142
+ `):`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=u}}class VE extends H{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 GE extends H{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 Cs extends H{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 kn extends H{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: ${eo(i)}`,t&&`Request body: ${Te(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 Wa extends H{constructor({body:t,error:n,url:r}){super("RPC Request failed.",{cause:n,details:n.message,metaMessages:[`URL: ${eo(r)}`,`Request body: ${Te(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}),this.code=n.code,this.data=n.data}}class Ep extends H{constructor({body:t,url:n}){super("The request took too long to respond.",{details:"The request timed out.",metaMessages:[`URL: ${eo(n)}`,`Request body: ${Te(t)}`],name:"TimeoutError"})}}const qE=-1;class Ue extends H{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 Wa?t.code:n??qE}}class Ye extends Ue{constructor(t,n){super(t,n),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.data=n.data}}class to extends Ue{constructor(t){super(t,{code:to.code,name:"ParseRpcError",shortMessage:"Invalid JSON was received by the server. An error occurred on the server while parsing the JSON text."})}}Object.defineProperty(to,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32700});class no extends Ue{constructor(t){super(t,{code:no.code,name:"InvalidRequestRpcError",shortMessage:"JSON is not a valid request object."})}}Object.defineProperty(no,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32600});class ro extends Ue{constructor(t,{method:n}={}){super(t,{code:ro.code,name:"MethodNotFoundRpcError",shortMessage:`The method${n?` "${n}"`:""} does not exist / is not available.`})}}Object.defineProperty(ro,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32601});class oo extends Ue{constructor(t){super(t,{code:oo.code,name:"InvalidParamsRpcError",shortMessage:["Invalid parameters were provided to the RPC method.","Double check you have provided the correct parameters."].join(`
143
+ `)})}}Object.defineProperty(oo,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32602});class Ln extends Ue{constructor(t){super(t,{code:Ln.code,name:"InternalRpcError",shortMessage:"An internal error was received."})}}Object.defineProperty(Ln,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32603});class Bn extends Ue{constructor(t){super(t,{code:Bn.code,name:"InvalidInputRpcError",shortMessage:["Missing or invalid parameters.","Double check you have provided the correct parameters."].join(`
144
+ `)})}}Object.defineProperty(Bn,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32e3});class so extends Ue{constructor(t){super(t,{code:so.code,name:"ResourceNotFoundRpcError",shortMessage:"Requested resource not found."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ResourceNotFoundRpcError"})}}Object.defineProperty(so,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32001});class io extends Ue{constructor(t){super(t,{code:io.code,name:"ResourceUnavailableRpcError",shortMessage:"Requested resource not available."})}}Object.defineProperty(io,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32002});class ao extends Ue{constructor(t){super(t,{code:ao.code,name:"TransactionRejectedRpcError",shortMessage:"Transaction creation failed."})}}Object.defineProperty(ao,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32003});class Rn extends Ue{constructor(t,{method:n}={}){super(t,{code:Rn.code,name:"MethodNotSupportedRpcError",shortMessage:`Method${n?` "${n}"`:""} is not supported.`})}}Object.defineProperty(Rn,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32004});class dr extends Ue{constructor(t){super(t,{code:dr.code,name:"LimitExceededRpcError",shortMessage:"Request exceeds defined limit."})}}Object.defineProperty(dr,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32005});class co extends Ue{constructor(t){super(t,{code:co.code,name:"JsonRpcVersionUnsupportedError",shortMessage:"Version of JSON-RPC protocol is not supported."})}}Object.defineProperty(co,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32006});class pr extends Ye{constructor(t){super(t,{code:pr.code,name:"UserRejectedRequestError",shortMessage:"User rejected the request."})}}Object.defineProperty(pr,"code",{enumerable:!0,configurable:!0,writable:!0,value:4001});class uo extends Ye{constructor(t){super(t,{code:uo.code,name:"UnauthorizedProviderError",shortMessage:"The requested method and/or account has not been authorized by the user."})}}Object.defineProperty(uo,"code",{enumerable:!0,configurable:!0,writable:!0,value:4100});class lo extends Ye{constructor(t,{method:n}={}){super(t,{code:lo.code,name:"UnsupportedProviderMethodError",shortMessage:`The Provider does not support the requested method${n?` " ${n}"`:""}.`})}}Object.defineProperty(lo,"code",{enumerable:!0,configurable:!0,writable:!0,value:4200});class fo extends Ye{constructor(t){super(t,{code:fo.code,name:"ProviderDisconnectedError",shortMessage:"The Provider is disconnected from all chains."})}}Object.defineProperty(fo,"code",{enumerable:!0,configurable:!0,writable:!0,value:4900});class po extends Ye{constructor(t){super(t,{code:po.code,name:"ChainDisconnectedError",shortMessage:"The Provider is not connected to the requested chain."})}}Object.defineProperty(po,"code",{enumerable:!0,configurable:!0,writable:!0,value:4901});class ho extends Ye{constructor(t){super(t,{code:ho.code,name:"SwitchChainError",shortMessage:"An error occurred when attempting to switch chain."})}}Object.defineProperty(ho,"code",{enumerable:!0,configurable:!0,writable:!0,value:4902});class mo extends Ye{constructor(t){super(t,{code:mo.code,name:"UnsupportedNonOptionalCapabilityError",shortMessage:"This Wallet does not support a capability that was not marked as optional."})}}Object.defineProperty(mo,"code",{enumerable:!0,configurable:!0,writable:!0,value:5700});class go extends Ye{constructor(t){super(t,{code:go.code,name:"UnsupportedChainIdError",shortMessage:"This Wallet does not support the requested chain ID."})}}Object.defineProperty(go,"code",{enumerable:!0,configurable:!0,writable:!0,value:5710});class bo extends Ye{constructor(t){super(t,{code:bo.code,name:"DuplicateIdError",shortMessage:"There is already a bundle submitted with this ID."})}}Object.defineProperty(bo,"code",{enumerable:!0,configurable:!0,writable:!0,value:5720});class yo extends Ye{constructor(t){super(t,{code:yo.code,name:"UnknownBundleIdError",shortMessage:"This bundle id is unknown / has not been submitted"})}}Object.defineProperty(yo,"code",{enumerable:!0,configurable:!0,writable:!0,value:5730});class vo extends Ye{constructor(t){super(t,{code:vo.code,name:"BundleTooLargeError",shortMessage:"The call bundle is too large for the Wallet to process."})}}Object.defineProperty(vo,"code",{enumerable:!0,configurable:!0,writable:!0,value:5740});class wo extends Ye{constructor(t){super(t,{code:wo.code,name:"AtomicReadyWalletRejectedUpgradeError",shortMessage:"The Wallet can support atomicity after an upgrade, but the user rejected the upgrade."})}}Object.defineProperty(wo,"code",{enumerable:!0,configurable:!0,writable:!0,value:5750});class xo extends Ye{constructor(t){super(t,{code:xo.code,name:"AtomicityNotSupportedError",shortMessage:"The wallet does not support atomic execution but the request requires it."})}}Object.defineProperty(xo,"code",{enumerable:!0,configurable:!0,writable:!0,value:5760});class ZE extends Ue{constructor(t){super(t,{name:"UnknownRpcError",shortMessage:"An unknown RPC error occurred."})}}const KE=3;function hr(e,{abi:t,address:n,args:r,docsPath:o,functionName:s,sender:i}){const c=e instanceof Cs?e:e instanceof H?e.walk(h=>"data"in h)||e.walk():{},{code:a,data:u,details:l,message:f,shortMessage:p}=c,d=e instanceof Vr?new VE({functionName:s}):[KE,Ln.code].includes(a)&&(u||l||f||p)?new za({abi:t,data:typeof u=="object"?u.data:u,functionName:s,message:c instanceof Wa?l:p??f}):e;return new HE(d,{abi:t,args:r,contractAddress:n,docsPath:o,functionName:s,sender:i})}function YE(e){const t=Ie(`0x${e.substring(4)}`).substring(26);return $s(`0x${t}`)}async function XE({hash:e,signature:t}){const n=vt(e)?e:Xt(e),{secp256k1:r}=await Promise.resolve().then(()=>_S);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=Sp(d);return new r.Signature(Rt(u),Rt(l)).addRecoveryBit(h)}const i=vt(t)?t:Xt(t);if(we(i)!==65)throw new Error("invalid signature length");const c=Yt(`0x${i.slice(130)}`),a=Sp(c);return r.Signature.fromCompact(i.substring(2,130)).addRecoveryBit(a)})().recoverPublicKey(n.substring(2)).toHex(!1)}`}function Sp(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 Pp({hash:e,signature:t}){return YE(await XE({hash:e,signature:t}))}function QE(e,t="hex"){const n=$p(e),r=ja(new Uint8Array(n.length));return n.encode(r),t==="hex"?$e(r.bytes):r.bytes}function $p(e){return Array.isArray(e)?JE(e.map(t=>$p(t))):e2(e)}function JE(e){const t=e.reduce((o,s)=>o+s.length,0),n=Tp(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 e2(e){const t=typeof e=="string"?xt(e):e,n=Tp(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 Tp(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 H("Length is too large.")}function t2(e){const{chainId:t,nonce:n,to:r}=e,o=e.contractAddress??e.address,s=Ie(ur(["0x05",QE([t?Q(t):"0x",o,n?Q(n):"0x"])]));return r==="bytes"?xt(s):s}async function n2(e){const{authorization:t,signature:n}=e;return Pp({hash:t2(t),signature:n??t})}class r2 extends H{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=As({from:n==null?void 0:n.address,to:f,value:typeof p<"u"&&`${bp(p)} ${((h=o==null?void 0:o.nativeCurrency)==null?void 0:h.symbol)||"ETH"}`,data:s,gas:i,gasPrice:typeof c<"u"&&`${Pt(c)} gwei`,maxFeePerGas:typeof a<"u"&&`${Pt(a)} gwei`,maxPriorityFeePerGas:typeof u<"u"&&`${Pt(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 mr extends H{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(mr,"code",{enumerable:!0,configurable:!0,writable:!0,value:3}),Object.defineProperty(mr,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/execution reverted/});class Os extends H{constructor({cause:t,maxFeePerGas:n}={}){super(`The fee cap (\`maxFeePerGas\`${n?` = ${Pt(n)} gwei`:""}) cannot be higher than the maximum allowed value (2^256-1).`,{cause:t,name:"FeeCapTooHighError"})}}Object.defineProperty(Os,"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 Ha extends H{constructor({cause:t,maxFeePerGas:n}={}){super(`The fee cap (\`maxFeePerGas\`${n?` = ${Pt(n)}`:""} gwei) cannot be lower than the block base fee.`,{cause:t,name:"FeeCapTooLowError"})}}Object.defineProperty(Ha,"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 Va extends H{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(Va,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/nonce too high/});class Ga extends H{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(`
155
145
  `),{cause:t,name:"NonceTooLowError"})}}Object.defineProperty(Ga,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/nonce too low|transaction already imported|already known/});class qa extends H{constructor({cause:t,nonce:n}={}){super(`Nonce provided for the transaction ${n?`(${n}) `:""}exceeds the maximum allowed nonce.`,{cause:t,name:"NonceMaxValueError"})}}Object.defineProperty(qa,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/nonce has max value/});class Za extends H{constructor({cause:t}={}){super(["The total cost (gas * gas fee + value) of executing this transaction exceeds the balance of the account."].join(`
156
- `),{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(Za,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/insufficient funds|exceeds transaction sender account balance/});class Ka extends H{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(Ka,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/intrinsic gas too high|gas limit reached/});class Ya extends H{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(Ya,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/intrinsic gas too low/});class Xa extends H{constructor({cause:t}){super("The transaction type is not supported for this chain.",{cause:t,name:"TransactionTypeNotSupportedError"})}}Object.defineProperty(Xa,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/transaction type not valid/});class Os extends H{constructor({cause:t,maxPriorityFeePerGas:n,maxFeePerGas:r}={}){super([`The provided tip (\`maxPriorityFeePerGas\`${n?` = ${Pt(n)} gwei`:""}) cannot be higher than the fee cap (\`maxFeePerGas\`${r?` = ${Pt(r)} gwei`:""}).`].join(`
157
- `),{cause:t,name:"TipAboveFeeCapError"})}}Object.defineProperty(Os,"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 Ns extends H{constructor({cause:t}){super(`An error occurred while executing: ${t==null?void 0:t.shortMessage}`,{cause:t,name:"UnknownNodeError"})}}function Qa(e,t){const n=(e.details||"").toLowerCase(),r=e instanceof H?e.walk(o=>(o==null?void 0:o.code)===mr.code):e;return r instanceof H?new mr({cause:e,message:r.details}):mr.nodeMessage.test(n)?new mr({cause:e,message:e.details}):Cs.nodeMessage.test(n)?new Cs({cause:e,maxFeePerGas:t==null?void 0:t.maxFeePerGas}):Ha.nodeMessage.test(n)?new Ha({cause:e,maxFeePerGas:t==null?void 0:t.maxFeePerGas}):Va.nodeMessage.test(n)?new Va({cause:e,nonce:t==null?void 0:t.nonce}):Ga.nodeMessage.test(n)?new Ga({cause:e,nonce:t==null?void 0:t.nonce}):qa.nodeMessage.test(n)?new qa({cause:e,nonce:t==null?void 0:t.nonce}):Za.nodeMessage.test(n)?new Za({cause:e}):Ka.nodeMessage.test(n)?new Ka({cause:e,gas:t==null?void 0:t.gas}):Ya.nodeMessage.test(n)?new Ya({cause:e,gas:t==null?void 0:t.gas}):Xa.nodeMessage.test(n)?new Xa({cause:e}):Os.nodeMessage.test(n)?new Os({cause:e,maxFeePerGas:t==null?void 0:t.maxFeePerGas,maxPriorityFeePerGas:t==null?void 0:t.maxPriorityFeePerGas}):new Ns({cause:e})}function n2(e,{docsPath:t,...n}){const r=(()=>{const o=Qa(e,n);return o instanceof Ns?e:o})();return new t2(r,{docsPath:t,...n})}function Ja(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 r2={legacy:"0x0",eip2930:"0x1",eip1559:"0x2",eip4844:"0x3",eip7702:"0x4"};function Is(e){const t={};return typeof e.authorizationList<"u"&&(t.authorizationList=o2(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=Q(e.gas)),typeof e.gasPrice<"u"&&(t.gasPrice=Q(e.gasPrice)),typeof e.maxFeePerBlobGas<"u"&&(t.maxFeePerBlobGas=Q(e.maxFeePerBlobGas)),typeof e.maxFeePerGas<"u"&&(t.maxFeePerGas=Q(e.maxFeePerGas)),typeof e.maxPriorityFeePerGas<"u"&&(t.maxPriorityFeePerGas=Q(e.maxPriorityFeePerGas)),typeof e.nonce<"u"&&(t.nonce=Q(e.nonce)),typeof e.to<"u"&&(t.to=e.to),typeof e.type<"u"&&(t.type=r2[e.type]),typeof e.value<"u"&&(t.value=Q(e.value)),t}function o2(e){return e.map(t=>({address:t.address,r:t.r?Q(BigInt(t.r)):t.r,s:t.s?Q(BigInt(t.s)):t.s,chainId:Q(t.chainId),nonce:Q(t.nonce),...typeof t.yParity<"u"?{yParity:Q(t.yParity)}:{},...typeof t.v<"u"&&typeof t.yParity>"u"?{v:Q(t.v)}:{}}))}function Cp(e){if(!(!e||e.length===0))return e.reduce((t,{slot:n,value:r})=>{if(n.length!==66)throw new kd({size:n.length,targetSize:66,type:"hex"});if(r.length!==66)throw new kd({size:r.length,targetSize:66,type:"hex"});return t[n]=r,t},{})}function s2(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=Q(t)),n!==void 0&&(i.nonce=Q(n)),r!==void 0&&(i.state=Cp(r)),o!==void 0){if(i.state)throw new RE;i.stateDiff=Cp(o)}return i}function ec(e){if(!e)return;const t={};for(const{address:n,...r}of e){if(!ct(n,{strict:!1}))throw new yn({address:n});if(t[n])throw new kE({address:n});t[n]=s2(r)}return t}const i2=2n**256n-1n;function Eo(e){const{account:t,gasPrice:n,maxFeePerGas:r,maxPriorityFeePerGas:o,to:s}=e,i=t?St(t):void 0;if(i&&!ct(i.address))throw new yn({address:i.address});if(s&&!ct(s))throw new yn({address:s});if(typeof n<"u"&&(typeof r<"u"||typeof o<"u"))throw new DE;if(r&&r>i2)throw new Cs({maxFeePerGas:r});if(o&&r&&o>r)throw new Os({maxFeePerGas:r,maxPriorityFeePerGas:o})}class a2 extends H{constructor(){super("`baseFeeMultiplier` must be greater than 1.",{name:"BaseFeeScalarError"})}}class tc extends H{constructor(){super("Chain does not support EIP-1559 fees.",{name:"Eip1559FeesNotSupportedError"})}}class c2 extends H{constructor({maxPriorityFeePerGas:t}){super(`\`maxFeePerGas\` cannot be less than the \`maxPriorityFeePerGas\` (${Pt(t)} gwei).`,{name:"MaxFeePerGasTooLowError"})}}class Op extends H{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 Np={"0x0":"legacy","0x1":"eip2930","0x2":"eip1559","0x3":"eip4844","0x4":"eip7702"};function Ip(e){const t={...e,blockHash:e.blockHash?e.blockHash:null,blockNumber:e.blockNumber?BigInt(e.blockNumber):null,chainId:e.chainId?Zt(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?Zt(e.nonce):void 0,to:e.to?e.to:null,transactionIndex:e.transactionIndex?Number(e.transactionIndex):null,type:e.type?Np[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=u2(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 u2(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 Mp(e){const t=(e.transactions??[]).map(n=>typeof n=="string"?n:Ip(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 Ft(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?Q(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 Op({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)||Mp)(c)}async function nc(e){const t=await e.request({method:"eth_gasPrice"});return BigInt(t)}async function l2(e,t){return Lp(e,t)}async function Lp(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 J(e,Ft,"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 Bt(a)}catch{const[c,a]=await Promise.all([n?Promise.resolve(n):J(e,Ft,"getBlock")({}),J(e,nc,"getGasPrice")({})]);if(typeof c.baseFeePerGas!="bigint")throw new tc;const u=a-c.baseFeePerGas;return u<0n?0n:u}}async function f2(e,t){return rc(e,t)}async function rc(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 a2;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 J(e,Ft,"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 tc;const h=typeof(o==null?void 0:o.maxPriorityFeePerGas)=="bigint"?o.maxPriorityFeePerGas:await Lp(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 J(e,nc,"getGasPrice")({}))}}async function Bp(e,{address:t,blockTag:n="latest",blockNumber:r}){const o=await e.request({method:"eth_getTransactionCount",params:[t,typeof r=="bigint"?Q(r):n]},{dedupe:!!r});return Zt(o)}function kp(e){const{kzg:t}=e,n=e.to??(typeof e.blobs[0]=="string"?"hex":"bytes"),r=typeof e.blobs[0]=="string"?e.blobs.map(s=>xt(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 Rp(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=>xt(i)):e.blobs,o=typeof e.commitments[0]=="string"?e.commitments.map(i=>xt(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 d2(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 p2(e,t,n){return e&t^~e&n}function h2(e,t,n){return e&t^e&n^t&n}class m2 extends Na{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=Oa(this.buffer)}update(t){ir(this),t=Es(t),Xt(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=Oa(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){ir(this),Ud(t,this),this.finished=!0;const{buffer:n,view:r,blockLen:o,isLE:s}=this;let{pos:i}=this;n[i++]=128,ar(this.buffer.subarray(i)),this.padOffset>o-i&&(this.process(r,0),i=0);for(let f=i;f<o;f++)n[f]=0;d2(r,o-8,BigInt(this.length*8),s),this.process(r,0);const c=Oa(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 vn=Uint32Array.from([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),g2=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]),wn=new Uint32Array(64);class b2 extends m2{constructor(t=32){super(64,t,8,!1),this.A=vn[0]|0,this.B=vn[1]|0,this.C=vn[2]|0,this.D=vn[3]|0,this.E=vn[4]|0,this.F=vn[5]|0,this.G=vn[6]|0,this.H=vn[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)wn[f]=t.getUint32(n,!1);for(let f=16;f<64;f++){const p=wn[f-15],d=wn[f-2],h=kt(p,7)^kt(p,18)^p>>>3,m=kt(d,17)^kt(d,19)^d>>>10;wn[f]=m+wn[f-7]+h+wn[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=kt(c,6)^kt(c,11)^kt(c,25),d=l+p+p2(c,a,u)+g2[f]+wn[f]|0,m=(kt(r,2)^kt(r,13)^kt(r,22))+h2(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(){ar(wn)}destroy(){this.set(0,0,0,0,0,0,0,0),ar(this.buffer)}}const Fp=Vd(()=>new b2),y2=Fp;function v2(e,t){return y2(vt(e,{strict:!1})?or(e):e)}function w2(e){const{commitment:t,version:n=1}=e,r=e.to??(typeof t=="string"?"hex":"bytes"),o=v2(t);return o.set([n],0),r==="bytes"?o:$e(o)}function x2(e){const{commitments:t,version:n}=e,r=e.to,o=[];for(const s of t)o.push(w2({commitment:s,to:r,version:n}));return o}const Dp=6,jp=32,oc=4096,_p=jp*oc,Up=_p*Dp-1-1*oc*Dp;class E2 extends H{constructor({maxSize:t,size:n}){super("Blob size is too large.",{metaMessages:[`Max: ${t} bytes`,`Given: ${n} bytes`],name:"BlobSizeTooLargeError"})}}class S2 extends H{constructor(){super("Blob data must not be empty.",{name:"EmptyBlobError"})}}function P2(e){const t=typeof e.data=="string"?xt(e.data):e.data,n=we(t);if(!n)throw new S2;if(n>Up)throw new E2({maxSize:Up,size:n});const r=[];let o=!0,s=0;for(;o;){const i=ja(new Uint8Array(_p));let c=0;for(;c<oc;){const a=t.slice(s,s+(jp-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 $2(e){const{data:t,kzg:n,to:r}=e,o=e.blobs??P2({data:t}),s=e.commitments??kp({blobs:o,kzg:n,to:r}),i=e.proofs??Rp({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 A2(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 jE({transaction:e})}async function zp(e){const t=await e.request({method:"eth_chainId"},{dedupe:!0});return Zt(t)}const T2=["blobVersionedHashes","chainId","fees","gas","nonce","type"],Wp=new Map;async function Hp(e,t){const{account:n=e.account,blobs:r,chain:o,gas:s,kzg:i,nonce:c,nonceManager:a,parameters:u=T2,type:l}=t,f=n&&St(n),p={...t,...f?{from:f==null?void 0:f.address}:{}};let d;async function h(){return d||(d=await J(e,Ft,"getBlock")({blockTag:"latest"}),d)}let m;async function v(){return m||(o?o.id:typeof t.chainId<"u"?t.chainId:(m=await J(e,zp,"getChainId")({}),m))}if(u.includes("nonce")&&typeof c>"u"&&f)if(a){const C=await v();p.nonce=await a.consume({address:f.address,chainId:C,client:e})}else p.nonce=await J(e,Bp,"getTransactionCount")({address:f.address,blockTag:"pending"});if((u.includes("blobVersionedHashes")||u.includes("sidecars"))&&r&&i){const C=kp({blobs:r,kzg:i});if(u.includes("blobVersionedHashes")){const y=x2({commitments:C,to:"hex"});p.blobVersionedHashes=y}if(u.includes("sidecars")){const y=Rp({blobs:r,commitments:C,kzg:i}),$=$2({blobs:r,commitments:C,proofs:y,to:"hex"});p.sidecars=$}}if(u.includes("chainId")&&(p.chainId=await v()),(u.includes("fees")||u.includes("type"))&&typeof l>"u")try{p.type=A2(p)}catch{let C=Wp.get(e.uid);if(typeof C>"u"){const y=await h();C=typeof(y==null?void 0:y.baseFeePerGas)=="bigint",Wp.set(e.uid,C)}p.type=C?"eip1559":"legacy"}if(u.includes("fees"))if(p.type!=="legacy"&&p.type!=="eip2930"){if(typeof p.maxFeePerGas>"u"||typeof p.maxPriorityFeePerGas>"u"){const C=await h(),{maxFeePerGas:y,maxPriorityFeePerGas:$}=await rc(e,{block:C,chain:o,request:p});if(typeof t.maxPriorityFeePerGas>"u"&&t.maxFeePerGas&&t.maxFeePerGas<$)throw new c2({maxPriorityFeePerGas:$});p.maxPriorityFeePerGas=$,p.maxFeePerGas=y}}else{if(typeof t.maxFeePerGas<"u"||typeof t.maxPriorityFeePerGas<"u")throw new tc;if(typeof t.gasPrice>"u"){const C=await h(),{gasPrice:y}=await rc(e,{block:C,chain:o,request:p,type:"legacy"});p.gasPrice=y}}return u.includes("gas")&&typeof s>"u"&&(p.gas=await J(e,sc,"estimateGas")({...p,account:f&&{address:f.address,type:"json-rpc"}})),Eo(p),delete p.parameters,p}async function Vp(e,{address:t,blockNumber:n,blockTag:r=e.experimental_blockTag??"latest"}){const o=typeof n=="bigint"?Q(n):void 0,s=await e.request({method:"eth_getBalance",params:[t,o||r]});return BigInt(s)}async function sc(e,t){var o,s,i;const{account:n=e.account}=t,r=n?St(n):void 0;try{let S=function(T){const{block:O,request:b,rpcStateOverride:L}=T;return e.request({method:"eth_estimateGas",params:L?[b,O??e.experimental_blockTag??"latest",L]: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:C,maxPriorityFeePerGas:y,nonce:$,value:B,stateOverride:k,...D}=await Hp(e,{...t,parameters:(r==null?void 0:r.type)==="local"?void 0:["blobVersionedHashes"]}),g=(typeof f=="bigint"?Q(f):void 0)||p,w=ec(k),A=await(async()=>{if(D.to)return D.to;if(a&&a.length>0)return await e2({authorization:a[0]}).catch(()=>{throw new H("`to` is required. Could not infer from `authorizationList`")})})();Eo(t);const I=(i=(s=(o=e.chain)==null?void 0:o.formatters)==null?void 0:s.transactionRequest)==null?void 0:i.format,P=(I||Is)({...Ja(D,{format:I}),from:r==null?void 0:r.address,accessList:c,authorizationList:a,blobs:u,blobVersionedHashes:l,data:d,gas:h,gasPrice:m,maxFeePerBlobGas:v,maxFeePerGas:C,maxPriorityFeePerGas:y,nonce:$,to:A,value:B});let x=BigInt(await S({block:g,request:P,rpcStateOverride:w}));if(a){const T=await Vp(e,{address:P.from}),O=await Promise.all(a.map(async b=>{const{address:L}=b,F=await S({block:g,request:{authorizationList:void 0,data:d,from:r==null?void 0:r.address,to:L,value:Q(T)},rpcStateOverride:w}).catch(()=>100000n);return 2n*BigInt(F)}));x+=O.reduce((b,L)=>b+L,0n)}return x}catch(c){throw n2(c,{...t,account:r,chain:e.chain})}}async function C2(e,t){const{abi:n,address:r,args:o,functionName:s,dataSuffix:i,...c}=t,a=Rt({abi:n,args:o,functionName:s});try{return await J(e,sc,"estimateGas")({data:`${a}${i?i.replace("0x",""):""}`,to:r,...c})}catch(u){const l=c.account?St(c.account):void 0;throw hr(u,{abi:n,address:r,args:o,docsPath:"/docs/contract/estimateContractGas",functionName:s,sender:l==null?void 0:l.address})}}function Ms(e,t){if(!ct(e,{strict:!1}))throw new yn({address:e});if(!ct(t,{strict:!1}))throw new yn({address:t});return e.toLowerCase()===t.toLowerCase()}const Gp="/docs/contract/decodeEventLog";function ic(e){const{abi:t,data:n,strict:r,topics:o}=e,s=r??!0,[i,...c]=o;if(!i)throw new yx({docsPath:Gp});const a=t.find(m=>m.type==="event"&&i===Ss(yt(m)));if(!(a&&"name"in a)||a.type!=="event")throw new Od(i,{docsPath:Gp});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,C]=d[m],y=c[m];if(!y)throw new ys({abiItem:a,param:v});p[f?C:v.name||C]=O2({param:v,value:y})}const h=l.filter(m=>!("indexed"in m&&m.indexed));if(h.length>0){if(n&&n!=="0x")try{const m=Qr(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 Ad||m instanceof hp?new Gr({abiItem:a,data:n,params:h,size:we(n)}):m}else if(s)throw new Gr({abiItem:a,data:"0x",params:h,size:0})}return{eventName:u,args:Object.values(p).length>0?p:void 0}}function O2({param:e,value:t}){return e.type==="string"||e.type==="bytes"||e.type==="tuple"||e.type.match(/^(.*)\[(\d+)?\]$/)?t:(Qr([e],t)||[])[0]}function ac(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]===Ss(l));if(!a)return null;const u=ic({...i,abi:[a],strict:o});return s&&!s.includes(u.eventName)||!N2({args:u.args,inputs:a.inputs,matchArgs:n})?null:{...u,...i}}catch(a){let u,l;if(a instanceof Od)return null;if(a instanceof Gr||a instanceof ys){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 N2(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"?Ms(i,c):s.type==="string"||s.type==="bytes"?Ne(or(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 tn(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 cc(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=>Xr({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"?Q(r):r,toBlock:typeof o=="bigint"?Q(o):o}]});const d=p.map(h=>tn(h));return l?ac({abi:l,args:c,logs:d,strict:u}):d}async function qp(e,t){const{abi:n,address:r,args:o,blockHash:s,eventName:i,fromBlock:c,toBlock:a,strict:u}=t,l=i?Ln({abi:n,name:i}):void 0,f=l?void 0:n.filter(p=>p.type==="event");return J(e,cc,"getLogs")({address:r,args:o,blockHash:s,event:l,events:f,fromBlock:c,toBlock:a,strict:u})}const uc="/docs/contract/decodeFunctionResult";function Dn(e){const{abi:t,args:n,functionName:r,data:o}=e;let s=t[0];if(r){const c=Ln({abi:t,args:n,name:r});if(!c)throw new nr(r,{docsPath:uc});s=c}if(s.type!=="function")throw new nr(void 0,{docsPath:uc});if(!s.outputs)throw new Id(s.name,{docsPath:uc});const i=Qr(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 lc=BigInt(0),fc=BigInt(1);function Ls(e,t=""){if(typeof e!="boolean"){const n=t&&`"${t}"`;throw new Error(n+"expected boolean, got type="+typeof e)}return e}function jn(e,t,n=""){const r=ws(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 Bs(e){const t=e.toString(16);return t.length&1?"0"+t:t}function Zp(e){if(typeof e!="string")throw new Error("hex string expected, got "+typeof e);return e===""?lc:BigInt("0x"+e)}function ks(e){return Zp(cr(e))}function Kp(e){return Xt(e),Zp(cr(Uint8Array.from(e).reverse()))}function dc(e,t){return xs(e.toString(16).padStart(t*2,"0"))}function Yp(e,t){return dc(e,t).reverse()}function ze(e,t,n){let r;if(typeof t=="string")try{r=xs(t)}catch(o){throw new Error(e+" must be hex string or Uint8Array, cause: "+o)}else if(ws(t))r=Uint8Array.from(t);else throw new Error(e+" must be hex string or Uint8Array");return r.length,r}const pc=e=>typeof e=="bigint"&&lc<=e;function I2(e,t,n){return pc(e)&&pc(t)&&pc(n)&&t<=e&&e<n}function M2(e,t,n,r){if(!I2(t,n,r))throw new Error("expected valid "+e+": "+n+" <= n < "+r+", got "+t)}function Xp(e){let t;for(t=0;e>lc;e>>=fc,t+=1);return t}const So=e=>(fc<<BigInt(e))-fc;function L2(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 bn(...h)};return(d,h)=>{a(),l(d);let m;for(;!(m=h(f()));)l();return a(),m}}function hc(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 Qp(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 B2="0.1.1";function k2(){return B2}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(`
158
- `);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@${k2()}`}),this.cause=n.cause,this.details=r,this.docs=i,this.docsPath=o,this.shortMessage=t}walk(t){return Jp(this,t)}}function Jp(e,t){return t!=null&&t(e)?e:e&&typeof e=="object"&&"cause"in e&&e.cause?Jp(e.cause,t):t?null:e}const R2="#__bigint";function F2(e,t,n){return JSON.stringify(e,(r,o)=>typeof o=="bigint"?o.toString()+R2:o,n)}function D2(e,t){if(nh(e)>t)throw new Z2({givenSize:nh(e),maxSize:t})}const nn={zero:48,nine:57,A:65,F:70,a:97,f:102};function eh(e){if(e>=nn.zero&&e<=nn.nine)return e-nn.zero;if(e>=nn.A&&e<=nn.F)return e-(nn.A-10);if(e>=nn.a&&e<=nn.f)return e-(nn.a-10)}function j2(e,t={}){const{dir:n,size:r=32}=t;if(r===0)return e;if(e.length>r)throw new K2({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 mc(e,t){if(ut(e)>t)throw new e6({givenSize:ut(e),maxSize:t})}function _2(e,t){if(typeof t=="number"&&t>0&&t>ut(e)-1)throw new ch({offset:t,position:"start",size:ut(e)})}function U2(e,t,n){if(typeof t=="number"&&typeof n=="number"&&ut(e)!==n-t)throw new ch({offset:n,position:"end",size:ut(e)})}function th(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 t6({size:Math.ceil(o.length/2),targetSize:r,type:"Hex"});return`0x${o[n==="right"?"padEnd":"padStart"](r*2,"0")}`}const z2=new TextEncoder;function W2(e){return e instanceof Uint8Array?e:typeof e=="string"?V2(e):H2(e)}function H2(e){return e instanceof Uint8Array?e:new Uint8Array(e)}function V2(e,t={}){const{size:n}=t;let r=e;n&&(mc(e,n),r=Un(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=eh(o.charCodeAt(a++)),l=eh(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 G2(e,t={}){const{size:n}=t,r=z2.encode(e);return typeof n=="number"?(D2(r,n),q2(r,n)):r}function q2(e,t){return j2(e,{dir:"right",size:t})}function nh(e){return e.length}let Z2=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"})}},K2=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 Y2=new TextEncoder,X2=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function Q2(e,t={}){const{strict:n=!1}=t;if(!e)throw new ih(e);if(typeof e!="string")throw new ih(e);if(n&&!/^0x[0-9a-fA-F]*$/.test(e))throw new ah(e);if(!e.startsWith("0x"))throw new ah(e)}function Dt(...e){return`0x${e.reduce((t,n)=>t+n.replace("0x",""),"")}`}function rh(e,t={}){const n=`0x${Number(e)}`;return typeof t.size=="number"?(mc(n,t.size),_n(n,t.size)):n}function oh(e,t={}){let n="";for(let o=0;o<e.length;o++)n+=X2[e[o]];const r=`0x${n}`;return typeof t.size=="number"?(mc(r,t.size),Un(r,t.size)):r}function ke(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 sh({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?_n(a,r):a}function gc(e,t={}){return oh(Y2.encode(e),t)}function _n(e,t){return th(e,{dir:"left",size:t})}function Un(e,t){return th(e,{dir:"right",size:t})}function bc(e,t,n,r={}){const{strict:o}=r;_2(e,t);const s=`0x${e.replace("0x","").slice((t??0)*2,(n??e.length)*2)}`;return o&&U2(s,t,n),s}function ut(e){return Math.ceil((e.length-2)/2)}function J2(e,t={}){const{strict:n=!1}=t;try{return Q2(e,{strict:n}),!0}catch{return!1}}class sh 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 ih extends be{constructor(t){super(`Value \`${typeof t=="object"?F2(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 ah 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 e6 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 ch 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 t6 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 n6(e){return{address:e.address,amount:ke(e.amount),index:ke(e.index),validatorIndex:ke(e.validatorIndex)}}function uh(e){return{...typeof e.baseFeePerGas=="bigint"&&{baseFeePerGas:ke(e.baseFeePerGas)},...typeof e.blobBaseFee=="bigint"&&{blobBaseFee:ke(e.blobBaseFee)},...typeof e.feeRecipient=="string"&&{feeRecipient:e.feeRecipient},...typeof e.gasLimit=="bigint"&&{gasLimit:ke(e.gasLimit)},...typeof e.number=="bigint"&&{number:ke(e.number)},...typeof e.prevRandao=="bigint"&&{prevRandao:ke(e.prevRandao)},...typeof e.time=="bigint"&&{time:ke(e.time)},...e.withdrawals&&{withdrawals:e.withdrawals.map(n6)}}}const yc=[{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"}],vc=[{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"}]}],lh=[{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"}],fh=[...lh,{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"}]}],r6=[...lh,{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"}]}],dh=[{name:"text",type:"function",stateMutability:"view",inputs:[{name:"name",type:"bytes32"},{name:"key",type:"string"}],outputs:[{name:"",type:"string"}]}],ph=[{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"}]}],hh=[{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"}],wc=[{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"}]}],o6="0x82ad56cb",mh="0x608060405234801561001057600080fd5b5060405161018e38038061018e83398101604081905261002f91610124565b6000808351602085016000f59050803b61004857600080fd5b6000808351602085016000855af16040513d6000823e81610067573d81fd5b3d81f35b634e487b7160e01b600052604160045260246000fd5b600082601f83011261009257600080fd5b81516001600160401b038111156100ab576100ab61006b565b604051601f8201601f19908116603f011681016001600160401b03811182821017156100d9576100d961006b565b6040528181528382016020018510156100f157600080fd5b60005b82811015610110576020818601810151838301820152016100f4565b506000918101602001919091529392505050565b6000806040838503121561013757600080fd5b82516001600160401b0381111561014d57600080fd5b61015985828601610081565b602085015190935090506001600160401b0381111561017757600080fd5b61018385828601610081565b915050925092905056fe",s6="0x608060405234801561001057600080fd5b506040516102c03803806102c083398101604081905261002f916101e6565b836001600160a01b03163b6000036100e457600080836001600160a01b03168360405161005c9190610270565b6000604051808303816000865af19150503d8060008114610099576040519150601f19603f3d011682016040523d82523d6000602084013e61009e565b606091505b50915091508115806100b857506001600160a01b0386163b155b156100e1578060405163101bb98d60e01b81526004016100d8919061028c565b60405180910390fd5b50505b6000808451602086016000885af16040513d6000823e81610103573d81fd5b3d81f35b80516001600160a01b038116811461011e57600080fd5b919050565b634e487b7160e01b600052604160045260246000fd5b60005b8381101561015457818101518382015260200161013c565b50506000910152565b600082601f83011261016e57600080fd5b81516001600160401b0381111561018757610187610123565b604051601f8201601f19908116603f011681016001600160401b03811182821017156101b5576101b5610123565b6040528181528382016020018510156101cd57600080fd5b6101de826020830160208701610139565b949350505050565b600080600080608085870312156101fc57600080fd5b61020585610107565b60208601519094506001600160401b0381111561022157600080fd5b61022d8782880161015d565b93505061023c60408601610107565b60608601519092506001600160401b0381111561025857600080fd5b6102648782880161015d565b91505092959194509250565b60008251610282818460208701610139565b9190910192915050565b60208152600082518060208401526102ab816040850160208701610139565b601f01601f1916919091016040019291505056fe",i6="0x608060405234801561001057600080fd5b5060405161069438038061069483398101604081905261002f9161051e565b600061003c848484610048565b9050806000526001601ff35b60007f64926492649264926492649264926492649264926492649264926492649264926100748361040c565b036101e7576000606080848060200190518101906100929190610577565b60405192955090935091506000906001600160a01b038516906100b69085906105dd565b6000604051808303816000865af19150503d80600081146100f3576040519150601f19603f3d011682016040523d82523d6000602084013e6100f8565b606091505b50509050876001600160a01b03163b60000361016057806101605760405162461bcd60e51b815260206004820152601e60248201527f5369676e617475726556616c696461746f723a206465706c6f796d656e74000060448201526064015b60405180910390fd5b604051630b135d3f60e11b808252906001600160a01b038a1690631626ba7e90610190908b9087906004016105f9565b602060405180830381865afa1580156101ad573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101d19190610633565b6001600160e01b03191614945050505050610405565b6001600160a01b0384163b1561027a57604051630b135d3f60e11b808252906001600160a01b03861690631626ba7e9061022790879087906004016105f9565b602060405180830381865afa158015610244573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102689190610633565b6001600160e01b031916149050610405565b81516041146102df5760405162461bcd60e51b815260206004820152603a602482015260008051602061067483398151915260448201527f3a20696e76616c6964207369676e6174757265206c656e6774680000000000006064820152608401610157565b6102e7610425565b5060208201516040808401518451859392600091859190811061030c5761030c61065d565b016020015160f81c9050601b811480159061032b57508060ff16601c14155b1561038c5760405162461bcd60e51b815260206004820152603b602482015260008051602061067483398151915260448201527f3a20696e76616c6964207369676e617475726520762076616c756500000000006064820152608401610157565b60408051600081526020810180835289905260ff83169181019190915260608101849052608081018390526001600160a01b0389169060019060a0016020604051602081039080840390855afa1580156103ea573d6000803e3d6000fd5b505050602060405103516001600160a01b0316149450505050505b9392505050565b600060208251101561041d57600080fd5b508051015190565b60405180606001604052806003906020820280368337509192915050565b6001600160a01b038116811461045857600080fd5b50565b634e487b7160e01b600052604160045260246000fd5b60005b8381101561048c578181015183820152602001610474565b50506000910152565b600082601f8301126104a657600080fd5b81516001600160401b038111156104bf576104bf61045b565b604051601f8201601f19908116603f011681016001600160401b03811182821017156104ed576104ed61045b565b60405281815283820160200185101561050557600080fd5b610516826020830160208701610471565b949350505050565b60008060006060848603121561053357600080fd5b835161053e81610443565b6020850151604086015191945092506001600160401b0381111561056157600080fd5b61056d86828701610495565b9150509250925092565b60008060006060848603121561058c57600080fd5b835161059781610443565b60208501519093506001600160401b038111156105b357600080fd5b6105bf86828701610495565b604086015190935090506001600160401b0381111561056157600080fd5b600082516105ef818460208701610471565b9190910192915050565b828152604060208201526000825180604084015261061e816060850160208701610471565b601f01601f1916919091016060019392505050565b60006020828403121561064557600080fd5b81516001600160e01b03198116811461040557600080fd5b634e487b7160e01b600052603260045260246000fdfe5369676e617475726556616c696461746f72237265636f7665725369676e6572";class xc extends H{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 gh extends H{constructor(){super("No chain was provided to the Client.",{name:"ClientChainNotConfiguredError"})}}const Ec="/docs/contract/encodeDeployData";function Sc(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 px({docsPath:Ec});if(!("inputs"in o))throw new $d({docsPath:Ec});if(!o.inputs||o.inputs.length===0)throw new $d({docsPath:Ec});const s=Jt(o.inputs,n);return ur([r,s])}function gr({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 xc({chain:t,contract:{name:n}});if(e&&r.blockCreated&&r.blockCreated>e)throw new xc({blockNumber:e,chain:t,contract:{name:n,blockCreated:r.blockCreated}});return r.address}function bh(e,{docsPath:t,...n}){const r=(()=>{const o=Qa(e,n);return o instanceof Ns?e:o})();return new Ep(r,{docsPath:t,...n})}function yh(){let e=()=>{},t=()=>{};return{promise:new Promise((r,o)=>{e=r,t=o}),resolve:e,reject:t}}const Pc=new Map;function vh({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=()=>Pc.delete(t),c=()=>a().map(({args:l})=>l),a=()=>Pc.get(t)||[],u=l=>Pc.set(t,[...a(),l]);return{flush:i,async schedule(l){const{promise:f,resolve:p,reject:d}=yh();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,x,T;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:C,maxPriorityFeePerGas:y,nonce:$,to:B,value:k,stateOverride:D,...j}=t,g=n?St(n):void 0;if(l&&(p||d))throw new H("Cannot provide both `code` & `factory`/`factoryData` as parameters.");if(l&&B)throw new H("Cannot provide both `code` & `to` as parameters.");const w=l&&f,A=p&&d&&B&&f,I=w||A,N=w?u6({code:l,data:f}):A?l6({data:f,factory:p,factoryData:d,to:B}):f;try{Eo(t);const b=(typeof s=="bigint"?Q(s):void 0)||i,L=u?uh(u):void 0,F=ec(D),U=(T=(x=(S=e.chain)==null?void 0:S.formatters)==null?void 0:x.transactionRequest)==null?void 0:T.format,V=(U||Is)({...Ja(j,{format:U}),from:g==null?void 0:g.address,accessList:c,authorizationList:r,blobs:a,data:N,gas:h,gasPrice:m,maxFeePerBlobGas:v,maxFeePerGas:C,maxPriorityFeePerGas:y,nonce:$,to:I?void 0:B,value:k});if(o&&a6({request:V})&&!F&&!L)try{return await c6(e,{...V,blockNumber:s,blockTag:i})}catch(K){if(!(K instanceof gh)&&!(K instanceof xc))throw K}const Z=(()=>{const K=[V,b];return F&&L?[...K,F,L]:F?[...K,F]:L?[...K,{},L]:K})(),W=await e.request({method:"eth_call",params:Z});return W==="0x"?{data:void 0}:{data:W}}catch(O){const b=f6(O),{offchainLookup:L,offchainLookupSignature:F}=await Promise.resolve().then(()=>p5);if(e.ccipRead!==!1&&(b==null?void 0:b.slice(0,10))===F&&B)return{data:await L(e,{data:b,to:B})};throw I&&(b==null?void 0:b.slice(0,10))==="0x101bb98d"?new HE({factory:p}):bh(O,{...t,account:g,chain:e.chain})}}function a6({request:e}){const{data:t,to:n,...r}=e;return!(!t||t.startsWith(o6)||!n||Object.values(r).filter(o=>typeof o<"u").length>0)}async function c6(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 gh;u=gr({blockNumber:o,chain:e.chain,contract:"multicall3"})}const f=(typeof o=="bigint"?Q(o):void 0)||s,{schedule:p}=vh({id:`${e.uid}.${f}`,wait:r,shouldSplitBatch(v){return v.reduce((y,{data:$})=>y+($.length-2),0)>n*2},fn:async v=>{const C=v.map(B=>({allowFailure:!0,callData:B.data,target:B.to})),y=Rt({abi:yc,args:[C],functionName:"aggregate3"}),$=await e.request({method:"eth_call",params:[{data:y,to:u},f]});return Dn({abi:yc,args:[C],functionName:"aggregate3",data:$||"0x"})}}),[{returnData:d,success:h}]=await p({data:i,to:a});if(!h)throw new Ts({data:d});return d==="0x"?{data:void 0}:{data:d}}function u6(e){const{code:t,data:n}=e;return Sc({abi:xd(["constructor(bytes, bytes)"]),bytecode:mh,args:[t,n]})}function l6(e){const{data:t,factory:n,factoryData:r,to:o}=e;return Sc({abi:xd(["constructor(address, bytes, address, bytes)"]),bytecode:s6,args:[o,t,n,r]})}function f6(e){var n;if(!(e instanceof H))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 rn(e,t){const{abi:n,address:r,args:o,functionName:s,...i}=t,c=Rt({abi:n,args:o,functionName:s});try{const{data:a}=await J(e,Po,"call")({...i,data:c,to:r});return Dn({abi:n,args:o,functionName:s,data:a||"0x"})}catch(a){throw hr(a,{abi:n,address:r,args:o,docsPath:"/docs/contract/readContract",functionName:s})}}async function d6(e,t){const{abi:n,address:r,args:o,dataSuffix:s,functionName:i,...c}=t,a=c.account?St(c.account):e.account,u=Rt({abi:n,args:o,functionName:i});try{const{data:l}=await J(e,Po,"call")({batch:!1,data:`${u}${s?s.replace("0x",""):""}`,to:r,...c,account:a}),f=Dn({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 hr(l,{abi:n,address:r,args:o,docsPath:"/docs/contract/simulateContract",functionName:i,sender:a==null?void 0:a.address})}}const $c=new Map,wh=new Map;let p6=0;function xn(e,t,n){const r=++p6,o=()=>$c.get(e)||[],s=()=>{const l=o();$c.set(e,l.filter(f=>f.id!==r))},i=()=>{const l=o();if(!l.some(p=>p.id===r))return;const f=wh.get(e);if(l.length===1&&f){const p=f();p instanceof Promise&&p.catch(()=>{})}s()},c=o();if($c.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"&&wh.set(e,u),i}async function Ac(e){return new Promise(t=>setTimeout(t,e))}function $o(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 Ac(a);const u=async()=>{o&&(await e({unpoll:s}),await Ac(r),u())};u()})(),s}const h6=new Map,m6=new Map;function g6(e){const t=(o,s)=>({clear:()=>s.delete(o),get:()=>s.get(o),set:i=>s.set(o,i)}),n=t(e,h6),r=t(e,m6);return{clear:()=>{n.clear(),r.clear()},promise:n,response:r}}async function b6(e,{cacheKey:t,cacheTime:n=Number.POSITIVE_INFINITY}){const r=g6(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 y6=e=>`blockNumber.${e}`;async function Ao(e,{cacheTime:t=e.cacheTime}={}){const n=await b6(()=>e.request({method:"eth_blockNumber"}),{cacheKey:y6(e.uid),cacheTime:t});return BigInt(n)}async function Rs(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=>tn(s));return!("abi"in t)||!t.abi?o:ac({abi:t.abi,logs:o,strict:n})}async function Fs(e,{filter:t}){return t.request({method:"eth_uninstallFilter",params:[t.id]})}function v6(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,C=Ae(["watchContractEvent",r,o,s,e.uid,i,f,v,c]);return xn(C,{onLogs:u,onError:a},y=>{let $;c!==void 0&&($=c-1n);let B,k=!1;const D=$o(async()=>{var j;if(!k){try{B=await J(e,up,"createContractEventFilter")({abi:n,address:r,args:o,eventName:i,strict:v,fromBlock:c})}catch{}k=!0;return}try{let g;if(B)g=await J(e,Rs,"getFilterChanges")({filter:B});else{const w=await J(e,Ao,"getBlockNumber")({});$&&$<w?g=await J(e,qp,"getContractEvents")({abi:n,address:r,args:o,eventName:i,fromBlock:$+1n,toBlock:w,strict:v}):g=[],$=w}if(g.length===0)return;if(s)y.onLogs(g);else for(const w of g)y.onLogs([w])}catch(g){B&&g instanceof Rn&&(k=!1),(j=y.onError)==null||j.call(y,g)}},{emitOnBegin:!0,interval:f});return async()=>{B&&await J(e,Fs,"uninstallFilter")({filter:B}),D()}})})():(()=>{const v=p??!1,C=Ae(["watchContractEvent",r,o,s,e.uid,i,f,v]);let y=!0,$=()=>y=!1;return xn(C,{onLogs:u,onError:a},B=>((async()=>{try{const k=(()=>{if(e.transport.type==="fallback"){const g=e.transport.transports.find(w=>w.config.type==="webSocket"||w.config.type==="ipc");return g?g.value:e.transport}return e.transport})(),D=i?Xr({abi:n,eventName:i,args:o}):[],{unsubscribe:j}=await k.subscribe({params:["logs",{address:r,topics:D}],onData(g){var A;if(!y)return;const w=g.result;try{const{eventName:I,args:N}=ic({abi:n,data:w.data,topics:w.topics,strict:p}),P=tn(w,{args:N,eventName:I});B.onLogs([P])}catch(I){let N,P;if(I instanceof Gr||I instanceof ys){if(p)return;N=I.abiItem.name,P=(A=I.abiItem.inputs)==null?void 0:A.some(x=>!("name"in x&&x.name))}const S=tn(w,{args:P?[]:{},eventName:N});B.onLogs([S])}},onError(g){var w;(w=B.onError)==null||w.call(B,g)}});$=j,y||$()}catch(k){a==null||a(k)}})(),()=>$()))})()}async function w6(e,{serializedTransaction:t}){return e.request({method:"eth_sendRawTransaction",params:[t]},{retryCount:0})}function Tc(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 Ac(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 x6={"0x0":"reverted","0x1":"success"};function E6(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=>tn(n)):null,to:e.to?e.to:null,transactionIndex:e.transactionIndex?Zt(e.transactionIndex):null,status:e.status?x6[e.status]:null,type:e.type?Np[e.type]||e.type:null};return e.blobGasPrice&&(t.blobGasPrice=BigInt(e.blobGasPrice)),e.blobGasUsed&&(t.blobGasUsed=BigInt(e.blobGasUsed)),t}const Cc=256;let Ds=Cc,js;function xh(e=11){if(!js||Ds+e>Cc*2){js="",Ds=0;for(let t=0;t<Cc;t++)js+=(256+Math.random()*256|0).toString(16).substring(1)}return js.substring(Ds,Ds+++e)}function S6(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?St(e.account):void 0,{config:d,request:h,value:m}=e.transport({chain:n,pollingInterval:l}),v={...d,...m},C={account:p,batch:t,cacheTime:f,ccipRead:r,chain:n,key:o,name:s,pollingInterval:l,request:h,transport:v,type:i,uid:xh(),...c?{experimental_blockTag:c}:{}};function y($){return B=>{const k=B($);for(const j in C)delete k[j];const D={...$,...k};return Object.assign(D,{extend:y(D)})}}return Object.assign(C,{extend:y(C)})}const _s=new Ma(8192);function P6(e,{enabled:t=!0,id:n}){if(!t||!n)return e();if(_s.get(n))return _s.get(n);const r=e().finally(()=>_s.delete(n));return _s.set(n,r),r}function $6(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 Fn(new Error("method not supported"),{method:u});if(s!=null&&s.include&&!s.include.includes(u))throw new Fn(new Error("method not supported"),{method:u});const l=o?qr(`${a}.${Ae(n)}`):void 0;return P6(()=>Tc(async()=>{try{return await e(n)}catch(p){const d=p;switch(d.code){case to.code:throw new to(d);case no.code:throw new no(d);case ro.code:throw new ro(d,{method:n.method});case oo.code:throw new oo(d);case kn.code:throw new kn(d);case Rn.code:throw new Rn(d);case so.code:throw new so(d);case io.code:throw new io(d);case ao.code:throw new ao(d);case Fn.code:throw new Fn(d,{method:n.method});case dr.code:throw new dr(d);case co.code:throw new co(d);case pr.code:throw new pr(d);case uo.code:throw new uo(d);case lo.code:throw new lo(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 go.code:throw new go(d);case bo.code:throw new bo(d);case yo.code:throw new yo(d);case vo.code:throw new vo(d);case wo.code:throw new wo(d);case xo.code:throw new xo(d);case 5e3:throw new pr(d);default:throw p instanceof H?p:new GE(d)}}},{delay:({count:p,error:d})=>{var h;if(d&&d instanceof Bn){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})=>A6(p)}),{enabled:o,id:l})}}function A6(e){return"code"in e&&typeof e.code=="number"?e.code===-1||e.code===dr.code||e.code===kn.code:e instanceof Bn&&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 T6({key:e,methods:t,name:n,request:r,retryCount:o=3,retryDelay:s=150,timeout:i,type:c},a){const u=xh();return{config:{key:e,methods:t,name:n,request:r,retryCount:o,retryDelay:s,timeout:i,type:c},request:$6(r,{methods:t,retryCount:o,retryDelay:s,uid:u}),value:a}}function C6(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 O6(){return{current:0,take(){return this.current++},reset(){this.current=0}}}const Eh=O6();function N6(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 C6(async({signal:h})=>{const m={...c,body:Array.isArray(r)?Ae(r.map($=>({jsonrpc:"2.0",id:$.id??Eh.take(),...$}))):Ae({jsonrpc:"2.0",id:r.id??Eh.take(),...r}),headers:{"Content-Type":"application/json",...a},method:u||"POST",signal:l||(i>0?h:null)},v=new Request(e,m),C=await(o==null?void 0:o(v,m))??{...m,url:e};return await fetch(C.url??e,C)},{errorInstance:new Sp({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 Bn({body:r,details:Ae(d.error)||p.statusText,headers:p.headers,status:p.status,url:e});return d}catch(p){throw p instanceof Bn||p instanceof Sp?p:new Bn({body:r,cause:p,url:e})}}}}function I6(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,C=d??t.timeout??1e4,y=e,$=N6(y,{fetchOptions:r,onRequest:c,onResponse:a,timeout:C});return T6({key:o,methods:s,name:i,async request({method:B,params:k}){const D={method:B,params:k},{schedule:j}=vh({id:y,wait:m,shouldSplitBatch(I){return I.length>h},fn:I=>$.request({body:I}),sort:(I,N)=>I.id-N.id}),g=async I=>n?j(I):[await $.request({body:I})],[{error:w,result:A}]=await g(D);if(l)return{error:w,result:A};if(w)throw new Wa({body:D,error:w,url:y});return A},retryCount:v,retryDelay:u,timeout:C,type:"http"},{fetchOptions:r,url:y})}}function Oc(e,t){var r,o,s,i,c,a;if(!(e instanceof H))return!1;const n=e.walk(u=>u instanceof za);return n instanceof za?!!(((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===fp[50]):!1}function M6(e){const{abi:t,data:n}=e,r=lr(n,0,4),o=t.find(s=>s.type==="function"&&r===Yr(yt(s)));if(!o)throw new vx(r,{docsPath:"/docs/contract/decodeFunctionData"});return{functionName:o.name,args:"inputs"in o&&o.inputs&&o.inputs.length>0?Qr(o.inputs,lr(n,4)):void 0}}const Nc="/docs/contract/encodeErrorResult";function Sh(e){const{abi:t,errorName:n,args:r}=e;let o=t[0];if(n){const a=Ln({abi:t,args:r,name:n});if(!a)throw new Td(n,{docsPath:Nc});o=a}if(o.type!=="error")throw new Td(void 0,{docsPath:Nc});const s=yt(o),i=Yr(s);let c="0x";if(r&&r.length>0){if(!o.inputs)throw new bx(o.name,{docsPath:Nc});c=Jt(o.inputs,r)}return ur([i,c])}const Ic="/docs/contract/encodeFunctionResult";function L6(e){const{abi:t,functionName:n,result:r}=e;let o=t[0];if(n){const i=Ln({abi:t,name:n});if(!i)throw new nr(n,{docsPath:Ic});o=i}if(o.type!=="function")throw new nr(void 0,{docsPath:Ic});if(!o.outputs)throw new Id(o.name,{docsPath:Ic});const s=(()=>{if(o.outputs.length===0)return[];if(o.outputs.length===1)return[r];if(Array.isArray(r))return r;throw new Md(r)})();return Jt(o.outputs,s)}const Us="x-batch-gateway:true";async function Ph(e){const{data:t,ccipRequest:n}=e,{args:[r]}=M6({abi:vc,data:t}),o=[],s=[];return await Promise.all(r.map(async(i,c)=>{try{s[c]=i.urls.includes(Us)?await Ph({data:i.data,ccipRequest:n}):await n(i),o[c]=!1}catch(a){o[c]=!0,s[c]=B6(a)}})),L6({abi:vc,functionName:"query",result:[o,s]})}function B6(e){return e.name==="HttpRequestError"&&e.status?Sh({abi:vc,errorName:"HttpError",args:[e.status,e.shortMessage]}):Sh({abi:[dp],errorName:"Error",args:["shortMessage"in e?e.shortMessage:e.message]})}function $h(e){if(e.length!==66||e.indexOf("[")!==0||e.indexOf("]")!==65)return null;const t=`0x${e.slice(1,65)}`;return vt(t)?t:null}function zs(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=$h(n[r]),s=o?or(o):Ne(Mn(n[r]),"bytes");t=Ne(Et([t,s]),"bytes")}return $e(t)}function k6(e){return`[${e.slice(2)}]`}function R6(e){const t=new Uint8Array(32).fill(0);return e?$h(e)||Ne(Mn(e)):$e(t)}function Ws(e){const t=e.replace(/^\.|\.$/gm,"");if(t.length===0)return new Uint8Array(1);const n=new Uint8Array(Mn(t).byteLength+2);let r=0;const o=t.split(".");for(let s=0;s<o.length;s++){let i=Mn(o[s]);i.byteLength>255&&(i=Mn(k6(R6(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 F6(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 gr({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=Rt({abi:ph,functionName:"addr",...o!=null?{args:[zs(s),BigInt(o)]}:{args:[zs(s)]}}),p={address:u,abi:fh,functionName:"resolve",args:[Kt(Ws(s)),f,i??[Us]],blockNumber:n,blockTag:r},h=await J(e,rn,"readContract")(p);if(h[0]==="0x")return null;const m=Dn({abi:ph,args:o!=null?[zs(s),BigInt(o)]:void 0,functionName:"addr",data:h[0]});return m==="0x"||In(m)==="0x00"?null:m}catch(f){if(c)throw f;if(Oc(f,"resolve"))return null;throw f}}class D6 extends H{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 To extends H{constructor({reason:t}){super(`ENS NFT avatar URI is invalid. ${t}`,{name:"EnsAvatarInvalidNftUriError"})}}class Mc extends H{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 j6 extends H{constructor({namespace:t}){super(`ENS NFT avatar namespace "${t}" is not supported. Must be "erc721" or "erc1155".`,{name:"EnsAvatarUnsupportedNamespaceError"})}}const _6=/(?<protocol>https?:\/\/[^\/]*|ipfs:\/|ipns:\/|ar:\/)?(?<root>\/)?(?<subpath>ipfs\/|ipns\/)?(?<target>[\w\-.]+)(?<subtarget>\/.*)?/,U6=/^(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>\/.*)?$/,z6=/^data:([a-zA-Z\-/+]*);base64,([^"].*)/,W6=/^data:([a-zA-Z\-/+]*)?(;[a-zA-Z0-9].*?)?(,)/;async function H6(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 Ah(e,t){return e?e.endsWith("/")?e.slice(0,-1):e:t}function Th({uri:e,gatewayUrls:t}){const n=z6.test(e);if(n)return{uri:e,isOnChain:!0,isEncoded:n};const r=Ah(t==null?void 0:t.ipfs,"https://ipfs.io"),o=Ah(t==null?void 0:t.arweave,"https://arweave.net"),s=e.match(_6),{protocol:i,subpath:c,target:a,subtarget:u=""}=(s==null?void 0:s.groups)||{},l=i==="ipns:/"||c==="ipns/",f=i==="ipfs:/"||c==="ipfs/"||U6.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(W6,"");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 Mc({uri:e})}function Ch(e){if(typeof e!="object"||!("image"in e)&&!("image_url"in e)&&!("image_data"in e))throw new D6({data:e});return e.image||e.image_url||e.image_data}async function V6({gatewayUrls:e,uri:t}){try{const n=await fetch(t).then(o=>o.json());return await Lc({gatewayUrls:e,uri:Ch(n)})}catch{throw new Mc({uri:t})}}async function Lc({gatewayUrls:e,uri:t}){const{uri:n,isOnChain:r}=Th({uri:t,gatewayUrls:e});if(r||await H6(n))return n;throw new Mc({uri:t})}function G6(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 To({reason:"Only EIP-155 supported"});if(!i)throw new To({reason:"Chain ID not found"});if(!a)throw new To({reason:"Contract address not found"});if(!o)throw new To({reason:"Token ID not found"});if(!c)throw new To({reason:"ERC namespace not found"});return{chainID:Number.parseInt(i),namespace:c.toLowerCase(),contractAddress:a,tokenID:o}}async function q6(e,{nft:t}){if(t.namespace==="erc721")return rn(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 rn(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 j6({namespace:t.namespace})}async function Z6(e,{gatewayUrls:t,record:n}){return/eip155:/i.test(n)?K6(e,{gatewayUrls:t,record:n}):Lc({uri:n,gatewayUrls:t})}async function K6(e,{gatewayUrls:t,record:n}){const r=G6(n),o=await q6(e,{nft:r}),{uri:s,isOnChain:i,isEncoded:c}=Th({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 Lc({uri:Ch(l),gatewayUrls:t})}let a=r.tokenID;return r.namespace==="erc1155"&&(a=a.replace("0x","").padStart(64,"0")),V6({gatewayUrls:t,uri:s.replace(/(?:0x)?{id}/,a)})}async function Oh(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 gr({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:fh,functionName:"resolve",args:[Kt(Ws(s)),Rt({abi:dh,functionName:"text",args:[zs(s),o]}),i??[Us]],blockNumber:n,blockTag:r},d=await J(e,rn,"readContract")(f);if(d[0]==="0x")return null;const h=Dn({abi:dh,functionName:"text",data:d[0]});return h===""?null:h}catch(f){if(c)throw f;if(Oc(f,"resolve"))return null;throw f}}async function Y6(e,{blockNumber:t,blockTag:n,assetGatewayUrls:r,name:o,gatewayUrls:s,strict:i,universalResolverAddress:c}){const a=await J(e,Oh,"getEnsText")({blockNumber:t,blockTag:n,key:"avatar",name:o,universalResolverAddress:c,gatewayUrls:s,strict:i});if(!a)return null;try{return await Z6(e,{record:a,gatewayUrls:r})}catch{return null}}async function X6(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=gr({blockNumber:n,chain:e.chain,contract:"ensUniversalResolver"})}const a=`${t.toLowerCase().substring(2)}.addr.reverse`;try{const u={address:c,abi:r6,functionName:"reverse",args:[Kt(Ws(a))],blockNumber:n,blockTag:r},l=J(e,rn,"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(Oc(u,"reverse"))return null;throw u}}async function Q6(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 gr({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 J(e,rn,"readContract")({address:i,abi:[{inputs:[{type:"bytes"}],name:"findResolver",outputs:[{type:"address"},{type:"bytes32"}],stateMutability:"view",type:"function"}],functionName:"findResolver",args:[Kt(Ws(o))],blockNumber:n,blockTag:r});return a}async function Nh(e,t){var v,C,y;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?St(n):void 0;try{Eo(t);const B=(typeof r=="bigint"?Q(r):void 0)||o,k=(y=(C=(v=e.chain)==null?void 0:v.formatters)==null?void 0:C.transactionRequest)==null?void 0:y.format,j=(k||Is)({...Ja(h,{format:k}),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($){throw bh($,{...t,account:m,chain:e.chain})}}async function J6(e){const t=$s(e,{method:"eth_newBlockFilter"}),n=await e.request({method:"eth_newBlockFilter"});return{id:n,request:t(n),type:"block"}}async function Ih(e,{address:t,args:n,event:r,events:o,fromBlock:s,strict:i,toBlock:c}={}){const a=o??(r?[r]:void 0),u=$s(e,{method:"eth_newFilter"});let l=[];a&&(l=[a.flatMap(d=>Xr({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"?Q(s):s,toBlock:typeof c=="bigint"?Q(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 Mh(e){const t=$s(e,{method:"eth_newPendingTransactionFilter"}),n=await e.request({method:"eth_newPendingTransactionFilter"});return{id:n,request:t(n),type:"transaction"}}async function e5(e){const t=await e.request({method:"eth_blobBaseFee"});return BigInt(t)}async function t5(e,{blockHash:t,blockNumber:n,blockTag:r="latest"}={}){const o=n!==void 0?Q(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}),Zt(s)}async function Lh(e,{address:t,blockNumber:n,blockTag:r="latest"}){const o=n!==void 0?Q(n):void 0,s=await e.request({method:"eth_getCode",params:[t,o||r]},{dedupe:!!o});if(s!=="0x")return s}class n5 extends H{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 r5(e,t){const{address:n,factory:r,factoryData:o}=t;try{const[s,i,c,a,u,l,f]=await J(e,rn,"readContract")({abi:o5,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 n5({address:n}):i}}const o5=[{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 s5(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 i5(e,{blockCount:t,blockNumber:n,blockTag:r="latest",rewardPercentiles:o}){const s=typeof n=="bigint"?Q(n):void 0,i=await e.request({method:"eth_feeHistory",params:[Q(t),s||r,o]},{dedupe:!!s});return s5(i)}async function a5(e,{filter:t}){const n=t.strict??!1,o=(await t.request({method:"eth_getFilterLogs",params:[t.id]})).map(s=>tn(s));return t.abi?ac({abi:t.abi,logs:o,strict:n}):o}class c5 extends H{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=>` ${eo(a)}`)],` Sender: ${s}`,` Data: ${r}`,` Callback selector: ${t}`,` Extra data: ${o}`].flat(),name:"OffchainLookupError"})}}class u5 extends H{constructor({result:t,url:n}){super("Offchain gateway response is malformed. Response data must be a hex value.",{metaMessages:[`Gateway URL: ${eo(n)}`,`Response: ${Ae(t)}`],name:"OffchainLookupResponseMalformedError"})}}class l5 extends H{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 f5="0x556f1830",Bh={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 d5(e,{blockNumber:t,blockTag:n,data:r,to:o}){const{args:s}=gp({data:r,abi:[Bh]}),[i,c,a,u,l]=s,{ccipRead:f}=e,p=f&&typeof(f==null?void 0:f.request)=="function"?f.request:kh;try{if(!Ms(o,i))throw new l5({sender:i,to:o});const d=c.includes(Us)?await Ph({data:a,ccipRequest:p}):await p({data:a,sender:i,urls:c}),{data:h}=await Po(e,{blockNumber:t,blockTag:n,data:Et([u,Jt([{type:"bytes"},{type:"bytes"}],[d,l])]),to:o});return h}catch(d){throw new c5({callbackSelector:u,cause:d,data:r,extraData:l,sender:i,urls:c})}}async function kh({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 Bn({body:a,details:f!=null&&f.error?Ae(f.error):l.statusText,headers:l.headers,status:l.status,url:i});continue}if(!vt(f)){r=new u5({result:f,url:i});continue}return f}catch(l){r=new Bn({body:a,details:l.message,url:i})}}throw r}const p5=Object.freeze(Object.defineProperty({__proto__:null,ccipRequest:kh,offchainLookup:d5,offchainLookupAbiItem:Bh,offchainLookupSignature:f5},Symbol.toStringTag,{value:"Module"}));function h5(e){return{formatters:void 0,fees:void 0,serializers:void 0,...e}}class m5 extends H{constructor({domain:t}){super(`Invalid domain "${Ae(t)}".`,{metaMessages:["Must be a valid EIP-712 domain."]})}}class g5 extends H{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 b5 extends H{constructor({type:t}){super(`Struct type "${t}" is invalid.`,{metaMessages:["Struct type must not be a Solidity type."],name:"InvalidStructTypeError"})}}function y5(e){const{domain:t={},message:n,primaryType:r}=e,o={EIP712Domain:S5({domain:t}),...e.types};E5({domain:t,message:n,primaryType:r,types:o});const s=["0x1901"];return t&&s.push(v5({domain:t,types:o})),r!=="EIP712Domain"&&s.push(Rh({data:n,primaryType:r,types:o})),Ne(Et(s))}function v5({domain:e,types:t}){return Rh({data:e,primaryType:"EIP712Domain",types:t})}function Rh({data:e,primaryType:t,types:n}){const r=Fh({data:e,primaryType:t,types:n});return Ne(r)}function Fh({data:e,primaryType:t,types:n}){const r=[{type:"bytes32"}],o=[w5({primaryType:t,types:n})];for(const s of n[t]){const[i,c]=jh({types:n,name:s.name,type:s.type,value:e[s.name]});r.push(i),o.push(c)}return Jt(r,o)}function w5({primaryType:e,types:t}){const n=Kt(x5({primaryType:e,types:t}));return Ne(n)}function x5({primaryType:e,types:t}){let n="";const r=Dh({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 Dh({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])Dh({primaryType:s.type,types:t},n);return n}function jh({types:e,name:t,type:n,value:r}){if(e[n]!==void 0)return[{type:"bytes32"},Ne(Fh({data:r,primaryType:n,types:e}))];if(n==="bytes")return r=`0x${(r.length%2?"0":"")+r.slice(2)}`,[{type:"bytes32"},Ne(r)];if(n==="string")return[{type:"bytes32"},Ne(Kt(r))];if(n.lastIndexOf("]")===n.length-1){const o=n.slice(0,n.lastIndexOf("[")),s=r.map(i=>jh({name:t,type:o,types:e,value:i}));return[{type:"bytes32"},Ne(Jt(s.map(([i])=>i),s.map(([,i])=>i)))]}return[{type:n},r]}function E5(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(sp);if(p&&(typeof f=="number"||typeof f=="bigint")){const[m,v,C]=p;Q(f,{signed:v==="int",size:Number.parseInt(C)/8})}if(l==="address"&&typeof f=="string"&&!ct(f))throw new yn({address:f});const d=l.match(lE);if(d){const[m,v]=d;if(v&&we(f)!==Number.parseInt(v))throw new xx({expectedSize:Number.parseInt(v),givenSize:we(f)})}const h=o[l];h&&(P5(l),s(h,f))}};if(o.EIP712Domain&&t){if(typeof t!="object")throw new m5({domain:t});s(o.EIP712Domain,t)}if(r!=="EIP712Domain")if(o[r])s(o[r],n);else throw new g5({primaryType:r,types:o})}function S5({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 P5(e){if(e==="address"||e==="bool"||e==="string"||e.startsWith("bytes")||e.startsWith("uint")||e.startsWith("int"))throw new b5({type:e})}const $5=`Ethereum Signed Message:
159
- `;function A5(e){const t=typeof e=="string"?qr(e):typeof e.raw=="string"?e.raw:$e(e.raw),n=qr(`${$5}${we(t)}`);return Et([n,t])}function _h(e,t){return Ne(A5(e),t)}const Uh="0x6492649264926492649264926492649264926492649264926492649264926492";function T5(e){return op(e,-32)===Uh}function C5(e){const{address:t,data:n,signature:r,to:o="hex"}=e,s=ur([Jt([{type:"address"},{type:"bytes"},{type:"bytes"}],[t,n,r]),Uh]);return o==="hex"?s:xt(s)}function O5(e){return e.map(t=>({...t,value:BigInt(t.value)}))}function N5(e){return{...e,balance:e.balance?BigInt(e.balance):void 0,nonce:e.nonce?Zt(e.nonce):void 0,storageProof:e.storageProof?O5(e.storageProof):void 0}}async function I5(e,{address:t,blockNumber:n,blockTag:r,storageKeys:o}){const s=r??"latest",i=n!==void 0?Q(n):void 0,c=await e.request({method:"eth_getProof",params:[t,o,i||s]});return N5(c)}async function M5(e,{address:t,blockNumber:n,blockTag:r="latest",slot:o}){const s=n!==void 0?Q(n):void 0;return await e.request({method:"eth_getStorageAt",params:[t,o,s||r]})}async function Bc(e,{blockHash:t,blockNumber:n,blockTag:r,hash:o,index:s}){var l,f,p;const i=r||"latest",c=n!==void 0?Q(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,Q(s)]},{dedupe:!0}):a=await e.request({method:"eth_getTransactionByBlockNumberAndIndex",params:[c||i,Q(s)]},{dedupe:!!c}),!a)throw new wp({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)||Ip)(a)}async function L5(e,{hash:t,transactionReceipt:n}){const[r,o]=await Promise.all([J(e,Ao,"getBlockNumber")({}),t?J(e,Bc,"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 Hs(e,{hash:t}){var o,s,i;const n=await e.request({method:"eth_getTransactionReceipt",params:[t]},{dedupe:!0});if(!n)throw new xp({hash:t});return(((i=(s=(o=e.chain)==null?void 0:o.formatters)==null?void 0:s.transactionReceipt)==null?void 0:i.format)||E6)(n)}async function B5(e,t){var C;const{account:n,allowFailure:r=!0,batchSize:o,blockNumber:s,blockTag:i,multicallAddress:c,stateOverride:a}=t,u=t.contracts,l=o??(typeof((C=e.batch)==null?void 0:C.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=gr({blockNumber:s,chain:e.chain,contract:"multicall3"})}const p=[[]];let d=0,h=0;for(let y=0;y<u.length;y++){const{abi:$,address:B,args:k,functionName:D}=u[y];try{const j=Rt({abi:$,args:k,functionName:D});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=hr(j,{abi:$,address:B,args:k,docsPath:"/docs/contract/multicall",functionName:D,sender:n});if(!r)throw g;p[d]=[...p[d],{allowFailure:!0,callData:"0x",target:B}]}}const m=await Promise.allSettled(p.map(y=>J(e,rn,"readContract")({abi:yc,account:n,address:f,args:[y],blockNumber:s,blockTag:i,functionName:"aggregate3",stateOverride:a}))),v=[];for(let y=0;y<m.length;y++){const $=m[y];if($.status==="rejected"){if(!r)throw $.reason;for(let k=0;k<p[y].length;k++)v.push({status:"failure",error:$.reason,result:void 0});continue}const B=$.value;for(let k=0;k<B.length;k++){const{returnData:D,success:j}=B[k],{callData:g}=p[y][k],{abi:w,address:A,functionName:I,args:N}=u[v.length];try{if(g==="0x")throw new Vr;if(!j)throw new Ts({data:D});const P=Dn({abi:w,args:N,data:D,functionName:I});v.push(r?{result:P,status:"success"}:P)}catch(P){const S=hr(P,{abi:w,address:A,args:N,docsPath:"/docs/contract/multicall",functionName:I});if(!r)throw S;v.push({error:S,result:void 0,status:"failure"})}}}if(v.length!==u.length)throw new H("multicall results mismatch");return v}async function kc(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?uh(p.blockOverrides):void 0,h=p.calls.map(v=>{const C=v,y=C.account?St(C.account):void 0,$=C.abi?Rt(C):C.data,B={...C,data:C.dataSuffix?Et([$||"0x",C.dataSuffix]):$,from:C.from??(y==null?void 0:y.address)};return Eo(B),Is(B)}),m=p.stateOverrides?ec(p.stateOverrides):void 0;a.push({blockOverrides:d,calls:h,stateOverrides:m})}const l=(typeof n=="bigint"?Q(n):void 0)||r;return(await e.request({method:"eth_simulateV1",params:[{blockStateCalls:a,returnFullTransactions:s,traceTransfers:i,validation:c},l]})).map((p,d)=>({...Mp(p),calls:p.calls.map((h,m)=>{var A,I;const{abi:v,args:C,functionName:y,to:$}=o[d].calls[m],B=((A=h.error)==null?void 0:A.data)??h.returnData,k=BigInt(h.gasUsed),D=(I=h.logs)==null?void 0:I.map(N=>tn(N)),j=h.status==="0x1"?"success":"failure",g=v&&j==="success"&&B!=="0x"?Dn({abi:v,data:B,functionName:y}):null,w=(()=>{var P;if(j==="success")return;let N;if(((P=h.error)==null?void 0:P.data)==="0x"?N=new Vr:h.error&&(N=new Ts(h.error)),!!N)return hr(N,{abi:v??[],address:$??"0x",args:C,functionName:y??"<unknown>"})})();return{data:B,gasUsed:k,logs:D,status:j,...j==="success"?{result:g}:{error:w}}})}))}catch(a){const u=a,l=Qa(u,{});throw l instanceof Ns?u:l}}function zh(e,t={}){const{as:n=typeof e=="string"?"Hex":"Bytes"}=t,r=Jd(W2(e));return n==="Bytes"?r:oh(r)}class k5 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 Rc={checksum:new k5(8192)}.checksum,R5=/^0x[a-fA-F0-9]{40}$/;function Vs(e,t={}){const{strict:n=!0}=t;if(!R5.test(e))throw new Wh({address:e,cause:new D5});if(n){if(e.toLowerCase()===e)return;if(F5(e)!==e)throw new Wh({address:e,cause:new j5})}}function F5(e){if(Rc.has(e))return Rc.get(e);Vs(e,{strict:!1});const t=e.substring(2).toLowerCase(),n=zh(G2(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 Rc.set(e,o),o}function Fc(e,t={}){const{strict:n=!0}=t??{};try{return Vs(e,{strict:n}),!0}catch{return!1}}class Wh 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 D5 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 j5 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 Dc(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 jc(e,t){const n=typeof e,r=t.type;switch(r){case"address":return Fc(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)=>jc(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=>jc(o,{...t,type:r.replace(/(\[[0-9]{0,}\])$/,"")})):!1}}function Hh(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 Hh(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")?Fc(n[r],{strict:!1}):i.includes("address")&&i.includes("bytes")?Fc(n[r],{strict:!1}):!1)return i}}function Vh(e,t={}){const{prepare:n=!0}=t,r=Array.isArray(e)||typeof e=="string"?Ed(e):e;return{...r,...n?{hash:br(r)}:{}}}function _5(e,t,n){const{args:r=[],prepare:o=!0}=n??{},s=J2(t,{strict:!1}),i=e.filter(u=>s?u.type==="function"||u.type==="error"?Gh(u)===bc(t,0,4):u.type==="event"?br(u)===t:!1:"name"in u&&u.name===t);if(i.length===0)throw new _c({name:t});if(i.length===1)return{...i[0],...o?{hash:br(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:br(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?jc(f,d):!1})){if(c&&"inputs"in c&&c.inputs){const f=Hh(u.inputs,c.inputs,r);if(f)throw new z5({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 _c({name:t});return{...a,...o?{hash:br(a)}:{}}}function Gh(e){return bc(br(e),0,4)}function U5(e){const t=typeof e=="string"?e:gs(e);return Dc(t)}function br(e){return typeof e!="string"&&"hash"in e&&e.hash?e.hash:zh(gc(U5(e)))}class z5 extends be{constructor(t,n){super("Found ambiguous types in overloaded ABI Items.",{metaMessages:[`\`${t.type}\` in \`${Dc(gs(t.abiItem))}\`, and`,`\`${n.type}\` in \`${Dc(gs(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 _c 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 W5=/^(.*)\[([0-9]*)\]$/,H5=/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/,qh=/^(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 V5({checksumAddress:e,parameters:t,values:n}){const r=[];for(let o=0;o<t.length;o++)r.push(Uc({checksumAddress:e,parameter:t[o],value:n[o]}));return r}function Uc({checksumAddress:e=!1,parameter:t,value:n}){const r=t,o=J5(r.type);if(o){const[s,i]=o;return q5(n,{checksumAddress:e,length:s,parameter:{...r,type:i}})}if(r.type==="tuple")return Q5(n,{checksumAddress:e,parameter:r});if(r.type==="address")return G5(n,{checksum:e});if(r.type==="bool")return K5(n);if(r.type.startsWith("uint")||r.type.startsWith("int")){const s=r.type.startsWith("int"),[,,i="256"]=qh.exec(r.type)??[];return Y5(n,{signed:s,size:Number(i)})}if(r.type.startsWith("bytes"))return Z5(n,{type:r.type});if(r.type==="string")return X5(n);throw new Xh(r.type)}function zc(e){let t=0;for(let s=0;s<e.length;s++){const{dynamic:i,encoded:c}=e[s];i?t+=32:t+=ut(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(ke(t+o,{size:32})),r.push(c),o+=ut(c)):n.push(c)}return Dt(...n,...r)}function G5(e,t){const{checksum:n=!1}=t;return Vs(e,{strict:n}),{dynamic:!1,encoded:_n(e.toLowerCase())}}function q5(e,t){const{checksumAddress:n,length:r,parameter:o}=t,s=r===null;if(!Array.isArray(e))throw new tS(e);if(!s&&e.length!==r)throw new eS({expectedLength:r,givenLength:e.length,type:`${o.type}[${r}]`});let i=!1;const c=[];for(let a=0;a<e.length;a++){const u=Uc({checksumAddress:n,parameter:o,value:e[a]});u.dynamic&&(i=!0),c.push(u)}if(s||i){const a=zc(c);if(s){const u=ke(c.length,{size:32});return{dynamic:!0,encoded:c.length>0?Dt(u,a):u}}if(i)return{dynamic:!0,encoded:a}}return{dynamic:!1,encoded:Dt(...c.map(({encoded:a})=>a))}}function Z5(e,{type:t}){const[,n]=t.split("bytes"),r=ut(e);if(!n){let o=e;return r%32!==0&&(o=Un(o,Math.ceil((e.length-2)/2/32)*32)),{dynamic:!0,encoded:Dt(_n(ke(r,{size:32})),o)}}if(r!==Number.parseInt(n))throw new Kh({expectedSize:Number.parseInt(n),value:e});return{dynamic:!1,encoded:Un(e)}}function K5(e){if(typeof e!="boolean")throw new be(`Invalid boolean value: "${e}" (type: ${typeof e}). Expected: \`true\` or \`false\`.`);return{dynamic:!1,encoded:_n(rh(e))}}function Y5(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 sh({max:r.toString(),min:o.toString(),signed:t,size:n/8,value:e.toString()})}return{dynamic:!1,encoded:ke(e,{size:32,signed:t})}}function X5(e){const t=gc(e),n=Math.ceil(ut(t)/32),r=[];for(let o=0;o<n;o++)r.push(Un(bc(t,o*32,(o+1)*32)));return{dynamic:!0,encoded:Dt(Un(ke(ut(t),{size:32})),...r)}}function Q5(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=Uc({checksumAddress:n,parameter:c,value:e[a]});s.push(u),u.dynamic&&(o=!0)}return{dynamic:o,encoded:o?zc(s):Dt(...s.map(({encoded:i})=>i))}}function J5(e){const t=e.match(/^(.*)\[(\d+)?\]$/);return t?[t[2]?Number(t[2]):null,t[1]]:void 0}function Zh(e,t,n){const{checksumAddress:r=!1}={};if(e.length!==t.length)throw new Yh({expectedLength:e.length,givenLength:t.length});const o=V5({checksumAddress:r,parameters:e,values:t}),s=zc(o);return s.length===0?"0x":s}function Wc(e,t){if(e.length!==t.length)throw new Yh({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(Wc.encode(o,s))}return Dt(...n)}(function(e){function t(n,r,o=!1){if(n==="address"){const a=r;return Vs(a),_n(a.toLowerCase(),o?32:0)}if(n==="string")return gc(r);if(n==="bytes")return r;if(n==="bool")return _n(rh(r),o?32:1);const s=n.match(qh);if(s){const[a,u,l="256"]=s,f=Number.parseInt(l)/8;return ke(r,{size:o?32:f,signed:u==="int"})}const i=n.match(H5);if(i){const[a,u]=i;if(Number.parseInt(u)!==(r.length-2)/2)throw new Kh({expectedSize:Number.parseInt(u),value:r});return Un(r,o?32:0)}const c=n.match(W5);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":Dt(...l)}throw new Xh(n)}e.encode=t})(Wc||(Wc={}));class eS 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 Kh extends be{constructor({expectedSize:t,value:n}){super(`Size of bytes "${n}" (bytes${ut(n)}) does not match expected size (bytes${t}).`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiParameters.BytesSizeMismatchError"})}}class Yh extends be{constructor({expectedLength:t,givenLength:n}){super(["ABI encoding parameters/values length mismatch.",`Expected length (parameters): ${t}`,`Given length (values): ${n}`].join(`
160
- `)),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiParameters.LengthMismatchError"})}}class tS 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 Xh 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 nS(e,t){var o;const{bytecode:n,args:r}=t;return Dt(n,(o=e.inputs)!=null&&o.length&&(r!=null&&r.length)?Zh(e.inputs,r):"0x")}function rS(e){return Vh(e)}function oS(e,...t){const{overloads:n}=e,r=n?sS([e,...n],e.name,{args:t[0]}):e,o=iS(r),s=t.length>0?Zh(r.inputs,t[0]):void 0;return s?Dt(o,s):o}function yr(e,t={}){return Vh(e,t)}function sS(e,t,n){const r=_5(e,t,n);if(r.type!=="function")throw new _c({name:t,type:"function"});return r}function iS(e){return Gh(e)}const aS="0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",jt="0x0000000000000000000000000000000000000000",cS="0x6080604052348015600e575f80fd5b5061016d8061001c5f395ff3fe608060405234801561000f575f80fd5b5060043610610029575f3560e01c8063f8b2cb4f1461002d575b5f80fd5b610047600480360381019061004291906100db565b61005d565b604051610054919061011e565b60405180910390f35b5f8173ffffffffffffffffffffffffffffffffffffffff16319050919050565b5f80fd5b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f6100aa82610081565b9050919050565b6100ba816100a0565b81146100c4575f80fd5b50565b5f813590506100d5816100b1565b92915050565b5f602082840312156100f0576100ef61007d565b5b5f6100fd848285016100c7565b91505092915050565b5f819050919050565b61011881610106565b82525050565b5f6020820190506101315f83018461010f565b9291505056fea26469706673582212203b9fe929fe995c7cf9887f0bdba8a36dd78e8b73f149b17d2d9ad7cd09d2dc6264736f6c634300081a0033";async function uS(e,t){const{blockNumber:n,blockTag:r,calls:o,stateOverrides:s,traceAssetChanges:i,traceTransfers:c,validation:a}=t,u=t.account?St(t.account):void 0;if(i&&!u)throw new H("`account` is required when `traceAssetChanges` is true");const l=u?nS(rS("constructor(bytes, bytes)"),{bytecode:mh,args:[cS,oS(yr("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:L}=await Nh(e,{account:u.address,...b,data:b.abi?Rt(b):b.data});return L.map(({address:F,storageKeys:U})=>U.length>0?F:null)})).then(b=>b.flat().filter(Boolean)):[],p=await kc(e,{blockNumber:n,blockTag:r,blocks:[...i?[{calls:[{data:l}],stateOverrides:s},{calls:f.map((b,L)=>({abi:[yr("function balanceOf(address) returns (uint256)")],functionName:"balanceOf",args:[u.address],to:b,from:jt,nonce:L})),stateOverrides:[{address:jt,nonce:0}]}]:[],{calls:[...o,{}].map(b=>({...b,from:u==null?void 0:u.address})),stateOverrides:s},...i?[{calls:[{data:l}]},{calls:f.map((b,L)=>({abi:[yr("function balanceOf(address) returns (uint256)")],functionName:"balanceOf",args:[u.address],to:b,from:jt,nonce:L})),stateOverrides:[{address:jt,nonce:0}]},{calls:f.map((b,L)=>({to:b,abi:[yr("function decimals() returns (uint256)")],functionName:"decimals",from:jt,nonce:L})),stateOverrides:[{address:jt,nonce:0}]},{calls:f.map((b,L)=>({to:b,abi:[yr("function tokenURI(uint256) returns (string)")],functionName:"tokenURI",args:[0n],from:jt,nonce:L})),stateOverrides:[{address:jt,nonce:0}]},{calls:f.map((b,L)=>({to:b,abi:[yr("function symbol() returns (string)")],functionName:"symbol",from:jt,nonce:L})),stateOverrides:[{address:jt,nonce:0}]}]:[]],traceTransfers:c,validation:a}),d=i?p[2]:p[0],[h,m,,v,C,y,$,B]=i?p:[],{calls:k,...D}=d,j=k.slice(0,-1)??[],g=(h==null?void 0:h.calls)??[],w=(m==null?void 0:m.calls)??[],A=[...g,...w].map(b=>b.status==="success"?Bt(b.data):null),I=(v==null?void 0:v.calls)??[],N=(C==null?void 0:C.calls)??[],P=[...I,...N].map(b=>b.status==="success"?Bt(b.data):null),S=((y==null?void 0:y.calls)??[]).map(b=>b.status==="success"?b.result:null),x=((B==null?void 0:B.calls)??[]).map(b=>b.status==="success"?b.result:null),T=(($==null?void 0:$.calls)??[]).map(b=>b.status==="success"?b.result:null),O=[];for(const[b,L]of P.entries()){const F=A[b];if(typeof L!="bigint"||typeof F!="bigint")continue;const U=S[b-1],z=x[b-1],V=T[b-1],Z=b===0?{address:aS,decimals:18,symbol:"ETH"}:{address:f[b-1],decimals:V||U?Number(U??1):void 0,symbol:z??void 0};O.some(W=>W.token.address===Z.address)||O.push({token:Z,value:{pre:F,post:L,diff:L-F}})}return{assetChanges:O,block:D,results:j}}class Qh extends Na{constructor(t,n){super(),this.finished=!1,this.destroyed=!1,_d(t);const r=Es(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),ar(s)}update(t){return ir(this),this.iHash.update(t),this}digestInto(t){ir(this),Xt(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 Jh=(e,t,n)=>new Qh(e,t).update(n).digest();Jh.create=(e,t)=>new Qh(e,t);/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const We=BigInt(0),Re=BigInt(1),zn=BigInt(2),e0=BigInt(3),t0=BigInt(4),n0=BigInt(5),lS=BigInt(7),r0=BigInt(8),fS=BigInt(9),o0=BigInt(16);function $t(e,t){const n=e%t;return n>=We?n:t+n}function lt(e,t,n){let r=e;for(;t-- >We;)r*=r,r%=n;return r}function s0(e,t){if(e===We)throw new Error("invert: expected non-zero number");if(t<=We)throw new Error("invert: expected positive modulus, got "+t);let n=$t(e,t),r=t,o=We,s=Re;for(;n!==We;){const c=r/n,a=r%n,u=o-s*c;r=n,n=a,o=s,s=u}if(r!==Re)throw new Error("invert: does not exist");return $t(o,t)}function Hc(e,t,n){if(!e.eql(e.sqr(t),n))throw new Error("Cannot find square root")}function i0(e,t){const n=(e.ORDER+Re)/t0,r=e.pow(t,n);return Hc(e,r,t),r}function dS(e,t){const n=(e.ORDER-n0)/r0,r=e.mul(t,zn),o=e.pow(r,n),s=e.mul(t,o),i=e.mul(e.mul(s,zn),o),c=e.mul(s,e.sub(i,e.ONE));return Hc(e,c,t),c}function pS(e){const t=Co(e),n=a0(e),r=n(t,t.neg(t.ONE)),o=n(t,r),s=n(t,t.neg(r)),i=(e+lS)/o0;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 Hc(c,v,a),v}}function a0(e){if(e<e0)throw new Error("sqrt is not defined for small field");let t=e-Re,n=0;for(;t%zn===We;)t/=zn,n++;let r=zn;const o=Co(e);for(;u0(o,r)===1;)if(r++>1e3)throw new Error("Cannot find square root: probably non-prime P");if(n===1)return i0;let s=o.pow(r,t);const i=(t+Re)/zn;return function(a,u){if(a.is0(u))return u;if(u0(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=Re<<BigInt(l-h-1),C=a.pow(f,v);l=h,f=a.sqr(C),p=a.mul(p,f),d=a.mul(d,C)}return d}}function hS(e){return e%t0===e0?i0:e%r0===n0?dS:e%o0===fS?pS(e):a0(e)}const mS=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function gS(e){const t={ORDER:"bigint",MASK:"bigint",BYTES:"number",BITS:"number"},n=mS.reduce((r,o)=>(r[o]="function",r),t);return hc(e,n),e}function bS(e,t,n){if(n<We)throw new Error("invalid exponent, negatives unsupported");if(n===We)return e.ONE;if(n===Re)return t;let r=e.ONE,o=t;for(;n>We;)n&Re&&(r=e.mul(r,o)),o=e.sqr(o),n>>=Re;return r}function c0(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 u0(e,t){const n=(e.ORDER-Re)/zn,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 l0(e,t){t!==void 0&&Zr(t);const n=t!==void 0?t:e.toString(2).length,r=Math.ceil(n/8);return{nBitLength:n,nByteLength:r}}function Co(e,t,n=!1,r={}){if(e<=We)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}=l0(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:So(a),ZERO:We,ONE:Re,allowedLengths:c,create:p=>$t(p,e),isValid:p=>{if(typeof p!="bigint")throw new Error("invalid field element: expected bigint, got "+typeof p);return We<=p&&p<e},is0:p=>p===We,isValidNot0:p=>!f.is0(p)&&f.isValid(p),isOdd:p=>(p&Re)===Re,neg:p=>$t(-p,e),eql:(p,d)=>p===d,sqr:p=>$t(p*p,e),add:(p,d)=>$t(p+d,e),sub:(p,d)=>$t(p-d,e),mul:(p,d)=>$t(p*d,e),pow:(p,d)=>bS(f,p,d),div:(p,d)=>$t(p*s0(d,e),e),sqrN:p=>p*p,addN:(p,d)=>p+d,subN:(p,d)=>p-d,mulN:(p,d)=>p*d,inv:p=>s0(p,e),sqrt:s||(p=>(l||(l=hS(e)),l(f,p))),toBytes:p=>n?Yp(p,u):dc(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?Kp(p):ks(p);if(i&&(h=$t(h,e)),!d&&!f.isValid(h))throw new Error("invalid field element: outside of range 0..ORDER");return h},invertBatch:p=>c0(f,p),cmov:(p,d,h)=>h?d:p});return Object.freeze(f)}function f0(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 d0(e){const t=f0(e);return t+Math.ceil(t/2)}function yS(e,t,n=!1){const r=e.length,o=f0(t),s=d0(t);if(r<16||r<s||r>1024)throw new Error("expected "+s+"-1024 bytes of input, got "+r);const i=n?Kp(e):ks(e),c=$t(i,t-Re)+Re;return n?Yp(c,o):dc(c,o)}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const vr=BigInt(0),Wn=BigInt(1);function Gs(e,t){const n=t.negate();return e?n:t}function Vc(e,t){const n=c0(e.Fp,t.map(r=>r.Z));return t.map((r,o)=>e.fromAffine(r.toAffine(n[o])))}function p0(e,t){if(!Number.isSafeInteger(e)||e<=0||e>t)throw new Error("invalid window size, expected [1.."+t+"], got W="+e)}function Gc(e,t){p0(e,t);const n=Math.ceil(t/e)+1,r=2**(e-1),o=2**e,s=So(e),i=BigInt(e);return{windows:n,windowSize:r,mask:s,maxNumber:o,shiftBy:i}}function h0(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+=Wn);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 vS(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 wS(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 qc=new WeakMap,m0=new WeakMap;function Zc(e){return m0.get(e)||1}function g0(e){if(e!==vr)throw new Error("invalid wNAF")}class xS{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>vr;)n&Wn&&(r=r.add(o)),o=o.double(),n>>=Wn;return r}precomputeWindow(t,n){const{windows:r,windowSize:o}=Gc(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=Gc(t,this.bits);for(let c=0;c<i.windows;c++){const{nextN:a,offset:u,isZero:l,isNeg:f,isNegF:p,offsetF:d}=h0(r,c,i);r=a,l?s=s.add(Gs(p,n[d])):o=o.add(Gs(f,n[u]))}return g0(r),{p:o,f:s}}wNAFUnsafe(t,n,r,o=this.ZERO){const s=Gc(t,this.bits);for(let i=0;i<s.windows&&r!==vr;i++){const{nextN:c,offset:a,isZero:u,isNeg:l}=h0(r,i,s);if(r=c,!u){const f=n[a];o=o.add(l?f.negate():f)}}return g0(r),o}getPrecomputes(t,n,r){let o=qc.get(n);return o||(o=this.precomputeWindow(n,t),t!==1&&(typeof r=="function"&&(o=r(o)),qc.set(n,o))),o}cached(t,n,r){const o=Zc(t);return this.wNAF(o,this.getPrecomputes(o,t,r),n)}unsafe(t,n,r,o){const s=Zc(t);return s===1?this._unsafeLadder(t,n,o):this.wNAFUnsafe(s,this.getPrecomputes(s,t,r),n,o)}createCache(t,n){p0(n,this.bits),m0.set(t,n),qc.delete(t)}hasCache(t){return Zc(t)!==1}}function ES(e,t,n,r){let o=t,s=e.ZERO,i=e.ZERO;for(;n>vr||r>vr;)n&Wn&&(s=s.add(o)),r&Wn&&(i=i.add(o)),o=o.double(),n>>=Wn,r>>=Wn;return{p1:s,p2:i}}function SS(e,t,n,r){vS(n,e),wS(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=Xp(BigInt(o));let a=1;c>12?a=c-3:c>4?a=c-2:c>0&&(a=2);const u=So(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],C=Number(v>>BigInt(d)&u);l[C]=l[C].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 b0(e,t,n){if(t){if(t.ORDER!==e)throw new Error("Field.ORDER must match order: Fp == p, Fn == n");return gS(t),t}else return Co(e,{isLE:n})}function PS(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>vr))throw new Error(`CURVE.${a} must be positive bigint`)}const o=b0(t.p,n.Fp,r),s=b0(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 y0=(e,t)=>(e+(e>=0?t:-t)/v0)/t;function $S(e,t,n){const[[r,o],[s,i]]=t,c=y0(i*e,n),a=y0(-o*e,n);let u=e-c*r-a*s,l=-c*o-a*i;const f=u<sn,p=l<sn;f&&(u=-u),p&&(l=-l);const d=So(Math.ceil(Xp(n)/2))+wr;if(u<sn||u>=d||l<sn||l>=d)throw new Error("splitScalar (endomorphism): failed, k="+e);return{k1neg:f,k1:u,k2neg:p,k2:l}}function Kc(e){if(!["compact","recovered","der"].includes(e))throw new Error('Signature format must be "compact", "recovered", or "der"');return e}function Yc(e,t){const n={};for(let r of Object.keys(t))n[r]=e[r]===void 0?t[r]:e[r];return Ls(n.lowS,"lowS"),Ls(n.prehash,"prehash"),n.format!==void 0&&Kc(n.format),n}class AS extends Error{constructor(t=""){super(t)}}const on={Err:AS,_tlv:{encode:(e,t)=>{const{Err:n}=on;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=Bs(r);if(o.length/2&128)throw new n("tlv.encode: long form length too big");const s=r>127?Bs(o.length/2|128):"";return Bs(e)+s+o+t},decode(e,t){const{Err:n}=on;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}=on;if(e<sn)throw new t("integer: negative integers are not allowed");let n=Bs(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}=on;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 ks(e)}},toSig(e){const{Err:t,_int:n,_tlv:r}=on,o=ze("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}=on,r=t.encode(2,n.encode(e.r)),o=t.encode(2,n.encode(e.s)),s=r+o;return t.encode(48,s)}},sn=BigInt(0),wr=BigInt(1),v0=BigInt(2),qs=BigInt(3),TS=BigInt(4);function xr(e,t){const{BYTES:n}=e;let r;if(typeof t=="bigint")r=t;else{let o=ze("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 CS(e,t={}){const n=PS("weierstrass",e,t),{Fp:r,Fn:o}=n;let s=n.CURVE;const{h:i,n:c}=s;hc(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=x0(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,y:T}=P.toAffine(),O=r.toBytes(x);if(Ls(S,"isCompressed"),S){l();const b=!r.isOdd(T);return bn(w0(b),O)}else return bn(Uint8Array.of(4),O,r.toBytes(T))}function p(N){jn(N,void 0,"Point");const{publicKey:P,publicKeyUncompressed:S}=u,x=N.length,T=N[0],O=N.subarray(1);if(x===P&&(T===2||T===3)){const b=r.fromBytes(O);if(!r.isValid(b))throw new Error("bad point: is not on curve, wrong x");const L=m(b);let F;try{F=r.sqrt(L)}catch(V){const Z=V instanceof Error?": "+V.message:"";throw new Error("bad point: is not on curve, sqrt error"+Z)}l();const U=r.isOdd(F);return(T&1)===1!==U&&(F=r.neg(F)),{x:b,y:F}}else if(x===S&&T===4){const b=r.BYTES,L=r.fromBytes(O.subarray(0,b)),F=r.fromBytes(O.subarray(b,b*2));if(!v(L,F))throw new Error("bad point: is not on curve");return{x:L,y:F}}else throw new Error(`bad point: got length ${x}, 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),x=m(N);return r.eql(S,x)}if(!v(s.Gx,s.Gy))throw new Error("bad curve params: generator point");const C=r.mul(r.pow(s.a,qs),TS),y=r.mul(r.sqr(s.b),BigInt(27));if(r.is0(r.add(C,y)))throw new Error("bad curve params: a or b");function $(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 w))throw new Error("ProjectivePoint expected")}function k(N){if(!a||!a.basises)throw new Error("no endo");return $S(N,a.basises,o.ORDER)}const D=Qp((N,P)=>{const{X:S,Y:x,Z:T}=N;if(r.eql(T,r.ONE))return{x:S,y:x};const O=N.is0();P==null&&(P=O?r.ONE:r.inv(T));const b=r.mul(S,P),L=r.mul(x,P),F=r.mul(T,P);if(O)return{x:r.ZERO,y:r.ZERO};if(!r.eql(F,r.ONE))throw new Error("invZ was invalid");return{x:b,y:L}}),j=Qp(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,x,T){return S=new w(r.mul(S.X,N),S.Y,S.Z),P=Gs(x,P),S=Gs(T,S),P.add(S)}class w{constructor(P,S,x){this.X=$("x",P),this.Y=$("y",S,!0),this.Z=$("z",x),Object.freeze(this)}static CURVE(){return s}static fromAffine(P){const{x:S,y:x}=P||{};if(!P||!r.isValid(S)||!r.isValid(x))throw new Error("invalid affine point");if(P instanceof w)throw new Error("projective point not allowed");return r.is0(S)&&r.is0(x)?w.ZERO:new w(S,x,r.ONE)}static fromBytes(P){const S=w.fromAffine(h(jn(P,void 0,"point")));return S.assertValidity(),S}static fromHex(P){return w.fromBytes(ze("pointHex",P))}get x(){return this.toAffine().x}get y(){return this.toAffine().y}precompute(P=8,S=!0){return I.createCache(this,P),S||this.multiply(qs),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:x,Z:T}=this,{X:O,Y:b,Z:L}=P,F=r.eql(r.mul(S,L),r.mul(O,T)),U=r.eql(r.mul(x,L),r.mul(b,T));return F&&U}negate(){return new w(this.X,r.neg(this.Y),this.Z)}double(){const{a:P,b:S}=s,x=r.mul(S,qs),{X:T,Y:O,Z:b}=this;let L=r.ZERO,F=r.ZERO,U=r.ZERO,z=r.mul(T,T),V=r.mul(O,O),Z=r.mul(b,b),W=r.mul(T,O);return W=r.add(W,W),U=r.mul(T,b),U=r.add(U,U),L=r.mul(P,U),F=r.mul(x,Z),F=r.add(L,F),L=r.sub(V,F),F=r.add(V,F),F=r.mul(L,F),L=r.mul(W,L),U=r.mul(x,U),Z=r.mul(P,Z),W=r.sub(z,Z),W=r.mul(P,W),W=r.add(W,U),U=r.add(z,z),z=r.add(U,z),z=r.add(z,Z),z=r.mul(z,W),F=r.add(F,z),Z=r.mul(O,b),Z=r.add(Z,Z),z=r.mul(Z,W),L=r.sub(L,z),U=r.mul(Z,V),U=r.add(U,U),U=r.add(U,U),new w(L,F,U)}add(P){B(P);const{X:S,Y:x,Z:T}=this,{X:O,Y:b,Z:L}=P;let F=r.ZERO,U=r.ZERO,z=r.ZERO;const V=s.a,Z=r.mul(s.b,qs);let W=r.mul(S,O),K=r.mul(x,b),G=r.mul(T,L),X=r.add(S,x),ee=r.add(O,b);X=r.mul(X,ee),ee=r.add(W,K),X=r.sub(X,ee),ee=r.add(S,T);let le=r.add(O,L);return ee=r.mul(ee,le),le=r.add(W,G),ee=r.sub(ee,le),le=r.add(x,T),F=r.add(b,L),le=r.mul(le,F),F=r.add(K,G),le=r.sub(le,F),z=r.mul(V,ee),F=r.mul(Z,G),z=r.add(F,z),F=r.sub(K,z),z=r.add(K,z),U=r.mul(F,z),K=r.add(W,W),K=r.add(K,W),G=r.mul(V,G),ee=r.mul(Z,ee),K=r.add(K,G),G=r.sub(W,G),G=r.mul(V,G),ee=r.add(ee,G),W=r.mul(K,ee),U=r.add(U,W),W=r.mul(le,ee),F=r.mul(X,F),F=r.sub(F,W),W=r.mul(X,K),z=r.mul(le,z),z=r.add(z,W),new w(F,U,z)}subtract(P){return this.add(P.negate())}is0(){return this.equals(w.ZERO)}multiply(P){const{endo:S}=t;if(!o.isValidNot0(P))throw new Error("invalid scalar: out of range");let x,T;const O=b=>I.cached(this,b,L=>Vc(w,L));if(S){const{k1neg:b,k1:L,k2neg:F,k2:U}=k(P),{p:z,f:V}=O(L),{p:Z,f:W}=O(U);T=V.add(W),x=g(S.beta,z,Z,b,F)}else{const{p:b,f:L}=O(P);x=b,T=L}return Vc(w,[x,T])[0]}multiplyUnsafe(P){const{endo:S}=t,x=this;if(!o.isValid(P))throw new Error("invalid scalar: out of range");if(P===sn||x.is0())return w.ZERO;if(P===wr)return x;if(I.hasCache(this))return this.multiply(P);if(S){const{k1neg:T,k1:O,k2neg:b,k2:L}=k(P),{p1:F,p2:U}=ES(w,x,O,L);return g(S.beta,F,U,T,b)}else return I.unsafe(x,P)}multiplyAndAddUnsafe(P,S,x){const T=this.multiplyUnsafe(S).add(P.multiplyUnsafe(x));return T.is0()?void 0:T}toAffine(P){return D(this,P)}isTorsionFree(){const{isTorsionFree:P}=t;return i===wr?!0:P?P(w,this):I.unsafe(this,c).is0()}clearCofactor(){const{clearCofactor:P}=t;return i===wr?this:P?P(w,this):this.multiplyUnsafe(i)}isSmallOrder(){return this.multiplyUnsafe(i).is0()}toBytes(P=!0){return Ls(P,"isCompressed"),this.assertValidity(),d(w,this,P)}toHex(P=!0){return cr(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 Vc(w,P)}static msm(P,S){return SS(w,o,P,S)}static fromPrivateKey(P){return w.BASE.multiply(xr(o,P))}}w.BASE=new w(s.Gx,s.Gy,r.ONE),w.ZERO=new w(r.ZERO,r.ONE,r.ZERO),w.Fp=r,w.Fn=o;const A=o.BITS,I=new xS(w,t.endo?Math.ceil(A/2):A);return w.BASE.precompute(8),w}function w0(e){return Uint8Array.of(e?2:3)}function x0(e,t){return{secretKey:t.BYTES,publicKey:1+e.BYTES,publicKeyUncompressed:1+2*e.BYTES,publicKeyHasPrefix:!0,signature:2*t.BYTES}}function OS(e,t={}){const{Fn:n}=e,r=t.randomBytes||Gd,o=Object.assign(x0(e.Fp,n),{seed:d0(n.ORDER)});function s(d){try{return!!xr(n,d)}catch{return!1}}function i(d,h){const{publicKey:m,publicKeyUncompressed:v}=o;try{const C=d.length;return h===!0&&C!==m||h===!1&&C!==v?!1:!!e.fromBytes(d)}catch{return!1}}function c(d=r(o.seed)){return yS(jn(d,o.seed,"seed"),n.ORDER)}function a(d,h=!0){return e.BASE.multiply(xr(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 C=ze("key",d).length;return C===m||C===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=xr(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=>xr(n,d),precompute(d=8,h=e.BASE){return h.precompute(d,!1)}},lengths:o})}function NS(e,t,n={}){_d(t),hc(n,{},{hmac:"function",lowS:"boolean",randomBytes:"function",bits2int:"function",bits2int_modN:"function"});const r=n.randomBytes||Gd,o=n.hmac||((S,...x)=>Jh(t,S,bn(...x))),{Fp:s,Fn:i}=e,{ORDER:c,BITS:a}=i,{keygen:u,getPublicKey:l,getSharedSecret:f,utils:p,lengths:d}=OS(e,n),h={prehash:!1,lowS:typeof n.lowS=="boolean"?n.lowS:!1,format:void 0,extraEntropy:!1},m="compact";function v(S){const x=c>>wr;return S>x}function C(S,x){if(!i.isValidNot0(x))throw new Error(`invalid signature ${S}: out of range 1..Point.Fn.ORDER`);return x}function y(S,x){Kc(x);const T=d.signature,O=x==="compact"?T:x==="recovered"?T+1:void 0;return jn(S,O,`${x} signature`)}class ${constructor(x,T,O){this.r=C("r",x),this.s=C("s",T),O!=null&&(this.recovery=O),Object.freeze(this)}static fromBytes(x,T=m){y(x,T);let O;if(T==="der"){const{r:U,s:z}=on.toSig(jn(x));return new $(U,z)}T==="recovered"&&(O=x[0],T="compact",x=x.subarray(1));const b=i.BYTES,L=x.subarray(0,b),F=x.subarray(b,b*2);return new $(i.fromBytes(L),i.fromBytes(F),O)}static fromHex(x,T){return this.fromBytes(xs(x),T)}addRecoveryBit(x){return new $(this.r,this.s,x)}recoverPublicKey(x){const T=s.ORDER,{r:O,s:b,recovery:L}=this;if(L==null||![0,1,2,3].includes(L))throw new Error("recovery id invalid");if(c*v0<T&&L>1)throw new Error("recovery id is ambiguous for h>1 curve");const U=L===2||L===3?O+c:O;if(!s.isValid(U))throw new Error("recovery id 2 or 3 invalid");const z=s.toBytes(U),V=e.fromBytes(bn(w0((L&1)===0),z)),Z=i.inv(U),W=k(ze("msgHash",x)),K=i.create(-W*Z),G=i.create(b*Z),X=e.BASE.multiplyUnsafe(K).add(V.multiplyUnsafe(G));if(X.is0())throw new Error("point at infinify");return X.assertValidity(),X}hasHighS(){return v(this.s)}toBytes(x=m){if(Kc(x),x==="der")return xs(on.hexFromSig(this));const T=i.toBytes(this.r),O=i.toBytes(this.s);if(x==="recovered"){if(this.recovery==null)throw new Error("recovery bit must be present");return bn(Uint8Array.of(this.recovery),T,O)}return bn(T,O)}toHex(x){return cr(this.toBytes(x))}assertValidity(){}static fromCompact(x){return $.fromBytes(ze("sig",x),"compact")}static fromDER(x){return $.fromBytes(ze("sig",x),"der")}normalizeS(){return this.hasHighS()?new $(this.r,i.neg(this.s),this.recovery):this}toDERRawBytes(){return this.toBytes("der")}toDERHex(){return cr(this.toBytes("der"))}toCompactRawBytes(){return this.toBytes("compact")}toCompactHex(){return cr(this.toBytes("compact"))}}const B=n.bits2int||function(x){if(x.length>8192)throw new Error("input is too large");const T=ks(x),O=x.length*8-a;return O>0?T>>BigInt(O):T},k=n.bits2int_modN||function(x){return i.create(B(x))},D=So(a);function j(S){return M2("num < 2^"+a,S,sn,D),i.toBytes(S)}function g(S,x){return jn(S,void 0,"message"),x?jn(t(S),void 0,"prehashed message"):S}function w(S,x,T){if(["recovered","canonical"].some(K=>K in T))throw new Error("sign() legacy options not supported");const{lowS:O,prehash:b,extraEntropy:L}=Yc(T,h);S=g(S,b);const F=k(S),U=xr(i,x),z=[j(U),j(F)];if(L!=null&&L!==!1){const K=L===!0?r(d.secretKey):L;z.push(ze("extraEntropy",K))}const V=bn(...z),Z=F;function W(K){const G=B(K);if(!i.isValidNot0(G))return;const X=i.inv(G),ee=e.BASE.multiply(G).toAffine(),le=i.create(ee.x);if(le===sn)return;const xe=i.create(X*i.create(Z+le*U));if(xe===sn)return;let oe=(ee.x===le?0:2)|Number(ee.y&wr),fe=xe;return O&&v(xe)&&(fe=i.neg(xe),oe^=1),new $(le,fe,oe)}return{seed:V,k2sig:W}}function A(S,x,T={}){S=ze("message",S);const{seed:O,k2sig:b}=w(S,x,T);return L2(t.outputLen,i.BYTES,o)(O,b)}function I(S){let x;const T=typeof S=="string"||ws(S),O=!T&&S!==null&&typeof S=="object"&&typeof S.r=="bigint"&&typeof S.s=="bigint";if(!T&&!O)throw new Error("invalid signature, expected Uint8Array, hex string or Signature instance");if(O)x=new $(S.r,S.s);else if(T){try{x=$.fromBytes(ze("sig",S),"der")}catch(b){if(!(b instanceof on.Err))throw b}if(!x)try{x=$.fromBytes(ze("sig",S),"compact")}catch{return!1}}return x||!1}function N(S,x,T,O={}){const{lowS:b,prehash:L,format:F}=Yc(O,h);if(T=ze("publicKey",T),x=g(ze("message",x),L),"strict"in O)throw new Error("options.strict was renamed to lowS");const U=F===void 0?I(S):$.fromBytes(ze("sig",S),F);if(U===!1)return!1;try{const z=e.fromBytes(T);if(b&&U.hasHighS())return!1;const{r:V,s:Z}=U,W=k(x),K=i.inv(Z),G=i.create(W*K),X=i.create(V*K),ee=e.BASE.multiplyUnsafe(G).add(z.multiplyUnsafe(X));return ee.is0()?!1:i.create(ee.x)===V}catch{return!1}}function P(S,x,T={}){const{prehash:O}=Yc(T,h);return x=g(x,O),$.fromBytes(S,"recovered").recoverPublicKey(x).toBytes()}return Object.freeze({keygen:u,getPublicKey:l,getSharedSecret:f,utils:p,lengths:d,Point:e,sign:A,verify:N,recoverPublicKey:P,Signature:$,hash:t})}function IS(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=Co(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 MS(e){const{CURVE:t,curveOpts:n}=IS(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 LS(e,t){const n=t.Point;return Object.assign({},t,{ProjectivePoint:n,CURVE:Object.assign({},e,l0(n.Fn.ORDER,n.Fn.BITS))})}function BS(e){const{CURVE:t,curveOpts:n,hash:r,ecdsaOpts:o}=MS(e),s=CS(t,n),i=NS(s,r,o);return LS(e,i)}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */function kS(e,t){const n=r=>BS({...e,hash:r});return{...n(t),create:n}}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const Xc={p:BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),n:BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),h:BigInt(1),a:BigInt(0),b:BigInt(7),Gx:BigInt("0x79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798"),Gy:BigInt("0x483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8")},RS={beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),basises:[[BigInt("0x3086d221a7d46bcde86c90e49284eb15"),-BigInt("0xe4437ed6010e88286f547fa90abfe4c3")],[BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),BigInt("0x3086d221a7d46bcde86c90e49284eb15")]]},E0=BigInt(2);function FS(e){const t=Xc.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=lt(l,n,t)*l%t,p=lt(f,n,t)*l%t,d=lt(p,E0,t)*u%t,h=lt(d,o,t)*d%t,m=lt(h,s,t)*h%t,v=lt(m,c,t)*m%t,C=lt(v,a,t)*v%t,y=lt(C,c,t)*m%t,$=lt(y,n,t)*l%t,B=lt($,i,t)*h%t,k=lt(B,r,t)*u%t,D=lt(k,E0,t);if(!Qc.eql(Qc.sqr(D),e))throw new Error("Cannot find square root");return D}const Qc=Co(Xc.p,{sqrt:FS}),S0=kS({...Xc,Fp:Qc,lowS:!0,endo:RS},Fp),DS=Object.freeze(Object.defineProperty({__proto__:null,secp256k1:S0},Symbol.toStringTag,{value:"Module"}));function jS({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 S0.Signature(Bt(e),Bt(t)).toCompactHex()}${s===0?"1b":"1c"}`;return n==="hex"?i:xt(i)}async function Jc(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=vt(i)?i:typeof i=="object"&&"r"in i&&"s"in i?jS(i):$e(i),l=await(async()=>!r&&!o||T5(u)?u:C5({address:r,data:o,signature:u}))();try{const h=c?{to:c,data:Rt({abi:hh,functionName:"isValidSig",args:[n,s,l]}),...a}:{data:Sc({abi:hh,args:[n,s,l],bytecode:i6}),...a},{data:m}=await J(e,Po,"call")(h);return Nx(m??"0x0")}catch(h){try{if(Ms(aE(n),await $p({hash:s,signature:i})))return!0}catch{}if(h instanceof Ep)return!1;throw h}}async function _S(e,{address:t,message:n,factory:r,factoryData:o,signature:s,...i}){const c=_h(n);return Jc(e,{address:t,factory:r,factoryData:o,hash:c,signature:s,...i})}async function US(e,t){const{address:n,factory:r,factoryData:o,signature:s,message:i,primaryType:c,types:a,domain:u,...l}=t,f=y5({message:i,primaryType:c,types:a,domain:u});return Jc(e,{address:n,factory:r,factoryData:o,hash:f,signature:s,...l})}function P0(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=Ae(["watchBlockNumber",e.uid,t,n,i]);return xn(f,{onBlockNumber:r,onError:o},p=>$o(async()=>{var d;try{const h=await J(e,Ao,"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=Ae(["watchBlockNumber",e.uid,t,n]);return xn(f,{onBlockNumber:r,onError:o},p=>{let d=!0,h=()=>d=!1;return(async()=>{try{const m=(()=>{if(e.transport.type==="fallback"){const C=e.transport.transports.find(y=>y.config.type==="webSocket"||y.config.type==="ipc");return C?C.value:e.transport}return e.transport})(),{unsubscribe:v}=await m.subscribe({params:["newHeads"],onData(C){var $;if(!d)return;const y=Bt(($=C.result)==null?void 0:$.number);p.onBlockNumber(y,a),a=y},onError(C){var y;(y=p.onError)==null||y.call(p,C)}});h=v,d||h()}catch(m){o==null||o(m)}})(),()=>h()})})()}async function zS(e,t){const{checkReplacement:n=!0,confirmations:r=1,hash:o,onReplaced:s,retryCount:i=6,retryDelay:c=({count:k})=>~~(1<<k)*200,timeout:a=18e4}=t,u=Ae(["waitForTransactionReceipt",e.uid,o]),l=(()=>{var k;return t.pollingInterval?t.pollingInterval:(k=e.chain)!=null&&k.experimental_preconfirmationTime?e.chain.experimental_preconfirmationTime:e.pollingInterval})();let f,p,d,h=!1,m,v;const{promise:C,resolve:y,reject:$}=yh(),B=a?setTimeout(()=>{v(),m(),$(new _E({hash:o}))},a):void 0;return m=xn(u,{onReplaced:s,resolve:y,reject:$},async k=>{if(d=await J(e,Hs,"getTransactionReceipt")({hash:o}).catch(()=>{}),d&&r<=1){clearTimeout(B),k.resolve(d),m();return}v=J(e,P0,"watchBlockNumber")({emitMissed:!0,emitOnBegin:!0,poll:!0,pollingInterval:l,async onBlockNumber(D){const j=w=>{clearTimeout(B),v(),w(),m()};let g=D;if(!h)try{if(d){if(r>1&&(!d.blockNumber||g-d.blockNumber+1n<r))return;j(()=>k.resolve(d));return}if(n&&!f&&(h=!0,await Tc(async()=>{f=await J(e,Bc,"getTransaction")({hash:o}),f.blockNumber&&(g=f.blockNumber)},{delay:c,retryCount:i}),h=!1),d=await J(e,Hs,"getTransactionReceipt")({hash:o}),r>1&&(!d.blockNumber||g-d.blockNumber+1n<r))return;j(()=>k.resolve(d))}catch(w){if(w instanceof wp||w instanceof xp){if(!f){h=!1;return}try{p=f,h=!0;const A=await Tc(()=>J(e,Ft,"getBlock")({blockNumber:g,includeTransactions:!0}),{delay:c,retryCount:i,shouldRetry:({error:P})=>P instanceof Op});h=!1;const I=A.transactions.find(({from:P,nonce:S})=>P===p.from&&S===p.nonce);if(!I||(d=await J(e,Hs,"getTransactionReceipt")({hash:I.hash}),r>1&&(!d.blockNumber||g-d.blockNumber+1n<r)))return;let N="replaced";I.to===p.to&&I.value===p.value&&I.input===p.input?N="repriced":I.from===I.to&&I.value===0n&&(N="cancelled"),j(()=>{var P;(P=k.onReplaced)==null||P.call(k,{reason:N,replacedTransaction:p,transaction:I,transactionReceipt:d}),k.resolve(d)})}catch(A){j(()=>k.reject(A))}}else j(()=>k.reject(w))}}})}),C}function WS(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=Ae(["watchBlocks",e.uid,t,n,r,l,a]);return xn(h,{onBlock:o,onError:s},m=>$o(async()=>{var v;try{const C=await J(e,Ft,"getBlock")({blockTag:t,includeTransactions:l});if(C.number!==null&&(f==null?void 0:f.number)!=null){if(C.number===f.number)return;if(C.number-f.number>1&&n)for(let y=(f==null?void 0:f.number)+1n;y<C.number;y++){const $=await J(e,Ft,"getBlock")({blockNumber:y,includeTransactions:l});m.onBlock($,f),f=$}}((f==null?void 0:f.number)==null||t==="pending"&&(C==null?void 0:C.number)==null||C.number!==null&&C.number>f.number)&&(m.onBlock(C,f),f=C)}catch(C){(v=m.onError)==null||v.call(m,C)}},{emitOnBegin:r,interval:a}))})():(()=>{let h=!0,m=!0,v=()=>h=!1;return(async()=>{try{r&&J(e,Ft,"getBlock")({blockTag:t,includeTransactions:l}).then($=>{h&&m&&(o($,void 0),m=!1)}).catch(s);const C=(()=>{if(e.transport.type==="fallback"){const $=e.transport.transports.find(B=>B.config.type==="webSocket"||B.config.type==="ipc");return $?$.value:e.transport}return e.transport})(),{unsubscribe:y}=await C.subscribe({params:["newHeads"],async onData($){var k;if(!h)return;const B=await J(e,Ft,"getBlock")({blockNumber:(k=$.result)==null?void 0:k.number,includeTransactions:l}).catch(()=>{});h&&(o(B,f),m=!1,f=B)},onError($){s==null||s($)}});v=y,h||v()}catch(C){s==null||s(C)}})(),()=>v()})()}function HS(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=Ae(["watchEvent",t,n,r,e.uid,o,l,i]);return xn(v,{onLogs:a,onError:c},C=>{let y;i!==void 0&&(y=i-1n);let $,B=!1;const k=$o(async()=>{var D;if(!B){try{$=await J(e,Ih,"createEventFilter")({address:t,args:n,event:o,events:s,strict:d,fromBlock:i})}catch{}B=!0;return}try{let j;if($)j=await J(e,Rs,"getFilterChanges")({filter:$});else{const g=await J(e,Ao,"getBlockNumber")({});y&&y!==g?j=await J(e,cc,"getLogs")({address:t,args:n,event:o,events:s,fromBlock:y+1n,toBlock:g}):j=[],y=g}if(j.length===0)return;if(r)C.onLogs(j);else for(const g of j)C.onLogs([g])}catch(j){$&&j instanceof Rn&&(B=!1),(D=C.onError)==null||D.call(C,j)}},{emitOnBegin:!0,interval:l});return async()=>{$&&await J(e,Fs,"uninstallFilter")({filter:$}),k()}})})():(()=>{let v=!0,C=()=>v=!1;return(async()=>{try{const y=(()=>{if(e.transport.type==="fallback"){const D=e.transport.transports.find(j=>j.config.type==="webSocket"||j.config.type==="ipc");return D?D.value:e.transport}return e.transport})(),$=s??(o?[o]:void 0);let B=[];$&&(B=[$.flatMap(j=>Xr({abi:[j],eventName:j.name,args:n}))],o&&(B=B[0]));const{unsubscribe:k}=await y.subscribe({params:["logs",{address:t,topics:B}],onData(D){var g;if(!v)return;const j=D.result;try{const{eventName:w,args:A}=ic({abi:$??[],data:j.data,topics:j.topics,strict:d}),I=tn(j,{args:A,eventName:w});a([I])}catch(w){let A,I;if(w instanceof Gr||w instanceof ys){if(f)return;A=w.abiItem.name,I=(g=w.abiItem.inputs)==null?void 0:g.some(P=>!("name"in P&&P.name))}const N=tn(j,{args:I?[]:{},eventName:A});a([N])}},onError(D){c==null||c(D)}});C=k,v||C()}catch(y){c==null||c(y)}})(),()=>C()})()}function VS(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=Ae(["watchPendingTransactions",e.uid,t,s]);return xn(u,{onTransactions:r,onError:n},l=>{let f;const p=$o(async()=>{var d;try{if(!f)try{f=await J(e,Mh,"createPendingTransactionFilter")({});return}catch(m){throw p(),m}const h=await J(e,Rs,"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 J(e,Fs,"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 GS(e){var f,p,d;const{scheme:t,statement:n,...r}=((f=e.match(qS))==null?void 0:f.groups)??{},{chainId:o,expirationTime:s,issuedAt:i,notBefore:c,requestId:a,...u}=((p=e.match(ZS))==null?void 0:p.groups)??{},l=(d=e.split("Resources:")[1])==null?void 0:d.split(`
161
- - `).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 qS=/^(?:(?<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)?/,ZS=/(?: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 KS(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||!ct(r.address,{strict:!1})||t&&!Ms(r.address,t))return!1}catch{return!1}return!0}async function YS(e,t){const{address:n,domain:r,message:o,nonce:s,scheme:i,signature:c,time:a=new Date,...u}=t,l=GS(o);if(!l.address||!KS({address:n,domain:r,message:l,nonce:s,scheme:i,time:a}))return!1;const p=_h(o);return Jc(e,{address:l.address,hash:p,signature:c,...u})}function XS(e){return{call:t=>Po(e,t),createAccessList:t=>Nh(e,t),createBlockFilter:()=>J6(e),createContractEventFilter:t=>up(e,t),createEventFilter:t=>Ih(e,t),createPendingTransactionFilter:()=>Mh(e),estimateContractGas:t=>C2(e,t),estimateGas:t=>sc(e,t),getBalance:t=>Vp(e,t),getBlobBaseFee:()=>e5(e),getBlock:t=>Ft(e,t),getBlockNumber:t=>Ao(e,t),getBlockTransactionCount:t=>t5(e,t),getBytecode:t=>Lh(e,t),getChainId:()=>zp(e),getCode:t=>Lh(e,t),getContractEvents:t=>qp(e,t),getEip712Domain:t=>r5(e,t),getEnsAddress:t=>F6(e,t),getEnsAvatar:t=>Y6(e,t),getEnsName:t=>X6(e,t),getEnsResolver:t=>Q6(e,t),getEnsText:t=>Oh(e,t),getFeeHistory:t=>i5(e,t),estimateFeesPerGas:t=>f2(e,t),getFilterChanges:t=>Rs(e,t),getFilterLogs:t=>a5(e,t),getGasPrice:()=>nc(e),getLogs:t=>cc(e,t),getProof:t=>I5(e,t),estimateMaxPriorityFeePerGas:t=>l2(e,t),getStorageAt:t=>M5(e,t),getTransaction:t=>Bc(e,t),getTransactionConfirmations:t=>L5(e,t),getTransactionCount:t=>Bp(e,t),getTransactionReceipt:t=>Hs(e,t),multicall:t=>B5(e,t),prepareTransactionRequest:t=>Hp(e,t),readContract:t=>rn(e,t),sendRawTransaction:t=>w6(e,t),simulate:t=>kc(e,t),simulateBlocks:t=>kc(e,t),simulateCalls:t=>uS(e,t),simulateContract:t=>d6(e,t),verifyMessage:t=>_S(e,t),verifySiweMessage:t=>YS(e,t),verifyTypedData:t=>US(e,t),uninstallFilter:t=>Fs(e,t),waitForTransactionReceipt:t=>zS(e,t),watchBlocks:t=>WS(e,t),watchBlockNumber:t=>P0(e,t),watchContractEvent:t=>v6(e,t),watchEvent:t=>HS(e,t),watchPendingTransactions:t=>VS(e,t)}}function QS(e){const{key:t="public",name:n="Public Client"}=e;return S6({...e,key:t,name:n,type:"publicClient"}).extend(XS)}const JS=h5({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}}}),eP=Object.values({MAINNET:1,SEPOLIA:11155111}),an=e=>{const t=typeof e=="string"?parseInt(e,10):e;return eP.includes(t)},tP={USDT:!0},$0=(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:!tP[t.toUpperCase()]:!0},Oo=({size:e="xs",color:t,className:n="",label:r="Loading...",inline:o=!1})=>{const s=t?`loading-${t}`:"",i=o?"loading-inline":"";return M.jsx("span",{className:`loading loading-${e} loading-spinner ${s} ${i} ${n}`.trim(),"aria-label":r,role:"status","aria-live":"polite"})},nP=({depositAmount:e,curSelectToken:t,approved:n,currentActiveChain:r,tokenBalance:o,platformBalance:s="0",showLayerZeroTip:i=!1,layerZeroTipKey:c,onDepositAmountChange:a,onApproved:u})=>{const{t:l}=pt(),[f,p]=E.useState(!1);E.useEffect(()=>{n&&f&&p(!1)},[n,f]);const d=E.useCallback(async()=>{if(!f)try{p(!0),await u()}catch(y){p(!1),console.error("Approve failed:",y)}},[u,f]),h=E.useCallback(()=>{let y=o||"0";if($0(r==null?void 0:r.chainId,t))try{const $=new Le(y),B=new Le("200000");$.gt(B)&&(y="200000")}catch($){console.warn("Error calculating max amount limit:",$)}return y},[o,r==null?void 0:r.chainId,t]),m=E.useMemo(()=>{if(!$0(r==null?void 0:r.chainId,t))return!1;try{const y=new Le(e||"0"),$=new Le("200000");return y.isNaN()||$.isNaN()?!1:y.gte($)}catch{return!1}},[r,e,t]),v=y=>{const $=y.target.value,B=h(),k=ra($,B);if(k.isValid)a(k.formattedValue),k.errorType;else return k.errorType==="exceed_balance",void 0},C=()=>{const y=parseFloat(o||"0"),$=parseFloat(e||"0");if($>0){const B=y-$,k=gt(Math.max(0,B).toString());return M.jsxs("span",{className:"flex items-center gap-1",children:[gt(o||"0"),M.jsx("span",{className:"text-sm font-edgex-harmony text-functional-green-1 leading-[18px] font-medium",children:"→"}),k," ",t]})}return`${gt(o||"0")} ${t}`};return M.jsxs(M.Fragment,{children:[M.jsxs("div",{className:"bg-fill-input-primary rounded-lg px-3 py-3 my-4",children:[M.jsxs("div",{className:"flex justify-between items-center h-[18px] mb-3",children:[M.jsx("input",{type:"text",placeholder:l("deposit.amount"),value:e,onChange:v,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"}),M.jsx("button",{onClick:()=>{const y=h();a(y)},className:"text-theme-normal text-xs font-medium cursor-pointer hover:opacity-80 transition-opacity h-full flex items-center",children:l("deposit.max")})]}),M.jsx("div",{className:"h-[1px] bg-line-divider-secondary mb-2"}),M.jsxs("div",{className:"flex justify-between items-center",children:[M.jsx(zr,{content:l("deposit.availableDesc"),children:M.jsx("span",{className:"text-text-tertiary text-xs leading-[14px] border-b border-dashed border-line-divider-primary",children:l("deposit.available")})}),M.jsx("span",{className:"text-text-primary text-xs leading-[14px]",children:C()})]})]}),!n&&s1(e||"0",0)&&M.jsxs("div",{className:"flex justify-center flex-col items-center",children:[M.jsx("h3",{className:"text-text-primary text-sm leading-4 font-medium",children:l("deposit.enableSystemProWithToken",{token:t,network:r==null?void 0:r.chain})}),M.jsx("p",{className:"text-text-secondary text-xs leading-3 mt-4",children:l("deposit.enableTokenDesc",{token:t,network:r==null?void 0:r.chain})}),M.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:d,disabled:f,children:f?M.jsx(Oo,{size:"xs",inline:!0}):l("deposit.enableWithToken",{token:t})})]}),i&&M.jsxs(M.Fragment,{children:[M.jsxs("div",{className:"flex mb-4",children:[M.jsx("div",{className:"w-5",children:M.jsx("img",{src:ms,className:"w-4 h-4",alt:"Warning"})}),M.jsx("div",{className:"flex-1 text-xs text-functional-orange-1",children:l(c||"deposit.layerZeroDepositTip")})]}),M.jsx("div",{className:"my-2 ml-5 h-[1px] border-b border-dashed border-line-divider-secondary"})]}),m&&M.jsxs("div",{className:"flex mb-4",children:[M.jsx("div",{className:"w-5",children:M.jsx("img",{src:ms,className:"w-4 h-4",alt:"Warning"})}),M.jsx("div",{className:"flex-1 text-xs text-functional-orange-1",children:l("deposit.depositTipFor25w")})]}),m&&M.jsx("div",{className:"my-2 ml-5 h-[1px] border-b border-dashed border-line-divider-secondary"}),M.jsxs("div",{className:"flex mb-4",children:[M.jsx("div",{className:"w-5",children:!(m||i)&&M.jsx("img",{src:ms,className:"w-4 h-4",alt:"Warning"})}),M.jsx("div",{className:"flex-1 text-xs text-functional-orange-1",children:l("deposit.noPrivateKeyWalletWarning")})]}),M.jsx("div",{className:"border-t border-line-divider-secondary border-dashed py-4",children:M.jsxs("div",{className:"flex justify-between items-center",children:[M.jsx("span",{className:"text-sm leading-[18px] text-text-tertiary",children:l("deposit.equity")}),M.jsx("span",{className:"text-sm leading-[18px] text-text-primary font-medium",children:e?M.jsxs("span",{className:"flex items-center gap-1",children:[gt(s),M.jsx("span",{className:"text-sm font-edgex-harmony text-functional-green-1 leading-[18px] font-medium",children:"→"}),gt((parseFloat(s)+parseFloat(e)).toString())," ",t]}):`${gt(s)} ${t}`})]})})]})},rP=({token:e,account:t,chainId:n,contractAddress:r,wagmiHooks:o,onResult:s})=>{var a,u;const i=(a=o==null?void 0:o.useBalance)==null?void 0:a.call(o,{address:t,token:e.tokenAddress,chainId:n,query:{enabled:!!t&&!!n&&!!e.tokenAddress&&!!(o!=null&&o.useBalance)}}),c=(u=o==null?void 0:o.useReadContract)==null?void 0:u.call(o,{address:e.tokenAddress,abi:[{name:"allowance",type:"function",stateMutability:"view",inputs:[{name:"owner",type:"address"},{name:"spender",type:"address"}],outputs:[{name:"",type:"uint256"}]}],functionName:"allowance",args:[t,r],chainId:n,query:{enabled:!!t&&!!n&&!!e.tokenAddress&&!!r&&!!(o!=null&&o.useReadContract)}});return E.useEffect(()=>{s(e.tokenAddress,{balance:i,allowance:c})},[i,c,e.tokenAddress,s]),null},A0=({account:e,chainId:t,contractAddress:n,tokens:r=[],wagmiHooks:o})=>{var h;const s=E.useMemo(()=>r.filter(m=>m.tokenAddress&&m.tokenAddress!=="0x0000000000000000000000000000000000000000"),[r]),[i,c]=E.useState({}),a=E.useCallback((m,v)=>{c(C=>({...C,[m]:v}))},[]),u=(h=o==null?void 0:o.useBalance)==null?void 0:h.call(o,{address:e,chainId:t,query:{enabled:!!e&&!!t&&!!(o!=null&&o.useBalance)}}),l=E.useMemo(()=>s.map(m=>E.createElement(rP,{key:m.tokenAddress,token:m,account:e,chainId:t,contractAddress:n,wagmiHooks:o,onResult:a})),[s,e,t,n,o,a]),f=E.useMemo(()=>{if(!(o!=null&&o.useBalance))return{balanceList:[],allowanceList:[],baseTokenBalance:{value:BigInt(0),formatted:"0",decimals:18,symbol:"ETH"},combinedData:{}};const m=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"},v=s.map($=>{const B=i[$.tokenAddress],k=B==null?void 0:B.balance,D=k==null?void 0:k.data;return{address:$.tokenAddress,value:(D==null?void 0:D.value)||BigInt(0),formatted:(D==null?void 0:D.formatted)||"0",decimals:(D==null?void 0:D.decimals)||$.decimals}}).filter($=>$.address),C=s.map($=>{const B=i[$.tokenAddress],k=B==null?void 0:B.allowance,D=k==null?void 0:k.data,j=BigInt(D?D.toString():0);return{address:$.tokenAddress,value:j,formatted:(j/BigInt(10)**BigInt($.decimals)).toString(),decimals:$.decimals}}).filter($=>$.address),y=v.reduce(($,B)=>{const k=C.find(D=>D.address===B.address);return{...$,[B.address]:{balance:B,allowance:k||{address:B.address,value:BigInt(0),formatted:"0",decimals:B.decimals}}}},{});return{balanceList:v,allowanceList:C,baseTokenBalance:m,combinedData:y}},[u,i,s,o==null?void 0:o.useBalance]),p=E.useCallback(async()=>f,[f]),d=E.useMemo(()=>{const m=(u==null?void 0:u.isLoading)||!1,v=Object.values(i).some(C=>{var y,$;return((y=C.balance)==null?void 0:y.isLoading)||(($=C.allowance)==null?void 0:$.isLoading)});return m||v},[u==null?void 0:u.isLoading,i]);return{multicallRun:p,multicallResult:f,validErcTokens:s,isLoading:d,queryComponents:l}};function oP({client:e,tokenAddress:t,holder:n,decimals:r,fallbackFormatted:o="0",pollingInterval:s=12e3}){const[i,c]=E.useState(null),[a,u]=E.useState(o);return E.useEffect(()=>{let l,f;const p=async()=>{try{const d=await e.readContract({address:t,abi:wc,functionName:"balanceOf",args:[n]});c(d),u(Ua(d,r))}catch{u(o)}};p();try{l=e.watchContractEvent({address:t,abi:wc,eventName:"Transfer",args:{to:n},onLogs:()=>{p()},poll:!0,pollingInterval:s}),f=e.watchContractEvent({address:t,abi:wc,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}}let He=null;const sP={symbol:"USDT"},T0=E.forwardRef((e,t)=>{const[n,r]=E.useState(!1),[o,s]=E.useState(!1),[i,c]=E.useState({chains:[]}),a=E.useCallback(h=>{c(h),r(!0)},[]),u=E.useCallback(h=>{c(m=>({...m,...h}))},[]),l=E.useCallback(()=>{r(!1),s(!1),i.onClose&&i.onClose()},[i.onClose]),f=E.useCallback(h=>{s(h)},[]),p=E.useCallback(()=>n,[n]),d=E.useCallback(()=>o,[o]);return E.useImperativeHandle(t,()=>({openDeposit:a,closeDeposit:l,updateDepositOptions:u,setDepositLoading:f,isOpen:p,isLoading:d}),[a,l,u,f,p,d]),E.useEffect(()=>(He={openDeposit:a,closeDeposit:l,updateDepositOptions:u,setDepositLoading:f,isOpen:p,isLoading:d},()=>{He=null}),[a,l,u,f,p,d]),M.jsx(M0,{isOpen:n,isLoading:o,onClose:l,config:i.config||sP,currentActiveAccount:i.currentActiveAccount||oa,smartWallet:i.smartWallet||sa,chains:i.chains||u1,defaultChainId:i.defaultChainId,defaultTokenAddress:i.defaultTokenAddress,defaultAmount:i.defaultAmount,metadata:i.metadata||ia,currentEquity:i.currentEquity??5e3,platformBalance:i.platformBalance||"0",wagmiHooks:i.wagmiHooks,approved:i.approved,onApproved:i.onApproved,onDeposit:i.onDeposit,onCopy:i.onCopy,onChainChange:i.onChainChange,onTokenChange:i.onTokenChange})});T0.displayName="DepositManager";const C0=e=>{if(!He){console.error("DepositManager not initialized. Make sure to render <DepositManager /> in your app.");return}He.openDeposit(e||{chains:[]})},O0=()=>{if(!He){console.error("DepositManager not initialized. Make sure to render <DepositManager /> in your app.");return}He.closeDeposit()},N0=e=>{He&&He.updateDepositOptions(e)},Zs=e=>{if(!He){console.error("DepositManager not initialized. Make sure to render <DepositManager /> in your app.");return}He.setDepositLoading(e)},iP=()=>He?He.isOpen():!1,I0=()=>He?He.isLoading():!1,aP=()=>({openDeposit:C0,closeDeposit:O0,updateDepositOptions:N0,setDepositLoading:Zs,isOpen:iP,isLoading:I0});function cP(){var e;return typeof window<"u"&&((e=window==null?void 0:window.ENV)==null?void 0:e.CHAIN_RPC_URL_42161)||"https://arb1.arbitrum.io/rpc"}const uP=({chains:e,defaultChainId:t,defaultTokenAddress:n,defaultAmount:r="",walletAdapter:o,metadata:s,currentEquity:i,platformBalance:c="0",isLoading:a=!1,wagmiHooks:u,approved:l,onApproved:f,onDeposit:p,onClose:d,onChainChange:h,onTokenChange:m})=>{var xe;const{t:v}=pt(),C=u==null?void 0:u.useAccount(),[y,$]=E.useState(()=>{var oe;return!e||e.length===0?1:t||((oe=e[0])==null?void 0:oe.chainId)||1}),[B,k]=E.useState(()=>{var ce;if(!e||e.length===0)return"";const oe=t||((ce=e[0])==null?void 0:ce.chainId),fe=e.find(Ge=>Ge.chainId===oe);if(!fe||!fe.tokenList||fe.tokenList.length===0)return"";const he=fe.tokenList.find(Ge=>Ge.tokenAddress===n)||fe.tokenList[0];return(he==null?void 0:he.token)||""}),[D,j]=E.useState(r),g=E.useCallback(oe=>{$(oe),h==null||h(oe)},[h]),w=E.useCallback(oe=>{k(oe),m==null||m(oe)},[m]),A=E.useRef(!0),I=E.useRef(B),N=E.useRef(y);E.useEffect(()=>{if(A.current){A.current=!1,I.current=B,N.current=y;return}(I.current!==B||N.current!==y)&&(j(""),I.current=B,N.current=y)},[B,y]);const P=e&&e.length>0?e.find(oe=>oe.chainId===y)||e[0]:null,S=(xe=P==null?void 0:P.tokenList)==null?void 0:xe.find(oe=>oe.token===B),x=o==null?void 0:o.getDisplayAddress(),{multicallResult:T,queryComponents:O}=A0({account:x,chainId:y,contractAddress:void 0,tokens:(P==null?void 0:P.tokenList)||[],wagmiHooks:u}),b=E.useMemo(()=>{var fe;if(!S)return;if(!S.tokenAddress||S.tokenAddress.toLowerCase()==="0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee")return T.baseTokenBalance.formatted;const oe=T.combinedData[S.tokenAddress];return((fe=oe==null?void 0:oe.balance)==null?void 0:fe.formatted)||"0"},[S,T]),L="0xfd086bc7cd5c481dcc9c85ebe478a1c0b69fcbb9",F="0xceeed84620e5eb9ab1d6dfc316867d2cda332e41",U=E.useMemo(()=>QS({chain:JS,transport:I6(cP())}),[]),z="1000000000000",{formatted:V}=oP({client:U,tokenAddress:L,holder:F,decimals:6,fallbackFormatted:z,pollingInterval:12e3}),Z=l??!1,W=E.useMemo(()=>+C.chainId!=+y,[C.chainId,y]),{showLayerZeroTip:K,layerZeroTipKey:G}=E.useMemo(()=>{const oe=+y==42161||+y==421614,fe=(B==null?void 0:B.toUpperCase())==="USDT",he=new Le(D||"0"),ce=new Le("200000");let Ge=!1,Er;if(oe&&fe&&D)if(he.gte(ce))Ge=!0,Er="deposit.layerZeroDepositTipGte200k";else{const Sr=V;if(typeof Sr=="string"&&Sr.length>0){const Xs=new Le(Sr);!Xs.isNaN()&&he.gte(Xs)&&(Ge=!0,Er="deposit.layerZeroDepositTipExceedPool")}}return{showLayerZeroTip:Ge,layerZeroTipKey:Er}},[y,B,D,V]),X=E.useMemo(()=>{if(W)return{text:v("deposit.switchNetwork"),disabled:!1,isNetworkSwitch:!0};const oe=parseFloat(D||"0"),fe=10,ce=i1(D,b||"0",Z);return!D||oe===0||!Z?{text:v(K?"deposit.layerZeroDepositButton":"deposit.confirmDeposit"),disabled:!0,isNetworkSwitch:!1}:oe<fe?{text:v("deposit.minDepositParsed",{amount:fe,token:B}),disabled:!0,isNetworkSwitch:!1}:{text:v(K?"deposit.layerZeroDepositButton":"deposit.confirmDeposit"),disabled:!ce,isNetworkSwitch:!1}},[D,B,b,Z,W,K,v]),ee=E.useCallback(async()=>{g&&g(y)},[g,y]),le=E.useCallback(async()=>{Zs(!0);try{p&&p({amount:D,chainId:y,tokenAddress:(S==null?void 0:S.tokenAddress)||"",tokenSymbol:B})}catch(oe){console.error("Deposit error:",oe),Zs(!1)}},[p,D,y,S==null?void 0:S.tokenAddress,B]);return!(u!=null&&u.useBalance)||!(u!=null&&u.useReadContract)||!(u!=null&&u.useAccount)?M.jsxs("div",{className:"p-6 text-center",children:[M.jsx("p",{className:"text-red-500",children:"缺少必要的 wagmi hooks"}),M.jsx("p",{className:"text-sm text-gray-500 mt-2",children:"请确保传入了 useBalance, useReadContract, useAccount"})]}):!e||e.length===0?M.jsx("div",{className:"text-center py-8",children:M.jsx("p",{className:"text-gray-400",children:"No chains available"})}):P?M.jsxs(M.Fragment,{children:[O,M.jsx(na,{currentActiveChain:P,chainList:e,onChainChange:g,curSelectToken:B,onTokenChange:w,walletType:"evm"}),M.jsx(nP,{depositAmount:D,curSelectToken:B,curSelectTokenData:{balance:S==null?void 0:S.balance,allowance:S==null?void 0:S.allowance},approved:Z,currentActiveChain:P,tokenBalance:b,platformBalance:c,showLayerZeroTip:K,layerZeroTipKey:G,onDepositAmountChange:j,onApproved:async()=>{f&&await f()}}),M.jsxs("button",{className:`w-full h-[38px] text-sm rounded-xl font-medium transition-colors flex items-center justify-center gap-2 ${X.disabled||a?"bg-text-disabled text-text-secondary cursor-not-allowed":"bg-fill-btn-primary text-text-on-sec-btn"}`,onClick:X.isNetworkSwitch?ee:le,disabled:X.disabled||a,children:[a&&M.jsx(Oo,{size:"xs"}),X.text]})]}):M.jsx("div",{className:"text-center py-8",children:M.jsx("p",{className:"text-gray-400",children:"Loading..."})})},M0=({isOpen:e,isLoading:t=!1,onClose:n,config:r,currentActiveAccount:o=oa,smartWallet:s=sa,chains:i,defaultChainId:c,defaultTokenAddress:a,defaultAmount:u="",metadata:l=ia,currentEquity:f=5e3,platformBalance:p="0",wagmiHooks:d,approved:h,onApproved:m,onDeposit:v,onCopy:C,onChainChange:y,onTokenChange:$})=>{const{t:B}=pt(),k=E.useMemo(()=>{var j;return o?vu(o,s,!1,(j=i[0])==null?void 0:j.chainId,"0","0"):null},[o,s,i]),D=(k==null?void 0:k.getWalletType())==="mpc";return e?Me.createPortal(M.jsx("div",{className:"fixed top-0 left-0 right-0 bottom-0 w-screen h-screen",style:{zIndex:49},children:M.jsx("div",{className:"fixed top-0 left-0 right-0 bottom-0 z-49 flex items-center justify-center",style:{background:"rgba(0, 0, 0, 0.6)"},onClick:()=>{n()},"aria-hidden":"true",children:M.jsxs("div",{className:"relative w-[420px] max-h-[85vh] bg-fill-page-secondary overflow-auto rounded-lg p-6 shadow-xl",onClick:j=>{j.stopPropagation()},children:[M.jsxs("div",{className:"flex items-center justify-between mb-4",children:[M.jsx("h2",{className:"text-lg font-semibold text-white",children:B("deposit.title")}),M.jsx("button",{className:"text-gray-400 hover:text-gray-200 transition-colors",onClick:n,"aria-label":"Close",children:M.jsx(bu,{className:"h-4 w-4"})})]}),D?M.jsx($w,{chains:i,defaultChainId:c,defaultTokenAddress:a,defaultAmount:u,walletAdapter:k,metadata:l,currentEquity:f,onDeposit:v,onCopy:C,onClose:n}):M.jsx(uP,{chains:i,defaultChainId:c,defaultTokenAddress:a,defaultAmount:u,walletAdapter:k,metadata:l,currentEquity:f,platformBalance:p,isLoading:t,wagmiHooks:d,approved:h,onApproved:m,onDeposit:v,onClose:n,onChainChange:y,onTokenChange:$})]})})}),document.body):null};E.createContext(null);const lP=()=>M.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"13",viewBox:"0 0 12 13",fill:"none",children:[M.jsx("g",{clipPath:"url(#clip0_active)",children:M.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"})}),M.jsx("defs",{children:M.jsx("clipPath",{id:"clip0_active",children:M.jsx("rect",{width:"12",height:"12",fill:"white",transform:"translate(0 0.0454102)"})})})]}),fP=()=>M.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"13",viewBox:"0 0 12 13",fill:"none",children:[M.jsx("g",{clipPath:"url(#clip0_inactive)",children:M.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"})}),M.jsx("defs",{children:M.jsx("clipPath",{id:"clip0_inactive",children:M.jsx("rect",{width:"12",height:"12",fill:"white",transform:"translate(0 0.0454102)"})})})]}),Ks=({selectedLevel:e,maxLevel:t,className:n=""})=>{const r=Array.from({length:t},(o,s)=>s+1);return M.jsx("div",{className:`flex items-center ${n}`,children:r.map(o=>M.jsx("div",{className:"flex items-center justify-center",children:o<=e?M.jsx(lP,{}):M.jsx(fP,{})},o))})};class cn{}Xe(cn,"FAST",3),Xe(cn,"Medium",2),Xe(cn,"SLOW",1),Xe(cn,"NONE",0);const dP=({withdrawAmount:e,curSelectToken:t,currentActiveChain:n,platformBalance:r="0",fee:o="0.00",walletType:s="evm",receiverAddress:i="",onWithdrawAmountChange:c,onReceiverAddressChange:a,onAmountChanged:u})=>{const{t:l}=pt(),f=E.useMemo(()=>{if(!an(n==null?void 0:n.chainId)){const v=new Le(e||"0").minus(o||"0").decimalPlaces(2,Le.ROUND_DOWN);return v.isNegative()?"0.00":v.toString()}return e||"0"},[e,o,n==null?void 0:n.chainId]),p=E.useMemo(()=>r||"0",[r]),d=v=>{const C=v.target.value,$=ra(C,p||"0");if($.isValid)c($.formattedValue),$.errorType;else return $.errorType==="exceed_balance",void 0;u==null||u($.formattedValue)},h=()=>{c(p),u==null||u(p)},m=()=>{const v=parseFloat(r||"0"),C=parseFloat(e||"0");if(C>0){const y=v-C,$=gt(Math.max(0,y).toString());return M.jsxs("span",{className:"flex items-center gap-1",children:[gt(r||"0"),M.jsx("span",{className:"text-sm font-edgex-harmony text-functional-green-1 leading-[18px] font-medium",children:"→"}),$," ",t]})}return`${gt(r||"0")} ${t}`};return M.jsxs(M.Fragment,{children:[M.jsxs("div",{className:"bg-fill-input-primary rounded-lg px-3 py-3 my-4",children:[M.jsxs("div",{className:"flex justify-between items-center h-[18px] mb-3",children:[M.jsx("input",{type:"text",placeholder:l("deposit.amount"),value:e,onChange:d,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"}),M.jsx("button",{onClick:h,className:"text-theme-normal text-xs font-medium cursor-pointer hover:opacity-80 transition-opacity h-full flex items-center",children:l("deposit.max")})]}),M.jsx("div",{className:"h-[1px] bg-line-divider-secondary mb-2"}),M.jsxs("div",{className:"flex justify-between items-center",children:[M.jsx(zr,{content:l("deposit.availableDesc"),children:M.jsx("span",{className:"text-text-tertiary text-xs leading-[14px] border-b border-dashed border-line-divider-primary",children:l("deposit.available")})}),M.jsx("span",{className:"text-text-primary text-xs leading-[14px]",children:m()})]})]}),s==="mpc"&&!an(n==null?void 0:n.chainId)&&M.jsx("div",{className:"bg-fill-input-primary rounded-lg my-4 h-9 flex items-center px-3",children:M.jsx("input",{type:"text",placeholder:l("withdraw.receiverAddress"),value:i,onChange:v=>a==null?void 0:a(v.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"})}),M.jsx("div",{className:"bg-fill-page-secondary rounded-lg mb-4",children:an(n==null?void 0:n.chainId)?M.jsxs(M.Fragment,{children:[M.jsx("p",{className:"text-text-tertiary text-xs leading-[18px]",children:l("withdraw.noticeDesc")}),M.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:l("withdraw.commonWithdraw")})]}):M.jsx("p",{className:"text-text-tertiary text-xs leading-[18px]",children:l("withdraw.crossChainTips")})}),M.jsxs("div",{className:"py-4 border-t border-line-divider-secondary border-dashed",children:[M.jsxs("div",{className:"flex items-center justify-between",children:[M.jsx("span",{className:"text-text-tertiary text-xs",children:l("withdraw.speed")}),M.jsx("div",{className:"flex items-center",children:M.jsx(zr,{content:M.jsxs("div",{children:[M.jsx("div",{children:l("withdraw.speedNote")}),M.jsxs("div",{className:"flex gap-1 items-center mt-1",children:[M.jsx(Ks,{selectedLevel:cn.FAST,maxLevel:3}),M.jsx("span",{children:l("withdraw.speedNoteSpeed1")})]}),M.jsxs("div",{className:"flex gap-1 items-center mt-1",children:[M.jsx(Ks,{selectedLevel:cn.Medium,maxLevel:3}),M.jsx("span",{children:l("withdraw.speedNoteSpeed2")})]}),M.jsxs("div",{className:"flex gap-1 items-center mt-1",children:[M.jsx(Ks,{selectedLevel:cn.SLOW,maxLevel:3}),M.jsx("span",{children:l("withdraw.speedNoteSpeed3")})]})]}),children:M.jsx(Ks,{selectedLevel:an(n==null?void 0:n.chainId)?cn.SLOW:cn.FAST,maxLevel:3})})})]}),!an(n==null?void 0:n.chainId)&&M.jsxs("div",{className:"flex items-center justify-between mt-2 h-[18px]",children:[M.jsx("span",{className:"text-text-tertiary text-sm leading-4",children:l("withdraw.fee")}),M.jsxs("span",{className:"text-text-primary text-sm leading-4 font-medium",children:[o," ",t]})]}),M.jsxs("div",{className:"flex items-center justify-between mt-2 h-[18px]",children:[M.jsx("span",{className:"text-text-tertiary text-sm leading-4",children:l(an(n==null?void 0:n.chainId)?"withdraw.withdrawlAmount":"withdraw.amountToReceive")}),M.jsxs("span",{className:"text-text-primary text-sm leading-4 font-medium",children:[gt(f)," ",t]})]})]})]})},pP=[],hP={};let Ve=null;const L0=E.forwardRef((e,t)=>{const[n,r]=E.useState(!1),[o,s]=E.useState(!1),[i,c]=E.useState({chains:[]}),a=E.useCallback(h=>{c(h||{chains:[]}),r(!0)},[]),u=E.useCallback(h=>{c(m=>({...m,...h}))},[]),l=E.useCallback(()=>{r(!1),s(!1),i.onClose&&i.onClose()},[i.onClose]),f=E.useCallback(h=>{s(h)},[]),p=E.useCallback(()=>n,[n]),d=E.useCallback(()=>o,[o]);return E.useImperativeHandle(t,()=>({openWithdraw:a,closeWithdraw:l,updateWithdrawOptions:u,setWithdrawLoading:f,isOpen:p,isLoading:d}),[a,l,u,f,p,d]),E.useEffect(()=>(Ve={openWithdraw:a,closeWithdraw:l,updateWithdrawOptions:u,setWithdrawLoading:f,isOpen:p,isLoading:d},()=>{Ve=null}),[a,l,u,f,p,d]),M.jsx(D0,{isOpen:n,isLoading:o,onClose:l,config:i.config||{symbol:"USDT"},currentActiveAccount:i.currentActiveAccount,smartWallet:i.smartWallet,chains:i.chains||pP,defaultChainId:i.defaultChainId,defaultTokenAddress:i.defaultTokenAddress,defaultAmount:i.defaultAmount,metadata:i.metadata||hP,currentEquity:i.currentEquity??5e3,platformBalance:i.platformBalance||"0",fee:i.fee,wagmiHooks:i.wagmiHooks,onWithdraw:i.onWithdraw,onChainChange:i.onChainChange,onTokenChange:i.onTokenChange,onAmountChanged:i.onAmountChanged})});L0.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:[]})},k0=()=>{if(!Ve){console.error("WithdrawManager not initialized. Make sure to render <WithdrawManager /> in your app.");return}Ve.closeWithdraw()},R0=e=>{if(!Ve){console.error("WithdrawManager not initialized. Make sure to render <WithdrawManager /> in your app.");return}Ve.updateWithdrawOptions(e)},Ys=e=>{if(!Ve){console.error("WithdrawManager not initialized. Make sure to render <WithdrawManager /> in your app.");return}Ve.setWithdrawLoading(e)},mP=()=>Ve?Ve.isOpen():!1,F0=()=>Ve?Ve.isLoading():!1,gP=()=>({openWithdraw:B0,closeWithdraw:k0,updateWithdrawOptions:R0,setWithdrawLoading:Ys,isOpen:mP,isLoading:F0}),bP=({chains:e,defaultChainId:t,defaultTokenAddress:n,defaultAmount:r="",walletAdapter:o,metadata:s,currentEquity:i,platformBalance:c="0",fee:a="0.00",isLoading:u=!1,wagmiHooks:l,onWithdraw:f,onClose:p,onChainChange:d,onTokenChange:h,onAmountChanged:m})=>{var V;const{t:v}=pt(),[C,y]=E.useState(()=>{var Z;return!e||e.length===0?1:t||((Z=e[0])==null?void 0:Z.chainId)||1}),[$,B]=E.useState(()=>{var G;if(!e||e.length===0)return"";const Z=t||((G=e[0])==null?void 0:G.chainId),W=e.find(X=>X.chainId===Z);if(!W||!W.tokenList||W.tokenList.length===0)return"";const K=W.tokenList.find(X=>X.tokenAddress===n)||W.tokenList[0];return(K==null?void 0:K.token)||""}),[k,D]=E.useState(r),[j,g]=E.useState(""),w=(o==null?void 0:o.getWalletType())||"evm",A=E.useCallback(Z=>{y(Z),d==null||d(Z)},[d]),I=E.useCallback(Z=>{B(Z),h==null||h(Z)},[h]),N=E.useRef(!0),P=E.useRef($),S=E.useRef(C);E.useEffect(()=>{if(N.current){N.current=!1,P.current=$,S.current=C;return}(P.current!==$||S.current!==C)&&(D(""),P.current=$,S.current=C)},[$,C]);const x=e&&e.length>0?e.find(Z=>Z.chainId===C)||e[0]:null,T=(V=x==null?void 0:x.tokenList)==null?void 0:V.find(Z=>Z.token===$),O=o==null?void 0:o.getDisplayAddress(),{multicallResult:b,queryComponents:L}=A0({account:O,chainId:C,contractAddress:void 0,tokens:(x==null?void 0:x.tokenList)||[],wagmiHooks:l}),F=E.useMemo(()=>{var W;if(!T)return;if(!T.tokenAddress||T.tokenAddress.toLowerCase()==="0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee")return b.baseTokenBalance.formatted;const Z=b.combinedData[T.tokenAddress];return((W=Z==null?void 0:Z.balance)==null?void 0:W.formatted)||"0"},[T,b]),U=E.useMemo(()=>{const Z=new Le(k||"0"),W=new Le(a||"0"),K=an(C);return!k||Z.isZero()||!K&&Z.isLessThan(W)?{text:v("withdraw.confirmWithdraw"),disabled:!0}:w==="mpc"&&!K&&!j.trim()?{text:v("withdraw.invalidReceiverAddress"),disabled:!0}:{text:v("withdraw.confirmWithdraw"),disabled:!1}},[v,C,k,w,j,a]),z=E.useCallback(async()=>{Ys(!0);try{if(f){const Z=new Le(k||"0"),W=new Le(a||"0"),G={amount:(an(C)?Z:Z.minus(W)).toString(),chainId:C,tokenAddress:(T==null?void 0:T.tokenAddress)||"",tokenSymbol:$};w==="mpc"&&!an(C)&&(G.receiverAddress=j),f(G)}}catch{Ys(!1)}},[f,k,a,C,T==null?void 0:T.tokenAddress,$,w,j]);return!(l!=null&&l.useBalance)||!(l!=null&&l.useReadContract)||!(l!=null&&l.useAccount)?M.jsxs("div",{className:"p-6 text-center",children:[M.jsx("p",{className:"text-red-500",children:"缺少必要的 wagmi hooks"}),M.jsx("p",{className:"text-sm text-gray-500 mt-2",children:"请确保传入了 useBalance, useReadContract, useAccount"})]}):!e||e.length===0?M.jsx("div",{className:"text-center py-8",children:M.jsx("p",{className:"text-gray-400",children:"No chains available"})}):x?M.jsxs(M.Fragment,{children:[L,M.jsx(na,{currentActiveChain:x,chainList:e,onChainChange:A,curSelectToken:$,onTokenChange:I,walletType:"evm"}),M.jsx(dP,{withdrawAmount:k,curSelectToken:$,curSelectTokenData:{balance:T==null?void 0:T.balance,allowance:T==null?void 0:T.allowance},currentActiveChain:x,currentEquity:i||0,amount:k,decimals:(T==null?void 0:T.decimals)||6,tokenBalance:F,platformBalance:c,fee:a,walletType:w,receiverAddress:j,onWithdrawAmountChange:D,onReceiverAddressChange:g,onAmountChanged:m}),M.jsxs("button",{className:`w-full h-[38px] text-sm rounded-xl font-medium transition-colors flex items-center justify-center gap-2 ${U.disabled||u?"bg-text-disabled text-text-secondary cursor-not-allowed":"bg-fill-btn-primary text-text-on-sec-btn"}`,onClick:z,disabled:U.disabled||u,children:[u&&M.jsx(Oo,{size:"xs"}),U.text]})]}):M.jsx("div",{className:"text-center py-8",children:M.jsx("p",{className:"text-gray-400",children:"Loading..."})})},D0=({isOpen:e,isLoading:t=!1,onClose:n,config:r,currentActiveAccount:o=oa,smartWallet:s=sa,chains:i,defaultChainId:c,defaultTokenAddress:a,defaultAmount:u="",metadata:l=ia,currentEquity:f=5e3,platformBalance:p="0",fee:d,wagmiHooks:h,onWithdraw:m,onChainChange:v,onTokenChange:C,onAmountChanged:y})=>{const{t:$}=pt(),B=E.useMemo(()=>{var k;return o?vu(o,s,!1,(k=i[0])==null?void 0:k.chainId,"0","0"):null},[o,s,i]);return e?Me.createPortal(M.jsx("div",{className:"fixed top-0 left-0 right-0 bottom-0 w-screen h-screen",style:{zIndex:49},children:M.jsx("div",{className:"fixed top-0 left-0 right-0 bottom-0 z-49 flex items-center justify-center",style:{background:"rgba(0, 0, 0, 0.6)"},onClick:()=>{n()},"aria-hidden":"true",children:M.jsxs("div",{className:"relative w-[420px] max-h-[85vh] bg-fill-page-secondary overflow-auto rounded-lg p-6 shadow-xl",onClick:k=>{k.stopPropagation()},children:[M.jsxs("div",{className:"flex items-center justify-between mb-4",children:[M.jsx("h2",{className:"text-lg font-semibold text-white",children:$("withdraw.withdraw")}),M.jsx("button",{className:"text-gray-400 hover:text-gray-200 transition-colors",onClick:n,"aria-label":"Close",children:M.jsx(bu,{className:"h-4 w-4"})})]}),M.jsx(bP,{chains:i,defaultChainId:c,defaultTokenAddress:a,defaultAmount:u,walletAdapter:B,metadata:l,currentEquity:f,platformBalance:p,fee:d,isLoading:t,wagmiHooks:h,onWithdraw:m,onClose:n,onChainChange:v,onTokenChange:C,onAmountChanged:y})]})})}),document.body):null};re.ChromeLoader=Oo,re.ComponentProvider=um,re.DEFAULT_LOCALE=Io,re.Deposit=M0,re.DepositManager=T0,re.LOCALE_NAMES=im,re.LoadingSpinner=Oo,re.SUPPORTED_LOCALES=Js,re.Tooltip=zr,re.Withdraw=D0,re.WithdrawManager=L0,re.closeDeposit=O0,re.closeWithdraw=k0,re.formatThousands=fm,re.isDepositLoading=I0,re.isWithdrawLoading=F0,re.openDeposit=C0,re.openWithdraw=B0,re.setDepositLoading=Zs,re.setWithdrawLoading=Ys,re.updateDepositOptions=N0,re.updateWithdrawOptions=R0,re.useComponentConfig=du,re.useDeposit=dm,re.useDepositManager=aP,re.useTranslation=pt,re.useWithdraw=pm,re.useWithdrawManager=gP,Object.defineProperty(re,Symbol.toStringTag,{value:"Module"})});
146
+ `),{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(Za,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/insufficient funds|exceeds transaction sender account balance/});class Ka extends H{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(Ka,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/intrinsic gas too high|gas limit reached/});class Ya extends H{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(Ya,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/intrinsic gas too low/});class Xa extends H{constructor({cause:t}){super("The transaction type is not supported for this chain.",{cause:t,name:"TransactionTypeNotSupportedError"})}}Object.defineProperty(Xa,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/transaction type not valid/});class Is extends H{constructor({cause:t,maxPriorityFeePerGas:n,maxFeePerGas:r}={}){super([`The provided tip (\`maxPriorityFeePerGas\`${n?` = ${Pt(n)} gwei`:""}) cannot be higher than the fee cap (\`maxFeePerGas\`${r?` = ${Pt(r)} gwei`:""}).`].join(`
147
+ `),{cause:t,name:"TipAboveFeeCapError"})}}Object.defineProperty(Is,"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 Ns extends H{constructor({cause:t}){super(`An error occurred while executing: ${t==null?void 0:t.shortMessage}`,{cause:t,name:"UnknownNodeError"})}}function Qa(e,t){const n=(e.details||"").toLowerCase(),r=e instanceof H?e.walk(o=>(o==null?void 0:o.code)===mr.code):e;return r instanceof H?new mr({cause:e,message:r.details}):mr.nodeMessage.test(n)?new mr({cause:e,message:e.details}):Os.nodeMessage.test(n)?new Os({cause:e,maxFeePerGas:t==null?void 0:t.maxFeePerGas}):Ha.nodeMessage.test(n)?new Ha({cause:e,maxFeePerGas:t==null?void 0:t.maxFeePerGas}):Va.nodeMessage.test(n)?new Va({cause:e,nonce:t==null?void 0:t.nonce}):Ga.nodeMessage.test(n)?new Ga({cause:e,nonce:t==null?void 0:t.nonce}):qa.nodeMessage.test(n)?new qa({cause:e,nonce:t==null?void 0:t.nonce}):Za.nodeMessage.test(n)?new Za({cause:e}):Ka.nodeMessage.test(n)?new Ka({cause:e,gas:t==null?void 0:t.gas}):Ya.nodeMessage.test(n)?new Ya({cause:e,gas:t==null?void 0:t.gas}):Xa.nodeMessage.test(n)?new Xa({cause:e}):Is.nodeMessage.test(n)?new Is({cause:e,maxFeePerGas:t==null?void 0:t.maxFeePerGas,maxPriorityFeePerGas:t==null?void 0:t.maxPriorityFeePerGas}):new Ns({cause:e})}function o2(e,{docsPath:t,...n}){const r=(()=>{const o=Qa(e,n);return o instanceof Ns?e:o})();return new r2(r,{docsPath:t,...n})}function Ja(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 s2={legacy:"0x0",eip2930:"0x1",eip1559:"0x2",eip4844:"0x3",eip7702:"0x4"};function Ms(e){const t={};return typeof e.authorizationList<"u"&&(t.authorizationList=i2(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=Q(e.gas)),typeof e.gasPrice<"u"&&(t.gasPrice=Q(e.gasPrice)),typeof e.maxFeePerBlobGas<"u"&&(t.maxFeePerBlobGas=Q(e.maxFeePerBlobGas)),typeof e.maxFeePerGas<"u"&&(t.maxFeePerGas=Q(e.maxFeePerGas)),typeof e.maxPriorityFeePerGas<"u"&&(t.maxPriorityFeePerGas=Q(e.maxPriorityFeePerGas)),typeof e.nonce<"u"&&(t.nonce=Q(e.nonce)),typeof e.to<"u"&&(t.to=e.to),typeof e.type<"u"&&(t.type=s2[e.type]),typeof e.value<"u"&&(t.value=Q(e.value)),t}function i2(e){return e.map(t=>({address:t.address,r:t.r?Q(BigInt(t.r)):t.r,s:t.s?Q(BigInt(t.s)):t.s,chainId:Q(t.chainId),nonce:Q(t.nonce),...typeof t.yParity<"u"?{yParity:Q(t.yParity)}:{},...typeof t.v<"u"&&typeof t.yParity>"u"?{v:Q(t.v)}:{}}))}function Ap(e){if(!(!e||e.length===0))return e.reduce((t,{slot:n,value:r})=>{if(n.length!==66)throw new Ld({size:n.length,targetSize:66,type:"hex"});if(r.length!==66)throw new Ld({size:r.length,targetSize:66,type:"hex"});return t[n]=r,t},{})}function a2(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=Q(t)),n!==void 0&&(i.nonce=Q(n)),r!==void 0&&(i.state=Ap(r)),o!==void 0){if(i.state)throw new FE;i.stateDiff=Ap(o)}return i}function ec(e){if(!e)return;const t={};for(const{address:n,...r}of e){if(!ct(n,{strict:!1}))throw new bn({address:n});if(t[n])throw new DE({address:n});t[n]=a2(r)}return t}const c2=2n**256n-1n;function Eo(e){const{account:t,gasPrice:n,maxFeePerGas:r,maxPriorityFeePerGas:o,to:s}=e,i=t?St(t):void 0;if(i&&!ct(i.address))throw new bn({address:i.address});if(s&&!ct(s))throw new bn({address:s});if(typeof n<"u"&&(typeof r<"u"||typeof o<"u"))throw new _E;if(r&&r>c2)throw new Os({maxFeePerGas:r});if(o&&r&&o>r)throw new Is({maxFeePerGas:r,maxPriorityFeePerGas:o})}class u2 extends H{constructor(){super("`baseFeeMultiplier` must be greater than 1.",{name:"BaseFeeScalarError"})}}class tc extends H{constructor(){super("Chain does not support EIP-1559 fees.",{name:"Eip1559FeesNotSupportedError"})}}class l2 extends H{constructor({maxPriorityFeePerGas:t}){super(`\`maxFeePerGas\` cannot be less than the \`maxPriorityFeePerGas\` (${Pt(t)} gwei).`,{name:"MaxFeePerGasTooLowError"})}}class Cp extends H{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 Op={"0x0":"legacy","0x1":"eip2930","0x2":"eip1559","0x3":"eip4844","0x4":"eip7702"};function Ip(e){const t={...e,blockHash:e.blockHash?e.blockHash:null,blockNumber:e.blockNumber?BigInt(e.blockNumber):null,chainId:e.chainId?Yt(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?Yt(e.nonce):void 0,to:e.to?e.to:null,transactionIndex:e.transactionIndex?Number(e.transactionIndex):null,type:e.type?Op[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=f2(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 f2(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 Np(e){const t=(e.transactions??[]).map(n=>typeof n=="string"?n:Ip(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 jt(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?Q(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 Cp({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)||Np)(c)}async function nc(e){const t=await e.request({method:"eth_gasPrice"});return BigInt(t)}async function d2(e,t){return Mp(e,t)}async function Mp(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 J(e,jt,"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 Rt(a)}catch{const[c,a]=await Promise.all([n?Promise.resolve(n):J(e,jt,"getBlock")({}),J(e,nc,"getGasPrice")({})]);if(typeof c.baseFeePerGas!="bigint")throw new tc;const u=a-c.baseFeePerGas;return u<0n?0n:u}}async function p2(e,t){return rc(e,t)}async function rc(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 u2;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 J(e,jt,"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 tc;const h=typeof(o==null?void 0:o.maxPriorityFeePerGas)=="bigint"?o.maxPriorityFeePerGas:await Mp(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 J(e,nc,"getGasPrice")({}))}}async function kp(e,{address:t,blockTag:n="latest",blockNumber:r}){const o=await e.request({method:"eth_getTransactionCount",params:[t,typeof r=="bigint"?Q(r):n]},{dedupe:!!r});return Yt(o)}function Lp(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=>xt(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 Bp(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=>xt(i)):e.blobs,o=typeof e.commitments[0]=="string"?e.commitments.map(i=>xt(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 h2(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 m2(e,t,n){return e&t^~e&n}function g2(e,t,n){return e&t^e&n^t&n}class b2 extends Ia{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=Oa(this.buffer)}update(t){ir(this),t=Ss(t),Jt(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=Oa(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){ir(this),_d(t,this),this.finished=!0;const{buffer:n,view:r,blockLen:o,isLE:s}=this;let{pos:i}=this;n[i++]=128,ar(this.buffer.subarray(i)),this.padOffset>o-i&&(this.process(r,0),i=0);for(let f=i;f<o;f++)n[f]=0;h2(r,o-8,BigInt(this.length*8),s),this.process(r,0);const c=Oa(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 yn=Uint32Array.from([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),y2=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]),vn=new Uint32Array(64);class v2 extends b2{constructor(t=32){super(64,t,8,!1),this.A=yn[0]|0,this.B=yn[1]|0,this.C=yn[2]|0,this.D=yn[3]|0,this.E=yn[4]|0,this.F=yn[5]|0,this.G=yn[6]|0,this.H=yn[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)vn[f]=t.getUint32(n,!1);for(let f=16;f<64;f++){const p=vn[f-15],d=vn[f-2],h=Dt(p,7)^Dt(p,18)^p>>>3,m=Dt(d,17)^Dt(d,19)^d>>>10;vn[f]=m+vn[f-7]+h+vn[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=Dt(c,6)^Dt(c,11)^Dt(c,25),d=l+p+m2(c,a,u)+y2[f]+vn[f]|0,m=(Dt(r,2)^Dt(r,13)^Dt(r,22))+g2(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(){ar(vn)}destroy(){this.set(0,0,0,0,0,0,0,0),ar(this.buffer)}}const Rp=Hd(()=>new v2),w2=Rp;function x2(e,t){return w2(vt(e,{strict:!1})?or(e):e)}function E2(e){const{commitment:t,version:n=1}=e,r=e.to??(typeof t=="string"?"hex":"bytes"),o=x2(t);return o.set([n],0),r==="bytes"?o:$e(o)}function S2(e){const{commitments:t,version:n}=e,r=e.to,o=[];for(const s of t)o.push(E2({commitment:s,to:r,version:n}));return o}const Dp=6,Fp=32,oc=4096,jp=Fp*oc,_p=jp*Dp-1-1*oc*Dp;class P2 extends H{constructor({maxSize:t,size:n}){super("Blob size is too large.",{metaMessages:[`Max: ${t} bytes`,`Given: ${n} bytes`],name:"BlobSizeTooLargeError"})}}class $2 extends H{constructor(){super("Blob data must not be empty.",{name:"EmptyBlobError"})}}function T2(e){const t=typeof e.data=="string"?xt(e.data):e.data,n=we(t);if(!n)throw new $2;if(n>_p)throw new P2({maxSize:_p,size:n});const r=[];let o=!0,s=0;for(;o;){const i=ja(new Uint8Array(jp));let c=0;for(;c<oc;){const a=t.slice(s,s+(Fp-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 A2(e){const{data:t,kzg:n,to:r}=e,o=e.blobs??T2({data:t}),s=e.commitments??Lp({blobs:o,kzg:n,to:r}),i=e.proofs??Bp({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 C2(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 UE({transaction:e})}async function Up(e){const t=await e.request({method:"eth_chainId"},{dedupe:!0});return Yt(t)}const O2=["blobVersionedHashes","chainId","fees","gas","nonce","type"],zp=new Map;async function Wp(e,t){const{account:n=e.account,blobs:r,chain:o,gas:s,kzg:i,nonce:c,nonceManager:a,parameters:u=O2,type:l}=t,f=n&&St(n),p={...t,...f?{from:f==null?void 0:f.address}:{}};let d;async function h(){return d||(d=await J(e,jt,"getBlock")({blockTag:"latest"}),d)}let m;async function y(){return m||(o?o.id:typeof t.chainId<"u"?t.chainId:(m=await J(e,Up,"getChainId")({}),m))}if(u.includes("nonce")&&typeof c>"u"&&f)if(a){const A=await y();p.nonce=await a.consume({address:f.address,chainId:A,client:e})}else p.nonce=await J(e,kp,"getTransactionCount")({address:f.address,blockTag:"pending"});if((u.includes("blobVersionedHashes")||u.includes("sidecars"))&&r&&i){const A=Lp({blobs:r,kzg:i});if(u.includes("blobVersionedHashes")){const g=S2({commitments:A,to:"hex"});p.blobVersionedHashes=g}if(u.includes("sidecars")){const g=Bp({blobs:r,commitments:A,kzg:i}),P=A2({blobs:r,commitments:A,proofs:g,to:"hex"});p.sidecars=P}}if(u.includes("chainId")&&(p.chainId=await y()),(u.includes("fees")||u.includes("type"))&&typeof l>"u")try{p.type=C2(p)}catch{let A=zp.get(e.uid);if(typeof A>"u"){const g=await h();A=typeof(g==null?void 0:g.baseFeePerGas)=="bigint",zp.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:g,maxPriorityFeePerGas:P}=await rc(e,{block:A,chain:o,request:p});if(typeof t.maxPriorityFeePerGas>"u"&&t.maxFeePerGas&&t.maxFeePerGas<P)throw new l2({maxPriorityFeePerGas:P});p.maxPriorityFeePerGas=P,p.maxFeePerGas=g}}else{if(typeof t.maxFeePerGas<"u"||typeof t.maxPriorityFeePerGas<"u")throw new tc;if(typeof t.gasPrice>"u"){const A=await h(),{gasPrice:g}=await rc(e,{block:A,chain:o,request:p,type:"legacy"});p.gasPrice=g}}return u.includes("gas")&&typeof s>"u"&&(p.gas=await J(e,sc,"estimateGas")({...p,account:f&&{address:f.address,type:"json-rpc"}})),Eo(p),delete p.parameters,p}async function Hp(e,{address:t,blockNumber:n,blockTag:r=e.experimental_blockTag??"latest"}){const o=typeof n=="bigint"?Q(n):void 0,s=await e.request({method:"eth_getBalance",params:[t,o||r]});return BigInt(s)}async function sc(e,t){var o,s,i;const{account:n=e.account}=t,r=n?St(n):void 0;try{let S=function(C){const{block:O,request:v,rpcStateOverride:M}=C;return e.request({method:"eth_estimateGas",params:M?[v,O??e.experimental_blockTag??"latest",M]:O?[v,O]:[v]})};const{accessList:c,authorizationList:a,blobs:u,blobVersionedHashes:l,blockNumber:f,blockTag:p,data:d,gas:h,gasPrice:m,maxFeePerBlobGas:y,maxFeePerGas:A,maxPriorityFeePerGas:g,nonce:P,value:k,stateOverride:B,...F}=await Wp(e,{...t,parameters:(r==null?void 0:r.type)==="local"?void 0:["blobVersionedHashes"]}),b=(typeof f=="bigint"?Q(f):void 0)||p,w=ec(B),T=await(async()=>{if(F.to)return F.to;if(a&&a.length>0)return await n2({authorization:a[0]}).catch(()=>{throw new H("`to` is required. Could not infer from `authorizationList`")})})();Eo(t);const N=(i=(s=(o=e.chain)==null?void 0:o.formatters)==null?void 0:s.transactionRequest)==null?void 0:i.format,$=(N||Ms)({...Ja(F,{format:N}),from:r==null?void 0:r.address,accessList:c,authorizationList:a,blobs:u,blobVersionedHashes:l,data:d,gas:h,gasPrice:m,maxFeePerBlobGas:y,maxFeePerGas:A,maxPriorityFeePerGas:g,nonce:P,to:T,value:k});let x=BigInt(await S({block:b,request:$,rpcStateOverride:w}));if(a){const C=await Hp(e,{address:$.from}),O=await Promise.all(a.map(async v=>{const{address:M}=v,D=await S({block:b,request:{authorizationList:void 0,data:d,from:r==null?void 0:r.address,to:M,value:Q(C)},rpcStateOverride:w}).catch(()=>100000n);return 2n*BigInt(D)}));x+=O.reduce((v,M)=>v+M,0n)}return x}catch(c){throw o2(c,{...t,account:r,chain:e.chain})}}async function I2(e,t){const{abi:n,address:r,args:o,functionName:s,dataSuffix:i,...c}=t,a=Ft({abi:n,args:o,functionName:s});try{return await J(e,sc,"estimateGas")({data:`${a}${i?i.replace("0x",""):""}`,to:r,...c})}catch(u){const l=c.account?St(c.account):void 0;throw hr(u,{abi:n,address:r,args:o,docsPath:"/docs/contract/estimateContractGas",functionName:s,sender:l==null?void 0:l.address})}}function ks(e,t){if(!ct(e,{strict:!1}))throw new bn({address:e});if(!ct(t,{strict:!1}))throw new bn({address:t});return e.toLowerCase()===t.toLowerCase()}const Vp="/docs/contract/decodeEventLog";function ic(e){const{abi:t,data:n,strict:r,topics:o}=e,s=r??!0,[i,...c]=o;if(!i)throw new wx({docsPath:Vp});const a=t.find(m=>m.type==="event"&&i===Ps(yt(m)));if(!(a&&"name"in a)||a.type!=="event")throw new Cd(i,{docsPath:Vp});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,y)=>[m,y]).filter(([m])=>"indexed"in m&&m.indexed);for(let m=0;m<d.length;m++){const[y,A]=d[m],g=c[m];if(!g)throw new vs({abiItem:a,param:y});p[f?A:y.name||A]=N2({param:y,value:g})}const h=l.filter(m=>!("indexed"in m&&m.indexed));if(h.length>0){if(n&&n!=="0x")try{const m=Qr(h,n);if(m)if(f)for(let y=0;y<l.length;y++)p[y]=p[y]??m.shift();else for(let y=0;y<h.length;y++)p[h[y].name]=m[y]}catch(m){if(s)throw m instanceof $d||m instanceof pp?new Gr({abiItem:a,data:n,params:h,size:we(n)}):m}else if(s)throw new Gr({abiItem:a,data:"0x",params:h,size:0})}return{eventName:u,args:Object.values(p).length>0?p:void 0}}function N2({param:e,value:t}){return e.type==="string"||e.type==="bytes"||e.type==="tuple"||e.type.match(/^(.*)\[(\d+)?\]$/)?t:(Qr([e],t)||[])[0]}function ac(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]===Ps(l));if(!a)return null;const u=ic({...i,abi:[a],strict:o});return s&&!s.includes(u.eventName)||!M2({args:u.args,inputs:a.inputs,matchArgs:n})?null:{...u,...i}}catch(a){let u,l;if(a instanceof Cd)return null;if(a instanceof Gr||a instanceof vs){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 M2(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"?ks(i,c):s.type==="string"||s.type==="bytes"?Ie(or(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 rn(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 cc(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=>Xr({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"?Q(r):r,toBlock:typeof o=="bigint"?Q(o):o}]});const d=p.map(h=>rn(h));return l?ac({abi:l,args:c,logs:d,strict:u}):d}async function Gp(e,t){const{abi:n,address:r,args:o,blockHash:s,eventName:i,fromBlock:c,toBlock:a,strict:u}=t,l=i?Mn({abi:n,name:i}):void 0,f=l?void 0:n.filter(p=>p.type==="event");return J(e,cc,"getLogs")({address:r,args:o,blockHash:s,event:l,events:f,fromBlock:c,toBlock:a,strict:u})}const uc="/docs/contract/decodeFunctionResult";function Dn(e){const{abi:t,args:n,functionName:r,data:o}=e;let s=t[0];if(r){const c=Mn({abi:t,args:n,name:r});if(!c)throw new nr(r,{docsPath:uc});s=c}if(s.type!=="function")throw new nr(void 0,{docsPath:uc});if(!s.outputs)throw new Id(s.name,{docsPath:uc});const i=Qr(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 lc=BigInt(0),fc=BigInt(1);function Ls(e,t=""){if(typeof e!="boolean"){const n=t&&`"${t}"`;throw new Error(n+"expected boolean, got type="+typeof e)}return e}function Fn(e,t,n=""){const r=xs(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 Bs(e){const t=e.toString(16);return t.length&1?"0"+t:t}function qp(e){if(typeof e!="string")throw new Error("hex string expected, got "+typeof e);return e===""?lc:BigInt("0x"+e)}function Rs(e){return qp(cr(e))}function Zp(e){return Jt(e),qp(cr(Uint8Array.from(e).reverse()))}function dc(e,t){return Es(e.toString(16).padStart(t*2,"0"))}function Kp(e,t){return dc(e,t).reverse()}function ze(e,t,n){let r;if(typeof t=="string")try{r=Es(t)}catch(o){throw new Error(e+" must be hex string or Uint8Array, cause: "+o)}else if(xs(t))r=Uint8Array.from(t);else throw new Error(e+" must be hex string or Uint8Array");return r.length,r}const pc=e=>typeof e=="bigint"&&lc<=e;function k2(e,t,n){return pc(e)&&pc(t)&&pc(n)&&t<=e&&e<n}function L2(e,t,n,r){if(!k2(t,n,r))throw new Error("expected valid "+e+": "+n+" <= n < "+r+", got "+t)}function Yp(e){let t;for(t=0;e>lc;e>>=fc,t+=1);return t}const So=e=>(fc<<BigInt(e))-fc;function B2(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 gn(...h)};return(d,h)=>{a(),l(d);let m;for(;!(m=h(f()));)l();return a(),m}}function hc(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 Xp(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 R2="0.1.1";function D2(){return R2}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(`
148
+ `);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@${D2()}`}),this.cause=n.cause,this.details=r,this.docs=i,this.docsPath=o,this.shortMessage=t}walk(t){return Qp(this,t)}}function Qp(e,t){return t!=null&&t(e)?e:e&&typeof e=="object"&&"cause"in e&&e.cause?Qp(e.cause,t):t?null:e}const F2="#__bigint";function j2(e,t,n){return JSON.stringify(e,(r,o)=>typeof o=="bigint"?o.toString()+F2:o,n)}function _2(e,t){if(th(e)>t)throw new Y2({givenSize:th(e),maxSize:t})}const on={zero:48,nine:57,A:65,F:70,a:97,f:102};function Jp(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 U2(e,t={}){const{dir:n,size:r=32}=t;if(r===0)return e;if(e.length>r)throw new X2({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 mc(e,t){if(ut(e)>t)throw new n6({givenSize:ut(e),maxSize:t})}function z2(e,t){if(typeof t=="number"&&t>0&&t>ut(e)-1)throw new ah({offset:t,position:"start",size:ut(e)})}function W2(e,t,n){if(typeof t=="number"&&typeof n=="number"&&ut(e)!==n-t)throw new ah({offset:n,position:"end",size:ut(e)})}function eh(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 r6({size:Math.ceil(o.length/2),targetSize:r,type:"Hex"});return`0x${o[n==="right"?"padEnd":"padStart"](r*2,"0")}`}const H2=new TextEncoder;function V2(e){return e instanceof Uint8Array?e:typeof e=="string"?q2(e):G2(e)}function G2(e){return e instanceof Uint8Array?e:new Uint8Array(e)}function q2(e,t={}){const{size:n}=t;let r=e;n&&(mc(e,n),r=_n(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=Jp(o.charCodeAt(a++)),l=Jp(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 Z2(e,t={}){const{size:n}=t,r=H2.encode(e);return typeof n=="number"?(_2(r,n),K2(r,n)):r}function K2(e,t){return U2(e,{dir:"right",size:t})}function th(e){return e.length}let Y2=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"})}},X2=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 Q2=new TextEncoder,J2=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function e6(e,t={}){const{strict:n=!1}=t;if(!e)throw new sh(e);if(typeof e!="string")throw new sh(e);if(n&&!/^0x[0-9a-fA-F]*$/.test(e))throw new ih(e);if(!e.startsWith("0x"))throw new ih(e)}function _t(...e){return`0x${e.reduce((t,n)=>t+n.replace("0x",""),"")}`}function nh(e,t={}){const n=`0x${Number(e)}`;return typeof t.size=="number"?(mc(n,t.size),jn(n,t.size)):n}function rh(e,t={}){let n="";for(let o=0;o<e.length;o++)n+=J2[e[o]];const r=`0x${n}`;return typeof t.size=="number"?(mc(r,t.size),_n(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 oh({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?jn(a,r):a}function gc(e,t={}){return rh(Q2.encode(e),t)}function jn(e,t){return eh(e,{dir:"left",size:t})}function _n(e,t){return eh(e,{dir:"right",size:t})}function bc(e,t,n,r={}){const{strict:o}=r;z2(e,t);const s=`0x${e.replace("0x","").slice((t??0)*2,(n??e.length)*2)}`;return o&&W2(s,t,n),s}function ut(e){return Math.ceil((e.length-2)/2)}function t6(e,t={}){const{strict:n=!1}=t;try{return e6(e,{strict:n}),!0}catch{return!1}}class oh 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 sh extends be{constructor(t){super(`Value \`${typeof t=="object"?j2(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 ih 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 n6 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 ah 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 r6 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 o6(e){return{address:e.address,amount:Be(e.amount),index:Be(e.index),validatorIndex:Be(e.validatorIndex)}}function ch(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(o6)}}}const yc=[{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"}],vc=[{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"}]}],uh=[{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"}],lh=[...uh,{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"}]}],s6=[...uh,{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"}]}],fh=[{name:"text",type:"function",stateMutability:"view",inputs:[{name:"name",type:"bytes32"},{name:"key",type:"string"}],outputs:[{name:"",type:"string"}]}],dh=[{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"}]}],ph=[{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"}],wc=[{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"}]}],i6="0x82ad56cb",hh="0x608060405234801561001057600080fd5b5060405161018e38038061018e83398101604081905261002f91610124565b6000808351602085016000f59050803b61004857600080fd5b6000808351602085016000855af16040513d6000823e81610067573d81fd5b3d81f35b634e487b7160e01b600052604160045260246000fd5b600082601f83011261009257600080fd5b81516001600160401b038111156100ab576100ab61006b565b604051601f8201601f19908116603f011681016001600160401b03811182821017156100d9576100d961006b565b6040528181528382016020018510156100f157600080fd5b60005b82811015610110576020818601810151838301820152016100f4565b506000918101602001919091529392505050565b6000806040838503121561013757600080fd5b82516001600160401b0381111561014d57600080fd5b61015985828601610081565b602085015190935090506001600160401b0381111561017757600080fd5b61018385828601610081565b915050925092905056fe",a6="0x608060405234801561001057600080fd5b506040516102c03803806102c083398101604081905261002f916101e6565b836001600160a01b03163b6000036100e457600080836001600160a01b03168360405161005c9190610270565b6000604051808303816000865af19150503d8060008114610099576040519150601f19603f3d011682016040523d82523d6000602084013e61009e565b606091505b50915091508115806100b857506001600160a01b0386163b155b156100e1578060405163101bb98d60e01b81526004016100d8919061028c565b60405180910390fd5b50505b6000808451602086016000885af16040513d6000823e81610103573d81fd5b3d81f35b80516001600160a01b038116811461011e57600080fd5b919050565b634e487b7160e01b600052604160045260246000fd5b60005b8381101561015457818101518382015260200161013c565b50506000910152565b600082601f83011261016e57600080fd5b81516001600160401b0381111561018757610187610123565b604051601f8201601f19908116603f011681016001600160401b03811182821017156101b5576101b5610123565b6040528181528382016020018510156101cd57600080fd5b6101de826020830160208701610139565b949350505050565b600080600080608085870312156101fc57600080fd5b61020585610107565b60208601519094506001600160401b0381111561022157600080fd5b61022d8782880161015d565b93505061023c60408601610107565b60608601519092506001600160401b0381111561025857600080fd5b6102648782880161015d565b91505092959194509250565b60008251610282818460208701610139565b9190910192915050565b60208152600082518060208401526102ab816040850160208701610139565b601f01601f1916919091016040019291505056fe",c6="0x608060405234801561001057600080fd5b5060405161069438038061069483398101604081905261002f9161051e565b600061003c848484610048565b9050806000526001601ff35b60007f64926492649264926492649264926492649264926492649264926492649264926100748361040c565b036101e7576000606080848060200190518101906100929190610577565b60405192955090935091506000906001600160a01b038516906100b69085906105dd565b6000604051808303816000865af19150503d80600081146100f3576040519150601f19603f3d011682016040523d82523d6000602084013e6100f8565b606091505b50509050876001600160a01b03163b60000361016057806101605760405162461bcd60e51b815260206004820152601e60248201527f5369676e617475726556616c696461746f723a206465706c6f796d656e74000060448201526064015b60405180910390fd5b604051630b135d3f60e11b808252906001600160a01b038a1690631626ba7e90610190908b9087906004016105f9565b602060405180830381865afa1580156101ad573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101d19190610633565b6001600160e01b03191614945050505050610405565b6001600160a01b0384163b1561027a57604051630b135d3f60e11b808252906001600160a01b03861690631626ba7e9061022790879087906004016105f9565b602060405180830381865afa158015610244573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102689190610633565b6001600160e01b031916149050610405565b81516041146102df5760405162461bcd60e51b815260206004820152603a602482015260008051602061067483398151915260448201527f3a20696e76616c6964207369676e6174757265206c656e6774680000000000006064820152608401610157565b6102e7610425565b5060208201516040808401518451859392600091859190811061030c5761030c61065d565b016020015160f81c9050601b811480159061032b57508060ff16601c14155b1561038c5760405162461bcd60e51b815260206004820152603b602482015260008051602061067483398151915260448201527f3a20696e76616c6964207369676e617475726520762076616c756500000000006064820152608401610157565b60408051600081526020810180835289905260ff83169181019190915260608101849052608081018390526001600160a01b0389169060019060a0016020604051602081039080840390855afa1580156103ea573d6000803e3d6000fd5b505050602060405103516001600160a01b0316149450505050505b9392505050565b600060208251101561041d57600080fd5b508051015190565b60405180606001604052806003906020820280368337509192915050565b6001600160a01b038116811461045857600080fd5b50565b634e487b7160e01b600052604160045260246000fd5b60005b8381101561048c578181015183820152602001610474565b50506000910152565b600082601f8301126104a657600080fd5b81516001600160401b038111156104bf576104bf61045b565b604051601f8201601f19908116603f011681016001600160401b03811182821017156104ed576104ed61045b565b60405281815283820160200185101561050557600080fd5b610516826020830160208701610471565b949350505050565b60008060006060848603121561053357600080fd5b835161053e81610443565b6020850151604086015191945092506001600160401b0381111561056157600080fd5b61056d86828701610495565b9150509250925092565b60008060006060848603121561058c57600080fd5b835161059781610443565b60208501519093506001600160401b038111156105b357600080fd5b6105bf86828701610495565b604086015190935090506001600160401b0381111561056157600080fd5b600082516105ef818460208701610471565b9190910192915050565b828152604060208201526000825180604084015261061e816060850160208701610471565b601f01601f1916919091016060019392505050565b60006020828403121561064557600080fd5b81516001600160e01b03198116811461040557600080fd5b634e487b7160e01b600052603260045260246000fdfe5369676e617475726556616c696461746f72237265636f7665725369676e6572";class xc extends H{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 mh extends H{constructor(){super("No chain was provided to the Client.",{name:"ClientChainNotConfiguredError"})}}const Ec="/docs/contract/encodeDeployData";function Sc(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 mx({docsPath:Ec});if(!("inputs"in o))throw new Pd({docsPath:Ec});if(!o.inputs||o.inputs.length===0)throw new Pd({docsPath:Ec});const s=tn(o.inputs,n);return ur([r,s])}function gr({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 xc({chain:t,contract:{name:n}});if(e&&r.blockCreated&&r.blockCreated>e)throw new xc({blockNumber:e,chain:t,contract:{name:n,blockCreated:r.blockCreated}});return r.address}function gh(e,{docsPath:t,...n}){const r=(()=>{const o=Qa(e,n);return o instanceof Ns?e:o})();return new xp(r,{docsPath:t,...n})}function bh(){let e=()=>{},t=()=>{};return{promise:new Promise((r,o)=>{e=r,t=o}),resolve:e,reject:t}}const Pc=new Map;function yh({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=()=>Pc.delete(t),c=()=>a().map(({args:l})=>l),a=()=>Pc.get(t)||[],u=l=>Pc.set(t,[...a(),l]);return{flush:i,async schedule(l){const{promise:f,resolve:p,reject:d}=bh();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 $,S,x,C;const{account:n=e.account,authorizationList:r,batch:o=!!(($=e.batch)!=null&&$.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:y,maxFeePerGas:A,maxPriorityFeePerGas:g,nonce:P,to:k,value:B,stateOverride:F,...j}=t,b=n?St(n):void 0;if(l&&(p||d))throw new H("Cannot provide both `code` & `factory`/`factoryData` as parameters.");if(l&&k)throw new H("Cannot provide both `code` & `to` as parameters.");const w=l&&f,T=p&&d&&k&&f,N=w||T,I=w?f6({code:l,data:f}):T?d6({data:f,factory:p,factoryData:d,to:k}):f;try{Eo(t);const v=(typeof s=="bigint"?Q(s):void 0)||i,M=u?ch(u):void 0,D=ec(F),_=(C=(x=(S=e.chain)==null?void 0:S.formatters)==null?void 0:x.transactionRequest)==null?void 0:C.format,V=(_||Ms)({...Ja(j,{format:_}),from:b==null?void 0:b.address,accessList:c,authorizationList:r,blobs:a,data:I,gas:h,gasPrice:m,maxFeePerBlobGas:y,maxFeePerGas:A,maxPriorityFeePerGas:g,nonce:P,to:N?void 0:k,value:B});if(o&&u6({request:V})&&!D&&!M)try{return await l6(e,{...V,blockNumber:s,blockTag:i})}catch(K){if(!(K instanceof mh)&&!(K instanceof xc))throw K}const Z=(()=>{const K=[V,v];return D&&M?[...K,D,M]:D?[...K,D]:M?[...K,{},M]:K})(),W=await e.request({method:"eth_call",params:Z});return W==="0x"?{data:void 0}:{data:W}}catch(O){const v=p6(O),{offchainLookup:M,offchainLookupSignature:D}=await Promise.resolve().then(()=>m5);if(e.ccipRead!==!1&&(v==null?void 0:v.slice(0,10))===D&&k)return{data:await M(e,{data:v,to:k})};throw N&&(v==null?void 0:v.slice(0,10))==="0x101bb98d"?new GE({factory:p}):gh(O,{...t,account:b,chain:e.chain})}}function u6({request:e}){const{data:t,to:n,...r}=e;return!(!t||t.startsWith(i6)||!n||Object.values(r).filter(o=>typeof o<"u").length>0)}async function l6(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 mh;u=gr({blockNumber:o,chain:e.chain,contract:"multicall3"})}const f=(typeof o=="bigint"?Q(o):void 0)||s,{schedule:p}=yh({id:`${e.uid}.${f}`,wait:r,shouldSplitBatch(y){return y.reduce((g,{data:P})=>g+(P.length-2),0)>n*2},fn:async y=>{const A=y.map(k=>({allowFailure:!0,callData:k.data,target:k.to})),g=Ft({abi:yc,args:[A],functionName:"aggregate3"}),P=await e.request({method:"eth_call",params:[{data:g,to:u},f]});return Dn({abi:yc,args:[A],functionName:"aggregate3",data:P||"0x"})}}),[{returnData:d,success:h}]=await p({data:i,to:a});if(!h)throw new Cs({data:d});return d==="0x"?{data:void 0}:{data:d}}function f6(e){const{code:t,data:n}=e;return Sc({abi:wd(["constructor(bytes, bytes)"]),bytecode:hh,args:[t,n]})}function d6(e){const{data:t,factory:n,factoryData:r,to:o}=e;return Sc({abi:wd(["constructor(address, bytes, address, bytes)"]),bytecode:a6,args:[o,t,n,r]})}function p6(e){var n;if(!(e instanceof H))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 sn(e,t){const{abi:n,address:r,args:o,functionName:s,...i}=t,c=Ft({abi:n,args:o,functionName:s});try{const{data:a}=await J(e,Po,"call")({...i,data:c,to:r});return Dn({abi:n,args:o,functionName:s,data:a||"0x"})}catch(a){throw hr(a,{abi:n,address:r,args:o,docsPath:"/docs/contract/readContract",functionName:s})}}async function h6(e,t){const{abi:n,address:r,args:o,dataSuffix:s,functionName:i,...c}=t,a=c.account?St(c.account):e.account,u=Ft({abi:n,args:o,functionName:i});try{const{data:l}=await J(e,Po,"call")({batch:!1,data:`${u}${s?s.replace("0x",""):""}`,to:r,...c,account:a}),f=Dn({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 hr(l,{abi:n,address:r,args:o,docsPath:"/docs/contract/simulateContract",functionName:i,sender:a==null?void 0:a.address})}}const $c=new Map,vh=new Map;let m6=0;function wn(e,t,n){const r=++m6,o=()=>$c.get(e)||[],s=()=>{const l=o();$c.set(e,l.filter(f=>f.id!==r))},i=()=>{const l=o();if(!l.some(p=>p.id===r))return;const f=vh.get(e);if(l.length===1&&f){const p=f();p instanceof Promise&&p.catch(()=>{})}s()},c=o();if($c.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"&&vh.set(e,u),i}async function Tc(e){return new Promise(t=>setTimeout(t,e))}function $o(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 Tc(a);const u=async()=>{o&&(await e({unpoll:s}),await Tc(r),u())};u()})(),s}const g6=new Map,b6=new Map;function y6(e){const t=(o,s)=>({clear:()=>s.delete(o),get:()=>s.get(o),set:i=>s.set(o,i)}),n=t(e,g6),r=t(e,b6);return{clear:()=>{n.clear(),r.clear()},promise:n,response:r}}async function v6(e,{cacheKey:t,cacheTime:n=Number.POSITIVE_INFINITY}){const r=y6(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 w6=e=>`blockNumber.${e}`;async function To(e,{cacheTime:t=e.cacheTime}={}){const n=await v6(()=>e.request({method:"eth_blockNumber"}),{cacheKey:w6(e.uid),cacheTime:t});return BigInt(n)}async function Ds(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=>rn(s));return!("abi"in t)||!t.abi?o:ac({abi:t.abi,logs:o,strict:n})}async function Fs(e,{filter:t}){return t.request({method:"eth_uninstallFilter",params:[t.id]})}function x6(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 y=p??!1,A=Te(["watchContractEvent",r,o,s,e.uid,i,f,y,c]);return wn(A,{onLogs:u,onError:a},g=>{let P;c!==void 0&&(P=c-1n);let k,B=!1;const F=$o(async()=>{var j;if(!B){try{k=await J(e,cp,"createContractEventFilter")({abi:n,address:r,args:o,eventName:i,strict:y,fromBlock:c})}catch{}B=!0;return}try{let b;if(k)b=await J(e,Ds,"getFilterChanges")({filter:k});else{const w=await J(e,To,"getBlockNumber")({});P&&P<w?b=await J(e,Gp,"getContractEvents")({abi:n,address:r,args:o,eventName:i,fromBlock:P+1n,toBlock:w,strict:y}):b=[],P=w}if(b.length===0)return;if(s)g.onLogs(b);else for(const w of b)g.onLogs([w])}catch(b){k&&b instanceof Bn&&(B=!1),(j=g.onError)==null||j.call(g,b)}},{emitOnBegin:!0,interval:f});return async()=>{k&&await J(e,Fs,"uninstallFilter")({filter:k}),F()}})})():(()=>{const y=p??!1,A=Te(["watchContractEvent",r,o,s,e.uid,i,f,y]);let g=!0,P=()=>g=!1;return wn(A,{onLogs:u,onError:a},k=>((async()=>{try{const B=(()=>{if(e.transport.type==="fallback"){const b=e.transport.transports.find(w=>w.config.type==="webSocket"||w.config.type==="ipc");return b?b.value:e.transport}return e.transport})(),F=i?Xr({abi:n,eventName:i,args:o}):[],{unsubscribe:j}=await B.subscribe({params:["logs",{address:r,topics:F}],onData(b){var T;if(!g)return;const w=b.result;try{const{eventName:N,args:I}=ic({abi:n,data:w.data,topics:w.topics,strict:p}),$=rn(w,{args:I,eventName:N});k.onLogs([$])}catch(N){let I,$;if(N instanceof Gr||N instanceof vs){if(p)return;I=N.abiItem.name,$=(T=N.abiItem.inputs)==null?void 0:T.some(x=>!("name"in x&&x.name))}const S=rn(w,{args:$?[]:{},eventName:I});k.onLogs([S])}},onError(b){var w;(w=k.onError)==null||w.call(k,b)}});P=j,g||P()}catch(B){a==null||a(B)}})(),()=>P()))})()}async function E6(e,{serializedTransaction:t}){return e.request({method:"eth_sendRawTransaction",params:[t]},{retryCount:0})}function Ac(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 Tc(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 S6={"0x0":"reverted","0x1":"success"};function P6(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=>rn(n)):null,to:e.to?e.to:null,transactionIndex:e.transactionIndex?Yt(e.transactionIndex):null,status:e.status?S6[e.status]:null,type:e.type?Op[e.type]||e.type:null};return e.blobGasPrice&&(t.blobGasPrice=BigInt(e.blobGasPrice)),e.blobGasUsed&&(t.blobGasUsed=BigInt(e.blobGasUsed)),t}const Cc=256;let js=Cc,_s;function wh(e=11){if(!_s||js+e>Cc*2){_s="",js=0;for(let t=0;t<Cc;t++)_s+=(256+Math.random()*256|0).toString(16).substring(1)}return _s.substring(js,js+++e)}function $6(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?St(e.account):void 0,{config:d,request:h,value:m}=e.transport({chain:n,pollingInterval:l}),y={...d,...m},A={account:p,batch:t,cacheTime:f,ccipRead:r,chain:n,key:o,name:s,pollingInterval:l,request:h,transport:y,type:i,uid:wh(),...c?{experimental_blockTag:c}:{}};function g(P){return k=>{const B=k(P);for(const j in A)delete B[j];const F={...P,...B};return Object.assign(F,{extend:g(F)})}}return Object.assign(A,{extend:g(A)})}const Us=new Ma(8192);function T6(e,{enabled:t=!0,id:n}){if(!t||!n)return e();if(Us.get(n))return Us.get(n);const r=e().finally(()=>Us.delete(n));return Us.set(n,r),r}function A6(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 Rn(new Error("method not supported"),{method:u});if(s!=null&&s.include&&!s.include.includes(u))throw new Rn(new Error("method not supported"),{method:u});const l=o?qr(`${a}.${Te(n)}`):void 0;return T6(()=>Ac(async()=>{try{return await e(n)}catch(p){const d=p;switch(d.code){case to.code:throw new to(d);case no.code:throw new no(d);case ro.code:throw new ro(d,{method:n.method});case oo.code:throw new oo(d);case Ln.code:throw new Ln(d);case Bn.code:throw new Bn(d);case so.code:throw new so(d);case io.code:throw new io(d);case ao.code:throw new ao(d);case Rn.code:throw new Rn(d,{method:n.method});case dr.code:throw new dr(d);case co.code:throw new co(d);case pr.code:throw new pr(d);case uo.code:throw new uo(d);case lo.code:throw new lo(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 go.code:throw new go(d);case bo.code:throw new bo(d);case yo.code:throw new yo(d);case vo.code:throw new vo(d);case wo.code:throw new wo(d);case xo.code:throw new xo(d);case 5e3:throw new pr(d);default:throw p instanceof H?p:new ZE(d)}}},{delay:({count:p,error:d})=>{var h;if(d&&d instanceof kn){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})=>C6(p)}),{enabled:o,id:l})}}function C6(e){return"code"in e&&typeof e.code=="number"?e.code===-1||e.code===dr.code||e.code===Ln.code:e instanceof kn&&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 O6({key:e,methods:t,name:n,request:r,retryCount:o=3,retryDelay:s=150,timeout:i,type:c},a){const u=wh();return{config:{key:e,methods:t,name:n,request:r,retryCount:o,retryDelay:s,timeout:i,type:c},request:A6(r,{methods:t,retryCount:o,retryDelay:s,uid:u}),value:a}}function I6(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 N6(){return{current:0,take(){return this.current++},reset(){this.current=0}}}const xh=N6();function M6(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 I6(async({signal:h})=>{const m={...c,body:Array.isArray(r)?Te(r.map(P=>({jsonrpc:"2.0",id:P.id??xh.take(),...P}))):Te({jsonrpc:"2.0",id:r.id??xh.take(),...r}),headers:{"Content-Type":"application/json",...a},method:u||"POST",signal:l||(i>0?h:null)},y=new Request(e,m),A=await(o==null?void 0:o(y,m))??{...m,url:e};return await fetch(A.url??e,A)},{errorInstance:new Ep({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 kn({body:r,details:Te(d.error)||p.statusText,headers:p.headers,status:p.status,url:e});return d}catch(p){throw p instanceof kn||p instanceof Ep?p:new kn({body:r,cause:p,url:e})}}}}function k6(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:{},y=t.retryCount??p,A=d??t.timeout??1e4,g=e,P=M6(g,{fetchOptions:r,onRequest:c,onResponse:a,timeout:A});return O6({key:o,methods:s,name:i,async request({method:k,params:B}){const F={method:k,params:B},{schedule:j}=yh({id:g,wait:m,shouldSplitBatch(N){return N.length>h},fn:N=>P.request({body:N}),sort:(N,I)=>N.id-I.id}),b=async N=>n?j(N):[await P.request({body:N})],[{error:w,result:T}]=await b(F);if(l)return{error:w,result:T};if(w)throw new Wa({body:F,error:w,url:g});return T},retryCount:y,retryDelay:u,timeout:A,type:"http"},{fetchOptions:r,url:g})}}function Oc(e,t){var r,o,s,i,c,a;if(!(e instanceof H))return!1;const n=e.walk(u=>u instanceof za);return n instanceof za?!!(((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===lp[50]):!1}function L6(e){const{abi:t,data:n}=e,r=lr(n,0,4),o=t.find(s=>s.type==="function"&&r===Yr(yt(s)));if(!o)throw new xx(r,{docsPath:"/docs/contract/decodeFunctionData"});return{functionName:o.name,args:"inputs"in o&&o.inputs&&o.inputs.length>0?Qr(o.inputs,lr(n,4)):void 0}}const Ic="/docs/contract/encodeErrorResult";function Eh(e){const{abi:t,errorName:n,args:r}=e;let o=t[0];if(n){const a=Mn({abi:t,args:r,name:n});if(!a)throw new Td(n,{docsPath:Ic});o=a}if(o.type!=="error")throw new Td(void 0,{docsPath:Ic});const s=yt(o),i=Yr(s);let c="0x";if(r&&r.length>0){if(!o.inputs)throw new vx(o.name,{docsPath:Ic});c=tn(o.inputs,r)}return ur([i,c])}const Nc="/docs/contract/encodeFunctionResult";function B6(e){const{abi:t,functionName:n,result:r}=e;let o=t[0];if(n){const i=Mn({abi:t,name:n});if(!i)throw new nr(n,{docsPath:Nc});o=i}if(o.type!=="function")throw new nr(void 0,{docsPath:Nc});if(!o.outputs)throw new Id(o.name,{docsPath:Nc});const s=(()=>{if(o.outputs.length===0)return[];if(o.outputs.length===1)return[r];if(Array.isArray(r))return r;throw new Nd(r)})();return tn(o.outputs,s)}const zs="x-batch-gateway:true";async function Sh(e){const{data:t,ccipRequest:n}=e,{args:[r]}=L6({abi:vc,data:t}),o=[],s=[];return await Promise.all(r.map(async(i,c)=>{try{s[c]=i.urls.includes(zs)?await Sh({data:i.data,ccipRequest:n}):await n(i),o[c]=!1}catch(a){o[c]=!0,s[c]=R6(a)}})),B6({abi:vc,functionName:"query",result:[o,s]})}function R6(e){return e.name==="HttpRequestError"&&e.status?Eh({abi:vc,errorName:"HttpError",args:[e.status,e.shortMessage]}):Eh({abi:[fp],errorName:"Error",args:["shortMessage"in e?e.shortMessage:e.message]})}function Ph(e){if(e.length!==66||e.indexOf("[")!==0||e.indexOf("]")!==65)return null;const t=`0x${e.slice(1,65)}`;return vt(t)?t:null}function Ws(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=Ph(n[r]),s=o?or(o):Ie(Nn(n[r]),"bytes");t=Ie(Et([t,s]),"bytes")}return $e(t)}function D6(e){return`[${e.slice(2)}]`}function F6(e){const t=new Uint8Array(32).fill(0);return e?Ph(e)||Ie(Nn(e)):$e(t)}function Hs(e){const t=e.replace(/^\.|\.$/gm,"");if(t.length===0)return new Uint8Array(1);const n=new Uint8Array(Nn(t).byteLength+2);let r=0;const o=t.split(".");for(let s=0;s<o.length;s++){let i=Nn(o[s]);i.byteLength>255&&(i=Nn(D6(F6(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 j6(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 gr({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=Ft({abi:dh,functionName:"addr",...o!=null?{args:[Ws(s),BigInt(o)]}:{args:[Ws(s)]}}),p={address:u,abi:lh,functionName:"resolve",args:[Xt(Hs(s)),f,i??[zs]],blockNumber:n,blockTag:r},h=await J(e,sn,"readContract")(p);if(h[0]==="0x")return null;const m=Dn({abi:dh,args:o!=null?[Ws(s),BigInt(o)]:void 0,functionName:"addr",data:h[0]});return m==="0x"||In(m)==="0x00"?null:m}catch(f){if(c)throw f;if(Oc(f,"resolve"))return null;throw f}}class _6 extends H{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 Ao extends H{constructor({reason:t}){super(`ENS NFT avatar URI is invalid. ${t}`,{name:"EnsAvatarInvalidNftUriError"})}}class Mc extends H{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 U6 extends H{constructor({namespace:t}){super(`ENS NFT avatar namespace "${t}" is not supported. Must be "erc721" or "erc1155".`,{name:"EnsAvatarUnsupportedNamespaceError"})}}const z6=/(?<protocol>https?:\/\/[^\/]*|ipfs:\/|ipns:\/|ar:\/)?(?<root>\/)?(?<subpath>ipfs\/|ipns\/)?(?<target>[\w\-.]+)(?<subtarget>\/.*)?/,W6=/^(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>\/.*)?$/,H6=/^data:([a-zA-Z\-/+]*);base64,([^"].*)/,V6=/^data:([a-zA-Z\-/+]*)?(;[a-zA-Z0-9].*?)?(,)/;async function G6(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 $h(e,t){return e?e.endsWith("/")?e.slice(0,-1):e:t}function Th({uri:e,gatewayUrls:t}){const n=H6.test(e);if(n)return{uri:e,isOnChain:!0,isEncoded:n};const r=$h(t==null?void 0:t.ipfs,"https://ipfs.io"),o=$h(t==null?void 0:t.arweave,"https://arweave.net"),s=e.match(z6),{protocol:i,subpath:c,target:a,subtarget:u=""}=(s==null?void 0:s.groups)||{},l=i==="ipns:/"||c==="ipns/",f=i==="ipfs:/"||c==="ipfs/"||W6.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(V6,"");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 Mc({uri:e})}function Ah(e){if(typeof e!="object"||!("image"in e)&&!("image_url"in e)&&!("image_data"in e))throw new _6({data:e});return e.image||e.image_url||e.image_data}async function q6({gatewayUrls:e,uri:t}){try{const n=await fetch(t).then(o=>o.json());return await kc({gatewayUrls:e,uri:Ah(n)})}catch{throw new Mc({uri:t})}}async function kc({gatewayUrls:e,uri:t}){const{uri:n,isOnChain:r}=Th({uri:t,gatewayUrls:e});if(r||await G6(n))return n;throw new Mc({uri:t})}function Z6(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 Ao({reason:"Only EIP-155 supported"});if(!i)throw new Ao({reason:"Chain ID not found"});if(!a)throw new Ao({reason:"Contract address not found"});if(!o)throw new Ao({reason:"Token ID not found"});if(!c)throw new Ao({reason:"ERC namespace not found"});return{chainID:Number.parseInt(i),namespace:c.toLowerCase(),contractAddress:a,tokenID:o}}async function K6(e,{nft:t}){if(t.namespace==="erc721")return sn(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 sn(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 U6({namespace:t.namespace})}async function Y6(e,{gatewayUrls:t,record:n}){return/eip155:/i.test(n)?X6(e,{gatewayUrls:t,record:n}):kc({uri:n,gatewayUrls:t})}async function X6(e,{gatewayUrls:t,record:n}){const r=Z6(n),o=await K6(e,{nft:r}),{uri:s,isOnChain:i,isEncoded:c}=Th({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 kc({uri:Ah(l),gatewayUrls:t})}let a=r.tokenID;return r.namespace==="erc1155"&&(a=a.replace("0x","").padStart(64,"0")),q6({gatewayUrls:t,uri:s.replace(/(?:0x)?{id}/,a)})}async function Ch(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 gr({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:lh,functionName:"resolve",args:[Xt(Hs(s)),Ft({abi:fh,functionName:"text",args:[Ws(s),o]}),i??[zs]],blockNumber:n,blockTag:r},d=await J(e,sn,"readContract")(f);if(d[0]==="0x")return null;const h=Dn({abi:fh,functionName:"text",data:d[0]});return h===""?null:h}catch(f){if(c)throw f;if(Oc(f,"resolve"))return null;throw f}}async function Q6(e,{blockNumber:t,blockTag:n,assetGatewayUrls:r,name:o,gatewayUrls:s,strict:i,universalResolverAddress:c}){const a=await J(e,Ch,"getEnsText")({blockNumber:t,blockTag:n,key:"avatar",name:o,universalResolverAddress:c,gatewayUrls:s,strict:i});if(!a)return null;try{return await Y6(e,{record:a,gatewayUrls:r})}catch{return null}}async function J6(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=gr({blockNumber:n,chain:e.chain,contract:"ensUniversalResolver"})}const a=`${t.toLowerCase().substring(2)}.addr.reverse`;try{const u={address:c,abi:s6,functionName:"reverse",args:[Xt(Hs(a))],blockNumber:n,blockTag:r},l=J(e,sn,"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(Oc(u,"reverse"))return null;throw u}}async function e5(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 gr({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 J(e,sn,"readContract")({address:i,abi:[{inputs:[{type:"bytes"}],name:"findResolver",outputs:[{type:"address"},{type:"bytes32"}],stateMutability:"view",type:"function"}],functionName:"findResolver",args:[Xt(Hs(o))],blockNumber:n,blockTag:r});return a}async function Oh(e,t){var y,A,g;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?St(n):void 0;try{Eo(t);const k=(typeof r=="bigint"?Q(r):void 0)||o,B=(g=(A=(y=e.chain)==null?void 0:y.formatters)==null?void 0:A.transactionRequest)==null?void 0:g.format,j=(B||Ms)({...Ja(h,{format:B}),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}),b=await e.request({method:"eth_createAccessList",params:[j,k]});return{accessList:b.accessList,gasUsed:BigInt(b.gasUsed)}}catch(P){throw gh(P,{...t,account:m,chain:e.chain})}}async function t5(e){const t=Ts(e,{method:"eth_newBlockFilter"}),n=await e.request({method:"eth_newBlockFilter"});return{id:n,request:t(n),type:"block"}}async function Ih(e,{address:t,args:n,event:r,events:o,fromBlock:s,strict:i,toBlock:c}={}){const a=o??(r?[r]:void 0),u=Ts(e,{method:"eth_newFilter"});let l=[];a&&(l=[a.flatMap(d=>Xr({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"?Q(s):s,toBlock:typeof c=="bigint"?Q(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 Nh(e){const t=Ts(e,{method:"eth_newPendingTransactionFilter"}),n=await e.request({method:"eth_newPendingTransactionFilter"});return{id:n,request:t(n),type:"transaction"}}async function n5(e){const t=await e.request({method:"eth_blobBaseFee"});return BigInt(t)}async function r5(e,{blockHash:t,blockNumber:n,blockTag:r="latest"}={}){const o=n!==void 0?Q(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}),Yt(s)}async function Mh(e,{address:t,blockNumber:n,blockTag:r="latest"}){const o=n!==void 0?Q(n):void 0,s=await e.request({method:"eth_getCode",params:[t,o||r]},{dedupe:!!o});if(s!=="0x")return s}class o5 extends H{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 s5(e,t){const{address:n,factory:r,factoryData:o}=t;try{const[s,i,c,a,u,l,f]=await J(e,sn,"readContract")({abi:i5,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 o5({address:n}):i}}const i5=[{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 a5(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 c5(e,{blockCount:t,blockNumber:n,blockTag:r="latest",rewardPercentiles:o}){const s=typeof n=="bigint"?Q(n):void 0,i=await e.request({method:"eth_feeHistory",params:[Q(t),s||r,o]},{dedupe:!!s});return a5(i)}async function u5(e,{filter:t}){const n=t.strict??!1,o=(await t.request({method:"eth_getFilterLogs",params:[t.id]})).map(s=>rn(s));return t.abi?ac({abi:t.abi,logs:o,strict:n}):o}class l5 extends H{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=>` ${eo(a)}`)],` Sender: ${s}`,` Data: ${r}`,` Callback selector: ${t}`,` Extra data: ${o}`].flat(),name:"OffchainLookupError"})}}class f5 extends H{constructor({result:t,url:n}){super("Offchain gateway response is malformed. Response data must be a hex value.",{metaMessages:[`Gateway URL: ${eo(n)}`,`Response: ${Te(t)}`],name:"OffchainLookupResponseMalformedError"})}}class d5 extends H{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 p5="0x556f1830",kh={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 h5(e,{blockNumber:t,blockTag:n,data:r,to:o}){const{args:s}=mp({data:r,abi:[kh]}),[i,c,a,u,l]=s,{ccipRead:f}=e,p=f&&typeof(f==null?void 0:f.request)=="function"?f.request:Lh;try{if(!ks(o,i))throw new d5({sender:i,to:o});const d=c.includes(zs)?await Sh({data:a,ccipRequest:p}):await p({data:a,sender:i,urls:c}),{data:h}=await Po(e,{blockNumber:t,blockTag:n,data:Et([u,tn([{type:"bytes"},{type:"bytes"}],[d,l])]),to:o});return h}catch(d){throw new l5({callbackSelector:u,cause:d,data:r,extraData:l,sender:i,urls:c})}}async function Lh({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 kn({body:a,details:f!=null&&f.error?Te(f.error):l.statusText,headers:l.headers,status:l.status,url:i});continue}if(!vt(f)){r=new f5({result:f,url:i});continue}return f}catch(l){r=new kn({body:a,details:l.message,url:i})}}throw r}const m5=Object.freeze(Object.defineProperty({__proto__:null,ccipRequest:Lh,offchainLookup:h5,offchainLookupAbiItem:kh,offchainLookupSignature:p5},Symbol.toStringTag,{value:"Module"}));function g5(e){return{formatters:void 0,fees:void 0,serializers:void 0,...e}}class b5 extends H{constructor({domain:t}){super(`Invalid domain "${Te(t)}".`,{metaMessages:["Must be a valid EIP-712 domain."]})}}class y5 extends H{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 v5 extends H{constructor({type:t}){super(`Struct type "${t}" is invalid.`,{metaMessages:["Struct type must not be a Solidity type."],name:"InvalidStructTypeError"})}}function w5(e){const{domain:t={},message:n,primaryType:r}=e,o={EIP712Domain:$5({domain:t}),...e.types};P5({domain:t,message:n,primaryType:r,types:o});const s=["0x1901"];return t&&s.push(x5({domain:t,types:o})),r!=="EIP712Domain"&&s.push(Bh({data:n,primaryType:r,types:o})),Ie(Et(s))}function x5({domain:e,types:t}){return Bh({data:e,primaryType:"EIP712Domain",types:t})}function Bh({data:e,primaryType:t,types:n}){const r=Rh({data:e,primaryType:t,types:n});return Ie(r)}function Rh({data:e,primaryType:t,types:n}){const r=[{type:"bytes32"}],o=[E5({primaryType:t,types:n})];for(const s of n[t]){const[i,c]=Fh({types:n,name:s.name,type:s.type,value:e[s.name]});r.push(i),o.push(c)}return tn(r,o)}function E5({primaryType:e,types:t}){const n=Xt(S5({primaryType:e,types:t}));return Ie(n)}function S5({primaryType:e,types:t}){let n="";const r=Dh({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 Dh({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])Dh({primaryType:s.type,types:t},n);return n}function Fh({types:e,name:t,type:n,value:r}){if(e[n]!==void 0)return[{type:"bytes32"},Ie(Rh({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(Xt(r))];if(n.lastIndexOf("]")===n.length-1){const o=n.slice(0,n.lastIndexOf("[")),s=r.map(i=>Fh({name:t,type:o,types:e,value:i}));return[{type:"bytes32"},Ie(tn(s.map(([i])=>i),s.map(([,i])=>i)))]}return[{type:n},r]}function P5(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(op);if(p&&(typeof f=="number"||typeof f=="bigint")){const[m,y,A]=p;Q(f,{signed:y==="int",size:Number.parseInt(A)/8})}if(l==="address"&&typeof f=="string"&&!ct(f))throw new bn({address:f});const d=l.match(dE);if(d){const[m,y]=d;if(y&&we(f)!==Number.parseInt(y))throw new Sx({expectedSize:Number.parseInt(y),givenSize:we(f)})}const h=o[l];h&&(T5(l),s(h,f))}};if(o.EIP712Domain&&t){if(typeof t!="object")throw new b5({domain:t});s(o.EIP712Domain,t)}if(r!=="EIP712Domain")if(o[r])s(o[r],n);else throw new y5({primaryType:r,types:o})}function $5({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 T5(e){if(e==="address"||e==="bool"||e==="string"||e.startsWith("bytes")||e.startsWith("uint")||e.startsWith("int"))throw new v5({type:e})}const A5=`Ethereum Signed Message:
149
+ `;function C5(e){const t=typeof e=="string"?qr(e):typeof e.raw=="string"?e.raw:$e(e.raw),n=qr(`${A5}${we(t)}`);return Et([n,t])}function jh(e,t){return Ie(C5(e),t)}const _h="0x6492649264926492649264926492649264926492649264926492649264926492";function O5(e){return rp(e,-32)===_h}function I5(e){const{address:t,data:n,signature:r,to:o="hex"}=e,s=ur([tn([{type:"address"},{type:"bytes"},{type:"bytes"}],[t,n,r]),_h]);return o==="hex"?s:xt(s)}function N5(e){return e.map(t=>({...t,value:BigInt(t.value)}))}function M5(e){return{...e,balance:e.balance?BigInt(e.balance):void 0,nonce:e.nonce?Yt(e.nonce):void 0,storageProof:e.storageProof?N5(e.storageProof):void 0}}async function k5(e,{address:t,blockNumber:n,blockTag:r,storageKeys:o}){const s=r??"latest",i=n!==void 0?Q(n):void 0,c=await e.request({method:"eth_getProof",params:[t,o,i||s]});return M5(c)}async function L5(e,{address:t,blockNumber:n,blockTag:r="latest",slot:o}){const s=n!==void 0?Q(n):void 0;return await e.request({method:"eth_getStorageAt",params:[t,o,s||r]})}async function Lc(e,{blockHash:t,blockNumber:n,blockTag:r,hash:o,index:s}){var l,f,p;const i=r||"latest",c=n!==void 0?Q(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,Q(s)]},{dedupe:!0}):a=await e.request({method:"eth_getTransactionByBlockNumberAndIndex",params:[c||i,Q(s)]},{dedupe:!!c}),!a)throw new vp({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)||Ip)(a)}async function B5(e,{hash:t,transactionReceipt:n}){const[r,o]=await Promise.all([J(e,To,"getBlockNumber")({}),t?J(e,Lc,"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 Vs(e,{hash:t}){var o,s,i;const n=await e.request({method:"eth_getTransactionReceipt",params:[t]},{dedupe:!0});if(!n)throw new wp({hash:t});return(((i=(s=(o=e.chain)==null?void 0:o.formatters)==null?void 0:s.transactionReceipt)==null?void 0:i.format)||P6)(n)}async function R5(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=gr({blockNumber:s,chain:e.chain,contract:"multicall3"})}const p=[[]];let d=0,h=0;for(let g=0;g<u.length;g++){const{abi:P,address:k,args:B,functionName:F}=u[g];try{const j=Ft({abi:P,args:B,functionName:F});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:k}]}catch(j){const b=hr(j,{abi:P,address:k,args:B,docsPath:"/docs/contract/multicall",functionName:F,sender:n});if(!r)throw b;p[d]=[...p[d],{allowFailure:!0,callData:"0x",target:k}]}}const m=await Promise.allSettled(p.map(g=>J(e,sn,"readContract")({abi:yc,account:n,address:f,args:[g],blockNumber:s,blockTag:i,functionName:"aggregate3",stateOverride:a}))),y=[];for(let g=0;g<m.length;g++){const P=m[g];if(P.status==="rejected"){if(!r)throw P.reason;for(let B=0;B<p[g].length;B++)y.push({status:"failure",error:P.reason,result:void 0});continue}const k=P.value;for(let B=0;B<k.length;B++){const{returnData:F,success:j}=k[B],{callData:b}=p[g][B],{abi:w,address:T,functionName:N,args:I}=u[y.length];try{if(b==="0x")throw new Vr;if(!j)throw new Cs({data:F});const $=Dn({abi:w,args:I,data:F,functionName:N});y.push(r?{result:$,status:"success"}:$)}catch($){const S=hr($,{abi:w,address:T,args:I,docsPath:"/docs/contract/multicall",functionName:N});if(!r)throw S;y.push({error:S,result:void 0,status:"failure"})}}}if(y.length!==u.length)throw new H("multicall results mismatch");return y}async function Bc(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?ch(p.blockOverrides):void 0,h=p.calls.map(y=>{const A=y,g=A.account?St(A.account):void 0,P=A.abi?Ft(A):A.data,k={...A,data:A.dataSuffix?Et([P||"0x",A.dataSuffix]):P,from:A.from??(g==null?void 0:g.address)};return Eo(k),Ms(k)}),m=p.stateOverrides?ec(p.stateOverrides):void 0;a.push({blockOverrides:d,calls:h,stateOverrides:m})}const l=(typeof n=="bigint"?Q(n):void 0)||r;return(await e.request({method:"eth_simulateV1",params:[{blockStateCalls:a,returnFullTransactions:s,traceTransfers:i,validation:c},l]})).map((p,d)=>({...Np(p),calls:p.calls.map((h,m)=>{var T,N;const{abi:y,args:A,functionName:g,to:P}=o[d].calls[m],k=((T=h.error)==null?void 0:T.data)??h.returnData,B=BigInt(h.gasUsed),F=(N=h.logs)==null?void 0:N.map(I=>rn(I)),j=h.status==="0x1"?"success":"failure",b=y&&j==="success"&&k!=="0x"?Dn({abi:y,data:k,functionName:g}):null,w=(()=>{var $;if(j==="success")return;let I;if((($=h.error)==null?void 0:$.data)==="0x"?I=new Vr:h.error&&(I=new Cs(h.error)),!!I)return hr(I,{abi:y??[],address:P??"0x",args:A,functionName:g??"<unknown>"})})();return{data:k,gasUsed:B,logs:F,status:j,...j==="success"?{result:b}:{error:w}}})}))}catch(a){const u=a,l=Qa(u,{});throw l instanceof Ns?u:l}}function Uh(e,t={}){const{as:n=typeof e=="string"?"Hex":"Bytes"}=t,r=Qd(V2(e));return n==="Bytes"?r:rh(r)}class D5 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 Rc={checksum:new D5(8192)}.checksum,F5=/^0x[a-fA-F0-9]{40}$/;function Gs(e,t={}){const{strict:n=!0}=t;if(!F5.test(e))throw new zh({address:e,cause:new _5});if(n){if(e.toLowerCase()===e)return;if(j5(e)!==e)throw new zh({address:e,cause:new U5})}}function j5(e){if(Rc.has(e))return Rc.get(e);Gs(e,{strict:!1});const t=e.substring(2).toLowerCase(),n=Uh(Z2(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 Rc.set(e,o),o}function Dc(e,t={}){const{strict:n=!0}=t??{};try{return Gs(e,{strict:n}),!0}catch{return!1}}class zh 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 _5 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 U5 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 Fc(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 jc(e,t){const n=typeof e,r=t.type;switch(r){case"address":return Dc(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)=>jc(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=>jc(o,{...t,type:r.replace(/(\[[0-9]{0,}\])$/,"")})):!1}}function Wh(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 Wh(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")?Dc(n[r],{strict:!1}):i.includes("address")&&i.includes("bytes")?Dc(n[r],{strict:!1}):!1)return i}}function Hh(e,t={}){const{prepare:n=!0}=t,r=Array.isArray(e)||typeof e=="string"?xd(e):e;return{...r,...n?{hash:br(r)}:{}}}function z5(e,t,n){const{args:r=[],prepare:o=!0}=n??{},s=t6(t,{strict:!1}),i=e.filter(u=>s?u.type==="function"||u.type==="error"?Vh(u)===bc(t,0,4):u.type==="event"?br(u)===t:!1:"name"in u&&u.name===t);if(i.length===0)throw new _c({name:t});if(i.length===1)return{...i[0],...o?{hash:br(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:br(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?jc(f,d):!1})){if(c&&"inputs"in c&&c.inputs){const f=Wh(u.inputs,c.inputs,r);if(f)throw new H5({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 _c({name:t});return{...a,...o?{hash:br(a)}:{}}}function Vh(e){return bc(br(e),0,4)}function W5(e){const t=typeof e=="string"?e:bs(e);return Fc(t)}function br(e){return typeof e!="string"&&"hash"in e&&e.hash?e.hash:Uh(gc(W5(e)))}class H5 extends be{constructor(t,n){super("Found ambiguous types in overloaded ABI Items.",{metaMessages:[`\`${t.type}\` in \`${Fc(bs(t.abiItem))}\`, and`,`\`${n.type}\` in \`${Fc(bs(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 _c 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 V5=/^(.*)\[([0-9]*)\]$/,G5=/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/,Gh=/^(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 q5({checksumAddress:e,parameters:t,values:n}){const r=[];for(let o=0;o<t.length;o++)r.push(Uc({checksumAddress:e,parameter:t[o],value:n[o]}));return r}function Uc({checksumAddress:e=!1,parameter:t,value:n}){const r=t,o=tS(r.type);if(o){const[s,i]=o;return K5(n,{checksumAddress:e,length:s,parameter:{...r,type:i}})}if(r.type==="tuple")return eS(n,{checksumAddress:e,parameter:r});if(r.type==="address")return Z5(n,{checksum:e});if(r.type==="bool")return X5(n);if(r.type.startsWith("uint")||r.type.startsWith("int")){const s=r.type.startsWith("int"),[,,i="256"]=Gh.exec(r.type)??[];return Q5(n,{signed:s,size:Number(i)})}if(r.type.startsWith("bytes"))return Y5(n,{type:r.type});if(r.type==="string")return J5(n);throw new Yh(r.type)}function zc(e){let t=0;for(let s=0;s<e.length;s++){const{dynamic:i,encoded:c}=e[s];i?t+=32:t+=ut(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+=ut(c)):n.push(c)}return _t(...n,...r)}function Z5(e,t){const{checksum:n=!1}=t;return Gs(e,{strict:n}),{dynamic:!1,encoded:jn(e.toLowerCase())}}function K5(e,t){const{checksumAddress:n,length:r,parameter:o}=t,s=r===null;if(!Array.isArray(e))throw new rS(e);if(!s&&e.length!==r)throw new nS({expectedLength:r,givenLength:e.length,type:`${o.type}[${r}]`});let i=!1;const c=[];for(let a=0;a<e.length;a++){const u=Uc({checksumAddress:n,parameter:o,value:e[a]});u.dynamic&&(i=!0),c.push(u)}if(s||i){const a=zc(c);if(s){const u=Be(c.length,{size:32});return{dynamic:!0,encoded:c.length>0?_t(u,a):u}}if(i)return{dynamic:!0,encoded:a}}return{dynamic:!1,encoded:_t(...c.map(({encoded:a})=>a))}}function Y5(e,{type:t}){const[,n]=t.split("bytes"),r=ut(e);if(!n){let o=e;return r%32!==0&&(o=_n(o,Math.ceil((e.length-2)/2/32)*32)),{dynamic:!0,encoded:_t(jn(Be(r,{size:32})),o)}}if(r!==Number.parseInt(n))throw new Zh({expectedSize:Number.parseInt(n),value:e});return{dynamic:!1,encoded:_n(e)}}function X5(e){if(typeof e!="boolean")throw new be(`Invalid boolean value: "${e}" (type: ${typeof e}). Expected: \`true\` or \`false\`.`);return{dynamic:!1,encoded:jn(nh(e))}}function Q5(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 oh({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 J5(e){const t=gc(e),n=Math.ceil(ut(t)/32),r=[];for(let o=0;o<n;o++)r.push(_n(bc(t,o*32,(o+1)*32)));return{dynamic:!0,encoded:_t(_n(Be(ut(t),{size:32})),...r)}}function eS(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=Uc({checksumAddress:n,parameter:c,value:e[a]});s.push(u),u.dynamic&&(o=!0)}return{dynamic:o,encoded:o?zc(s):_t(...s.map(({encoded:i})=>i))}}function tS(e){const t=e.match(/^(.*)\[(\d+)?\]$/);return t?[t[2]?Number(t[2]):null,t[1]]:void 0}function qh(e,t,n){const{checksumAddress:r=!1}={};if(e.length!==t.length)throw new Kh({expectedLength:e.length,givenLength:t.length});const o=q5({checksumAddress:r,parameters:e,values:t}),s=zc(o);return s.length===0?"0x":s}function Wc(e,t){if(e.length!==t.length)throw new Kh({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(Wc.encode(o,s))}return _t(...n)}(function(e){function t(n,r,o=!1){if(n==="address"){const a=r;return Gs(a),jn(a.toLowerCase(),o?32:0)}if(n==="string")return gc(r);if(n==="bytes")return r;if(n==="bool")return jn(nh(r),o?32:1);const s=n.match(Gh);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(G5);if(i){const[a,u]=i;if(Number.parseInt(u)!==(r.length-2)/2)throw new Zh({expectedSize:Number.parseInt(u),value:r});return _n(r,o?32:0)}const c=n.match(V5);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":_t(...l)}throw new Yh(n)}e.encode=t})(Wc||(Wc={}));class nS 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 Zh extends be{constructor({expectedSize:t,value:n}){super(`Size of bytes "${n}" (bytes${ut(n)}) does not match expected size (bytes${t}).`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiParameters.BytesSizeMismatchError"})}}class Kh extends be{constructor({expectedLength:t,givenLength:n}){super(["ABI encoding parameters/values length mismatch.",`Expected length (parameters): ${t}`,`Given length (values): ${n}`].join(`
150
+ `)),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiParameters.LengthMismatchError"})}}class rS 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 Yh 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 oS(e,t){var o;const{bytecode:n,args:r}=t;return _t(n,(o=e.inputs)!=null&&o.length&&(r!=null&&r.length)?qh(e.inputs,r):"0x")}function sS(e){return Hh(e)}function iS(e,...t){const{overloads:n}=e,r=n?aS([e,...n],e.name,{args:t[0]}):e,o=cS(r),s=t.length>0?qh(r.inputs,t[0]):void 0;return s?_t(o,s):o}function yr(e,t={}){return Hh(e,t)}function aS(e,t,n){const r=z5(e,t,n);if(r.type!=="function")throw new _c({name:t,type:"function"});return r}function cS(e){return Vh(e)}const uS="0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",Ut="0x0000000000000000000000000000000000000000",lS="0x6080604052348015600e575f80fd5b5061016d8061001c5f395ff3fe608060405234801561000f575f80fd5b5060043610610029575f3560e01c8063f8b2cb4f1461002d575b5f80fd5b610047600480360381019061004291906100db565b61005d565b604051610054919061011e565b60405180910390f35b5f8173ffffffffffffffffffffffffffffffffffffffff16319050919050565b5f80fd5b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f6100aa82610081565b9050919050565b6100ba816100a0565b81146100c4575f80fd5b50565b5f813590506100d5816100b1565b92915050565b5f602082840312156100f0576100ef61007d565b5b5f6100fd848285016100c7565b91505092915050565b5f819050919050565b61011881610106565b82525050565b5f6020820190506101315f83018461010f565b9291505056fea26469706673582212203b9fe929fe995c7cf9887f0bdba8a36dd78e8b73f149b17d2d9ad7cd09d2dc6264736f6c634300081a0033";async function fS(e,t){const{blockNumber:n,blockTag:r,calls:o,stateOverrides:s,traceAssetChanges:i,traceTransfers:c,validation:a}=t,u=t.account?St(t.account):void 0;if(i&&!u)throw new H("`account` is required when `traceAssetChanges` is true");const l=u?oS(sS("constructor(bytes, bytes)"),{bytecode:hh,args:[lS,iS(yr("function getBalance(address)"),[u.address])]}):void 0,f=i?await Promise.all(t.calls.map(async v=>{if(!v.data&&!v.abi)return;const{accessList:M}=await Oh(e,{account:u.address,...v,data:v.abi?Ft(v):v.data});return M.map(({address:D,storageKeys:_})=>_.length>0?D:null)})).then(v=>v.flat().filter(Boolean)):[],p=await Bc(e,{blockNumber:n,blockTag:r,blocks:[...i?[{calls:[{data:l}],stateOverrides:s},{calls:f.map((v,M)=>({abi:[yr("function balanceOf(address) returns (uint256)")],functionName:"balanceOf",args:[u.address],to:v,from:Ut,nonce:M})),stateOverrides:[{address:Ut,nonce:0}]}]:[],{calls:[...o,{}].map(v=>({...v,from:u==null?void 0:u.address})),stateOverrides:s},...i?[{calls:[{data:l}]},{calls:f.map((v,M)=>({abi:[yr("function balanceOf(address) returns (uint256)")],functionName:"balanceOf",args:[u.address],to:v,from:Ut,nonce:M})),stateOverrides:[{address:Ut,nonce:0}]},{calls:f.map((v,M)=>({to:v,abi:[yr("function decimals() returns (uint256)")],functionName:"decimals",from:Ut,nonce:M})),stateOverrides:[{address:Ut,nonce:0}]},{calls:f.map((v,M)=>({to:v,abi:[yr("function tokenURI(uint256) returns (string)")],functionName:"tokenURI",args:[0n],from:Ut,nonce:M})),stateOverrides:[{address:Ut,nonce:0}]},{calls:f.map((v,M)=>({to:v,abi:[yr("function symbol() returns (string)")],functionName:"symbol",from:Ut,nonce:M})),stateOverrides:[{address:Ut,nonce:0}]}]:[]],traceTransfers:c,validation:a}),d=i?p[2]:p[0],[h,m,,y,A,g,P,k]=i?p:[],{calls:B,...F}=d,j=B.slice(0,-1)??[],b=(h==null?void 0:h.calls)??[],w=(m==null?void 0:m.calls)??[],T=[...b,...w].map(v=>v.status==="success"?Rt(v.data):null),N=(y==null?void 0:y.calls)??[],I=(A==null?void 0:A.calls)??[],$=[...N,...I].map(v=>v.status==="success"?Rt(v.data):null),S=((g==null?void 0:g.calls)??[]).map(v=>v.status==="success"?v.result:null),x=((k==null?void 0:k.calls)??[]).map(v=>v.status==="success"?v.result:null),C=((P==null?void 0:P.calls)??[]).map(v=>v.status==="success"?v.result:null),O=[];for(const[v,M]of $.entries()){const D=T[v];if(typeof M!="bigint"||typeof D!="bigint")continue;const _=S[v-1],z=x[v-1],V=C[v-1],Z=v===0?{address:uS,decimals:18,symbol:"ETH"}:{address:f[v-1],decimals:V||_?Number(_??1):void 0,symbol:z??void 0};O.some(W=>W.token.address===Z.address)||O.push({token:Z,value:{pre:D,post:M,diff:M-D}})}return{assetChanges:O,block:F,results:j}}class Xh extends Ia{constructor(t,n){super(),this.finished=!1,this.destroyed=!1,jd(t);const r=Ss(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),ar(s)}update(t){return ir(this),this.iHash.update(t),this}digestInto(t){ir(this),Jt(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 Qh=(e,t,n)=>new Xh(e,t).update(n).digest();Qh.create=(e,t)=>new Xh(e,t);/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const We=BigInt(0),Re=BigInt(1),Un=BigInt(2),Jh=BigInt(3),e0=BigInt(4),t0=BigInt(5),dS=BigInt(7),n0=BigInt(8),pS=BigInt(9),r0=BigInt(16);function $t(e,t){const n=e%t;return n>=We?n:t+n}function lt(e,t,n){let r=e;for(;t-- >We;)r*=r,r%=n;return r}function o0(e,t){if(e===We)throw new Error("invert: expected non-zero number");if(t<=We)throw new Error("invert: expected positive modulus, got "+t);let n=$t(e,t),r=t,o=We,s=Re;for(;n!==We;){const c=r/n,a=r%n,u=o-s*c;r=n,n=a,o=s,s=u}if(r!==Re)throw new Error("invert: does not exist");return $t(o,t)}function Hc(e,t,n){if(!e.eql(e.sqr(t),n))throw new Error("Cannot find square root")}function s0(e,t){const n=(e.ORDER+Re)/e0,r=e.pow(t,n);return Hc(e,r,t),r}function hS(e,t){const n=(e.ORDER-t0)/n0,r=e.mul(t,Un),o=e.pow(r,n),s=e.mul(t,o),i=e.mul(e.mul(s,Un),o),c=e.mul(s,e.sub(i,e.ONE));return Hc(e,c,t),c}function mS(e){const t=Co(e),n=i0(e),r=n(t,t.neg(t.ONE)),o=n(t,r),s=n(t,t.neg(r)),i=(e+dS)/r0;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),y=c.cmov(u,l,m);return Hc(c,y,a),y}}function i0(e){if(e<Jh)throw new Error("sqrt is not defined for small field");let t=e-Re,n=0;for(;t%Un===We;)t/=Un,n++;let r=Un;const o=Co(e);for(;c0(o,r)===1;)if(r++>1e3)throw new Error("Cannot find square root: probably non-prime P");if(n===1)return s0;let s=o.pow(r,t);const i=(t+Re)/Un;return function(a,u){if(a.is0(u))return u;if(c0(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 y=Re<<BigInt(l-h-1),A=a.pow(f,y);l=h,f=a.sqr(A),p=a.mul(p,f),d=a.mul(d,A)}return d}}function gS(e){return e%e0===Jh?s0:e%n0===t0?hS:e%r0===pS?mS(e):i0(e)}const bS=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function yS(e){const t={ORDER:"bigint",MASK:"bigint",BYTES:"number",BITS:"number"},n=bS.reduce((r,o)=>(r[o]="function",r),t);return hc(e,n),e}function vS(e,t,n){if(n<We)throw new Error("invalid exponent, negatives unsupported");if(n===We)return e.ONE;if(n===Re)return t;let r=e.ONE,o=t;for(;n>We;)n&Re&&(r=e.mul(r,o)),o=e.sqr(o),n>>=Re;return r}function a0(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 c0(e,t){const n=(e.ORDER-Re)/Un,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 u0(e,t){t!==void 0&&Zr(t);const n=t!==void 0?t:e.toString(2).length,r=Math.ceil(n/8);return{nBitLength:n,nByteLength:r}}function Co(e,t,n=!1,r={}){if(e<=We)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}=u0(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:So(a),ZERO:We,ONE:Re,allowedLengths:c,create:p=>$t(p,e),isValid:p=>{if(typeof p!="bigint")throw new Error("invalid field element: expected bigint, got "+typeof p);return We<=p&&p<e},is0:p=>p===We,isValidNot0:p=>!f.is0(p)&&f.isValid(p),isOdd:p=>(p&Re)===Re,neg:p=>$t(-p,e),eql:(p,d)=>p===d,sqr:p=>$t(p*p,e),add:(p,d)=>$t(p+d,e),sub:(p,d)=>$t(p-d,e),mul:(p,d)=>$t(p*d,e),pow:(p,d)=>vS(f,p,d),div:(p,d)=>$t(p*o0(d,e),e),sqrN:p=>p*p,addN:(p,d)=>p+d,subN:(p,d)=>p-d,mulN:(p,d)=>p*d,inv:p=>o0(p,e),sqrt:s||(p=>(l||(l=gS(e)),l(f,p))),toBytes:p=>n?Kp(p,u):dc(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?Zp(p):Rs(p);if(i&&(h=$t(h,e)),!d&&!f.isValid(h))throw new Error("invalid field element: outside of range 0..ORDER");return h},invertBatch:p=>a0(f,p),cmov:(p,d,h)=>h?d:p});return Object.freeze(f)}function l0(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 f0(e){const t=l0(e);return t+Math.ceil(t/2)}function wS(e,t,n=!1){const r=e.length,o=l0(t),s=f0(t);if(r<16||r<s||r>1024)throw new Error("expected "+s+"-1024 bytes of input, got "+r);const i=n?Zp(e):Rs(e),c=$t(i,t-Re)+Re;return n?Kp(c,o):dc(c,o)}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const vr=BigInt(0),zn=BigInt(1);function qs(e,t){const n=t.negate();return e?n:t}function Vc(e,t){const n=a0(e.Fp,t.map(r=>r.Z));return t.map((r,o)=>e.fromAffine(r.toAffine(n[o])))}function d0(e,t){if(!Number.isSafeInteger(e)||e<=0||e>t)throw new Error("invalid window size, expected [1.."+t+"], got W="+e)}function Gc(e,t){d0(e,t);const n=Math.ceil(t/e)+1,r=2**(e-1),o=2**e,s=So(e),i=BigInt(e);return{windows:n,windowSize:r,mask:s,maxNumber:o,shiftBy:i}}function p0(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+=zn);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 xS(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 ES(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 qc=new WeakMap,h0=new WeakMap;function Zc(e){return h0.get(e)||1}function m0(e){if(e!==vr)throw new Error("invalid wNAF")}class SS{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>vr;)n&zn&&(r=r.add(o)),o=o.double(),n>>=zn;return r}precomputeWindow(t,n){const{windows:r,windowSize:o}=Gc(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=Gc(t,this.bits);for(let c=0;c<i.windows;c++){const{nextN:a,offset:u,isZero:l,isNeg:f,isNegF:p,offsetF:d}=p0(r,c,i);r=a,l?s=s.add(qs(p,n[d])):o=o.add(qs(f,n[u]))}return m0(r),{p:o,f:s}}wNAFUnsafe(t,n,r,o=this.ZERO){const s=Gc(t,this.bits);for(let i=0;i<s.windows&&r!==vr;i++){const{nextN:c,offset:a,isZero:u,isNeg:l}=p0(r,i,s);if(r=c,!u){const f=n[a];o=o.add(l?f.negate():f)}}return m0(r),o}getPrecomputes(t,n,r){let o=qc.get(n);return o||(o=this.precomputeWindow(n,t),t!==1&&(typeof r=="function"&&(o=r(o)),qc.set(n,o))),o}cached(t,n,r){const o=Zc(t);return this.wNAF(o,this.getPrecomputes(o,t,r),n)}unsafe(t,n,r,o){const s=Zc(t);return s===1?this._unsafeLadder(t,n,o):this.wNAFUnsafe(s,this.getPrecomputes(s,t,r),n,o)}createCache(t,n){d0(n,this.bits),h0.set(t,n),qc.delete(t)}hasCache(t){return Zc(t)!==1}}function PS(e,t,n,r){let o=t,s=e.ZERO,i=e.ZERO;for(;n>vr||r>vr;)n&zn&&(s=s.add(o)),r&zn&&(i=i.add(o)),o=o.double(),n>>=zn,r>>=zn;return{p1:s,p2:i}}function $S(e,t,n,r){xS(n,e),ES(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=Yp(BigInt(o));let a=1;c>12?a=c-3:c>4?a=c-2:c>0&&(a=2);const u=So(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 y=r[m],A=Number(y>>BigInt(d)&u);l[A]=l[A].add(n[m])}let h=i;for(let m=l.length-1,y=i;m>0;m--)y=y.add(l[m]),h=h.add(y);if(p=p.add(h),d!==0)for(let m=0;m<a;m++)p=p.double()}return p}function g0(e,t,n){if(t){if(t.ORDER!==e)throw new Error("Field.ORDER must match order: Fp == p, Fn == n");return yS(t),t}else return Co(e,{isLE:n})}function TS(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>vr))throw new Error(`CURVE.${a} must be positive bigint`)}const o=g0(t.p,n.Fp,r),s=g0(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 b0=(e,t)=>(e+(e>=0?t:-t)/y0)/t;function AS(e,t,n){const[[r,o],[s,i]]=t,c=b0(i*e,n),a=b0(-o*e,n);let u=e-c*r-a*s,l=-c*o-a*i;const f=u<cn,p=l<cn;f&&(u=-u),p&&(l=-l);const d=So(Math.ceil(Yp(n)/2))+wr;if(u<cn||u>=d||l<cn||l>=d)throw new Error("splitScalar (endomorphism): failed, k="+e);return{k1neg:f,k1:u,k2neg:p,k2:l}}function Kc(e){if(!["compact","recovered","der"].includes(e))throw new Error('Signature format must be "compact", "recovered", or "der"');return e}function Yc(e,t){const n={};for(let r of Object.keys(t))n[r]=e[r]===void 0?t[r]:e[r];return Ls(n.lowS,"lowS"),Ls(n.prehash,"prehash"),n.format!==void 0&&Kc(n.format),n}class CS extends Error{constructor(t=""){super(t)}}const an={Err:CS,_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=Bs(r);if(o.length/2&128)throw new n("tlv.encode: long form length too big");const s=r>127?Bs(o.length/2|128):"";return Bs(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 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}=an;if(e<cn)throw new t("integer: negative integers are not allowed");let n=Bs(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 Rs(e)}},toSig(e){const{Err:t,_int:n,_tlv:r}=an,o=ze("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}=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)}},cn=BigInt(0),wr=BigInt(1),y0=BigInt(2),Zs=BigInt(3),OS=BigInt(4);function xr(e,t){const{BYTES:n}=e;let r;if(typeof t=="bigint")r=t;else{let o=ze("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 IS(e,t={}){const n=TS("weierstrass",e,t),{Fp:r,Fn:o}=n;let s=n.CURVE;const{h:i,n:c}=s;hc(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=w0(r,o);function l(){if(!r.isOdd)throw new Error("compression is not supported: Field does not have .isOdd()")}function f(I,$,S){const{x,y:C}=$.toAffine(),O=r.toBytes(x);if(Ls(S,"isCompressed"),S){l();const v=!r.isOdd(C);return gn(v0(v),O)}else return gn(Uint8Array.of(4),O,r.toBytes(C))}function p(I){Fn(I,void 0,"Point");const{publicKey:$,publicKeyUncompressed:S}=u,x=I.length,C=I[0],O=I.subarray(1);if(x===$&&(C===2||C===3)){const v=r.fromBytes(O);if(!r.isValid(v))throw new Error("bad point: is not on curve, wrong x");const M=m(v);let D;try{D=r.sqrt(M)}catch(V){const Z=V instanceof Error?": "+V.message:"";throw new Error("bad point: is not on curve, sqrt error"+Z)}l();const _=r.isOdd(D);return(C&1)===1!==_&&(D=r.neg(D)),{x:v,y:D}}else if(x===S&&C===4){const v=r.BYTES,M=r.fromBytes(O.subarray(0,v)),D=r.fromBytes(O.subarray(v,v*2));if(!y(M,D))throw new Error("bad point: is not on curve");return{x:M,y:D}}else throw new Error(`bad point: got length ${x}, expected compressed=${$} or uncompressed=${S}`)}const d=t.toBytes||f,h=t.fromBytes||p;function m(I){const $=r.sqr(I),S=r.mul($,I);return r.add(r.add(S,r.mul(I,s.a)),s.b)}function y(I,$){const S=r.sqr($),x=m(I);return r.eql(S,x)}if(!y(s.Gx,s.Gy))throw new Error("bad curve params: generator point");const A=r.mul(r.pow(s.a,Zs),OS),g=r.mul(r.sqr(s.b),BigInt(27));if(r.is0(r.add(A,g)))throw new Error("bad curve params: a or b");function P(I,$,S=!1){if(!r.isValid($)||S&&r.is0($))throw new Error(`bad point coordinate ${I}`);return $}function k(I){if(!(I instanceof w))throw new Error("ProjectivePoint expected")}function B(I){if(!a||!a.basises)throw new Error("no endo");return AS(I,a.basises,o.ORDER)}const F=Xp((I,$)=>{const{X:S,Y:x,Z:C}=I;if(r.eql(C,r.ONE))return{x:S,y:x};const O=I.is0();$==null&&($=O?r.ONE:r.inv(C));const v=r.mul(S,$),M=r.mul(x,$),D=r.mul(C,$);if(O)return{x:r.ZERO,y:r.ZERO};if(!r.eql(D,r.ONE))throw new Error("invZ was invalid");return{x:v,y:M}}),j=Xp(I=>{if(I.is0()){if(t.allowInfinityPoint&&!r.is0(I.Y))return;throw new Error("bad point: ZERO")}const{x:$,y:S}=I.toAffine();if(!r.isValid($)||!r.isValid(S))throw new Error("bad point: x or y not field elements");if(!y($,S))throw new Error("bad point: equation left != right");if(!I.isTorsionFree())throw new Error("bad point: not in prime-order subgroup");return!0});function b(I,$,S,x,C){return S=new w(r.mul(S.X,I),S.Y,S.Z),$=qs(x,$),S=qs(C,S),$.add(S)}class w{constructor($,S,x){this.X=P("x",$),this.Y=P("y",S,!0),this.Z=P("z",x),Object.freeze(this)}static CURVE(){return s}static fromAffine($){const{x:S,y:x}=$||{};if(!$||!r.isValid(S)||!r.isValid(x))throw new Error("invalid affine point");if($ instanceof w)throw new Error("projective point not allowed");return r.is0(S)&&r.is0(x)?w.ZERO:new w(S,x,r.ONE)}static fromBytes($){const S=w.fromAffine(h(Fn($,void 0,"point")));return S.assertValidity(),S}static fromHex($){return w.fromBytes(ze("pointHex",$))}get x(){return this.toAffine().x}get y(){return this.toAffine().y}precompute($=8,S=!0){return N.createCache(this,$),S||this.multiply(Zs),this}assertValidity(){j(this)}hasEvenY(){const{y:$}=this.toAffine();if(!r.isOdd)throw new Error("Field doesn't support isOdd");return!r.isOdd($)}equals($){k($);const{X:S,Y:x,Z:C}=this,{X:O,Y:v,Z:M}=$,D=r.eql(r.mul(S,M),r.mul(O,C)),_=r.eql(r.mul(x,M),r.mul(v,C));return D&&_}negate(){return new w(this.X,r.neg(this.Y),this.Z)}double(){const{a:$,b:S}=s,x=r.mul(S,Zs),{X:C,Y:O,Z:v}=this;let M=r.ZERO,D=r.ZERO,_=r.ZERO,z=r.mul(C,C),V=r.mul(O,O),Z=r.mul(v,v),W=r.mul(C,O);return W=r.add(W,W),_=r.mul(C,v),_=r.add(_,_),M=r.mul($,_),D=r.mul(x,Z),D=r.add(M,D),M=r.sub(V,D),D=r.add(V,D),D=r.mul(M,D),M=r.mul(W,M),_=r.mul(x,_),Z=r.mul($,Z),W=r.sub(z,Z),W=r.mul($,W),W=r.add(W,_),_=r.add(z,z),z=r.add(_,z),z=r.add(z,Z),z=r.mul(z,W),D=r.add(D,z),Z=r.mul(O,v),Z=r.add(Z,Z),z=r.mul(Z,W),M=r.sub(M,z),_=r.mul(Z,V),_=r.add(_,_),_=r.add(_,_),new w(M,D,_)}add($){k($);const{X:S,Y:x,Z:C}=this,{X:O,Y:v,Z:M}=$;let D=r.ZERO,_=r.ZERO,z=r.ZERO;const V=s.a,Z=r.mul(s.b,Zs);let W=r.mul(S,O),K=r.mul(x,v),G=r.mul(C,M),X=r.add(S,x),ee=r.add(O,v);X=r.mul(X,ee),ee=r.add(W,K),X=r.sub(X,ee),ee=r.add(S,C);let le=r.add(O,M);return ee=r.mul(ee,le),le=r.add(W,G),ee=r.sub(ee,le),le=r.add(x,C),D=r.add(v,M),le=r.mul(le,D),D=r.add(K,G),le=r.sub(le,D),z=r.mul(V,ee),D=r.mul(Z,G),z=r.add(D,z),D=r.sub(K,z),z=r.add(K,z),_=r.mul(D,z),K=r.add(W,W),K=r.add(K,W),G=r.mul(V,G),ee=r.mul(Z,ee),K=r.add(K,G),G=r.sub(W,G),G=r.mul(V,G),ee=r.add(ee,G),W=r.mul(K,ee),_=r.add(_,W),W=r.mul(le,ee),D=r.mul(X,D),D=r.sub(D,W),W=r.mul(X,K),z=r.mul(le,z),z=r.add(z,W),new w(D,_,z)}subtract($){return this.add($.negate())}is0(){return this.equals(w.ZERO)}multiply($){const{endo:S}=t;if(!o.isValidNot0($))throw new Error("invalid scalar: out of range");let x,C;const O=v=>N.cached(this,v,M=>Vc(w,M));if(S){const{k1neg:v,k1:M,k2neg:D,k2:_}=B($),{p:z,f:V}=O(M),{p:Z,f:W}=O(_);C=V.add(W),x=b(S.beta,z,Z,v,D)}else{const{p:v,f:M}=O($);x=v,C=M}return Vc(w,[x,C])[0]}multiplyUnsafe($){const{endo:S}=t,x=this;if(!o.isValid($))throw new Error("invalid scalar: out of range");if($===cn||x.is0())return w.ZERO;if($===wr)return x;if(N.hasCache(this))return this.multiply($);if(S){const{k1neg:C,k1:O,k2neg:v,k2:M}=B($),{p1:D,p2:_}=PS(w,x,O,M);return b(S.beta,D,_,C,v)}else return N.unsafe(x,$)}multiplyAndAddUnsafe($,S,x){const C=this.multiplyUnsafe(S).add($.multiplyUnsafe(x));return C.is0()?void 0:C}toAffine($){return F(this,$)}isTorsionFree(){const{isTorsionFree:$}=t;return i===wr?!0:$?$(w,this):N.unsafe(this,c).is0()}clearCofactor(){const{clearCofactor:$}=t;return i===wr?this:$?$(w,this):this.multiplyUnsafe(i)}isSmallOrder(){return this.multiplyUnsafe(i).is0()}toBytes($=!0){return Ls($,"isCompressed"),this.assertValidity(),d(w,this,$)}toHex($=!0){return cr(this.toBytes($))}toString(){return`<Point ${this.is0()?"ZERO":this.toHex()}>`}get px(){return this.X}get py(){return this.X}get pz(){return this.Z}toRawBytes($=!0){return this.toBytes($)}_setWindowSize($){this.precompute($)}static normalizeZ($){return Vc(w,$)}static msm($,S){return $S(w,o,$,S)}static fromPrivateKey($){return w.BASE.multiply(xr(o,$))}}w.BASE=new w(s.Gx,s.Gy,r.ONE),w.ZERO=new w(r.ZERO,r.ONE,r.ZERO),w.Fp=r,w.Fn=o;const T=o.BITS,N=new SS(w,t.endo?Math.ceil(T/2):T);return w.BASE.precompute(8),w}function v0(e){return Uint8Array.of(e?2:3)}function w0(e,t){return{secretKey:t.BYTES,publicKey:1+e.BYTES,publicKeyUncompressed:1+2*e.BYTES,publicKeyHasPrefix:!0,signature:2*t.BYTES}}function NS(e,t={}){const{Fn:n}=e,r=t.randomBytes||Vd,o=Object.assign(w0(e.Fp,n),{seed:f0(n.ORDER)});function s(d){try{return!!xr(n,d)}catch{return!1}}function i(d,h){const{publicKey:m,publicKeyUncompressed:y}=o;try{const A=d.length;return h===!0&&A!==m||h===!1&&A!==y?!1:!!e.fromBytes(d)}catch{return!1}}function c(d=r(o.seed)){return wS(Fn(d,o.seed,"seed"),n.ORDER)}function a(d,h=!0){return e.BASE.multiply(xr(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:y}=o;if(n.allowedLengths||h===m)return;const A=ze("key",d).length;return A===m||A===y}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 y=xr(n,d);return e.fromHex(h).multiply(y).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=>xr(n,d),precompute(d=8,h=e.BASE){return h.precompute(d,!1)}},lengths:o})}function MS(e,t,n={}){jd(t),hc(n,{},{hmac:"function",lowS:"boolean",randomBytes:"function",bits2int:"function",bits2int_modN:"function"});const r=n.randomBytes||Vd,o=n.hmac||((S,...x)=>Qh(t,S,gn(...x))),{Fp:s,Fn:i}=e,{ORDER:c,BITS:a}=i,{keygen:u,getPublicKey:l,getSharedSecret:f,utils:p,lengths:d}=NS(e,n),h={prehash:!1,lowS:typeof n.lowS=="boolean"?n.lowS:!1,format:void 0,extraEntropy:!1},m="compact";function y(S){const x=c>>wr;return S>x}function A(S,x){if(!i.isValidNot0(x))throw new Error(`invalid signature ${S}: out of range 1..Point.Fn.ORDER`);return x}function g(S,x){Kc(x);const C=d.signature,O=x==="compact"?C:x==="recovered"?C+1:void 0;return Fn(S,O,`${x} signature`)}class P{constructor(x,C,O){this.r=A("r",x),this.s=A("s",C),O!=null&&(this.recovery=O),Object.freeze(this)}static fromBytes(x,C=m){g(x,C);let O;if(C==="der"){const{r:_,s:z}=an.toSig(Fn(x));return new P(_,z)}C==="recovered"&&(O=x[0],C="compact",x=x.subarray(1));const v=i.BYTES,M=x.subarray(0,v),D=x.subarray(v,v*2);return new P(i.fromBytes(M),i.fromBytes(D),O)}static fromHex(x,C){return this.fromBytes(Es(x),C)}addRecoveryBit(x){return new P(this.r,this.s,x)}recoverPublicKey(x){const C=s.ORDER,{r:O,s:v,recovery:M}=this;if(M==null||![0,1,2,3].includes(M))throw new Error("recovery id invalid");if(c*y0<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 z=s.toBytes(_),V=e.fromBytes(gn(v0((M&1)===0),z)),Z=i.inv(_),W=B(ze("msgHash",x)),K=i.create(-W*Z),G=i.create(v*Z),X=e.BASE.multiplyUnsafe(K).add(V.multiplyUnsafe(G));if(X.is0())throw new Error("point at infinify");return X.assertValidity(),X}hasHighS(){return y(this.s)}toBytes(x=m){if(Kc(x),x==="der")return Es(an.hexFromSig(this));const C=i.toBytes(this.r),O=i.toBytes(this.s);if(x==="recovered"){if(this.recovery==null)throw new Error("recovery bit must be present");return gn(Uint8Array.of(this.recovery),C,O)}return gn(C,O)}toHex(x){return cr(this.toBytes(x))}assertValidity(){}static fromCompact(x){return P.fromBytes(ze("sig",x),"compact")}static fromDER(x){return P.fromBytes(ze("sig",x),"der")}normalizeS(){return this.hasHighS()?new P(this.r,i.neg(this.s),this.recovery):this}toDERRawBytes(){return this.toBytes("der")}toDERHex(){return cr(this.toBytes("der"))}toCompactRawBytes(){return this.toBytes("compact")}toCompactHex(){return cr(this.toBytes("compact"))}}const k=n.bits2int||function(x){if(x.length>8192)throw new Error("input is too large");const C=Rs(x),O=x.length*8-a;return O>0?C>>BigInt(O):C},B=n.bits2int_modN||function(x){return i.create(k(x))},F=So(a);function j(S){return L2("num < 2^"+a,S,cn,F),i.toBytes(S)}function b(S,x){return Fn(S,void 0,"message"),x?Fn(t(S),void 0,"prehashed message"):S}function w(S,x,C){if(["recovered","canonical"].some(K=>K in C))throw new Error("sign() legacy options not supported");const{lowS:O,prehash:v,extraEntropy:M}=Yc(C,h);S=b(S,v);const D=B(S),_=xr(i,x),z=[j(_),j(D)];if(M!=null&&M!==!1){const K=M===!0?r(d.secretKey):M;z.push(ze("extraEntropy",K))}const V=gn(...z),Z=D;function W(K){const G=k(K);if(!i.isValidNot0(G))return;const X=i.inv(G),ee=e.BASE.multiply(G).toAffine(),le=i.create(ee.x);if(le===cn)return;const xe=i.create(X*i.create(Z+le*_));if(xe===cn)return;let oe=(ee.x===le?0:2)|Number(ee.y&wr),fe=xe;return O&&y(xe)&&(fe=i.neg(xe),oe^=1),new P(le,fe,oe)}return{seed:V,k2sig:W}}function T(S,x,C={}){S=ze("message",S);const{seed:O,k2sig:v}=w(S,x,C);return B2(t.outputLen,i.BYTES,o)(O,v)}function N(S){let x;const C=typeof S=="string"||xs(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)x=new P(S.r,S.s);else if(C){try{x=P.fromBytes(ze("sig",S),"der")}catch(v){if(!(v instanceof an.Err))throw v}if(!x)try{x=P.fromBytes(ze("sig",S),"compact")}catch{return!1}}return x||!1}function I(S,x,C,O={}){const{lowS:v,prehash:M,format:D}=Yc(O,h);if(C=ze("publicKey",C),x=b(ze("message",x),M),"strict"in O)throw new Error("options.strict was renamed to lowS");const _=D===void 0?N(S):P.fromBytes(ze("sig",S),D);if(_===!1)return!1;try{const z=e.fromBytes(C);if(v&&_.hasHighS())return!1;const{r:V,s:Z}=_,W=B(x),K=i.inv(Z),G=i.create(W*K),X=i.create(V*K),ee=e.BASE.multiplyUnsafe(G).add(z.multiplyUnsafe(X));return ee.is0()?!1:i.create(ee.x)===V}catch{return!1}}function $(S,x,C={}){const{prehash:O}=Yc(C,h);return x=b(x,O),P.fromBytes(S,"recovered").recoverPublicKey(x).toBytes()}return Object.freeze({keygen:u,getPublicKey:l,getSharedSecret:f,utils:p,lengths:d,Point:e,sign:T,verify:I,recoverPublicKey:$,Signature:P,hash:t})}function kS(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=Co(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 LS(e){const{CURVE:t,curveOpts:n}=kS(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 BS(e,t){const n=t.Point;return Object.assign({},t,{ProjectivePoint:n,CURVE:Object.assign({},e,u0(n.Fn.ORDER,n.Fn.BITS))})}function RS(e){const{CURVE:t,curveOpts:n,hash:r,ecdsaOpts:o}=LS(e),s=IS(t,n),i=MS(s,r,o);return BS(e,i)}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */function DS(e,t){const n=r=>RS({...e,hash:r});return{...n(t),create:n}}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const Xc={p:BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),n:BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),h:BigInt(1),a:BigInt(0),b:BigInt(7),Gx:BigInt("0x79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798"),Gy:BigInt("0x483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8")},FS={beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),basises:[[BigInt("0x3086d221a7d46bcde86c90e49284eb15"),-BigInt("0xe4437ed6010e88286f547fa90abfe4c3")],[BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),BigInt("0x3086d221a7d46bcde86c90e49284eb15")]]},x0=BigInt(2);function jS(e){const t=Xc.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=lt(l,n,t)*l%t,p=lt(f,n,t)*l%t,d=lt(p,x0,t)*u%t,h=lt(d,o,t)*d%t,m=lt(h,s,t)*h%t,y=lt(m,c,t)*m%t,A=lt(y,a,t)*y%t,g=lt(A,c,t)*m%t,P=lt(g,n,t)*l%t,k=lt(P,i,t)*h%t,B=lt(k,r,t)*u%t,F=lt(B,x0,t);if(!Qc.eql(Qc.sqr(F),e))throw new Error("Cannot find square root");return F}const Qc=Co(Xc.p,{sqrt:jS}),E0=DS({...Xc,Fp:Qc,lowS:!0,endo:FS},Rp),_S=Object.freeze(Object.defineProperty({__proto__:null,secp256k1:E0},Symbol.toStringTag,{value:"Module"}));function US({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 E0.Signature(Rt(e),Rt(t)).toCompactHex()}${s===0?"1b":"1c"}`;return n==="hex"?i:xt(i)}async function Jc(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=vt(i)?i:typeof i=="object"&&"r"in i&&"s"in i?US(i):$e(i),l=await(async()=>!r&&!o||O5(u)?u:I5({address:r,data:o,signature:u}))();try{const h=c?{to:c,data:Ft({abi:ph,functionName:"isValidSig",args:[n,s,l]}),...a}:{data:Sc({abi:ph,args:[n,s,l],bytecode:c6}),...a},{data:m}=await J(e,Po,"call")(h);return Mx(m??"0x0")}catch(h){try{if(ks(uE(n),await Pp({hash:s,signature:i})))return!0}catch{}if(h instanceof xp)return!1;throw h}}async function zS(e,{address:t,message:n,factory:r,factoryData:o,signature:s,...i}){const c=jh(n);return Jc(e,{address:t,factory:r,factoryData:o,hash:c,signature:s,...i})}async function WS(e,t){const{address:n,factory:r,factoryData:o,signature:s,message:i,primaryType:c,types:a,domain:u,...l}=t,f=w5({message:i,primaryType:c,types:a,domain:u});return Jc(e,{address:n,factory:r,factoryData:o,hash:f,signature:s,...l})}function S0(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 wn(f,{onBlockNumber:r,onError:o},p=>$o(async()=>{var d;try{const h=await J(e,To,"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 wn(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(g=>g.config.type==="webSocket"||g.config.type==="ipc");return A?A.value:e.transport}return e.transport})(),{unsubscribe:y}=await m.subscribe({params:["newHeads"],onData(A){var P;if(!d)return;const g=Rt((P=A.result)==null?void 0:P.number);p.onBlockNumber(g,a),a=g},onError(A){var g;(g=p.onError)==null||g.call(p,A)}});h=y,d||h()}catch(m){o==null||o(m)}})(),()=>h()})})()}async function HS(e,t){const{checkReplacement:n=!0,confirmations:r=1,hash:o,onReplaced:s,retryCount:i=6,retryDelay:c=({count:B})=>~~(1<<B)*200,timeout:a=18e4}=t,u=Te(["waitForTransactionReceipt",e.uid,o]),l=(()=>{var B;return t.pollingInterval?t.pollingInterval:(B=e.chain)!=null&&B.experimental_preconfirmationTime?e.chain.experimental_preconfirmationTime:e.pollingInterval})();let f,p,d,h=!1,m,y;const{promise:A,resolve:g,reject:P}=bh(),k=a?setTimeout(()=>{y(),m(),P(new zE({hash:o}))},a):void 0;return m=wn(u,{onReplaced:s,resolve:g,reject:P},async B=>{if(d=await J(e,Vs,"getTransactionReceipt")({hash:o}).catch(()=>{}),d&&r<=1){clearTimeout(k),B.resolve(d),m();return}y=J(e,S0,"watchBlockNumber")({emitMissed:!0,emitOnBegin:!0,poll:!0,pollingInterval:l,async onBlockNumber(F){const j=w=>{clearTimeout(k),y(),w(),m()};let b=F;if(!h)try{if(d){if(r>1&&(!d.blockNumber||b-d.blockNumber+1n<r))return;j(()=>B.resolve(d));return}if(n&&!f&&(h=!0,await Ac(async()=>{f=await J(e,Lc,"getTransaction")({hash:o}),f.blockNumber&&(b=f.blockNumber)},{delay:c,retryCount:i}),h=!1),d=await J(e,Vs,"getTransactionReceipt")({hash:o}),r>1&&(!d.blockNumber||b-d.blockNumber+1n<r))return;j(()=>B.resolve(d))}catch(w){if(w instanceof vp||w instanceof wp){if(!f){h=!1;return}try{p=f,h=!0;const T=await Ac(()=>J(e,jt,"getBlock")({blockNumber:b,includeTransactions:!0}),{delay:c,retryCount:i,shouldRetry:({error:$})=>$ instanceof Cp});h=!1;const N=T.transactions.find(({from:$,nonce:S})=>$===p.from&&S===p.nonce);if(!N||(d=await J(e,Vs,"getTransactionReceipt")({hash:N.hash}),r>1&&(!d.blockNumber||b-d.blockNumber+1n<r)))return;let I="replaced";N.to===p.to&&N.value===p.value&&N.input===p.input?I="repriced":N.from===N.to&&N.value===0n&&(I="cancelled"),j(()=>{var $;($=B.onReplaced)==null||$.call(B,{reason:I,replacedTransaction:p,transaction:N,transactionReceipt:d}),B.resolve(d)})}catch(T){j(()=>B.reject(T))}}else j(()=>B.reject(w))}}})}),A}function VS(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 wn(h,{onBlock:o,onError:s},m=>$o(async()=>{var y;try{const A=await J(e,jt,"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 g=(f==null?void 0:f.number)+1n;g<A.number;g++){const P=await J(e,jt,"getBlock")({blockNumber:g,includeTransactions:l});m.onBlock(P,f),f=P}}((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){(y=m.onError)==null||y.call(m,A)}},{emitOnBegin:r,interval:a}))})():(()=>{let h=!0,m=!0,y=()=>h=!1;return(async()=>{try{r&&J(e,jt,"getBlock")({blockTag:t,includeTransactions:l}).then(P=>{h&&m&&(o(P,void 0),m=!1)}).catch(s);const A=(()=>{if(e.transport.type==="fallback"){const P=e.transport.transports.find(k=>k.config.type==="webSocket"||k.config.type==="ipc");return P?P.value:e.transport}return e.transport})(),{unsubscribe:g}=await A.subscribe({params:["newHeads"],async onData(P){var B;if(!h)return;const k=await J(e,jt,"getBlock")({blockNumber:(B=P.result)==null?void 0:B.number,includeTransactions:l}).catch(()=>{});h&&(o(k,f),m=!1,f=k)},onError(P){s==null||s(P)}});y=g,h||y()}catch(A){s==null||s(A)}})(),()=>y()})()}function GS(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 y=Te(["watchEvent",t,n,r,e.uid,o,l,i]);return wn(y,{onLogs:a,onError:c},A=>{let g;i!==void 0&&(g=i-1n);let P,k=!1;const B=$o(async()=>{var F;if(!k){try{P=await J(e,Ih,"createEventFilter")({address:t,args:n,event:o,events:s,strict:d,fromBlock:i})}catch{}k=!0;return}try{let j;if(P)j=await J(e,Ds,"getFilterChanges")({filter:P});else{const b=await J(e,To,"getBlockNumber")({});g&&g!==b?j=await J(e,cc,"getLogs")({address:t,args:n,event:o,events:s,fromBlock:g+1n,toBlock:b}):j=[],g=b}if(j.length===0)return;if(r)A.onLogs(j);else for(const b of j)A.onLogs([b])}catch(j){P&&j instanceof Bn&&(k=!1),(F=A.onError)==null||F.call(A,j)}},{emitOnBegin:!0,interval:l});return async()=>{P&&await J(e,Fs,"uninstallFilter")({filter:P}),B()}})})():(()=>{let y=!0,A=()=>y=!1;return(async()=>{try{const g=(()=>{if(e.transport.type==="fallback"){const F=e.transport.transports.find(j=>j.config.type==="webSocket"||j.config.type==="ipc");return F?F.value:e.transport}return e.transport})(),P=s??(o?[o]:void 0);let k=[];P&&(k=[P.flatMap(j=>Xr({abi:[j],eventName:j.name,args:n}))],o&&(k=k[0]));const{unsubscribe:B}=await g.subscribe({params:["logs",{address:t,topics:k}],onData(F){var b;if(!y)return;const j=F.result;try{const{eventName:w,args:T}=ic({abi:P??[],data:j.data,topics:j.topics,strict:d}),N=rn(j,{args:T,eventName:w});a([N])}catch(w){let T,N;if(w instanceof Gr||w instanceof vs){if(f)return;T=w.abiItem.name,N=(b=w.abiItem.inputs)==null?void 0:b.some($=>!("name"in $&&$.name))}const I=rn(j,{args:N?[]:{},eventName:T});a([I])}},onError(F){c==null||c(F)}});A=B,y||A()}catch(g){c==null||c(g)}})(),()=>A()})()}function qS(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 wn(u,{onTransactions:r,onError:n},l=>{let f;const p=$o(async()=>{var d;try{if(!f)try{f=await J(e,Nh,"createPendingTransactionFilter")({});return}catch(m){throw p(),m}const h=await J(e,Ds,"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 J(e,Fs,"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 ZS(e){var f,p,d;const{scheme:t,statement:n,...r}=((f=e.match(KS))==null?void 0:f.groups)??{},{chainId:o,expirationTime:s,issuedAt:i,notBefore:c,requestId:a,...u}=((p=e.match(YS))==null?void 0:p.groups)??{},l=(d=e.split("Resources:")[1])==null?void 0:d.split(`
151
+ - `).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 KS=/^(?:(?<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)?/,YS=/(?: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 XS(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||!ct(r.address,{strict:!1})||t&&!ks(r.address,t))return!1}catch{return!1}return!0}async function QS(e,t){const{address:n,domain:r,message:o,nonce:s,scheme:i,signature:c,time:a=new Date,...u}=t,l=ZS(o);if(!l.address||!XS({address:n,domain:r,message:l,nonce:s,scheme:i,time:a}))return!1;const p=jh(o);return Jc(e,{address:l.address,hash:p,signature:c,...u})}function JS(e){return{call:t=>Po(e,t),createAccessList:t=>Oh(e,t),createBlockFilter:()=>t5(e),createContractEventFilter:t=>cp(e,t),createEventFilter:t=>Ih(e,t),createPendingTransactionFilter:()=>Nh(e),estimateContractGas:t=>I2(e,t),estimateGas:t=>sc(e,t),getBalance:t=>Hp(e,t),getBlobBaseFee:()=>n5(e),getBlock:t=>jt(e,t),getBlockNumber:t=>To(e,t),getBlockTransactionCount:t=>r5(e,t),getBytecode:t=>Mh(e,t),getChainId:()=>Up(e),getCode:t=>Mh(e,t),getContractEvents:t=>Gp(e,t),getEip712Domain:t=>s5(e,t),getEnsAddress:t=>j6(e,t),getEnsAvatar:t=>Q6(e,t),getEnsName:t=>J6(e,t),getEnsResolver:t=>e5(e,t),getEnsText:t=>Ch(e,t),getFeeHistory:t=>c5(e,t),estimateFeesPerGas:t=>p2(e,t),getFilterChanges:t=>Ds(e,t),getFilterLogs:t=>u5(e,t),getGasPrice:()=>nc(e),getLogs:t=>cc(e,t),getProof:t=>k5(e,t),estimateMaxPriorityFeePerGas:t=>d2(e,t),getStorageAt:t=>L5(e,t),getTransaction:t=>Lc(e,t),getTransactionConfirmations:t=>B5(e,t),getTransactionCount:t=>kp(e,t),getTransactionReceipt:t=>Vs(e,t),multicall:t=>R5(e,t),prepareTransactionRequest:t=>Wp(e,t),readContract:t=>sn(e,t),sendRawTransaction:t=>E6(e,t),simulate:t=>Bc(e,t),simulateBlocks:t=>Bc(e,t),simulateCalls:t=>fS(e,t),simulateContract:t=>h6(e,t),verifyMessage:t=>zS(e,t),verifySiweMessage:t=>QS(e,t),verifyTypedData:t=>WS(e,t),uninstallFilter:t=>Fs(e,t),waitForTransactionReceipt:t=>HS(e,t),watchBlocks:t=>VS(e,t),watchBlockNumber:t=>S0(e,t),watchContractEvent:t=>x6(e,t),watchEvent:t=>GS(e,t),watchPendingTransactions:t=>qS(e,t)}}function eP(e){const{key:t="public",name:n="Public Client"}=e;return $6({...e,key:t,name:n,type:"publicClient"}).extend(JS)}const tP=g5({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}}}),Oo=({size:e="xs",color:t,className:n="",label:r="Loading...",inline:o=!1})=>{const s=t?`loading-${t}`:"",i=o?"loading-inline":"";return L.jsx("span",{className:`loading loading-${e} loading-spinner ${s} ${i} ${n}`.trim(),"aria-label":r,role:"status","aria-live":"polite"})},nP=({depositAmount:e,curSelectToken:t,approved:n,currentActiveChain:r,tokenBalance:o,platformBalance:s="0",showLayerZeroTip:i=!1,layerZeroTipKey:c,onDepositAmountChange:a,onApproved:u})=>{const{t:l}=Tt(),[f,p]=E.useState(!1);E.useEffect(()=>{n&&f&&p(!1)},[n,f]);const d=E.useCallback(async()=>{if(!f)try{p(!0),await u()}catch(g){p(!1),console.error("Approve failed:",g)}},[u,f]),h=E.useCallback(()=>{let g=o||"0";if(Ef(r==null?void 0:r.chainId,t))try{const P=new ke(g),k=new ke("200000");P.gt(k)&&(g="200000")}catch(P){console.warn("Error calculating max amount limit:",P)}return g},[o,r==null?void 0:r.chainId,t]),m=E.useMemo(()=>{if(!Ef(r==null?void 0:r.chainId,t))return!1;try{const g=new ke(e||"0"),P=new ke("200000");return g.isNaN()||P.isNaN()?!1:g.gte(P)}catch{return!1}},[r,e,t]),y=g=>{const P=g.target.value,k=h(),B=ra(P,k);if(B.isValid)a(B.formattedValue),B.errorType;else return B.errorType==="exceed_balance",void 0},A=()=>{const g=parseFloat(o||"0"),P=parseFloat(e||"0");if(P>0){const k=g-P,B=gt(Math.max(0,k).toString());return L.jsxs("span",{className:"flex items-center gap-1",children:[gt(o||"0"),L.jsx("span",{className:"text-sm font-edgex-harmony text-functional-green-1 leading-[18px] font-medium",children:"→"}),B," ",t]})}return`${gt(o||"0")} ${t}`};return L.jsxs(L.Fragment,{children:[L.jsxs("div",{className:"bg-fill-input-primary rounded-lg px-3 py-3 my-4",children:[L.jsxs("div",{className:"flex justify-between items-center h-[18px] mb-3",children:[L.jsx("input",{type:"text",placeholder:l("deposit.amount"),value:e,onChange:y,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"}),L.jsx("button",{onClick:()=>{const g=h();a(g)},className:"text-theme-normal text-xs font-medium cursor-pointer hover:opacity-80 transition-opacity h-full flex items-center",children:l("deposit.max")})]}),L.jsx("div",{className:"h-[1px] bg-line-divider-secondary mb-2"}),L.jsxs("div",{className:"flex justify-between items-center",children:[L.jsx(er,{content:l("deposit.availableDesc"),children:L.jsx("span",{className:"text-text-tertiary text-xs leading-[14px] border-b border-dashed border-line-divider-primary",children:l("deposit.available")})}),L.jsx("span",{className:"text-text-primary text-xs leading-[14px]",children:A()})]})]}),!n&&a1(e||"0",0)&&L.jsxs("div",{className:"flex justify-center flex-col items-center",children:[L.jsx("h3",{className:"text-text-primary text-sm leading-4 font-medium",children:l("deposit.enableSystemProWithToken",{token:t,network:r==null?void 0:r.chain})}),L.jsx("p",{className:"text-text-secondary text-xs leading-3 mt-4",children:l("deposit.enableTokenDesc",{token:t,network:r==null?void 0:r.chain})}),L.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:d,disabled:f,children:f?L.jsx(Oo,{size:"xs",inline:!0}):l("deposit.enableWithToken",{token:t})})]}),i&&L.jsxs(L.Fragment,{children:[L.jsxs("div",{className:"flex mb-4",children:[L.jsx("div",{className:"w-5",children:L.jsx("img",{src:gs,className:"w-4 h-4",alt:"Warning"})}),L.jsx("div",{className:"flex-1 text-xs text-functional-orange-1",children:l(c||"deposit.layerZeroDepositTip")})]}),L.jsx("div",{className:"my-2 ml-5 h-[1px] border-b border-dashed border-line-divider-secondary"})]}),m&&L.jsxs("div",{className:"flex mb-4",children:[L.jsx("div",{className:"w-5",children:L.jsx("img",{src:gs,className:"w-4 h-4",alt:"Warning"})}),L.jsx("div",{className:"flex-1 text-xs text-functional-orange-1",children:l("deposit.depositTipFor25w")})]}),m&&L.jsx("div",{className:"my-2 ml-5 h-[1px] border-b border-dashed border-line-divider-secondary"}),L.jsxs("div",{className:"flex mb-4",children:[L.jsx("div",{className:"w-5",children:!(m||i)&&L.jsx("img",{src:gs,className:"w-4 h-4",alt:"Warning"})}),L.jsx("div",{className:"flex-1 text-xs text-functional-orange-1",children:l("deposit.noPrivateKeyWalletWarning")})]}),L.jsxs("div",{className:"border-t border-line-divider-secondary border-dashed py-4",children:[L.jsxs("div",{className:"flex justify-between items-center h-[18px] leading-4",children:[L.jsx("span",{className:"text-sm text-text-tertiary",children:l("deposit.arrivalTime")}),L.jsx(er,{content:L.jsxs("div",{className:"grid flex-grow max-w-[300px] min-w-[80px] rounded-2xl flex-col gap-[10px]",children:[L.jsx("p",{children:l("deposit.arrivaltimeTooltip1",{v:(r==null?void 0:r.blockTime)*r.txConfirm/60,v1:r==null?void 0:r.txConfirm})}),L.jsx("p",{children:l("deposit.arrivaltimeTooltip2")})]}),placement:"top",children:L.jsx("span",{className:"text-text-primary font-medium text-right border-b-[2px] border-dashed border-line-divider-primary decoration-dashed text-sm",children:l("deposit.arrivalEstimated",{v:(r==null?void 0:r.blockTime)*r.txConfirm/60})})})]}),L.jsxs("div",{className:"flex justify-between items-center h-[18px] leading-4 mt-2",children:[L.jsx("span",{className:"text-sm text-text-tertiary",children:l("deposit.equity")}),L.jsx("span",{className:"text-sm text-text-primary font-medium",children:e?L.jsxs("span",{className:"flex items-center gap-1",children:[gt(s),L.jsx("span",{className:"text-sm font-edgex-harmony text-functional-green-1 leading-[18px] font-medium",children:"→"}),gt((parseFloat(s)+parseFloat(e)).toString())," ",t]}):`${gt(s)} ${t}`})]})]})]})},rP=({token:e,account:t,chainId:n,contractAddress:r,wagmiHooks:o,onResult:s})=>{var a,u;const i=(a=o==null?void 0:o.useBalance)==null?void 0:a.call(o,{address:t,token:e.tokenAddress,chainId:n,query:{enabled:!!t&&!!n&&!!e.tokenAddress&&!!(o!=null&&o.useBalance)}}),c=(u=o==null?void 0:o.useReadContract)==null?void 0:u.call(o,{address:e.tokenAddress,abi:[{name:"allowance",type:"function",stateMutability:"view",inputs:[{name:"owner",type:"address"},{name:"spender",type:"address"}],outputs:[{name:"",type:"uint256"}]}],functionName:"allowance",args:[t,r],chainId:n,query:{enabled:!!t&&!!n&&!!e.tokenAddress&&!!r&&!!(o!=null&&o.useReadContract)}});return E.useEffect(()=>{s(e.tokenAddress,{balance:i,allowance:c})},[i,c,e.tokenAddress,s]),null},P0=({account:e,chainId:t,contractAddress:n,tokens:r=[],wagmiHooks:o})=>{var h;const s=E.useMemo(()=>r.filter(m=>m.tokenAddress&&m.tokenAddress!=="0x0000000000000000000000000000000000000000"),[r]),[i,c]=E.useState({}),a=E.useCallback((m,y)=>{c(A=>({...A,[m]:y}))},[]),u=(h=o==null?void 0:o.useBalance)==null?void 0:h.call(o,{address:e,chainId:t,query:{enabled:!!e&&!!t&&!!(o!=null&&o.useBalance)}}),l=E.useMemo(()=>s.map(m=>E.createElement(rP,{key:m.tokenAddress,token:m,account:e,chainId:t,contractAddress:n,wagmiHooks:o,onResult:a})),[s,e,t,n,o,a]),f=E.useMemo(()=>{if(!(o!=null&&o.useBalance))return{balanceList:[],allowanceList:[],baseTokenBalance:{value:BigInt(0),formatted:"0",decimals:18,symbol:"ETH"},combinedData:{}};const m=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"},y=s.map(P=>{const k=i[P.tokenAddress],B=k==null?void 0:k.balance,F=B==null?void 0:B.data;return{address:P.tokenAddress,value:(F==null?void 0:F.value)||BigInt(0),formatted:(F==null?void 0:F.formatted)||"0",decimals:(F==null?void 0:F.decimals)||P.decimals}}).filter(P=>P.address),A=s.map(P=>{const k=i[P.tokenAddress],B=k==null?void 0:k.allowance,F=B==null?void 0:B.data,j=BigInt(F?F.toString():0);return{address:P.tokenAddress,value:j,formatted:(j/BigInt(10)**BigInt(P.decimals)).toString(),decimals:P.decimals}}).filter(P=>P.address),g=y.reduce((P,k)=>{const B=A.find(F=>F.address===k.address);return{...P,[k.address]:{balance:k,allowance:B||{address:k.address,value:BigInt(0),formatted:"0",decimals:k.decimals}}}},{});return{balanceList:y,allowanceList:A,baseTokenBalance:m,combinedData:g}},[u,i,s,o==null?void 0:o.useBalance]),p=E.useCallback(async()=>f,[f]),d=E.useMemo(()=>{const m=(u==null?void 0:u.isLoading)||!1,y=Object.values(i).some(A=>{var g,P;return((g=A.balance)==null?void 0:g.isLoading)||((P=A.allowance)==null?void 0:P.isLoading)});return m||y},[u==null?void 0:u.isLoading,i]);return{multicallRun:p,multicallResult:f,validErcTokens:s,isLoading:d,queryComponents:l}};function oP({client:e,tokenAddress:t,holder:n,decimals:r,fallbackFormatted:o="0",pollingInterval:s=12e3}){const[i,c]=E.useState(null),[a,u]=E.useState(o);return E.useEffect(()=>{let l,f;const p=async()=>{try{const d=await e.readContract({address:t,abi:wc,functionName:"balanceOf",args:[n]});c(d),u(Ua(d,r))}catch{u(o)}};p();try{l=e.watchContractEvent({address:t,abi:wc,eventName:"Transfer",args:{to:n},onLogs:()=>{p()},poll:!0,pollingInterval:s}),f=e.watchContractEvent({address:t,abi:wc,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}}let He=null;const sP={symbol:"USDT"},$0=E.forwardRef((e,t)=>{const[n,r]=E.useState(!1),[o,s]=E.useState(!1),[i,c]=E.useState({chains:[]}),a=E.useCallback(h=>{c(h),r(!0)},[]),u=E.useCallback(h=>{c(m=>({...m,...h}))},[]),l=E.useCallback(()=>{r(!1),s(!1),i.onClose&&i.onClose()},[i.onClose]),f=E.useCallback(h=>{s(h)},[]),p=E.useCallback(()=>n,[n]),d=E.useCallback(()=>o,[o]);return E.useImperativeHandle(t,()=>({openDeposit:a,closeDeposit:l,updateDepositOptions:u,setDepositLoading:f,isOpen:p,isLoading:d}),[a,l,u,f,p,d]),E.useEffect(()=>(He={openDeposit:a,closeDeposit:l,updateDepositOptions:u,setDepositLoading:f,isOpen:p,isLoading:d},()=>{He=null}),[a,l,u,f,p,d]),L.jsx(I0,{isOpen:n,isLoading:o,onClose:l,config:i.config||sP,currentActiveAccount:i.currentActiveAccount||oa,smartWallet:i.smartWallet||sa,chains:i.chains||f1,defaultChainId:i.defaultChainId,defaultTokenAddress:i.defaultTokenAddress,defaultAmount:i.defaultAmount,metadata:i.metadata||ia,currentEquity:i.currentEquity??5e3,platformBalance:i.platformBalance||"0",wagmiHooks:i.wagmiHooks,approved:i.approved,onApproved:i.onApproved,onDeposit:i.onDeposit,onCopy:i.onCopy,onChainChange:i.onChainChange,onTokenChange:i.onTokenChange})});$0.displayName="DepositManager";const T0=e=>{if(!He){console.error("DepositManager not initialized. Make sure to render <DepositManager /> in your app.");return}He.openDeposit(e||{chains:[]})},A0=()=>{if(!He){console.error("DepositManager not initialized. Make sure to render <DepositManager /> in your app.");return}He.closeDeposit()},C0=e=>{He&&He.updateDepositOptions(e)},Ks=e=>{if(!He){console.error("DepositManager not initialized. Make sure to render <DepositManager /> in your app.");return}He.setDepositLoading(e)},iP=()=>He?He.isOpen():!1,O0=()=>He?He.isLoading():!1,aP=()=>({openDeposit:T0,closeDeposit:A0,updateDepositOptions:C0,setDepositLoading:Ks,isOpen:iP,isLoading:O0});function cP(){var e;return typeof window<"u"&&((e=window==null?void 0:window.ENV)==null?void 0:e.CHAIN_RPC_URL_42161)||"https://arb1.arbitrum.io/rpc"}const uP=({chains:e,defaultChainId:t,defaultTokenAddress:n,defaultAmount:r="",walletAdapter:o,metadata:s,currentEquity:i,platformBalance:c="0",isLoading:a=!1,wagmiHooks:u,approved:l,onApproved:f,onDeposit:p,onClose:d,onChainChange:h,onTokenChange:m})=>{var xe;const{t:y}=Tt(),A=u==null?void 0:u.useAccount(),[g,P]=E.useState(()=>{var oe;return!e||e.length===0?1:t||((oe=e[0])==null?void 0:oe.chainId)||1}),[k,B]=E.useState(()=>{var ce;if(!e||e.length===0)return"";const oe=t||((ce=e[0])==null?void 0:ce.chainId),fe=e.find(Ge=>Ge.chainId===oe);if(!fe||!fe.tokenList||fe.tokenList.length===0)return"";const he=fe.tokenList.find(Ge=>Ge.tokenAddress===n)||fe.tokenList[0];return(he==null?void 0:he.token)||""}),[F,j]=E.useState(r),b=E.useCallback(oe=>{P(oe),h==null||h(oe)},[h]),w=E.useCallback(oe=>{B(oe),m==null||m(oe)},[m]),T=E.useRef(!0),N=E.useRef(k),I=E.useRef(g);E.useEffect(()=>{if(T.current){T.current=!1,N.current=k,I.current=g;return}(N.current!==k||I.current!==g)&&(j(""),N.current=k,I.current=g)},[k,g]);const $=e&&e.length>0?e.find(oe=>oe.chainId===g)||e[0]:null,S=(xe=$==null?void 0:$.tokenList)==null?void 0:xe.find(oe=>oe.token===k),x=o==null?void 0:o.getDisplayAddress(),{multicallResult:C,queryComponents:O}=P0({account:x,chainId:g,contractAddress:void 0,tokens:($==null?void 0:$.tokenList)||[],wagmiHooks:u}),v=E.useMemo(()=>{var fe;if(!S)return;if(!S.tokenAddress||S.tokenAddress.toLowerCase()==="0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee")return C.baseTokenBalance.formatted;const oe=C.combinedData[S.tokenAddress];return((fe=oe==null?void 0:oe.balance)==null?void 0:fe.formatted)||"0"},[S,C]),M="0xfd086bc7cd5c481dcc9c85ebe478a1c0b69fcbb9",D="0xceeed84620e5eb9ab1d6dfc316867d2cda332e41",_=E.useMemo(()=>eP({chain:tP,transport:k6(cP())}),[]),z="1000000000000",{formatted:V}=oP({client:_,tokenAddress:M,holder:D,decimals:6,fallbackFormatted:z,pollingInterval:12e3}),Z=l??!1,W=E.useMemo(()=>+A.chainId!=+g,[A.chainId,g]),{showLayerZeroTip:K,layerZeroTipKey:G}=E.useMemo(()=>{const oe=+g==42161||+g==421614,fe=(k==null?void 0:k.toUpperCase())==="USDT",he=new ke(F||"0"),ce=new ke("200000");let Ge=!1,Er;if(oe&&fe&&F)if(he.gte(ce))Ge=!0,Er="deposit.layerZeroDepositTipGte200k";else{const Sr=V;if(typeof Sr=="string"&&Sr.length>0){const Xs=new ke(Sr);!Xs.isNaN()&&he.gte(Xs)&&(Ge=!0,Er="deposit.layerZeroDepositTipExceedPool")}}return{showLayerZeroTip:Ge,layerZeroTipKey:Er}},[g,k,F,V]),X=E.useMemo(()=>{if(W)return{text:y("deposit.switchNetwork"),disabled:!1,isNetworkSwitch:!0};const oe=parseFloat(F||"0"),fe=10,ce=c1(F,v||"0",Z);return!F||oe===0||!Z?{text:y(K?"deposit.layerZeroDepositButton":"deposit.confirmDeposit"),disabled:!0,isNetworkSwitch:!1}:oe<fe?{text:y("deposit.minDepositParsed",{amount:fe,token:k}),disabled:!0,isNetworkSwitch:!1}:{text:y(K?"deposit.layerZeroDepositButton":"deposit.confirmDeposit"),disabled:!ce,isNetworkSwitch:!1}},[F,k,v,Z,W,K,y]),ee=E.useCallback(async()=>{b&&b(g)},[b,g]),le=E.useCallback(async()=>{Ks(!0);try{p&&p({amount:F,chainId:g,tokenAddress:(S==null?void 0:S.tokenAddress)||"",tokenSymbol:k})}catch(oe){console.error("Deposit error:",oe),Ks(!1)}},[p,F,g,S==null?void 0:S.tokenAddress,k]);return!(u!=null&&u.useBalance)||!(u!=null&&u.useReadContract)||!(u!=null&&u.useAccount)?L.jsxs("div",{className:"p-6 text-center",children:[L.jsx("p",{className:"text-red-500",children:"缺少必要的 wagmi hooks"}),L.jsx("p",{className:"text-sm text-gray-500 mt-2",children:"请确保传入了 useBalance, useReadContract, useAccount"})]}):!e||e.length===0?L.jsx("div",{className:"text-center py-8",children:L.jsx("p",{className:"text-gray-400",children:"No chains available"})}):$?L.jsxs(L.Fragment,{children:[O,L.jsx(na,{currentActiveChain:$,chainList:e,onChainChange:b,curSelectToken:k,onTokenChange:w,walletType:"evm"}),L.jsx(nP,{depositAmount:F,curSelectToken:k,curSelectTokenData:{balance:S==null?void 0:S.balance,allowance:S==null?void 0:S.allowance},approved:Z,currentActiveChain:$,tokenBalance:v,platformBalance:c,showLayerZeroTip:K,layerZeroTipKey:G,onDepositAmountChange:j,onApproved:async()=>{f&&await f()}}),L.jsxs("button",{className:`w-full h-[38px] text-sm rounded-xl font-medium transition-colors flex items-center justify-center gap-2 ${X.disabled||a?"bg-text-disabled text-text-secondary cursor-not-allowed":"bg-fill-btn-primary text-text-on-sec-btn"}`,onClick:X.isNetworkSwitch?ee:le,disabled:X.disabled||a,children:[a&&L.jsx(Oo,{size:"xs"}),X.text]})]}):L.jsx("div",{className:"text-center py-8",children:L.jsx("p",{className:"text-gray-400",children:"Loading..."})})},I0=({isOpen:e,isLoading:t=!1,onClose:n,config:r,currentActiveAccount:o=oa,smartWallet:s=sa,chains:i,defaultChainId:c,defaultTokenAddress:a,defaultAmount:u="",metadata:l=ia,currentEquity:f=5e3,platformBalance:p="0",wagmiHooks:d,approved:h,onApproved:m,onDeposit:y,onCopy:A,onChainChange:g,onTokenChange:P})=>{const{t:k}=Tt(),B=E.useMemo(()=>{var j;return o?vu(o,s,!1,(j=i[0])==null?void 0:j.chainId,"0","0"):null},[o,s,i]),F=(B==null?void 0:B.getWalletType())==="mpc";return e?Me.createPortal(L.jsx("div",{className:"fixed top-0 left-0 right-0 bottom-0 w-screen h-screen",style:{zIndex:49},children:L.jsx("div",{className:"fixed top-0 left-0 right-0 bottom-0 z-49 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:L.jsxs("div",{className:"relative w-[420px] max-h-[85vh] bg-fill-page-secondary overflow-auto rounded-lg p-6 shadow-xl",onClick:j=>{j.stopPropagation()},children:[L.jsxs("div",{className:"flex items-center justify-between mb-4",children:[L.jsx("h2",{className:"text-lg font-semibold text-white",children:k("deposit.title")}),L.jsx("button",{className:"text-gray-400 hover:text-gray-200 transition-colors",onClick:n,"aria-label":"Close",children:L.jsx(bu,{className:"h-4 w-4"})})]}),F?L.jsx(Aw,{chains:i,defaultChainId:c,defaultTokenAddress:a,defaultAmount:u,walletAdapter:B,metadata:l,currentEquity:f,onDeposit:y,onCopy:A,onClose:n}):L.jsx(uP,{chains:i,defaultChainId:c,defaultTokenAddress:a,defaultAmount:u,walletAdapter:B,metadata:l,currentEquity:f,platformBalance:p,isLoading:t,wagmiHooks:d,approved:h,onApproved:m,onDeposit:y,onClose:n,onChainChange:g,onTokenChange:P})]})})}),document.body):null};E.createContext(null);const lP=({withdrawAmount:e,curSelectToken:t,currentActiveChain:n,platformBalance:r="0",fee:o="0.00",walletType:s="evm",receiverAddress:i="",onWithdrawAmountChange:c,onReceiverAddressChange:a,onAmountChanged:u})=>{const{t:l}=Tt(),f=E.useMemo(()=>{if(!Mt(n==null?void 0:n.chainId)){const y=new ke(e||"0").minus(o||"0").decimalPlaces(2,ke.ROUND_DOWN);return y.isNegative()?"0.00":y.toString()}return e||"0"},[e,o,n==null?void 0:n.chainId]),p=E.useMemo(()=>r||"0",[r]),d=y=>{const A=y.target.value,P=ra(A,p||"0");if(P.isValid)c(P.formattedValue),P.errorType;else return P.errorType==="exceed_balance",void 0;u==null||u(P.formattedValue)},h=()=>{c(p),u==null||u(p)},m=()=>{const y=parseFloat(r||"0"),A=parseFloat(e||"0");if(A>0){const g=y-A,P=gt(Math.max(0,g).toString());return L.jsxs("span",{className:"flex items-center gap-1",children:[gt(r||"0"),L.jsx("span",{className:"text-sm font-edgex-harmony text-functional-green-1 leading-[18px] font-medium",children:"→"}),P," ",t]})}return`${gt(r||"0")} ${t}`};return L.jsxs(L.Fragment,{children:[L.jsxs("div",{className:"bg-fill-input-primary rounded-lg px-3 py-3 my-4",children:[L.jsxs("div",{className:"flex justify-between items-center h-[18px] mb-3",children:[L.jsx("input",{type:"text",placeholder:l("deposit.amount"),value:e,onChange:d,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"}),L.jsx("button",{onClick:h,className:"text-theme-normal text-xs font-medium cursor-pointer hover:opacity-80 transition-opacity h-full flex items-center",children:l("deposit.max")})]}),L.jsx("div",{className:"h-[1px] bg-line-divider-secondary mb-2"}),L.jsxs("div",{className:"flex justify-between items-center",children:[L.jsx(er,{content:l("deposit.availableDesc"),children:L.jsx("span",{className:"text-text-tertiary text-xs leading-[14px] border-b border-dashed border-line-divider-primary",children:l("deposit.available")})}),L.jsx("span",{className:"text-text-primary text-xs leading-[14px]",children:m()})]})]}),s==="mpc"&&!Mt(n==null?void 0:n.chainId)&&L.jsx("div",{className:"bg-fill-input-primary rounded-lg my-4 h-9 flex items-center px-3",children:L.jsx("input",{type:"text",placeholder:l("withdraw.receiverAddress"),value:i,onChange:y=>a==null?void 0:a(y.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"})}),L.jsx("div",{className:"bg-fill-page-secondary rounded-lg mb-4",children:Mt(n==null?void 0:n.chainId)?L.jsxs(L.Fragment,{children:[L.jsx("p",{className:"text-text-tertiary text-xs leading-[18px]",children:l("withdraw.noticeDesc")}),L.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:l("withdraw.commonWithdraw")})]}):L.jsx("p",{className:"text-text-tertiary text-xs leading-[18px]",children:l("withdraw.crossChainTips")})}),L.jsxs("div",{className:"py-4 border-t border-line-divider-secondary border-dashed",children:[L.jsxs("div",{className:"flex items-center justify-between h-[18px] leading-[18px]",children:[L.jsx(er,{content:L.jsxs("div",{children:[L.jsx("div",{children:l("withdraw.speedNote")}),L.jsxs("div",{className:"flex gap-1 items-center mt-1",children:[L.jsx(_r,{selectedLevel:mt.FAST,maxLevel:3}),L.jsx("span",{children:l("withdraw.speedNoteSpeed1")})]}),L.jsxs("div",{className:"flex gap-1 items-center mt-1",children:[L.jsx(_r,{selectedLevel:mt.Medium,maxLevel:3}),L.jsx("span",{children:l("withdraw.speedNoteSpeed2")})]}),L.jsxs("div",{className:"flex gap-1 items-center mt-1",children:[L.jsx(_r,{selectedLevel:mt.SLOW,maxLevel:3}),L.jsx("span",{children:l("withdraw.speedNoteSpeed3")})]})]}),children:L.jsx("span",{className:"text-text-tertiary text-sm leading-4 border-b border-dashed border-line-divider-primary",children:l("withdraw.speed")})}),L.jsx("div",{className:"flex items-center",children:L.jsx(_r,{selectedLevel:Mt(n==null?void 0:n.chainId)?mt.SLOW:mt.FAST,maxLevel:3})})]}),!Mt(n==null?void 0:n.chainId)&&L.jsxs("div",{className:"flex items-center justify-between mt-2 h-[18px]",children:[L.jsx("span",{className:"text-text-tertiary text-sm leading-4",children:l("withdraw.fee")}),L.jsxs("span",{className:"text-text-primary text-sm leading-4 font-medium",children:[o," ",t]})]}),L.jsxs("div",{className:"flex items-center justify-between mt-2 h-[18px]",children:[L.jsx("span",{className:"text-text-tertiary text-sm leading-4",children:l(Mt(n==null?void 0:n.chainId)?"withdraw.withdrawlAmount":"withdraw.amountToReceive")}),L.jsxs("span",{className:"text-text-primary text-sm leading-4 font-medium",children:[gt(f)," ",t]})]})]})]})},fP=[],dP={};let Ve=null;const N0=E.forwardRef((e,t)=>{const[n,r]=E.useState(!1),[o,s]=E.useState(!1),[i,c]=E.useState({chains:[]}),a=E.useCallback(h=>{c(h||{chains:[]}),r(!0)},[]),u=E.useCallback(h=>{c(m=>({...m,...h}))},[]),l=E.useCallback(()=>{r(!1),s(!1),i.onClose&&i.onClose()},[i.onClose]),f=E.useCallback(h=>{s(h)},[]),p=E.useCallback(()=>n,[n]),d=E.useCallback(()=>o,[o]);return E.useImperativeHandle(t,()=>({openWithdraw:a,closeWithdraw:l,updateWithdrawOptions:u,setWithdrawLoading:f,isOpen:p,isLoading:d}),[a,l,u,f,p,d]),E.useEffect(()=>(Ve={openWithdraw:a,closeWithdraw:l,updateWithdrawOptions:u,setWithdrawLoading:f,isOpen:p,isLoading:d},()=>{Ve=null}),[a,l,u,f,p,d]),L.jsx(R0,{isOpen:n,isLoading:o,onClose:l,config:i.config||{symbol:"USDT"},currentActiveAccount:i.currentActiveAccount,smartWallet:i.smartWallet,chains:i.chains||fP,defaultChainId:i.defaultChainId,defaultTokenAddress:i.defaultTokenAddress,defaultAmount:i.defaultAmount,metadata:i.metadata||dP,currentEquity:i.currentEquity??5e3,platformBalance:i.platformBalance||"0",fee:i.fee,wagmiHooks:i.wagmiHooks,onWithdraw:i.onWithdraw,onChainChange:i.onChainChange,onTokenChange:i.onTokenChange,onAmountChanged:i.onAmountChanged})});N0.displayName="WithdrawManager";const M0=e=>{if(!Ve){console.error("WithdrawManager not initialized. Make sure to render <WithdrawManager /> in your app.");return}Ve.openWithdraw(e||{chains:[]})},k0=()=>{if(!Ve){console.error("WithdrawManager not initialized. Make sure to render <WithdrawManager /> in your app.");return}Ve.closeWithdraw()},L0=e=>{if(!Ve){console.error("WithdrawManager not initialized. Make sure to render <WithdrawManager /> in your app.");return}Ve.updateWithdrawOptions(e)},Ys=e=>{if(!Ve){console.error("WithdrawManager not initialized. Make sure to render <WithdrawManager /> in your app.");return}Ve.setWithdrawLoading(e)},pP=()=>Ve?Ve.isOpen():!1,B0=()=>Ve?Ve.isLoading():!1,hP=()=>({openWithdraw:M0,closeWithdraw:k0,updateWithdrawOptions:L0,setWithdrawLoading:Ys,isOpen:pP,isLoading:B0}),mP=({chains:e,defaultChainId:t,defaultTokenAddress:n,defaultAmount:r="",walletAdapter:o,metadata:s,currentEquity:i,platformBalance:c="0",fee:a="0.00",isLoading:u=!1,wagmiHooks:l,onWithdraw:f,onClose:p,onChainChange:d,onTokenChange:h,onAmountChanged:m})=>{var V;const{t:y}=Tt(),[A,g]=E.useState(()=>{var Z;return!e||e.length===0?1:t||((Z=e[0])==null?void 0:Z.chainId)||1}),[P,k]=E.useState(()=>{var G;if(!e||e.length===0)return"";const Z=t||((G=e[0])==null?void 0:G.chainId),W=e.find(X=>X.chainId===Z);if(!W||!W.tokenList||W.tokenList.length===0)return"";const K=W.tokenList.find(X=>X.tokenAddress===n)||W.tokenList[0];return(K==null?void 0:K.token)||""}),[B,F]=E.useState(r),[j,b]=E.useState(""),w=(o==null?void 0:o.getWalletType())||"evm",T=E.useCallback(Z=>{g(Z),d==null||d(Z)},[d]),N=E.useCallback(Z=>{k(Z),h==null||h(Z)},[h]),I=E.useRef(!0),$=E.useRef(P),S=E.useRef(A);E.useEffect(()=>{if(I.current){I.current=!1,$.current=P,S.current=A;return}($.current!==P||S.current!==A)&&(F(""),$.current=P,S.current=A)},[P,A]);const x=e&&e.length>0?e.find(Z=>Z.chainId===A)||e[0]:null,C=(V=x==null?void 0:x.tokenList)==null?void 0:V.find(Z=>Z.token===P),O=o==null?void 0:o.getDisplayAddress(),{multicallResult:v,queryComponents:M}=P0({account:O,chainId:A,contractAddress:void 0,tokens:(x==null?void 0:x.tokenList)||[],wagmiHooks:l}),D=E.useMemo(()=>{var W;if(!C)return;if(!C.tokenAddress||C.tokenAddress.toLowerCase()==="0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee")return v.baseTokenBalance.formatted;const Z=v.combinedData[C.tokenAddress];return((W=Z==null?void 0:Z.balance)==null?void 0:W.formatted)||"0"},[C,v]),_=E.useMemo(()=>{const Z=new ke(B||"0"),W=new ke(a||"0"),K=Mt(A);return!B||Z.isZero()||!K&&Z.isLessThan(W)?{text:y("withdraw.confirmWithdraw"),disabled:!0}:w==="mpc"&&!K&&!j.trim()?{text:y("withdraw.invalidReceiverAddress"),disabled:!0}:{text:y("withdraw.confirmWithdraw"),disabled:!1}},[y,A,B,w,j,a]),z=E.useCallback(async()=>{Ys(!0);try{if(f){const Z=new ke(B||"0"),W=new ke(a||"0"),G={amount:(Mt(A)?Z:Z.minus(W)).toString(),chainId:A,tokenAddress:(C==null?void 0:C.tokenAddress)||"",tokenSymbol:P};w==="mpc"&&!Mt(A)&&(G.receiverAddress=j),f(G)}}catch{Ys(!1)}},[f,B,a,A,C==null?void 0:C.tokenAddress,P,w,j]);return!(l!=null&&l.useBalance)||!(l!=null&&l.useReadContract)||!(l!=null&&l.useAccount)?L.jsxs("div",{className:"p-6 text-center",children:[L.jsx("p",{className:"text-red-500",children:"缺少必要的 wagmi hooks"}),L.jsx("p",{className:"text-sm text-gray-500 mt-2",children:"请确保传入了 useBalance, useReadContract, useAccount"})]}):!e||e.length===0?L.jsx("div",{className:"text-center py-8",children:L.jsx("p",{className:"text-gray-400",children:"No chains available"})}):x?L.jsxs(L.Fragment,{children:[M,L.jsx(na,{currentActiveChain:x,chainList:e,onChainChange:T,curSelectToken:P,onTokenChange:N,walletType:"evm",txType:"withdraw"}),L.jsx(lP,{withdrawAmount:B,curSelectToken:P,curSelectTokenData:{balance:C==null?void 0:C.balance,allowance:C==null?void 0:C.allowance},currentActiveChain:x,currentEquity:i||0,amount:B,decimals:(C==null?void 0:C.decimals)||6,tokenBalance:D,platformBalance:c,fee:a,walletType:w,receiverAddress:j,onWithdrawAmountChange:F,onReceiverAddressChange:b,onAmountChanged:m}),L.jsxs("button",{className:`w-full h-[38px] text-sm rounded-xl font-medium transition-colors flex items-center justify-center gap-2 ${_.disabled||u?"bg-text-disabled text-text-secondary cursor-not-allowed":"bg-fill-btn-primary text-text-on-sec-btn"}`,onClick:z,disabled:_.disabled||u,children:[u&&L.jsx(Oo,{size:"xs"}),_.text]})]}):L.jsx("div",{className:"text-center py-8",children:L.jsx("p",{className:"text-gray-400",children:"Loading..."})})},R0=({isOpen:e,isLoading:t=!1,onClose:n,config:r,currentActiveAccount:o=oa,smartWallet:s=sa,chains:i,defaultChainId:c,defaultTokenAddress:a,defaultAmount:u="",metadata:l=ia,currentEquity:f=5e3,platformBalance:p="0",fee:d,wagmiHooks:h,onWithdraw:m,onChainChange:y,onTokenChange:A,onAmountChanged:g})=>{const{t:P}=Tt(),k=E.useMemo(()=>{var B;return o?vu(o,s,!1,(B=i[0])==null?void 0:B.chainId,"0","0"):null},[o,s,i]);return e?Me.createPortal(L.jsx("div",{className:"fixed top-0 left-0 right-0 bottom-0 w-screen h-screen",style:{zIndex:49},children:L.jsx("div",{className:"fixed top-0 left-0 right-0 bottom-0 z-49 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:L.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:[L.jsxs("div",{className:"flex items-center justify-between mb-4",children:[L.jsx("h2",{className:"text-lg font-semibold text-white",children:P("withdraw.withdraw")}),L.jsx("button",{className:"text-gray-400 hover:text-gray-200 transition-colors",onClick:n,"aria-label":"Close",children:L.jsx(bu,{className:"h-4 w-4"})})]}),L.jsx(mP,{chains:i,defaultChainId:c,defaultTokenAddress:a,defaultAmount:u,walletAdapter:k,metadata:l,currentEquity:f,platformBalance:p,fee:d,isLoading:t,wagmiHooks:h,onWithdraw:m,onClose:n,onChainChange:y,onTokenChange:A,onAmountChanged:g})]})})}),document.body):null};re.ChromeLoader=Oo,re.ComponentProvider=am,re.DEFAULT_LOCALE=No,re.Deposit=I0,re.DepositManager=$0,re.LOCALE_NAMES=om,re.LoadingSpinner=Oo,re.SUPPORTED_LOCALES=Js,re.Tooltip=er,re.Withdraw=R0,re.WithdrawManager=N0,re.closeDeposit=A0,re.closeWithdraw=k0,re.formatThousands=um,re.isDepositLoading=O0,re.isWithdrawLoading=B0,re.openDeposit=T0,re.openWithdraw=M0,re.setDepositLoading=Ks,re.setWithdrawLoading=Ys,re.updateDepositOptions=C0,re.updateWithdrawOptions=L0,re.useComponentConfig=du,re.useDeposit=lm,re.useDepositManager=aP,re.useTranslation=Tt,re.useWithdraw=fm,re.useWithdrawManager=hP,Object.defineProperty(re,Symbol.toStringTag,{value:"Module"})});
162
152
  //# sourceMappingURL=index.umd.js.map