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

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 (96) hide show
  1. package/dist/{ccip-oG01dD8F.mjs → ccip-Ce2tn0VX.mjs} +2 -2
  2. package/dist/{ccip-oG01dD8F.mjs.map → ccip-Ce2tn0VX.mjs.map} +1 -1
  3. package/dist/components/Deposit/index.d.ts +0 -7
  4. package/dist/components/Deposit/index.d.ts.map +1 -1
  5. package/dist/components/Deposit/src/DepositManager.d.ts.map +1 -1
  6. package/dist/components/Deposit/src/components/evm/hooks/index.d.ts +3 -0
  7. package/dist/components/Deposit/src/components/evm/hooks/index.d.ts.map +1 -0
  8. package/dist/components/Deposit/src/components/evm/hooks/useApprove.d.ts +4 -0
  9. package/dist/components/Deposit/src/components/evm/hooks/useApprove.d.ts.map +1 -0
  10. package/dist/components/Deposit/src/components/evm/hooks/useDepositButtonState.d.ts +14 -0
  11. package/dist/components/Deposit/src/components/evm/hooks/useDepositButtonState.d.ts.map +1 -0
  12. package/dist/components/Deposit/src/components/evm/index.d.ts +6 -0
  13. package/dist/components/Deposit/src/components/evm/index.d.ts.map +1 -0
  14. package/dist/components/Deposit/src/components/evm/types/approve.d.ts +15 -0
  15. package/dist/components/Deposit/src/components/evm/types/approve.d.ts.map +1 -0
  16. package/dist/components/Deposit/src/components/evm/types/index.d.ts +15 -0
  17. package/dist/components/Deposit/src/components/evm/types/index.d.ts.map +1 -0
  18. package/dist/components/Deposit/src/components/evm/utils/format.d.ts +12 -0
  19. package/dist/components/Deposit/src/components/evm/utils/format.d.ts.map +1 -0
  20. package/dist/components/Deposit/src/components/evm/utils/index.d.ts +8 -0
  21. package/dist/components/Deposit/src/components/evm/utils/index.d.ts.map +1 -0
  22. package/dist/components/Deposit/src/components/mpc/index.d.ts +6 -0
  23. package/dist/components/Deposit/src/components/mpc/index.d.ts.map +1 -0
  24. package/dist/components/Deposit/src/components/mpc/types/index.d.ts +16 -0
  25. package/dist/components/Deposit/src/components/mpc/types/index.d.ts.map +1 -0
  26. package/dist/components/Deposit/src/constants/index.d.ts +4 -0
  27. package/dist/components/Deposit/src/constants/index.d.ts.map +1 -0
  28. package/dist/components/Deposit/src/hooks/useMulticallBalance.d.ts +2 -3
  29. package/dist/components/Deposit/src/hooks/useMulticallBalance.d.ts.map +1 -1
  30. package/dist/components/Deposit/src/index.d.ts +2 -2
  31. package/dist/components/Deposit/src/index.d.ts.map +1 -1
  32. package/dist/components/Deposit/src/utils.d.ts +0 -40
  33. package/dist/components/Deposit/src/utils.d.ts.map +1 -1
  34. package/dist/components/Deposit/types/index.d.ts +10 -38
  35. package/dist/components/Deposit/types/index.d.ts.map +1 -1
  36. package/dist/components/Withdraw/src/WithdrawManager.d.ts.map +1 -1
  37. package/dist/components/Withdraw/src/evm/index.d.ts +2 -1
  38. package/dist/components/Withdraw/src/evm/index.d.ts.map +1 -1
  39. package/dist/components/Withdraw/src/index.d.ts.map +1 -1
  40. package/dist/components/Withdraw/types/index.d.ts +3 -12
  41. package/dist/components/Withdraw/types/index.d.ts.map +1 -1
  42. package/dist/components/shared/components/SpeedLevel/ActiveSpeed.d.ts +5 -0
  43. package/dist/components/shared/components/SpeedLevel/ActiveSpeed.d.ts.map +1 -0
  44. package/dist/components/shared/components/SpeedLevel/InactiveSpeed.d.ts +5 -0
  45. package/dist/components/shared/components/SpeedLevel/InactiveSpeed.d.ts.map +1 -0
  46. package/dist/components/shared/components/SpeedLevel/index.d.ts +6 -0
  47. package/dist/components/shared/components/SpeedLevel/index.d.ts.map +1 -0
  48. package/dist/components/shared/components/SpeedLevel/types/index.d.ts +6 -0
  49. package/dist/components/shared/components/SpeedLevel/types/index.d.ts.map +1 -0
  50. package/dist/components/shared/components/selector/AssetTabs.d.ts +5 -0
  51. package/dist/components/shared/components/selector/AssetTabs.d.ts.map +1 -0
  52. package/dist/components/shared/components/selector/Chain.d.ts +5 -0
  53. package/dist/components/shared/components/selector/Chain.d.ts.map +1 -0
  54. package/dist/components/shared/components/selector/index.d.ts +5 -0
  55. package/dist/components/shared/components/selector/index.d.ts.map +1 -0
  56. package/dist/components/shared/components/selector/types/index.d.ts +36 -0
  57. package/dist/components/shared/components/selector/types/index.d.ts.map +1 -0
  58. package/dist/components/shared/constants/index.d.ts +3 -0
  59. package/dist/components/shared/constants/index.d.ts.map +1 -0
  60. package/dist/components/shared/hooks/index.d.ts +1 -0
  61. package/dist/components/shared/hooks/index.d.ts.map +1 -0
  62. package/dist/components/shared/types/index.d.ts +10 -0
  63. package/dist/components/shared/types/index.d.ts.map +1 -0
  64. package/dist/components/shared/utils/index.d.ts +23 -0
  65. package/dist/components/shared/utils/index.d.ts.map +1 -0
  66. package/dist/{index-zCcWmHkS.mjs → index-EY9qKvQ0.mjs} +6532 -6760
  67. package/dist/index-EY9qKvQ0.mjs.map +1 -0
  68. package/dist/index.esm.js +1 -1
  69. package/dist/index.umd.js +69 -69
  70. package/dist/index.umd.js.map +1 -1
  71. package/dist/types/index.d.ts +7 -0
  72. package/dist/types/index.d.ts.map +1 -1
  73. package/package.json +4 -2
  74. package/dist/components/Deposit/src/WalletProvider.d.ts +0 -23
  75. package/dist/components/Deposit/src/WalletProvider.d.ts.map +0 -1
  76. package/dist/components/Deposit/src/evm/WalletView.d.ts +0 -18
  77. package/dist/components/Deposit/src/evm/WalletView.d.ts.map +0 -1
  78. package/dist/components/Deposit/src/evm/index.d.ts +0 -38
  79. package/dist/components/Deposit/src/evm/index.d.ts.map +0 -1
  80. package/dist/components/Deposit/src/mpc/WalletView.d.ts +0 -13
  81. package/dist/components/Deposit/src/mpc/WalletView.d.ts.map +0 -1
  82. package/dist/components/Deposit/src/mpc/index.d.ts +0 -23
  83. package/dist/components/Deposit/src/mpc/index.d.ts.map +0 -1
  84. package/dist/components/Deposit/src/selector/Asset.d.ts +0 -19
  85. package/dist/components/Deposit/src/selector/Asset.d.ts.map +0 -1
  86. package/dist/components/Deposit/src/selector/AssetTabs.d.ts +0 -17
  87. package/dist/components/Deposit/src/selector/AssetTabs.d.ts.map +0 -1
  88. package/dist/components/Deposit/src/selector/Chain.d.ts +0 -16
  89. package/dist/components/Deposit/src/selector/Chain.d.ts.map +0 -1
  90. package/dist/components/Deposit/src/selector/index.d.ts +0 -15
  91. package/dist/components/Deposit/src/selector/index.d.ts.map +0 -1
  92. package/dist/components/Deposit/src/walletAdapters.d.ts +0 -67
  93. package/dist/components/Deposit/src/walletAdapters.d.ts.map +0 -1
  94. package/dist/components/Deposit/types/wallet-hooks.d.ts +0 -78
  95. package/dist/components/Deposit/types/wallet-hooks.d.ts.map +0 -1
  96. package/dist/index-zCcWmHkS.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 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={};/**
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,Ne){"use strict";var j$=Object.defineProperty;var _$=(re,E,Ne)=>E in re?j$(re,E,{enumerable:!0,configurable:!0,writable:!0,value:Ne}):re[E]=Ne;var Io=(re,E,Ne)=>_$(re,typeof E!="symbol"?E+"":E,Ne);function ou(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=ou(E),Pr=ou(Ne);function X0(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Js={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 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={};/**
9
+ */var su;function Q0(){if(su)return Ar;su=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={},d=null,p=null;u!==void 0&&(d=""+u),a.key!==void 0&&(d=""+a.key),a.ref!==void 0&&(p=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:d,ref:p,props:f,_owner:o.current}}return Ar.Fragment=n,Ar.jsx=i,Ar.jsxs=i,Ar}var Tr={};/**
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 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
- `+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
- `),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`
17
+ */var iu;function J0(){return iu||(iu=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"),d=Symbol.for("react.lazy"),p=Symbol.for("react.offscreen"),h=Symbol.iterator,m="@@iterator";function v(L){if(L===null||typeof L!="object")return null;var G=h&&L[h]||L[m];return typeof G=="function"?G:null}var O=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function b(L){{for(var G=arguments.length,Y=new Array(G>1?G-1:0),ee=1;ee<G;ee++)Y[ee-1]=arguments[ee];A("error",L,Y)}}function A(L,G,Y){{var ee=O.ReactDebugCurrentFrame,le=ee.getStackAddendum();le!==""&&(G+="%s",Y=Y.concat([le]));var de=Y.map(function(ae){return String(ae)});de.unshift("Warning: "+G),Function.prototype.apply.call(console[L],console,de)}}var k=!1,R=!1,D=!1,j=!1,g=!1,w;w=Symbol.for("react.module.reference");function P(L){return!!(typeof L=="string"||typeof L=="function"||L===r||L===s||g||L===o||L===u||L===l||j||L===p||k||R||D||typeof L=="object"&&L!==null&&(L.$$typeof===d||L.$$typeof===f||L.$$typeof===i||L.$$typeof===c||L.$$typeof===a||L.$$typeof===w||L.getModuleId!==void 0))}function N(L,G,Y){var ee=L.displayName;if(ee)return ee;var le=G.displayName||G.name||"";return le!==""?Y+"("+le+")":Y}function I(L){return L.displayName||"Context"}function $(L){if(L==null)return null;if(typeof L.tag=="number"&&b("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),typeof L=="function")return L.displayName||L.name||null;if(typeof L=="string")return L;switch(L){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 L=="object")switch(L.$$typeof){case c:var G=L;return I(G)+".Consumer";case i:var Y=L;return I(Y._context)+".Provider";case a:return N(L,L.render,"ForwardRef");case f:var ee=L.displayName||null;return ee!==null?ee:$(L.type)||"Memo";case d:{var le=L,de=le._payload,ae=le._init;try{return $(ae(de))}catch{return null}}}return null}var S=Object.assign,x=0,T,C,y,M,F,_,z;function H(){}H.__reactDisabledLog=!0;function K(){{if(x===0){T=console.log,C=console.info,y=console.warn,M=console.error,F=console.group,_=console.groupCollapsed,z=console.groupEnd;var L={configurable:!0,enumerable:!0,value:H,writable:!0};Object.defineProperties(console,{info:L,log:L,warn:L,error:L,group:L,groupCollapsed:L,groupEnd:L})}x++}}function W(){{if(x--,x===0){var L={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:S({},L,{value:T}),info:S({},L,{value:C}),warn:S({},L,{value:y}),error:S({},L,{value:M}),group:S({},L,{value:F}),groupCollapsed:S({},L,{value:_}),groupEnd:S({},L,{value:z})})}x<0&&b("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var Z=O.ReactCurrentDispatcher,q;function Q(L,G,Y){{if(q===void 0)try{throw Error()}catch(le){var ee=le.stack.trim().match(/\n( *(at )?)/);q=ee&&ee[1]||""}return`
18
+ `+q+L}}var te=!1,ue;{var Se=typeof WeakMap=="function"?WeakMap:Map;ue=new Se}function Ke(L,G){if(!L||te)return"";{var Y=ue.get(L);if(Y!==void 0)return Y}var ee;te=!0;var le=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var de;de=Z.current,Z.current=null,K();try{if(G){var ae=function(){throw Error()};if(Object.defineProperty(ae.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(ae,[])}catch(Ve){ee=Ve}Reflect.construct(L,[],ae)}else{try{ae.call()}catch(Ve){ee=Ve}L.call(ae.prototype)}}else{try{throw Error()}catch(Ve){ee=Ve}L()}}catch(Ve){if(Ve&&ee&&typeof Ve.stack=="string"){for(var se=Ve.stack.split(`
19
+ `),Re=ee.stack.split(`
20
+ `),ve=se.length-1,we=Re.length-1;ve>=1&&we>=0&&se[ve]!==Re[we];)we--;for(;ve>=1&&we>=0;ve--,we--)if(se[ve]!==Re[we]){if(ve!==1||we!==1)do if(ve--,we--,we<0||se[ve]!==Re[we]){var ut=`
21
+ `+se[ve].replace(" at new "," at ");return L.displayName&&ut.includes("<anonymous>")&&(ut=ut.replace("<anonymous>",L.displayName)),typeof L=="function"&&ue.set(L,ut),ut}while(ve>=1&&we>=0);break}}}finally{te=!1,Z.current=de,W(),Error.prepareStackTrace=le}var $r=L?L.displayName||L.name:"",Hn=$r?Q($r):"";return typeof L=="function"&&ue.set(L,Hn),Hn}function $e(L,G,Y){return Ke(L,!1)}function Pe(L){var G=L.prototype;return!!(G&&G.isReactComponent)}function fe(L,G,Y){if(L==null)return"";if(typeof L=="function")return Ke(L,Pe(L));if(typeof L=="string")return Q(L);switch(L){case u:return Q("Suspense");case l:return Q("SuspenseList")}if(typeof L=="object")switch(L.$$typeof){case a:return $e(L.render);case f:return fe(L.type,G,Y);case d:{var ee=L,le=ee._payload,de=ee._init;try{return fe(de(le),G,Y)}catch{}}}return""}var Co=Object.prototype.hasOwnProperty,R0={},F0=O.ReactDebugCurrentFrame;function Qs(L){if(L){var G=L._owner,Y=fe(L.type,L._source,G?G.type:null);F0.setExtraStackFrame(Y)}else F0.setExtraStackFrame(null)}function b$(L,G,Y,ee,le){{var de=Function.call.bind(Co);for(var ae in L)if(de(L,ae)){var se=void 0;try{if(typeof L[ae]!="function"){var Re=Error((ee||"React class")+": "+Y+" type `"+ae+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof L[ae]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw Re.name="Invariant Violation",Re}se=L[ae](G,ae,ee,Y,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(ve){se=ve}se&&!(se instanceof Error)&&(Qs(le),b("%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).",ee||"React class",Y,ae,typeof se),Qs(null)),se instanceof Error&&!(se.message in R0)&&(R0[se.message]=!0,Qs(le),b("Failed %s type: %s",Y,se.message),Qs(null))}}}var y$=Array.isArray;function Xc(L){return y$(L)}function v$(L){{var G=typeof Symbol=="function"&&Symbol.toStringTag,Y=G&&L[Symbol.toStringTag]||L.constructor.name||"Object";return Y}}function w$(L){try{return D0(L),!1}catch{return!0}}function D0(L){return""+L}function j0(L){if(w$(L))return b("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",v$(L)),D0(L)}var _0=O.ReactCurrentOwner,x$={key:!0,ref:!0,__self:!0,__source:!0},U0,z0;function E$(L){if(Co.call(L,"ref")){var G=Object.getOwnPropertyDescriptor(L,"ref").get;if(G&&G.isReactWarning)return!1}return L.ref!==void 0}function S$(L){if(Co.call(L,"key")){var G=Object.getOwnPropertyDescriptor(L,"key").get;if(G&&G.isReactWarning)return!1}return L.key!==void 0}function $$(L,G){typeof L.ref=="string"&&_0.current}function P$(L,G){{var Y=function(){U0||(U0=!0,b("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",G))};Y.isReactWarning=!0,Object.defineProperty(L,"key",{get:Y,configurable:!0})}}function A$(L,G){{var Y=function(){z0||(z0=!0,b("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",G))};Y.isReactWarning=!0,Object.defineProperty(L,"ref",{get:Y,configurable:!0})}}var T$=function(L,G,Y,ee,le,de,ae){var se={$$typeof:t,type:L,key:G,ref:Y,props:ae,_owner:de};return se._store={},Object.defineProperty(se._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(se,"_self",{configurable:!1,enumerable:!1,writable:!1,value:ee}),Object.defineProperty(se,"_source",{configurable:!1,enumerable:!1,writable:!1,value:le}),Object.freeze&&(Object.freeze(se.props),Object.freeze(se)),se};function O$(L,G,Y,ee,le){{var de,ae={},se=null,Re=null;Y!==void 0&&(j0(Y),se=""+Y),S$(G)&&(j0(G.key),se=""+G.key),E$(G)&&(Re=G.ref,$$(G,le));for(de in G)Co.call(G,de)&&!x$.hasOwnProperty(de)&&(ae[de]=G[de]);if(L&&L.defaultProps){var ve=L.defaultProps;for(de in ve)ae[de]===void 0&&(ae[de]=ve[de])}if(se||Re){var we=typeof L=="function"?L.displayName||L.name||"Unknown":L;se&&P$(ae,we),Re&&A$(ae,we)}return T$(L,se,Re,le,ee,_0.current,ae)}}var Qc=O.ReactCurrentOwner,H0=O.ReactDebugCurrentFrame;function Sr(L){if(L){var G=L._owner,Y=fe(L.type,L._source,G?G.type:null);H0.setExtraStackFrame(Y)}else H0.setExtraStackFrame(null)}var Jc;Jc=!1;function eu(L){return typeof L=="object"&&L!==null&&L.$$typeof===t}function W0(){{if(Qc.current){var L=$(Qc.current.type);if(L)return`
22
22
 
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=`
23
+ Check the render method of \``+L+"`."}return""}}function C$(L){return""}var V0={};function I$(L){{var G=W0();if(!G){var Y=typeof L=="string"?L:L.displayName||L.name;Y&&(G=`
24
24
 
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:
25
+ Check the top-level render call using <`+Y+">.")}return G}}function G0(L,G){{if(!L._store||L._store.validated||L.key!=null)return;L._store.validated=!0;var Y=I$(G);if(V0[Y])return;V0[Y]=!0;var ee="";L&&L._owner&&L._owner!==Qc.current&&(ee=" It was passed a child from "+$(L._owner.type)+"."),Sr(L),b('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',Y,ee),Sr(null)}}function q0(L,G){{if(typeof L!="object")return;if(Xc(L))for(var Y=0;Y<L.length;Y++){var ee=L[Y];eu(ee)&&G0(ee,G)}else if(eu(L))L._store&&(L._store.validated=!0);else if(L){var le=v(L);if(typeof le=="function"&&le!==L.entries)for(var de=le.call(L),ae;!(ae=de.next()).done;)eu(ae.value)&&G0(ae.value,G)}}}function N$(L){{var G=L.type;if(G==null||typeof G=="string")return;var Y;if(typeof G=="function")Y=G.propTypes;else if(typeof G=="object"&&(G.$$typeof===a||G.$$typeof===f))Y=G.propTypes;else return;if(Y){var ee=$(G);b$(Y,L.props,"prop",ee,L)}else if(G.PropTypes!==void 0&&!Jc){Jc=!0;var le=$(G);b("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",le||"Unknown")}typeof G.getDefaultProps=="function"&&!G.getDefaultProps.isReactClassApproved&&b("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function M$(L){{for(var G=Object.keys(L.props),Y=0;Y<G.length;Y++){var ee=G[Y];if(ee!=="children"&&ee!=="key"){Sr(L),b("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",ee),Sr(null);break}}L.ref!==null&&(Sr(L),b("Invalid attribute `ref` supplied to `React.Fragment`."),Sr(null))}}var Z0={};function K0(L,G,Y,ee,le,de){{var ae=P(L);if(!ae){var se="";(L===void 0||typeof L=="object"&&L!==null&&Object.keys(L).length===0)&&(se+=" 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 Re=C$();Re?se+=Re:se+=W0();var ve;L===null?ve="null":Xc(L)?ve="array":L!==void 0&&L.$$typeof===t?(ve="<"+($(L.type)||"Unknown")+" />",se=" Did you accidentally export a JSX literal instead of a component?"):ve=typeof L,b("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",ve,se)}var we=O$(L,G,Y,le,de);if(we==null)return we;if(ae){var ut=G.children;if(ut!==void 0)if(ee)if(Xc(ut)){for(var $r=0;$r<ut.length;$r++)q0(ut[$r],L);Object.freeze&&Object.freeze(ut)}else b("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 q0(ut,L)}if(Co.call(G,"key")){var Hn=$(L),Ve=Object.keys(G).filter(function(D$){return D$!=="key"}),tu=Ve.length>0?"{key: someKey, "+Ve.join(": ..., ")+": ...}":"{key: someKey}";if(!Z0[Hn+tu]){var F$=Ve.length>0?"{"+Ve.join(": ..., ")+": ...}":"{}";b(`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,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=>{},[])});/**
30
+ <%s key={someKey} {...props} />`,tu,Hn,F$,Hn),Z0[Hn+tu]=!0}}return L===r?M$(we):N$(we),we}}function k$(L,G,Y){return K0(L,G,Y,!0)}function B$(L,G,Y){return K0(L,G,Y,!1)}var L$=B$,R$=k$;Tr.Fragment=r,Tr.jsx=L$,Tr.jsxs=R$}()),Tr}process.env.NODE_ENV==="production"?Js.exports=Q0():Js.exports=J0();var B=Js.exports;const em={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:"接收地址不合法"}},tm={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"}},nm={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:"無効な受け取りアドレス"}},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}}).
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:"Неверный адрес получателя"}},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}}) 資產到此位址。
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:"接收地址不合法"}},ei=["en-US","ja-JP","ru-RU","zh-CN","zh-TW"],au={"en-US":tm,"ja-JP":nm,"ru-RU":rm,"zh-CN":em,"zh-TW":om},No="en-US",sm={"en-US":"English","zh-CN":"简体中文","zh-TW":"繁體中文","ja-JP":"日本語","ru-RU":"Русский"},im=e=>ei.includes(e)?au[e]:au[No],am=e=>ei.includes(e),cu=E.createContext(null),cm=({config:e,children:t})=>{const n=E.useMemo(()=>{const r=e.locale||No,o=am(r)?r:No,s=im(o);return{...e,currentLocale:o,translations:s}},[e]);return B.jsx(cu.Provider,{value:n,children:t})},uu=()=>{const e=E.useContext(cu);if(!e)throw new Error("useComponentConfig must be used within ComponentProvider");return e};var um=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,ti=Math.ceil,Ye=Math.floor,Fe="[BigNumber Error] ",lu=Fe+"Number primitive has more than 15 significant digits: ",lt=1e14,ne=14,ni=9007199254740991,ri=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],an=1e7,Ae=1e9;function fu(e){var t,n,r,o=b.prototype={constructor:b,toString:null,valueOf:null},s=new b(1),i=20,c=4,a=-7,u=21,l=-1e7,f=1e7,d=!1,p=1,h=0,m={prefix:"",groupSize:3,secondaryGroupSize:0,groupSeparator:",",decimalSeparator:".",fractionGroupSize:0,fractionGroupSeparator:" ",suffix:""},v="0123456789abcdefghijklmnopqrstuvwxyz",O=!0;function b(g,w){var P,N,I,$,S,x,T,C,y=this;if(!(y instanceof b))return new b(g,w);if(w==null){if(g&&g._isBigNumber===!0){y.s=g.s,!g.c||g.e>f?y.c=y.e=null:g.e<l?y.c=[y.e=0]:(y.e=g.e,y.c=g.c.slice());return}if((x=typeof g=="number")&&g*0==0){if(y.s=1/g<0?(g=-g,-1):1,g===~~g){for($=0,S=g;S>=10;S/=10,$++);$>f?y.c=y.e=null:(y.e=$,y.c=[g]);return}C=String(g)}else{if(!um.test(C=String(g)))return r(y,C,x);y.s=C.charCodeAt(0)==45?(C=C.slice(1),-1):1}($=C.indexOf("."))>-1&&(C=C.replace(".","")),(S=C.search(/e/i))>0?($<0&&($=S),$+=+C.slice(S+1),C=C.substring(0,S)):$<0&&($=C.length)}else{if(me(w,2,v.length,"Base"),w==10&&O)return y=new b(g),D(y,i+y.e+1,c);if(C=String(g),x=typeof g=="number"){if(g*0!=0)return r(y,C,x,w);if(y.s=1/g<0?(C=C.slice(1),-1):1,b.DEBUG&&C.replace(/^0\.0*|\./,"").length>15)throw Error(lu+g)}else y.s=C.charCodeAt(0)===45?(C=C.slice(1),-1):1;for(P=v.slice(0,w),$=S=0,T=C.length;S<T;S++)if(P.indexOf(N=C.charAt(S))<0){if(N=="."){if(S>$){$=T;continue}}else if(!I&&(C==C.toUpperCase()&&(C=C.toLowerCase())||C==C.toLowerCase()&&(C=C.toUpperCase()))){I=!0,S=-1,$=0;continue}return r(y,String(g),x,w)}x=!1,C=n(C,w,10,y.s),($=C.indexOf("."))>-1?C=C.replace(".",""):$=C.length}for(S=0;C.charCodeAt(S)===48;S++);for(T=C.length;C.charCodeAt(--T)===48;);if(C=C.slice(S,++T)){if(T-=S,x&&b.DEBUG&&T>15&&(g>ni||g!==Ye(g)))throw Error(lu+y.s*g);if(($=$-S-1)>f)y.c=y.e=null;else if($<l)y.c=[y.e=0];else{if(y.e=$,y.c=[],S=($+1)%ne,$<0&&(S+=ne),S<T){for(S&&y.c.push(+C.slice(0,S)),T-=ne;S<T;)y.c.push(+C.slice(S,S+=ne));S=ne-(C=C.slice(S)).length}else S-=T;for(;S--;C+="0");y.c.push(+C)}}else y.c=[y.e=0]}b.clone=fu,b.ROUND_UP=0,b.ROUND_DOWN=1,b.ROUND_CEIL=2,b.ROUND_FLOOR=3,b.ROUND_HALF_UP=4,b.ROUND_HALF_DOWN=5,b.ROUND_HALF_EVEN=6,b.ROUND_HALF_CEIL=7,b.ROUND_HALF_FLOOR=8,b.EUCLID=9,b.config=b.set=function(g){var w,P;if(g!=null)if(typeof g=="object"){if(g.hasOwnProperty(w="DECIMAL_PLACES")&&(P=g[w],me(P,0,Ae,w),i=P),g.hasOwnProperty(w="ROUNDING_MODE")&&(P=g[w],me(P,0,8,w),c=P),g.hasOwnProperty(w="EXPONENTIAL_AT")&&(P=g[w],P&&P.pop?(me(P[0],-Ae,0,w),me(P[1],0,Ae,w),a=P[0],u=P[1]):(me(P,-Ae,Ae,w),a=-(u=P<0?-P:P))),g.hasOwnProperty(w="RANGE"))if(P=g[w],P&&P.pop)me(P[0],-Ae,-1,w),me(P[1],1,Ae,w),l=P[0],f=P[1];else if(me(P,-Ae,Ae,w),P)l=-(f=P<0?-P:P);else throw Error(Fe+w+" cannot be zero: "+P);if(g.hasOwnProperty(w="CRYPTO"))if(P=g[w],P===!!P)if(P)if(typeof crypto<"u"&&crypto&&(crypto.getRandomValues||crypto.randomBytes))d=P;else throw d=!P,Error(Fe+"crypto unavailable");else d=P;else throw Error(Fe+w+" not true or false: "+P);if(g.hasOwnProperty(w="MODULO_MODE")&&(P=g[w],me(P,0,9,w),p=P),g.hasOwnProperty(w="POW_PRECISION")&&(P=g[w],me(P,0,Ae,w),h=P),g.hasOwnProperty(w="FORMAT"))if(P=g[w],typeof P=="object")m=P;else throw Error(Fe+w+" not an object: "+P);if(g.hasOwnProperty(w="ALPHABET"))if(P=g[w],typeof P=="string"&&!/^.?$|[+\-.\s]|(.).*\1/.test(P))O=P.slice(0,10)=="0123456789",v=P;else throw Error(Fe+w+" invalid: "+P)}else throw Error(Fe+"Object expected: "+g);return{DECIMAL_PLACES:i,ROUNDING_MODE:c,EXPONENTIAL_AT:[a,u],RANGE:[l,f],CRYPTO:d,MODULO_MODE:p,POW_PRECISION:h,FORMAT:m,ALPHABET:v}},b.isBigNumber=function(g){if(!g||g._isBigNumber!==!0)return!1;if(!b.DEBUG)return!0;var w,P,N=g.c,I=g.e,$=g.s;e:if({}.toString.call(N)=="[object Array]"){if(($===1||$===-1)&&I>=-Ae&&I<=Ae&&I===Ye(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(P=N[w],P<0||P>=lt||P!==Ye(P))break e;if(P!==0)return!0}}}else if(N===null&&I===null&&($===null||$===1||$===-1))return!0;throw Error(Fe+"Invalid BigNumber: "+g)},b.maximum=b.max=function(){return k(arguments,-1)},b.minimum=b.min=function(){return k(arguments,1)},b.random=function(){var g=9007199254740992,w=Math.random()*g&2097151?function(){return Ye(Math.random()*g)}:function(){return(Math.random()*1073741824|0)*8388608+(Math.random()*8388608|0)};return function(P){var N,I,$,S,x,T=0,C=[],y=new b(s);if(P==null?P=i:me(P,0,Ae),S=ti(P/ne),d)if(crypto.getRandomValues){for(N=crypto.getRandomValues(new Uint32Array(S*=2));T<S;)x=N[T]*131072+(N[T+1]>>>11),x>=9e15?(I=crypto.getRandomValues(new Uint32Array(2)),N[T]=I[0],N[T+1]=I[1]):(C.push(x%1e14),T+=2);T=S/2}else if(crypto.randomBytes){for(N=crypto.randomBytes(S*=7);T<S;)x=(N[T]&31)*281474976710656+N[T+1]*1099511627776+N[T+2]*4294967296+N[T+3]*16777216+(N[T+4]<<16)+(N[T+5]<<8)+N[T+6],x>=9e15?crypto.randomBytes(7).copy(N,T):(C.push(x%1e14),T+=7);T=S/7}else throw d=!1,Error(Fe+"crypto unavailable");if(!d)for(;T<S;)x=w(),x<9e15&&(C[T++]=x%1e14);for(S=C[--T],P%=ne,S&&P&&(x=ri[ne-P],C[T]=Ye(S/x)*x);C[T]===0;C.pop(),T--);if(T<0)C=[$=0];else{for($=-1;C[0]===0;C.splice(0,1),$-=ne);for(T=1,x=C[0];x>=10;x/=10,T++);T<ne&&($-=ne-T)}return y.e=$,y.c=C,y}}(),b.sum=function(){for(var g=1,w=arguments,P=new b(w[0]);g<w.length;)P=P.plus(w[g++]);return P},n=function(){var g="0123456789";function w(P,N,I,$){for(var S,x=[0],T,C=0,y=P.length;C<y;){for(T=x.length;T--;x[T]*=N);for(x[0]+=$.indexOf(P.charAt(C++)),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(P,N,I,$,S){var x,T,C,y,M,F,_,z,H=P.indexOf("."),K=i,W=c;for(H>=0&&(y=h,h=0,P=P.replace(".",""),z=new b(N),F=z.pow(P.length-H),h=y,z.c=w(jt(Qe(F.c),F.e,"0"),10,I,g),z.e=z.c.length),_=w(P,N,I,S?(x=v,g):(x=g,v)),C=y=_.length;_[--y]==0;_.pop());if(!_[0])return x.charAt(0);if(H<0?--C:(F.c=_,F.e=C,F.s=$,F=t(F,z,K,W,I),_=F.c,M=F.r,C=F.e),T=C+K+1,H=_[T],y=I/2,M=M||T<0||_[T+1]!=null,M=W<4?(H!=null||M)&&(W==0||W==(F.s<0?3:2)):H>y||H==y&&(W==4||M||W==6&&_[T-1]&1||W==(F.s<0?8:7)),T<1||!_[0])P=M?jt(x.charAt(1),-K,x.charAt(0)):x.charAt(0);else{if(_.length=T,M)for(--I;++_[--T]>I;)_[T]=0,T||(++C,_=[1].concat(_));for(y=_.length;!_[--y];);for(H=0,P="";H<=y;P+=x.charAt(_[H++]));P=jt(P,C,x.charAt(0))}return P}}(),t=function(){function g(N,I,$){var S,x,T,C,y=0,M=N.length,F=I%an,_=I/an|0;for(N=N.slice();M--;)T=N[M]%an,C=N[M]/an|0,S=_*T+C*F,x=F*T+S%an*an+y,y=(x/$|0)+(S/an|0)+_*C,N[M]=x%$;return y&&(N=[y].concat(N)),N}function w(N,I,$,S){var x,T;if($!=S)T=$>S?1:-1;else for(x=T=0;x<$;x++)if(N[x]!=I[x]){T=N[x]>I[x]?1:-1;break}return T}function P(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 T,C,y,M,F,_,z,H,K,W,Z,q,Q,te,ue,Se,Ke,$e=N.s==I.s?1:-1,Pe=N.c,fe=I.c;if(!Pe||!Pe[0]||!fe||!fe[0])return new b(!N.s||!I.s||(Pe?fe&&Pe[0]==fe[0]:!fe)?NaN:Pe&&Pe[0]==0||!fe?$e*0:$e/0);for(H=new b($e),K=H.c=[],C=N.e-I.e,$e=$+C+1,x||(x=lt,C=Xe(N.e/ne)-Xe(I.e/ne),$e=$e/ne|0),y=0;fe[y]==(Pe[y]||0);y++);if(fe[y]>(Pe[y]||0)&&C--,$e<0)K.push(1),M=!0;else{for(te=Pe.length,Se=fe.length,y=0,$e+=2,F=Ye(x/(fe[0]+1)),F>1&&(fe=g(fe,F,x),Pe=g(Pe,F,x),Se=fe.length,te=Pe.length),Q=Se,W=Pe.slice(0,Se),Z=W.length;Z<Se;W[Z++]=0);Ke=fe.slice(),Ke=[0].concat(Ke),ue=fe[0],fe[1]>=x/2&&ue++;do{if(F=0,T=w(fe,W,Se,Z),T<0){if(q=W[0],Se!=Z&&(q=q*x+(W[1]||0)),F=Ye(q/ue),F>1)for(F>=x&&(F=x-1),_=g(fe,F,x),z=_.length,Z=W.length;w(_,W,z,Z)==1;)F--,P(_,Se<z?Ke:fe,z,x),z=_.length,T=1;else F==0&&(T=F=1),_=fe.slice(),z=_.length;if(z<Z&&(_=[0].concat(_)),P(W,_,Z,x),Z=W.length,T==-1)for(;w(fe,W,Se,Z)<1;)F++,P(W,Se<Z?Ke:fe,Z,x),Z=W.length}else T===0&&(F++,W=[0]);K[y++]=F,W[0]?W[Z++]=Pe[Q]||0:(W=[Pe[Q]],Z=1)}while((Q++<te||W[0]!=null)&&$e--);M=W[0]!=null,K[0]||K.splice(0,1)}if(x==lt){for(y=1,$e=K[0];$e>=10;$e/=10,y++);D(H,$+(H.e=y+C*ne-1)+1,S,M)}else H.e=C,H.r=+M;return H}}();function A(g,w,P,N){var I,$,S,x,T;if(P==null?P=c:me(P,0,8),!g.c)return g.toString();if(I=g.c[0],S=g.e,w==null)T=Qe(g.c),T=N==1||N==2&&(S<=a||S>=u)?ko(T,S):jt(T,S,"0");else if(g=D(new b(g),w,P),$=g.e,T=Qe(g.c),x=T.length,N==1||N==2&&(w<=$||$<=a)){for(;x<w;T+="0",x++);T=ko(T,$)}else if(w-=S+(N===2&&$>S),T=jt(T,$,"0"),$+1>x){if(--w>0)for(T+=".";w--;T+="0");}else if(w+=$-x,w>0)for($+1==x&&(T+=".");w--;T+="0");return g.s<0&&I?"-"+T:T}function k(g,w){for(var P,N,I=1,$=new b(g[0]);I<g.length;I++)N=new b(g[I]),(!N.s||(P=vn($,N))===w||P===0&&$.s===w)&&($=N);return $}function R(g,w,P){for(var N=1,I=w.length;!w[--I];w.pop());for(I=w[0];I>=10;I/=10,N++);return(P=N+P*ne-1)>f?g.c=g.e=null:P<l?g.c=[g.e=0]:(g.e=P,g.c=w),g}r=function(){var g=/^(-?)0([xbo])(?=\w[\w.]*$)/i,w=/^([^.]+)\.$/,P=/^\.([^.]+)$/,N=/^-?(Infinity|NaN)$/,I=/^\s*\+(?=[\w.])|^\s+|\s+$/g;return function($,S,x,T){var C,y=x?S:S.replace(I,"");if(N.test(y))$.s=isNaN(y)?null:y<0?-1:1;else{if(!x&&(y=y.replace(g,function(M,F,_){return C=(_=_.toLowerCase())=="x"?16:_=="b"?2:8,!T||T==C?F:M}),T&&(C=T,y=y.replace(w,"$1").replace(P,"0.$1")),S!=y))return new b(y,C);if(b.DEBUG)throw Error(Fe+"Not a"+(T?" base "+T:"")+" number: "+S);$.s=null}$.c=$.e=null}}();function D(g,w,P,N){var I,$,S,x,T,C,y,M=g.c,F=ri;if(M){e:{for(I=1,x=M[0];x>=10;x/=10,I++);if($=w-I,$<0)$+=ne,S=w,T=M[C=0],y=Ye(T/F[I-S-1]%10);else if(C=ti(($+1)/ne),C>=M.length)if(N){for(;M.length<=C;M.push(0));T=y=0,I=1,$%=ne,S=$-ne+1}else break e;else{for(T=x=M[C],I=1;x>=10;x/=10,I++);$%=ne,S=$-ne+I,y=S<0?0:Ye(T/F[I-S-1]%10)}if(N=N||w<0||M[C+1]!=null||(S<0?T:T%F[I-S-1]),N=P<4?(y||N)&&(P==0||P==(g.s<0?3:2)):y>5||y==5&&(P==4||N||P==6&&($>0?S>0?T/F[I-S]:0:M[C-1])%10&1||P==(g.s<0?8:7)),w<1||!M[0])return M.length=0,N?(w-=g.e+1,M[0]=F[(ne-w%ne)%ne],g.e=-w||0):M[0]=g.e=0,g;if($==0?(M.length=C,x=1,C--):(M.length=C+1,x=F[ne-$],M[C]=S>0?Ye(T/F[I-S]%F[S])*x:0),N)for(;;)if(C==0){for($=1,S=M[0];S>=10;S/=10,$++);for(S=M[0]+=x,x=1;S>=10;S/=10,x++);$!=x&&(g.e++,M[0]==lt&&(M[0]=1));break}else{if(M[C]+=x,M[C]!=lt)break;M[C--]=0,x=1}for($=M.length;M[--$]===0;M.pop());}g.e>f?g.c=g.e=null:g.e<l&&(g.c=[g.e=0])}return g}function j(g){var w,P=g.e;return P===null?g.toString():(w=Qe(g.c),w=P<=a||P>=u?ko(w,P):jt(w,P,"0"),g.s<0?"-"+w:w)}return o.absoluteValue=o.abs=function(){var g=new b(this);return g.s<0&&(g.s=1),g},o.comparedTo=function(g,w){return vn(this,new b(g,w))},o.decimalPlaces=o.dp=function(g,w){var P,N,I,$=this;if(g!=null)return me(g,0,Ae),w==null?w=c:me(w,0,8),D(new b($),g+$.e+1,w);if(!(P=$.c))return null;if(N=((I=P.length-1)-Xe(this.e/ne))*ne,I=P[I])for(;I%10==0;I/=10,N--);return N<0&&(N=0),N},o.dividedBy=o.div=function(g,w){return t(this,new b(g,w),i,c)},o.dividedToIntegerBy=o.idiv=function(g,w){return t(this,new b(g,w),0,1)},o.exponentiatedBy=o.pow=function(g,w){var P,N,I,$,S,x,T,C,y,M=this;if(g=new b(g),g.c&&!g.isInteger())throw Error(Fe+"Exponent not an integer: "+j(g));if(w!=null&&(w=new b(w)),x=g.e>14,!M.c||!M.c[0]||M.c[0]==1&&!M.e&&M.c.length==1||!g.c||!g.c[0])return y=new b(Math.pow(+j(M),x?g.s*(2-Mo(g)):+j(g))),w?y.mod(w):y;if(T=g.s<0,w){if(w.c?!w.c[0]:!w.s)return new b(NaN);N=!T&&M.isInteger()&&w.isInteger(),N&&(M=M.mod(w))}else{if(g.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(g)?-0:0,M.e>-1&&($=1/$),new b(T?1/$:$);h&&($=ti(h/ne+2))}for(x?(P=new b(.5),T&&(g.s=1),C=Mo(g)):(I=Math.abs(+j(g)),C=I%2),y=new b(s);;){if(C){if(y=y.times(M),!y.c)break;$?y.c.length>$&&(y.c.length=$):N&&(y=y.mod(w))}if(I){if(I=Ye(I/2),I===0)break;C=I%2}else if(g=g.times(P),D(g,g.e+1,1),g.e>14)C=Mo(g);else{if(I=+j(g),I===0)break;C=I%2}M=M.times(M),$?M.c&&M.c.length>$&&(M.c.length=$):N&&(M=M.mod(w))}return N?y:(T&&(y=s.div(y)),w?y.mod(w):$?D(y,h,c,S):y)},o.integerValue=function(g){var w=new b(this);return g==null?g=c:me(g,0,8),D(w,w.e+1,g)},o.isEqualTo=o.eq=function(g,w){return vn(this,new b(g,w))===0},o.isFinite=function(){return!!this.c},o.isGreaterThan=o.gt=function(g,w){return vn(this,new b(g,w))>0},o.isGreaterThanOrEqualTo=o.gte=function(g,w){return(w=vn(this,new b(g,w)))===1||w===0},o.isInteger=function(){return!!this.c&&Xe(this.e/ne)>this.c.length-2},o.isLessThan=o.lt=function(g,w){return vn(this,new b(g,w))<0},o.isLessThanOrEqualTo=o.lte=function(g,w){return(w=vn(this,new b(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 P,N,I,$,S=this,x=S.s;if(g=new b(g,w),w=g.s,!x||!w)return new b(NaN);if(x!=w)return g.s=-w,S.plus(g);var T=S.e/ne,C=g.e/ne,y=S.c,M=g.c;if(!T||!C){if(!y||!M)return y?(g.s=-w,g):new b(M?S:NaN);if(!y[0]||!M[0])return M[0]?(g.s=-w,g):new b(y[0]?S:c==3?-0:0)}if(T=Xe(T),C=Xe(C),y=y.slice(),x=T-C){for(($=x<0)?(x=-x,I=y):(C=T,I=M),I.reverse(),w=x;w--;I.push(0));I.reverse()}else for(N=($=(x=y.length)<(w=M.length))?x:w,x=w=0;w<N;w++)if(y[w]!=M[w]){$=y[w]<M[w];break}if($&&(I=y,y=M,M=I,g.s=-g.s),w=(N=M.length)-(P=y.length),w>0)for(;w--;y[P++]=0);for(w=lt-1;N>x;){if(y[--N]<M[N]){for(P=N;P&&!y[--P];y[P]=w);--y[P],y[N]+=lt}y[N]-=M[N]}for(;y[0]==0;y.splice(0,1),--C);return y[0]?R(g,y,C):(g.s=c==3?-1:1,g.c=[g.e=0],g)},o.modulo=o.mod=function(g,w){var P,N,I=this;return g=new b(g,w),!I.c||!g.s||g.c&&!g.c[0]?new b(NaN):!g.c||I.c&&!I.c[0]?new b(I):(p==9?(N=g.s,g.s=1,P=t(I,g,0,3),g.s=N,P.s*=N):P=t(I,g,0,p),g=I.minus(P.times(g)),!g.c[0]&&p==1&&(g.s=I.s),g)},o.multipliedBy=o.times=function(g,w){var P,N,I,$,S,x,T,C,y,M,F,_,z,H,K,W=this,Z=W.c,q=(g=new b(g,w)).c;if(!Z||!q||!Z[0]||!q[0])return!W.s||!g.s||Z&&!Z[0]&&!q||q&&!q[0]&&!Z?g.c=g.e=g.s=null:(g.s*=W.s,!Z||!q?g.c=g.e=null:(g.c=[0],g.e=0)),g;for(N=Xe(W.e/ne)+Xe(g.e/ne),g.s*=W.s,T=Z.length,M=q.length,T<M&&(z=Z,Z=q,q=z,I=T,T=M,M=I),I=T+M,z=[];I--;z.push(0));for(H=lt,K=an,I=M;--I>=0;){for(P=0,F=q[I]%K,_=q[I]/K|0,S=T,$=I+S;$>I;)C=Z[--S]%K,y=Z[S]/K|0,x=_*C+y*F,C=F*C+x%K*K+z[$]+P,P=(C/H|0)+(x/K|0)+_*y,z[$--]=C%H;z[$]=P}return P?++N:z.splice(0,1),R(g,z,N)},o.negated=function(){var g=new b(this);return g.s=-g.s||null,g},o.plus=function(g,w){var P,N=this,I=N.s;if(g=new b(g,w),w=g.s,!I||!w)return new b(NaN);if(I!=w)return g.s=-w,N.minus(g);var $=N.e/ne,S=g.e/ne,x=N.c,T=g.c;if(!$||!S){if(!x||!T)return new b(I/0);if(!x[0]||!T[0])return T[0]?g:new b(x[0]?N:I*0)}if($=Xe($),S=Xe(S),x=x.slice(),I=$-S){for(I>0?(S=$,P=T):(I=-I,P=x),P.reverse();I--;P.push(0));P.reverse()}for(I=x.length,w=T.length,I-w<0&&(P=T,T=x,x=P,w=I),I=0;w;)I=(x[--w]=x[w]+T[w]+I)/lt|0,x[w]=lt===x[w]?0:x[w]%lt;return I&&(x=[I].concat(x),++S),R(g,x,S)},o.precision=o.sd=function(g,w){var P,N,I,$=this;if(g!=null&&g!==!!g)return me(g,1,Ae),w==null?w=c:me(w,0,8),D(new b($),g,w);if(!(P=$.c))return null;if(I=P.length-1,N=I*ne+1,I=P[I]){for(;I%10==0;I/=10,N--);for(I=P[0];I>=10;I/=10,N++);}return g&&$.e+1>N&&(N=$.e+1),N},o.shiftedBy=function(g){return me(g,-ni,ni),this.times("1e"+g)},o.squareRoot=o.sqrt=function(){var g,w,P,N,I,$=this,S=$.c,x=$.s,T=$.e,C=i+4,y=new b("0.5");if(x!==1||!S||!S[0])return new b(!x||x<0&&(!S||S[0])?NaN:S?$:1/0);if(x=Math.sqrt(+j($)),x==0||x==1/0?(w=Qe(S),(w.length+T)%2==0&&(w+="0"),x=Math.sqrt(+w),T=Xe((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),P=new b(w)):P=new b(x+""),P.c[0]){for(T=P.e,x=T+C,x<3&&(x=0);;)if(I=P,P=y.times(I.plus(t($,I,C,1))),Qe(I.c).slice(0,x)===(w=Qe(P.c)).slice(0,x))if(P.e<T&&--x,w=w.slice(x-3,x+1),w=="9999"||!N&&w=="4999"){if(!N&&(D(I,I.e+i+2,0),I.times(I).eq($))){P=I;break}C+=4,x+=4,N=1}else{(!+w||!+w.slice(1)&&w.charAt(0)=="5")&&(D(P,P.e+i+2,1),g=!P.times(P).eq($));break}}return D(P,P.e+i+1,c,g)},o.toExponential=function(g,w){return g!=null&&(me(g,0,Ae),g++),A(this,g,w,1)},o.toFixed=function(g,w){return g!=null&&(me(g,0,Ae),g=g+this.e+1),A(this,g,w)},o.toFormat=function(g,w,P){var N,I=this;if(P==null)g!=null&&w&&typeof w=="object"?(P=w,w=null):g&&typeof g=="object"?(P=g,g=w=null):P=m;else if(typeof P!="object")throw Error(Fe+"Argument not an object: "+P);if(N=I.toFixed(g,w),I.c){var $,S=N.split("."),x=+P.groupSize,T=+P.secondaryGroupSize,C=P.groupSeparator||"",y=S[0],M=S[1],F=I.s<0,_=F?y.slice(1):y,z=_.length;if(T&&($=x,x=T,T=$,z-=$),x>0&&z>0){for($=z%x||x,y=_.substr(0,$);$<z;$+=x)y+=C+_.substr($,x);T>0&&(y+=C+_.slice($)),F&&(y="-"+y)}N=M?y+(P.decimalSeparator||"")+((T=+P.fractionGroupSize)?M.replace(new RegExp("\\d{"+T+"}\\B","g"),"$&"+(P.fractionGroupSeparator||"")):M):y}return(P.prefix||"")+N+(P.suffix||"")},o.toFraction=function(g){var w,P,N,I,$,S,x,T,C,y,M,F,_=this,z=_.c;if(g!=null&&(x=new b(g),!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 b(_);for(w=new b(s),C=P=new b(s),N=T=new b(s),F=Qe(z),$=w.e=F.length-_.e-1,w.c[0]=ri[(S=$%ne)<0?ne+S:S],g=!g||x.comparedTo(w)>0?$>0?w:C:x,S=f,f=1/0,x=new b(F),T.c[0]=0;y=t(x,w,0,1),I=P.plus(y.times(N)),I.comparedTo(g)!=1;)P=N,N=I,C=T.plus(y.times(I=C)),T=I,w=x.minus(y.times(I=w)),x=I;return I=t(g.minus(P),N,0,1),T=T.plus(I.times(C)),P=P.plus(I.times(N)),T.s=C.s=_.s,$=$*2,M=t(C,N,$,c).minus(_).abs().comparedTo(t(T,P,$,c).minus(_).abs())<1?[C,N]:[T,P],f=S,M},o.toNumber=function(){return+j(this)},o.toPrecision=function(g,w){return g!=null&&me(g,1,Ae),A(this,g,w,2)},o.toString=function(g){var w,P=this,N=P.s,I=P.e;return I===null?N?(w="Infinity",N<0&&(w="-"+w)):w="NaN":(g==null?w=I<=a||I>=u?ko(Qe(P.c),I):jt(Qe(P.c),I,"0"):g===10&&O?(P=D(new b(P),i+I+1,c),w=jt(Qe(P.c),P.e,"0")):(me(g,2,v.length,"Base"),w=n(jt(Qe(P.c),I,"0"),10,g,N,!0)),N<0&&P.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&&b.set(e),b}function Xe(e){var t=e|0;return e>0||e===t?t:t-1}function Qe(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 vn(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 me(e,t,n,r){if(e<t||e>n||e!==Ye(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 Xe(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 jt(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 Me=fu();const lm=(e,t=6)=>{try{const n=new Me(e||"0");if(n.isNaN())return"0";const r=n.decimalPlaces(t,Me.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"}},_t=()=>{const{translations:e,currentLocale:t}=uu();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}}}},fm=()=>({openDeposit:E.useCallback(t=>{},[])}),dm=()=>({openWithdraw:E.useCallback(t=>{},[])}),wn="MPC",oi="EVM";/**
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 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};/**
40
+ */const pm=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),hm=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,n,r)=>r?r.toUpperCase():n.toLowerCase()),du=e=>{const t=hm(e);return t.charAt(0).toUpperCase()+t.slice(1)},pu=(...e)=>e.filter((t,n,r)=>!!t&&t.trim()!==""&&r.indexOf(t)===n).join(" ").trim(),mm=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 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"};/**
45
+ */var gm={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 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]]));/**
50
+ */const bm=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,...gm,width:t,height:t,stroke:e,strokeWidth:r?Number(n)*24/Number(t):n,className:pu("lucide",o),...!s&&!mm(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 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};/**
55
+ */const ym=(e,t)=>{const n=E.forwardRef(({className:r,...o},s)=>E.createElement(bm,{ref:s,iconNode:t,className:pu(`lucide-${pm(du(e))}`,`lucide-${e}`,r),...o}));return n.displayName=du(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=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
- `),"","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(`
60
+ */const hu=ym("x",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]),vm=({tokens:e,selectedToken:t,onTokenChange:n})=>B.jsx("div",{className:"bg-fill-input-primary flex rounded-lg p-1",children:e.map(r=>B.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:[B.jsx("img",{src:r.iconUrl,alt:r.token,className:"w-4 h-4 rounded-full"}),B.jsx("span",{className:"ml-1",children:r.token||r.symbol})]},r.token))}),mu=typeof document<"u"?E.useLayoutEffect:()=>{};var si;const wm=(si=E.useInsertionEffect)!==null&&si!==void 0?si:mu;function xm(e){const t=E.useRef(null);return wm(()=>{t.current=e},[e]),E.useCallback((...n)=>{const r=t.current;return r==null?void 0:r(...n)},[])}const cn=e=>{var t;return(t=e==null?void 0:e.ownerDocument)!==null&&t!==void 0?t:document},xn=e=>e&&"window"in e&&e.window===e?e:cn(e).defaultView||window;function Em(e){return e!==null&&typeof e=="object"&&"nodeType"in e&&typeof e.nodeType=="number"}function Sm(e){return Em(e)&&e.nodeType===Node.DOCUMENT_FRAGMENT_NODE&&"host"in e}let $m=!1;function ii(){return $m}function gu(e,t){if(!ii())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:Sm(n)?n=n.host:n=n.parentNode}return!1}const ai=(e=document)=>{var t;if(!ii())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 bu(e){return ii()&&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 ci(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 ui=Ut(function(){return ci(/^Mac/i)}),Pm=Ut(function(){return ci(/^iPhone/i)}),Am=Ut(function(){return ci(/^iPad/i)||ui()&&navigator.maxTouchPoints>1}),Tm=Ut(function(){return Pm()||Am()});Ut(function(){return ui()||Tm()}),Ut(function(){return Bo(/AppleWebKit/i)&&!Om()});const Om=Ut(function(){return Bo(/Chrome/i)}),Cm=Ut(function(){return Bo(/Android/i)});Ut(function(){return Bo(/Firefox/i)});function yu(){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 Im(e){return e.mozInputSource===0&&e.isTrusted?!0:Cm()&&e.pointerType?e.type==="click"&&e.buttons===1:e.detail===0&&!e.pointerType}function vu(e){let t=e;return t.nativeEvent=e,t.isDefaultPrevented=()=>t.defaultPrevented,t.isPropagationStopped=()=>t.cancelBubble,t.persist=()=>{},t}function Nm(e,t){Object.defineProperty(e,"target",{value:t}),Object.defineProperty(e,"currentTarget",{value:t})}function wu(e){let t=E.useRef({isFocused:!1,observer:null});mu(()=>{const r=t.current;return()=>{r.observer&&(r.observer.disconnect(),r.observer=null)}},[]);let n=xm(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=vu(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 Mm=!1,Or=null,li=new Set,Cr=new Map,En=!1,fi=!1;const km={Tab:!0,Escape:!0};function di(e,t){for(let n of li)n(e,t)}function Bm(e){return!(e.metaKey||!ui()&&e.altKey||e.ctrlKey||e.key==="Control"||e.key==="Shift"||e.key==="Meta")}function Lo(e){En=!0,Bm(e)&&(Or="keyboard",di("keyboard",e))}function Je(e){Or="pointer",(e.type==="mousedown"||e.type==="pointerdown")&&(En=!0,di("pointer",e))}function xu(e){Im(e)&&(En=!0,Or="virtual")}function Eu(e){e.target===window||e.target===document||Mm||!e.isTrusted||(!En&&!fi&&(Or="virtual",di("virtual",e)),En=!1,fi=!1)}function Su(){En=!1,fi=!0}function pi(e){if(typeof window>"u"||typeof document>"u"||Cr.get(xn(e)))return;const t=xn(e),n=cn(e);let r=t.HTMLElement.prototype.focus;t.HTMLElement.prototype.focus=function(){En=!0,r.apply(this,arguments)},n.addEventListener("keydown",Lo,!0),n.addEventListener("keyup",Lo,!0),n.addEventListener("click",xu,!0),t.addEventListener("focus",Eu,!0),t.addEventListener("blur",Su,!1),typeof PointerEvent<"u"?(n.addEventListener("pointerdown",Je,!0),n.addEventListener("pointermove",Je,!0),n.addEventListener("pointerup",Je,!0)):process.env.NODE_ENV==="test"&&(n.addEventListener("mousedown",Je,!0),n.addEventListener("mousemove",Je,!0),n.addEventListener("mouseup",Je,!0)),t.addEventListener("beforeunload",()=>{$u(e)},{once:!0}),Cr.set(t,{focus:r})}const $u=(e,t)=>{const n=xn(e),r=cn(e);t&&r.removeEventListener("DOMContentLoaded",t),Cr.has(n)&&(n.HTMLElement.prototype.focus=Cr.get(n).focus,r.removeEventListener("keydown",Lo,!0),r.removeEventListener("keyup",Lo,!0),r.removeEventListener("click",xu,!0),n.removeEventListener("focus",Eu,!0),n.removeEventListener("blur",Su,!1),typeof PointerEvent<"u"?(r.removeEventListener("pointerdown",Je,!0),r.removeEventListener("pointermove",Je,!0),r.removeEventListener("pointerup",Je,!0)):process.env.NODE_ENV==="test"&&(r.removeEventListener("mousedown",Je,!0),r.removeEventListener("mousemove",Je,!0),r.removeEventListener("mouseup",Je,!0)),Cr.delete(n))};function Lm(e){const t=cn(e);let n;return t.readyState!=="loading"?pi(e):(n=()=>{pi(e)},t.addEventListener("DOMContentLoaded",n)),()=>$u(e,n)}typeof document<"u"&&Lm();function Pu(){return Or!=="pointer"}const Rm=new Set(["checkbox","radio","range","color","file","image","button","submit","reset"]);function Fm(e,t,n){let r=cn(n==null?void 0:n.target);const o=typeof window<"u"?xn(n==null?void 0:n.target).HTMLInputElement:HTMLInputElement,s=typeof window<"u"?xn(n==null?void 0:n.target).HTMLTextAreaElement:HTMLTextAreaElement,i=typeof window<"u"?xn(n==null?void 0:n.target).HTMLElement:HTMLElement,c=typeof window<"u"?xn(n==null?void 0:n.target).KeyboardEvent:KeyboardEvent;return e=e||r.activeElement instanceof o&&!Rm.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 Dm(e,t,n){pi(),E.useEffect(()=>{let r=(o,s)=>{Fm(!!(n!=null&&n.isTextInput),o,s)&&e(Pu())};return li.add(r),()=>{li.delete(r)}},t)}function jm(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=wu(s),c=E.useCallback(a=>{const u=cn(a.target),l=u?ai(u):ai();a.target===a.currentTarget&&l===bu(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 _m(e){let{isDisabled:t,onBlurWithin:n,onFocusWithin:r,onFocusWithinChange:o}=e,s=E.useRef({isFocusWithin:!1}),{addGlobalListener:i,removeAllGlobalListeners:c}=yu(),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=wu(a),l=E.useCallback(f=>{if(!f.currentTarget.contains(f.target))return;const d=cn(f.target),p=ai(d);if(!s.current.isFocusWithin&&p===bu(f.nativeEvent)){r&&r(f),o&&o(!0),s.current.isFocusWithin=!0,u(f);let h=f.currentTarget;i(d,"focus",m=>{if(s.current.isFocusWithin&&!gu(h,m.target)){let v=new d.defaultView.FocusEvent("blur",{relatedTarget:m.target});Nm(v,h);let O=vu(v);a(O)}},{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 hi(){Ro=!0,setTimeout(()=>{Ro=!1},50)}function Au(e){e.pointerType==="touch"&&hi()}function Um(){if(!(typeof document>"u"))return Fo===0&&(typeof PointerEvent<"u"?document.addEventListener("pointerup",Au):process.env.NODE_ENV==="test"&&document.addEventListener("touchend",hi)),Fo++,()=>{Fo--,!(Fo>0)&&(typeof PointerEvent<"u"?document.removeEventListener("pointerup",Au):process.env.NODE_ENV==="test"&&document.removeEventListener("touchend",hi))}}function zm(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(Um,[]);let{addGlobalListener:a,removeAllGlobalListeners:u}=yu(),{hoverProps:l,triggerHoverEnd:f}=E.useMemo(()=>{let d=(m,v)=>{if(c.pointerType=v,o||v==="touch"||c.isHovered||!m.currentTarget.contains(m.target))return;c.isHovered=!0;let O=m.currentTarget;c.target=O,a(cn(m.target),"pointerover",b=>{c.isHovered&&c.target&&!gu(c.target,b.target)&&p(b,b.pointerType)},{capture:!0}),t&&t({type:"hoverstart",target:O,pointerType:v}),n&&n(!0),i(!0)},p=(m,v)=>{let O=c.target;c.pointerType="",c.target=null,!(v==="touch"||!c.isHovered||!O)&&(c.isHovered=!1,u(),r&&r({type:"hoverend",target:O,pointerType:v}),n&&n(!1),i(!1))},h={};return typeof PointerEvent<"u"?(h.onPointerEnter=m=>{Ro&&m.pointerType==="mouse"||d(m,m.pointerType)},h.onPointerLeave=m=>{!o&&m.currentTarget.contains(m.target)&&p(m,m.pointerType)}):process.env.NODE_ENV==="test"&&(h.onTouchStart=()=>{c.ignoreEmulatedMouseEvents=!0},h.onMouseEnter=m=>{!c.ignoreEmulatedMouseEvents&&!Ro&&d(m,"mouse"),c.ignoreEmulatedMouseEvents=!1},h.onMouseLeave=m=>{!o&&m.currentTarget.contains(m.target)&&p(m,"mouse")}),{hoverProps:h,triggerHoverEnd:p}},[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||Pu()}),[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(p=>{o.current.isFocused=p,i(p),u()},[u]);Dm(p=>{o.current.isFocusVisible=p,u()},[],{isTextInput:n});let{focusProps:f}=jm({isDisabled:r,onFocusChange:l}),{focusWithinProps:d}=_m({isDisabled:!r,onFocusWithinChange:l});return{isFocused:s,isFocusVisible:c,focusProps:r?d:f}}var Wm=Object.defineProperty,Vm=(e,t,n)=>t in e?Wm(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,mi=(e,t,n)=>(Vm(e,typeof t!="symbol"?t+"":t,n),n);let Gm=class{constructor(){mi(this,"current",this.detect()),mi(this,"handoffState","pending"),mi(this,"currentId",0)}set(t){this.current!==t&&(this.handoffState="pending",this.currentId=0,this.current=t)}reset(){this.set(this.detect())}nextId(){return++this.currentId}get isServer(){return this.current==="server"}get isClient(){return this.current==="client"}detect(){return typeof window>"u"||typeof document>"u"?"server":"client"}handoff(){this.handoffState==="pending"&&(this.handoffState="complete")}get isHandoffComplete(){return this.handoffState==="complete"}},$t=new Gm;function Ir(e){var t,n;return $t.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 Tu(e){typeof queueMicrotask=="function"?queueMicrotask(e):Promise.resolve().then(e).catch(t=>setTimeout(()=>{throw t}))}function ft(){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 Tu(()=>{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=ft();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 Wn(){let[e]=E.useState(ft);return E.useEffect(()=>()=>e.dispose(),[e]),e}let pe=(e,t)=>{$t.isServer?E.useEffect(e,t):E.useLayoutEffect(e,t)};function Sn(e){let t=E.useRef(e);return pe(()=>{t.current=e},[e]),t}let ie=function(e){let t=Sn(e);return E.useCallback((...n)=>t.current(...n),[t])};function qm(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 Zm(e,t){return!(!e||!t||e.right<t.left||e.left>t.right||e.bottom<t.top||e.top>t.bottom)}function Km({disabled:e=!1}={}){let t=E.useRef(null),[n,r]=E.useState(!1),o=Wn(),s=ie(()=>{t.current=null,r(!1),o.dispose()}),i=ie(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=qm(u);r(Zm(l,t.current.getBoundingClientRect()))}},!1),o.addEventListener(a,"pointercancel",s,!1)}}});return{pressed:n,pressProps:e?{}:{onPointerDown:i,onPointerUp:s,onClick:s}}}let Ym=E.createContext(void 0);function gi(){return E.useContext(Ym)}function bi(...e){return Array.from(new Set(e.flatMap(t=>typeof t=="string"?t.split(" "):[]))).filter(Boolean).join(" ")}function et(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,et),r}var Do=(e=>(e[e.None=0]="None",e[e.RenderStrategy=1]="RenderStrategy",e[e.Static=2]="Static",e))(Do||{}),un=(e=>(e[e.Unmount=0]="Unmount",e[e.Hidden=1]="Hidden",e))(un||{});function Ge(){let e=Qm();return E.useCallback(t=>Xm({mergeRefs:e,...t}),[e])}function Xm({ourProps:e,theirProps:t,slot:n,defaultTag:r,features:o,visible:s=!0,name:i,mergeRefs:c}){c=c??Jm;let a=Ou(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 et(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}=yi(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 d=!1,p=[];for(let[h,m]of Object.entries(t))typeof m=="boolean"&&(d=!0),m===!0&&p.push(h.replace(/([A-Z])/g,v=>`-${v.toLowerCase()}`));if(d){f["data-headlessui-state"]=p.join(" ");for(let h of p)f[`data-${h}`]=""}}if(s===E.Fragment&&(Object.keys(ln(a)).length>0||Object.keys(ln(f)).length>0))if(!E.isValidElement(l)||Array.isArray(l)&&l.length>1){if(Object.keys(ln(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(ln(a)).concat(Object.keys(ln(f))).map(d=>` - ${d}`).join(`
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(d=>` - ${d}`).join(`
62
62
  `)].join(`
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={};/**
63
+ `))}else{let d=l.props,p=d==null?void 0:d.className,h=typeof p=="function"?(...O)=>bi(p(...O),a.className):bi(p,a.className),m=h?{className:h}:{},v=Ou(l.props,ln(yi(a,["ref"])));for(let O in f)O in v&&delete f[O];return E.cloneElement(l,Object.assign({},v,f,u,{ref:o(eg(l),u.ref)},m))}return E.createElement(s,Object.assign({},yi(a,["ref"]),s!==E.Fragment&&u,s!==E.Fragment&&f),l)}function Qm(){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 Jm(...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 Ou(...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 Cu(...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 De(e){var t;return Object.assign(E.forwardRef(e),{displayName:(t=e.displayName)!=null?t:e.name})}function ln(e){let t=Object.assign({},e);for(let n in t)t[n]===void 0&&delete t[n];return t}function yi(e,t=[]){let n=Object.assign({},e);for(let r of t)r in n&&delete n[r];return n}function eg(e){return E.version.split(".")[0]>="19"?e.props.ref:e.ref}function tg(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,ie(u=>(s||o(u),t==null?void 0:t(u)))]}function ng(e){let[t]=E.useState(e);return t}function Iu(e={},t=null,n=[]){for(let[r,o]of Object.entries(e))Mu(n,Nu(t,r),o);return n}function Nu(e,t){return e?e+"["+t+"]":t}function Mu(e,t,n){if(Array.isArray(n))for(let[r,o]of n.entries())Mu(e,Nu(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,""]):Iu(n,t,e)}function rg(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 og="span";var vi=(e=>(e[e.None=1]="None",e[e.Focusable=2]="Focusable",e[e.Hidden=4]="Hidden",e))(vi||{});function sg(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 Ge()({ourProps:s,theirProps:o,slot:{},defaultTag:og,name:"Hidden"})}let ku=De(sg),ig=E.createContext(null);function ag({children:e}){let t=E.useContext(ig);if(!t)return E.createElement(E.Fragment,null,e);let{target:n}=t;return n?Ne.createPortal(E.createElement(E.Fragment,null,e),n):null}function cg({data:e,form:t,disabled:n,onReset:r,overrides:o}){let[s,i]=E.useState(null),c=Wn();return E.useEffect(()=>{if(r&&s)return c.addEventListener(s,"reset",r)},[s,t,r]),E.createElement(ag,null,E.createElement(ug,{setForm:i,formId:t}),Iu(e).map(([a,u])=>E.createElement(ku,{features:vi.Hidden,...ln({key:a,as:"input",type:"hidden",hidden:!0,readOnly:!0,form:t,disabled:n,name:a,value:u,...o})})))}function ug({setForm:e,formId:t}){return E.useEffect(()=>{if(t){let n=document.getElementById(t);n&&e(n)}},[e,t]),t?null:E.createElement(ku,{features:vi.Hidden,as:"input",type:"hidden",hidden:!0,readOnly:!0,ref:n=>{if(!n)return;let r=n.closest("form");r&&e(r)}})}let lg=E.createContext(void 0);function Bu(){return E.useContext(lg)}function wi(e){return typeof e!="object"||e===null?!1:"nodeType"in e}function _o(e){return wi(e)&&"tagName"in e}function zt(e){return _o(e)&&"accessKey"in e}function Vn(e){return _o(e)&&"tabIndex"in e}function fg(e){return _o(e)&&"style"in e}function dg(e){return zt(e)&&e.nodeName==="IFRAME"}function Lu(e){return zt(e)&&e.nodeName==="INPUT"}function Ru(e){return zt(e)&&e.nodeName==="LABEL"}function pg(e){return zt(e)&&e.nodeName==="FIELDSET"}function Fu(e){return zt(e)&&e.nodeName==="LEGEND"}function hg(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 mg(e){let t=e.parentElement,n=null;for(;t&&!pg(t);)Fu(t)&&(n=t),t=t.parentElement;let r=(t==null?void 0:t.getAttribute("disabled"))==="";return r&&gg(n)?!1:r}function gg(e){if(!e)return!1;let t=e.previousElementSibling;for(;t!==null;){if(Fu(t))return!1;t=t.previousElementSibling}return!0}let Du=Symbol();function bg(e,t=!0){return Object.assign(e,{[Du]:t})}function tt(...e){let t=E.useRef(e);E.useEffect(()=>{t.current=e},[e]);let n=ie(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[Du]))?void 0:n}let xi=E.createContext(null);xi.displayName="DescriptionContext";function ju(){let e=E.useContext(xi);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,ju),t}return e}function yg(){var e,t;return(t=(e=E.useContext(xi))==null?void 0:e.value)!=null?t:void 0}let vg="p";function wg(e,t){let n=E.useId(),r=gi(),{id:o=`headlessui-description-${n}`,...s}=e,i=ju(),c=tt(t);pe(()=>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 Ge()({ourProps:l,theirProps:s,slot:u,defaultTag:vg,name:i.name||"Description"})}let xg=De(wg);Object.assign(xg,{});var Te=(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))(Te||{});let Uo=E.createContext(null);Uo.displayName="LabelContext";function _u(){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,_u),t}return e}function Uu(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 Eg({inherit:e=!1}={}){let t=Uu(),[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=ie(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 Sg="label";function $g(e,t){var n;let r=E.useId(),o=_u(),s=Bu(),i=gi(),{id:c=`headlessui-label-${r}`,htmlFor:a=s??((n=o.props)==null?void 0:n.htmlFor),passive:u=!1,...l}=e,f=tt(t);pe(()=>o.register(c),[c,o.register]);let d=ie(v=>{let O=v.currentTarget;if(!(v.target!==v.currentTarget&&hg(v.target))&&(Ru(O)&&v.preventDefault(),o.props&&"onClick"in o.props&&typeof o.props.onClick=="function"&&o.props.onClick(v),Ru(O))){let b=document.getElementById(O.htmlFor);if(b){let A=b.getAttribute("disabled");if(A==="true"||A==="")return;let k=b.getAttribute("aria-disabled");if(k==="true"||k==="")return;(Lu(b)&&(b.type==="file"||b.type==="radio"||b.type==="checkbox")||b.role==="radio"||b.role==="checkbox"||b.role==="switch")&&b.click(),b.focus({preventScroll:!0})}}}),p=i||!1,h=E.useMemo(()=>({...o.slot,disabled:p}),[o.slot,p]),m={ref:f,...o.props,id:c,htmlFor:a,onClick:d};return u&&("onClick"in m&&(delete m.htmlFor,delete m.onClick),"onClick"in l&&delete l.onClick),Ge()({ourProps:m,theirProps:l,slot:h,defaultTag:a?Sg:"div",name:o.name||"Label"})}let Pg=De($g),Ag=Object.assign(Pg,{});function Tg(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=Tg){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 Cg(e){if(e===null)return{width:0,height:0};let{width:t,height:n}=e.getBoundingClientRect();return{width:t,height:n}}function Ig(e,t=!1){let[n,r]=E.useReducer(()=>({}),{}),o=E.useMemo(()=>Cg(e),[e,n]);return pe(()=>{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 zu=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 Ng=Object.defineProperty,Mg=(e,t,n)=>t in e?Ng(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,kg=(e,t,n)=>(Mg(e,t+"",n),n),Hu=(e,t,n)=>{if(!t.has(e))throw TypeError("Cannot "+n)},nt=(e,t,n)=>(Hu(e,t,"read from private field"),n?n.call(e):t.get(e)),Ei=(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)},Wu=(e,t,n,r)=>(Hu(e,t,"write to private field"),t.set(e,n),n),Pt,Nr,Mr;let Vu=class{constructor(t){Ei(this,Pt,{}),Ei(this,Nr,new zu(()=>new Set)),Ei(this,Mr,new Set),kg(this,"disposables",ft()),Wu(this,Pt,t),$t.isServer&&this.disposables.microTask(()=>{this.dispose()})}dispose(){this.disposables.dispose()}get state(){return nt(this,Pt)}subscribe(t,n){if($t.isServer)return()=>{};let r={selector:t,callback:n,current:t(nt(this,Pt))};return nt(this,Mr).add(r),this.disposables.add(()=>{nt(this,Mr).delete(r)})}on(t,n){return $t.isServer?()=>{}:(nt(this,Nr).get(t).add(n),this.disposables.add(()=>{nt(this,Nr).get(t).delete(n)}))}send(t){let n=this.reduce(nt(this,Pt),t);if(n!==nt(this,Pt)){Wu(this,Pt,n);for(let r of nt(this,Mr)){let o=r.selector(nt(this,Pt));Gu(r.current,o)||(r.current=o,r.callback(o))}for(let r of nt(this,Nr).get(t.type))r(nt(this,Pt),t)}}};Pt=new WeakMap,Nr=new WeakMap,Mr=new WeakMap;function Gu(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:Si(e[Symbol.iterator](),t[Symbol.iterator]()):e instanceof Map&&t instanceof Map||e instanceof Set&&t instanceof Set?e.size!==t.size?!1:Si(e.entries(),t.entries()):qu(e)&&qu(t)?Si(Object.entries(e)[Symbol.iterator](),Object.entries(t)[Symbol.iterator]()):!1}function Si(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 $i(e){let[t,n]=e(),r=ft();return(...o)=>{t(...o),r.dispose(),r.microTask(n)}}var Bg=Object.defineProperty,Lg=(e,t,n)=>t in e?Bg(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Zu=(e,t,n)=>(Lg(e,typeof t!="symbol"?t+"":t,n),n),Ku=(e=>(e[e.Push=0]="Push",e[e.Pop=1]="Pop",e))(Ku||{});let Rg={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 Y0 extends Vu{constructor(){super(...arguments),Zu(this,"actions",{push:t=>this.send({type:0,id:t}),pop:t=>this.send({type:1,id:t})}),Zu(this,"selectors",{isTop:(t,n)=>t.stack[t.stack.length-1]===n,inStack:(t,n)=>t.stack.includes(n)})}static new(){return new Y0({stack:[]})}reduce(t,n){return et(n.type,Rg,t,n)}};const Pi=new zu(()=>Fg.new());var Ai={exports:{}},Ti={};/**
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 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={};/**
71
+ */var Yu;function Dg(){if(Yu)return Ti;Yu=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 Ti.useSyncExternalStoreWithSelector=function(a,u,l,f,d){var p=o(null);if(p.current===null){var h={hasValue:!1,value:null};p.current=h}else h=p.current;p=i(function(){function v(R){if(!O){if(O=!0,b=R,R=f(R),d!==void 0&&h.hasValue){var D=h.value;if(d(D,R))return A=D}return A=R}if(D=A,n(b,R))return D;var j=f(R);return d!==void 0&&d(D,j)?(b=R,D):(b=R,A=j)}var O=!1,b,A,k=l===void 0?null:l;return[function(){return v(u())},k===null?void 0:function(){return v(k())}]},[u,l,f,d]);var m=r(a,p[0],p[1]);return s(function(){h.hasValue=!0,h.value=m},[m]),c(m),m},Ti}var Oi={};/**
72
72
  * @license React
73
73
  * use-sync-external-store-with-selector.development.js
74
74
  *
@@ -76,29 +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 _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}}/*!
79
+ */var Xu;function jg(){return Xu||(Xu=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;Oi.useSyncExternalStoreWithSelector=function(a,u,l,f,d){var p=o(null);if(p.current===null){var h={hasValue:!1,value:null};p.current=h}else h=p.current;p=i(function(){function v(R){if(!O){if(O=!0,b=R,R=f(R),d!==void 0&&h.hasValue){var D=h.value;if(d(D,R))return A=D}return A=R}if(D=A,n(b,R))return D;var j=f(R);return d!==void 0&&d(D,j)?(b=R,D):(b=R,A=j)}var O=!1,b,A,k=l===void 0?null:l;return[function(){return v(u())},k===null?void 0:function(){return v(k())}]},[u,l,f,d]);var m=r(a,p[0],p[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())}()),Oi}process.env.NODE_ENV==="production"?Ai.exports=Dg():Ai.exports=jg();var _g=Ai.exports;function rt(e,t,n=Gu){return _g.useSyncExternalStoreWithSelector(ie(r=>e.subscribe(Ug,r)),ie(()=>e.state),ie(()=>e.state),ie(t),n)}function Ug(e){return e}function Qu(e,t){let n=E.useId(),r=Pi.get(t),[o,s]=rt(r,E.useCallback(i=>[r.selectors.isTop(i,n),r.selectors.inStack(i,n)],[r,n]));return pe(()=>{if(e)return r.actions.push(n),()=>r.actions.pop(n)},[r,e,n]),e?s?o:!0:!1}let Ci=new Map,kr=new Map;function Ju(e){var t;let n=(t=kr.get(e))!=null?t:0;return kr.set(e,n+1),n!==0?()=>el(e):(Ci.set(e,{"aria-hidden":e.getAttribute("aria-hidden"),inert:e.inert}),e.setAttribute("aria-hidden","true"),e.inert=!0,()=>el(e))}function el(e){var t;let n=(t=kr.get(e))!=null?t:1;if(n===1?kr.delete(e):kr.set(e,n-1),n!==1)return;let r=Ci.get(e);r&&(r["aria-hidden"]===null?e.removeAttribute("aria-hidden"):e.setAttribute("aria-hidden",r["aria-hidden"]),e.inert=r.inert,Ci.delete(e))}function zg(e,{allowed:t,disallowed:n}={}){let r=Qu(e,"inert-others");pe(()=>{var o,s;if(!r)return;let i=ft();for(let a of(o=n==null?void 0:n())!=null?o:[])a&&i.add(Ju(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(d=>f.contains(d))||i.add(Ju(f));l=l.parentElement}}return i.dispose},[r,t,n])}function Hg(e,t,n){let r=Sn(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=ft();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 Ii=["[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(","),Wg=["[data-autofocus]"].map(e=>`${e}:not([tabindex='-1'])`).join(",");var Ni=(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))(Ni||{}),Vg=(e=>(e[e.Error=0]="Error",e[e.Overflow=1]="Overflow",e[e.Success=2]="Success",e[e.Underflow=3]="Underflow",e))(Vg||{}),Gg=(e=>(e[e.Previous=-1]="Previous",e[e.Next=1]="Next",e))(Gg||{});function tl(e=document.body){return e==null?[]:Array.from(e.querySelectorAll(Ii)).sort((t,n)=>Math.sign((t.tabIndex||Number.MAX_SAFE_INTEGER)-(n.tabIndex||Number.MAX_SAFE_INTEGER)))}function qg(e=document.body){return e==null?[]:Array.from(e.querySelectorAll(Wg)).sort((t,n)=>Math.sign((t.tabIndex||Number.MAX_SAFE_INTEGER)-(n.tabIndex||Number.MAX_SAFE_INTEGER)))}var Mi=(e=>(e[e.Strict=0]="Strict",e[e.Loose=1]="Loose",e))(Mi||{});function nl(e,t=0){var n;return e===((n=Ir(e))==null?void 0:n.body)?!1:et(t,{0(){return e.matches(Ii)},1(){let r=e;for(;r!==null;){if(r.matches(Ii))return!0;r=r.parentElement}return!1}})}var Zg=(e=>(e[e.Keyboard=0]="Keyboard",e[e.Mouse=1]="Mouse",e))(Zg||{});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 Kg=["textarea","input"].join(",");function Yg(e){var t,n;return(n=(t=e==null?void 0:e.matches)==null?void 0:t.call(e,Kg))!=null?n:!1}function rl(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 Xg(e,t){return Qg(tl(),t,{relativeTo:e})}function Qg(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?rl(e):e:t&64?qg(e):tl(e);o.length>0&&i.length>1&&(i=i.filter(p=>!o.some(h=>h!=null&&"current"in h?(h==null?void 0:h.current)===p:h===p))),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,d;do{if(l>=f||l+f<=0)return 0;let p=a+l;if(t&16)p=(p+f)%f;else{if(p<0)return 3;if(p>=f)return 1}d=i[p],d==null||d.focus(u),l+=c}while(d!==s.activeElement);return t&6&&Yg(d)&&d.select(),2}function ol(){return/iPhone/gi.test(window.navigator.platform)||/Mac/gi.test(window.navigator.platform)&&window.navigator.maxTouchPoints>0}function Jg(){return/Android/gi.test(window.navigator.userAgent)}function sl(){return ol()||Jg()}function Gn(e,t,n,r){let o=Sn(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 eb(e,t,n,r){let o=Sn(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 il=30;function tb(e,t,n){let r=Sn(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(d){return typeof d=="function"?f(d()):Array.isArray(d)||d instanceof Set?d:[d]}(t);for(let f of l)if(f!==null&&(f.contains(u)||c.composed&&c.composedPath().includes(f)))return;return!nl(u,Mi.Loose)&&u.tabIndex!==-1&&c.preventDefault(),r.current(c,u)},[r,t]),s=E.useRef(null);Gn(e,"pointerdown",c=>{var a,u;sl()||(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(sl()||!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)>=il||Math.abs(a.y-i.current.y)>=il))return o(c,()=>Vn(c.target)?c.target:null)},!0),eb(e,"blur",c=>o(c,()=>dg(window.document.activeElement)?window.document.activeElement:null),!0)}function ki(...e){return E.useMemo(()=>Ir(...e),[...e])}var nb=(e=>(e[e.Ignore=0]="Ignore",e[e.Select=1]="Select",e[e.Close=2]="Close",e))(nb||{});const zo={Ignore:{kind:0},Select:e=>({kind:1,target:e}),Close:{kind:2}},rb=200,al=5;function ob(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=>{wi(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))<al&&Math.abs(a.y-((l=c.current)!=null?l:a.y))<al)return;let d=n(a);switch(d.kind){case 0:return;case 1:{a.timeStamp-f>rb&&(o(d.target),r());break}case 2:{r();break}}},{capture:!0})}function sb(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 ib(e){return E.useSyncExternalStore(e.subscribe,e.getSnapshot,e.getSnapshot)}function ab(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 cb(){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 ub(){return ol()?{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=ft();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)&&fg(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(Lu(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 lb(){return{before({doc:e,d:t}){t.style(e.documentElement,"overflow","hidden")}}}function fb(e){let t={};for(let n of e)Object.assign(t,n(t));return t}let $n=ab(()=>new Map,{PUSH(e,t){var n;let r=(n=this.get(e))!=null?n:{doc:e,count:0,d:ft(),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:fb(n)},o=[ub(),cb(),lb()];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 db(e,t,n=()=>({containers:[]})){let r=ib($n),o=t?r.get(t):void 0,s=o?o.count>0:!1;return pe(()=>{if(!(!t||!e))return $n.dispatch("PUSH",t,n),()=>$n.dispatch("POP",t,n)},[e,t]),s}function pb(e,t,n=()=>[document.body]){let r=Qu(e,"scroll-lock");db(r,t,o=>{var s;return{containers:[...(s=o.containers)!=null?s:[],n]}})}function cl(e){return[e.screenX,e.screenY]}function hb(){let e=E.useRef([-1,-1]);return{wasMoved(t){let n=cl(t);return e.current[0]===n[0]&&e.current[1]===n[1]?!1:(e.current=n,!0)},update(t){e.current=cl(t)}}}function mb(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 ul,ll;typeof process<"u"&&typeof globalThis<"u"&&typeof Element<"u"&&((ul=process==null?void 0:process.env)==null?void 0:ul.NODE_ENV)==="test"&&typeof((ll=Element==null?void 0:Element.prototype)==null?void 0:ll.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 gb=(e=>(e[e.None=0]="None",e[e.Closed=1]="Closed",e[e.Enter=2]="Enter",e[e.Leave=4]="Leave",e))(gb||{});function fl(e){let t={};for(let n in e)e[n]===!0&&(t[`data-${n}`]="");return t}function dl(e,t,n,r){let[o,s]=E.useState(n),{hasFlag:i,addFlag:c,removeFlag:a}=mb(e&&o?3:0),u=E.useRef(!1),l=E.useRef(!1),f=Wn();return pe(()=>{var d;if(e){if(n&&s(!0),!t){n&&c(3);return}return(d=r==null?void 0:r.start)==null||d.call(r,n),bb(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 p;l.current&&typeof t.getAnimations=="function"&&t.getAnimations().length>0||(u.current=!1,a(7),n||s(!1),(p=r==null?void 0:r.end)==null||p.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 bb(e,{prepare:t,run:n,done:r,inFlight:o}){let s=ft();return vb(e,{prepare:t,inFlight:o}),s.nextFrame(()=>{n(),s.requestAnimationFrame(()=>{s.add(yb(e,r))})}),s.dispose}function yb(e,t){var n,r;let o=ft();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 vb(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 Ho(){return typeof window<"u"}function qn(e){return Bi(e)?(e.nodeName||"").toLowerCase():"#document"}function je(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function At(e){var t;return(t=(Bi(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function Bi(e){return Ho()?e instanceof Node||e instanceof je(e).Node:!1}function ce(e){return Ho()?e instanceof Element||e instanceof je(e).Element:!1}function ke(e){return Ho()?e instanceof HTMLElement||e instanceof je(e).HTMLElement:!1}function Li(e){return!Ho()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof je(e).ShadowRoot}const wb=new Set(["inline","contents"]);function Br(e){const{overflow:t,overflowX:n,overflowY:r,display:o}=ot(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!wb.has(o)}const xb=new Set(["table","td","th"]);function Eb(e){return xb.has(qn(e))}const Sb=[":popover-open",":modal"];function Wo(e){return Sb.some(t=>{try{return e.matches(t)}catch{return!1}})}const $b=["transform","translate","scale","rotate","perspective"],Pb=["transform","translate","scale","rotate","perspective","filter"],Ab=["paint","layout","strict","content"];function Ri(e){const t=Vo(),n=ce(e)?ot(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)||Pb.some(r=>(n.willChange||"").includes(r))||Ab.some(r=>(n.contain||"").includes(r))}function Tb(e){let t=Wt(e);for(;ke(t)&&!Ht(t);){if(Ri(t))return t;if(Wo(t))return null;t=Wt(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 Ht(e){return Ob.has(qn(e))}function ot(e){return je(e).getComputedStyle(e)}function Go(e){return ce(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Wt(e){if(qn(e)==="html")return e;const t=e.assignedSlot||e.parentNode||Li(e)&&e.host||At(e);return Li(t)?t.host:t}function pl(e){const t=Wt(e);return Ht(t)?e.ownerDocument?e.ownerDocument.body:e.body:ke(t)&&Br(t)?t:pl(t)}function fn(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const o=pl(e),s=o===((r=e.ownerDocument)==null?void 0:r.body),i=je(o);if(s){const c=Fi(i);return t.concat(i,i.visualViewport||[],Br(o)?o:[],c&&n?fn(c):[])}return t.concat(o,fn(o,[],n))}function Fi(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function Cb(){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,Lr=Math.round,qo=Math.floor,Tt=e=>({x:e,y:e}),Ib={left:"right",right:"left",bottom:"top",top:"bottom"},Nb={start:"end",end:"start"};function Di(e,t,n){return Ie(e,Vt(t,n))}function Pn(e,t){return typeof e=="function"?e(t):e}function dn(e){return e.split("-")[0]}function Zn(e){return e.split("-")[1]}function hl(e){return e==="x"?"y":"x"}function ji(e){return e==="y"?"height":"width"}const Mb=new Set(["top","bottom"]);function Gt(e){return Mb.has(dn(e))?"y":"x"}function _i(e){return hl(Gt(e))}function kb(e,t,n){n===void 0&&(n=!1);const r=Zn(e),o=_i(e),s=ji(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[Ui(e),t,Ui(t)]}function Ui(e){return e.replace(/start|end/g,t=>Nb[t])}const ml=["left","right"],gl=["right","left"],Lb=["top","bottom"],Rb=["bottom","top"];function Fb(e,t,n){switch(e){case"top":case"bottom":return n?t?gl:ml:t?ml:gl;case"left":case"right":return t?Lb:Rb;default:return[]}}function Db(e,t,n,r){const o=Zn(e);let s=Fb(dn(e),n==="start",r);return o&&(s=s.map(i=>i+"-"+o),t&&(s=s.concat(s.map(Ui)))),s}function Zo(e){return e.replace(/left|right|bottom|top/g,t=>Ib[t])}function jb(e){return{top:0,right:0,bottom:0,left:0,...e}}function bl(e){return typeof e!="number"?jb(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 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:`
83
+ */var _b=["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])"],zi=_b.join(","),yl=typeof Element>"u",Rr=yl?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,Yo=!yl&&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},Ub=function(t){var n,r=t==null||(n=t.getAttribute)===null||n===void 0?void 0:n.call(t,"contenteditable");return r===""||r==="true"},zb=function(t,n,r){if(Xo(t))return[];var o=Array.prototype.slice.apply(t.querySelectorAll(zi));return n&&Rr.call(t,zi)&&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=Rr.call(i,zi);l&&r.filter(i)&&(n||!t.includes(i))&&o.push(i);var f=i.shadowRoot||typeof r.getShadowRoot=="function"&&r.getShadowRoot(i),d=!Xo(f,!1)&&(!r.shadowRootFilter||r.shadowRootFilter(i));if(f&&d){var p=e(f===!0?i.children:f.children,!0,r);r.flatten?o.push.apply(o,p):o.push({scopeParent:i,candidates:p})}else s.unshift.apply(s,i.children)}}return o},vl=function(t){return!isNaN(parseInt(t.getAttribute("tabindex"),10))},wl=function(t){if(!t)throw new Error("No node provided");return t.tabIndex<0&&(/^(AUDIO|VIDEO|DETAILS)$/.test(t.tagName)||Ub(t))&&!vl(t)?0:t.tabIndex},Wb=function(t,n){var r=wl(t);return r<0&&n&&!vl(t)?0:r},Vb=function(t,n){return t.tabIndex===n.tabIndex?t.documentOrder-n.documentOrder:t.tabIndex-n.tabIndex},xl=function(t){return t.tagName==="INPUT"},Gb=function(t){return xl(t)&&t.type==="hidden"},qb=function(t){var n=t.tagName==="DETAILS"&&Array.prototype.slice.apply(t.children).some(function(r){return r.tagName==="SUMMARY"});return n},Zb=function(t,n){for(var r=0;r<t.length;r++)if(t[r].checked&&t[r].form===n)return t[r]},Kb=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=Zb(o,t.form);return!s||s===t},Yb=function(t){return xl(t)&&t.type==="radio"},Xb=function(t){return Yb(t)&&!Kb(t)},Qb=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},El=function(t){var n=t.getBoundingClientRect(),r=n.width,o=n.height;return r===0&&o===0},Jb=function(t,n){var r=n.displayCheck,o=n.getShadowRoot;if(getComputedStyle(t).visibility==="hidden")return!0;var s=Rr.call(t,"details>summary:first-of-type"),i=s?t.parentElement:t;if(Rr.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 El(t);t.assignedSlot?t=t.assignedSlot:!a&&u!==t.ownerDocument?t=u.host:t=a}t=c}if(Qb(t))return!t.getClientRects().length;if(r!=="legacy-full")return!0}else if(r==="non-zero-area")return El(t);return!1},ey=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 Rr.call(n,"fieldset[disabled] *")?!0:!o.contains(t)}return!0}n=n.parentElement}return!1},ty=function(t,n){return!(n.disabled||Xo(n)||Gb(n)||Jb(n,t)||qb(n)||ey(n))},Sl=function(t,n){return!(Xb(n)||wl(n)<0||!ty(t,n))},ny=function(t){var n=parseInt(t.getAttribute("tabindex"),10);return!!(isNaN(n)||n>=0)},ry=function e(t){var n=[],r=[];return t.forEach(function(o,s){var i=!!o.scopeParent,c=i?o.scopeParent:o,a=Wb(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(Vb).reduce(function(o,s){return s.isScope?o.push.apply(o,s.content):o.push(s.content),o},[]).concat(n)},$l=function(t,n){n=n||{};var r;return n.getShadowRoot?r=Hb([t],n.includeContainer,{filter:Sl.bind(null,n),flatten:!1,getShadowRoot:n.getShadowRoot,shadowRootFilter:ny}):r=zb(t,n.includeContainer,Sl.bind(null,n)),ry(r)};function Pl(e,t,n){let{reference:r,floating:o}=e;const s=Gt(t),i=_i(t),c=ji(i),a=dn(t),u=s==="y",l=r.x+r.width/2-o.width/2,f=r.y+r.height/2-o.height/2,d=r[c]/2-o[c]/2;let p;switch(a){case"top":p={x:l,y:r.y-o.height};break;case"bottom":p={x:l,y:r.y+r.height};break;case"right":p={x:r.x+r.width,y:f};break;case"left":p={x:r.x-o.width,y:f};break;default:p={x:r.x,y:r.y}}switch(Zn(t)){case"start":p[i]-=d*(n&&u?-1:1);break;case"end":p[i]+=d*(n&&u?-1:1);break}return p}const oy=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}=Pl(u,r,a),d=r,p={},h=0;for(let m=0;m<c.length;m++){const{name:v,fn:O}=c[m],{x:b,y:A,data:k,reset:R}=await O({x:l,y:f,initialPlacement:r,placement:d,strategy:o,middlewareData:p,rects:u,platform:i,elements:{reference:e,floating:t}});l=b??l,f=A??f,p={...p,[v]:{...p[v],...k}},R&&h<=50&&(h++,typeof R=="object"&&(R.placement&&(d=R.placement),R.rects&&(u=R.rects===!0?await i.getElementRects({reference:e,floating:t,strategy:o}):R.rects),{x:l,y:f}=Pl(u,d,a)),m=-1)}return{x:l,y:f,placement:d,strategy:o,middlewareData:p}};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:d=!1,padding:p=0}=Pn(t,e),h=bl(p),v=c[d?f==="floating"?"reference":"floating":f],O=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})),b=f==="floating"?{x:r,y:o,width:i.floating.width,height:i.floating.height}:i.reference,A=await(s.getOffsetParent==null?void 0:s.getOffsetParent(c.floating)),k=await(s.isElement==null?void 0:s.isElement(A))?await(s.getScale==null?void 0:s.getScale(A))||{x:1,y:1}:{x:1,y:1},R=Ko(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:c,rect:b,offsetParent:A,strategy:a}):b);return{top:(O.top-R.top+h.top)/k.y,bottom:(R.bottom-O.bottom+h.bottom)/k.y,left:(O.left-R.left+h.left)/k.x,right:(R.right-O.right+h.right)/k.x}}const sy=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}=Pn(e,t)||{};if(u==null)return{};const f=bl(l),d={x:n,y:r},p=_i(o),h=ji(p),m=await i.getDimensions(u),v=p==="y",O=v?"top":"left",b=v?"bottom":"right",A=v?"clientHeight":"clientWidth",k=s.reference[h]+s.reference[p]-d[p]-s.floating[h],R=d[p]-s.reference[p],D=await(i.getOffsetParent==null?void 0:i.getOffsetParent(u));let j=D?D[A]:0;(!j||!await(i.isElement==null?void 0:i.isElement(D)))&&(j=c.floating[A]||s.floating[h]);const g=k/2-R/2,w=j/2-m[h]/2-1,P=Vt(f[O],w),N=Vt(f[b],w),I=P,$=j-m[h]-N,S=j/2-m[h]/2+g,x=Di(I,S,$),T=!a.arrow&&Zn(o)!=null&&S!==x&&s.reference[h]/2-(S<I?P:N)-m[h]/2<0,C=T?S<I?S-I:S-$:0;return{[p]:d[p]+C,data:{[p]:x,centerOffset:S-x-C,...T&&{alignmentOffset:C}},reset:T}}}),iy=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:d,fallbackStrategy:p="bestFit",fallbackAxisSideDirection:h="none",flipAlignment:m=!0,...v}=Pn(e,t);if((n=s.arrow)!=null&&n.alignmentOffset)return{};const O=dn(o),b=Gt(c),A=dn(c)===c,k=await(a.isRTL==null?void 0:a.isRTL(u.floating)),R=d||(A||!m?[Zo(c)]:Bb(c)),D=h!=="none";!d&&D&&R.push(...Db(c,m,h,k));const j=[c,...R],g=await Qo(t,v),w=[];let P=((r=s.flip)==null?void 0:r.overflows)||[];if(l&&w.push(g[O]),f){const S=kb(o,i,k);w.push(g[S[0]],g[S[1]])}if(P=[...P,{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"?b!==Gt(x):!1)||P.every(y=>Gt(y.placement)===b?y.overflows[0]>0:!0)))return{data:{index:S,overflows:P},reset:{placement:x}};let T=(I=P.filter(C=>C.overflows[0]<=0).sort((C,y)=>C.overflows[1]-y.overflows[1])[0])==null?void 0:I.placement;if(!T)switch(p){case"bestFit":{var $;const C=($=P.filter(y=>{if(D){const M=Gt(y.placement);return M===b||M==="y"}return!0}).map(y=>[y.placement,y.overflows.filter(M=>M>0).reduce((M,F)=>M+F,0)]).sort((y,M)=>y[1]-M[1])[0])==null?void 0:$[0];C&&(T=C);break}case"initialPlacement":T=c;break}if(o!==T)return{reset:{placement:T}}}return{}}}},ay=new Set(["left","top"]);async function cy(e,t){const{placement:n,platform:r,elements:o}=e,s=await(r.isRTL==null?void 0:r.isRTL(o.floating)),i=dn(n),c=Zn(n),a=Gt(n)==="y",u=ay.has(i)?-1:1,l=s&&a?-1:1,f=Pn(t,e);let{mainAxis:d,crossAxis:p,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"&&(p=c==="end"?h*-1:h),a?{x:p*l,y:d*u}:{x:d*u,y:p*l}}const uy=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 cy(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}}}}},ly=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:O,y:b}=v;return{x:O,y:b}}},...a}=Pn(e,t),u={x:n,y:r},l=await Qo(t,a),f=Gt(dn(o)),d=hl(f);let p=u[d],h=u[f];if(s){const v=d==="y"?"top":"left",O=d==="y"?"bottom":"right",b=p+l[v],A=p-l[O];p=Di(b,p,A)}if(i){const v=f==="y"?"top":"left",O=f==="y"?"bottom":"right",b=h+l[v],A=h-l[O];h=Di(b,h,A)}const m=c.fn({...t,[d]:p,[f]:h});return{...m,data:{x:m.x-n,y:m.y-r,enabled:{[d]:s,[f]:i}}}}}},fy=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}=Pn(e,t),l=await Qo(t,u),f=dn(o),d=Zn(o),p=Gt(o)==="y",{width:h,height:m}=s.floating;let v,O;f==="top"||f==="bottom"?(v=f,O=d===(await(i.isRTL==null?void 0:i.isRTL(c.floating))?"start":"end")?"left":"right"):(O=f,v=d==="end"?"top":"bottom");const b=m-l.top-l.bottom,A=h-l.left-l.right,k=Vt(m-l[v],b),R=Vt(h-l[O],A),D=!t.middlewareData.shift;let j=k,g=R;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(g=A),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(j=b),D&&!d){const P=Ie(l.left,0),N=Ie(l.right,0),I=Ie(l.top,0),$=Ie(l.bottom,0);p?g=h-2*(P!==0||N!==0?P+N:Ie(l.left,l.right)):j=m-2*(I!==0||$!==0?I+$: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 Al(e){const t=ot(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const o=ke(e),s=o?e.offsetWidth:n,i=o?e.offsetHeight:r,c=Lr(n)!==s||Lr(r)!==i;return c&&(n=s,r=i),{width:n,height:r,$:c}}function Hi(e){return ce(e)?e:e.contextElement}function Kn(e){const t=Hi(e);if(!ke(t))return Tt(1);const n=t.getBoundingClientRect(),{width:r,height:o,$:s}=Al(t);let i=(s?Lr(n.width):n.width)/r,c=(s?Lr(n.height):n.height)/o;return(!i||!Number.isFinite(i))&&(i=1),(!c||!Number.isFinite(c))&&(c=1),{x:i,y:c}}const dy=Tt(0);function Tl(e){const t=je(e);return!Vo()||!t.visualViewport?dy:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function py(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==je(e)?!1:t}function An(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const o=e.getBoundingClientRect(),s=Hi(e);let i=Tt(1);t&&(r?ce(r)&&(i=Kn(r)):i=Kn(e));const c=py(s,n,r)?Tl(s):Tt(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 d=je(s),p=r&&ce(r)?je(r):r;let h=d,m=Fi(h);for(;m&&r&&p!==h;){const v=Kn(m),O=m.getBoundingClientRect(),b=ot(m),A=O.left+(m.clientLeft+parseFloat(b.paddingLeft))*v.x,k=O.top+(m.clientTop+parseFloat(b.paddingTop))*v.y;a*=v.x,u*=v.y,l*=v.x,f*=v.y,a+=A,u+=k,h=je(m),m=Fi(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(At(e)).left+n}function Ol(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 hy(e){let{elements:t,rect:n,offsetParent:r,strategy:o}=e;const s=o==="fixed",i=At(r),c=t?Wo(t.floating):!1;if(r===i||c&&s)return n;let a={scrollLeft:0,scrollTop:0},u=Tt(1);const l=Tt(0),f=ke(r);if((f||!f&&!s)&&((qn(r)!=="body"||Br(i))&&(a=Go(r)),ke(r))){const p=An(r);u=Kn(r),l.x=p.x+r.clientLeft,l.y=p.y+r.clientTop}const d=i&&!f&&!s?Ol(i,a):Tt(0);return{width:n.width*u.x,height:n.height*u.y,x:n.x*u.x-a.scrollLeft*u.x+l.x+d.x,y:n.y*u.y-a.scrollTop*u.y+l.y+d.y}}function my(e){return Array.from(e.getClientRects())}function gy(e){const t=At(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 ot(r).direction==="rtl"&&(i+=Ie(t.clientWidth,r.clientWidth)-o),{width:o,height:s,x:i,y:c}}const Cl=25;function by(e,t){const n=je(e),r=At(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,d=getComputedStyle(f),p=l.compatMode==="CSS1Compat"&&parseFloat(d.marginLeft)+parseFloat(d.marginRight)||0,h=Math.abs(r.clientWidth-f.clientWidth-p);h<=Cl&&(s-=h)}else u<=Cl&&(s+=u);return{width:s,height:i,x:c,y:a}}const yy=new Set(["absolute","fixed"]);function vy(e,t){const n=An(e,!0,t==="fixed"),r=n.top+e.clientTop,o=n.left+e.clientLeft,s=ke(e)?Kn(e):Tt(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 Il(e,t,n){let r;if(t==="viewport")r=by(e,n);else if(t==="document")r=gy(At(e));else if(ce(t))r=vy(t,n);else{const o=Tl(e);r={x:t.x-o.x,y:t.y-o.y,width:t.width,height:t.height}}return Ko(r)}function Nl(e,t){const n=Wt(e);return n===t||!ce(n)||Ht(n)?!1:ot(n).position==="fixed"||Nl(n,t)}function wy(e,t){const n=t.get(e);if(n)return n;let r=fn(e,[],!1).filter(c=>ce(c)&&qn(c)!=="body"),o=null;const s=ot(e).position==="fixed";let i=s?Wt(e):e;for(;ce(i)&&!Ht(i);){const c=ot(i),a=Ri(i);!a&&c.position==="fixed"&&(o=null),(s?!a&&!o:!a&&c.position==="static"&&!!o&&yy.has(o.position)||Br(i)&&!a&&Nl(e,i))?r=r.filter(l=>l!==i):o=c,i=Wt(i)}return t.set(e,r),r}function xy(e){let{element:t,boundary:n,rootBoundary:r,strategy:o}=e;const i=[...n==="clippingAncestors"?Wo(t)?[]:wy(t,this._c):[].concat(n),r],c=i[0],a=i.reduce((u,l)=>{const f=Il(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},Il(t,c,o));return{width:a.right-a.left,height:a.bottom-a.top,x:a.left,y:a.top}}function Ey(e){const{width:t,height:n}=Al(e);return{width:t,height:n}}function Sy(e,t,n){const r=ke(t),o=At(t),s=n==="fixed",i=An(e,!0,s,t);let c={scrollLeft:0,scrollTop:0};const a=Tt(0);function u(){a.x=Jo(o)}if(r||!r&&!s)if((qn(t)!=="body"||Br(o))&&(c=Go(t)),r){const p=An(t,!0,s,t);a.x=p.x+t.clientLeft,a.y=p.y+t.clientTop}else o&&u();s&&!r&&o&&u();const l=o&&!r&&!s?Ol(o,c):Tt(0),f=i.left+c.scrollLeft-a.x-l.x,d=i.top+c.scrollTop-a.y-l.y;return{x:f,y:d,width:i.width,height:i.height}}function Wi(e){return ot(e).position==="static"}function Ml(e,t){if(!ke(e)||ot(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return At(e)===n&&(n=n.ownerDocument.body),n}function kl(e,t){const n=je(e);if(Wo(e))return n;if(!ke(e)){let o=Wt(e);for(;o&&!Ht(o);){if(ce(o)&&!Wi(o))return o;o=Wt(o)}return n}let r=Ml(e,t);for(;r&&Eb(r)&&Wi(r);)r=Ml(r,t);return r&&Ht(r)&&Wi(r)&&!Ri(r)?n:r||Tb(e)||n}const $y=async function(e){const t=this.getOffsetParent||kl,n=this.getDimensions,r=await n(e.floating);return{reference:Sy(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function Py(e){return ot(e).direction==="rtl"}const Ay={convertOffsetParentRelativeRectToViewportRelativeRect:hy,getDocumentElement:At,getClippingRect:xy,getOffsetParent:kl,getElementRects:$y,getClientRects:my,getDimensions:Ey,getScale:Kn,isElement:ce,isRTL:Py};function Bl(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function Ty(e,t){let n=null,r;const o=At(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:d,height:p}=u;if(c||t(),!d||!p)return;const h=qo(f),m=qo(o.clientWidth-(l+d)),v=qo(o.clientHeight-(f+p)),O=qo(l),A={rootMargin:-h+"px "+-m+"px "+-v+"px "+-O+"px",threshold:Ie(0,Vt(1,a))||1};let k=!0;function R(D){const j=D[0].intersectionRatio;if(j!==a){if(!k)return i();j?i(!1,j):r=setTimeout(()=>{i(!1,1e-7)},1e3)}j===1&&!Bl(u,e.getBoundingClientRect())&&i(),k=!1}try{n=new IntersectionObserver(R,{...A,root:o.ownerDocument})}catch{n=new IntersectionObserver(R,A)}n.observe(e)}return i(!0),s}function Ll(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=Hi(e),l=o||s?[...u?fn(u):[],...fn(t)]:[];l.forEach(O=>{o&&O.addEventListener("scroll",n,{passive:!0}),s&&O.addEventListener("resize",n)});const f=u&&c?Ty(u,n):null;let d=-1,p=null;i&&(p=new ResizeObserver(O=>{let[b]=O;b&&b.target===u&&p&&(p.unobserve(t),cancelAnimationFrame(d),d=requestAnimationFrame(()=>{var A;(A=p)==null||A.observe(t)})),n()}),u&&!a&&p.observe(u),p.observe(t));let h,m=a?An(e):null;a&&v();function v(){const O=An(e);m&&!Bl(m,O)&&n(),m=O,h=requestAnimationFrame(v)}return n(),()=>{var O;l.forEach(b=>{o&&b.removeEventListener("scroll",n),s&&b.removeEventListener("resize",n)}),f==null||f(),(O=p)==null||O.disconnect(),p=null,a&&cancelAnimationFrame(h)}}const Vi=Qo,Oy=uy,Cy=ly,Iy=iy,Ny=fy,Rl=sy,My=(e,t,n)=>{const r=new Map,o={platform:Ay,...n},s={...o.platform,_c:r};return oy(e,t,{...o,platform:s})};var ky=typeof document<"u",By=function(){},es=ky?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 Fl(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Dl(e,t){const n=Fl(e);return Math.round(t*n)/n}function Gi(e){const t=U.useRef(e);return es(()=>{t.current=e}),t}function jl(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}),[d,p]=U.useState(r);ts(d,r)||p(r);const[h,m]=U.useState(null),[v,O]=U.useState(null),b=U.useCallback(y=>{y!==D.current&&(D.current=y,m(y))},[]),A=U.useCallback(y=>{y!==j.current&&(j.current=y,O(y))},[]),k=s||h,R=i||v,D=U.useRef(null),j=U.useRef(null),g=U.useRef(l),w=a!=null,P=Gi(a),N=Gi(o),I=Gi(u),$=U.useCallback(()=>{if(!D.current||!j.current)return;const y={placement:t,strategy:n,middleware:d};N.current&&(y.platform=N.current),My(D.current,j.current,y).then(M=>{const F={...M,isPositioned:I.current!==!1};S.current&&!ts(g.current,F)&&(g.current=F,Pr.flushSync(()=>{f(F)}))})},[d,t,n,N,I]);es(()=>{u===!1&&g.current.isPositioned&&(g.current.isPositioned=!1,f(y=>({...y,isPositioned:!1})))},[u]);const S=U.useRef(!1);es(()=>(S.current=!0,()=>{S.current=!1}),[]),es(()=>{if(k&&(D.current=k),R&&(j.current=R),k&&R){if(P.current)return P.current(k,R,$);$()}},[k,R,$,P,w]);const x=U.useMemo(()=>({reference:D,floating:j,setReference:b,setFloating:A}),[b,A]),T=U.useMemo(()=>({reference:k,floating:R}),[k,R]),C=U.useMemo(()=>{const y={position:n,left:0,top:0};if(!T.floating)return y;const M=Dl(T.floating,l.x),F=Dl(T.floating,l.y);return c?{...y,transform:"translate("+M+"px, "+F+"px)",...Fl(T.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:M,top:F}},[n,c,T.floating,l.x,l.y]);return U.useMemo(()=>({...l,update:$,refs:x,elements:T,floatingStyles:C}),[l,$,x,T,C])}const Ly=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?Rl({element:r.current,padding:o}).fn(n):{}:r?Rl({element:r,padding:o}).fn(n):{}}}},qi=(e,t)=>({...Oy(e),options:[e,t]}),_l=(e,t)=>({...Cy(e),options:[e,t]}),Ul=(e,t)=>({...Iy(e),options:[e,t]}),Ry=(e,t)=>({...Ny(e),options:[e,t]}),Fy=(e,t)=>({...Ly(e),options:[e,t]}),zl={...U},Dy=zl.useInsertionEffect||(e=>e());function Hl(e){const t=U.useRef(()=>{if(process.env.NODE_ENV!=="production")throw new Error("Cannot call an event handler while rendering.")});return Dy(()=>{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 Zi=typeof document<"u"?E.useLayoutEffect:E.useEffect;let Wl=!1,jy=0;const Vl=()=>"floating-ui-"+Math.random().toString(36).slice(2,6)+jy++;function _y(){const[e,t]=U.useState(()=>Wl?Vl():void 0);return Zi(()=>{e==null&&t(Vl())},[]),U.useEffect(()=>{Wl=!0},[]),e}const Uy=zl.useId||_y;let Fr;process.env.NODE_ENV!=="production"&&(Fr=new Set);function zy(){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 Wy(){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 Vy=U.createContext(null),Gy=U.createContext(null),qy=()=>{var e;return((e=U.useContext(Vy))==null?void 0:e.id)||null},Zy=()=>U.useContext(Gy),Ky="data-floating-ui-focusable";function Yy(e){const{open:t=!1,onOpenChange:n,elements:r}=e,o=Uy(),s=U.useRef({}),[i]=U.useState(()=>Wy()),c=qy()!=null;if(process.env.NODE_ENV!=="production"){const p=r.reference;p&&!ce(p)&&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=Hl((p,h,m)=>{s.current.openEvent=p?h:void 0,i.emit("openchange",{open:p,event:h,reason:m,nested:c}),n==null||n(p,h,m)}),f=U.useMemo(()=>({setPositionReference:u}),[]),d=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:d,events:i,floatingId:o,refs:f}),[t,l,d,i,o,f])}function Xy(e){e===void 0&&(e={});const{nodeId:t}=e,n=Yy({...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),d=Zy();Zi(()=>{l&&(f.current=l)},[l]);const p=jl({...e,elements:{...o,...c&&{reference:c}}}),h=U.useCallback(A=>{const k=ce(A)?{getBoundingClientRect:()=>A.getBoundingClientRect(),contextElement:A}:A;a(k),p.refs.setReference(k)},[p.refs]),m=U.useCallback(A=>{(ce(A)||A===null)&&(f.current=A,i(A)),(ce(p.refs.reference.current)||p.refs.reference.current===null||A!==null&&!ce(A))&&p.refs.setReference(A)},[p.refs]),v=U.useMemo(()=>({...p.refs,setReference:m,setPositionReference:h,domReference:f}),[p.refs,m,h]),O=U.useMemo(()=>({...p.elements,domReference:l}),[p.elements,l]),b=U.useMemo(()=>({...p,...r,refs:v,elements:O,nodeId:t}),[p,v,O,t,r]);return Zi(()=>{r.dataRef.current.floatingContext=b;const A=d==null?void 0:d.nodesRef.current.find(k=>k.id===t);A&&(A.context=b)}),U.useMemo(()=>({...p,context:b,refs:v,elements:O}),[p,v,O,b])}const Gl="active",ql="selected";function Ki(e,t,n){const r=new Map,o=n==="item";let s=e;if(o&&e){const{[Gl]:i,[ql]:c,...a}=e;s=a}return{...n==="floating"&&{tabIndex:-1,[Ky]:""},...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&&[Gl,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 d,p=arguments.length,h=new Array(p),m=0;m<p;m++)h[m]=arguments[m];return(d=r.get(u))==null?void 0:d.map(v=>v(...h)).find(v=>v!==void 0)}}}else i[u]=l}),i),{})}}function Qy(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=>Ki(c,e,"reference"),t),s=U.useCallback(c=>Ki(c,e,"floating"),n),i=U.useCallback(c=>Ki(c,e,"item"),r);return U.useMemo(()=>({getReferenceProps:o,getFloatingProps:s,getItemProps:i}),[o,s,i])}function Zl(e,t){return{...e,rects:{...e.rects,floating:{...e.rects.floating,height:t}}}}const Jy=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}=Pn(e,t),{rects:f,elements:{floating:d}}=t,p=n.current[i],h=(u==null?void 0:u.current)||d,m=d.clientTop||h.clientTop,v=d.clientTop!==0,O=h.clientTop!==0,b=d===h;if(process.env.NODE_ENV!=="production"&&(t.placement.startsWith("bottom")||zy('`placement` side must be "bottom" when using the `inner`',"middleware.")),!p)return{};const A={...t,...await qi(-p.offsetTop-d.clientTop-f.reference.height/2-p.offsetHeight/2-s).fn(t)},k=await Vi(Zl(A,h.scrollHeight+m+d.clientTop),l),R=await Vi(A,{...l,elementContext:"reference"}),D=Ie(0,k.top),j=A.y+D,P=(h.scrollHeight>h.clientHeight?N=>N:Lr)(Ie(0,h.scrollHeight+(v&&b||O?m*2:0)-D-Ie(0,k.bottom)));if(h.style.maxHeight=P+"px",h.scrollTop=D,o){const N=h.offsetHeight<p.offsetHeight*Vt(c,n.current.length)-1||R.top>=-a||R.bottom>=-a;Pr.flushSync(()=>o(N))}return r&&(r.current=await Vi(Zl({...A,y:j},h.offsetHeight+m+d.clientTop),l)),{y:j}}});function e1(e,t){const{open:n,elements:r}=e,{enabled:o=!0,overflowRef:s,scrollRef:i,onChange:c}=t,a=Hl(c),u=U.useRef(!1),l=U.useRef(null),f=U.useRef(null);U.useEffect(()=>{if(!o)return;function p(m){if(m.ctrlKey||!h||s.current==null)return;const v=m.deltaY,O=s.current.top>=-.5,b=s.current.bottom>=-.5,A=h.scrollHeight-h.clientHeight,k=v<0?-1:1,R=v<0?"max":"min";h.scrollHeight<=h.clientHeight||(!O&&v>0||!b&&v<0?(m.preventDefault(),Pr.flushSync(()=>{a(D=>D+Math[R](v,A*k))})):/firefox/i.test(Cb())&&(h.scrollTop+=v))}const h=(i==null?void 0:i.current)||r.floating;if(n&&h)return h.addEventListener("wheel",p),requestAnimationFrame(()=>{l.current=h.scrollTop,s.current!=null&&(f.current={...s.current})}),()=>{l.current=null,f.current=null,h.removeEventListener("wheel",p)}},[o,n,r.floating,s,i,a]);const d=U.useMemo(()=>({onKeyDown(){u.current=!0},onWheel(){u.current=!1},onPointerMove(){u.current=!1},onScroll(){const p=(i==null?void 0:i.current)||r.floating;if(!(!s.current||!p||!u.current)){if(l.current!==null){const h=p.scrollTop-l.current;(s.current.bottom<-.5&&h<-1||s.current.top<-.5&&h>1)&&Pr.flushSync(()=>a(m=>m+h))}requestAnimationFrame(()=>{l.current=p.scrollTop})}}}),[r.floating,a,s,i]);return U.useMemo(()=>o?{floating:d}:{},[o,d])}let Yn=E.createContext({styles:void 0,setReference:()=>{},setFloating:()=>{},getReferenceProps:()=>({}),getFloatingProps:()=>({}),slot:{}});Yn.displayName="FloatingContext";let Yi=E.createContext(null);Yi.displayName="PlacementContext";function t1(e){return E.useMemo(()=>e?typeof e=="string"?{to:e}:e:null,[e])}function n1(){return E.useContext(Yn).setReference}function r1(){return E.useContext(Yn).getReferenceProps}function o1(){let{getFloatingProps:e,slot:t}=E.useContext(Yn);return E.useCallback((...n)=>Object.assign({},e(...n),{"data-anchor":t.anchor}),[e,t])}function s1(e=null){e===!1&&(e=null),typeof e=="string"&&(e={to:e});let t=E.useContext(Yi),n=E.useMemo(()=>e,[JSON.stringify(e,(o,s)=>{var i;return(i=s==null?void 0:s.outerHTML)!=null?i:s})]);pe(()=>{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 Kl=4;function i1({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);a1(c);let u=t&&n!==null&&c!==null,{to:l="bottom",gap:f=0,offset:d=0,padding:p=0,inner:h}=c1(n,c),[m,v="center"]=l.split(" ");pe(()=>{u&&s(0)},[u]);let{refs:O,floatingStyles:b,context:A}=Xy({open:u,placement:m==="selection"?v==="center"?"bottom":`bottom-${v}`:v==="center"?`${m}`:`${m}-${v}`,strategy:"absolute",transform:!1,middleware:[qi({mainAxis:m==="selection"?0:f,crossAxis:d}),_l({padding:p}),m!=="selection"&&Ul({padding:p}),m==="selection"&&h?Jy({...h,padding:p,overflowRef:i,offset:o,minItemsVisible:Kl,referenceOverflowThreshold:p,onFallbackChange(N){var I,$;if(!N)return;let S=A.elements.floating;if(!S)return;let x=parseFloat(getComputedStyle(S).scrollPaddingBottom)||0,T=Math.min(Kl,S.childElementCount),C=0,y=0;for(let M of($=(I=A.elements.floating)==null?void 0:I.childNodes)!=null?$:[])if(zt(M)){let F=M.offsetTop,_=F+M.clientHeight+x,z=S.scrollTop,H=z+S.clientHeight;if(F>=z&&_<=H)T--;else{y=Math.max(0,Math.min(_,H)-Math.max(F,z)),C=M.clientHeight;break}}T>=1&&s(M=>{let F=C*T-y+x;return M>=F?M:F})}}):null,Ry({padding:p,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:Ll}),[k=m,R=v]=A.placement.split("-");m==="selection"&&(k="selection");let D=E.useMemo(()=>({anchor:[k,R].filter(Boolean).join(" ")}),[k,R]),j=e1(A,{overflowRef:i,onChange:s}),{getReferenceProps:g,getFloatingProps:w}=Qy([j]),P=ie(N=>{a(N),O.setFloating(N)});return U.createElement(Yi.Provider,{value:r},U.createElement(Yn.Provider,{value:{setFloating:P,setReference:O.setReference,styles:b,getReferenceProps:g,getFloatingProps:w,slot:D}},e))}function a1(e){pe(()=>{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 c1(e,t){var n,r,o;let s=Xi((n=e==null?void 0:e.gap)!=null?n:"var(--anchor-gap, 0)",t),i=Xi((r=e==null?void 0:e.offset)!=null?r:"var(--anchor-offset, 0)",t),c=Xi((o=e==null?void 0:e.padding)!=null?o:"var(--anchor-padding, 0)",t);return{...e,gap:s,offset:i,padding:c}}function Xi(e,t,n=void 0){let r=Wn(),o=ie((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=Xl(a,u);return[l,f=>{let d=Yl(a);{let p=d.map(h=>window.getComputedStyle(u).getPropertyValue(h));r.requestAnimationFrame(function h(){r.nextFrame(h);let m=!1;for(let[O,b]of d.entries()){let A=window.getComputedStyle(u).getPropertyValue(b);if(p[O]!==A){p[O]=A,m=!0;break}}if(!m)return;let v=Xl(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 pe(()=>{let[a,u]=o(e,t);if(c(a),!!u)return u(c)},[e,t]),i}function Yl(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,...Yl(o)]:[r]}return[]}function Xl(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 u1(e,t){let[n,r]=E.useState(t);return!e&&n!==t&&r(t),e?n:t}let Qi=E.createContext(null);Qi.displayName="OpenClosedContext";var dt=(e=>(e[e.Open=1]="Open",e[e.Closed=2]="Closed",e[e.Closing=4]="Closing",e[e.Opening=8]="Opening",e))(dt||{});function Ji(){return E.useContext(Qi)}function Ql({value:e,children:t}){return E.createElement(Qi.Provider,{value:e},t)}function l1(e){throw new Error("Unexpected object: "+e)}var ge=(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))(ge||{});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:l1(e)}}var Jl=(e=>(e[e.Left=0]="Left",e[e.Right=2]="Right",e))(Jl||{});function ef(e){let t=ie(e),n=E.useRef(!1);E.useEffect(()=>(n.current=!1,()=>{n.current=!0,Tu(()=>{n.current&&t()})}),[t])}function f1(){let e=typeof document>"u";return"useSyncExternalStore"in U?(t=>t.useSyncExternalStore)(U)(()=>()=>{},()=>!1,()=>!e):!1}function ea(){let e=f1(),[t,n]=U.useState($t.isHandoffComplete);return t&&$t.isHandoffComplete===!1&&n(!1),U.useEffect(()=>{t!==!0&&n(!0)},[t]),U.useEffect(()=>$t.handoff(),[]),e?!1:t}let d1=E.createContext(!1);function p1(){return E.useContext(d1)}function h1(e){let t=p1(),n=E.useContext(nf),[r,o]=E.useState(()=>{var s;if(!t&&n!==null)return(s=n.current)!=null?s:null;if($t.isServer)return null;let i=e==null?void 0:e.getElementById("headlessui-portal-root");if(i)return i;if(e===null)return null;let c=e.createElement("div");return c.setAttribute("id","headlessui-portal-root"),e.body.appendChild(c)});return 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 tf=E.Fragment,m1=De(function(e,t){let{ownerDocument:n=null,...r}=e,o=E.useRef(null),s=tt(bg(p=>{o.current=p}),t),i=ki(o),c=n??i,a=h1(c),[u]=E.useState(()=>{var p;return $t.isServer?null:(p=c==null?void 0:c.createElement("div"))!=null?p:null}),l=E.useContext(v1),f=ea();pe(()=>{!a||!u||a.contains(u)||(u.setAttribute("data-headlessui-portal",""),a.appendChild(u))},[a,u]),pe(()=>{if(u&&l)return l.register(u)},[l,u]),ef(()=>{var p;!a||!u||(wi(u)&&a.contains(u)&&a.removeChild(u),a.childNodes.length<=0&&((p=a.parentElement)==null||p.removeChild(a)))});let d=Ge();return f?!a||!u?null:Ne.createPortal(d({ourProps:{ref:s},theirProps:r,slot:{},defaultTag:tf,name:"Portal"}),u):null});function g1(e,t){let n=tt(t),{enabled:r=!0,ownerDocument:o,...s}=e,i=Ge();return r?E.createElement(m1,{...s,ownerDocument:o,ref:n}):i({ourProps:{ref:n},theirProps:s,slot:{},defaultTag:tf,name:"Portal"})}let b1=E.Fragment,nf=E.createContext(null);function y1(e,t){let{target:n,...r}=e,o={ref:tt(t)},s=Ge();return E.createElement(nf.Provider,{value:n},s({ourProps:o,theirProps:r,defaultTag:b1,name:"Popover.Group"}))}let v1=E.createContext(null),w1=De(g1),x1=De(y1),E1=Object.assign(w1,{Group:x1});function S1(){let e=E.useRef(!1);return pe(()=>(e.current=!0,()=>{e.current=!1}),[]),e}function rf(e){var t;return!!(e.enter||e.enterFrom||e.enterTo||e.leave||e.leaveFrom||e.leaveTo)||((t=e.as)!=null?t:sf)!==E.Fragment||E.Children.count(e.children)===1}let rs=E.createContext(null);rs.displayName="TransitionContext";var $1=(e=>(e.Visible="visible",e.Hidden="hidden",e))($1||{});function P1(){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 A1(){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 of(e,t){let n=Sn(e),r=E.useRef([]),o=S1(),s=Wn(),i=ie((p,h=un.Hidden)=>{let m=r.current.findIndex(({el:v})=>v===p);m!==-1&&(et(h,{[un.Unmount](){r.current.splice(m,1)},[un.Hidden](){r.current[m].state="hidden"}}),s.microTask(()=>{var v;!ss(r)&&o.current&&((v=n.current)==null||v.call(n))}))}),c=ie(p=>{let h=r.current.find(({el:m})=>m===p);return h?h.state!=="visible"&&(h.state="visible"):r.current.push({el:p,state:"visible"}),()=>i(p,un.Unmount)}),a=E.useRef([]),u=E.useRef(Promise.resolve()),l=E.useRef({enter:[],leave:[]}),f=ie((p,h,m)=>{a.current.splice(0),t&&(t.chains.current[h]=t.chains.current[h].filter(([v])=>v!==p)),t==null||t.chains.current[h].push([p,new Promise(v=>{a.current.push(v)})]),t==null||t.chains.current[h].push([p,new Promise(v=>{Promise.all(l.current[h].map(([O,b])=>b)).then(()=>v())})]),h==="enter"?u.current=u.current.then(()=>t==null?void 0:t.wait.current).then(()=>m(h)):m(h)}),d=ie((p,h,m)=>{Promise.all(l.current[h].splice(0).map(([v,O])=>O)).then(()=>{var v;(v=a.current.shift())==null||v()}).then(()=>m(h))});return E.useMemo(()=>({children:r,register:c,unregister:i,onStart:f,onStop:d,wait:u,chains:l}),[c,i,r,f,d,l,u])}let sf=E.Fragment,af=Do.RenderStrategy;function T1(e,t){var n,r;let{transition:o=!0,beforeEnter:s,afterEnter:i,beforeLeave:c,afterLeave:a,enter:u,enterFrom:l,enterTo:f,entered:d,leave:p,leaveFrom:h,leaveTo:m,...v}=e,[O,b]=E.useState(null),A=E.useRef(null),k=rf(e),R=tt(...k?[A,t,b]:t===null?[]:[t]),D=(n=v.unmount)==null||n?un.Unmount:un.Hidden,{show:j,appear:g,initial:w}=P1(),[P,N]=E.useState(j?"visible":"hidden"),I=A1(),{register:$,unregister:S}=I;pe(()=>$(A),[$,A]),pe(()=>{if(D===un.Hidden&&A.current){if(j&&P!=="visible"){N("visible");return}return et(P,{hidden:()=>S(A),visible:()=>$(A)})}},[P,A,$,S,j,D]);let x=ea();pe(()=>{if(k&&x&&P==="visible"&&A.current===null)throw new Error("Did you forget to passthrough the `ref` to the actual DOM node?")},[A,P,x,k]);let T=w&&!g,C=g&&j&&w,y=E.useRef(!1),M=of(()=>{y.current||(N("hidden"),S(A))},I),F=ie(q=>{y.current=!0;let Q=q?"enter":"leave";M.onStart(A,Q,te=>{te==="enter"?s==null||s():te==="leave"&&(c==null||c())})}),_=ie(q=>{let Q=q?"enter":"leave";y.current=!1,M.onStop(A,Q,te=>{te==="enter"?i==null||i():te==="leave"&&(a==null||a())}),Q==="leave"&&!ss(M)&&(N("hidden"),S(A))});E.useEffect(()=>{k&&o||(F(j),_(j))},[j,k,o]);let z=!(!o||!k||!x||T),[,H]=dl(z,O,j,{start:F,end:_}),K=ln({ref:R,className:((r=bi(v.className,C&&u,C&&l,H.enter&&u,H.enter&&H.closed&&l,H.enter&&!H.closed&&f,H.leave&&p,H.leave&&!H.closed&&h,H.leave&&H.closed&&m,!H.transition&&j&&d))==null?void 0:r.trim())||void 0,...fl(H)}),W=0;P==="visible"&&(W|=dt.Open),P==="hidden"&&(W|=dt.Closed),j&&P==="hidden"&&(W|=dt.Opening),!j&&P==="visible"&&(W|=dt.Closing);let Z=Ge();return E.createElement(os.Provider,{value:M},E.createElement(Ql,{value:W},Z({ourProps:K,theirProps:v,defaultTag:sf,features:af,visible:P==="visible",name:"Transition.Child"})))}function O1(e,t){let{show:n,appear:r=!1,unmount:o=!0,...s}=e,i=E.useRef(null),c=rf(e),a=tt(...c?[i,t]:t===null?[]:[t]);ea();let u=Ji();if(n===void 0&&u!==null&&(n=(u&dt.Open)===dt.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"),d=of(()=>{n||f("hidden")}),[p,h]=E.useState(!0),m=E.useRef([n]);pe(()=>{p!==!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:p}),[n,r,p]);pe(()=>{n?f("visible"):!ss(d)&&i.current!==null&&f("hidden")},[n,d]);let O={unmount:o},b=ie(()=>{var R;p&&h(!1),(R=e.beforeEnter)==null||R.call(e)}),A=ie(()=>{var R;p&&h(!1),(R=e.beforeLeave)==null||R.call(e)}),k=Ge();return E.createElement(os.Provider,{value:d},E.createElement(rs.Provider,{value:v},k({ourProps:{...O,as:E.Fragment,children:E.createElement(cf,{ref:a,...O,...s,beforeEnter:b,beforeLeave:A})},theirProps:{},defaultTag:E.Fragment,features:af,visible:l==="visible",name:"Transition"})))}function C1(e,t){let n=E.useContext(rs)!==null,r=Ji()!==null;return E.createElement(E.Fragment,null,!n&&r?E.createElement(ta,{ref:t,...e}):E.createElement(cf,{ref:t,...e}))}let ta=De(O1),cf=De(T1),I1=De(C1),N1=Object.assign(ta,{Child:I1,Root:ta});function M1(e,t){let n=E.useRef({left:0,top:0});if(pe(()=>{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 uf=/([\u2700-\u27BF]|[\uE000-\uF8FF]|\uD83C[\uDC00-\uDFFF]|\uD83D[\uDC00-\uDFFF]|[\u2011-\u26FF]|\uD83E[\uDD10-\uDDFF])/g;function lf(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 uf.test(i)&&(i=i.replace(uf,"")),i}function k1(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():lf(s).trim()}return null}).filter(Boolean);if(r.length>0)return r.join(", ")}return lf(e).trim()}function B1(e){let t=E.useRef(""),n=E.useRef("");return ie(()=>{let r=e.current;if(!r)return"";let o=r.innerText;if(t.current===o)return n.current;let s=k1(r).trim().toLowerCase();return t.current=o,n.current=s,s})}var L1=Object.defineProperty,R1=(e,t,n)=>t in e?L1(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,ff=(e,t,n)=>(R1(e,typeof t!="symbol"?t+"":t,n),n),Oe=(e=>(e[e.Open=0]="Open",e[e.Closed=1]="Closed",e))(Oe||{}),Ot=(e=>(e[e.Single=0]="Single",e[e.Multi=1]="Multi",e))(Ot||{}),is=(e=>(e[e.Pointer=0]="Pointer",e[e.Other=1]="Other",e))(is||{}),df=(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))(df||{});function pf(e,t=n=>n){let n=e.activeOptionIndex!==null?e.options[e.activeOptionIndex]:null,r=rl(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 F1={1(e){return e.dataRef.current.disabled||e.listboxState===1?e:{...e,activeOptionIndex:null,pendingFocus:{focus:ge.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===ge.Nothing)return{...c,activeOptionIndex:null};if(t.focus===ge.Specific)return{...c,activeOptionIndex:e.options.findIndex(l=>l.id===t.id)};if(t.focus===ge.Previous){let l=e.activeOptionIndex;if(l!==null){let f=e.options[l].dataRef.current.domRef,d=ns(t,{resolveItems:()=>e.options,resolveActiveIndex:()=>e.activeOptionIndex,resolveId:p=>p.id,resolveDisabled:p=>p.dataRef.current.disabled});if(d!==null){let p=e.options[d].dataRef.current.domRef;if(((r=f.current)==null?void 0:r.previousElementSibling)===p.current||((o=p.current)==null?void 0:o.previousElementSibling)===null)return{...c,activeOptionIndex:d}}}}else if(t.focus===ge.Next){let l=e.activeOptionIndex;if(l!==null){let f=e.options[l].dataRef.current.domRef,d=ns(t,{resolveItems:()=>e.options,resolveActiveIndex:()=>e.activeOptionIndex,resolveId:p=>p.id,resolveDisabled:p=>p.dataRef.current.disabled});if(d!==null){let p=e.options[d].dataRef.current.domRef;if(((s=f.current)==null?void 0:s.nextElementSibling)===p.current||((i=p.current)==null?void 0:i.nextElementSibling)===null)return{...c,activeOptionIndex:d}}}}let a=pf(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!==ge.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:ge.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,...pf(e),pendingShouldSort:!1}:e};class na extends Vu{constructor(t){super(t),ff(this,"actions",{onChange:n=>{let{onChange:r,compare:o,mode:s,value:i}=this.state.dataRef.current;return et(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:$i(()=>{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:$i(()=>{let n=[];return[r=>n.push(r),()=>{this.send({type:6,options:n.splice(0)})}]}),goToOption:$i(()=>{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:ge.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})}}),ff(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=Pi.get(null);this.disposables.add(r.on(Ku.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 na({id:t,dataRef:{current:{}},listboxState:n?0:1,options:[],searchQuery:"",activeOptionIndex:null,activationTrigger:1,buttonElement:null,optionsElement:null,pendingShouldSort:!1,pendingFocus:{focus:ge.Nothing},__demoMode:n})}reduce(t,n){return et(n.type,F1,t,n)}}const hf=E.createContext(null);function ra(e){let t=E.useContext(hf);if(t===null){let n=new Error(`<${e} /> is missing a parent <Listbox /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,mf),n}return t}function mf({id:e,__demoMode:t=!1}){let n=E.useMemo(()=>na.new({id:e,__demoMode:t}),[]);return ef(()=>n.dispose()),n}let as=E.createContext(null);as.displayName="ListboxDataContext";function Dr(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,Dr),n}return t}let D1=E.Fragment;function j1(e,t){let n=E.useId(),r=gi(),{value:o,defaultValue:s,form:i,name:c,onChange:a,by:u,invalid:l=!1,disabled:f=r||!1,horizontal:d=!1,multiple:p=!1,__demoMode:h=!1,...m}=e;const v=d?"horizontal":"vertical";let O=tt(t),b=ng(s),[A=p?[]:void 0,k]=tg(o,a,b),R=mf({id:n,__demoMode:h}),D=E.useRef({static:!1,hold:!1}),j=E.useRef(new Map),g=Og(u),w=E.useCallback(z=>et(P.mode,{[Ot.Multi]:()=>A.some(H=>g(H,z)),[Ot.Single]:()=>g(A,z)}),[A]),P=E.useMemo(()=>({value:A,disabled:f,invalid:l,mode:p?Ot.Multi:Ot.Single,orientation:v,onChange:k,compare:g,isSelected:w,optionsPropsRef:D,listRef:j}),[A,f,l,p,v,k,g,w,D,j]);pe(()=>{R.state.dataRef.current=P},[P]);let N=rt(R,z=>z.listboxState),I=Pi.get(null),$=rt(I,E.useCallback(z=>I.selectors.isTop(z,n),[I,n])),[S,x]=rt(R,z=>[z.buttonElement,z.optionsElement]);tb($,[S,x],(z,H)=>{R.send({type:df.CloseListbox}),nl(H,Mi.Loose)||(z.preventDefault(),S==null||S.focus())});let T=E.useMemo(()=>({open:N===Oe.Open,disabled:f,invalid:l,value:A}),[N,f,l,A]),[C,y]=Eg({inherit:!0}),M={ref:O},F=E.useCallback(()=>{if(b!==void 0)return k==null?void 0:k(b)},[k,b]),_=Ge();return E.createElement(y,{value:C,props:{htmlFor:S==null?void 0:S.id},slot:{open:N===Oe.Open,disabled:f}},E.createElement(i1,null,E.createElement(hf.Provider,{value:R},E.createElement(as.Provider,{value:P},E.createElement(Ql,{value:et(N,{[Oe.Open]:dt.Open,[Oe.Closed]:dt.Closed})},c!=null&&A!=null&&E.createElement(cg,{disabled:f,data:{[c]:A},form:i,onReset:F}),_({ourProps:M,theirProps:m,slot:T,defaultTag:D1,name:"Listbox"}))))))}let _1="button";function U1(e,t){let n=E.useId(),r=Bu(),o=Dr("Listbox.Button"),s=ra("Listbox.Button"),{id:i=r||`headlessui-listbox-button-${n}`,disabled:c=o.disabled||!1,autoFocus:a=!1,...u}=e,l=tt(t,n1(),s.actions.setButtonElement),f=r1(),[d,p,h]=rt(s,y=>[y.listboxState,y.buttonElement,y.optionsElement]),m=d===Oe.Open;ob(m,{trigger:p,action:E.useCallback(y=>{if(p!=null&&p.contains(y.target))return zo.Ignore;let M=y.target.closest('[role="option"]:not([data-disabled])');return zt(M)?zo.Select(M):h!=null&&h.contains(y.target)?zo.Ignore:zo.Close},[p,h]),close:s.actions.closeListbox,select:s.actions.selectActiveOption});let v=ie(y=>{switch(y.key){case Te.Enter:rg(y.currentTarget);break;case Te.Space:case Te.ArrowDown:y.preventDefault(),s.actions.openListbox({focus:o.value?ge.Nothing:ge.First});break;case Te.ArrowUp:y.preventDefault(),s.actions.openListbox({focus:o.value?ge.Nothing:ge.Last});break}}),O=ie(y=>{switch(y.key){case Te.Space:y.preventDefault();break}}),b=ie(y=>{var M;if(y.button===Jl.Left){if(mg(y.currentTarget))return y.preventDefault();s.state.listboxState===Oe.Open?(Ne.flushSync(()=>s.actions.closeListbox()),(M=s.state.buttonElement)==null||M.focus({preventScroll:!0})):(y.preventDefault(),s.actions.openListbox({focus:ge.Nothing}))}}),A=E.useRef(null),k=ie(y=>{A.current=y.pointerType,y.pointerType==="mouse"&&b(y)}),R=ie(y=>{A.current!=="mouse"&&b(y)}),D=ie(y=>y.preventDefault()),j=Uu([i]),g=yg(),{isFocusVisible:w,focusProps:P}=Hm({autoFocus:a}),{isHovered:N,hoverProps:I}=zm({isDisabled:c}),{pressed:$,pressProps:S}=Km({disabled:c}),x=E.useMemo(()=>({open:d===Oe.Open,active:$||d===Oe.Open,disabled:c,invalid:o.invalid,value:o.value,hover:N,focus:w,autofocus:a}),[d,o.value,c,N,w,$,o.invalid,a]),T=rt(s,y=>y.listboxState===Oe.Open),C=Cu(f(),{ref:l,id:i,type:sb(e,p),"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:O,onKeyPress:D,onPointerDown:k,onClick:R},P,I,S);return Ge()({ourProps:C,theirProps:u,slot:x,defaultTag:_1,name:"Listbox.Button"})}let gf=E.createContext(!1),z1="div",H1=Do.RenderStrategy|Do.Static;function W1(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=t1(o),[l,f]=E.useState(null);u&&(s=!0);let d=Dr("Listbox.Options"),p=ra("Listbox.Options"),[h,m,v,O]=rt(p,q=>[q.listboxState,q.buttonElement,q.optionsElement,q.__demoMode]),b=ki(m),A=ki(v),k=Ji(),[R,D]=dl(c,l,k!==null?(k&dt.Open)===dt.Open:h===Oe.Open);Hg(R,m,p.actions.closeListbox);let j=O?!1:i&&h===Oe.Open;pb(j,A);let g=O?!1:i&&h===Oe.Open;zg(g,{allowed:E.useCallback(()=>[m,v],[m,v])});let w=h!==Oe.Open,P=M1(w,m)?!1:R,N=R&&h===Oe.Closed,I=u1(N,d.value),$=ie(q=>d.compare(I,q)),S=rt(p,q=>{var Q;if(u==null||!((Q=u==null?void 0:u.to)!=null&&Q.includes("selection")))return null;let te=q.options.findIndex(ue=>$(ue.dataRef.current.value));return te===-1&&(te=0),te}),x=(()=>{if(u==null)return;if(S===null)return{...u,inner:void 0};let q=Array.from(d.listRef.current.values());return{...u,inner:{listRef:{current:q},index:S}}})(),[T,C]=s1(x),y=o1(),M=tt(t,u?T:null,p.actions.setOptionsElement,f),F=Wn();E.useEffect(()=>{var q;let Q=v;Q&&h===Oe.Open&&Q!==((q=Ir(Q))==null?void 0:q.activeElement)&&(Q==null||Q.focus({preventScroll:!0}))},[h,v]);let _=ie(q=>{var Q,te;switch(F.dispose(),q.key){case Te.Space:if(p.state.searchQuery!=="")return q.preventDefault(),q.stopPropagation(),p.actions.search(q.key);case Te.Enter:if(q.preventDefault(),q.stopPropagation(),p.state.activeOptionIndex!==null){let{dataRef:ue}=p.state.options[p.state.activeOptionIndex];p.actions.onChange(ue.current.value)}d.mode===Ot.Single&&(Ne.flushSync(()=>p.actions.closeListbox()),(Q=p.state.buttonElement)==null||Q.focus({preventScroll:!0}));break;case et(d.orientation,{vertical:Te.ArrowDown,horizontal:Te.ArrowRight}):return q.preventDefault(),q.stopPropagation(),p.actions.goToOption({focus:ge.Next});case et(d.orientation,{vertical:Te.ArrowUp,horizontal:Te.ArrowLeft}):return q.preventDefault(),q.stopPropagation(),p.actions.goToOption({focus:ge.Previous});case Te.Home:case Te.PageUp:return q.preventDefault(),q.stopPropagation(),p.actions.goToOption({focus:ge.First});case Te.End:case Te.PageDown:return q.preventDefault(),q.stopPropagation(),p.actions.goToOption({focus:ge.Last});case Te.Escape:q.preventDefault(),q.stopPropagation(),Ne.flushSync(()=>p.actions.closeListbox()),(te=p.state.buttonElement)==null||te.focus({preventScroll:!0});return;case Te.Tab:q.preventDefault(),q.stopPropagation(),Ne.flushSync(()=>p.actions.closeListbox()),Xg(p.state.buttonElement,q.shiftKey?Ni.Previous:Ni.Next);break;default:q.key.length===1&&(p.actions.search(q.key),F.setTimeout(()=>p.actions.clearSearch(),350));break}}),z=rt(p,q=>{var Q;return(Q=q.buttonElement)==null?void 0:Q.id}),H=E.useMemo(()=>({open:h===Oe.Open}),[h]),K=Cu(u?y():{},{id:r,ref:M,"aria-activedescendant":rt(p,p.selectors.activeDescendantId),"aria-multiselectable":d.mode===Ot.Multi?!0:void 0,"aria-labelledby":z,"aria-orientation":d.orientation,onKeyDown:_,role:"listbox",tabIndex:h===Oe.Open?0:void 0,style:{...a.style,...C,"--button-width":Ig(m,!0).width},...fl(D)}),W=Ge(),Z=E.useMemo(()=>d.mode===Ot.Multi?d:{...d,isSelected:$},[d,$]);return E.createElement(E1,{enabled:s?e.static||R:!1,ownerDocument:b},E.createElement(as.Provider,{value:Z},W({ourProps:K,theirProps:a,slot:H,defaultTag:z1,features:H1,visible:P,name:"Listbox.Options"})))}let V1="div";function G1(e,t){let n=E.useId(),{id:r=`headlessui-listbox-option-${n}`,disabled:o=!1,value:s,...i}=e,c=E.useContext(gf)===!0,a=Dr("Listbox.Option"),u=ra("Listbox.Option"),l=rt(u,P=>u.selectors.isActive(P,r)),f=a.isSelected(s),d=E.useRef(null),p=B1(d),h=Sn({disabled:o,value:s,domRef:d,get textValue(){return p()}}),m=tt(t,d,P=>{P?a.listRef.current.set(r,P):a.listRef.current.delete(r)}),v=rt(u,P=>u.selectors.shouldScrollIntoView(P,r));pe(()=>{if(v)return ft().requestAnimationFrame(()=>{var P,N;(N=(P=d.current)==null?void 0:P.scrollIntoView)==null||N.call(P,{block:"nearest"})})},[v,d]),pe(()=>{if(!c)return u.actions.registerOption(r,h),()=>u.actions.unregisterOption(r)},[h,r,c]);let O=ie(P=>{var N;if(o)return P.preventDefault();u.actions.onChange(s),a.mode===Ot.Single&&(Ne.flushSync(()=>u.actions.closeListbox()),(N=u.state.buttonElement)==null||N.focus({preventScroll:!0}))}),b=ie(()=>{if(o)return u.actions.goToOption({focus:ge.Nothing});u.actions.goToOption({focus:ge.Specific,id:r})}),A=hb(),k=ie(P=>A.update(P)),R=ie(P=>{A.wasMoved(P)&&(o||l&&u.state.activationTrigger===is.Pointer||u.actions.goToOption({focus:ge.Specific,id:r},is.Pointer))}),D=ie(P=>{A.wasMoved(P)&&(o||l&&u.state.activationTrigger===is.Pointer&&u.actions.goToOption({focus:ge.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:O,onFocus:b,onPointerEnter:k,onMouseEnter:k,onPointerMove:R,onMouseMove:R,onPointerLeave:D,onMouseLeave:D},w=Ge();return!f&&c?null:w({ourProps:g,theirProps:i,slot:j,defaultTag:V1,name:"Listbox.Option"})}let q1=E.Fragment;function Z1(e,t){let{options:n,placeholder:r,...o}=e,s={ref:tt(t)},i=Dr("ListboxSelectedOption"),c=E.useMemo(()=>({}),[]),a=i.value===void 0||i.value===null||i.mode===Ot.Multi&&Array.isArray(i.value)&&i.value.length===0,u=Ge();return E.createElement(gf.Provider,{value:!0},u({ourProps:s,theirProps:{...o,children:E.createElement(E.Fragment,null,r&&a?r:n)},slot:c,defaultTag:q1,name:"ListboxSelectedOption"}))}let K1=De(j1),Y1=De(U1),X1=Ag,Q1=De(W1),J1=De(G1),ev=De(Z1),cs=Object.assign(K1,{Button:Y1,Label:X1,Options:Q1,Option:J1,SelectedOption:ev});const tv=()=>B.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",children:[B.jsx("g",{clipPath:"url(#clip0_active)",children:B.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"})}),B.jsx("defs",{children:B.jsx("clipPath",{id:"clip0_active",children:B.jsx("rect",{width:"12",height:"12",fill:"white",transform:"translate(0 0.0454102)"})})})]}),nv=()=>B.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",children:[B.jsx("g",{clipPath:"url(#clip0_inactive)",children:B.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"})}),B.jsx("defs",{children:B.jsx("clipPath",{id:"clip0_inactive",children:B.jsx("rect",{width:"12",height:"12",fill:"white",transform:"translate(0 0.0454102)"})})})]}),jr=({selectedLevel:e,maxLevel:t,className:n=""})=>{const r=Array.from({length:t},(o,s)=>s+1);return B.jsx("div",{className:`flex items-center ${n}`,children:r.map(o=>B.jsx("div",{className:"flex items-center justify-center",children:o>t-e?B.jsx(tv,{}):B.jsx(nv,{})},o))})};class pt{}Io(pt,"FAST",3),Io(pt,"Medium",2),Io(pt,"SLOW",1),Io(pt,"NONE",0);const rv=Object.values({MAINNET:1,SEPOLIA:11155111}),Ct=e=>{const t=typeof e=="string"?parseInt(e,10):e;return rv.includes(t)},ov={USDT:!0},bf=(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:!ov[t.toUpperCase()]:!0},sv=({chains:e,selectedChain:t,onChainChange:n,disabled:r=!1,className:o="",walletType:s="mpc"})=>{const{t:i}=_t();return B.jsx("div",{className:`relative ${o}`,children:B.jsx(cs,{value:t,onChange:n,disabled:r,children:({open:c})=>B.jsxs(B.Fragment,{children:[B.jsxs(cs.Button,{className:`
84
84
  relative w-full h-9 text-text-primary bg-fill-input-primary
85
85
  items-center justify-between flex px-3 rounded-lg
86
86
  focus:outline-none
87
87
  ${r?"opacity-50 cursor-not-allowed":"cursor-pointer hover:bg-fill-btn-secondary-hover"}
88
88
  ${c?"ring-1 ring-white":""}
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:`
89
+ `,children:[B.jsx("span",{className:"text-sm leading-[18px] font-medium",children:i("deposit.chain")}),B.jsxs("div",{className:"flex items-center space-x-2",children:[t.chainIconUrl?B.jsx("img",{src:t.chainIconUrl,alt:t.chain,className:"w-4 h-4 rounded-full"}):B.jsx("div",{className:"w-4 h-4 rounded-full bg-blue-500 flex items-center justify-center",children:B.jsx("span",{className:"text-xs text-white font-bold",children:t.chain.charAt(0)})}),B.jsx("span",{className:"text-sm text-white ml-1",children:t.chain}),B.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:[B.jsx("g",{clipPath:"url(#clip0_12919_27745)",children:B.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"})}),B.jsx("defs",{children:B.jsx("clipPath",{id:"clip0_12919_27745",children:B.jsx("rect",{width:"10",height:"10",fill:"white",transform:"translate(0 0.955078)"})})})]})]})]}),B.jsx(N1,{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:B.jsx(cs.Options,{className:`
90
90
  absolute z-50 mt-1 w-full max-h-60 overflow-auto rounded-lg
91
91
  bg-fill-input-primary border border-line-divider-secondary shadow-lg
92
92
  focus:outline-none
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};/**
93
+ `,children:e.filter(a=>a[s==="mpc"?"allowAaDeposit":"allowDeposit"]!==!1).map(a=>B.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})=>B.jsxs("div",{className:"flex items-center justify-between",children:[B.jsxs("div",{className:"flex items-center space-x-3",children:[a.chainIconUrl?B.jsx("img",{src:a.chainIconUrl,alt:a.chain,className:"w-5 h-5 rounded-full"}):B.jsx("div",{className:"w-5 h-5 rounded-full bg-blue-500 flex items-center justify-center",children:B.jsx("span",{className:"text-xs text-white font-bold",children:a.chain.charAt(0)})}),B.jsx("div",{className:"flex flex-col",children:B.jsx("span",{className:`text-sm font-medium ${u||l?"text-text-primary":"text-text-tertiary"}`,children:a.chain})})]}),B.jsx("div",{className:"w-12 bg-fill-page-secondary p-1 h-5 flex rounded",children:B.jsx(jr,{className:"w-full justify-between",selectedLevel:Ct(a.chainId)?pt.SLOW:pt.FAST,maxLevel:3})})]})},a.chainId))})})]})})})},yf=({currentActiveChain:e,chainList:t,onChainChange:n,curSelectToken:r,onTokenChange:o,walletType:s=wn,txType:i="deposit"})=>{const c=E.useCallback(m=>i==="withdraw"?s===wn?m.allowAaWithdraw!==!1:m.allowWithdraw!==!1:s===wn?m.allowAaDeposit!==!1:m.allowDeposit!==!1,[i,s]),a=E.useMemo(()=>{const m=new Set,v=[];for(const O of t)if(c(O))for(const b of O.tokenList||[]){const A=b.symbol||b.token;A&&(m.has(A)||(m.add(A),v.push({token:A,symbol:A,iconUrl:b.iconUrl,decimals:b.decimals,tokenAddress:b.tokenAddress})))}return v},[t,c]),u=m=>{n(m.chainId)},l=m=>{const v=m.symbol||m.token;o(v);const O=[];for(const b of t){if(!c(b))continue;(b.tokenList||[]).some(k=>(k.symbol||k.token)===v)&&O.push(b.chainId)}!O.includes(e.chainId)&&O[0]!==void 0&&n(O[0])},f=E.useMemo(()=>{var O,b;const m=r||((O=a[0])==null?void 0:O.symbol)||((b=a[0])==null?void 0:b.token);if(!m)return[];const v=[];for(const A of t){if(!c(A))continue;const k=(A.tokenList||[]).find(R=>(R.symbol||R.token)===m);k&&v.push({...A,tokenList:[{token:k.token,symbol:k.symbol,iconUrl:k.iconUrl,decimals:k.decimals,tokenAddress:k.tokenAddress}]})}return v},[t,r,a,c]),d=E.useMemo(()=>f.find(m=>m.chainId===e.chainId)||f[0],[f,e.chainId]),p=E.useMemo(()=>a,[a]),h=E.useMemo(()=>{if(p.length!==0)return p.find(m=>m.token===r||m.symbol===r)||p[0]},[p,r]);return E.useEffect(()=>{if(p.length===0)return;if(!p.some(v=>(v.symbol||v.token)===r)){const v=p[0];o(v.symbol||v.token)}},[p,r,o]),E.useEffect(()=>{if(f.length===0)return;f.some(v=>v.chainId===e.chainId)||n(f[0].chainId)},[f,e.chainId,n]),B.jsxs("div",{className:"space-y-4",children:[p.length>0&&h&&B.jsx(vm,{tokens:p,selectedToken:h,onTokenChange:l}),B.jsx(sv,{chains:f,selectedChain:d,onChainChange:m=>{const v=t.find(O=>O.chainId===m.chainId);v&&u(v)},walletType:s,className:"w-full"})]})};var us={},iv=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()}},av=iv,vf={"text/plain":"Text","text/html":"Url",default:"Text"},cv="Copy to clipboard: #{key}, Enter";function uv(e){var t=(/mac os x/i.test(navigator.userAgent)?"⌘":"Ctrl")+"+C";return e.replace(/#{\s*key\s*}/g,t)}function lv(e,t){var n,r,o,s,i,c,a=!1;t||(t={}),n=t.debug||!1;try{o=av(),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=vf[t.format]||vf.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=uv("message"in t?t.message:cv),window.prompt(r,e)}}finally{i&&(typeof i.removeRange=="function"?i.removeRange(s):i.removeAllRanges()),c&&document.body.removeChild(c),o()}return a}var fv=lv;function oa(e){"@babel/helpers - typeof";return oa=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},oa(e)}Object.defineProperty(us,"__esModule",{value:!0}),us.CopyToClipboard=void 0;var ls=wf(E),dv=wf(fv),pv=["text","onCopy","options","children"];function wf(e){return e&&e.__esModule?e:{default:e}}function xf(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 Ef(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?xf(Object(n),!0).forEach(function(r){ia(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):xf(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function hv(e,t){if(e==null)return{};var n=mv(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 mv(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 gv(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function bv(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 yv(e,t,n){return t&&bv(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function vv(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&&sa(e,t)}function sa(e,t){return sa=Object.setPrototypeOf||function(r,o){return r.__proto__=o,r},sa(e,t)}function wv(e){var t=Ev();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 xv(this,o)}}function xv(e,t){if(t&&(oa(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Sf(e)}function Sf(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Ev(){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 ia(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var $f=function(e){vv(n,e);var t=wv(n);function n(){var r;gv(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)),ia(Sf(r),"onClick",function(c){var a=r.props,u=a.text,l=a.onCopy,f=a.children,d=a.options,p=ls.default.Children.only(f),h=(0,dv.default)(u,d);l&&l(u,h),p&&p.props&&typeof p.props.onClick=="function"&&p.props.onClick(c)}),r}return yv(n,[{key:"render",value:function(){var o=this.props;o.text,o.onCopy,o.options;var s=o.children,i=hv(o,pv),c=ls.default.Children.only(s);return ls.default.cloneElement(c,Ef(Ef({},i),{},{onClick:this.onClick}))}}]),n}(ls.default.PureComponent);us.CopyToClipboard=$f,ia($f,"defaultProps",{onCopy:void 0,options:void 0});var Sv=us,aa=Sv.CopyToClipboard;aa.CopyToClipboard=aa;var $v=aa;const Pv=X0($v);var Av=Object.defineProperty,ds=Object.getOwnPropertySymbols,Pf=Object.prototype.hasOwnProperty,Af=Object.prototype.propertyIsEnumerable,Tf=(e,t,n)=>t in e?Av(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,ca=(e,t)=>{for(var n in t||(t={}))Pf.call(t,n)&&Tf(e,n,t[n]);if(ds)for(var n of ds(t))Af.call(t,n)&&Tf(e,n,t[n]);return e},ua=(e,t)=>{var n={};for(var r in e)Pf.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&&Af.call(e,r)&&(n[r]=e[r]);return n};/**
94
94
  * @license QR Code generator library (TypeScript)
95
95
  * Copyright (c) Project Nayuki.
96
96
  * SPDX-License-Identifier: MIT
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;/**
97
+ */var Tn;(e=>{const t=class oe{constructor(a,u,l,f){if(this.version=a,this.errorCorrectionLevel=u,this.modules=[],this.isFunction=[],a<oe.MIN_VERSION||a>oe.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 d=[];for(let h=0;h<this.size;h++)d.push(!1);for(let h=0;h<this.size;h++)this.modules.push(d.slice()),this.isFunction.push(d.slice());this.drawFunctionPatterns();const p=this.addEccAndInterleave(l);if(this.drawCodewords(p),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 oe.encodeSegments(l,u)}static encodeBinary(a,u){const l=e.QrSegment.makeBytes(a);return oe.encodeSegments([l],u)}static encodeSegments(a,u,l=1,f=40,d=-1,p=!0){if(!(oe.MIN_VERSION<=l&&l<=f&&f<=oe.MAX_VERSION)||d<-1||d>7)throw new RangeError("Invalid value");let h,m;for(h=l;;h++){const A=oe.getNumDataCodewords(h,u)*8,k=i.getTotalBits(a,h);if(k<=A){m=k;break}if(h>=f)throw new RangeError("Data too long")}for(const A of[oe.Ecc.MEDIUM,oe.Ecc.QUARTILE,oe.Ecc.HIGH])p&&m<=oe.getNumDataCodewords(h,A)*8&&(u=A);let v=[];for(const A of a){n(A.mode.modeBits,4,v),n(A.numChars,A.mode.numCharCountBits(h),v);for(const k of A.getData())v.push(k)}o(v.length==m);const O=oe.getNumDataCodewords(h,u)*8;o(v.length<=O),n(0,Math.min(4,O-v.length),v),n(0,(8-v.length%8)%8,v),o(v.length%8==0);for(let A=236;v.length<O;A^=253)n(A,8,v);let b=[];for(;b.length*8<v.length;)b.push(0);return v.forEach((A,k)=>b[k>>>3]|=A<<7-(k&7)),new oe(h,u,b,d)}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 d=0;d<10;d++)l=l<<1^(l>>>9)*1335;const f=(u<<10|l)^21522;o(f>>>15==0);for(let d=0;d<=5;d++)this.setFunctionModule(8,d,r(f,d));this.setFunctionModule(8,7,r(f,6)),this.setFunctionModule(8,8,r(f,7)),this.setFunctionModule(7,8,r(f,8));for(let d=9;d<15;d++)this.setFunctionModule(14-d,8,r(f,d));for(let d=0;d<8;d++)this.setFunctionModule(this.size-1-d,8,r(f,d));for(let d=8;d<15;d++)this.setFunctionModule(8,this.size-15+d,r(f,d));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),d=this.size-11+l%3,p=Math.floor(l/3);this.setFunctionModule(d,p,f),this.setFunctionModule(p,d,f)}}drawFinderPattern(a,u){for(let l=-4;l<=4;l++)for(let f=-4;f<=4;f++){const d=Math.max(Math.abs(f),Math.abs(l)),p=a+f,h=u+l;0<=p&&p<this.size&&0<=h&&h<this.size&&this.setFunctionModule(p,h,d!=2&&d!=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!=oe.getNumDataCodewords(u,l))throw new RangeError("Invalid argument");const f=oe.NUM_ERROR_CORRECTION_BLOCKS[l.ordinal][u],d=oe.ECC_CODEWORDS_PER_BLOCK[l.ordinal][u],p=Math.floor(oe.getNumRawDataModules(u)/8),h=f-p%f,m=Math.floor(p/f);let v=[];const O=oe.reedSolomonComputeDivisor(d);for(let A=0,k=0;A<f;A++){let R=a.slice(k,k+m-d+(A<h?0:1));k+=R.length;const D=oe.reedSolomonComputeRemainder(R,O);A<h&&R.push(0),v.push(R.concat(D))}let b=[];for(let A=0;A<v[0].length;A++)v.forEach((k,R)=>{(A!=m-d||R>=h)&&b.push(k[A])});return o(b.length==p),b}drawCodewords(a){if(a.length!=Math.floor(oe.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 d=0;d<2;d++){const p=l-d,m=(l+1&2)==0?this.size-1-f:f;!this.isFunction[m][p]&&u<a.length*8&&(this.modules[m][p]=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 d=0;d<this.size;d++){let p=!1,h=0,m=[0,0,0,0,0,0,0];for(let v=0;v<this.size;v++)this.modules[d][v]==p?(h++,h==5?a+=oe.PENALTY_N1:h>5&&a++):(this.finderPenaltyAddHistory(h,m),p||(a+=this.finderPenaltyCountPatterns(m)*oe.PENALTY_N3),p=this.modules[d][v],h=1);a+=this.finderPenaltyTerminateAndCount(p,h,m)*oe.PENALTY_N3}for(let d=0;d<this.size;d++){let p=!1,h=0,m=[0,0,0,0,0,0,0];for(let v=0;v<this.size;v++)this.modules[v][d]==p?(h++,h==5?a+=oe.PENALTY_N1:h>5&&a++):(this.finderPenaltyAddHistory(h,m),p||(a+=this.finderPenaltyCountPatterns(m)*oe.PENALTY_N3),p=this.modules[v][d],h=1);a+=this.finderPenaltyTerminateAndCount(p,h,m)*oe.PENALTY_N3}for(let d=0;d<this.size-1;d++)for(let p=0;p<this.size-1;p++){const h=this.modules[d][p];h==this.modules[d][p+1]&&h==this.modules[d+1][p]&&h==this.modules[d+1][p+1]&&(a+=oe.PENALTY_N2)}let u=0;for(const d of this.modules)u=d.reduce((p,h)=>p+(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*oe.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<oe.MIN_VERSION||a>oe.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(oe.getNumRawDataModules(a)/8)-oe.ECC_CODEWORDS_PER_BLOCK[u.ordinal][a]*oe.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 d=0;d<u.length;d++)u[d]=oe.reedSolomonMultiply(u[d],l),d+1<u.length&&(u[d]^=u[d+1]);l=oe.reedSolomonMultiply(l,2)}return u}static reedSolomonComputeRemainder(a,u){let l=u.map(f=>0);for(const f of a){const d=f^l.shift();l.push(0),u.forEach((p,h)=>l[h]^=oe.reedSolomonMultiply(p,d))}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 ye{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 ye(ye.Mode.BYTE,a.length,u)}static makeNumeric(a){if(!ye.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 ye(ye.Mode.NUMERIC,a.length,u)}static makeAlphanumeric(a){if(!ye.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=ye.ALPHANUMERIC_CHARSET.indexOf(a.charAt(l))*45;f+=ye.ALPHANUMERIC_CHARSET.indexOf(a.charAt(l+1)),n(f,11,u)}return l<a.length&&n(ye.ALPHANUMERIC_CHARSET.indexOf(a.charAt(l)),6,u),new ye(ye.Mode.ALPHANUMERIC,a.length,u)}static makeSegments(a){return a==""?[]:ye.isNumeric(a)?[ye.makeNumeric(a)]:ye.isAlphanumeric(a)?[ye.makeAlphanumeric(a)]:[ye.makeBytes(ye.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 ye(ye.Mode.ECI,0,u)}static isNumeric(a){return ye.NUMERIC_REGEX.test(a)}static isAlphanumeric(a){return ye.ALPHANUMERIC_REGEX.test(a)}getData(){return this.bitData.slice()}static getTotalBits(a,u){let l=0;for(const f of a){const d=f.mode.numCharCountBits(u);if(f.numChars>=1<<d)return 1/0;l+=4+d+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})(Tn||(Tn={})),(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={}))})(Tn||(Tn={})),(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={}))})(Tn||(Tn={}));var Xn=Tn;/**
98
98
  * @license qrcode.react
99
99
  * Copyright (c) Paul O'Shannessy
100
100
  * SPDX-License-Identifier: ISC
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:`
101
+ */var Tv={L:Xn.QrCode.Ecc.LOW,M:Xn.QrCode.Ecc.MEDIUM,Q:Xn.QrCode.Ecc.QUARTILE,H:Xn.QrCode.Ecc.HIGH},Of=128,Cf="L",If="#FFFFFF",Nf="#000000",Mf=!1,kf=1,Ov=4,Cv=0,Iv=.1;function Bf(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 Lf(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 Nv(e,t,n,r){if(r==null)return null;const o=e.length+n*2,s=Math.floor(t*Iv),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 d=null;if(r.excavate){let h=Math.floor(u),m=Math.floor(l),v=Math.ceil(c+u-h),O=Math.ceil(a+l-m);d={x:h,y:m,w:v,h:O}}const p=r.crossOrigin;return{x:u,y:l,h:a,w:c,excavation:d,opacity:f,crossOrigin:p}}function Mv(e,t){return t!=null?Math.max(Math.floor(t),0):e?Ov:Cv}function Rf({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(...Xn.QrSegment.makeSegments(v)),m),[]);return Xn.QrCode.encodeSegments(h,Tv[t],n,void 0,void 0,c)},[e,t,n,c]);const{cells:u,margin:l,numCells:f,calculatedImageSettings:d}=E.useMemo(()=>{let p=a.getModules();const h=Mv(r,o),m=p.length+h*2,v=Nv(p,i,h,s);return{cells:p,margin:h,numCells:m,calculatedImageSettings:v}},[a,i,s,r,o]);return{qrcode:a,margin:l,cells:u,numCells:f,calculatedImageSettings:d}}var kv=function(){try{new Path2D().addPath(new Path2D)}catch{return!1}return!0}(),Bv=E.forwardRef(function(t,n){const r=t,{value:o,size:s=Of,level:i=Cf,bgColor:c=If,fgColor:a=Nf,includeMargin:u=Mf,minVersion:l=kf,boostLevel:f,marginSize:d,imageSettings:p}=r,m=ua(r,["value","size","level","bgColor","fgColor","includeMargin","minVersion","boostLevel","marginSize","imageSettings"]),{style:v}=m,O=ua(m,["style"]),b=p==null?void 0:p.src,A=E.useRef(null),k=E.useRef(null),R=E.useCallback(S=>{A.current=S,typeof n=="function"?n(S):n&&(n.current=S)},[n]),[D,j]=E.useState(!1),{margin:g,cells:w,numCells:P,calculatedImageSettings:N}=Rf({value:o,level:i,minVersion:l,boostLevel:f,includeMargin:u,marginSize:d,imageSettings:p,size:s});E.useEffect(()=>{if(A.current!=null){const S=A.current,x=S.getContext("2d");if(!x)return;let T=w;const C=k.current,y=N!=null&&C!==null&&C.complete&&C.naturalHeight!==0&&C.naturalWidth!==0;y&&N.excavation!=null&&(T=Lf(w,N.excavation));const M=window.devicePixelRatio||1;S.height=S.width=s*M;const F=s/P*M;x.scale(F,F),x.fillStyle=c,x.fillRect(0,0,P,P),x.fillStyle=a,kv?x.fill(new Path2D(Bf(T,g))):w.forEach(function(_,z){_.forEach(function(H,K){H&&x.fillRect(K+g,z+g,1,1)})}),N&&(x.globalAlpha=N.opacity),y&&x.drawImage(C,N.x+g,N.y+g,N.w,N.h)}}),E.useEffect(()=>{j(!1)},[b]);const I=ca({height:s,width:s},v);let $=null;return b!=null&&($=E.createElement("img",{src:b,key:b,style:{display:"none"},onLoad:()=>{j(!0)},ref:k,crossOrigin:N==null?void 0:N.crossOrigin})),E.createElement(E.Fragment,null,E.createElement("canvas",ca({style:I,height:s,width:s,ref:R,role:"img"},O)),$)});Bv.displayName="QRCodeCanvas";var Ff=E.forwardRef(function(t,n){const r=t,{value:o,size:s=Of,level:i=Cf,bgColor:c=If,fgColor:a=Nf,includeMargin:u=Mf,minVersion:l=kf,boostLevel:f,title:d,marginSize:p,imageSettings:h}=r,m=ua(r,["value","size","level","bgColor","fgColor","includeMargin","minVersion","boostLevel","title","marginSize","imageSettings"]),{margin:v,cells:O,numCells:b,calculatedImageSettings:A}=Rf({value:o,level:i,minVersion:l,boostLevel:f,includeMargin:u,marginSize:p,imageSettings:h,size:s});let k=O,R=null;h!=null&&A!=null&&(A.excavation!=null&&(k=Lf(O,A.excavation)),R=E.createElement("image",{href:h.src,height:A.h,width:A.w,x:A.x+v,y:A.y+v,preserveAspectRatio:"none",opacity:A.opacity,crossOrigin:A.crossOrigin}));const D=Bf(k,v);return E.createElement("svg",ca({height:s,width:s,viewBox:`0 0 ${b} ${b}`,ref:n,role:"img"},m),!!d&&E.createElement("title",null,d),E.createElement("path",{fill:c,d:`M0,0 h${b}v${b}H0z`,shapeRendering:"crispEdges"}),E.createElement("path",{fill:a,d:D,shapeRendering:"crispEdges"}),R)});Ff.displayName="QRCodeSVG";function Lv(){const e=navigator.userAgentData;return e!=null&&e.platform?e.platform:navigator.platform}function Rv(){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 Df(){return/apple/i.test(navigator.vendor)}function Fv(){return Lv().toLowerCase().startsWith("mac")&&!navigator.maxTouchPoints}function Dv(){return Rv().includes("jsdom/")}const jf="data-floating-ui-focusable",jv="input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])";function la(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&&Li(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 fa(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 _v(e){return e.matches("html,body")}function It(e){return(e==null?void 0:e.ownerDocument)||document}function _f(e){return ke(e)&&e.matches(jv)}function Uv(e){if(!e||Dv())return!0;try{return e.matches(":focus-visible")}catch{return!0}}function zv(e){return e?e.hasAttribute(jf)?e:e.querySelector("["+jf+"]")||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 Hv(e){return"nativeEvent"in e}function _r(e,t){const n=["mouse","pen"];return t||n.push("",void 0),n.includes(e)}var Wv=typeof document<"u",Vv=function(){},Nt=Wv?E.useLayoutEffect:Vv;const Gv={...U};function hs(e){const t=U.useRef(e);return Nt(()=>{t.current=e}),t}const qv=Gv.useInsertionEffect||(e=>e());function Mt(e){const t=U.useRef(()=>{if(process.env.NODE_ENV!=="production")throw new Error("Cannot call an event handler while rendering.")});return qv(()=>{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 Uf=()=>({getShadowRoot:!0,displayCheck:typeof ResizeObserver=="function"&&ResizeObserver.toString().includes("[native code]")?"full":"none"});function zf(e,t){const n=$l(e,Uf()),r=n.length;if(r===0)return;const o=la(It(e)),s=n.indexOf(o),i=s===-1?t===1?0:r-1:s+t;return n[i]}function Zv(e){return zf(It(e).body,1)||e}function Kv(e){return zf(It(e).body,-1)||e}function da(e,t){const n=t||e.currentTarget,r=e.relatedTarget;return!r||!Qn(n,r)}function Yv(e){$l(e,Uf()).forEach(n=>{n.dataset.tabindex=n.getAttribute("tabindex")||"",n.setAttribute("tabindex","-1")})}function Hf(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 Xv="data-floating-ui-focusable",Wf="active",Vf="selected",Qv={...U};let Gf=!1,Jv=0;const qf=()=>"floating-ui-"+Math.random().toString(36).slice(2,6)+Jv++;function ew(){const[e,t]=U.useState(()=>Gf?qf():void 0);return Nt(()=>{e==null&&t(qf())},[]),U.useEffect(()=>{Gf=!0},[]),e}const pa=Qv.useId||ew;let ha;process.env.NODE_ENV!=="production"&&(ha=new Set);function tw(){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=ha)!=null&&e.has(o))){var s;(s=ha)==null||s.add(o),console.error(o)}}function nw(){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 rw=U.createContext(null),ow=U.createContext(null),ma=()=>{var e;return((e=U.useContext(rw))==null?void 0:e.id)||null},ga=()=>U.useContext(ow);function Ur(e){return"data-floating-ui-"+e}function st(e){e.current!==-1&&(clearTimeout(e.current),e.current=-1)}const Zf=Ur("safe-polygon");function ba(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 ya(e){return typeof e=="function"?e():e}function sw(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:d=!0}=t,p=ga(),h=ma(),m=hs(u),v=hs(a),O=hs(n),b=hs(f),A=U.useRef(),k=U.useRef(-1),R=U.useRef(),D=U.useRef(-1),j=U.useRef(!0),g=U.useRef(!1),w=U.useRef(()=>{}),P=U.useRef(!1),N=Mt(()=>{var C;const y=(C=o.current.openEvent)==null?void 0:C.type;return(y==null?void 0:y.includes("mouse"))&&y!=="mousedown"});U.useEffect(()=>{if(!c)return;function C(y){let{open:M}=y;M||(st(k),st(D),j.current=!0,P.current=!1)}return s.on("openchange",C),()=>{s.off("openchange",C)}},[c,s]),U.useEffect(()=>{if(!c||!m.current||!n)return;function C(M){N()&&r(!1,M,"hover")}const y=It(i.floating).documentElement;return y.addEventListener("mouseleave",C),()=>{y.removeEventListener("mouseleave",C)}},[i.floating,n,r,c,m,N]);const I=U.useCallback(function(C,y,M){y===void 0&&(y=!0),M===void 0&&(M="hover");const F=ba(v.current,"close",A.current);F&&!R.current?(st(k),k.current=window.setTimeout(()=>r(!1,C,M),F)):y&&(st(k),r(!1,C,M))},[v,r]),$=Mt(()=>{w.current(),R.current=void 0}),S=Mt(()=>{if(g.current){const C=It(i.floating).body;C.style.pointerEvents="",C.removeAttribute(Zf),g.current=!1}}),x=Mt(()=>o.current.openEvent?["click","mousedown"].includes(o.current.openEvent.type):!1);U.useEffect(()=>{if(!c)return;function C(z){if(st(k),j.current=!1,l&&!_r(A.current)||ya(b.current)>0&&!ba(v.current,"open"))return;const H=ba(v.current,"open",A.current);H?k.current=window.setTimeout(()=>{O.current||r(!0,z,"hover")},H):n||r(!0,z,"hover")}function y(z){if(x()){S();return}w.current();const H=It(i.floating);if(st(D),P.current=!1,m.current&&o.current.floatingContext){n||st(k),R.current=m.current({...o.current.floatingContext,tree:p,x:z.clientX,y:z.clientY,onClose(){S(),$(),x()||I(z,!0,"safe-polygon")}});const W=R.current;H.addEventListener("mousemove",W),w.current=()=>{H.removeEventListener("mousemove",W)};return}(A.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:p,x:z.clientX,y:z.clientY,onClose(){S(),$(),x()||I(z)}})(z))}function F(){st(k)}function _(z){x()||I(z,!1)}if(ce(i.domReference)){const z=i.domReference,H=i.floating;return n&&z.addEventListener("mouseleave",M),d&&z.addEventListener("mousemove",C,{once:!0}),z.addEventListener("mouseenter",C),z.addEventListener("mouseleave",y),H&&(H.addEventListener("mouseleave",M),H.addEventListener("mouseenter",F),H.addEventListener("mouseleave",_)),()=>{n&&z.removeEventListener("mouseleave",M),d&&z.removeEventListener("mousemove",C),z.removeEventListener("mouseenter",C),z.removeEventListener("mouseleave",y),H&&(H.removeEventListener("mouseleave",M),H.removeEventListener("mouseenter",F),H.removeEventListener("mouseleave",_))}}},[i,c,e,l,d,I,$,S,r,n,O,p,v,m,o,x,b]),Nt(()=>{var C;if(c&&n&&(C=m.current)!=null&&(C=C.__options)!=null&&C.blockPointerEvents&&N()){g.current=!0;const M=i.floating;if(ce(i.domReference)&&M){var y;const F=It(i.floating).body;F.setAttribute(Zf,"");const _=i.domReference,z=p==null||(y=p.nodesRef.current.find(H=>H.id===h))==null||(y=y.context)==null?void 0:y.elements.floating;return z&&(z.style.pointerEvents=""),F.style.pointerEvents="none",_.style.pointerEvents="auto",M.style.pointerEvents="auto",()=>{F.style.pointerEvents="",_.style.pointerEvents="",M.style.pointerEvents=""}}}},[c,n,h,i,p,m,N]),Nt(()=>{n||(A.current=void 0,P.current=!1,$(),S())},[n,$,S]),U.useEffect(()=>()=>{$(),st(k),st(D),S()},[c,i.domReference,$,S]);const T=U.useMemo(()=>{function C(y){A.current=y.pointerType}return{onPointerDown:C,onPointerEnter:C,onMouseMove(y){const{nativeEvent:M}=y;function F(){!j.current&&!O.current&&r(!0,M,"hover")}l&&!_r(A.current)||n||ya(b.current)===0||P.current&&y.movementX**2+y.movementY**2<2||(st(D),A.current==="touch"?F():(P.current=!0,D.current=window.setTimeout(F,ya(b.current))))}}},[l,r,n,O,b]);return U.useMemo(()=>c?{reference:T}:{},[c,T])}const Kf={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},Yf=U.forwardRef(function(t,n){const[r,o]=U.useState();Nt(()=>{Df()&&o("button")},[]);const s={ref:n,tabIndex:0,role:r,"aria-hidden":r?void 0:!0,[Ur("focus-guard")]:"",style:Kf};return B.jsx("span",{...t,...s})}),Xf=U.createContext(null),Qf=Ur("portal");function iw(e){e===void 0&&(e={});const{id:t,root:n}=e,r=pa(),o=cw(),[s,i]=U.useState(null),c=U.useRef(null);return Nt(()=>()=>{s==null||s.remove(),queueMicrotask(()=>{c.current=null})},[s]),Nt(()=>{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(Qf,""),a.appendChild(u),c.current=u,i(u)},[t,r]),Nt(()=>{if(n===null||!r||c.current)return;let a=n||(o==null?void 0:o.portalNode);a&&!Bi(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(Qf,""),a=u||a,a.appendChild(l),c.current=l,i(l)},[t,n,r,o]),s}function aw(e){const{children:t,id:n,root:r,preserveTabOrder:o=!0}=e,s=iw({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),d=i==null?void 0:i.modal,p=i==null?void 0:i.open,h=!!i&&!i.modal&&i.open&&o&&!!(r||s);return U.useEffect(()=>{if(!s||!o||d)return;function m(v){s&&da(v)&&(v.type==="focusin"?Hf:Yv)(s)}return s.addEventListener("focusin",m,!0),s.addEventListener("focusout",m,!0),()=>{s.removeEventListener("focusin",m,!0),s.removeEventListener("focusout",m,!0)}},[s,o,d]),U.useEffect(()=>{s&&(p||Hf(s))},[p,s]),B.jsxs(Xf.Provider,{value:U.useMemo(()=>({preserveTabOrder:o,beforeOutsideRef:a,afterOutsideRef:u,beforeInsideRef:l,afterInsideRef:f,portalNode:s,setFocusManagerState:c}),[o,s]),children:[h&&s&&B.jsx(Yf,{"data-type":"outside",ref:a,onFocus:m=>{if(da(m,s)){var v;(v=l.current)==null||v.focus()}else{const O=i?i.domReference:null,b=Kv(O);b==null||b.focus()}}}),h&&s&&B.jsx("span",{"aria-owns":s.id,style:Kf}),s&&Pr.createPortal(t,s),h&&s&&B.jsx(Yf,{"data-type":"outside",ref:u,onFocus:m=>{if(da(m,s)){var v;(v=f.current)==null||v.focus()}else{const O=i?i.domReference:null,b=Zv(O);b==null||b.focus(),i!=null&&i.closeOnFocusOut&&(i==null||i.onOpenChange(!1,m.nativeEvent,"focus-out"))}}})]})}const cw=()=>U.useContext(Xf);function Jf(e){return ke(e.target)&&e.target.tagName==="BUTTON"}function uw(e){return ke(e.target)&&e.target.tagName==="A"}function ed(e){return _f(e)}function lw(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,d=U.useRef(),p=U.useRef(!1),h=U.useMemo(()=>({onPointerDown(m){d.current=m.pointerType},onMouseDown(m){const v=d.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=d.current;if(c==="mousedown"&&d.current){d.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){d.current=void 0,!(m.defaultPrevented||!l||Jf(m))&&(m.key===" "&&!ed(s)&&(m.preventDefault(),p.current=!0),!uw(m)&&m.key==="Enter"&&r(!(n&&a),m.nativeEvent,"click"))},onKeyUp(m){m.defaultPrevented||!l||Jf(m)||ed(s)||m.key===" "&&p.current&&(p.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 fw={pointerdown:"onPointerDown",mousedown:"onMouseDown",click:"onClick"},dw={pointerdown:"onPointerDownCapture",mousedown:"onMouseDownCapture",click:"onClickCapture"},td=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 pw(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:d=!1,bubbles:p,capture:h}=t,m=ga(),v=Mt(typeof a=="function"?a:()=>!1),O=typeof a=="function"?v:a,b=U.useRef(!1),{escapeKey:A,outsidePress:k}=td(p),{escapeKey:R,outsidePress:D}=td(h),j=U.useRef(!1),g=Mt(S=>{var x;if(!n||!i||!c||S.key!=="Escape"||j.current)return;const T=(x=s.current.floatingContext)==null?void 0:x.nodeId,C=m?ps(m.nodesRef.current,T):[];if(!A&&(S.stopPropagation(),C.length>0)){let y=!0;if(C.forEach(M=>{var F;if((F=M.context)!=null&&F.open&&!M.context.dataRef.current.__escapeKeyBubbles){y=!1;return}}),!y)return}r(!1,Hv(S)?S.nativeEvent:S,"escape-key")}),w=Mt(S=>{var x;const T=()=>{var C;g(S),(C=Jn(S))==null||C.removeEventListener("keydown",T)};(x=Jn(S))==null||x.addEventListener("keydown",T)}),P=Mt(S=>{var x;const T=s.current.insideReactTree;s.current.insideReactTree=!1;const C=b.current;if(b.current=!1,u==="click"&&C||T||typeof O=="function"&&!O(S))return;const y=Jn(S),M="["+Ur("inert")+"]",F=It(o.floating).querySelectorAll(M);let _=ce(y)?y:null;for(;_&&!Ht(_);){const W=Wt(_);if(Ht(W)||!ce(W))break;_=W}if(F.length&&ce(y)&&!_v(y)&&!Qn(y,o.floating)&&Array.from(F).every(W=>!Qn(_,W)))return;if(ke(y)&&$){const W=Ht(y),Z=ot(y),q=/auto|scroll/,Q=W||q.test(Z.overflowX),te=W||q.test(Z.overflowY),ue=Q&&y.clientWidth>0&&y.scrollWidth>y.clientWidth,Se=te&&y.clientHeight>0&&y.scrollHeight>y.clientHeight,Ke=Z.direction==="rtl",$e=Se&&(Ke?S.offsetX<=y.offsetWidth-y.clientWidth:S.offsetX>y.clientWidth),Pe=ue&&S.offsetY>y.clientHeight;if($e||Pe)return}const z=(x=s.current.floatingContext)==null?void 0:x.nodeId,H=m&&ps(m.nodesRef.current,z).some(W=>{var Z;return fa(S,(Z=W.context)==null?void 0:Z.elements.floating)});if(fa(S,o.floating)||fa(S,o.domReference)||H)return;const K=m?ps(m.nodesRef.current,z):[];if(K.length>0){let W=!0;if(K.forEach(Z=>{var q;if((q=Z.context)!=null&&q.open&&!Z.context.dataRef.current.__outsidePressBubbles){W=!1;return}}),!W)return}r(!1,S,"outside-press")}),N=Mt(S=>{var x;const T=()=>{var C;P(S),(C=Jn(S))==null||C.removeEventListener(u,T)};(x=Jn(S))==null||x.addEventListener(u,T)});U.useEffect(()=>{if(!n||!i)return;s.current.__escapeKeyBubbles=A,s.current.__outsidePressBubbles=k;let S=-1;function x(F){r(!1,F,"ancestor-scroll")}function T(){window.clearTimeout(S),j.current=!0}function C(){S=window.setTimeout(()=>{j.current=!1},Vo()?5:0)}const y=It(o.floating);c&&(y.addEventListener("keydown",R?w:g,R),y.addEventListener("compositionstart",T),y.addEventListener("compositionend",C)),O&&y.addEventListener(u,D?N:P,D);let M=[];return d&&(ce(o.domReference)&&(M=fn(o.domReference)),ce(o.floating)&&(M=M.concat(fn(o.floating))),!ce(o.reference)&&o.reference&&o.reference.contextElement&&(M=M.concat(fn(o.reference.contextElement)))),M=M.filter(F=>{var _;return F!==((_=y.defaultView)==null?void 0:_.visualViewport)}),M.forEach(F=>{F.addEventListener("scroll",x,{passive:!0})}),()=>{c&&(y.removeEventListener("keydown",R?w:g,R),y.removeEventListener("compositionstart",T),y.removeEventListener("compositionend",C)),O&&y.removeEventListener(u,D?N:P,D),M.forEach(F=>{F.removeEventListener("scroll",x)}),window.clearTimeout(S)}},[s,o,c,O,u,n,r,d,i,A,k,g,R,w,P,D,N]),U.useEffect(()=>{s.current.insideReactTree=!1},[s,O,u]);const I=U.useMemo(()=>({onKeyDown:g,...l&&{[fw[f]]:S=>{r(!1,S.nativeEvent,"reference-press")},...f!=="click"&&{onClick(S){r(!1,S.nativeEvent,"reference-press")}}}}),[g,r,l,f]),$=U.useMemo(()=>({onKeyDown:g,onMouseDown(){b.current=!0},onMouseUp(){b.current=!0},[dw[u]]:()=>{s.current.insideReactTree=!0}}),[g,u,s]);return U.useMemo(()=>i?{reference:I,floating:$}:{},[i,I,$])}function hw(e){const{open:t=!1,onOpenChange:n,elements:r}=e,o=pa(),s=U.useRef({}),[i]=U.useState(()=>nw()),c=ma()!=null;if(process.env.NODE_ENV!=="production"){const p=r.reference;p&&!ce(p)&&tw("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=Mt((p,h,m)=>{s.current.openEvent=p?h:void 0,i.emit("openchange",{open:p,event:h,reason:m,nested:c}),n==null||n(p,h,m)}),f=U.useMemo(()=>({setPositionReference:u}),[]),d=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:d,events:i,floatingId:o,refs:f}),[t,l,d,i,o,f])}function mw(e){e===void 0&&(e={});const{nodeId:t}=e,n=hw({...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),d=ga();Nt(()=>{l&&(f.current=l)},[l]);const p=jl({...e,elements:{...o,...c&&{reference:c}}}),h=U.useCallback(A=>{const k=ce(A)?{getBoundingClientRect:()=>A.getBoundingClientRect(),getClientRects:()=>A.getClientRects(),contextElement:A}:A;a(k),p.refs.setReference(k)},[p.refs]),m=U.useCallback(A=>{(ce(A)||A===null)&&(f.current=A,i(A)),(ce(p.refs.reference.current)||p.refs.reference.current===null||A!==null&&!ce(A))&&p.refs.setReference(A)},[p.refs]),v=U.useMemo(()=>({...p.refs,setReference:m,setPositionReference:h,domReference:f}),[p.refs,m,h]),O=U.useMemo(()=>({...p.elements,domReference:l}),[p.elements,l]),b=U.useMemo(()=>({...p,...r,refs:v,elements:O,nodeId:t}),[p,v,O,t,r]);return Nt(()=>{r.dataRef.current.floatingContext=b;const A=d==null?void 0:d.nodesRef.current.find(k=>k.id===t);A&&(A.context=b)}),U.useMemo(()=>({...p,context:b,refs:v,elements:O}),[p,v,O,b])}function va(){return Fv()&&Df()}function gw(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 p=je(i.domReference);function h(){!n&&ke(i.domReference)&&i.domReference===la(It(i.domReference))&&(u.current=!0)}function m(){f.current=!0}function v(){f.current=!1}return p.addEventListener("blur",h),va()&&(p.addEventListener("keydown",m,!0),p.addEventListener("pointerdown",v,!0)),()=>{p.removeEventListener("blur",h),va()&&(p.removeEventListener("keydown",m,!0),p.removeEventListener("pointerdown",v,!0))}},[i.domReference,n,c]),U.useEffect(()=>{if(!c)return;function p(h){let{reason:m}=h;(m==="reference-press"||m==="escape-key")&&(u.current=!0)}return o.on("openchange",p),()=>{o.off("openchange",p)}},[o,c]),U.useEffect(()=>()=>{st(l)},[]);const d=U.useMemo(()=>({onMouseLeave(){u.current=!1},onFocus(p){if(u.current)return;const h=Jn(p.nativeEvent);if(a&&ce(h)){if(va()&&!p.relatedTarget){if(!f.current&&!_f(h))return}else if(!Uv(h))return}r(!0,p.nativeEvent,"focus")},onBlur(p){u.current=!1;const h=p.relatedTarget,m=p.nativeEvent,v=ce(h)&&h.hasAttribute(Ur("focus-guard"))&&h.getAttribute("data-type")==="outside";l.current=window.setTimeout(()=>{var O;const b=la(i.domReference?i.domReference.ownerDocument:document);!h&&b===i.domReference||Qn((O=s.current.floatingContext)==null?void 0:O.refs.floating.current,b)||Qn(i.domReference,b)||v||r(!1,m,"focus")})}}),[s,i.domReference,r,a]);return U.useMemo(()=>c?{reference:d}:{},[c,d])}function wa(e,t,n){const r=new Map,o=n==="item";let s=e;if(o&&e){const{[Wf]:i,[Vf]:c,...a}=e;s=a}return{...n==="floating"&&{tabIndex:-1,[Xv]:""},...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&&[Wf,Vf].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 d,p=arguments.length,h=new Array(p),m=0;m<p;m++)h[m]=arguments[m];return(d=r.get(u))==null?void 0:d.map(v=>v(...h)).find(v=>v!==void 0)}}}else i[u]=l}),i),{})}}function bw(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=>wa(c,e,"reference"),t),s=U.useCallback(c=>wa(c,e,"floating"),n),i=U.useCallback(c=>wa(c,e,"item"),r);return U.useMemo(()=>({getReferenceProps:o,getFloatingProps:s,getItemProps:i}),[o,s,i])}const yw=new Map([["select","listbox"],["combobox","listbox"],["label",!1]]);function vw(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=pa(),l=((n=s.domReference)==null?void 0:n.id)||u,f=U.useMemo(()=>{var b;return((b=zv(s.floating))==null?void 0:b.id)||i},[s.floating,i]),d=(r=yw.get(a))!=null?r:a,h=ma()!=null,m=U.useMemo(()=>d==="tooltip"||a==="label"?{["aria-"+(a==="label"?"labelledby":"describedby")]:o?f:void 0}:{"aria-expanded":o?"true":"false","aria-haspopup":d==="alertdialog"?"dialog":d,"aria-controls":o?f:void 0,...d==="listbox"&&{role:"combobox"},...d==="menu"&&{id:l},...d==="menu"&&h&&{role:"menuitem"},...a==="select"&&{"aria-autocomplete":"none"},...a==="combobox"&&{"aria-autocomplete":"list"}},[d,f,h,o,l,a]),v=U.useMemo(()=>{const b={id:f,...d&&{role:d}};return d==="tooltip"||a==="label"?b:{...b,...d==="menu"&&{"aria-labelledby":l}}},[d,f,l,a]),O=U.useCallback(b=>{let{active:A,selected:k}=b;const R={role:"option",...A&&{id:f+"-fui-option"}};switch(a){case"select":case"combobox":return{...R,"aria-selected":k}}return{}},[f,a]);return U.useMemo(()=>c?{reference:m,floating:v,item:O}:{},[c,m,v,O])}const nd=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 B.jsx("div",{ref:n,className:`absolute w-0 h-0 ${t}`,style:o})});nd.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:d,floatingStyles:p,context:h}=mw({open:u&&!i,onOpenChange:l,placement:n,whileElementsMounted:Ll,middleware:[qi(o?12:8),Ul({fallbackAxisSideDirection:"start",padding:8}),_l({padding:8}),...o?[Fy({element:f})]:[]]}),m=sw(h,{enabled:a.includes("hover"),delay:{open:r,close:150}}),v=gw(h,{enabled:a.includes("focus")}),O=lw(h,{enabled:a.includes("click")}),b=pw(h),A=vw(h,{role:"tooltip"}),{getReferenceProps:k,getFloatingProps:R}=bw([m,v,O,b,A]);return i?B.jsx(B.Fragment,{children:e}):B.jsxs(B.Fragment,{children:[B.jsx("div",{ref:d.setReference,...k(),children:e}),u&&B.jsx(aw,{children:B.jsxs("div",{ref:d.setFloating,...R(),style:p,className:`
102
102
  z-50 px-3 py-2
103
103
  bg-fill-page-secondary
104
104
  text-text-primary text-sm font-medium
@@ -106,47 +106,47 @@ React keys must be passed directly to JSX without using spread:
106
106
  relative
107
107
  ${c}
108
108
  ${s}
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(`
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(`
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(`
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(`
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(`
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}:
109
+ `,children:[t,o&&B.jsx(nd,{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=",ww=(e,t)=>Number(e)>Number(t),ht=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"},xa=(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 xa(a,t)}const s=parseFloat(e),i=parseFloat(t);return!isNaN(s)&&!isNaN(i)&&s>i?{isValid:!0,formattedValue:ht(t),errorType:"auto_adjusted_to_max"}:{isValid:!0,formattedValue:e}},gs={ETHEREUM:1,ARBITRUM:42161,ARBITRUM_SEPOLIA:421614,SEPOLIA:11155111},xw=[gs.ETHEREUM,gs.SEPOLIA,gs.ARBITRUM,gs.ARBITRUM_SEPOLIA],Ew=e=>{if(e.chainId!==void 0){const t=typeof e.chainId=="string"?parseInt(e.chainId,10):e.chainId;return!xw.includes(t)}return!0},Sw=({currentActiveChain:e,selectedToken:t,address:n,onDeposit:r,onCopy:o,onClose:s})=>{const{t:i}=_t(),c=E.useMemo(()=>Ew(e||{}),[e]);return B.jsxs(B.Fragment,{children:[B.jsx("div",{className:"flex justify-center mt-4 mb-3",children:n&&B.jsx("div",{className:"bg-white rounded-lg",children:B.jsx(Ff,{value:n,size:120,level:"L",bgColor:"#ffffff",fgColor:"#000000",marginSize:0})})}),n&&B.jsxs("div",{className:"flex items-center justify-between bg-fill-input-primary rounded-lg py-2 px-3 mb-3",children:[B.jsx("span",{className:"flex-1 text-text-primary text-sm font-medium break-all mr-3",children:n}),B.jsx(Pv,{onCopy:()=>{o&&o(n)},text:n,children:B.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:[B.jsx("rect",{x:"2.08496",y:"4.02295",width:"9.89893",height:"9.89893",rx:"2",stroke:"#F9F9F9"}),B.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")]}),B.jsxs("div",{className:"border-b border-dashed border-line-divider-secondary pb-4",children:[B.jsxs("div",{className:"flex items-start",children:[B.jsx("div",{className:"w-5",children:B.jsx("img",{src:ms,className:"w-4 h-4",alt:"Warning"})}),B.jsx("div",{className:"flex-1",children:B.jsx("p",{className:"text-xs text-functional-orange-1",children:i("deposit.depositAllTip",{coin:t,v:e==null?void 0:e.chain})})})]}),c&&B.jsxs(B.Fragment,{children:[B.jsx("div",{className:"my-2 ml-5 h-[1px] border-b border-dashed border-line-divider-secondary"}),B.jsx("div",{className:"flex items-start pl-5 text-functional-orange-1 text-xs",children:i("deposit.depositTipFor25w")})]})]}),B.jsxs("div",{className:"text-sm",children:[B.jsxs("div",{className:"flex justify-between items-center h-[18px] mt-4",children:[B.jsx("span",{className:"text-text-tertiary",children:i("deposit.arrivalTime")}),B.jsx(er,{content:B.jsxs("div",{className:"grid flex-grow max-w-[300px] min-w-[80px] rounded-2xl flex-col gap-[10px]",children:[B.jsx("p",{children:i("deposit.arrivaltimeTooltip1",{v:(e==null?void 0:e.blockTime)*e.txConfirm/60,v1:e==null?void 0:e.txConfirm})}),B.jsx("p",{children:i("deposit.arrivaltimeTooltip2")})]}),placement:"top",children:B.jsx("span",{className:"text-text-primary font-medium text-right border-b-[2px] border-dashed border-line-divider-primary decoration-dashed",children:i("deposit.arrivalEstimated",{v:(e==null?void 0:e.blockTime)*e.txConfirm/60})})})]}),B.jsxs("div",{className:"flex justify-between items-center h-[18px] mt-1",children:[B.jsx("span",{className:"text-text-tertiary",children:i("deposit.minDeposit")}),B.jsxs("span",{className:"text-text-primary font-medium text-right",children:["10 ",t]})]}),B.jsxs("div",{className:"flex justify-between items-center h-[18px] mt-1",children:[B.jsx("span",{className:"text-text-tertiary",children:i("deposit.maxDeposit")}),B.jsxs("span",{className:"text-text-primary font-medium text-right",children:["200,000 ",t]})]})]}),B.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:()=>{r&&r({amount:"",chainId:e.chainId,tokenAddress:n,tokenSymbol:t}),s()},children:i("deposit.title")})]})},$w="1.0.8";let qe=class nu extends Error{constructor(t,n={}){var i;const r=n.cause instanceof nu?n.cause.details:(i=n.cause)!=null&&i.message?n.cause.message:n.details,o=n.cause instanceof nu&&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@${$w}`].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 qt(e,t){const n=e.exec(t);return n==null?void 0:n.groups}const rd=/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/,od=/^u?int(8|16|24|32|40|48|56|64|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256)?$/,sd=/^\(.+?\).*?$/,id=/^tuple(?<array>(\[(\d*)\])*)$/;function Ea(e){let t=e.type;if(id.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+=Ea(s),o<n-1&&(t+=", ")}const r=qt(id,e.type);return t+=`)${(r==null?void 0:r.array)??""}`,Ea({...e,type:t})}return"indexed"in e&&e.indexed&&(t=`${t} indexed`),e.name?`${t} ${e.name}`:t}function zr(e){let t="";const n=e.length;for(let r=0;r<n;r++){const o=e[r];t+=Ea(o),r!==n-1&&(t+=", ")}return t}function bs(e){var t;return e.type==="function"?`function ${e.name}(${zr(e.inputs)})${e.stateMutability&&e.stateMutability!=="nonpayable"?` ${e.stateMutability}`:""}${(t=e.outputs)!=null&&t.length?` returns (${zr(e.outputs)})`:""}`:e.type==="event"?`event ${e.name}(${zr(e.inputs)})`:e.type==="error"?`error ${e.name}(${zr(e.inputs)})`:e.type==="constructor"?`constructor(${zr(e.inputs)})${e.stateMutability==="payable"?" payable":""}`:e.type==="fallback"?`fallback() external${e.stateMutability==="payable"?" payable":""}`:"receive() external payable"}const ad=/^error (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*)\((?<parameters>.*?)\)$/;function Pw(e){return ad.test(e)}function Aw(e){return qt(ad,e)}const cd=/^event (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*)\((?<parameters>.*?)\)$/;function Tw(e){return cd.test(e)}function Ow(e){return qt(cd,e)}const ud=/^function (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*)\((?<parameters>.*?)\)(?: (?<scope>external|public{1}))?(?: (?<stateMutability>pure|view|nonpayable|payable{1}))?(?: returns\s?\((?<returns>.*?)\))?$/;function Cw(e){return ud.test(e)}function Iw(e){return qt(ud,e)}const ld=/^struct (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*) \{(?<properties>.*?)\}$/;function Sa(e){return ld.test(e)}function Nw(e){return qt(ld,e)}const fd=/^constructor\((?<parameters>.*?)\)(?:\s(?<stateMutability>payable{1}))?$/;function Mw(e){return fd.test(e)}function kw(e){return qt(fd,e)}const dd=/^fallback\(\) external(?:\s(?<stateMutability>payable{1}))?$/;function Bw(e){return dd.test(e)}function Lw(e){return qt(dd,e)}const Rw=/^receive\(\) external payable$/;function Fw(e){return Rw.test(e)}const Dw=new Set(["indexed"]),$a=new Set(["calldata","memory","storage"]);class jw extends qe{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 _w extends qe{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 Uw extends qe{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 zw extends qe{constructor({param:t}){super("Invalid ABI parameter.",{details:t}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidParameterError"})}}class Hw extends qe{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 Ww extends qe{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 Vw extends qe{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 Gw extends qe{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 qe{constructor({signature:t,type:n}){super(`Invalid ${n} signature.`,{details:t}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidSignatureError"})}}class qw extends qe{constructor({signature:t}){super("Unknown signature.",{details:t}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"UnknownSignatureError"})}}class Zw extends qe{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 Kw extends qe{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 Yw extends qe{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 Xw(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 Pa=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 Aa(e,t={}){if(Cw(e))return Qw(e,t);if(Tw(e))return Jw(e,t);if(Pw(e))return ex(e,t);if(Mw(e))return tx(e,t);if(Bw(e))return nx(e);if(Fw(e))return{type:"receive",stateMutability:"payable"};throw new qw({signature:e})}function Qw(e,t={}){const n=Iw(e);if(!n)throw new tr({signature:e,type:"function"});const r=mt(n.parameters),o=[],s=r.length;for(let c=0;c<s;c++)o.push(On(r[c],{modifiers:$a,structs:t,type:"function"}));const i=[];if(n.returns){const c=mt(n.returns),a=c.length;for(let u=0;u<a;u++)i.push(On(c[u],{modifiers:$a,structs:t,type:"function"}))}return{name:n.name,type:"function",stateMutability:n.stateMutability??"nonpayable",inputs:o,outputs:i}}function Jw(e,t={}){const n=Ow(e);if(!n)throw new tr({signature:e,type:"event"});const r=mt(n.parameters),o=[],s=r.length;for(let i=0;i<s;i++)o.push(On(r[i],{modifiers:Dw,structs:t,type:"event"}));return{name:n.name,type:"event",inputs:o}}function ex(e,t={}){const n=Aw(e);if(!n)throw new tr({signature:e,type:"error"});const r=mt(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 tx(e,t={}){const n=kw(e);if(!n)throw new tr({signature:e,type:"constructor"});const r=mt(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 nx(e){const t=Lw(e);if(!t)throw new tr({signature:e,type:"fallback"});return{type:"fallback",stateMutability:t.stateMutability??"nonpayable"}}const rx=/^(?<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$_]*))?$/,ox=/^\((?<type>.+?)\)(?<array>(?:\[\d*?\])+?)?(?:\s(?<modifier>calldata|indexed|memory|storage{1}))?(?:\s(?<name>[a-zA-Z$_][a-zA-Z0-9$_]*))?$/,sx=/^u?int$/;function On(e,t){var f,d;const n=Xw(e,t==null?void 0:t.type,t==null?void 0:t.structs);if(Pa.has(n))return Pa.get(n);const r=sd.test(e),o=qt(r?ox:rx,e);if(!o)throw new zw({param:e});if(o.name&&ax(o.name))throw new Hw({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 p=mt(o.type),h=[],m=p.length;for(let v=0;v<m;v++)h.push(On(p[v],{structs:c}));u={components:h}}else if(o.type in c)a="tuple",u={components:c[o.type]};else if(sx.test(o.type))a=`${o.type}256`;else if(a=o.type,(t==null?void 0:t.type)!=="struct"&&!pd(a))throw new Uw({type:a});if(o.modifier){if(!((d=(f=t==null?void 0:t.modifiers)==null?void 0:f.has)!=null&&d.call(f,o.modifier)))throw new Ww({param:e,type:t==null?void 0:t.type,modifier:o.modifier});if($a.has(o.modifier)&&!cx(a,!!o.array))throw new Vw({param:e,type:t==null?void 0:t.type,modifier:o.modifier})}const l={type:`${a}${o.array??""}`,...s,...i,...u};return Pa.set(n,l),l}function mt(e,t=[],n="",r=0){const o=e.trim().length;for(let s=0;s<o;s++){const i=e[s],c=e.slice(s+1);switch(i){case",":return r===0?mt(c,[...t,n.trim()]):mt(c,t,`${n}${i}`,r);case"(":return mt(c,t,`${n}${i}`,r+1);case")":return mt(c,t,`${n}${i}`,r-1);default:return mt(c,t,`${n}${i}`,r)}}if(n==="")return t;if(r!==0)throw new Yw({current:n,depth:r});return t.push(n.trim()),t}function pd(e){return e==="address"||e==="bool"||e==="function"||e==="string"||rd.test(e)||od.test(e)}const ix=/^(?: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 ax(e){return e==="address"||e==="bool"||e==="function"||e==="string"||e==="tuple"||rd.test(e)||od.test(e)||ix.test(e)}function cx(e,t){return t||e==="bytes"||e==="string"||e==="tuple"}function hd(e){const t={},n=e.length;for(let i=0;i<n;i++){const c=e[i];if(!Sa(c))continue;const a=Nw(c);if(!a)throw new tr({signature:c,type:"struct"});const u=a.properties.split(";"),l=[],f=u.length;for(let d=0;d<f;d++){const h=u[d].trim();if(!h)continue;const m=On(h,{type:"struct"});l.push(m)}if(!l.length)throw new Zw({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]=md(a,t)}return r}const ux=/^(?<type>[a-zA-Z$_][a-zA-Z0-9$_]*)(?<array>(?:\[\d*?\])+?)?$/;function md(e,t,n=new Set){const r=[],o=e.length;for(let s=0;s<o;s++){const i=e[s];if(sd.test(i.type))r.push(i);else{const a=qt(ux,i.type);if(!(a!=null&&a.type))throw new Gw({abiParameter:i});const{array:u,type:l}=a;if(l in t){if(n.has(l))throw new Kw({type:l});r.push({...i,type:`tuple${u??""}`,components:md(t[l]??[],t,new Set([...n,l]))})}else if(pd(l))r.push(i);else throw new _w({type:l})}}return r}function gd(e){const t=hd(e),n=[],r=e.length;for(let o=0;o<r;o++){const s=e[o];Sa(s)||n.push(Aa(s,t))}return n}function bd(e){let t;if(typeof e=="string")t=Aa(e);else{const n=hd(e),r=e.length;for(let o=0;o<r;o++){const s=e[o];if(!Sa(s)){t=Aa(s,n);break}}}if(!t)throw new jw({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 gt(e,{includeName:t=!1}={}){if(e.type!=="function"&&e.type!=="event"&&e.type!=="error")throw new Ex(e.type);return`${e.name}(${ys(e.inputs,{includeName:t})})`}function ys(e,{includeName:t=!1}={}){return e?e.map(n=>lx(n,{includeName:t})).join(t?", ":","):""}function lx(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 bt(e,{strict:t=!0}={}){return!e||typeof e!="string"?!1:t?/^0x[0-9a-fA-F]*$/.test(e):e.startsWith("0x")}function be(e){return bt(e,{strict:!1})?Math.ceil((e.length-2)/2):e.length}const yd="2.34.0";let Hr={getDocsUrl:({docsBaseUrl:e,docsPath:t="",docsSlug:n})=>t?`${e??"https://viem.sh"}${t}${n?`#${n}`:""}`:void 0,version:`viem@${yd}`},V=class ru extends Error{constructor(t,n={}){var c;const r=(()=>{var a;return n.cause instanceof ru?n.cause.details:(a=n.cause)!=null&&a.message?n.cause.message:n.details})(),o=n.cause instanceof ru&&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=yd}walk(t){return vd(this,t)}};function vd(e,t){return t!=null&&t(e)?e:e&&typeof e=="object"&&"cause"in e&&e.cause!==void 0?vd(e.cause,t):t?null:e}class fx extends V{constructor({docsPath:t}){super(["A constructor was not found on the ABI.","Make sure you are using the correct ABI and that the constructor exists on it."].join(`
112
+ `),{docsPath:t,name:"AbiConstructorNotFoundError"})}}class wd extends V{constructor({docsPath:t}){super(["Constructor arguments were provided (`args`), but a constructor parameters (`inputs`) were not found on the ABI.","Make sure you are using the correct ABI, and that the `inputs` attribute on the constructor exists."].join(`
113
+ `),{docsPath:t,name:"AbiConstructorParamsNotFoundError"})}}class xd extends V{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 Wr extends V{constructor(){super('Cannot decode zero data ("0x") with ABI parameters.',{name:"AbiDecodingZeroDataError"})}}class dx extends V{constructor({expectedLength:t,givenLength:n,type:r}){super([`ABI encoding array length mismatch for type ${r}.`,`Expected length: ${t}`,`Given length: ${n}`].join(`
115
+ `),{name:"AbiEncodingArrayLengthMismatchError"})}}class px extends V{constructor({expectedSize:t,value:n}){super(`Size of bytes "${n}" (bytes${be(n)}) does not match expected size (bytes${t}).`,{name:"AbiEncodingBytesSizeMismatchError"})}}class hx extends V{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 mx extends V{constructor(t,{docsPath:n}){super([`Arguments (\`args\`) were provided to "${t}", but "${t}" on the ABI does not contain any parameters (\`inputs\`).`,"Cannot encode error result without knowing what the parameter types are.","Make sure you are using the correct ABI and that the inputs exist on it."].join(`
117
+ `),{docsPath:n,name:"AbiErrorInputsNotFoundError"})}}class Ed extends V{constructor(t,{docsPath:n}={}){super([`Error ${t?`"${t}" `:""}not found on ABI.`,"Make sure you are using the correct ABI and that the error exists on it."].join(`
118
+ `),{docsPath:n,name:"AbiErrorNotFoundError"})}}class Sd extends V{constructor(t,{docsPath:n}){super([`Encoded error signature "${t}" not found on ABI.`,"Make sure you are using the correct ABI and that the error exists on it.",`You can look up the decoded signature here: https://openchain.xyz/signatures?query=${t}.`].join(`
119
+ `),{docsPath:n,name:"AbiErrorSignatureNotFoundError"}),Object.defineProperty(this,"signature",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.signature=t}}class gx extends V{constructor({docsPath:t}){super("Cannot extract event signature from empty topics.",{docsPath:t,name:"AbiEventSignatureEmptyTopicsError"})}}class $d extends V{constructor(t,{docsPath:n}){super([`Encoded event signature "${t}" not found on ABI.`,"Make sure you are using the correct ABI and that the event exists on it.",`You can look up the signature here: https://openchain.xyz/signatures?query=${t}.`].join(`
120
+ `),{docsPath:n,name:"AbiEventSignatureNotFoundError"})}}class Pd extends V{constructor(t,{docsPath:n}={}){super([`Event ${t?`"${t}" `:""}not found on ABI.`,"Make sure you are using the correct ABI and that the event exists on it."].join(`
121
+ `),{docsPath:n,name:"AbiEventNotFoundError"})}}class nr extends V{constructor(t,{docsPath:n}={}){super([`Function ${t?`"${t}" `:""}not found on ABI.`,"Make sure you are using the correct ABI and that the function exists on it."].join(`
122
+ `),{docsPath:n,name:"AbiFunctionNotFoundError"})}}class Ad extends V{constructor(t,{docsPath:n}){super([`Function "${t}" does not contain any \`outputs\` on ABI.`,"Cannot decode function result without knowing what the parameter types are.","Make sure you are using the correct ABI and that the function exists on it."].join(`
123
+ `),{docsPath:n,name:"AbiFunctionOutputsNotFoundError"})}}class bx extends V{constructor(t,{docsPath:n}){super([`Encoded function signature "${t}" not found on ABI.`,"Make sure you are using the correct ABI and that the function exists on it.",`You can look up the signature here: https://openchain.xyz/signatures?query=${t}.`].join(`
124
+ `),{docsPath:n,name:"AbiFunctionSignatureNotFoundError"})}}class yx extends V{constructor(t,n){super("Found ambiguous types in overloaded ABI items.",{metaMessages:[`\`${t.type}\` in \`${gt(t.abiItem)}\`, and`,`\`${n.type}\` in \`${gt(n.abiItem)}\``,"","These types encode differently and cannot be distinguished at runtime.","Remove one of the ambiguous items in the ABI."],name:"AbiItemAmbiguityError"})}}let vx=class extends V{constructor({expectedSize:t,givenSize:n}){super(`Expected bytes${t}, got bytes${n}.`,{name:"BytesSizeMismatchError"})}};class Vr extends V{constructor({abiItem:t,data:n,params:r,size:o}){super([`Data size of ${o} bytes is too small for non-indexed event parameters.`].join(`
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 V{constructor({abiItem:t,param:n}){super([`Expected a topic for indexed event parameter${n.name?` "${n.name}"`:""} on event "${gt(t,{includeName:!0})}".`].join(`
126
+ `),{name:"DecodeLogTopicsMismatch"}),Object.defineProperty(this,"abiItem",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.abiItem=t}}class wx extends V{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 xx extends V{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 Td=class extends V{constructor(t){super([`Value "${t}" is not a valid array.`].join(`
129
+ `),{name:"InvalidArrayError"})}};class Ex extends V{constructor(t){super([`"${t}" is not a valid definition type.`,'Valid types: "function", "event", "error"'].join(`
130
+ `),{name:"InvalidDefinitionTypeError"})}}class Sx extends V{constructor(t){super(`Filter type "${t}" is not supported.`,{name:"FilterTypeNotSupportedError"})}}let Od=class extends V{constructor({offset:t,position:n,size:r}){super(`Slice ${n==="start"?"starting":"ending"} at offset "${t}" is out-of-bounds (size: ${r}).`,{name:"SliceOffsetOutOfBoundsError"})}},Cd=class extends V{constructor({size:t,targetSize:n,type:r}){super(`${r.charAt(0).toUpperCase()}${r.slice(1).toLowerCase()} size (${t}) exceeds padding size (${n}).`,{name:"SizeExceedsPaddingSizeError"})}};class Id extends V{constructor({size:t,targetSize:n,type:r}){super(`${r.charAt(0).toUpperCase()}${r.slice(1).toLowerCase()} is expected to be ${n} ${r} long, but is ${t} ${r} long.`,{name:"InvalidBytesLengthError"})}}function rr(e,{dir:t,size:n=32}={}){return typeof e=="string"?pn(e,{dir:t,size:n}):$x(e,{dir:t,size:n})}function pn(e,{dir:t,size:n=32}={}){if(n===null)return e;const r=e.replace("0x","");if(r.length>n*2)throw new Cd({size:Math.ceil(r.length/2),targetSize:n,type:"hex"});return`0x${r[t==="right"?"padEnd":"padStart"](n*2,"0")}`}function $x(e,{dir:t,size:n=32}={}){if(n===null)return e;if(e.length>n)throw new Cd({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 Nd=class extends V{constructor({max:t,min:n,signed:r,size:o,value:s}){super(`Number "${s}" is not in safe ${o?`${o*8}-bit ${r?"signed":"unsigned"} `:""}integer range ${t?`(${n} to ${t})`:`(above ${n})`}`,{name:"IntegerOutOfRangeError"})}};class Px extends V{constructor(t){super(`Bytes value "${t}" is not a valid boolean. The bytes array must contain a single byte of either a 0 or 1 value.`,{name:"InvalidBytesBooleanError"})}}class Ax extends V{constructor(t){super(`Hex value "${t}" is not a valid boolean. The hex value must be "0x0" (false) or "0x1" (true).`,{name:"InvalidHexBooleanError"})}}let Tx=class extends V{constructor({givenSize:t,maxSize:n}){super(`Size cannot exceed ${n} bytes. Given size: ${t} bytes.`,{name:"SizeOverflowError"})}};function Cn(e,{dir:t="left"}={}){let n=typeof e=="string"?e.replace("0x",""):e,r=0;for(let o=0;o<n.length-1&&n[t==="left"?o:n.length-o-1].toString()==="0";o++)r++;return n=t==="left"?n.slice(r):n.slice(0,n.length-r),typeof e=="string"?(n.length===1&&t==="right"&&(n=`${n}0`),`0x${n.length%2===1?`0${n}`:n}`):n}function yt(e,{size:t}){if(be(e)>t)throw new Tx({givenSize:be(e),maxSize:t})}function kt(e,t={}){const{signed:n}=t;t.size&&yt(e,{size:t.size});const r=BigInt(e);if(!n)return r;const o=(e.length-2)/2,s=(1n<<BigInt(o)*8n-1n)-1n;return r<=s?r:r-BigInt(`0x${"f".padStart(o*2,"f")}`)-1n}function Ox(e,t={}){let n=e;if(t.size&&(yt(n,{size:t.size}),n=Cn(n)),Cn(n)==="0x00")return!1;if(Cn(n)==="0x01")return!0;throw new Ax(n)}function Zt(e,t={}){return Number(kt(e,t))}const Cx=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function Kt(e,t={}){return typeof e=="number"||typeof e=="bigint"?X(e,t):typeof e=="string"?Gr(e,t):typeof e=="boolean"?Md(e,t):xe(e,t)}function Md(e,t={}){const n=`0x${Number(e)}`;return typeof t.size=="number"?(yt(n,{size:t.size}),rr(n,{size:t.size})):n}function xe(e,t={}){let n="";for(let o=0;o<e.length;o++)n+=Cx[e[o]];const r=`0x${n}`;return typeof t.size=="number"?(yt(r,{size:t.size}),rr(r,{dir:"right",size:t.size})):r}function X(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 Nd({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 Ix=new TextEncoder;function Gr(e,t={}){const n=Ix.encode(e);return xe(n,t)}const Nx=new TextEncoder;function or(e,t={}){return typeof e=="number"||typeof e=="bigint"?kx(e,t):typeof e=="boolean"?Mx(e,t):bt(e)?vt(e,t):In(e,t)}function Mx(e,t={}){const n=new Uint8Array(1);return n[0]=Number(e),typeof t.size=="number"?(yt(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 kd(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 vt(e,t={}){let n=e;t.size&&(yt(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=kd(r.charCodeAt(c++)),u=kd(r.charCodeAt(c++));if(a===void 0||u===void 0)throw new V(`Invalid byte sequence ("${r[c-2]}${r[c-1]}" in "${r}").`);s[i]=a*16+u}return s}function kx(e,t){const n=X(e,t);return vt(n)}function In(e,t={}){const n=Nx.encode(e);return typeof t.size=="number"?(yt(n,{size:t.size}),rr(n,{dir:"right",size:t.size})):n}const ws=BigInt(2**32-1),Bd=BigInt(32);function Bx(e,t=!1){return t?{h:Number(e&ws),l:Number(e>>Bd&ws)}:{h:Number(e>>Bd&ws)|0,l:Number(e&ws)|0}}function Lx(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}=Bx(e[s],t);[r[s],o[s]]=[i,c]}return[r,o]}const Rx=(e,t,n)=>e<<n|t>>>32-n,Fx=(e,t,n)=>t<<n|e>>>32-n,Dx=(e,t,n)=>t<<n-32|e>>>64-n,jx=(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 qr(e){if(!Number.isSafeInteger(e)||e<0)throw new Error("positive integer expected, got "+e)}function Xt(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 Ld(e){if(typeof e!="function"||typeof e.create!="function")throw new Error("Hash should be wrapped by utils.createHasher");qr(e.outputLen),qr(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 Rd(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 _x(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 Ta(e){return new DataView(e.buffer,e.byteOffset,e.byteLength)}function Bt(e,t){return e<<32-t|e>>>t}const Ux=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;function zx(e){return e<<24&4278190080|e<<8&16711680|e>>>8&65280|e>>>24&255}function Hx(e){for(let t=0;t<e.length;t++)e[t]=zx(e[t]);return e}const Fd=Ux?e=>e:Hx,Dd=typeof Uint8Array.from([]).toHex=="function"&&typeof Uint8Array.fromHex=="function",Wx=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function cr(e){if(Xt(e),Dd)return e.toHex();let t="";for(let n=0;n<e.length;n++)t+=Wx[e[n]];return t}const Qt={_0:48,_9:57,A:65,F:70,a:97,f:102};function jd(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 Es(e){if(typeof e!="string")throw new Error("hex string expected, got "+typeof e);if(Dd)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=jd(e.charCodeAt(s)),c=jd(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 Vx(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=Vx(e)),Xt(e),e}function hn(...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 Oa{}function _d(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 Ud(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 Gx=BigInt(0),Zr=BigInt(1),qx=BigInt(2),Zx=BigInt(7),Kx=BigInt(256),Yx=BigInt(113),zd=[],Hd=[],Wd=[];for(let e=0,t=Zr,n=1,r=0;e<24;e++){[n,r]=[r,(2*n+3*r)%5],zd.push(2*(5*r+n)),Hd.push((e+1)*(e+2)/2%64);let o=Gx;for(let s=0;s<7;s++)t=(t<<Zr^(t>>Zx)*Yx)%Kx,t&qx&&(o^=Zr<<(Zr<<BigInt(s))-Zr);Wd.push(o)}const Vd=Lx(Wd,!0),Xx=Vd[0],Qx=Vd[1],Gd=(e,t,n)=>n>32?Dx(e,t,n):Rx(e,t,n),qd=(e,t,n)=>n>32?jx(e,t,n):Fx(e,t,n);function Jx(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=Gd(u,l,1)^n[c],d=qd(u,l,1)^n[c+1];for(let p=0;p<50;p+=10)e[i+p]^=f,e[i+p+1]^=d}let o=e[2],s=e[3];for(let i=0;i<24;i++){const c=Hd[i],a=Gd(o,s,c),u=qd(o,s,c),l=zd[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]^=Xx[r],e[1]^=Qx[r]}ar(n)}class Ca extends Oa{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,qr(r),!(0<t&&t<200))throw new Error("only keccak-f1600 function is supported");this.state=new Uint8Array(200),this.state32=_x(this.state)}clone(){return this._cloneInto()}keccak(){Fd(this.state32),Jx(this.state32,this.rounds),Fd(this.state32),this.posOut=0,this.pos=0}update(t){ir(this),t=Ss(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 qr(t),this.xofInto(new Uint8Array(t))}digestInto(t){if(Rd(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 Ca(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 eE=(e,t,n)=>_d(()=>new Ca(t,e,n)),Zd=eE(1,136,256/8);function Ce(e,t){const n=t||"hex",r=Zd(bt(e,{strict:!1})?or(e):e);return n==="bytes"?r:Kt(r)}const tE=e=>Ce(or(e));function nE(e){return tE(e)}function rE(e){let t=!0,n="",r=0,o="",s=!1;for(let i=0;i<e.length;i++){const c=e[i];if(["(",")",","].includes(c)&&(t=!0),c==="("&&r++,c===")"&&r--,!!t){if(r===0){if(c===" "&&["event","function",""].includes(o))o="";else if(o+=c,c===")"){s=!0;break}continue}if(c===" "){e[i-1]!==","&&n!==","&&n!==",("&&(n="",t=!1);continue}o+=c,n+=c}}if(!s)throw new V("Unable to normalize signature.");return o}const oE=e=>{const t=typeof e=="string"?e:bs(e);return rE(t)};function Kd(e){return nE(oE(e))}const $s=Kd;let mn=class extends V{constructor({address:t}){super(`Address "${t}" is invalid.`,{metaMessages:["- Address must be a hex value of 20 bytes (40 hex characters).","- Address must match its checksum counterpart."],name:"InvalidAddressError"})}},Ia=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 Na=new Ia(8192);function Ps(e,t){if(Na.has(`${e}.${t}`))return Na.get(`${e}.${t}`);const n=e.substring(2).toLowerCase(),r=Ce(In(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 Na.set(`${e}.${t}`,s),s}function Nn(e,t){if(!it(e,{strict:!1}))throw new mn({address:e});return Ps(e,t)}const sE=/^0x[a-fA-F0-9]{40}$/,Ma=new Ia(8192);function it(e,t){const{strict:n=!0}=t??{},r=`${e}.${n}`;if(Ma.has(r))return Ma.get(r);const o=sE.test(e)?e.toLowerCase()===e?!0:n?Ps(e)===e:!0:!1;return Ma.set(r,o),o}function wt(e){return typeof e[0]=="string"?ur(e):iE(e)}function iE(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 bt(e,{strict:!1})?Jd(e,t,n,{strict:r}):Qd(e,t,n,{strict:r})}function Yd(e,t){if(typeof t=="number"&&t>0&&t>be(e)-1)throw new Od({offset:t,position:"start",size:be(e)})}function Xd(e,t,n){if(typeof t=="number"&&typeof n=="number"&&be(e)!==n-t)throw new Od({offset:n,position:"end",size:be(e)})}function Qd(e,t,n,{strict:r}={}){Yd(e,t);const o=e.slice(t,n);return r&&Xd(o,t,n),o}function Jd(e,t,n,{strict:r}={}){Yd(e,t);const o=`0x${e.replace("0x","").slice((t??0)*2,(n??e.length)*2)}`;return r&&Xd(o,t,n),o}const aE=/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/,ep=/^(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 hx({expectedLength:e.length,givenLength:t.length});const n=cE({params:e,values:t}),r=Ba(n);return r.length===0?"0x":r}function cE({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=La(e.type);if(n){const[r,o]=n;return lE(t,{length:r,param:{...e,type:o}})}if(e.type==="tuple")return mE(t,{param:e});if(e.type==="address")return uE(t);if(e.type==="bool")return dE(t);if(e.type.startsWith("uint")||e.type.startsWith("int")){const r=e.type.startsWith("int"),[,,o="256"]=ep.exec(e.type)??[];return pE(t,{signed:r,size:Number(o)})}if(e.type.startsWith("bytes"))return fE(t,{param:e});if(e.type==="string")return hE(t);throw new wx(e.type,{docsPath:"/docs/contract/encodeAbiParameters"})}function Ba(e){let t=0;for(let s=0;s<e.length;s++){const{dynamic:i,encoded:c}=e[s];i?t+=32:t+=be(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(X(t+o,{size:32})),r.push(c),o+=be(c)):n.push(c)}return wt([...n,...r])}function uE(e){if(!it(e))throw new mn({address:e});return{dynamic:!1,encoded:pn(e.toLowerCase())}}function lE(e,{length:t,param:n}){const r=t===null;if(!Array.isArray(e))throw new Td(e);if(!r&&e.length!==t)throw new dx({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=Ba(s);if(r){const c=X(s.length,{size:32});return{dynamic:!0,encoded:s.length>0?wt([c,i]):c}}if(o)return{dynamic:!0,encoded:i}}return{dynamic:!1,encoded:wt(s.map(({encoded:i})=>i))}}function fE(e,{param:t}){const[,n]=t.type.split("bytes"),r=be(e);if(!n){let o=e;return r%32!==0&&(o=pn(o,{dir:"right",size:Math.ceil((e.length-2)/2/32)*32})),{dynamic:!0,encoded:wt([pn(X(r,{size:32})),o])}}if(r!==Number.parseInt(n))throw new px({expectedSize:Number.parseInt(n),value:e});return{dynamic:!1,encoded:pn(e,{dir:"right"})}}function dE(e){if(typeof e!="boolean")throw new V(`Invalid boolean value: "${e}" (type: ${typeof e}). Expected: \`true\` or \`false\`.`);return{dynamic:!1,encoded:pn(Md(e))}}function pE(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 Nd({max:r.toString(),min:o.toString(),signed:t,size:n/8,value:e.toString()})}return{dynamic:!1,encoded:X(e,{size:32,signed:t})}}function hE(e){const t=Gr(e),n=Math.ceil(be(t)/32),r=[];for(let o=0;o<n;o++)r.push(pn(lr(t,o*32,(o+1)*32),{dir:"right"}));return{dynamic:!0,encoded:wt([pn(X(be(t),{size:32})),...r])}}function mE(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?Ba(r):wt(r.map(({encoded:o})=>o))}}function La(e){const t=e.match(/^(.*)\[(\d+)?\]$/);return t?[t[2]?Number(t[2]):null,t[1]]:void 0}const Kr=e=>lr(Kd(e),0,4);function Mn(e){const{abi:t,args:n=[],name:r}=e,o=bt(r,{strict:!1}),s=t.filter(c=>o?c.type==="function"?Kr(c)===r:c.type==="event"?$s(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?Ra(u,f):!1})){if(i&&"inputs"in i&&i.inputs){const u=tp(c.inputs,i.inputs,n);if(u)throw new yx({abiItem:c,type:u[0]},{abiItem:i,type:u[1]})}i=c}}return i||s[0]}function Ra(e,t){const n=typeof e,r=t.type;switch(r){case"address":return it(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)=>Ra(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=>Ra(o,{...t,type:r.replace(/(\[[0-9]{0,}\])$/,"")})):!1}}function tp(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 tp(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")?it(n[r],{strict:!1}):i.includes("address")&&i.includes("bytes")?it(n[r],{strict:!1}):!1)return i}}const np="/docs/contract/encodeEventTopics";function Yr(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 Pd(n,{docsPath:np});o=u}if(o.type!=="event")throw new Pd(void 0,{docsPath:np});const s=gt(o),i=$s(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,d)=>Array.isArray(l[d])?l[d].map((p,h)=>rp({param:f,value:l[d][h]})):typeof l[d]<"u"&&l[d]!==null?rp({param:f,value:l[d]}):null))??[])}return[i,...c]}function rp({param:e,value:t}){if(e.type==="string"||e.type==="bytes")return Ce(or(t));if(e.type==="tuple"||e.type.match(/^(.*)\[(\d+)?\]$/))throw new Sx(e.type);return Jt([e],[t])}function As(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 op(e,t){const{address:n,abi:r,args:o,eventName:s,fromBlock:i,strict:c,toBlock:a}=t,u=As(e,{method:"eth_newFilter"}),l=s?Yr({abi:r,args:o,eventName:s}):void 0,f=await e.request({method:"eth_newFilter",params:[{address:n,fromBlock:typeof i=="bigint"?X(i):i,toBlock:typeof a=="bigint"?X(a):a,topics:l}]});return{abi:r,args:o,eventName:s,id:f,request:u(f),strict:!!c,type:"event"}}function xt(e){return typeof e=="string"?{address:e,type:"json-rpc"}:e}const sp="/docs/contract/encodeFunctionData";function gE(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:sp});o=s}if(o.type!=="function")throw new nr(void 0,{docsPath:sp});return{abi:[o],functionName:Kr(gt(o))}}function Lt(e){const{args:t}=e,{abi:n,functionName:r}=(()=>{var c;return e.abi.length===1&&((c=e.functionName)!=null&&c.startsWith("0x"))?e:gE(e)})(),o=n[0],s=r,i="inputs"in o&&o.inputs?Jt(o.inputs,t??[]):void 0;return ur([s,i??"0x"])}const ip={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."},ap={inputs:[{name:"message",type:"string"}],name:"Error",type:"error"},bE={inputs:[{name:"reason",type:"uint256"}],name:"Panic",type:"error"};class cp extends V{constructor({offset:t}){super(`Offset \`${t}\` cannot be negative.`,{name:"NegativeOffsetError"})}}class up extends V{constructor({length:t,position:n}){super(`Position \`${n}\` is out of bounds (\`0 < position < ${t}\`).`,{name:"PositionOutOfBoundsError"})}}class yE extends V{constructor({count:t,limit:n}){super(`Recursive read limit of \`${n}\` exceeded (recursive read count: \`${t}\`).`,{name:"RecursiveReadLimitExceededError"})}}const vE={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 yE({count:this.recursiveReadCount+1,limit:this.recursiveReadLimit})},assertPosition(e){if(e<0||e>this.bytes.length-1)throw new up({length:this.bytes.length,position:e})},decrementPosition(e){if(e<0)throw new cp({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 cp({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 Fa(e,{recursiveReadLimit:t=8192}={}){const n=Object.create(vE);return n.bytes=e,n.dataView=new DataView(e.buffer,e.byteOffset,e.byteLength),n.positionReadCount=new Map,n.recursiveReadLimit=t,n}function wE(e,t={}){typeof t.size<"u"&&yt(e,{size:t.size});const n=xe(e,t);return kt(n,t)}function xE(e,t={}){let n=e;if(typeof t.size<"u"&&(yt(n,{size:t.size}),n=Cn(n)),n.length>1||n[0]>1)throw new Px(n);return!!n[0]}function en(e,t={}){typeof t.size<"u"&&yt(e,{size:t.size});const n=xe(e,t);return Zt(n,t)}function EE(e,t={}){let n=e;return typeof t.size<"u"&&(yt(n,{size:t.size}),n=Cn(n,{dir:"right"})),new TextDecoder().decode(n)}function Xr(e,t){const n=typeof t=="string"?vt(t):t,r=Fa(n);if(be(n)===0&&e.length>0)throw new Wr;if(be(t)&&be(t)<32)throw new xd({data:typeof t=="string"?t:xe(t),params:e,size:be(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=La(t.type);if(r){const[o,s]=r;return $E(e,{...t,type:s},{length:o,staticPosition:n})}if(t.type==="tuple")return OE(e,t,{staticPosition:n});if(t.type==="address")return SE(e);if(t.type==="bool")return PE(e);if(t.type.startsWith("bytes"))return AE(e,t,{staticPosition:n});if(t.type.startsWith("uint")||t.type.startsWith("int"))return TE(e,t);if(t.type==="string")return CE(e,{staticPosition:n});throw new xx(t.type,{docsPath:"/docs/contract/decodeAbiParameters"})}const lp=32,Da=32;function SE(e){const t=e.readBytes(32);return[Ps(xe(Qd(t,-20))),32]}function $E(e,t,{length:n,staticPosition:r}){if(!n){const i=en(e.readBytes(Da)),c=r+i,a=c+lp;e.setPosition(c);const u=en(e.readBytes(lp)),l=Qr(t);let f=0;const d=[];for(let p=0;p<u;++p){e.setPosition(a+(l?p*32:f));const[h,m]=fr(e,t,{staticPosition:a});f+=m,d.push(h)}return e.setPosition(r+32),[d,32]}if(Qr(t)){const i=en(e.readBytes(Da)),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 PE(e){return[xE(e.readBytes(32),{size:32}),32]}function AE(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),[xe(a),32]}return[xe(e.readBytes(Number.parseInt(o),32)),32]}function TE(e,t){const n=t.type.startsWith("int"),r=Number.parseInt(t.type.split("int")[1]||"256"),o=e.readBytes(32);return[r>48?wE(o,{signed:n}):en(o,{signed:n}),32]}function OE(e,t,{staticPosition:n}){const r=t.components.length===0||t.components.some(({name:i})=>!i),o=r?[]:{};let s=0;if(Qr(t)){const i=en(e.readBytes(Da)),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 CE(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=EE(Cn(s));return e.setPosition(t+32),[i,32]}function Qr(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(Qr);const n=La(e.type);return!!(n&&Qr({...e,type:n[1]}))}function fp(e){const{abi:t,data:n}=e,r=lr(n,0,4);if(r==="0x")throw new Wr;const s=[...t||[],ap,bE].find(i=>i.type==="error"&&r===Kr(gt(i)));if(!s)throw new Sd(r,{docsPath:"/docs/contract/decodeErrorResult"});return{abiItem:s,args:"inputs"in s&&s.inputs&&s.inputs.length>0?Xr(s.inputs,lr(n,4)):void 0,errorName:s.name}}const Ee=(e,t,n)=>JSON.stringify(e,(r,o)=>typeof o=="bigint"?o.toString():o,n);function dp({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"?Ee(t[s]):t[s]}`).join(", ")})`}const IE={gwei:9,wei:18},NE={ether:-9,wei:9};function ja(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 pp(e,t="wei"){return ja(e,IE[t])}function Et(e,t="wei"){return ja(e,NE[t])}class ME extends V{constructor({address:t}){super(`State for account "${t}" is set multiple times.`,{name:"AccountStateConflictError"})}}class kE extends V{constructor(){super("state and stateDiff are set on the same account.",{name:"StateAssignmentConflictError"})}}function hp(e){return e.reduce((t,{slot:n,value:r})=>`${t} ${n}: ${r}
131
+ `,"")}function BE(e){return e.reduce((t,{address:n,...r})=>{let o=`${t} ${n}:
132
132
  `;return r.nonce&&(o+=` nonce: ${r.nonce}
133
133
  `),r.balance&&(o+=` balance: ${r.balance}
134
134
  `),r.code&&(o+=` code: ${r.code}
135
135
  `),r.state&&(o+=` state:
136
- `,o+=yp(r.state)),r.stateDiff&&(o+=` stateDiff:
137
- `,o+=yp(r.stateDiff)),o},` State Override:
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(`
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(`
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(`
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"})});
136
+ `,o+=hp(r.state)),r.stateDiff&&(o+=` stateDiff:
137
+ `,o+=hp(r.stateDiff)),o},` State Override:
138
+ `).slice(0,-1)}function Ts(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(`
139
+ `)}class LE extends V{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 RE extends V{constructor({transaction:t}){super("Cannot infer a transaction type from provided transaction.",{metaMessages:["Provided Transaction:","{",Ts(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 mp extends V{constructor({blockHash:t,blockNumber:n,blockTag:r,hash:o,index:s}){let i="Transaction";r&&s!==void 0&&(i=`Transaction at block time "${r}" at index "${s}"`),t&&s!==void 0&&(i=`Transaction at block hash "${t}" at index "${s}"`),n&&s!==void 0&&(i=`Transaction at block number "${n}" at index "${s}"`),o&&(i=`Transaction with hash "${o}"`),super(`${i} could not be found.`,{name:"TransactionNotFoundError"})}}class gp extends V{constructor({hash:t}){super(`Transaction receipt with hash "${t}" could not be found. The Transaction may not be processed on a block yet.`,{name:"TransactionReceiptNotFoundError"})}}class FE extends V{constructor({hash:t}){super(`Timed out while waiting for transaction with hash "${t}" to be confirmed.`,{name:"WaitForTransactionReceiptTimeoutError"})}}const DE=e=>e,Jr=e=>e;class bp extends V{constructor(t,{account:n,docsPath:r,chain:o,data:s,gas:i,gasPrice:c,maxFeePerGas:a,maxPriorityFeePerGas:u,nonce:l,to:f,value:d,stateOverride:p}){var v;const h=n?xt(n):void 0;let m=Ts({from:h==null?void 0:h.address,to:f,value:typeof d<"u"&&`${pp(d)} ${((v=o==null?void 0:o.nativeCurrency)==null?void 0:v.symbol)||"ETH"}`,data:s,gas:i,gasPrice:typeof c<"u"&&`${Et(c)} gwei`,maxFeePerGas:typeof a<"u"&&`${Et(a)} gwei`,maxPriorityFeePerGas:typeof u<"u"&&`${Et(u)} gwei`,nonce:l});p&&(m+=`
141
+ ${BE(p)}`),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 jE extends V{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?dp({abiItem:a,args:r,includeFunctionName:!1,includeName:!1}):void 0,l=a?gt(a,{includeName:!0}):void 0,f=Ts({address:o&&DE(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 _a extends V{constructor({abi:t,data:n,functionName:r,message:o}){let s,i,c,a;if(n&&n!=="0x")try{i=fp({abi:t,data:n});const{abiItem:l,errorName:f,args:d}=i;if(f==="Error")a=d[0];else if(f==="Panic"){const[p]=d;a=ip[p]}else{const p=l?gt(l,{includeName:!0}):void 0,h=l&&d?dp({abiItem:l,args:d,includeFunctionName:!1,includeName:!1}):void 0;c=[p?`Error: ${p}`:"",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 Sd&&(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 _E extends V{constructor({functionName:t}){super(`The contract function "${t}" returned no data ("0x").`,{metaMessages:["This could be due to any of the following:",` - The contract does not have the function "${t}",`," - The parameters passed to the contract function may be invalid, or"," - The address is not a contract."],name:"ContractFunctionZeroDataError"})}}class UE extends V{constructor({factory:t}){super(`Deployment for counterfactual contract call failed${t?` for factory "${t}".`:""}`,{metaMessages:["Please ensure:","- The `factory` is a valid contract deployment factory (ie. Create2 Factory, ERC-4337 Factory, etc).","- The `factoryData` is a valid encoded function call for contract deployment function on the factory."],name:"CounterfactualDeploymentFailedError"})}}class Os extends V{constructor({data:t,message:n}){super(n||"",{name:"RawContractError"}),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:3}),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.data=t}}class kn extends V{constructor({body:t,cause:n,details:r,headers:o,status:s,url:i}){super("HTTP request failed.",{cause:n,details:r,metaMessages:[s&&`Status: ${s}`,`URL: ${Jr(i)}`,t&&`Request body: ${Ee(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 Ua extends V{constructor({body:t,error:n,url:r}){super("RPC Request failed.",{cause:n,details:n.message,metaMessages:[`URL: ${Jr(r)}`,`Request body: ${Ee(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 yp extends V{constructor({body:t,url:n}){super("The request took too long to respond.",{details:"The request timed out.",metaMessages:[`URL: ${Jr(n)}`,`Request body: ${Ee(t)}`],name:"TimeoutError"})}}const zE=-1;class _e extends V{constructor(t,{code:n,docsPath:r,metaMessages:o,name:s,shortMessage:i}){super(i,{cause:t,docsPath:r,metaMessages:o||(t==null?void 0:t.metaMessages),name:s||"RpcError"}),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.name=s||t.name,this.code=t instanceof Ua?t.code:n??zE}}class Ze extends _e{constructor(t,n){super(t,n),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.data=n.data}}class eo extends _e{constructor(t){super(t,{code:eo.code,name:"ParseRpcError",shortMessage:"Invalid JSON was received by the server. An error occurred on the server while parsing the JSON text."})}}Object.defineProperty(eo,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32700});class to extends _e{constructor(t){super(t,{code:to.code,name:"InvalidRequestRpcError",shortMessage:"JSON is not a valid request object."})}}Object.defineProperty(to,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32600});class no extends _e{constructor(t,{method:n}={}){super(t,{code:no.code,name:"MethodNotFoundRpcError",shortMessage:`The method${n?` "${n}"`:""} does not exist / is not available.`})}}Object.defineProperty(no,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32601});class ro extends _e{constructor(t){super(t,{code:ro.code,name:"InvalidParamsRpcError",shortMessage:["Invalid parameters were provided to the RPC method.","Double check you have provided the correct parameters."].join(`
143
+ `)})}}Object.defineProperty(ro,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32602});class Bn extends _e{constructor(t){super(t,{code:Bn.code,name:"InternalRpcError",shortMessage:"An internal error was received."})}}Object.defineProperty(Bn,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32603});class Ln extends _e{constructor(t){super(t,{code:Ln.code,name:"InvalidInputRpcError",shortMessage:["Missing or invalid parameters.","Double check you have provided the correct parameters."].join(`
144
+ `)})}}Object.defineProperty(Ln,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32e3});class oo extends _e{constructor(t){super(t,{code:oo.code,name:"ResourceNotFoundRpcError",shortMessage:"Requested resource not found."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ResourceNotFoundRpcError"})}}Object.defineProperty(oo,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32001});class so extends _e{constructor(t){super(t,{code:so.code,name:"ResourceUnavailableRpcError",shortMessage:"Requested resource not available."})}}Object.defineProperty(so,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32002});class io extends _e{constructor(t){super(t,{code:io.code,name:"TransactionRejectedRpcError",shortMessage:"Transaction creation failed."})}}Object.defineProperty(io,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32003});class Rn extends _e{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 _e{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 ao extends _e{constructor(t){super(t,{code:ao.code,name:"JsonRpcVersionUnsupportedError",shortMessage:"Version of JSON-RPC protocol is not supported."})}}Object.defineProperty(ao,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32006});class pr extends Ze{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 co extends Ze{constructor(t){super(t,{code:co.code,name:"UnauthorizedProviderError",shortMessage:"The requested method and/or account has not been authorized by the user."})}}Object.defineProperty(co,"code",{enumerable:!0,configurable:!0,writable:!0,value:4100});class uo extends Ze{constructor(t,{method:n}={}){super(t,{code:uo.code,name:"UnsupportedProviderMethodError",shortMessage:`The Provider does not support the requested method${n?` " ${n}"`:""}.`})}}Object.defineProperty(uo,"code",{enumerable:!0,configurable:!0,writable:!0,value:4200});class lo extends Ze{constructor(t){super(t,{code:lo.code,name:"ProviderDisconnectedError",shortMessage:"The Provider is disconnected from all chains."})}}Object.defineProperty(lo,"code",{enumerable:!0,configurable:!0,writable:!0,value:4900});class fo extends Ze{constructor(t){super(t,{code:fo.code,name:"ChainDisconnectedError",shortMessage:"The Provider is not connected to the requested chain."})}}Object.defineProperty(fo,"code",{enumerable:!0,configurable:!0,writable:!0,value:4901});class po extends Ze{constructor(t){super(t,{code:po.code,name:"SwitchChainError",shortMessage:"An error occurred when attempting to switch chain."})}}Object.defineProperty(po,"code",{enumerable:!0,configurable:!0,writable:!0,value:4902});class ho extends Ze{constructor(t){super(t,{code:ho.code,name:"UnsupportedNonOptionalCapabilityError",shortMessage:"This Wallet does not support a capability that was not marked as optional."})}}Object.defineProperty(ho,"code",{enumerable:!0,configurable:!0,writable:!0,value:5700});class mo extends Ze{constructor(t){super(t,{code:mo.code,name:"UnsupportedChainIdError",shortMessage:"This Wallet does not support the requested chain ID."})}}Object.defineProperty(mo,"code",{enumerable:!0,configurable:!0,writable:!0,value:5710});class go extends Ze{constructor(t){super(t,{code:go.code,name:"DuplicateIdError",shortMessage:"There is already a bundle submitted with this ID."})}}Object.defineProperty(go,"code",{enumerable:!0,configurable:!0,writable:!0,value:5720});class bo extends Ze{constructor(t){super(t,{code:bo.code,name:"UnknownBundleIdError",shortMessage:"This bundle id is unknown / has not been submitted"})}}Object.defineProperty(bo,"code",{enumerable:!0,configurable:!0,writable:!0,value:5730});class yo extends Ze{constructor(t){super(t,{code:yo.code,name:"BundleTooLargeError",shortMessage:"The call bundle is too large for the Wallet to process."})}}Object.defineProperty(yo,"code",{enumerable:!0,configurable:!0,writable:!0,value:5740});class vo extends Ze{constructor(t){super(t,{code:vo.code,name:"AtomicReadyWalletRejectedUpgradeError",shortMessage:"The Wallet can support atomicity after an upgrade, but the user rejected the upgrade."})}}Object.defineProperty(vo,"code",{enumerable:!0,configurable:!0,writable:!0,value:5750});class wo extends Ze{constructor(t){super(t,{code:wo.code,name:"AtomicityNotSupportedError",shortMessage:"The wallet does not support atomic execution but the request requires it."})}}Object.defineProperty(wo,"code",{enumerable:!0,configurable:!0,writable:!0,value:5760});class HE extends _e{constructor(t){super(t,{name:"UnknownRpcError",shortMessage:"An unknown RPC error occurred."})}}const WE=3;function hr(e,{abi:t,address:n,args:r,docsPath:o,functionName:s,sender:i}){const c=e instanceof Os?e:e instanceof V?e.walk(h=>"data"in h)||e.walk():{},{code:a,data:u,details:l,message:f,shortMessage:d}=c,p=e instanceof Wr?new _E({functionName:s}):[WE,Bn.code].includes(a)&&(u||l||f||d)?new _a({abi:t,data:typeof u=="object"?u.data:u,functionName:s,message:c instanceof Ua?l:d??f}):e;return new jE(p,{abi:t,args:r,contractAddress:n,docsPath:o,functionName:s,sender:i})}function VE(e){const t=Ce(`0x${e.substring(4)}`).substring(26);return Ps(`0x${t}`)}async function GE({hash:e,signature:t}){const n=bt(e)?e:Kt(e),{secp256k1:r}=await Promise.resolve().then(()=>FS);return`0x${(()=>{if(typeof t=="object"&&"r"in t&&"s"in t){const{r:u,s:l,v:f,yParity:d}=t,p=Number(d??f),h=vp(p);return new r.Signature(kt(u),kt(l)).addRecoveryBit(h)}const i=bt(t)?t:Kt(t);if(be(i)!==65)throw new Error("invalid signature length");const c=Zt(`0x${i.slice(130)}`),a=vp(c);return r.Signature.fromCompact(i.substring(2,130)).addRecoveryBit(a)})().recoverPublicKey(n.substring(2)).toHex(!1)}`}function vp(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 wp({hash:e,signature:t}){return VE(await GE({hash:e,signature:t}))}function qE(e,t="hex"){const n=xp(e),r=Fa(new Uint8Array(n.length));return n.encode(r),t==="hex"?xe(r.bytes):r.bytes}function xp(e){return Array.isArray(e)?ZE(e.map(t=>xp(t))):KE(e)}function ZE(e){const t=e.reduce((o,s)=>o+s.length,0),n=Ep(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 KE(e){const t=typeof e=="string"?vt(e):e,n=Ep(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 Ep(e){if(e<2**8)return 1;if(e<2**16)return 2;if(e<2**24)return 3;if(e<2**32)return 4;throw new V("Length is too large.")}function YE(e){const{chainId:t,nonce:n,to:r}=e,o=e.contractAddress??e.address,s=Ce(ur(["0x05",qE([t?X(t):"0x",o,n?X(n):"0x"])]));return r==="bytes"?vt(s):s}async function XE(e){const{authorization:t,signature:n}=e;return wp({hash:YE(t),signature:n??t})}class QE extends V{constructor(t,{account:n,docsPath:r,chain:o,data:s,gas:i,gasPrice:c,maxFeePerGas:a,maxPriorityFeePerGas:u,nonce:l,to:f,value:d}){var h;const p=Ts({from:n==null?void 0:n.address,to:f,value:typeof d<"u"&&`${pp(d)} ${((h=o==null?void 0:o.nativeCurrency)==null?void 0:h.symbol)||"ETH"}`,data:s,gas:i,gasPrice:typeof c<"u"&&`${Et(c)} gwei`,maxFeePerGas:typeof a<"u"&&`${Et(a)} gwei`,maxPriorityFeePerGas:typeof u<"u"&&`${Et(u)} gwei`,nonce:l});super(t.shortMessage,{cause:t,docsPath:r,metaMessages:[...t.metaMessages?[...t.metaMessages," "]:[],"Estimate Gas Arguments:",p].filter(Boolean),name:"EstimateGasExecutionError"}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.cause=t}}class mr extends V{constructor({cause:t,message:n}={}){var o;const r=(o=n==null?void 0:n.replace("execution reverted: ",""))==null?void 0:o.replace("execution reverted","");super(`Execution reverted ${r?`with reason: ${r}`:"for an unknown reason"}.`,{cause:t,name:"ExecutionRevertedError"})}}Object.defineProperty(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 V{constructor({cause:t,maxFeePerGas:n}={}){super(`The fee cap (\`maxFeePerGas\`${n?` = ${Et(n)} gwei`:""}) cannot be higher than the maximum allowed value (2^256-1).`,{cause:t,name:"FeeCapTooHighError"})}}Object.defineProperty(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 za extends V{constructor({cause:t,maxFeePerGas:n}={}){super(`The fee cap (\`maxFeePerGas\`${n?` = ${Et(n)}`:""} gwei) cannot be lower than the block base fee.`,{cause:t,name:"FeeCapTooLowError"})}}Object.defineProperty(za,"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 Ha extends V{constructor({cause:t,nonce:n}={}){super(`Nonce provided for the transaction ${n?`(${n}) `:""}is higher than the next one expected.`,{cause:t,name:"NonceTooHighError"})}}Object.defineProperty(Ha,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/nonce too high/});class Wa extends V{constructor({cause:t,nonce:n}={}){super([`Nonce provided for the transaction ${n?`(${n}) `:""}is lower than the current nonce of the account.`,"Try increasing the nonce or find the latest nonce with `getTransactionCount`."].join(`
145
+ `),{cause:t,name:"NonceTooLowError"})}}Object.defineProperty(Wa,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/nonce too low|transaction already imported|already known/});class Va extends V{constructor({cause:t,nonce:n}={}){super(`Nonce provided for the transaction ${n?`(${n}) `:""}exceeds the maximum allowed nonce.`,{cause:t,name:"NonceMaxValueError"})}}Object.defineProperty(Va,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/nonce has max value/});class Ga extends V{constructor({cause:t}={}){super(["The total cost (gas * gas fee + value) of executing this transaction exceeds the balance of the account."].join(`
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(Ga,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/insufficient funds|exceeds transaction sender account balance/});class qa extends V{constructor({cause:t,gas:n}={}){super(`The amount of gas ${n?`(${n}) `:""}provided for the transaction exceeds the limit allowed for the block.`,{cause:t,name:"IntrinsicGasTooHighError"})}}Object.defineProperty(qa,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/intrinsic gas too high|gas limit reached/});class Za extends V{constructor({cause:t,gas:n}={}){super(`The amount of gas ${n?`(${n}) `:""}provided for the transaction is too low.`,{cause:t,name:"IntrinsicGasTooLowError"})}}Object.defineProperty(Za,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/intrinsic gas too low/});class Ka extends V{constructor({cause:t}){super("The transaction type is not supported for this chain.",{cause:t,name:"TransactionTypeNotSupportedError"})}}Object.defineProperty(Ka,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/transaction type not valid/});class Is extends V{constructor({cause:t,maxPriorityFeePerGas:n,maxFeePerGas:r}={}){super([`The provided tip (\`maxPriorityFeePerGas\`${n?` = ${Et(n)} gwei`:""}) cannot be higher than the fee cap (\`maxFeePerGas\`${r?` = ${Et(r)} gwei`:""}).`].join(`
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 V{constructor({cause:t}){super(`An error occurred while executing: ${t==null?void 0:t.shortMessage}`,{cause:t,name:"UnknownNodeError"})}}function Ya(e,t){const n=(e.details||"").toLowerCase(),r=e instanceof V?e.walk(o=>(o==null?void 0:o.code)===mr.code):e;return r instanceof V?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}):za.nodeMessage.test(n)?new za({cause:e,maxFeePerGas:t==null?void 0:t.maxFeePerGas}):Ha.nodeMessage.test(n)?new Ha({cause:e,nonce:t==null?void 0:t.nonce}):Wa.nodeMessage.test(n)?new Wa({cause:e,nonce:t==null?void 0:t.nonce}):Va.nodeMessage.test(n)?new Va({cause:e,nonce:t==null?void 0:t.nonce}):Ga.nodeMessage.test(n)?new Ga({cause:e}):qa.nodeMessage.test(n)?new qa({cause:e,gas:t==null?void 0:t.gas}):Za.nodeMessage.test(n)?new Za({cause:e,gas:t==null?void 0:t.gas}):Ka.nodeMessage.test(n)?new Ka({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 JE(e,{docsPath:t,...n}){const r=(()=>{const o=Ya(e,n);return o instanceof Ns?e:o})();return new QE(r,{docsPath:t,...n})}function Xa(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 e2={legacy:"0x0",eip2930:"0x1",eip1559:"0x2",eip4844:"0x3",eip7702:"0x4"};function Ms(e){const t={};return typeof e.authorizationList<"u"&&(t.authorizationList=t2(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=>xe(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=X(e.gas)),typeof e.gasPrice<"u"&&(t.gasPrice=X(e.gasPrice)),typeof e.maxFeePerBlobGas<"u"&&(t.maxFeePerBlobGas=X(e.maxFeePerBlobGas)),typeof e.maxFeePerGas<"u"&&(t.maxFeePerGas=X(e.maxFeePerGas)),typeof e.maxPriorityFeePerGas<"u"&&(t.maxPriorityFeePerGas=X(e.maxPriorityFeePerGas)),typeof e.nonce<"u"&&(t.nonce=X(e.nonce)),typeof e.to<"u"&&(t.to=e.to),typeof e.type<"u"&&(t.type=e2[e.type]),typeof e.value<"u"&&(t.value=X(e.value)),t}function t2(e){return e.map(t=>({address:t.address,r:t.r?X(BigInt(t.r)):t.r,s:t.s?X(BigInt(t.s)):t.s,chainId:X(t.chainId),nonce:X(t.nonce),...typeof t.yParity<"u"?{yParity:X(t.yParity)}:{},...typeof t.v<"u"&&typeof t.yParity>"u"?{v:X(t.v)}:{}}))}function Sp(e){if(!(!e||e.length===0))return e.reduce((t,{slot:n,value:r})=>{if(n.length!==66)throw new Id({size:n.length,targetSize:66,type:"hex"});if(r.length!==66)throw new Id({size:r.length,targetSize:66,type:"hex"});return t[n]=r,t},{})}function n2(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=X(t)),n!==void 0&&(i.nonce=X(n)),r!==void 0&&(i.state=Sp(r)),o!==void 0){if(i.state)throw new kE;i.stateDiff=Sp(o)}return i}function Qa(e){if(!e)return;const t={};for(const{address:n,...r}of e){if(!it(n,{strict:!1}))throw new mn({address:n});if(t[n])throw new ME({address:n});t[n]=n2(r)}return t}const $p=2n**256n-1n;function xo(e){const{account:t,gasPrice:n,maxFeePerGas:r,maxPriorityFeePerGas:o,to:s}=e,i=t?xt(t):void 0;if(i&&!it(i.address))throw new mn({address:i.address});if(s&&!it(s))throw new mn({address:s});if(typeof n<"u"&&(typeof r<"u"||typeof o<"u"))throw new LE;if(r&&r>$p)throw new Cs({maxFeePerGas:r});if(o&&r&&o>r)throw new Is({maxFeePerGas:r,maxPriorityFeePerGas:o})}class r2 extends V{constructor(){super("`baseFeeMultiplier` must be greater than 1.",{name:"BaseFeeScalarError"})}}class Ja extends V{constructor(){super("Chain does not support EIP-1559 fees.",{name:"Eip1559FeesNotSupportedError"})}}class o2 extends V{constructor({maxPriorityFeePerGas:t}){super(`\`maxFeePerGas\` cannot be less than the \`maxPriorityFeePerGas\` (${Et(t)} gwei).`,{name:"MaxFeePerGasTooLowError"})}}class Pp extends V{constructor({blockHash:t,blockNumber:n}){let r="Block";t&&(r=`Block at hash "${t}"`),n&&(r=`Block at number "${n}"`),super(`${r} could not be found.`,{name:"BlockNotFoundError"})}}const Ap={"0x0":"legacy","0x1":"eip2930","0x2":"eip1559","0x3":"eip4844","0x4":"eip7702"};function Tp(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?Ap[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=s2(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 s2(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 Op(e){const t=(e.transactions??[]).map(n=>typeof n=="string"?n:Tp(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 Rt(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?X(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 Pp({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)||Op)(c)}async function ec(e){const t=await e.request({method:"eth_gasPrice"});return BigInt(t)}async function i2(e,t){return Cp(e,t)}async function Cp(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,Rt,"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 kt(a)}catch{const[c,a]=await Promise.all([n?Promise.resolve(n):J(e,Rt,"getBlock")({}),J(e,ec,"getGasPrice")({})]);if(typeof c.baseFeePerGas!="bigint")throw new Ja;const u=a-c.baseFeePerGas;return u<0n?0n:u}}async function a2(e,t){return tc(e,t)}async function tc(e,t){var d,p;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 r2;const a=10**(((d=i.toString().split(".")[1])==null?void 0:d.length)??0),u=h=>h*BigInt(Math.ceil(i*a))/BigInt(a),l=n||await J(e,Rt,"getBlock")({});if(typeof((p=r==null?void 0:r.fees)==null?void 0:p.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 Ja;const h=typeof(o==null?void 0:o.maxPriorityFeePerGas)=="bigint"?o.maxPriorityFeePerGas:await Cp(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,ec,"getGasPrice")({}))}}async function Ip(e,{address:t,blockTag:n="latest",blockNumber:r}){const o=await e.request({method:"eth_getTransactionCount",params:[t,typeof r=="bigint"?X(r):n]},{dedupe:!!r});return Zt(o)}function Np(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=>vt(s)):e.blobs,o=[];for(const s of r)o.push(Uint8Array.from(t.blobToKzgCommitment(s)));return n==="bytes"?o:o.map(s=>xe(s))}function Mp(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=>vt(i)):e.blobs,o=typeof e.commitments[0]=="string"?e.commitments.map(i=>vt(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=>xe(i))}function c2(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 u2(e,t,n){return e&t^~e&n}function l2(e,t,n){return e&t^e&n^t&n}class f2 extends Oa{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=Ta(this.buffer)}update(t){ir(this),t=Ss(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=Ta(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),Rd(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;c2(r,o-8,BigInt(this.length*8),s),this.process(r,0);const c=Ta(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 gn=Uint32Array.from([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),d2=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]),bn=new Uint32Array(64);class p2 extends f2{constructor(t=32){super(64,t,8,!1),this.A=gn[0]|0,this.B=gn[1]|0,this.C=gn[2]|0,this.D=gn[3]|0,this.E=gn[4]|0,this.F=gn[5]|0,this.G=gn[6]|0,this.H=gn[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)bn[f]=t.getUint32(n,!1);for(let f=16;f<64;f++){const d=bn[f-15],p=bn[f-2],h=Bt(d,7)^Bt(d,18)^d>>>3,m=Bt(p,17)^Bt(p,19)^p>>>10;bn[f]=m+bn[f-7]+h+bn[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 d=Bt(c,6)^Bt(c,11)^Bt(c,25),p=l+d+u2(c,a,u)+d2[f]+bn[f]|0,m=(Bt(r,2)^Bt(r,13)^Bt(r,22))+l2(r,o,s)|0;l=u,u=a,a=c,c=i+p|0,i=s,s=o,o=r,r=p+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(bn)}destroy(){this.set(0,0,0,0,0,0,0,0),ar(this.buffer)}}const kp=_d(()=>new p2),h2=kp;function m2(e,t){return h2(bt(e,{strict:!1})?or(e):e)}function g2(e){const{commitment:t,version:n=1}=e,r=e.to??(typeof t=="string"?"hex":"bytes"),o=m2(t);return o.set([n],0),r==="bytes"?o:xe(o)}function b2(e){const{commitments:t,version:n}=e,r=e.to,o=[];for(const s of t)o.push(g2({commitment:s,to:r,version:n}));return o}const Bp=6,Lp=32,nc=4096,Rp=Lp*nc,Fp=Rp*Bp-1-1*nc*Bp;class y2 extends V{constructor({maxSize:t,size:n}){super("Blob size is too large.",{metaMessages:[`Max: ${t} bytes`,`Given: ${n} bytes`],name:"BlobSizeTooLargeError"})}}class v2 extends V{constructor(){super("Blob data must not be empty.",{name:"EmptyBlobError"})}}function w2(e){const t=typeof e.data=="string"?vt(e.data):e.data,n=be(t);if(!n)throw new v2;if(n>Fp)throw new y2({maxSize:Fp,size:n});const r=[];let o=!0,s=0;for(;o;){const i=Fa(new Uint8Array(Rp));let c=0;for(;c<nc;){const a=t.slice(s,s+(Lp-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=>xe(i.bytes))}function x2(e){const{data:t,kzg:n,to:r}=e,o=e.blobs??w2({data:t}),s=e.commitments??Np({blobs:o,kzg:n,to:r}),i=e.proofs??Mp({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 E2(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 RE({transaction:e})}async function Dp(e){const t=await e.request({method:"eth_chainId"},{dedupe:!0});return Zt(t)}const S2=["blobVersionedHashes","chainId","fees","gas","nonce","type"],jp=new Map;async function _p(e,t){const{account:n=e.account,blobs:r,chain:o,gas:s,kzg:i,nonce:c,nonceManager:a,parameters:u=S2,type:l}=t,f=n&&xt(n),d={...t,...f?{from:f==null?void 0:f.address}:{}};let p;async function h(){return p||(p=await J(e,Rt,"getBlock")({blockTag:"latest"}),p)}let m;async function v(){return m||(o?o.id:typeof t.chainId<"u"?t.chainId:(m=await J(e,Dp,"getChainId")({}),m))}if(u.includes("nonce")&&typeof c>"u"&&f)if(a){const O=await v();d.nonce=await a.consume({address:f.address,chainId:O,client:e})}else d.nonce=await J(e,Ip,"getTransactionCount")({address:f.address,blockTag:"pending"});if((u.includes("blobVersionedHashes")||u.includes("sidecars"))&&r&&i){const O=Np({blobs:r,kzg:i});if(u.includes("blobVersionedHashes")){const b=b2({commitments:O,to:"hex"});d.blobVersionedHashes=b}if(u.includes("sidecars")){const b=Mp({blobs:r,commitments:O,kzg:i}),A=x2({blobs:r,commitments:O,proofs:b,to:"hex"});d.sidecars=A}}if(u.includes("chainId")&&(d.chainId=await v()),(u.includes("fees")||u.includes("type"))&&typeof l>"u")try{d.type=E2(d)}catch{let O=jp.get(e.uid);if(typeof O>"u"){const b=await h();O=typeof(b==null?void 0:b.baseFeePerGas)=="bigint",jp.set(e.uid,O)}d.type=O?"eip1559":"legacy"}if(u.includes("fees"))if(d.type!=="legacy"&&d.type!=="eip2930"){if(typeof d.maxFeePerGas>"u"||typeof d.maxPriorityFeePerGas>"u"){const O=await h(),{maxFeePerGas:b,maxPriorityFeePerGas:A}=await tc(e,{block:O,chain:o,request:d});if(typeof t.maxPriorityFeePerGas>"u"&&t.maxFeePerGas&&t.maxFeePerGas<A)throw new o2({maxPriorityFeePerGas:A});d.maxPriorityFeePerGas=A,d.maxFeePerGas=b}}else{if(typeof t.maxFeePerGas<"u"||typeof t.maxPriorityFeePerGas<"u")throw new Ja;if(typeof t.gasPrice>"u"){const O=await h(),{gasPrice:b}=await tc(e,{block:O,chain:o,request:d,type:"legacy"});d.gasPrice=b}}return u.includes("gas")&&typeof s>"u"&&(d.gas=await J(e,rc,"estimateGas")({...d,account:f&&{address:f.address,type:"json-rpc"}})),xo(d),delete d.parameters,d}async function Up(e,{address:t,blockNumber:n,blockTag:r=e.experimental_blockTag??"latest"}){const o=typeof n=="bigint"?X(n):void 0,s=await e.request({method:"eth_getBalance",params:[t,o||r]});return BigInt(s)}async function rc(e,t){var o,s,i;const{account:n=e.account}=t,r=n?xt(n):void 0;try{let S=function(T){const{block:C,request:y,rpcStateOverride:M}=T;return e.request({method:"eth_estimateGas",params:M?[y,C??e.experimental_blockTag??"latest",M]:C?[y,C]:[y]})};const{accessList:c,authorizationList:a,blobs:u,blobVersionedHashes:l,blockNumber:f,blockTag:d,data:p,gas:h,gasPrice:m,maxFeePerBlobGas:v,maxFeePerGas:O,maxPriorityFeePerGas:b,nonce:A,value:k,stateOverride:R,...D}=await _p(e,{...t,parameters:(r==null?void 0:r.type)==="local"?void 0:["blobVersionedHashes"]}),g=(typeof f=="bigint"?X(f):void 0)||d,w=Qa(R),P=await(async()=>{if(D.to)return D.to;if(a&&a.length>0)return await XE({authorization:a[0]}).catch(()=>{throw new V("`to` is required. Could not infer from `authorizationList`")})})();xo(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)({...Xa(D,{format:N}),from:r==null?void 0:r.address,accessList:c,authorizationList:a,blobs:u,blobVersionedHashes:l,data:p,gas:h,gasPrice:m,maxFeePerBlobGas:v,maxFeePerGas:O,maxPriorityFeePerGas:b,nonce:A,to:P,value:k});let x=BigInt(await S({block:g,request:$,rpcStateOverride:w}));if(a){const T=await Up(e,{address:$.from}),C=await Promise.all(a.map(async y=>{const{address:M}=y,F=await S({block:g,request:{authorizationList:void 0,data:p,from:r==null?void 0:r.address,to:M,value:X(T)},rpcStateOverride:w}).catch(()=>100000n);return 2n*BigInt(F)}));x+=C.reduce((y,M)=>y+M,0n)}return x}catch(c){throw JE(c,{...t,account:r,chain:e.chain})}}async function $2(e,t){const{abi:n,address:r,args:o,functionName:s,dataSuffix:i,...c}=t,a=Lt({abi:n,args:o,functionName:s});try{return await J(e,rc,"estimateGas")({data:`${a}${i?i.replace("0x",""):""}`,to:r,...c})}catch(u){const l=c.account?xt(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(!it(e,{strict:!1}))throw new mn({address:e});if(!it(t,{strict:!1}))throw new mn({address:t});return e.toLowerCase()===t.toLowerCase()}const zp="/docs/contract/decodeEventLog";function oc(e){const{abi:t,data:n,strict:r,topics:o}=e,s=r??!0,[i,...c]=o;if(!i)throw new gx({docsPath:zp});const a=t.find(m=>m.type==="event"&&i===$s(gt(m)));if(!(a&&"name"in a)||a.type!=="event")throw new $d(i,{docsPath:zp});const{name:u,inputs:l}=a,f=l==null?void 0:l.some(m=>!("name"in m&&m.name)),d=f?[]:{},p=l.map((m,v)=>[m,v]).filter(([m])=>"indexed"in m&&m.indexed);for(let m=0;m<p.length;m++){const[v,O]=p[m],b=c[m];if(!b)throw new vs({abiItem:a,param:v});d[f?O:v.name||O]=P2({param:v,value:b})}const h=l.filter(m=>!("indexed"in m&&m.indexed));if(h.length>0){if(n&&n!=="0x")try{const m=Xr(h,n);if(m)if(f)for(let v=0;v<l.length;v++)d[v]=d[v]??m.shift();else for(let v=0;v<h.length;v++)d[h[v].name]=m[v]}catch(m){if(s)throw m instanceof xd||m instanceof up?new Vr({abiItem:a,data:n,params:h,size:be(n)}):m}else if(s)throw new Vr({abiItem:a,data:"0x",params:h,size:0})}return{eventName:u,args:Object.values(d).length>0?d:void 0}}function P2({param:e,value:t}){return e.type==="string"||e.type==="bytes"||e.type==="tuple"||e.type.match(/^(.*)\[(\d+)?\]$/)?t:(Xr([e],t)||[])[0]}function sc(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]===$s(l));if(!a)return null;const u=oc({...i,abi:[a],strict:o});return s&&!s.includes(u.eventName)||!A2({args:u.args,inputs:a.inputs,matchArgs:n})?null:{...u,...i}}catch(a){let u,l;if(a instanceof $d)return null;if(a instanceof Vr||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 A2(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"?Ce(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 ic(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=>Yr({abi:[m],eventName:m.name,args:i?void 0:c}))],s&&(f=f[0]));let d;n?d=await e.request({method:"eth_getLogs",params:[{address:t,topics:f,blockHash:n}]}):d=await e.request({method:"eth_getLogs",params:[{address:t,topics:f,fromBlock:typeof r=="bigint"?X(r):r,toBlock:typeof o=="bigint"?X(o):o}]});const p=d.map(h=>tn(h));return l?sc({abi:l,args:c,logs:p,strict:u}):p}async function Hp(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(d=>d.type==="event");return J(e,ic,"getLogs")({address:r,args:o,blockHash:s,event:l,events:f,fromBlock:c,toBlock:a,strict:u})}const ac="/docs/contract/decodeFunctionResult";function Fn(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:ac});s=c}if(s.type!=="function")throw new nr(void 0,{docsPath:ac});if(!s.outputs)throw new Ad(s.name,{docsPath:ac});const i=Xr(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 cc=BigInt(0),uc=BigInt(1);function Bs(e,t=""){if(typeof e!="boolean"){const n=t&&`"${t}"`;throw new Error(n+"expected boolean, got type="+typeof e)}return e}function Dn(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 Ls(e){const t=e.toString(16);return t.length&1?"0"+t:t}function Wp(e){if(typeof e!="string")throw new Error("hex string expected, got "+typeof e);return e===""?cc:BigInt("0x"+e)}function Rs(e){return Wp(cr(e))}function Vp(e){return Xt(e),Wp(cr(Uint8Array.from(e).reverse()))}function lc(e,t){return Es(e.toString(16).padStart(t*2,"0"))}function Gp(e,t){return lc(e,t).reverse()}function Ue(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 fc=e=>typeof e=="bigint"&&cc<=e;function T2(e,t,n){return fc(e)&&fc(t)&&fc(n)&&t<=e&&e<n}function O2(e,t,n,r){if(!T2(t,n,r))throw new Error("expected valid "+e+": "+n+" <= n < "+r+", got "+t)}function qp(e){let t;for(t=0;e>cc;e>>=uc,t+=1);return t}const Eo=e=>(uc<<BigInt(e))-uc;function C2(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=p=>new Uint8Array(p),o=p=>Uint8Array.of(p);let s=r(e),i=r(e),c=0;const a=()=>{s.fill(1),i.fill(0),c=0},u=(...p)=>n(i,s,...p),l=(p=r(0))=>{i=u(o(0),p),s=u(),p.length!==0&&(i=u(o(1),p),s=u())},f=()=>{if(c++>=1e3)throw new Error("drbg: tried 1000 values");let p=0;const h=[];for(;p<t;){s=u();const m=s.slice();h.push(m),p+=s.length}return hn(...h)};return(p,h)=>{a(),l(p);let m;for(;!(m=h(f()));)l();return a(),m}}function dc(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 Zp(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 I2="0.1.1";function N2(){return I2}class he extends Error{constructor(t,n={}){const r=(()=>{var a;if(n.cause instanceof he){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 he&&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@${N2()}`}),this.cause=n.cause,this.details=r,this.docs=i,this.docsPath=o,this.shortMessage=t}walk(t){return Kp(this,t)}}function Kp(e,t){return t!=null&&t(e)?e:e&&typeof e=="object"&&"cause"in e&&e.cause?Kp(e.cause,t):t?null:e}const M2="#__bigint";function k2(e,t,n){return JSON.stringify(e,(r,o)=>typeof o=="bigint"?o.toString()+M2:o,n)}function B2(e,t){if(Qp(e)>t)throw new W2({givenSize:Qp(e),maxSize:t})}const nn={zero:48,nine:57,A:65,F:70,a:97,f:102};function Yp(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 L2(e,t={}){const{dir:n,size:r=32}=t;if(r===0)return e;if(e.length>r)throw new V2({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 pc(e,t){if(at(e)>t)throw new Y2({givenSize:at(e),maxSize:t})}function R2(e,t){if(typeof t=="number"&&t>0&&t>at(e)-1)throw new oh({offset:t,position:"start",size:at(e)})}function F2(e,t,n){if(typeof t=="number"&&typeof n=="number"&&at(e)!==n-t)throw new oh({offset:n,position:"end",size:at(e)})}function Xp(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 X2({size:Math.ceil(o.length/2),targetSize:r,type:"Hex"});return`0x${o[n==="right"?"padEnd":"padStart"](r*2,"0")}`}const D2=new TextEncoder;function j2(e){return e instanceof Uint8Array?e:typeof e=="string"?U2(e):_2(e)}function _2(e){return e instanceof Uint8Array?e:new Uint8Array(e)}function U2(e,t={}){const{size:n}=t;let r=e;n&&(pc(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=Yp(o.charCodeAt(a++)),l=Yp(o.charCodeAt(a++));if(u===void 0||l===void 0)throw new he(`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=D2.encode(e);return typeof n=="number"?(B2(r,n),H2(r,n)):r}function H2(e,t){return L2(e,{dir:"right",size:t})}function Qp(e){return e.length}let W2=class extends he{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"})}},V2=class extends he{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 G2=new TextEncoder,q2=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function Z2(e,t={}){const{strict:n=!1}=t;if(!e)throw new nh(e);if(typeof e!="string")throw new nh(e);if(n&&!/^0x[0-9a-fA-F]*$/.test(e))throw new rh(e);if(!e.startsWith("0x"))throw new rh(e)}function Ft(...e){return`0x${e.reduce((t,n)=>t+n.replace("0x",""),"")}`}function Jp(e,t={}){const n=`0x${Number(e)}`;return typeof t.size=="number"?(pc(n,t.size),jn(n,t.size)):n}function eh(e,t={}){let n="";for(let o=0;o<e.length;o++)n+=q2[e[o]];const r=`0x${n}`;return typeof t.size=="number"?(pc(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 th({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 hc(e,t={}){return eh(G2.encode(e),t)}function jn(e,t){return Xp(e,{dir:"left",size:t})}function _n(e,t){return Xp(e,{dir:"right",size:t})}function mc(e,t,n,r={}){const{strict:o}=r;R2(e,t);const s=`0x${e.replace("0x","").slice((t??0)*2,(n??e.length)*2)}`;return o&&F2(s,t,n),s}function at(e){return Math.ceil((e.length-2)/2)}function K2(e,t={}){const{strict:n=!1}=t;try{return Z2(e,{strict:n}),!0}catch{return!1}}class th extends he{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 nh extends he{constructor(t){super(`Value \`${typeof t=="object"?k2(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 rh extends he{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 Y2 extends he{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 oh extends he{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 X2 extends he{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 Q2(e){return{address:e.address,amount:Be(e.amount),index:Be(e.index),validatorIndex:Be(e.validatorIndex)}}function sh(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(Q2)}}}const gc=[{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"}],bc=[{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"}]}],ih=[{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"}],ah=[...ih,{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"}]}],J2=[...ih,{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"}]}],ch=[{name:"text",type:"function",stateMutability:"view",inputs:[{name:"name",type:"bytes32"},{name:"key",type:"string"}],outputs:[{name:"",type:"string"}]}],uh=[{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"}]}],lh=[{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"}],gr=[{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"}]}],e6="0x82ad56cb",fh="0x608060405234801561001057600080fd5b5060405161018e38038061018e83398101604081905261002f91610124565b6000808351602085016000f59050803b61004857600080fd5b6000808351602085016000855af16040513d6000823e81610067573d81fd5b3d81f35b634e487b7160e01b600052604160045260246000fd5b600082601f83011261009257600080fd5b81516001600160401b038111156100ab576100ab61006b565b604051601f8201601f19908116603f011681016001600160401b03811182821017156100d9576100d961006b565b6040528181528382016020018510156100f157600080fd5b60005b82811015610110576020818601810151838301820152016100f4565b506000918101602001919091529392505050565b6000806040838503121561013757600080fd5b82516001600160401b0381111561014d57600080fd5b61015985828601610081565b602085015190935090506001600160401b0381111561017757600080fd5b61018385828601610081565b915050925092905056fe",t6="0x608060405234801561001057600080fd5b506040516102c03803806102c083398101604081905261002f916101e6565b836001600160a01b03163b6000036100e457600080836001600160a01b03168360405161005c9190610270565b6000604051808303816000865af19150503d8060008114610099576040519150601f19603f3d011682016040523d82523d6000602084013e61009e565b606091505b50915091508115806100b857506001600160a01b0386163b155b156100e1578060405163101bb98d60e01b81526004016100d8919061028c565b60405180910390fd5b50505b6000808451602086016000885af16040513d6000823e81610103573d81fd5b3d81f35b80516001600160a01b038116811461011e57600080fd5b919050565b634e487b7160e01b600052604160045260246000fd5b60005b8381101561015457818101518382015260200161013c565b50506000910152565b600082601f83011261016e57600080fd5b81516001600160401b0381111561018757610187610123565b604051601f8201601f19908116603f011681016001600160401b03811182821017156101b5576101b5610123565b6040528181528382016020018510156101cd57600080fd5b6101de826020830160208701610139565b949350505050565b600080600080608085870312156101fc57600080fd5b61020585610107565b60208601519094506001600160401b0381111561022157600080fd5b61022d8782880161015d565b93505061023c60408601610107565b60608601519092506001600160401b0381111561025857600080fd5b6102648782880161015d565b91505092959194509250565b60008251610282818460208701610139565b9190910192915050565b60208152600082518060208401526102ab816040850160208701610139565b601f01601f1916919091016040019291505056fe",n6="0x608060405234801561001057600080fd5b5060405161069438038061069483398101604081905261002f9161051e565b600061003c848484610048565b9050806000526001601ff35b60007f64926492649264926492649264926492649264926492649264926492649264926100748361040c565b036101e7576000606080848060200190518101906100929190610577565b60405192955090935091506000906001600160a01b038516906100b69085906105dd565b6000604051808303816000865af19150503d80600081146100f3576040519150601f19603f3d011682016040523d82523d6000602084013e6100f8565b606091505b50509050876001600160a01b03163b60000361016057806101605760405162461bcd60e51b815260206004820152601e60248201527f5369676e617475726556616c696461746f723a206465706c6f796d656e74000060448201526064015b60405180910390fd5b604051630b135d3f60e11b808252906001600160a01b038a1690631626ba7e90610190908b9087906004016105f9565b602060405180830381865afa1580156101ad573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101d19190610633565b6001600160e01b03191614945050505050610405565b6001600160a01b0384163b1561027a57604051630b135d3f60e11b808252906001600160a01b03861690631626ba7e9061022790879087906004016105f9565b602060405180830381865afa158015610244573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102689190610633565b6001600160e01b031916149050610405565b81516041146102df5760405162461bcd60e51b815260206004820152603a602482015260008051602061067483398151915260448201527f3a20696e76616c6964207369676e6174757265206c656e6774680000000000006064820152608401610157565b6102e7610425565b5060208201516040808401518451859392600091859190811061030c5761030c61065d565b016020015160f81c9050601b811480159061032b57508060ff16601c14155b1561038c5760405162461bcd60e51b815260206004820152603b602482015260008051602061067483398151915260448201527f3a20696e76616c6964207369676e617475726520762076616c756500000000006064820152608401610157565b60408051600081526020810180835289905260ff83169181019190915260608101849052608081018390526001600160a01b0389169060019060a0016020604051602081039080840390855afa1580156103ea573d6000803e3d6000fd5b505050602060405103516001600160a01b0316149450505050505b9392505050565b600060208251101561041d57600080fd5b508051015190565b60405180606001604052806003906020820280368337509192915050565b6001600160a01b038116811461045857600080fd5b50565b634e487b7160e01b600052604160045260246000fd5b60005b8381101561048c578181015183820152602001610474565b50506000910152565b600082601f8301126104a657600080fd5b81516001600160401b038111156104bf576104bf61045b565b604051601f8201601f19908116603f011681016001600160401b03811182821017156104ed576104ed61045b565b60405281815283820160200185101561050557600080fd5b610516826020830160208701610471565b949350505050565b60008060006060848603121561053357600080fd5b835161053e81610443565b6020850151604086015191945092506001600160401b0381111561056157600080fd5b61056d86828701610495565b9150509250925092565b60008060006060848603121561058c57600080fd5b835161059781610443565b60208501519093506001600160401b038111156105b357600080fd5b6105bf86828701610495565b604086015190935090506001600160401b0381111561056157600080fd5b600082516105ef818460208701610471565b9190910192915050565b828152604060208201526000825180604084015261061e816060850160208701610471565b601f01601f1916919091016060019392505050565b60006020828403121561064557600080fd5b81516001600160e01b03198116811461040557600080fd5b634e487b7160e01b600052603260045260246000fdfe5369676e617475726556616c696461746f72237265636f7665725369676e6572";class yc extends V{constructor({blockNumber:t,chain:n,contract:r}){super(`Chain "${n.name}" does not support contract "${r.name}".`,{metaMessages:["This could be due to any of the following:",...t&&r.blockCreated&&r.blockCreated>t?[`- The contract "${r.name}" was not deployed until block ${r.blockCreated} (current block ${t}).`]:[`- The chain does not have the contract "${r.name}" configured.`]],name:"ChainDoesNotSupportContract"})}}class dh extends V{constructor(){super("No chain was provided to the Client.",{name:"ClientChainNotConfiguredError"})}}const vc="/docs/contract/encodeDeployData";function wc(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 fx({docsPath:vc});if(!("inputs"in o))throw new wd({docsPath:vc});if(!o.inputs||o.inputs.length===0)throw new wd({docsPath:vc});const s=Jt(o.inputs,n);return ur([r,s])}function br({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 yc({chain:t,contract:{name:n}});if(e&&r.blockCreated&&r.blockCreated>e)throw new yc({blockNumber:e,chain:t,contract:{name:n,blockCreated:r.blockCreated}});return r.address}function ph(e,{docsPath:t,...n}){const r=(()=>{const o=Ya(e,n);return o instanceof Ns?e:o})();return new bp(r,{docsPath:t,...n})}function hh(){let e=()=>{},t=()=>{};return{promise:new Promise((r,o)=>{e=r,t=o}),resolve:e,reject:t}}const xc=new Map;function mh({fn:e,id:t,shouldSplitBatch:n,wait:r=0,sort:o}){const s=async()=>{const l=a();i();const f=l.map(({args:d})=>d);f.length!==0&&e(f).then(d=>{o&&Array.isArray(d)&&d.sort(o);for(let p=0;p<l.length;p++){const{resolve:h}=l[p];h==null||h([d[p],d])}}).catch(d=>{for(let p=0;p<l.length;p++){const{reject:h}=l[p];h==null||h(d)}})},i=()=>xc.delete(t),c=()=>a().map(({args:l})=>l),a=()=>xc.get(t)||[],u=l=>xc.set(t,[...a(),l]);return{flush:i,async schedule(l){const{promise:f,resolve:d,reject:p}=hh();return(n==null?void 0:n([...c(),l]))&&s(),a().length>0?(u({args:l,resolve:d,reject:p}),f):(u({args:l,resolve:d,reject:p}),setTimeout(s,r),f)}}}async function So(e,t){var $,S,x,T;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:d,factoryData:p,gas:h,gasPrice:m,maxFeePerBlobGas:v,maxFeePerGas:O,maxPriorityFeePerGas:b,nonce:A,to:k,value:R,stateOverride:D,...j}=t,g=n?xt(n):void 0;if(l&&(d||p))throw new V("Cannot provide both `code` & `factory`/`factoryData` as parameters.");if(l&&k)throw new V("Cannot provide both `code` & `to` as parameters.");const w=l&&f,P=d&&p&&k&&f,N=w||P,I=w?s6({code:l,data:f}):P?i6({data:f,factory:d,factoryData:p,to:k}):f;try{xo(t);const y=(typeof s=="bigint"?X(s):void 0)||i,M=u?sh(u):void 0,F=Qa(D),_=(T=(x=(S=e.chain)==null?void 0:S.formatters)==null?void 0:x.transactionRequest)==null?void 0:T.format,H=(_||Ms)({...Xa(j,{format:_}),from:g==null?void 0:g.address,accessList:c,authorizationList:r,blobs:a,data:I,gas:h,gasPrice:m,maxFeePerBlobGas:v,maxFeePerGas:O,maxPriorityFeePerGas:b,nonce:A,to:N?void 0:k,value:R});if(o&&r6({request:H})&&!F&&!M)try{return await o6(e,{...H,blockNumber:s,blockTag:i})}catch(Z){if(!(Z instanceof dh)&&!(Z instanceof yc))throw Z}const K=(()=>{const Z=[H,y];return F&&M?[...Z,F,M]:F?[...Z,F]:M?[...Z,{},M]:Z})(),W=await e.request({method:"eth_call",params:K});return W==="0x"?{data:void 0}:{data:W}}catch(C){const y=a6(C),{offchainLookup:M,offchainLookupSignature:F}=await Promise.resolve().then(()=>l5);if(e.ccipRead!==!1&&(y==null?void 0:y.slice(0,10))===F&&k)return{data:await M(e,{data:y,to:k})};throw N&&(y==null?void 0:y.slice(0,10))==="0x101bb98d"?new UE({factory:d}):ph(C,{...t,account:g,chain:e.chain})}}function r6({request:e}){const{data:t,to:n,...r}=e;return!(!t||t.startsWith(e6)||!n||Object.values(r).filter(o=>typeof o<"u").length>0)}async function o6(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 dh;u=br({blockNumber:o,chain:e.chain,contract:"multicall3"})}const f=(typeof o=="bigint"?X(o):void 0)||s,{schedule:d}=mh({id:`${e.uid}.${f}`,wait:r,shouldSplitBatch(v){return v.reduce((b,{data:A})=>b+(A.length-2),0)>n*2},fn:async v=>{const O=v.map(k=>({allowFailure:!0,callData:k.data,target:k.to})),b=Lt({abi:gc,args:[O],functionName:"aggregate3"}),A=await e.request({method:"eth_call",params:[{data:b,to:u},f]});return Fn({abi:gc,args:[O],functionName:"aggregate3",data:A||"0x"})}}),[{returnData:p,success:h}]=await d({data:i,to:a});if(!h)throw new Os({data:p});return p==="0x"?{data:void 0}:{data:p}}function s6(e){const{code:t,data:n}=e;return wc({abi:gd(["constructor(bytes, bytes)"]),bytecode:fh,args:[t,n]})}function i6(e){const{data:t,factory:n,factoryData:r,to:o}=e;return wc({abi:gd(["constructor(address, bytes, address, bytes)"]),bytecode:t6,args:[o,t,n,r]})}function a6(e){var n;if(!(e instanceof V))return;const t=e.walk();return typeof(t==null?void 0:t.data)=="object"?(n=t.data)==null?void 0:n.data:t.data}async function rn(e,t){const{abi:n,address:r,args:o,functionName:s,...i}=t,c=Lt({abi:n,args:o,functionName:s});try{const{data:a}=await J(e,So,"call")({...i,data:c,to:r});return Fn({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 c6(e,t){const{abi:n,address:r,args:o,dataSuffix:s,functionName:i,...c}=t,a=c.account?xt(c.account):e.account,u=Lt({abi:n,args:o,functionName:i});try{const{data:l}=await J(e,So,"call")({batch:!1,data:`${u}${s?s.replace("0x",""):""}`,to:r,...c,account:a}),f=Fn({abi:n,args:o,functionName:i,data:l||"0x"}),d=n.filter(p=>"name"in p&&p.name===t.functionName);return{result:f,request:{abi:d,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 Ec=new Map,gh=new Map;let u6=0;function yn(e,t,n){const r=++u6,o=()=>Ec.get(e)||[],s=()=>{const l=o();Ec.set(e,l.filter(f=>f.id!==r))},i=()=>{const l=o();if(!l.some(d=>d.id===r))return;const f=gh.get(e);if(l.length===1&&f){const d=f();d instanceof Promise&&d.catch(()=>{})}s()},c=o();if(Ec.set(e,[...c,{id:r,fns:t}]),c&&c.length>0)return i;const a={};for(const l in t)a[l]=(...f)=>{var p,h;const d=o();if(d.length!==0)for(const m of d)(h=(p=m.fns)[l])==null||h.call(p,...f)};const u=n(a);return typeof u=="function"&&gh.set(e,u),i}async function Sc(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 Sc(a);const u=async()=>{o&&(await e({unpoll:s}),await Sc(r),u())};u()})(),s}const l6=new Map,f6=new Map;function d6(e){const t=(o,s)=>({clear:()=>s.delete(o),get:()=>s.get(o),set:i=>s.set(o,i)}),n=t(e,l6),r=t(e,f6);return{clear:()=>{n.clear(),r.clear()},promise:n,response:r}}async function p6(e,{cacheKey:t,cacheTime:n=Number.POSITIVE_INFINITY}){const r=d6(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 h6=e=>`blockNumber.${e}`;async function Po(e,{cacheTime:t=e.cacheTime}={}){const n=await p6(()=>e.request({method:"eth_blockNumber"}),{cacheKey:h6(e.uid),cacheTime:t});return BigInt(n)}async function Fs(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:sc({abi:t.abi,logs:o,strict:n})}async function Ds(e,{filter:t}){return t.request({method:"eth_uninstallFilter",params:[t.id]})}function m6(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:d}=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=d??!1,O=Ee(["watchContractEvent",r,o,s,e.uid,i,f,v,c]);return yn(O,{onLogs:u,onError:a},b=>{let A;c!==void 0&&(A=c-1n);let k,R=!1;const D=$o(async()=>{var j;if(!R){try{k=await J(e,op,"createContractEventFilter")({abi:n,address:r,args:o,eventName:i,strict:v,fromBlock:c})}catch{}R=!0;return}try{let g;if(k)g=await J(e,Fs,"getFilterChanges")({filter:k});else{const w=await J(e,Po,"getBlockNumber")({});A&&A<w?g=await J(e,Hp,"getContractEvents")({abi:n,address:r,args:o,eventName:i,fromBlock:A+1n,toBlock:w,strict:v}):g=[],A=w}if(g.length===0)return;if(s)b.onLogs(g);else for(const w of g)b.onLogs([w])}catch(g){k&&g instanceof Ln&&(R=!1),(j=b.onError)==null||j.call(b,g)}},{emitOnBegin:!0,interval:f});return async()=>{k&&await J(e,Ds,"uninstallFilter")({filter:k}),D()}})})():(()=>{const v=d??!1,O=Ee(["watchContractEvent",r,o,s,e.uid,i,f,v]);let b=!0,A=()=>b=!1;return yn(O,{onLogs:u,onError:a},k=>((async()=>{try{const R=(()=>{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?Yr({abi:n,eventName:i,args:o}):[],{unsubscribe:j}=await R.subscribe({params:["logs",{address:r,topics:D}],onData(g){var P;if(!b)return;const w=g.result;try{const{eventName:N,args:I}=oc({abi:n,data:w.data,topics:w.topics,strict:d}),$=tn(w,{args:I,eventName:N});k.onLogs([$])}catch(N){let I,$;if(N instanceof Vr||N instanceof vs){if(d)return;I=N.abiItem.name,$=(P=N.abiItem.inputs)==null?void 0:P.some(x=>!("name"in x&&x.name))}const S=tn(w,{args:$?[]:{},eventName:I});k.onLogs([S])}},onError(g){var w;(w=k.onError)==null||w.call(k,g)}});A=j,b||A()}catch(R){a==null||a(R)}})(),()=>A()))})()}async function g6(e,{serializedTransaction:t}){return e.request({method:"eth_sendRawTransaction",params:[t]},{retryCount:0})}function $c(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 Sc(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 b6={"0x0":"reverted","0x1":"success"};function y6(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?b6[e.status]:null,type:e.type?Ap[e.type]||e.type:null};return e.blobGasPrice&&(t.blobGasPrice=BigInt(e.blobGasPrice)),e.blobGasUsed&&(t.blobGasUsed=BigInt(e.blobGasUsed)),t}const Pc=256;let js=Pc,_s;function bh(e=11){if(!_s||js+e>Pc*2){_s="",js=0;for(let t=0;t<Pc;t++)_s+=(256+Math.random()*256|0).toString(16).substring(1)}return _s.substring(js,js+++e)}function v6(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,d=e.account?xt(e.account):void 0,{config:p,request:h,value:m}=e.transport({chain:n,pollingInterval:l}),v={...p,...m},O={account:d,batch:t,cacheTime:f,ccipRead:r,chain:n,key:o,name:s,pollingInterval:l,request:h,transport:v,type:i,uid:bh(),...c?{experimental_blockTag:c}:{}};function b(A){return k=>{const R=k(A);for(const j in O)delete R[j];const D={...A,...R};return Object.assign(D,{extend:b(D)})}}return Object.assign(O,{extend:b(O)})}const Us=new Ia(8192);function w6(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 x6(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?Gr(`${a}.${Ee(n)}`):void 0;return w6(()=>$c(async()=>{try{return await e(n)}catch(d){const p=d;switch(p.code){case eo.code:throw new eo(p);case to.code:throw new to(p);case no.code:throw new no(p,{method:n.method});case ro.code:throw new ro(p);case Bn.code:throw new Bn(p);case Ln.code:throw new Ln(p);case oo.code:throw new oo(p);case so.code:throw new so(p);case io.code:throw new io(p);case Rn.code:throw new Rn(p,{method:n.method});case dr.code:throw new dr(p);case ao.code:throw new ao(p);case pr.code:throw new pr(p);case co.code:throw new co(p);case uo.code:throw new uo(p);case lo.code:throw new lo(p);case fo.code:throw new fo(p);case po.code:throw new po(p);case ho.code:throw new ho(p);case mo.code:throw new mo(p);case go.code:throw new go(p);case bo.code:throw new bo(p);case yo.code:throw new yo(p);case vo.code:throw new vo(p);case wo.code:throw new wo(p);case 5e3:throw new pr(p);default:throw d instanceof V?d:new HE(p)}}},{delay:({count:d,error:p})=>{var h;if(p&&p instanceof kn){const m=(h=p==null?void 0:p.headers)==null?void 0:h.get("Retry-After");if(m!=null&&m.match(/\d/))return Number.parseInt(m)*1e3}return~~(1<<d)*i},retryCount:c,shouldRetry:({error:d})=>E6(d)}),{enabled:o,id:l})}}function E6(e){return"code"in e&&typeof e.code=="number"?e.code===-1||e.code===dr.code||e.code===Bn.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 S6({key:e,methods:t,name:n,request:r,retryCount:o=3,retryDelay:s=150,timeout:i,type:c},a){const u=bh();return{config:{key:e,methods:t,name:n,request:r,retryCount:o,retryDelay:s,timeout:i,type:c},request:x6(r,{methods:t,retryCount:o,retryDelay:s,uid:u}),value:a}}class $6 extends V{constructor(){super("No URL was provided to the Transport. Please provide a valid RPC URL to the Transport.",{docsPath:"/docs/clients/intro",name:"UrlRequiredError"})}}function P6(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 A6(){return{current:0,take(){return this.current++},reset(){this.current=0}}}const yh=A6();function T6(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 d=await P6(async({signal:h})=>{const m={...c,body:Array.isArray(r)?Ee(r.map(A=>({jsonrpc:"2.0",id:A.id??yh.take(),...A}))):Ee({jsonrpc:"2.0",id:r.id??yh.take(),...r}),headers:{"Content-Type":"application/json",...a},method:u||"POST",signal:l||(i>0?h:null)},v=new Request(e,m),O=await(o==null?void 0:o(v,m))??{...m,url:e};return await fetch(O.url??e,O)},{errorInstance:new yp({body:r,url:e}),timeout:i,signal:!0});s&&await s(d);let p;if((f=d.headers.get("Content-Type"))!=null&&f.startsWith("application/json"))p=await d.json();else{p=await d.text();try{p=JSON.parse(p||"{}")}catch(h){if(d.ok)throw h;p={error:p}}}if(!d.ok)throw new kn({body:r,details:Ee(p.error)||d.statusText,headers:d.headers,status:d.status,url:e});return p}catch(d){throw d instanceof kn||d instanceof yp?d:new kn({body:r,cause:d,url:e})}}}}function O6(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:d,timeout:p})=>{const{batchSize:h=1e3,wait:m=0}=typeof n=="object"?n:{},v=t.retryCount??d,O=p??t.timeout??1e4,b=e||(f==null?void 0:f.rpcUrls.default.http[0]);if(!b)throw new $6;const A=T6(b,{fetchOptions:r,onRequest:c,onResponse:a,timeout:O});return S6({key:o,methods:s,name:i,async request({method:k,params:R}){const D={method:k,params:R},{schedule:j}=mh({id:b,wait:m,shouldSplitBatch(N){return N.length>h},fn:N=>A.request({body:N}),sort:(N,I)=>N.id-I.id}),g=async N=>n?j(N):[await A.request({body:N})],[{error:w,result:P}]=await g(D);if(l)return{error:w,result:P};if(w)throw new Ua({body:D,error:w,url:b});return P},retryCount:v,retryDelay:u,timeout:O,type:"http"},{fetchOptions:r,url:b})}}function Ac(e,t){var r,o,s,i,c,a;if(!(e instanceof V))return!1;const n=e.walk(u=>u instanceof _a);return n instanceof _a?!!(((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===ip[50]):!1}function C6(e){const{abi:t,data:n}=e,r=lr(n,0,4),o=t.find(s=>s.type==="function"&&r===Kr(gt(s)));if(!o)throw new bx(r,{docsPath:"/docs/contract/decodeFunctionData"});return{functionName:o.name,args:"inputs"in o&&o.inputs&&o.inputs.length>0?Xr(o.inputs,lr(n,4)):void 0}}const Tc="/docs/contract/encodeErrorResult";function vh(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 Ed(n,{docsPath:Tc});o=a}if(o.type!=="error")throw new Ed(void 0,{docsPath:Tc});const s=gt(o),i=Kr(s);let c="0x";if(r&&r.length>0){if(!o.inputs)throw new mx(o.name,{docsPath:Tc});c=Jt(o.inputs,r)}return ur([i,c])}const Oc="/docs/contract/encodeFunctionResult";function I6(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:Oc});o=i}if(o.type!=="function")throw new nr(void 0,{docsPath:Oc});if(!o.outputs)throw new Ad(o.name,{docsPath:Oc});const s=(()=>{if(o.outputs.length===0)return[];if(o.outputs.length===1)return[r];if(Array.isArray(r))return r;throw new Td(r)})();return Jt(o.outputs,s)}const zs="x-batch-gateway:true";async function wh(e){const{data:t,ccipRequest:n}=e,{args:[r]}=C6({abi:bc,data:t}),o=[],s=[];return await Promise.all(r.map(async(i,c)=>{try{s[c]=i.urls.includes(zs)?await wh({data:i.data,ccipRequest:n}):await n(i),o[c]=!1}catch(a){o[c]=!0,s[c]=N6(a)}})),I6({abi:bc,functionName:"query",result:[o,s]})}function N6(e){return e.name==="HttpRequestError"&&e.status?vh({abi:bc,errorName:"HttpError",args:[e.status,e.shortMessage]}):vh({abi:[ap],errorName:"Error",args:["shortMessage"in e?e.shortMessage:e.message]})}function xh(e){if(e.length!==66||e.indexOf("[")!==0||e.indexOf("]")!==65)return null;const t=`0x${e.slice(1,65)}`;return bt(t)?t:null}function Hs(e){let t=new Uint8Array(32).fill(0);if(!e)return xe(t);const n=e.split(".");for(let r=n.length-1;r>=0;r-=1){const o=xh(n[r]),s=o?or(o):Ce(In(n[r]),"bytes");t=Ce(wt([t,s]),"bytes")}return xe(t)}function M6(e){return`[${e.slice(2)}]`}function k6(e){const t=new Uint8Array(32).fill(0);return e?xh(e)||Ce(In(e)):xe(t)}function Ws(e){const t=e.replace(/^\.|\.$/gm,"");if(t.length===0)return new Uint8Array(1);const n=new Uint8Array(In(t).byteLength+2);let r=0;const o=t.split(".");for(let s=0;s<o.length;s++){let i=In(o[s]);i.byteLength>255&&(i=In(M6(k6(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 B6(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 br({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=Lt({abi:uh,functionName:"addr",...o!=null?{args:[Hs(s),BigInt(o)]}:{args:[Hs(s)]}}),d={address:u,abi:ah,functionName:"resolve",args:[Kt(Ws(s)),f,i??[zs]],blockNumber:n,blockTag:r},h=await J(e,rn,"readContract")(d);if(h[0]==="0x")return null;const m=Fn({abi:uh,args:o!=null?[Hs(s),BigInt(o)]:void 0,functionName:"addr",data:h[0]});return m==="0x"||Cn(m)==="0x00"?null:m}catch(f){if(c)throw f;if(Ac(f,"resolve"))return null;throw f}}class L6 extends V{constructor({data:t}){super("Unable to extract image from metadata. The metadata may be malformed or invalid.",{metaMessages:["- Metadata must be a JSON object with at least an `image`, `image_url` or `image_data` property.","",`Provided data: ${JSON.stringify(t)}`],name:"EnsAvatarInvalidMetadataError"})}}class Ao extends V{constructor({reason:t}){super(`ENS NFT avatar URI is invalid. ${t}`,{name:"EnsAvatarInvalidNftUriError"})}}class Cc extends V{constructor({uri:t}){super(`Unable to resolve ENS avatar URI "${t}". The URI may be malformed, invalid, or does not respond with a valid image.`,{name:"EnsAvatarUriResolutionError"})}}class R6 extends V{constructor({namespace:t}){super(`ENS NFT avatar namespace "${t}" is not supported. Must be "erc721" or "erc1155".`,{name:"EnsAvatarUnsupportedNamespaceError"})}}const F6=/(?<protocol>https?:\/\/[^\/]*|ipfs:\/|ipns:\/|ar:\/)?(?<root>\/)?(?<subpath>ipfs\/|ipns\/)?(?<target>[\w\-.]+)(?<subtarget>\/.*)?/,D6=/^(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>\/.*)?$/,j6=/^data:([a-zA-Z\-/+]*);base64,([^"].*)/,_6=/^data:([a-zA-Z\-/+]*)?(;[a-zA-Z0-9].*?)?(,)/;async function U6(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 Eh(e,t){return e?e.endsWith("/")?e.slice(0,-1):e:t}function Sh({uri:e,gatewayUrls:t}){const n=j6.test(e);if(n)return{uri:e,isOnChain:!0,isEncoded:n};const r=Eh(t==null?void 0:t.ipfs,"https://ipfs.io"),o=Eh(t==null?void 0:t.arweave,"https://arweave.net"),s=e.match(F6),{protocol:i,subpath:c,target:a,subtarget:u=""}=(s==null?void 0:s.groups)||{},l=i==="ipns:/"||c==="ipns/",f=i==="ipfs:/"||c==="ipfs/"||D6.test(e);if(e.startsWith("http")&&!l&&!f){let p=e;return t!=null&&t.arweave&&(p=e.replace(/https:\/\/arweave.net/g,t==null?void 0:t.arweave)),{uri:p,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 d=e.replace(_6,"");if(d.startsWith("<svg")&&(d=`data:image/svg+xml;base64,${btoa(d)}`),d.startsWith("data:")||d.startsWith("{"))return{uri:d,isOnChain:!0,isEncoded:!1};throw new Cc({uri:e})}function $h(e){if(typeof e!="object"||!("image"in e)&&!("image_url"in e)&&!("image_data"in e))throw new L6({data:e});return e.image||e.image_url||e.image_data}async function z6({gatewayUrls:e,uri:t}){try{const n=await fetch(t).then(o=>o.json());return await Ic({gatewayUrls:e,uri:$h(n)})}catch{throw new Cc({uri:t})}}async function Ic({gatewayUrls:e,uri:t}){const{uri:n,isOnChain:r}=Sh({uri:t,gatewayUrls:e});if(r||await U6(n))return n;throw new Cc({uri:t})}function H6(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 W6(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 R6({namespace:t.namespace})}async function V6(e,{gatewayUrls:t,record:n}){return/eip155:/i.test(n)?G6(e,{gatewayUrls:t,record:n}):Ic({uri:n,gatewayUrls:t})}async function G6(e,{gatewayUrls:t,record:n}){const r=H6(n),o=await W6(e,{nft:r}),{uri:s,isOnChain:i,isEncoded:c}=Sh({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 Ic({uri:$h(l),gatewayUrls:t})}let a=r.tokenID;return r.namespace==="erc1155"&&(a=a.replace("0x","").padStart(64,"0")),z6({gatewayUrls:t,uri:s.replace(/(?:0x)?{id}/,a)})}async function Ph(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 br({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:ah,functionName:"resolve",args:[Kt(Ws(s)),Lt({abi:ch,functionName:"text",args:[Hs(s),o]}),i??[zs]],blockNumber:n,blockTag:r},p=await J(e,rn,"readContract")(f);if(p[0]==="0x")return null;const h=Fn({abi:ch,functionName:"text",data:p[0]});return h===""?null:h}catch(f){if(c)throw f;if(Ac(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,Ph,"getEnsText")({blockNumber:t,blockTag:n,key:"avatar",name:o,universalResolverAddress:c,gatewayUrls:s,strict:i});if(!a)return null;try{return await V6(e,{record:a,gatewayUrls:r})}catch{return null}}async function Z6(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=br({blockNumber:n,chain:e.chain,contract:"ensUniversalResolver"})}const a=`${t.toLowerCase().substring(2)}.addr.reverse`;try{const u={address:c,abi:J2,functionName:"reverse",args:[Kt(Ws(a))],blockNumber:n,blockTag:r},l=J(e,rn,"readContract"),[f,d]=o?await l({...u,args:[...u.args,o]}):await l(u);return t.toLowerCase()!==d.toLowerCase()?null:f}catch(u){if(s)throw u;if(Ac(u,"reverse"))return null;throw u}}async function K6(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 br({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 Ah(e,t){var v,O,b;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:d,value:p,...h}=t,m=n?xt(n):void 0;try{xo(t);const k=(typeof r=="bigint"?X(r):void 0)||o,R=(b=(O=(v=e.chain)==null?void 0:v.formatters)==null?void 0:O.transactionRequest)==null?void 0:b.format,j=(R||Ms)({...Xa(h,{format:R}),from:m==null?void 0:m.address,blobs:s,data:i,gas:c,gasPrice:a,maxFeePerBlobGas:u,maxFeePerGas:l,maxPriorityFeePerGas:f,to:d,value:p}),g=await e.request({method:"eth_createAccessList",params:[j,k]});return{accessList:g.accessList,gasUsed:BigInt(g.gasUsed)}}catch(A){throw ph(A,{...t,account:m,chain:e.chain})}}async function Y6(e){const t=As(e,{method:"eth_newBlockFilter"}),n=await e.request({method:"eth_newBlockFilter"});return{id:n,request:t(n),type:"block"}}async function Th(e,{address:t,args:n,event:r,events:o,fromBlock:s,strict:i,toBlock:c}={}){const a=o??(r?[r]:void 0),u=As(e,{method:"eth_newFilter"});let l=[];a&&(l=[a.flatMap(p=>Yr({abi:[p],eventName:p.name,args:n}))],r&&(l=l[0]));const f=await e.request({method:"eth_newFilter",params:[{address:t,fromBlock:typeof s=="bigint"?X(s):s,toBlock:typeof c=="bigint"?X(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 Oh(e){const t=As(e,{method:"eth_newPendingTransactionFilter"}),n=await e.request({method:"eth_newPendingTransactionFilter"});return{id:n,request:t(n),type:"transaction"}}async function X6(e){const t=await e.request({method:"eth_blobBaseFee"});return BigInt(t)}async function Q6(e,{blockHash:t,blockNumber:n,blockTag:r="latest"}={}){const o=n!==void 0?X(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 Ch(e,{address:t,blockNumber:n,blockTag:r="latest"}){const o=n!==void 0?X(n):void 0,s=await e.request({method:"eth_getCode",params:[t,o||r]},{dedupe:!!o});if(s!=="0x")return s}class J6 extends V{constructor({address:t}){super(`No EIP-712 domain found on contract "${t}".`,{metaMessages:["Ensure that:",`- The contract is deployed at the address "${t}".`,"- `eip712Domain()` function exists on the contract.","- `eip712Domain()` function matches signature to ERC-5267 specification."],name:"Eip712DomainNotFoundError"})}}async function e5(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:t5,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 J6({address:n}):i}}const t5=[{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 n5(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 r5(e,{blockCount:t,blockNumber:n,blockTag:r="latest",rewardPercentiles:o}){const s=typeof n=="bigint"?X(n):void 0,i=await e.request({method:"eth_feeHistory",params:[X(t),s||r,o]},{dedupe:!!s});return n5(i)}async function o5(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?sc({abi:t.abi,logs:o,strict:n}):o}class s5 extends V{constructor({callbackSelector:t,cause:n,data:r,extraData:o,sender:s,urls:i}){var c;super(n.shortMessage||"An error occurred while fetching for an offchain result.",{cause:n,metaMessages:[...n.metaMessages||[],(c=n.metaMessages)!=null&&c.length?"":[],"Offchain Gateway Call:",i&&[" Gateway URL(s):",...i.map(a=>` ${Jr(a)}`)],` Sender: ${s}`,` Data: ${r}`,` Callback selector: ${t}`,` Extra data: ${o}`].flat(),name:"OffchainLookupError"})}}class i5 extends V{constructor({result:t,url:n}){super("Offchain gateway response is malformed. Response data must be a hex value.",{metaMessages:[`Gateway URL: ${Jr(n)}`,`Response: ${Ee(t)}`],name:"OffchainLookupResponseMalformedError"})}}class a5 extends V{constructor({sender:t,to:n}){super("Reverted sender address does not match target contract address (`to`).",{metaMessages:[`Contract address: ${n}`,`OffchainLookup sender address: ${t}`],name:"OffchainLookupSenderMismatchError"})}}const c5="0x556f1830",Ih={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 u5(e,{blockNumber:t,blockTag:n,data:r,to:o}){const{args:s}=fp({data:r,abi:[Ih]}),[i,c,a,u,l]=s,{ccipRead:f}=e,d=f&&typeof(f==null?void 0:f.request)=="function"?f.request:Nh;try{if(!ks(o,i))throw new a5({sender:i,to:o});const p=c.includes(zs)?await wh({data:a,ccipRequest:d}):await d({data:a,sender:i,urls:c}),{data:h}=await So(e,{blockNumber:t,blockTag:n,data:wt([u,Jt([{type:"bytes"},{type:"bytes"}],[p,l])]),to:o});return h}catch(p){throw new s5({callbackSelector:u,cause:p,data:r,extraData:l,sender:i,urls:c})}}async function Nh({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?Ee(f.error):l.statusText,headers:l.headers,status:l.status,url:i});continue}if(!bt(f)){r=new i5({result:f,url:i});continue}return f}catch(l){r=new kn({body:a,details:l.message,url:i})}}throw r}const l5=Object.freeze(Object.defineProperty({__proto__:null,ccipRequest:Nh,offchainLookup:u5,offchainLookupAbiItem:Ih,offchainLookupSignature:c5},Symbol.toStringTag,{value:"Module"}));function f5(e){return{formatters:void 0,fees:void 0,serializers:void 0,...e}}class d5 extends V{constructor({domain:t}){super(`Invalid domain "${Ee(t)}".`,{metaMessages:["Must be a valid EIP-712 domain."]})}}class p5 extends V{constructor({primaryType:t,types:n}){super(`Invalid primary type \`${t}\` must be one of \`${JSON.stringify(Object.keys(n))}\`.`,{docsPath:"/api/glossary/Errors#typeddatainvalidprimarytypeerror",metaMessages:["Check that the primary type is a key in `types`."]})}}class h5 extends V{constructor({type:t}){super(`Struct type "${t}" is invalid.`,{metaMessages:["Struct type must not be a Solidity type."],name:"InvalidStructTypeError"})}}function m5(e){const{domain:t={},message:n,primaryType:r}=e,o={EIP712Domain:w5({domain:t}),...e.types};v5({domain:t,message:n,primaryType:r,types:o});const s=["0x1901"];return t&&s.push(g5({domain:t,types:o})),r!=="EIP712Domain"&&s.push(Mh({data:n,primaryType:r,types:o})),Ce(wt(s))}function g5({domain:e,types:t}){return Mh({data:e,primaryType:"EIP712Domain",types:t})}function Mh({data:e,primaryType:t,types:n}){const r=kh({data:e,primaryType:t,types:n});return Ce(r)}function kh({data:e,primaryType:t,types:n}){const r=[{type:"bytes32"}],o=[b5({primaryType:t,types:n})];for(const s of n[t]){const[i,c]=Lh({types:n,name:s.name,type:s.type,value:e[s.name]});r.push(i),o.push(c)}return Jt(r,o)}function b5({primaryType:e,types:t}){const n=Kt(y5({primaryType:e,types:t}));return Ce(n)}function y5({primaryType:e,types:t}){let n="";const r=Bh({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 Bh({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])Bh({primaryType:s.type,types:t},n);return n}function Lh({types:e,name:t,type:n,value:r}){if(e[n]!==void 0)return[{type:"bytes32"},Ce(kh({data:r,primaryType:n,types:e}))];if(n==="bytes")return r=`0x${(r.length%2?"0":"")+r.slice(2)}`,[{type:"bytes32"},Ce(r)];if(n==="string")return[{type:"bytes32"},Ce(Kt(r))];if(n.lastIndexOf("]")===n.length-1){const o=n.slice(0,n.lastIndexOf("[")),s=r.map(i=>Lh({name:t,type:o,types:e,value:i}));return[{type:"bytes32"},Ce(Jt(s.map(([i])=>i),s.map(([,i])=>i)))]}return[{type:n},r]}function v5(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],d=l.match(ep);if(d&&(typeof f=="number"||typeof f=="bigint")){const[m,v,O]=d;X(f,{signed:v==="int",size:Number.parseInt(O)/8})}if(l==="address"&&typeof f=="string"&&!it(f))throw new mn({address:f});const p=l.match(aE);if(p){const[m,v]=p;if(v&&be(f)!==Number.parseInt(v))throw new vx({expectedSize:Number.parseInt(v),givenSize:be(f)})}const h=o[l];h&&(x5(l),s(h,f))}};if(o.EIP712Domain&&t){if(typeof t!="object")throw new d5({domain:t});s(o.EIP712Domain,t)}if(r!=="EIP712Domain")if(o[r])s(o[r],n);else throw new p5({primaryType:r,types:o})}function w5({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 x5(e){if(e==="address"||e==="bool"||e==="string"||e.startsWith("bytes")||e.startsWith("uint")||e.startsWith("int"))throw new h5({type:e})}const E5=`Ethereum Signed Message:
149
+ `;function S5(e){const t=typeof e=="string"?Gr(e):typeof e.raw=="string"?e.raw:xe(e.raw),n=Gr(`${E5}${be(t)}`);return wt([n,t])}function Rh(e,t){return Ce(S5(e),t)}const Fh="0x6492649264926492649264926492649264926492649264926492649264926492";function $5(e){return Jd(e,-32)===Fh}function P5(e){const{address:t,data:n,signature:r,to:o="hex"}=e,s=ur([Jt([{type:"address"},{type:"bytes"},{type:"bytes"}],[t,n,r]),Fh]);return o==="hex"?s:vt(s)}class A5 extends V{constructor({value:t}){super(`Number \`${t}\` is not a valid decimal number.`,{name:"InvalidDecimalNumberError"})}}function T5(e,t){if(!/^(-?)([0-9]*)\.?([0-9]*)$/.test(e))throw new A5({value:e});let[n,r="0"]=e.split(".");const o=n.startsWith("-");if(o&&(n=n.slice(1)),r=r.replace(/(0+)$/,""),t===0)Math.round(+`.${r}`)===1&&(n=`${BigInt(n)+1n}`),r="";else if(r.length>t){const[s,i,c]=[r.slice(0,t-1),r.slice(t-1,t),r.slice(t)],a=Math.round(+`${i}.${c}`);a>9?r=`${BigInt(s)+BigInt(1)}0`.padStart(s.length+1,"0"):r=`${s}${a}`,r.length>t&&(r=r.slice(1),n=`${BigInt(n)+1n}`),r=r.slice(0,t)}else r=r.padEnd(t,"0");return BigInt(`${o?"-":""}${n}${r}`)}function O5(e){return e.map(t=>({...t,value:BigInt(t.value)}))}function C5(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?X(n):void 0,c=await e.request({method:"eth_getProof",params:[t,o,i||s]});return C5(c)}async function N5(e,{address:t,blockNumber:n,blockTag:r="latest",slot:o}){const s=n!==void 0?X(n):void 0;return await e.request({method:"eth_getStorageAt",params:[t,o,s||r]})}async function Nc(e,{blockHash:t,blockNumber:n,blockTag:r,hash:o,index:s}){var l,f,d;const i=r||"latest",c=n!==void 0?X(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,X(s)]},{dedupe:!0}):a=await e.request({method:"eth_getTransactionByBlockNumberAndIndex",params:[c||i,X(s)]},{dedupe:!!c}),!a)throw new mp({blockHash:t,blockNumber:n,blockTag:i,hash:o,index:s});return(((d=(f=(l=e.chain)==null?void 0:l.formatters)==null?void 0:f.transaction)==null?void 0:d.format)||Tp)(a)}async function M5(e,{hash:t,transactionReceipt:n}){const[r,o]=await Promise.all([J(e,Po,"getBlockNumber")({}),t?J(e,Nc,"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 gp({hash:t});return(((i=(s=(o=e.chain)==null?void 0:o.formatters)==null?void 0:s.transactionReceipt)==null?void 0:i.format)||y6)(n)}async function k5(e,t){var O;const{account:n,allowFailure:r=!0,batchSize:o,blockNumber:s,blockTag:i,multicallAddress:c,stateOverride:a}=t,u=t.contracts,l=o??(typeof((O=e.batch)==null?void 0:O.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=br({blockNumber:s,chain:e.chain,contract:"multicall3"})}const d=[[]];let p=0,h=0;for(let b=0;b<u.length;b++){const{abi:A,address:k,args:R,functionName:D}=u[b];try{const j=Lt({abi:A,args:R,functionName:D});h+=(j.length-2)/2,l>0&&h>l&&d[p].length>0&&(p++,h=(j.length-2)/2,d[p]=[]),d[p]=[...d[p],{allowFailure:!0,callData:j,target:k}]}catch(j){const g=hr(j,{abi:A,address:k,args:R,docsPath:"/docs/contract/multicall",functionName:D,sender:n});if(!r)throw g;d[p]=[...d[p],{allowFailure:!0,callData:"0x",target:k}]}}const m=await Promise.allSettled(d.map(b=>J(e,rn,"readContract")({abi:gc,account:n,address:f,args:[b],blockNumber:s,blockTag:i,functionName:"aggregate3",stateOverride:a}))),v=[];for(let b=0;b<m.length;b++){const A=m[b];if(A.status==="rejected"){if(!r)throw A.reason;for(let R=0;R<d[b].length;R++)v.push({status:"failure",error:A.reason,result:void 0});continue}const k=A.value;for(let R=0;R<k.length;R++){const{returnData:D,success:j}=k[R],{callData:g}=d[b][R],{abi:w,address:P,functionName:N,args:I}=u[v.length];try{if(g==="0x")throw new Wr;if(!j)throw new Os({data:D});const $=Fn({abi:w,args:I,data:D,functionName:N});v.push(r?{result:$,status:"success"}:$)}catch($){const S=hr($,{abi:w,address:P,args:I,docsPath:"/docs/contract/multicall",functionName:N});if(!r)throw S;v.push({error:S,result:void 0,status:"failure"})}}}if(v.length!==u.length)throw new V("multicall results mismatch");return v}async function Mc(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 d of o){const p=d.blockOverrides?sh(d.blockOverrides):void 0,h=d.calls.map(v=>{const O=v,b=O.account?xt(O.account):void 0,A=O.abi?Lt(O):O.data,k={...O,data:O.dataSuffix?wt([A||"0x",O.dataSuffix]):A,from:O.from??(b==null?void 0:b.address)};return xo(k),Ms(k)}),m=d.stateOverrides?Qa(d.stateOverrides):void 0;a.push({blockOverrides:p,calls:h,stateOverrides:m})}const l=(typeof n=="bigint"?X(n):void 0)||r;return(await e.request({method:"eth_simulateV1",params:[{blockStateCalls:a,returnFullTransactions:s,traceTransfers:i,validation:c},l]})).map((d,p)=>({...Op(d),calls:d.calls.map((h,m)=>{var P,N;const{abi:v,args:O,functionName:b,to:A}=o[p].calls[m],k=((P=h.error)==null?void 0:P.data)??h.returnData,R=BigInt(h.gasUsed),D=(N=h.logs)==null?void 0:N.map(I=>tn(I)),j=h.status==="0x1"?"success":"failure",g=v&&j==="success"&&k!=="0x"?Fn({abi:v,data:k,functionName:b}):null,w=(()=>{var $;if(j==="success")return;let I;if((($=h.error)==null?void 0:$.data)==="0x"?I=new Wr:h.error&&(I=new Os(h.error)),!!I)return hr(I,{abi:v??[],address:A??"0x",args:O,functionName:b??"<unknown>"})})();return{data:k,gasUsed:R,logs:D,status:j,...j==="success"?{result:g}:{error:w}}})}))}catch(a){const u=a,l=Ya(u,{});throw l instanceof Ns?u:l}}function Dh(e,t={}){const{as:n=typeof e=="string"?"Hex":"Bytes"}=t,r=Zd(j2(e));return n==="Bytes"?r:eh(r)}class B5 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 kc={checksum:new B5(8192)}.checksum,L5=/^0x[a-fA-F0-9]{40}$/;function Gs(e,t={}){const{strict:n=!0}=t;if(!L5.test(e))throw new jh({address:e,cause:new F5});if(n){if(e.toLowerCase()===e)return;if(R5(e)!==e)throw new jh({address:e,cause:new D5})}}function R5(e){if(kc.has(e))return kc.get(e);Gs(e,{strict:!1});const t=e.substring(2).toLowerCase(),n=Dh(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 kc.set(e,o),o}function Bc(e,t={}){const{strict:n=!0}=t??{};try{return Gs(e,{strict:n}),!0}catch{return!1}}class jh extends he{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 F5 extends he{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 D5 extends he{constructor(){super("Address does not match its checksum counterpart."),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Address.InvalidChecksumError"})}}function Lc(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 he("Unable to normalize signature.");return o}function Rc(e,t){const n=typeof e,r=t.type;switch(r){case"address":return Bc(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)=>Rc(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=>Rc(o,{...t,type:r.replace(/(\[[0-9]{0,}\])$/,"")})):!1}}function _h(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 _h(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")?Bc(n[r],{strict:!1}):i.includes("address")&&i.includes("bytes")?Bc(n[r],{strict:!1}):!1)return i}}function Uh(e,t={}){const{prepare:n=!0}=t,r=Array.isArray(e)||typeof e=="string"?bd(e):e;return{...r,...n?{hash:yr(r)}:{}}}function j5(e,t,n){const{args:r=[],prepare:o=!0}=n??{},s=K2(t,{strict:!1}),i=e.filter(u=>s?u.type==="function"||u.type==="error"?zh(u)===mc(t,0,4):u.type==="event"?yr(u)===t:!1:"name"in u&&u.name===t);if(i.length===0)throw new Fc({name:t});if(i.length===1)return{...i[0],...o?{hash:yr(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:yr(u)}:{}};continue}if(!u.inputs||u.inputs.length===0||u.inputs.length!==r.length)continue;if(r.every((f,d)=>{const p="inputs"in u&&u.inputs[d];return p?Rc(f,p):!1})){if(c&&"inputs"in c&&c.inputs){const f=_h(u.inputs,c.inputs,r);if(f)throw new U5({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 Fc({name:t});return{...a,...o?{hash:yr(a)}:{}}}function zh(e){return mc(yr(e),0,4)}function _5(e){const t=typeof e=="string"?e:bs(e);return Lc(t)}function yr(e){return typeof e!="string"&&"hash"in e&&e.hash?e.hash:Dh(hc(_5(e)))}class U5 extends he{constructor(t,n){super("Found ambiguous types in overloaded ABI Items.",{metaMessages:[`\`${t.type}\` in \`${Lc(bs(t.abiItem))}\`, and`,`\`${n.type}\` in \`${Lc(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 Fc extends he{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 z5=/^(.*)\[([0-9]*)\]$/,H5=/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/,Hh=/^(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 W5({checksumAddress:e,parameters:t,values:n}){const r=[];for(let o=0;o<t.length;o++)r.push(Dc({checksumAddress:e,parameter:t[o],value:n[o]}));return r}function Dc({checksumAddress:e=!1,parameter:t,value:n}){const r=t,o=Q5(r.type);if(o){const[s,i]=o;return G5(n,{checksumAddress:e,length:s,parameter:{...r,type:i}})}if(r.type==="tuple")return X5(n,{checksumAddress:e,parameter:r});if(r.type==="address")return V5(n,{checksum:e});if(r.type==="bool")return Z5(n);if(r.type.startsWith("uint")||r.type.startsWith("int")){const s=r.type.startsWith("int"),[,,i="256"]=Hh.exec(r.type)??[];return K5(n,{signed:s,size:Number(i)})}if(r.type.startsWith("bytes"))return q5(n,{type:r.type});if(r.type==="string")return Y5(n);throw new qh(r.type)}function jc(e){let t=0;for(let s=0;s<e.length;s++){const{dynamic:i,encoded:c}=e[s];i?t+=32:t+=at(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+=at(c)):n.push(c)}return Ft(...n,...r)}function V5(e,t){const{checksum:n=!1}=t;return Gs(e,{strict:n}),{dynamic:!1,encoded:jn(e.toLowerCase())}}function G5(e,t){const{checksumAddress:n,length:r,parameter:o}=t,s=r===null;if(!Array.isArray(e))throw new eS(e);if(!s&&e.length!==r)throw new J5({expectedLength:r,givenLength:e.length,type:`${o.type}[${r}]`});let i=!1;const c=[];for(let a=0;a<e.length;a++){const u=Dc({checksumAddress:n,parameter:o,value:e[a]});u.dynamic&&(i=!0),c.push(u)}if(s||i){const a=jc(c);if(s){const u=Be(c.length,{size:32});return{dynamic:!0,encoded:c.length>0?Ft(u,a):u}}if(i)return{dynamic:!0,encoded:a}}return{dynamic:!1,encoded:Ft(...c.map(({encoded:a})=>a))}}function q5(e,{type:t}){const[,n]=t.split("bytes"),r=at(e);if(!n){let o=e;return r%32!==0&&(o=_n(o,Math.ceil((e.length-2)/2/32)*32)),{dynamic:!0,encoded:Ft(jn(Be(r,{size:32})),o)}}if(r!==Number.parseInt(n))throw new Vh({expectedSize:Number.parseInt(n),value:e});return{dynamic:!1,encoded:_n(e)}}function Z5(e){if(typeof e!="boolean")throw new he(`Invalid boolean value: "${e}" (type: ${typeof e}). Expected: \`true\` or \`false\`.`);return{dynamic:!1,encoded:jn(Jp(e))}}function K5(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 th({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 Y5(e){const t=hc(e),n=Math.ceil(at(t)/32),r=[];for(let o=0;o<n;o++)r.push(_n(mc(t,o*32,(o+1)*32)));return{dynamic:!0,encoded:Ft(_n(Be(at(t),{size:32})),...r)}}function X5(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=Dc({checksumAddress:n,parameter:c,value:e[a]});s.push(u),u.dynamic&&(o=!0)}return{dynamic:o,encoded:o?jc(s):Ft(...s.map(({encoded:i})=>i))}}function Q5(e){const t=e.match(/^(.*)\[(\d+)?\]$/);return t?[t[2]?Number(t[2]):null,t[1]]:void 0}function Wh(e,t,n){const{checksumAddress:r=!1}={};if(e.length!==t.length)throw new Gh({expectedLength:e.length,givenLength:t.length});const o=W5({checksumAddress:r,parameters:e,values:t}),s=jc(o);return s.length===0?"0x":s}function _c(e,t){if(e.length!==t.length)throw new Gh({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(_c.encode(o,s))}return Ft(...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 hc(r);if(n==="bytes")return r;if(n==="bool")return jn(Jp(r),o?32:1);const s=n.match(Hh);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(H5);if(i){const[a,u]=i;if(Number.parseInt(u)!==(r.length-2)/2)throw new Vh({expectedSize:Number.parseInt(u),value:r});return _n(r,o?32:0)}const c=n.match(z5);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":Ft(...l)}throw new qh(n)}e.encode=t})(_c||(_c={}));class J5 extends he{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 Vh extends he{constructor({expectedSize:t,value:n}){super(`Size of bytes "${n}" (bytes${at(n)}) does not match expected size (bytes${t}).`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiParameters.BytesSizeMismatchError"})}}class Gh extends he{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 eS extends he{constructor(t){super(`Value \`${t}\` is not a valid array.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiParameters.InvalidArrayError"})}}class qh extends he{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 tS(e,t){var o;const{bytecode:n,args:r}=t;return Ft(n,(o=e.inputs)!=null&&o.length&&(r!=null&&r.length)?Wh(e.inputs,r):"0x")}function nS(e){return Uh(e)}function rS(e,...t){const{overloads:n}=e,r=n?oS([e,...n],e.name,{args:t[0]}):e,o=sS(r),s=t.length>0?Wh(r.inputs,t[0]):void 0;return s?Ft(o,s):o}function vr(e,t={}){return Uh(e,t)}function oS(e,t,n){const r=j5(e,t,n);if(r.type!=="function")throw new Fc({name:t,type:"function"});return r}function sS(e){return zh(e)}const iS="0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",Dt="0x0000000000000000000000000000000000000000",aS="0x6080604052348015600e575f80fd5b5061016d8061001c5f395ff3fe608060405234801561000f575f80fd5b5060043610610029575f3560e01c8063f8b2cb4f1461002d575b5f80fd5b610047600480360381019061004291906100db565b61005d565b604051610054919061011e565b60405180910390f35b5f8173ffffffffffffffffffffffffffffffffffffffff16319050919050565b5f80fd5b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f6100aa82610081565b9050919050565b6100ba816100a0565b81146100c4575f80fd5b50565b5f813590506100d5816100b1565b92915050565b5f602082840312156100f0576100ef61007d565b5b5f6100fd848285016100c7565b91505092915050565b5f819050919050565b61011881610106565b82525050565b5f6020820190506101315f83018461010f565b9291505056fea26469706673582212203b9fe929fe995c7cf9887f0bdba8a36dd78e8b73f149b17d2d9ad7cd09d2dc6264736f6c634300081a0033";async function cS(e,t){const{blockNumber:n,blockTag:r,calls:o,stateOverrides:s,traceAssetChanges:i,traceTransfers:c,validation:a}=t,u=t.account?xt(t.account):void 0;if(i&&!u)throw new V("`account` is required when `traceAssetChanges` is true");const l=u?tS(nS("constructor(bytes, bytes)"),{bytecode:fh,args:[aS,rS(vr("function getBalance(address)"),[u.address])]}):void 0,f=i?await Promise.all(t.calls.map(async y=>{if(!y.data&&!y.abi)return;const{accessList:M}=await Ah(e,{account:u.address,...y,data:y.abi?Lt(y):y.data});return M.map(({address:F,storageKeys:_})=>_.length>0?F:null)})).then(y=>y.flat().filter(Boolean)):[],d=await Mc(e,{blockNumber:n,blockTag:r,blocks:[...i?[{calls:[{data:l}],stateOverrides:s},{calls:f.map((y,M)=>({abi:[vr("function balanceOf(address) returns (uint256)")],functionName:"balanceOf",args:[u.address],to:y,from:Dt,nonce:M})),stateOverrides:[{address:Dt,nonce:0}]}]:[],{calls:[...o,{}].map(y=>({...y,from:u==null?void 0:u.address})),stateOverrides:s},...i?[{calls:[{data:l}]},{calls:f.map((y,M)=>({abi:[vr("function balanceOf(address) returns (uint256)")],functionName:"balanceOf",args:[u.address],to:y,from:Dt,nonce:M})),stateOverrides:[{address:Dt,nonce:0}]},{calls:f.map((y,M)=>({to:y,abi:[vr("function decimals() returns (uint256)")],functionName:"decimals",from:Dt,nonce:M})),stateOverrides:[{address:Dt,nonce:0}]},{calls:f.map((y,M)=>({to:y,abi:[vr("function tokenURI(uint256) returns (string)")],functionName:"tokenURI",args:[0n],from:Dt,nonce:M})),stateOverrides:[{address:Dt,nonce:0}]},{calls:f.map((y,M)=>({to:y,abi:[vr("function symbol() returns (string)")],functionName:"symbol",from:Dt,nonce:M})),stateOverrides:[{address:Dt,nonce:0}]}]:[]],traceTransfers:c,validation:a}),p=i?d[2]:d[0],[h,m,,v,O,b,A,k]=i?d:[],{calls:R,...D}=p,j=R.slice(0,-1)??[],g=(h==null?void 0:h.calls)??[],w=(m==null?void 0:m.calls)??[],P=[...g,...w].map(y=>y.status==="success"?kt(y.data):null),N=(v==null?void 0:v.calls)??[],I=(O==null?void 0:O.calls)??[],$=[...N,...I].map(y=>y.status==="success"?kt(y.data):null),S=((b==null?void 0:b.calls)??[]).map(y=>y.status==="success"?y.result:null),x=((k==null?void 0:k.calls)??[]).map(y=>y.status==="success"?y.result:null),T=((A==null?void 0:A.calls)??[]).map(y=>y.status==="success"?y.result:null),C=[];for(const[y,M]of $.entries()){const F=P[y];if(typeof M!="bigint"||typeof F!="bigint")continue;const _=S[y-1],z=x[y-1],H=T[y-1],K=y===0?{address:iS,decimals:18,symbol:"ETH"}:{address:f[y-1],decimals:H||_?Number(_??1):void 0,symbol:z??void 0};C.some(W=>W.token.address===K.address)||C.push({token:K,value:{pre:F,post:M,diff:M-F}})}return{assetChanges:C,block:D,results:j}}class Zh extends Oa{constructor(t,n){super(),this.finished=!1,this.destroyed=!1,Ld(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),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 Kh=(e,t,n)=>new Zh(e,t).update(n).digest();Kh.create=(e,t)=>new Zh(e,t);/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const ze=BigInt(0),Le=BigInt(1),Un=BigInt(2),Yh=BigInt(3),Xh=BigInt(4),Qh=BigInt(5),uS=BigInt(7),Jh=BigInt(8),lS=BigInt(9),e0=BigInt(16);function St(e,t){const n=e%t;return n>=ze?n:t+n}function ct(e,t,n){let r=e;for(;t-- >ze;)r*=r,r%=n;return r}function t0(e,t){if(e===ze)throw new Error("invert: expected non-zero number");if(t<=ze)throw new Error("invert: expected positive modulus, got "+t);let n=St(e,t),r=t,o=ze,s=Le;for(;n!==ze;){const c=r/n,a=r%n,u=o-s*c;r=n,n=a,o=s,s=u}if(r!==Le)throw new Error("invert: does not exist");return St(o,t)}function Uc(e,t,n){if(!e.eql(e.sqr(t),n))throw new Error("Cannot find square root")}function n0(e,t){const n=(e.ORDER+Le)/Xh,r=e.pow(t,n);return Uc(e,r,t),r}function fS(e,t){const n=(e.ORDER-Qh)/Jh,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 Uc(e,c,t),c}function dS(e){const t=To(e),n=r0(e),r=n(t,t.neg(t.ONE)),o=n(t,r),s=n(t,t.neg(r)),i=(e+uS)/e0;return(c,a)=>{let u=c.pow(a,i),l=c.mul(u,r);const f=c.mul(u,o),d=c.mul(u,s),p=c.eql(c.sqr(l),a),h=c.eql(c.sqr(f),a);u=c.cmov(u,l,p),l=c.cmov(d,f,h);const m=c.eql(c.sqr(l),a),v=c.cmov(u,l,m);return Uc(c,v,a),v}}function r0(e){if(e<Yh)throw new Error("sqrt is not defined for small field");let t=e-Le,n=0;for(;t%Un===ze;)t/=Un,n++;let r=Un;const o=To(e);for(;s0(o,r)===1;)if(r++>1e3)throw new Error("Cannot find square root: probably non-prime P");if(n===1)return n0;let s=o.pow(r,t);const i=(t+Le)/Un;return function(a,u){if(a.is0(u))return u;if(s0(a,u)!==1)throw new Error("Cannot find square root");let l=n,f=a.mul(a.ONE,s),d=a.pow(u,t),p=a.pow(u,i);for(;!a.eql(d,a.ONE);){if(a.is0(d))return a.ZERO;let h=1,m=a.sqr(d);for(;!a.eql(m,a.ONE);)if(h++,m=a.sqr(m),h===l)throw new Error("Cannot find square root");const v=Le<<BigInt(l-h-1),O=a.pow(f,v);l=h,f=a.sqr(O),d=a.mul(d,f),p=a.mul(p,O)}return p}}function pS(e){return e%Xh===Yh?n0:e%Jh===Qh?fS:e%e0===lS?dS(e):r0(e)}const hS=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function mS(e){const t={ORDER:"bigint",MASK:"bigint",BYTES:"number",BITS:"number"},n=hS.reduce((r,o)=>(r[o]="function",r),t);return dc(e,n),e}function gS(e,t,n){if(n<ze)throw new Error("invalid exponent, negatives unsupported");if(n===ze)return e.ONE;if(n===Le)return t;let r=e.ONE,o=t;for(;n>ze;)n&Le&&(r=e.mul(r,o)),o=e.sqr(o),n>>=Le;return r}function o0(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 s0(e,t){const n=(e.ORDER-Le)/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 i0(e,t){t!==void 0&&qr(t);const n=t!==void 0?t:e.toString(2).length,r=Math.ceil(n/8);return{nBitLength:n,nByteLength:r}}function To(e,t,n=!1,r={}){if(e<=ze)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 d=t;d.BITS&&(o=d.BITS),d.sqrt&&(s=d.sqrt),typeof d.isLE=="boolean"&&(n=d.isLE),typeof d.modFromBytes=="boolean"&&(i=d.modFromBytes),c=d.allowedLengths}else typeof t=="number"&&(o=t),r.sqrt&&(s=r.sqrt);const{nBitLength:a,nByteLength:u}=i0(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:Eo(a),ZERO:ze,ONE:Le,allowedLengths:c,create:d=>St(d,e),isValid:d=>{if(typeof d!="bigint")throw new Error("invalid field element: expected bigint, got "+typeof d);return ze<=d&&d<e},is0:d=>d===ze,isValidNot0:d=>!f.is0(d)&&f.isValid(d),isOdd:d=>(d&Le)===Le,neg:d=>St(-d,e),eql:(d,p)=>d===p,sqr:d=>St(d*d,e),add:(d,p)=>St(d+p,e),sub:(d,p)=>St(d-p,e),mul:(d,p)=>St(d*p,e),pow:(d,p)=>gS(f,d,p),div:(d,p)=>St(d*t0(p,e),e),sqrN:d=>d*d,addN:(d,p)=>d+p,subN:(d,p)=>d-p,mulN:(d,p)=>d*p,inv:d=>t0(d,e),sqrt:s||(d=>(l||(l=pS(e)),l(f,d))),toBytes:d=>n?Gp(d,u):lc(d,u),fromBytes:(d,p=!0)=>{if(c){if(!c.includes(d.length)||d.length>u)throw new Error("Field.fromBytes: expected "+c+" bytes, got "+d.length);const m=new Uint8Array(u);m.set(d,n?0:m.length-d.length),d=m}if(d.length!==u)throw new Error("Field.fromBytes: expected "+u+" bytes, got "+d.length);let h=n?Vp(d):Rs(d);if(i&&(h=St(h,e)),!p&&!f.isValid(h))throw new Error("invalid field element: outside of range 0..ORDER");return h},invertBatch:d=>o0(f,d),cmov:(d,p,h)=>h?p:d});return Object.freeze(f)}function a0(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 c0(e){const t=a0(e);return t+Math.ceil(t/2)}function bS(e,t,n=!1){const r=e.length,o=a0(t),s=c0(t);if(r<16||r<s||r>1024)throw new Error("expected "+s+"-1024 bytes of input, got "+r);const i=n?Vp(e):Rs(e),c=St(i,t-Le)+Le;return n?Gp(c,o):lc(c,o)}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const wr=BigInt(0),zn=BigInt(1);function qs(e,t){const n=t.negate();return e?n:t}function zc(e,t){const n=o0(e.Fp,t.map(r=>r.Z));return t.map((r,o)=>e.fromAffine(r.toAffine(n[o])))}function u0(e,t){if(!Number.isSafeInteger(e)||e<=0||e>t)throw new Error("invalid window size, expected [1.."+t+"], got W="+e)}function Hc(e,t){u0(e,t);const n=Math.ceil(t/e)+1,r=2**(e-1),o=2**e,s=Eo(e),i=BigInt(e);return{windows:n,windowSize:r,mask:s,maxNumber:o,shiftBy:i}}function l0(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,d=c<0,p=t%2!==0;return{nextN:a,offset:l,isZero:f,isNeg:d,isNegF:p,offsetF:u}}function yS(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 vS(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 Wc=new WeakMap,f0=new WeakMap;function Vc(e){return f0.get(e)||1}function d0(e){if(e!==wr)throw new Error("invalid wNAF")}class wS{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>wr;)n&zn&&(r=r.add(o)),o=o.double(),n>>=zn;return r}precomputeWindow(t,n){const{windows:r,windowSize:o}=Hc(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=Hc(t,this.bits);for(let c=0;c<i.windows;c++){const{nextN:a,offset:u,isZero:l,isNeg:f,isNegF:d,offsetF:p}=l0(r,c,i);r=a,l?s=s.add(qs(d,n[p])):o=o.add(qs(f,n[u]))}return d0(r),{p:o,f:s}}wNAFUnsafe(t,n,r,o=this.ZERO){const s=Hc(t,this.bits);for(let i=0;i<s.windows&&r!==wr;i++){const{nextN:c,offset:a,isZero:u,isNeg:l}=l0(r,i,s);if(r=c,!u){const f=n[a];o=o.add(l?f.negate():f)}}return d0(r),o}getPrecomputes(t,n,r){let o=Wc.get(n);return o||(o=this.precomputeWindow(n,t),t!==1&&(typeof r=="function"&&(o=r(o)),Wc.set(n,o))),o}cached(t,n,r){const o=Vc(t);return this.wNAF(o,this.getPrecomputes(o,t,r),n)}unsafe(t,n,r,o){const s=Vc(t);return s===1?this._unsafeLadder(t,n,o):this.wNAFUnsafe(s,this.getPrecomputes(s,t,r),n,o)}createCache(t,n){u0(n,this.bits),f0.set(t,n),Wc.delete(t)}hasCache(t){return Vc(t)!==1}}function xS(e,t,n,r){let o=t,s=e.ZERO,i=e.ZERO;for(;n>wr||r>wr;)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 ES(e,t,n,r){yS(n,e),vS(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=qp(BigInt(o));let a=1;c>12?a=c-3:c>4?a=c-2:c>0&&(a=2);const u=Eo(a),l=new Array(Number(u)+1).fill(i),f=Math.floor((t.BITS-1)/a)*a;let d=i;for(let p=f;p>=0;p-=a){l.fill(i);for(let m=0;m<s;m++){const v=r[m],O=Number(v>>BigInt(p)&u);l[O]=l[O].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(d=d.add(h),p!==0)for(let m=0;m<a;m++)d=d.double()}return d}function p0(e,t,n){if(t){if(t.ORDER!==e)throw new Error("Field.ORDER must match order: Fp == p, Fn == n");return mS(t),t}else return To(e,{isLE:n})}function SS(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>wr))throw new Error(`CURVE.${a} must be positive bigint`)}const o=p0(t.p,n.Fp,r),s=p0(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 h0=(e,t)=>(e+(e>=0?t:-t)/m0)/t;function $S(e,t,n){const[[r,o],[s,i]]=t,c=h0(i*e,n),a=h0(-o*e,n);let u=e-c*r-a*s,l=-c*o-a*i;const f=u<sn,d=l<sn;f&&(u=-u),d&&(l=-l);const p=Eo(Math.ceil(qp(n)/2))+xr;if(u<sn||u>=p||l<sn||l>=p)throw new Error("splitScalar (endomorphism): failed, k="+e);return{k1neg:f,k1:u,k2neg:d,k2:l}}function Gc(e){if(!["compact","recovered","der"].includes(e))throw new Error('Signature format must be "compact", "recovered", or "der"');return e}function qc(e,t){const n={};for(let r of Object.keys(t))n[r]=e[r]===void 0?t[r]:e[r];return Bs(n.lowS,"lowS"),Bs(n.prehash,"prehash"),n.format!==void 0&&Gc(n.format),n}class PS extends Error{constructor(t=""){super(t)}}const on={Err:PS,_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=Ls(r);if(o.length/2&128)throw new n("tlv.encode: long form length too big");const s=r>127?Ls(o.length/2|128):"";return Ls(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=Ls(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 Rs(e)}},toSig(e){const{Err:t,_int:n,_tlv:r}=on,o=Ue("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),xr=BigInt(1),m0=BigInt(2),Zs=BigInt(3),AS=BigInt(4);function Er(e,t){const{BYTES:n}=e;let r;if(typeof t=="bigint")r=t;else{let o=Ue("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 TS(e,t={}){const n=SS("weierstrass",e,t),{Fp:r,Fn:o}=n;let s=n.CURVE;const{h:i,n:c}=s;dc(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=b0(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:T}=$.toAffine(),C=r.toBytes(x);if(Bs(S,"isCompressed"),S){l();const y=!r.isOdd(T);return hn(g0(y),C)}else return hn(Uint8Array.of(4),C,r.toBytes(T))}function d(I){Dn(I,void 0,"Point");const{publicKey:$,publicKeyUncompressed:S}=u,x=I.length,T=I[0],C=I.subarray(1);if(x===$&&(T===2||T===3)){const y=r.fromBytes(C);if(!r.isValid(y))throw new Error("bad point: is not on curve, wrong x");const M=m(y);let F;try{F=r.sqrt(M)}catch(H){const K=H instanceof Error?": "+H.message:"";throw new Error("bad point: is not on curve, sqrt error"+K)}l();const _=r.isOdd(F);return(T&1)===1!==_&&(F=r.neg(F)),{x:y,y:F}}else if(x===S&&T===4){const y=r.BYTES,M=r.fromBytes(C.subarray(0,y)),F=r.fromBytes(C.subarray(y,y*2));if(!v(M,F))throw new Error("bad point: is not on curve");return{x:M,y:F}}else throw new Error(`bad point: got length ${x}, expected compressed=${$} or uncompressed=${S}`)}const p=t.toBytes||f,h=t.fromBytes||d;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 v(I,$){const S=r.sqr($),x=m(I);return r.eql(S,x)}if(!v(s.Gx,s.Gy))throw new Error("bad curve params: generator point");const O=r.mul(r.pow(s.a,Zs),AS),b=r.mul(r.sqr(s.b),BigInt(27));if(r.is0(r.add(O,b)))throw new Error("bad curve params: a or b");function A(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 R(I){if(!a||!a.basises)throw new Error("no endo");return $S(I,a.basises,o.ORDER)}const D=Zp((I,$)=>{const{X:S,Y:x,Z:T}=I;if(r.eql(T,r.ONE))return{x:S,y:x};const C=I.is0();$==null&&($=C?r.ONE:r.inv(T));const y=r.mul(S,$),M=r.mul(x,$),F=r.mul(T,$);if(C)return{x:r.ZERO,y:r.ZERO};if(!r.eql(F,r.ONE))throw new Error("invZ was invalid");return{x:y,y:M}}),j=Zp(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(!v($,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 g(I,$,S,x,T){return S=new w(r.mul(S.X,I),S.Y,S.Z),$=qs(x,$),S=qs(T,S),$.add(S)}class w{constructor($,S,x){this.X=A("x",$),this.Y=A("y",S,!0),this.Z=A("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(Dn($,void 0,"point")));return S.assertValidity(),S}static fromHex($){return w.fromBytes(Ue("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:T}=this,{X:C,Y:y,Z:M}=$,F=r.eql(r.mul(S,M),r.mul(C,T)),_=r.eql(r.mul(x,M),r.mul(y,T));return F&&_}negate(){return new w(this.X,r.neg(this.Y),this.Z)}double(){const{a:$,b:S}=s,x=r.mul(S,Zs),{X:T,Y:C,Z:y}=this;let M=r.ZERO,F=r.ZERO,_=r.ZERO,z=r.mul(T,T),H=r.mul(C,C),K=r.mul(y,y),W=r.mul(T,C);return W=r.add(W,W),_=r.mul(T,y),_=r.add(_,_),M=r.mul($,_),F=r.mul(x,K),F=r.add(M,F),M=r.sub(H,F),F=r.add(H,F),F=r.mul(M,F),M=r.mul(W,M),_=r.mul(x,_),K=r.mul($,K),W=r.sub(z,K),W=r.mul($,W),W=r.add(W,_),_=r.add(z,z),z=r.add(_,z),z=r.add(z,K),z=r.mul(z,W),F=r.add(F,z),K=r.mul(C,y),K=r.add(K,K),z=r.mul(K,W),M=r.sub(M,z),_=r.mul(K,H),_=r.add(_,_),_=r.add(_,_),new w(M,F,_)}add($){k($);const{X:S,Y:x,Z:T}=this,{X:C,Y:y,Z:M}=$;let F=r.ZERO,_=r.ZERO,z=r.ZERO;const H=s.a,K=r.mul(s.b,Zs);let W=r.mul(S,C),Z=r.mul(x,y),q=r.mul(T,M),Q=r.add(S,x),te=r.add(C,y);Q=r.mul(Q,te),te=r.add(W,Z),Q=r.sub(Q,te),te=r.add(S,T);let ue=r.add(C,M);return te=r.mul(te,ue),ue=r.add(W,q),te=r.sub(te,ue),ue=r.add(x,T),F=r.add(y,M),ue=r.mul(ue,F),F=r.add(Z,q),ue=r.sub(ue,F),z=r.mul(H,te),F=r.mul(K,q),z=r.add(F,z),F=r.sub(Z,z),z=r.add(Z,z),_=r.mul(F,z),Z=r.add(W,W),Z=r.add(Z,W),q=r.mul(H,q),te=r.mul(K,te),Z=r.add(Z,q),q=r.sub(W,q),q=r.mul(H,q),te=r.add(te,q),W=r.mul(Z,te),_=r.add(_,W),W=r.mul(ue,te),F=r.mul(Q,F),F=r.sub(F,W),W=r.mul(Q,Z),z=r.mul(ue,z),z=r.add(z,W),new w(F,_,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,T;const C=y=>N.cached(this,y,M=>zc(w,M));if(S){const{k1neg:y,k1:M,k2neg:F,k2:_}=R($),{p:z,f:H}=C(M),{p:K,f:W}=C(_);T=H.add(W),x=g(S.beta,z,K,y,F)}else{const{p:y,f:M}=C($);x=y,T=M}return zc(w,[x,T])[0]}multiplyUnsafe($){const{endo:S}=t,x=this;if(!o.isValid($))throw new Error("invalid scalar: out of range");if($===sn||x.is0())return w.ZERO;if($===xr)return x;if(N.hasCache(this))return this.multiply($);if(S){const{k1neg:T,k1:C,k2neg:y,k2:M}=R($),{p1:F,p2:_}=xS(w,x,C,M);return g(S.beta,F,_,T,y)}else return N.unsafe(x,$)}multiplyAndAddUnsafe($,S,x){const T=this.multiplyUnsafe(S).add($.multiplyUnsafe(x));return T.is0()?void 0:T}toAffine($){return D(this,$)}isTorsionFree(){const{isTorsionFree:$}=t;return i===xr?!0:$?$(w,this):N.unsafe(this,c).is0()}clearCofactor(){const{clearCofactor:$}=t;return i===xr?this:$?$(w,this):this.multiplyUnsafe(i)}isSmallOrder(){return this.multiplyUnsafe(i).is0()}toBytes($=!0){return Bs($,"isCompressed"),this.assertValidity(),p(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 zc(w,$)}static msm($,S){return ES(w,o,$,S)}static fromPrivateKey($){return w.BASE.multiply(Er(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 P=o.BITS,N=new wS(w,t.endo?Math.ceil(P/2):P);return w.BASE.precompute(8),w}function g0(e){return Uint8Array.of(e?2:3)}function b0(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||Ud,o=Object.assign(b0(e.Fp,n),{seed:c0(n.ORDER)});function s(p){try{return!!Er(n,p)}catch{return!1}}function i(p,h){const{publicKey:m,publicKeyUncompressed:v}=o;try{const O=p.length;return h===!0&&O!==m||h===!1&&O!==v?!1:!!e.fromBytes(p)}catch{return!1}}function c(p=r(o.seed)){return bS(Dn(p,o.seed,"seed"),n.ORDER)}function a(p,h=!0){return e.BASE.multiply(Er(n,p)).toBytes(h)}function u(p){const h=c(p);return{secretKey:h,publicKey:a(h)}}function l(p){if(typeof p=="bigint")return!1;if(p instanceof e)return!0;const{secretKey:h,publicKey:m,publicKeyUncompressed:v}=o;if(n.allowedLengths||h===m)return;const O=Ue("key",p).length;return O===m||O===v}function f(p,h,m=!0){if(l(p)===!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=Er(n,p);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:p=>Er(n,p),precompute(p=8,h=e.BASE){return h.precompute(p,!1)}},lengths:o})}function CS(e,t,n={}){Ld(t),dc(n,{},{hmac:"function",lowS:"boolean",randomBytes:"function",bits2int:"function",bits2int_modN:"function"});const r=n.randomBytes||Ud,o=n.hmac||((S,...x)=>Kh(t,S,hn(...x))),{Fp:s,Fn:i}=e,{ORDER:c,BITS:a}=i,{keygen:u,getPublicKey:l,getSharedSecret:f,utils:d,lengths:p}=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>>xr;return S>x}function O(S,x){if(!i.isValidNot0(x))throw new Error(`invalid signature ${S}: out of range 1..Point.Fn.ORDER`);return x}function b(S,x){Gc(x);const T=p.signature,C=x==="compact"?T:x==="recovered"?T+1:void 0;return Dn(S,C,`${x} signature`)}class A{constructor(x,T,C){this.r=O("r",x),this.s=O("s",T),C!=null&&(this.recovery=C),Object.freeze(this)}static fromBytes(x,T=m){b(x,T);let C;if(T==="der"){const{r:_,s:z}=on.toSig(Dn(x));return new A(_,z)}T==="recovered"&&(C=x[0],T="compact",x=x.subarray(1));const y=i.BYTES,M=x.subarray(0,y),F=x.subarray(y,y*2);return new A(i.fromBytes(M),i.fromBytes(F),C)}static fromHex(x,T){return this.fromBytes(Es(x),T)}addRecoveryBit(x){return new A(this.r,this.s,x)}recoverPublicKey(x){const T=s.ORDER,{r:C,s:y,recovery:M}=this;if(M==null||![0,1,2,3].includes(M))throw new Error("recovery id invalid");if(c*m0<T&&M>1)throw new Error("recovery id is ambiguous for h>1 curve");const _=M===2||M===3?C+c:C;if(!s.isValid(_))throw new Error("recovery id 2 or 3 invalid");const z=s.toBytes(_),H=e.fromBytes(hn(g0((M&1)===0),z)),K=i.inv(_),W=R(Ue("msgHash",x)),Z=i.create(-W*K),q=i.create(y*K),Q=e.BASE.multiplyUnsafe(Z).add(H.multiplyUnsafe(q));if(Q.is0())throw new Error("point at infinify");return Q.assertValidity(),Q}hasHighS(){return v(this.s)}toBytes(x=m){if(Gc(x),x==="der")return Es(on.hexFromSig(this));const T=i.toBytes(this.r),C=i.toBytes(this.s);if(x==="recovered"){if(this.recovery==null)throw new Error("recovery bit must be present");return hn(Uint8Array.of(this.recovery),T,C)}return hn(T,C)}toHex(x){return cr(this.toBytes(x))}assertValidity(){}static fromCompact(x){return A.fromBytes(Ue("sig",x),"compact")}static fromDER(x){return A.fromBytes(Ue("sig",x),"der")}normalizeS(){return this.hasHighS()?new A(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 T=Rs(x),C=x.length*8-a;return C>0?T>>BigInt(C):T},R=n.bits2int_modN||function(x){return i.create(k(x))},D=Eo(a);function j(S){return O2("num < 2^"+a,S,sn,D),i.toBytes(S)}function g(S,x){return Dn(S,void 0,"message"),x?Dn(t(S),void 0,"prehashed message"):S}function w(S,x,T){if(["recovered","canonical"].some(Z=>Z in T))throw new Error("sign() legacy options not supported");const{lowS:C,prehash:y,extraEntropy:M}=qc(T,h);S=g(S,y);const F=R(S),_=Er(i,x),z=[j(_),j(F)];if(M!=null&&M!==!1){const Z=M===!0?r(p.secretKey):M;z.push(Ue("extraEntropy",Z))}const H=hn(...z),K=F;function W(Z){const q=k(Z);if(!i.isValidNot0(q))return;const Q=i.inv(q),te=e.BASE.multiply(q).toAffine(),ue=i.create(te.x);if(ue===sn)return;const Se=i.create(Q*i.create(K+ue*_));if(Se===sn)return;let Ke=(te.x===ue?0:2)|Number(te.y&xr),$e=Se;return C&&v(Se)&&($e=i.neg(Se),Ke^=1),new A(ue,$e,Ke)}return{seed:H,k2sig:W}}function P(S,x,T={}){S=Ue("message",S);const{seed:C,k2sig:y}=w(S,x,T);return C2(t.outputLen,i.BYTES,o)(C,y)}function N(S){let x;const T=typeof S=="string"||xs(S),C=!T&&S!==null&&typeof S=="object"&&typeof S.r=="bigint"&&typeof S.s=="bigint";if(!T&&!C)throw new Error("invalid signature, expected Uint8Array, hex string or Signature instance");if(C)x=new A(S.r,S.s);else if(T){try{x=A.fromBytes(Ue("sig",S),"der")}catch(y){if(!(y instanceof on.Err))throw y}if(!x)try{x=A.fromBytes(Ue("sig",S),"compact")}catch{return!1}}return x||!1}function I(S,x,T,C={}){const{lowS:y,prehash:M,format:F}=qc(C,h);if(T=Ue("publicKey",T),x=g(Ue("message",x),M),"strict"in C)throw new Error("options.strict was renamed to lowS");const _=F===void 0?N(S):A.fromBytes(Ue("sig",S),F);if(_===!1)return!1;try{const z=e.fromBytes(T);if(y&&_.hasHighS())return!1;const{r:H,s:K}=_,W=R(x),Z=i.inv(K),q=i.create(W*Z),Q=i.create(H*Z),te=e.BASE.multiplyUnsafe(q).add(z.multiplyUnsafe(Q));return te.is0()?!1:i.create(te.x)===H}catch{return!1}}function $(S,x,T={}){const{prehash:C}=qc(T,h);return x=g(x,C),A.fromBytes(S,"recovered").recoverPublicKey(x).toBytes()}return Object.freeze({keygen:u,getPublicKey:l,getSharedSecret:f,utils:d,lengths:p,Point:e,sign:P,verify:I,recoverPublicKey:$,Signature:A,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=To(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 NS(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 MS(e,t){const n=t.Point;return Object.assign({},t,{ProjectivePoint:n,CURVE:Object.assign({},e,i0(n.Fn.ORDER,n.Fn.BITS))})}function kS(e){const{CURVE:t,curveOpts:n,hash:r,ecdsaOpts:o}=NS(e),s=TS(t,n),i=CS(s,r,o);return MS(e,i)}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */function BS(e,t){const n=r=>kS({...e,hash:r});return{...n(t),create:n}}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const Zc={p:BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),n:BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),h:BigInt(1),a:BigInt(0),b:BigInt(7),Gx:BigInt("0x79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798"),Gy:BigInt("0x483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8")},LS={beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),basises:[[BigInt("0x3086d221a7d46bcde86c90e49284eb15"),-BigInt("0xe4437ed6010e88286f547fa90abfe4c3")],[BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),BigInt("0x3086d221a7d46bcde86c90e49284eb15")]]},y0=BigInt(2);function RS(e){const t=Zc.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=ct(l,n,t)*l%t,d=ct(f,n,t)*l%t,p=ct(d,y0,t)*u%t,h=ct(p,o,t)*p%t,m=ct(h,s,t)*h%t,v=ct(m,c,t)*m%t,O=ct(v,a,t)*v%t,b=ct(O,c,t)*m%t,A=ct(b,n,t)*l%t,k=ct(A,i,t)*h%t,R=ct(k,r,t)*u%t,D=ct(R,y0,t);if(!Kc.eql(Kc.sqr(D),e))throw new Error("Cannot find square root");return D}const Kc=To(Zc.p,{sqrt:RS}),v0=BS({...Zc,Fp:Kc,lowS:!0,endo:LS},kp),FS=Object.freeze(Object.defineProperty({__proto__:null,secp256k1:v0},Symbol.toStringTag,{value:"Module"}));function DS({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 v0.Signature(kt(e),kt(t)).toCompactHex()}${s===0?"1b":"1c"}`;return n==="hex"?i:vt(i)}async function Yc(e,t){var f,d,p;const{address:n,factory:r,factoryData:o,hash:s,signature:i,universalSignatureVerifierAddress:c=(p=(d=(f=e.chain)==null?void 0:f.contracts)==null?void 0:d.universalSignatureVerifier)==null?void 0:p.address,...a}=t,u=bt(i)?i:typeof i=="object"&&"r"in i&&"s"in i?DS(i):xe(i),l=await(async()=>!r&&!o||$5(u)?u:P5({address:r,data:o,signature:u}))();try{const h=c?{to:c,data:Lt({abi:lh,functionName:"isValidSig",args:[n,s,l]}),...a}:{data:wc({abi:lh,args:[n,s,l],bytecode:n6}),...a},{data:m}=await J(e,So,"call")(h);return Ox(m??"0x0")}catch(h){try{if(ks(Nn(n),await wp({hash:s,signature:i})))return!0}catch{}if(h instanceof bp)return!1;throw h}}async function jS(e,{address:t,message:n,factory:r,factoryData:o,signature:s,...i}){const c=Rh(n);return Yc(e,{address:t,factory:r,factoryData:o,hash:c,signature:s,...i})}async function _S(e,t){const{address:n,factory:r,factoryData:o,signature:s,message:i,primaryType:c,types:a,domain:u,...l}=t,f=m5({message:i,primaryType:c,types:a,domain:u});return Yc(e,{address:n,factory:r,factoryData:o,hash:f,signature:s,...l})}function w0(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=Ee(["watchBlockNumber",e.uid,t,n,i]);return yn(f,{onBlockNumber:r,onError:o},d=>$o(async()=>{var p;try{const h=await J(e,Po,"getBlockNumber")({cacheTime:0});if(a){if(h===a)return;if(h-a>1&&n)for(let m=a+1n;m<h;m++)d.onBlockNumber(m,a),a=m}(!a||h>a)&&(d.onBlockNumber(h,a),a=h)}catch(h){(p=d.onError)==null||p.call(d,h)}},{emitOnBegin:t,interval:i}))})():(()=>{const f=Ee(["watchBlockNumber",e.uid,t,n]);return yn(f,{onBlockNumber:r,onError:o},d=>{let p=!0,h=()=>p=!1;return(async()=>{try{const m=(()=>{if(e.transport.type==="fallback"){const O=e.transport.transports.find(b=>b.config.type==="webSocket"||b.config.type==="ipc");return O?O.value:e.transport}return e.transport})(),{unsubscribe:v}=await m.subscribe({params:["newHeads"],onData(O){var A;if(!p)return;const b=kt((A=O.result)==null?void 0:A.number);d.onBlockNumber(b,a),a=b},onError(O){var b;(b=d.onError)==null||b.call(d,O)}});h=v,p||h()}catch(m){o==null||o(m)}})(),()=>h()})})()}async function US(e,t){const{checkReplacement:n=!0,confirmations:r=1,hash:o,onReplaced:s,retryCount:i=6,retryDelay:c=({count:R})=>~~(1<<R)*200,timeout:a=18e4}=t,u=Ee(["waitForTransactionReceipt",e.uid,o]),l=(()=>{var R;return t.pollingInterval?t.pollingInterval:(R=e.chain)!=null&&R.experimental_preconfirmationTime?e.chain.experimental_preconfirmationTime:e.pollingInterval})();let f,d,p,h=!1,m,v;const{promise:O,resolve:b,reject:A}=hh(),k=a?setTimeout(()=>{v(),m(),A(new FE({hash:o}))},a):void 0;return m=yn(u,{onReplaced:s,resolve:b,reject:A},async R=>{if(p=await J(e,Vs,"getTransactionReceipt")({hash:o}).catch(()=>{}),p&&r<=1){clearTimeout(k),R.resolve(p),m();return}v=J(e,w0,"watchBlockNumber")({emitMissed:!0,emitOnBegin:!0,poll:!0,pollingInterval:l,async onBlockNumber(D){const j=w=>{clearTimeout(k),v(),w(),m()};let g=D;if(!h)try{if(p){if(r>1&&(!p.blockNumber||g-p.blockNumber+1n<r))return;j(()=>R.resolve(p));return}if(n&&!f&&(h=!0,await $c(async()=>{f=await J(e,Nc,"getTransaction")({hash:o}),f.blockNumber&&(g=f.blockNumber)},{delay:c,retryCount:i}),h=!1),p=await J(e,Vs,"getTransactionReceipt")({hash:o}),r>1&&(!p.blockNumber||g-p.blockNumber+1n<r))return;j(()=>R.resolve(p))}catch(w){if(w instanceof mp||w instanceof gp){if(!f){h=!1;return}try{d=f,h=!0;const P=await $c(()=>J(e,Rt,"getBlock")({blockNumber:g,includeTransactions:!0}),{delay:c,retryCount:i,shouldRetry:({error:$})=>$ instanceof Pp});h=!1;const N=P.transactions.find(({from:$,nonce:S})=>$===d.from&&S===d.nonce);if(!N||(p=await J(e,Vs,"getTransactionReceipt")({hash:N.hash}),r>1&&(!p.blockNumber||g-p.blockNumber+1n<r)))return;let I="replaced";N.to===d.to&&N.value===d.value&&N.input===d.input?I="repriced":N.from===N.to&&N.value===0n&&(I="cancelled"),j(()=>{var $;($=R.onReplaced)==null||$.call(R,{reason:I,replacedTransaction:d,transaction:N,transactionReceipt:p}),R.resolve(p)})}catch(P){j(()=>R.reject(P))}}else j(()=>R.reject(w))}}})}),O}function zS(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=Ee(["watchBlocks",e.uid,t,n,r,l,a]);return yn(h,{onBlock:o,onError:s},m=>$o(async()=>{var v;try{const O=await J(e,Rt,"getBlock")({blockTag:t,includeTransactions:l});if(O.number!==null&&(f==null?void 0:f.number)!=null){if(O.number===f.number)return;if(O.number-f.number>1&&n)for(let b=(f==null?void 0:f.number)+1n;b<O.number;b++){const A=await J(e,Rt,"getBlock")({blockNumber:b,includeTransactions:l});m.onBlock(A,f),f=A}}((f==null?void 0:f.number)==null||t==="pending"&&(O==null?void 0:O.number)==null||O.number!==null&&O.number>f.number)&&(m.onBlock(O,f),f=O)}catch(O){(v=m.onError)==null||v.call(m,O)}},{emitOnBegin:r,interval:a}))})():(()=>{let h=!0,m=!0,v=()=>h=!1;return(async()=>{try{r&&J(e,Rt,"getBlock")({blockTag:t,includeTransactions:l}).then(A=>{h&&m&&(o(A,void 0),m=!1)}).catch(s);const O=(()=>{if(e.transport.type==="fallback"){const A=e.transport.transports.find(k=>k.config.type==="webSocket"||k.config.type==="ipc");return A?A.value:e.transport}return e.transport})(),{unsubscribe:b}=await O.subscribe({params:["newHeads"],async onData(A){var R;if(!h)return;const k=await J(e,Rt,"getBlock")({blockNumber:(R=A.result)==null?void 0:R.number,includeTransactions:l}).catch(()=>{});h&&(o(k,f),m=!1,f=k)},onError(A){s==null||s(A)}});v=b,h||v()}catch(O){s==null||s(O)}})(),()=>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 d=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")),p=f??!1;return d?(()=>{const v=Ee(["watchEvent",t,n,r,e.uid,o,l,i]);return yn(v,{onLogs:a,onError:c},O=>{let b;i!==void 0&&(b=i-1n);let A,k=!1;const R=$o(async()=>{var D;if(!k){try{A=await J(e,Th,"createEventFilter")({address:t,args:n,event:o,events:s,strict:p,fromBlock:i})}catch{}k=!0;return}try{let j;if(A)j=await J(e,Fs,"getFilterChanges")({filter:A});else{const g=await J(e,Po,"getBlockNumber")({});b&&b!==g?j=await J(e,ic,"getLogs")({address:t,args:n,event:o,events:s,fromBlock:b+1n,toBlock:g}):j=[],b=g}if(j.length===0)return;if(r)O.onLogs(j);else for(const g of j)O.onLogs([g])}catch(j){A&&j instanceof Ln&&(k=!1),(D=O.onError)==null||D.call(O,j)}},{emitOnBegin:!0,interval:l});return async()=>{A&&await J(e,Ds,"uninstallFilter")({filter:A}),R()}})})():(()=>{let v=!0,O=()=>v=!1;return(async()=>{try{const b=(()=>{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})(),A=s??(o?[o]:void 0);let k=[];A&&(k=[A.flatMap(j=>Yr({abi:[j],eventName:j.name,args:n}))],o&&(k=k[0]));const{unsubscribe:R}=await b.subscribe({params:["logs",{address:t,topics:k}],onData(D){var g;if(!v)return;const j=D.result;try{const{eventName:w,args:P}=oc({abi:A??[],data:j.data,topics:j.topics,strict:p}),N=tn(j,{args:P,eventName:w});a([N])}catch(w){let P,N;if(w instanceof Vr||w instanceof vs){if(f)return;P=w.abiItem.name,N=(g=w.abiItem.inputs)==null?void 0:g.some($=>!("name"in $&&$.name))}const I=tn(j,{args:N?[]:{},eventName:P});a([I])}},onError(D){c==null||c(D)}});O=R,v||O()}catch(b){c==null||c(b)}})(),()=>O()})()}function WS(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=Ee(["watchPendingTransactions",e.uid,t,s]);return yn(u,{onTransactions:r,onError:n},l=>{let f;const d=$o(async()=>{var p;try{if(!f)try{f=await J(e,Oh,"createPendingTransactionFilter")({});return}catch(m){throw d(),m}const h=await J(e,Fs,"getFilterChanges")({filter:f});if(h.length===0)return;if(t)l.onTransactions(h);else for(const m of h)l.onTransactions([m])}catch(h){(p=l.onError)==null||p.call(l,h)}},{emitOnBegin:!0,interval:s});return async()=>{f&&await J(e,Ds,"uninstallFilter")({filter:f}),d()}})})():(()=>{let u=!0,l=()=>u=!1;return(async()=>{try{const{unsubscribe:f}=await e.transport.subscribe({params:["newPendingTransactions"],onData(d){if(!u)return;const p=d.result;r([p])},onError(d){n==null||n(d)}});l=f,u||l()}catch(f){n==null||n(f)}})(),()=>l()})()}function VS(e){var f,d,p;const{scheme:t,statement:n,...r}=((f=e.match(GS))==null?void 0:f.groups)??{},{chainId:o,expirationTime:s,issuedAt:i,notBefore:c,requestId:a,...u}=((d=e.match(qS))==null?void 0:d.groups)??{},l=(p=e.split("Resources:")[1])==null?void 0:p.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 GS=/^(?:(?<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)?/,qS=/(?: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 ZS(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||!it(r.address,{strict:!1})||t&&!ks(r.address,t))return!1}catch{return!1}return!0}async function KS(e,t){const{address:n,domain:r,message:o,nonce:s,scheme:i,signature:c,time:a=new Date,...u}=t,l=VS(o);if(!l.address||!ZS({address:n,domain:r,message:l,nonce:s,scheme:i,time:a}))return!1;const d=Rh(o);return Yc(e,{address:l.address,hash:d,signature:c,...u})}function YS(e){return{call:t=>So(e,t),createAccessList:t=>Ah(e,t),createBlockFilter:()=>Y6(e),createContractEventFilter:t=>op(e,t),createEventFilter:t=>Th(e,t),createPendingTransactionFilter:()=>Oh(e),estimateContractGas:t=>$2(e,t),estimateGas:t=>rc(e,t),getBalance:t=>Up(e,t),getBlobBaseFee:()=>X6(e),getBlock:t=>Rt(e,t),getBlockNumber:t=>Po(e,t),getBlockTransactionCount:t=>Q6(e,t),getBytecode:t=>Ch(e,t),getChainId:()=>Dp(e),getCode:t=>Ch(e,t),getContractEvents:t=>Hp(e,t),getEip712Domain:t=>e5(e,t),getEnsAddress:t=>B6(e,t),getEnsAvatar:t=>q6(e,t),getEnsName:t=>Z6(e,t),getEnsResolver:t=>K6(e,t),getEnsText:t=>Ph(e,t),getFeeHistory:t=>r5(e,t),estimateFeesPerGas:t=>a2(e,t),getFilterChanges:t=>Fs(e,t),getFilterLogs:t=>o5(e,t),getGasPrice:()=>ec(e),getLogs:t=>ic(e,t),getProof:t=>I5(e,t),estimateMaxPriorityFeePerGas:t=>i2(e,t),getStorageAt:t=>N5(e,t),getTransaction:t=>Nc(e,t),getTransactionConfirmations:t=>M5(e,t),getTransactionCount:t=>Ip(e,t),getTransactionReceipt:t=>Vs(e,t),multicall:t=>k5(e,t),prepareTransactionRequest:t=>_p(e,t),readContract:t=>rn(e,t),sendRawTransaction:t=>g6(e,t),simulate:t=>Mc(e,t),simulateBlocks:t=>Mc(e,t),simulateCalls:t=>cS(e,t),simulateContract:t=>c6(e,t),verifyMessage:t=>jS(e,t),verifySiweMessage:t=>KS(e,t),verifyTypedData:t=>_S(e,t),uninstallFilter:t=>Ds(e,t),waitForTransactionReceipt:t=>US(e,t),watchBlocks:t=>zS(e,t),watchBlockNumber:t=>w0(e,t),watchContractEvent:t=>m6(e,t),watchEvent:t=>HS(e,t),watchPendingTransactions:t=>WS(e,t)}}function XS(e){const{key:t="public",name:n="Public Client"}=e;return v6({...e,key:t,name:n,type:"publicClient"}).extend(YS)}const QS=f5({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 B.jsx("span",{className:`loading loading-${e} loading-spinner ${s} ${i} ${n}`.trim(),"aria-label":r,role:"status","aria-live":"polite"})},JS=(e,t,n)=>{const r=parseFloat(String(e)||"0"),o=parseFloat(String(t)||"0");if(o>0){const s=r-o,i=ht(Math.max(0,s).toString());return B.jsxs("span",{className:"flex items-center gap-1",children:[ht(e),B.jsx("span",{className:"text-sm font-edgex-harmony text-functional-green-1 leading-[18px] font-medium",children:"→"}),i," ",n]})}return`${ht(e)} ${n}`},e$=(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)},t$=(e,t,n)=>{if(!bf(e,n))return!1;try{const r=new Me(t||"0"),o=new Me("200000");return r.isNaN()||o.isNaN()?!1:r.gte(o)}catch{return!1}},n$=(e,t,n)=>{let r=t||"0";if(bf(e,n))try{const o=new Me(r),s=new Me("200000");o.gt(s)&&(r="200000")}catch(o){console.warn("Error calculating max amount limit:",o)}return r},x0={chains:[],currentActiveAccount:{wallet:"EVM",ethAddress:"",accountId:"",smartWalletAddress:""},defaultChainId:1,platformBalance:"0"};let He=null;const E0=E.forwardRef((e,t)=>{const[n,r]=E.useState(!1),[o,s]=E.useState(!1),[i,c]=E.useState(x0),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)},[]),d=E.useCallback(()=>n,[n]),p=E.useCallback(()=>o,[o]);return E.useImperativeHandle(t,()=>({openDeposit:a,closeDeposit:l,updateDepositOptions:u,setDepositLoading:f,isOpen:d,isLoading:p}),[a,l,u,f,d,p]),E.useEffect(()=>(He={openDeposit:a,closeDeposit:l,updateDepositOptions:u,setDepositLoading:f,isOpen:d,isLoading:p},()=>{He=null}),[a,l,u,f,d,p]),B.jsx(C0,{isOpen:n,isLoading:o,onClose:l,currentActiveAccount:i.currentActiveAccount,chains:i.chains,defaultChainId:i.defaultChainId,platformBalance:i.platformBalance,wagmiHooks:i.wagmiHooks,onDeposit:i.onDeposit,onCopy:i.onCopy,onChainChange:h=>{var m;return(m=i.onChainChange)==null?void 0:m.call(i,h)},onTokenChange:h=>{var m;return(m=i.onTokenChange)==null?void 0:m.call(i,h)}})});E0.displayName="DepositManager";const S0=e=>{if(!He){console.error("DepositManager not initialized. Make sure to render <DepositManager /> in your app.");return}He.openDeposit(e||x0)},$0=()=>{if(!He){console.error("DepositManager not initialized. Make sure to render <DepositManager /> in your app.");return}He.closeDeposit()},P0=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)},r$=()=>He?He.isOpen():!1,A0=()=>He?He.isLoading():!1,o$=()=>({openDeposit:S0,closeDeposit:$0,updateDepositOptions:P0,setDepositLoading:Ks,isOpen:r$,isLoading:A0}),s$=e=>{const{t}=_t(),{isNetworkMismatch:n,depositAmount:r,approved:o,currentTokenBalance:s,selectedToken:i,showLayerZeroTip:c,minDeposit:a=10}=e;return E.useMemo(()=>{if(n)return{text:t("deposit.switchNetwork"),disabled:!1,isNetworkSwitch:!0};const u=parseFloat(r||"0"),l=e$(r,s||"0",o);return!r||u===0||!o?{text:t(c?"deposit.layerZeroDepositButton":"deposit.confirmDeposit"),disabled:!0,isNetworkSwitch:!1}:u<a?{text:t("deposit.minDepositParsed",{amount:a,token:i}),disabled:!0,isNetworkSwitch:!1}:{text:t(c?"deposit.layerZeroDepositButton":"deposit.confirmDeposit"),disabled:!l,isNetworkSwitch:!1}},[n,r,o,s,i,c,a,t])};function i$(e){const{account:t,accountChainId:n,targetChainId:r,tokenInfo:o,amount:s}=e,{useReadContract:i,useWriteContract:c,usePublicClient:a,useSwitchChain:u}=e.wagmiHooks,l=o==null?void 0:o.tokenAddress,f=(o==null?void 0:o.decimals)??18,d=o==null?void 0:o.contractAddress,p=!l||l.toLowerCase()==="0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",{switchChainAsync:h}=u(),{writeContractAsync:m}=c(),v=a(),O=i({address:l,abi:gr,functionName:"allowance",args:[Nn(t||""),d],chainId:r,query:{enabled:!!(!p&&t&&r&&l&&d)}}),b=O!=null&&O.isSuccess?O.data:void 0,A=E.useMemo(()=>{if(p)return!0;if(!O.isSuccess||b===void 0||b===0n)return!1;try{const R=T5(String(Number(s||"0")||0),Number(f));return b>=R}catch{return!1}},[p,O.isSuccess,b,s,f]),k=E.useCallback(async()=>{try{if(r&&n&&+n!=+r&&await h({chainId:+r}),!m||!v||!l||!d)return;const D=Nn(l),j=Nn(d);if((b||0n)>0n){const P=await m({abi:gr,address:D,functionName:"approve",args:[j,0n]});await v.waitForTransactionReceipt({hash:P})}const w=await m({abi:gr,address:D,functionName:"approve",args:[j,$p]});await v.waitForTransactionReceipt({hash:w}),O!=null&&O.refetch&&await O.refetch()}catch(R){console.error("[useApprove] onApprove failed:",R)}},[r,n,l,d,b,O,m,v,h]);return{approve:A,onApprove:k}}const a$=({token:e,account:t,chainId:n,wagmiHooks:r,onResult:o})=>{var i;const s=(i=r==null?void 0:r.useBalance)==null?void 0:i.call(r,{address:t,token:e.tokenAddress,chainId:n,query:{enabled:!!t&&!!n&&!!e.tokenAddress&&!!(r!=null&&r.useBalance)}});return E.useEffect(()=>{o(Nn(e.tokenAddress),{balance:s})},[s,e.tokenAddress,o]),null},T0=({account:e,chainId:t,contractAddress:n,tokens:r=[],wagmiHooks:o})=>{var O;const s=E.useMemo(()=>r.filter(b=>b.tokenAddress&&b.tokenAddress!=="0x0000000000000000000000000000000000000000"),[r]),[i,c]=E.useState({}),a=E.useCallback((b,A)=>{c(k=>({...k,[b]:A}))},[]),u=(O=o==null?void 0:o.useBalance)==null?void 0:O.call(o,{address:e,chainId:t,query:{enabled:!!e&&!!t&&!!(o!=null&&o.useBalance)}}),[l,f]=E.useState(0),d=E.useMemo(()=>s.map(b=>E.createElement(a$,{key:`${b.tokenAddress}-${l}`,token:b,account:e,chainId:t,contractAddress:n,wagmiHooks:o,onResult:a})),[s,e,t,n,o,a,l]),p=E.useMemo(()=>{const b=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"},A=s.map(R=>{const D=i[Nn(R.tokenAddress)],j=D==null?void 0:D.balance,g=j==null?void 0:j.data;return{address:Nn(R.tokenAddress),value:(g==null?void 0:g.value)||BigInt(0),formatted:(g==null?void 0:g.formatted)||"0",decimals:(g==null?void 0:g.decimals)||R.decimals}}).filter(R=>R.address),k=A.reduce((R,D)=>({...R,[D.address]:{balance:D}}),{});return{balanceList:A,baseTokenBalance:b,combinedData:k}},[u,i,s]),h=E.useCallback(async()=>p,[p]),m=E.useMemo(()=>{const b=(u==null?void 0:u.isLoading)||!1,A=Object.values(i).some(k=>{var R;return(R=k.balance)==null?void 0:R.isLoading});return b||A},[u==null?void 0:u.isLoading,i]),v=E.useCallback(()=>f(b=>b+1),[]);return{multicallRun:h,multicallRefresh:v,multicallResult:p,validErcTokens:s,isLoading:m,queryComponents:d}};function c$({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 d=async()=>{try{const p=await e.readContract({address:t,abi:gr,functionName:"balanceOf",args:[n]});c(p),u(ja(p,r))}catch{u(o)}};d();try{l=e.watchContractEvent({address:t,abi:gr,eventName:"Transfer",args:{to:n},onLogs:()=>{d()},poll:!0,pollingInterval:s}),f=e.watchContractEvent({address:t,abi:gr,eventName:"Transfer",args:{from:n},onLogs:()=>{d()},poll:!0,pollingInterval:s})}catch{}return()=>{l==null||l(),f==null||f()}},[e,t,n,r,o,s]),{value:i,formatted:a}}const u$=({address:e,currentActiveChain:t,selectedToken:n,platformBalance:r,isLoading:o,wagmiHooks:s,onChainChange:i,onDeposit:c})=>{const{t:a}=_t(),u=s.useAccount(),l=t.tokenList.find(F=>F.token===n),f=t.chainId,[d,p]=E.useState("");E.useEffect(()=>{p("")},[n,t.chainId]);const{multicallResult:h,queryComponents:m}=T0({account:e,chainId:t.chainId,contractAddress:(l==null?void 0:l.contractAddress)||(t==null?void 0:t.contractAddress),tokens:(t==null?void 0:t.tokenList)||[],wagmiHooks:s}),v=E.useMemo(()=>{var _;if(!l)return"0";if(!l.tokenAddress||l.tokenAddress.toLowerCase()==="0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee")return h.baseTokenBalance.formatted;const F=h.combinedData[l.tokenAddress];return((_=F==null?void 0:F.balance)==null?void 0:_.formatted)||"0"},[l,h]),O="0xfd086bc7cd5c481dcc9c85ebe478a1c0b69fcbb9",b="0xceeed84620e5eb9ab1d6dfc316867d2cda332e41",A=E.useMemo(()=>{var F,_;return XS({chain:QS,transport:O6(t.rpcUrl||((F=window==null?void 0:window.ENV)==null?void 0:F.CHAIN_RPC_URL_42161)||((_=window==null?void 0:window.ENV)==null?void 0:_.CHAIN_RPC_URL_421614))})},[t.rpcUrl]),k="1000000000000",{formatted:R}=c$({client:A,tokenAddress:O,holder:b,decimals:6,fallbackFormatted:k,pollingInterval:12e3}),[D,j]=E.useState(!1),{approve:g,onApprove:w}=i$({account:e,accountChainId:u.chainId,targetChainId:+t.chainId,tokenInfo:l,amount:d,wagmiHooks:s}),P=E.useCallback(async()=>{if(!D)try{j(!0),await w()}catch(F){console.error("Approve failed:",F)}finally{j(!1)}},[D,w]),N=E.useMemo(()=>+u.chainId!=+t.chainId,[u.chainId,t.chainId]),{showLayerZeroTip:I,layerZeroTipKey:$}=E.useMemo(()=>{const F=+t.chainId==42161||+t.chainId==421614,_=(n==null?void 0:n.toUpperCase())==="USDT",z=new Me(d||"0"),H=new Me("200000");let K=!1,W;if(F&&_&&d)if(z.gte(H))K=!0,W="deposit.layerZeroDepositTipGte200k";else{const Z=R;if(typeof Z=="string"&&Z.length>0){const Q=new Me(Z);!Q.isNaN()&&z.gte(Q)&&(K=!0,W="deposit.layerZeroDepositTipExceedPool")}}return{showLayerZeroTip:K,layerZeroTipKey:W}},[t.chainId,n,d,R]),S=E.useCallback(()=>n$(+t.chainId,v||"0",n),[v,t==null?void 0:t.chainId,n]),x=E.useMemo(()=>t$(+t.chainId,d,n),[t==null?void 0:t.chainId,d,n]),T=s$({isNetworkMismatch:N,depositAmount:d,approved:g,currentTokenBalance:v,selectedToken:n,showLayerZeroTip:I,minDeposit:10}),C=F=>{const _=F.target.value,z=S(),H=xa(_,z);if(H.isValid)p(H.formattedValue),H.errorType;else return H.errorType==="exceed_balance",void 0},y=E.useCallback(async()=>{i&&i(f)},[i,f]),M=E.useCallback(async()=>{Ks(!0);try{c&&c({amount:d,chainId:f,tokenAddress:(l==null?void 0:l.tokenAddress)||"",tokenSymbol:n})}catch(F){console.error("Deposit error:",F),Ks(!1)}},[c,d,f,l==null?void 0:l.tokenAddress,n]);return B.jsxs(B.Fragment,{children:[m,B.jsxs("div",{className:"bg-fill-input-primary rounded-lg px-3 py-3 my-4",children:[B.jsxs("div",{className:"flex justify-between items-center h-[18px] mb-3",children:[B.jsx("input",{type:"text",placeholder:a("deposit.amount"),value:d,onChange:C,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"}),B.jsx("button",{onClick:()=>{const F=S();p(F)},className:"text-theme-normal text-xs font-medium cursor-pointer hover:opacity-80 transition-opacity h-full flex items-center",children:a("deposit.max")})]}),B.jsx("div",{className:"h-[1px] bg-line-divider-secondary mb-2"}),B.jsxs("div",{className:"flex justify-between items-center",children:[B.jsx(er,{content:a("deposit.availableDesc"),children:B.jsx("span",{className:"text-text-tertiary text-xs leading-[14px] border-b border-dashed border-line-divider-primary",children:a("deposit.available")})}),B.jsx("span",{className:"text-text-primary text-xs leading-[14px]",children:JS(v||"0",d,n)})]})]}),!g&&ww(d||"0",0)&&B.jsxs("div",{className:"flex justify-center flex-col items-center",children:[B.jsx("h3",{className:"text-text-primary text-sm leading-4 font-medium",children:a("deposit.enableSystemProWithToken",{token:n,network:t==null?void 0:t.chain})}),B.jsx("p",{className:"text-text-secondary text-xs leading-3 mt-4",children:a("deposit.enableTokenDesc",{token:n,network:t==null?void 0:t.chain})}),B.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:P,disabled:D,children:D?B.jsx(Oo,{size:"xs",inline:!0}):a("deposit.enableWithToken",{token:n})})]}),I&&B.jsxs(B.Fragment,{children:[B.jsxs("div",{className:"flex mb-4",children:[B.jsx("div",{className:"w-5",children:B.jsx("img",{src:ms,className:"w-4 h-4",alt:"Warning"})}),B.jsx("div",{className:"flex-1 text-xs text-functional-orange-1",children:a($||"deposit.layerZeroDepositTip")})]}),B.jsx("div",{className:"my-2 ml-5 h-[1px] border-b border-dashed border-line-divider-secondary"})]}),x&&B.jsxs("div",{className:"flex mb-4",children:[B.jsx("div",{className:"w-5",children:B.jsx("img",{src:ms,className:"w-4 h-4",alt:"Warning"})}),B.jsx("div",{className:"flex-1 text-xs text-functional-orange-1",children:a("deposit.depositTipFor25w")})]}),x&&B.jsx("div",{className:"my-2 ml-5 h-[1px] border-b border-dashed border-line-divider-secondary"}),B.jsxs("div",{className:"flex mb-4",children:[B.jsx("div",{className:"w-5",children:!(x||I)&&B.jsx("img",{src:ms,className:"w-4 h-4",alt:"Warning"})}),B.jsx("div",{className:"flex-1 text-xs text-functional-orange-1",children:a("deposit.noPrivateKeyWalletWarning")})]}),B.jsxs("div",{className:"border-t border-line-divider-secondary border-dashed py-4",children:[B.jsxs("div",{className:"flex justify-between items-center h-[18px] leading-4",children:[B.jsx("span",{className:"text-sm text-text-tertiary",children:a("deposit.arrivalTime")}),B.jsx(er,{content:B.jsxs("div",{className:"grid flex-grow max-w-[300px] min-w-[80px] rounded-2xl flex-col gap-[10px]",children:[B.jsx("p",{children:a("deposit.arrivaltimeTooltip1",{v:(t==null?void 0:t.blockTime)*t.txConfirm/60,v1:t==null?void 0:t.txConfirm})}),B.jsx("p",{children:a("deposit.arrivaltimeTooltip2")})]}),placement:"top",children:B.jsx("span",{className:"text-text-primary font-medium text-right border-b-[2px] border-dashed border-line-divider-primary decoration-dashed text-sm",children:a("deposit.arrivalEstimated",{v:(t==null?void 0:t.blockTime)*t.txConfirm/60})})})]}),B.jsxs("div",{className:"flex justify-between items-center h-[18px] leading-4 mt-2",children:[B.jsx("span",{className:"text-sm text-text-tertiary",children:a("deposit.equity")}),B.jsx("span",{className:"text-sm text-text-primary font-medium",children:d?B.jsxs("span",{className:"flex items-center gap-1",children:[ht(r),B.jsx("span",{className:"text-sm font-edgex-harmony text-functional-green-1 leading-[18px] font-medium",children:"→"}),ht((parseFloat(r)+parseFloat(d)).toString())," ",n]}):`${ht(r)} ${n}`})]})]}),B.jsxs("button",{className:`w-full h-[38px] text-sm rounded-xl font-medium transition-colors flex items-center justify-center gap-2 ${T.disabled||o?"bg-text-disabled text-text-secondary cursor-not-allowed":"bg-fill-btn-primary text-text-on-sec-btn"}`,onClick:T.isNetworkSwitch?y:M,disabled:T.disabled||o,children:[o&&B.jsx(Oo,{size:"xs"}),T.text]})]})},O0=e=>e.toLocaleUpperCase()===wn?wn:oi,Ys=e=>O0(e.wallet)===wn,l$=e=>O0(e.wallet)===oi,C0=({isOpen:e,isLoading:t=!1,onClose:n,currentActiveAccount:r,chains:o,defaultChainId:s,platformBalance:i="0",wagmiHooks:c,onDeposit:a,onCopy:u,onChainChange:l,onTokenChange:f})=>{const{t:d}=_t(),[p,h]=E.useState(()=>{var k;return!o||o.length===0?1:s||((k=o[0])==null?void 0:k.chainId)||1}),m=o.find(k=>k.chainId===p)||o[0],[v,O]=E.useState(()=>{var j;if(!o||o.length===0)return"";const k=s||((j=o[0])==null?void 0:j.chainId),R=o.find(g=>g.chainId===k);if(!R||!R.tokenList||R.tokenList.length===0)return"";const D=R.tokenList[0];return(D==null?void 0:D.token)||""}),b=E.useCallback(k=>{h(k),l==null||l(k)},[l]),A=E.useCallback(k=>{O(k),f==null||f(k)},[f]);return e?Ne.createPortal(B.jsx("div",{className:"fixed top-0 left-0 right-0 bottom-0 w-screen h-screen",style:{zIndex:49},children:B.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:B.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:[B.jsxs("div",{className:"flex items-center justify-between mb-4",children:[B.jsx("h2",{className:"text-lg font-semibold text-white",children:d("deposit.title")}),B.jsx("button",{className:"text-gray-400 hover:text-gray-200 transition-colors",onClick:n,"aria-label":"Close",children:B.jsx(hu,{className:"h-4 w-4"})})]}),B.jsx(yf,{currentActiveChain:m,chainList:o,onChainChange:b,curSelectToken:v,onTokenChange:A,walletType:Ys(r)?wn:oi}),Ys(r)&&B.jsx(Sw,{address:r.smartWalletAddress,currentActiveChain:m,selectedToken:v,onDeposit:a,onCopy:u,onClose:n}),l$(r)&&B.jsx(u$,{address:r.ethAddress,currentActiveChain:m,selectedToken:v,platformBalance:i,isLoading:t,wagmiHooks:c,onChainChange:b,onDeposit:a,onClose:n})]})})}),document.body):null},f$=({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}=_t(),f=E.useMemo(()=>{if(!Ct(n==null?void 0:n.chainId)){const v=new Me(e||"0").minus(o||"0").decimalPlaces(2,Me.ROUND_DOWN);return v.isNegative()?"0.00":v.toString()}return e||"0"},[e,o,n==null?void 0:n.chainId]),d=E.useMemo(()=>r||"0",[r]),p=v=>{const O=v.target.value,A=xa(O,d||"0");if(A.isValid)c(A.formattedValue),A.errorType;else return A.errorType==="exceed_balance",void 0;u==null||u(A.formattedValue)},h=()=>{c(d),u==null||u(d)},m=()=>{const v=parseFloat(r||"0"),O=parseFloat(e||"0");if(O>0){const b=v-O,A=ht(Math.max(0,b).toString());return B.jsxs("span",{className:"flex items-center gap-1",children:[ht(r||"0"),B.jsx("span",{className:"text-sm font-edgex-harmony text-functional-green-1 leading-[18px] font-medium",children:"→"}),A," ",t]})}return`${ht(r||"0")} ${t}`};return B.jsxs(B.Fragment,{children:[B.jsxs("div",{className:"bg-fill-input-primary rounded-lg px-3 py-3 my-4",children:[B.jsxs("div",{className:"flex justify-between items-center h-[18px] mb-3",children:[B.jsx("input",{type:"text",placeholder:l("deposit.amount"),value:e,onChange:p,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"}),B.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")})]}),B.jsx("div",{className:"h-[1px] bg-line-divider-secondary mb-2"}),B.jsxs("div",{className:"flex justify-between items-center",children:[B.jsx(er,{content:l("deposit.availableDesc"),children:B.jsx("span",{className:"text-text-tertiary text-xs leading-[14px] border-b border-dashed border-line-divider-primary",children:l("deposit.available")})}),B.jsx("span",{className:"text-text-primary text-xs leading-[14px]",children:m()})]})]}),s==="mpc"&&!Ct(n==null?void 0:n.chainId)&&B.jsx("div",{className:"bg-fill-input-primary rounded-lg my-4 h-9 flex items-center px-3",children:B.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"})}),B.jsx("div",{className:"bg-fill-page-secondary rounded-lg mb-4",children:Ct(n==null?void 0:n.chainId)?B.jsxs(B.Fragment,{children:[B.jsx("p",{className:"text-text-tertiary text-xs leading-[18px]",children:l("withdraw.noticeDesc")}),B.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")})]}):B.jsx("p",{className:"text-text-tertiary text-xs leading-[18px]",children:l("withdraw.crossChainTips")})}),B.jsxs("div",{className:"py-4 border-t border-line-divider-secondary border-dashed",children:[B.jsxs("div",{className:"flex items-center justify-between h-[18px] leading-[18px]",children:[B.jsx(er,{content:B.jsxs("div",{children:[B.jsx("div",{children:l("withdraw.speedNote")}),B.jsxs("div",{className:"flex gap-1 items-center mt-1",children:[B.jsx(jr,{selectedLevel:pt.FAST,maxLevel:3}),B.jsx("span",{children:l("withdraw.speedNoteSpeed1")})]}),B.jsxs("div",{className:"flex gap-1 items-center mt-1",children:[B.jsx(jr,{selectedLevel:pt.Medium,maxLevel:3}),B.jsx("span",{children:l("withdraw.speedNoteSpeed2")})]}),B.jsxs("div",{className:"flex gap-1 items-center mt-1",children:[B.jsx(jr,{selectedLevel:pt.SLOW,maxLevel:3}),B.jsx("span",{children:l("withdraw.speedNoteSpeed3")})]})]}),children:B.jsx("span",{className:"text-text-tertiary text-sm leading-4 border-b border-dashed border-line-divider-primary",children:l("withdraw.speed")})}),B.jsx("div",{className:"flex items-center",children:B.jsx(jr,{selectedLevel:Ct(n==null?void 0:n.chainId)?pt.SLOW:pt.FAST,maxLevel:3})})]}),!Ct(n==null?void 0:n.chainId)&&B.jsxs("div",{className:"flex items-center justify-between mt-2 h-[18px]",children:[B.jsx("span",{className:"text-text-tertiary text-sm leading-4",children:l("withdraw.fee")}),B.jsxs("span",{className:"text-text-primary text-sm leading-4 font-medium",children:[o," ",t]})]}),B.jsxs("div",{className:"flex items-center justify-between mt-2 h-[18px]",children:[B.jsx("span",{className:"text-text-tertiary text-sm leading-4",children:l(Ct(n==null?void 0:n.chainId)?"withdraw.withdrawlAmount":"withdraw.amountToReceive")}),B.jsxs("span",{className:"text-text-primary text-sm leading-4 font-medium",children:[ht(f)," ",t]})]})]})]})},d$=[],p$={};let We=null;const I0=E.forwardRef((e,t)=>{const[n,r]=E.useState(!1),[o,s]=E.useState(!1),[i,c]=E.useState({chains:[],currentActiveAccount:{wallet:"EVM",ethAddress:"",accountId:"",smartWalletAddress:""}}),a=E.useCallback(h=>{c(h||{chains:[],currentActiveAccount:{wallet:"EVM",ethAddress:"",accountId:"",smartWalletAddress:""}}),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)},[]),d=E.useCallback(()=>n,[n]),p=E.useCallback(()=>o,[o]);return E.useImperativeHandle(t,()=>({openWithdraw:a,closeWithdraw:l,updateWithdrawOptions:u,setWithdrawLoading:f,isOpen:d,isLoading:p}),[a,l,u,f,d,p]),E.useEffect(()=>(We={openWithdraw:a,closeWithdraw:l,updateWithdrawOptions:u,setWithdrawLoading:f,isOpen:d,isLoading:p},()=>{We=null}),[a,l,u,f,d,p]),B.jsx(L0,{isOpen:n,isLoading:o,onClose:l,config:i.config||{symbol:"USDT"},currentActiveAccount:i.currentActiveAccount,chains:i.chains||d$,defaultChainId:i.defaultChainId,defaultTokenAddress:i.defaultTokenAddress,defaultAmount:i.defaultAmount,metadata:i.metadata||p$,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})});I0.displayName="WithdrawManager";const N0=e=>{if(!We){console.error("WithdrawManager not initialized. Make sure to render <WithdrawManager /> in your app.");return}We.openWithdraw(e||{chains:[],currentActiveAccount:{wallet:"EVM",ethAddress:"",accountId:"",smartWalletAddress:""}})},M0=()=>{if(!We){console.error("WithdrawManager not initialized. Make sure to render <WithdrawManager /> in your app.");return}We.closeWithdraw()},k0=e=>{if(!We){console.error("WithdrawManager not initialized. Make sure to render <WithdrawManager /> in your app.");return}We.updateWithdrawOptions(e)},Xs=e=>{if(!We){console.error("WithdrawManager not initialized. Make sure to render <WithdrawManager /> in your app.");return}We.setWithdrawLoading(e)},h$=()=>We?We.isOpen():!1,B0=()=>We?We.isLoading():!1,m$=()=>({openWithdraw:N0,closeWithdraw:M0,updateWithdrawOptions:k0,setWithdrawLoading:Xs,isOpen:h$,isLoading:B0}),g$=({address:e,walletType:t,chains:n,defaultChainId:r,defaultTokenAddress:o,defaultAmount:s="",metadata:i,currentEquity:c,platformBalance:a="0",fee:u="0.00",isLoading:l=!1,wagmiHooks:f,onWithdraw:d,onClose:p,onChainChange:h,onTokenChange:m,onAmountChanged:v})=>{var z;const{t:O}=_t(),[b,A]=E.useState(()=>{var H;return!n||n.length===0?1:r||((H=n[0])==null?void 0:H.chainId)||1}),[k,R]=E.useState(()=>{var Z;if(!n||n.length===0)return"";const H=r||((Z=n[0])==null?void 0:Z.chainId),K=n.find(q=>q.chainId===H);if(!K||!K.tokenList||K.tokenList.length===0)return"";const W=K.tokenList.find(q=>q.tokenAddress===o)||K.tokenList[0];return(W==null?void 0:W.token)||""}),[D,j]=E.useState(s),[g,w]=E.useState(""),P=E.useCallback(H=>{A(H),h==null||h(H)},[h]),N=E.useCallback(H=>{R(H),m==null||m(H)},[m]),I=E.useRef(!0),$=E.useRef(k),S=E.useRef(b);E.useEffect(()=>{if(I.current){I.current=!1,$.current=k,S.current=b;return}($.current!==k||S.current!==b)&&(j(""),$.current=k,S.current=b)},[k,b]);const x=n&&n.length>0?n.find(H=>H.chainId===b)||n[0]:null,T=(z=x==null?void 0:x.tokenList)==null?void 0:z.find(H=>H.token===k),{multicallResult:C,queryComponents:y}=T0({account:e,chainId:b,contractAddress:void 0,tokens:(x==null?void 0:x.tokenList)||[],wagmiHooks:f}),M=E.useMemo(()=>{var K;if(!T)return;if(!T.tokenAddress||T.tokenAddress.toLowerCase()==="0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee")return C.baseTokenBalance.formatted;const H=C.combinedData[T.tokenAddress];return((K=H==null?void 0:H.balance)==null?void 0:K.formatted)||"0"},[T,C]),F=E.useMemo(()=>{const H=new Me(D||"0"),K=new Me(u||"0"),W=Ct(b);return!D||H.isZero()||!W&&H.isLessThan(K)?{text:O("withdraw.confirmWithdraw"),disabled:!0}:t==="mpc"&&!W&&!g.trim()?{text:O("withdraw.invalidReceiverAddress"),disabled:!0}:{text:O("withdraw.confirmWithdraw"),disabled:!1}},[O,b,D,t,g,u]),_=E.useCallback(async()=>{Xs(!0);try{if(d){const H=new Me(D||"0"),K=new Me(u||"0"),Z={amount:(Ct(b)?H:H.minus(K)).toString(),chainId:b,tokenAddress:(T==null?void 0:T.tokenAddress)||"",tokenSymbol:k};t==="mpc"&&!Ct(b)&&(Z.receiverAddress=g),d(Z)}}catch{Xs(!1)}},[d,D,u,b,T==null?void 0:T.tokenAddress,k,t,g]);return!(f!=null&&f.useBalance)||!(f!=null&&f.useReadContract)||!(f!=null&&f.useAccount)?B.jsxs("div",{className:"p-6 text-center",children:[B.jsx("p",{className:"text-red-500",children:"缺少必要的 wagmi hooks"}),B.jsx("p",{className:"text-sm text-gray-500 mt-2",children:"请确保传入了 useBalance, useReadContract, useAccount"})]}):!n||n.length===0?B.jsx("div",{className:"text-center py-8",children:B.jsx("p",{className:"text-gray-400",children:"No chains available"})}):x?B.jsxs(B.Fragment,{children:[y,B.jsx(yf,{currentActiveChain:x,chainList:n,onChainChange:P,curSelectToken:k,onTokenChange:N,walletType:"EVM",txType:"withdraw"}),B.jsx(f$,{withdrawAmount:D,curSelectToken:k,curSelectTokenData:{balance:T==null?void 0:T.balance,allowance:T==null?void 0:T.allowance},currentActiveChain:x,currentEquity:c||0,amount:D,decimals:(T==null?void 0:T.decimals)||6,tokenBalance:M,platformBalance:a,fee:u,walletType:t,receiverAddress:g,onWithdrawAmountChange:j,onReceiverAddressChange:w,onAmountChanged:v}),B.jsxs("button",{className:`w-full h-[38px] text-sm rounded-xl font-medium transition-colors flex items-center justify-center gap-2 ${F.disabled||l?"bg-text-disabled text-text-secondary cursor-not-allowed":"bg-fill-btn-primary text-text-on-sec-btn"}`,onClick:_,disabled:F.disabled||l,children:[l&&B.jsx(Oo,{size:"xs"}),F.text]})]}):B.jsx("div",{className:"text-center py-8",children:B.jsx("p",{className:"text-gray-400",children:"Loading..."})})},L0=({isOpen:e,isLoading:t=!1,onClose:n,config:r,currentActiveAccount:o,chains:s,defaultChainId:i,defaultTokenAddress:c,defaultAmount:a="",metadata:u,currentEquity:l=5e3,platformBalance:f="0",fee:d,wagmiHooks:p,onWithdraw:h,onChainChange:m,onTokenChange:v,onAmountChanged:O})=>{const{t:b}=_t();return e?Ne.createPortal(B.jsx("div",{className:"fixed top-0 left-0 right-0 bottom-0 w-screen h-screen",style:{zIndex:49},children:B.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:B.jsxs("div",{className:"relative w-[420px] max-h-[85vh] bg-fill-page-secondary overflow-auto rounded-lg p-6 shadow-xl",onClick:A=>{A.stopPropagation()},children:[B.jsxs("div",{className:"flex items-center justify-between mb-4",children:[B.jsx("h2",{className:"text-lg font-semibold text-white",children:b("withdraw.withdraw")}),B.jsx("button",{className:"text-gray-400 hover:text-gray-200 transition-colors",onClick:n,"aria-label":"Close",children:B.jsx(hu,{className:"h-4 w-4"})})]}),B.jsx(g$,{chains:s,address:Ys(o)?o.smartWalletAddress:o.ethAddress,walletType:Ys(o)?"mpc":"evm",defaultChainId:i,defaultTokenAddress:c,defaultAmount:a,metadata:u,currentEquity:l,platformBalance:f,fee:d,isLoading:t,wagmiHooks:p,onWithdraw:h,onClose:n,onChainChange:m,onTokenChange:v,onAmountChanged:O})]})})}),document.body):null};re.ChromeLoader=Oo,re.ComponentProvider=cm,re.DEFAULT_LOCALE=No,re.Deposit=C0,re.DepositManager=E0,re.LOCALE_NAMES=sm,re.LoadingSpinner=Oo,re.SUPPORTED_LOCALES=ei,re.Tooltip=er,re.Withdraw=L0,re.WithdrawManager=I0,re.closeDeposit=$0,re.closeWithdraw=M0,re.formatThousands=lm,re.isDepositLoading=A0,re.isWithdrawLoading=B0,re.openDeposit=S0,re.openWithdraw=N0,re.setDepositLoading=Ks,re.setWithdrawLoading=Xs,re.updateDepositOptions=P0,re.updateWithdrawOptions=k0,re.useComponentConfig=uu,re.useDeposit=fm,re.useDepositManager=o$,re.useTranslation=_t,re.useWithdraw=dm,re.useWithdrawManager=m$,Object.defineProperty(re,Symbol.toStringTag,{value:"Module"})});
152
152
  //# sourceMappingURL=index.umd.js.map