@edgex-web/components 0.2.0-beta.13 → 0.2.0-beta.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.umd.js CHANGED
@@ -1,4 +1,4 @@
1
- (function(re,v){typeof exports=="object"&&typeof module<"u"?v(exports,require("react"),require("react-dom")):typeof define=="function"&&define.amd?define(["exports","react","react-dom"],v):(re=typeof globalThis<"u"?globalThis:re||self,v(re.EdgeXComponents={},re.React,re.ReactDOM))})(this,function(re,v,ke){"use strict";var _P=Object.defineProperty;var UP=(re,v,ke)=>v in re?_P(re,v,{enumerable:!0,configurable:!0,writable:!0,value:ke}):re[v]=ke;var Bo=(re,v,ke)=>UP(re,typeof v!="symbol"?v+"":v,ke);function il(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const n in e)if(n!=="default"){const r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:()=>e[n]})}}return t.default=e,Object.freeze(t)}const z=il(v),Or=il(ke);function X0(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Js={exports:{}},Cr={};/**
1
+ (function(re,v){typeof exports=="object"&&typeof module<"u"?v(exports,require("react"),require("react-dom")):typeof define=="function"&&define.amd?define(["exports","react","react-dom"],v):(re=typeof globalThis<"u"?globalThis:re||self,v(re.EdgeXComponents={},re.React,re.ReactDOM))})(this,function(re,v,ke){"use strict";var _P=Object.defineProperty;var UP=(re,v,ke)=>v in re?_P(re,v,{enumerable:!0,configurable:!0,writable:!0,value:ke}):re[v]=ke;var Bo=(re,v,ke)=>UP(re,typeof v!="symbol"?v+"":v,ke);function il(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const n in e)if(n!=="default"){const r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:()=>e[n]})}}return t.default=e,Object.freeze(t)}const z=il(v),Or=il(ke);function X0(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var ei={exports:{}},Cr={};/**
2
2
  * @license React
3
3
  * react-jsx-runtime.production.min.js
4
4
  *
@@ -14,11 +14,11 @@
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 cl;function J0(){return cl||(cl=1,process.env.NODE_ENV!=="production"&&function(){var e=v,t=Symbol.for("react.element"),n=Symbol.for("react.portal"),r=Symbol.for("react.fragment"),o=Symbol.for("react.strict_mode"),s=Symbol.for("react.profiler"),i=Symbol.for("react.provider"),c=Symbol.for("react.context"),a=Symbol.for("react.forward_ref"),l=Symbol.for("react.suspense"),u=Symbol.for("react.suspense_list"),f=Symbol.for("react.memo"),p=Symbol.for("react.lazy"),d=Symbol.for("react.offscreen"),h=Symbol.iterator,m="@@iterator";function x(D){if(D===null||typeof D!="object")return null;var q=h&&D[h]||D[m];return typeof q=="function"?q:null}var A=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function w(D){{for(var q=arguments.length,X=new Array(q>1?q-1:0),te=1;te<q;te++)X[te-1]=arguments[te];T("error",D,X)}}function T(D,q,X){{var te=A.ReactDebugCurrentFrame,de=te.getStackAddendum();de!==""&&(q+="%s",X=X.concat([de]));var he=X.map(function(ue){return String(ue)});he.unshift("Warning: "+q),Function.prototype.apply.call(console[D],console,he)}}var B=!1,L=!1,F=!1,j=!1,g=!1,y;y=Symbol.for("react.module.reference");function P(D){return!!(typeof D=="string"||typeof D=="function"||D===r||D===s||g||D===o||D===l||D===u||j||D===d||B||L||F||typeof D=="object"&&D!==null&&(D.$$typeof===p||D.$$typeof===f||D.$$typeof===i||D.$$typeof===c||D.$$typeof===a||D.$$typeof===y||D.getModuleId!==void 0))}function k(D,q,X){var te=D.displayName;if(te)return te;var de=q.displayName||q.name||"";return de!==""?X+"("+de+")":X}function C(D){return D.displayName||"Context"}function $(D){if(D==null)return null;if(typeof D.tag=="number"&&w("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),typeof D=="function")return D.displayName||D.name||null;if(typeof D=="string")return D;switch(D){case r:return"Fragment";case n:return"Portal";case s:return"Profiler";case o:return"StrictMode";case l:return"Suspense";case u:return"SuspenseList"}if(typeof D=="object")switch(D.$$typeof){case c:var q=D;return C(q)+".Consumer";case i:var X=D;return C(X._context)+".Provider";case a:return k(D,D.render,"ForwardRef");case f:var te=D.displayName||null;return te!==null?te:$(D.type)||"Memo";case p:{var de=D,he=de._payload,ue=de._init;try{return $(ue(he))}catch{return null}}}return null}var S=Object.assign,E=0,O,N,b,M,R,_,U;function W(){}W.__reactDisabledLog=!0;function K(){{if(E===0){O=console.log,N=console.info,b=console.warn,M=console.error,R=console.group,_=console.groupCollapsed,U=console.groupEnd;var D={configurable:!0,enumerable:!0,value:W,writable:!0};Object.defineProperties(console,{info:D,log:D,warn:D,error:D,group:D,groupCollapsed:D,groupEnd:D})}E++}}function V(){{if(E--,E===0){var D={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:S({},D,{value:O}),info:S({},D,{value:N}),warn:S({},D,{value:b}),error:S({},D,{value:M}),group:S({},D,{value:R}),groupCollapsed:S({},D,{value:_}),groupEnd:S({},D,{value:U})})}E<0&&w("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var Z=A.ReactCurrentDispatcher,H;function Y(D,q,X){{if(H===void 0)try{throw Error()}catch(de){var te=de.stack.trim().match(/\n( *(at )?)/);H=te&&te[1]||""}return`
18
- `+H+D}}var Q=!1,se;{var me=typeof WeakMap=="function"?WeakMap:Map;se=new me}function pe(D,q){if(!D||Q)return"";{var X=se.get(D);if(X!==void 0)return X}var te;Q=!0;var de=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var he;he=Z.current,Z.current=null,K();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(D,[],ue)}else{try{ue.call()}catch(qe){te=qe}D.call(ue.prototype)}}else{try{throw Error()}catch(qe){te=qe}D()}}catch(qe){if(qe&&te&&typeof qe.stack=="string"){for(var ae=qe.stack.split(`
17
+ */var cl;function J0(){return cl||(cl=1,process.env.NODE_ENV!=="production"&&function(){var e=v,t=Symbol.for("react.element"),n=Symbol.for("react.portal"),r=Symbol.for("react.fragment"),o=Symbol.for("react.strict_mode"),s=Symbol.for("react.profiler"),i=Symbol.for("react.provider"),c=Symbol.for("react.context"),a=Symbol.for("react.forward_ref"),l=Symbol.for("react.suspense"),u=Symbol.for("react.suspense_list"),f=Symbol.for("react.memo"),p=Symbol.for("react.lazy"),d=Symbol.for("react.offscreen"),h=Symbol.iterator,m="@@iterator";function x(D){if(D===null||typeof D!="object")return null;var q=h&&D[h]||D[m];return typeof q=="function"?q:null}var A=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function w(D){{for(var q=arguments.length,X=new Array(q>1?q-1:0),te=1;te<q;te++)X[te-1]=arguments[te];T("error",D,X)}}function T(D,q,X){{var te=A.ReactDebugCurrentFrame,de=te.getStackAddendum();de!==""&&(q+="%s",X=X.concat([de]));var he=X.map(function(ue){return String(ue)});he.unshift("Warning: "+q),Function.prototype.apply.call(console[D],console,he)}}var B=!1,L=!1,F=!1,_=!1,g=!1,y;y=Symbol.for("react.module.reference");function P(D){return!!(typeof D=="string"||typeof D=="function"||D===r||D===s||g||D===o||D===l||D===u||_||D===d||B||L||F||typeof D=="object"&&D!==null&&(D.$$typeof===p||D.$$typeof===f||D.$$typeof===i||D.$$typeof===c||D.$$typeof===a||D.$$typeof===y||D.getModuleId!==void 0))}function k(D,q,X){var te=D.displayName;if(te)return te;var de=q.displayName||q.name||"";return de!==""?X+"("+de+")":X}function C(D){return D.displayName||"Context"}function $(D){if(D==null)return null;if(typeof D.tag=="number"&&w("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),typeof D=="function")return D.displayName||D.name||null;if(typeof D=="string")return D;switch(D){case r:return"Fragment";case n:return"Portal";case s:return"Profiler";case o:return"StrictMode";case l:return"Suspense";case u:return"SuspenseList"}if(typeof D=="object")switch(D.$$typeof){case c:var q=D;return C(q)+".Consumer";case i:var X=D;return C(X._context)+".Provider";case a:return k(D,D.render,"ForwardRef");case f:var te=D.displayName||null;return te!==null?te:$(D.type)||"Memo";case p:{var de=D,he=de._payload,ue=de._init;try{return $(ue(he))}catch{return null}}}return null}var S=Object.assign,E=0,O,N,b,M,R,U,j;function W(){}W.__reactDisabledLog=!0;function K(){{if(E===0){O=console.log,N=console.info,b=console.warn,M=console.error,R=console.group,U=console.groupCollapsed,j=console.groupEnd;var D={configurable:!0,enumerable:!0,value:W,writable:!0};Object.defineProperties(console,{info:D,log:D,warn:D,error:D,group:D,groupCollapsed:D,groupEnd:D})}E++}}function V(){{if(E--,E===0){var D={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:S({},D,{value:O}),info:S({},D,{value:N}),warn:S({},D,{value:b}),error:S({},D,{value:M}),group:S({},D,{value:R}),groupCollapsed:S({},D,{value:U}),groupEnd:S({},D,{value:j})})}E<0&&w("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var Z=A.ReactCurrentDispatcher,H;function Y(D,q,X){{if(H===void 0)try{throw Error()}catch(de){var te=de.stack.trim().match(/\n( *(at )?)/);H=te&&te[1]||""}return`
18
+ `+H+D}}var Q=!1,oe;{var me=typeof WeakMap=="function"?WeakMap:Map;oe=new me}function pe(D,q){if(!D||Q)return"";{var X=oe.get(D);if(X!==void 0)return X}var te;Q=!0;var de=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var he;he=Z.current,Z.current=null,K();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(D,[],ue)}else{try{ue.call()}catch(qe){te=qe}D.call(ue.prototype)}}else{try{throw Error()}catch(qe){te=qe}D()}}catch(qe){if(qe&&te&&typeof qe.stack=="string"){for(var ae=qe.stack.split(`
19
19
  `),Fe=te.stack.split(`
20
20
  `),Se=ae.length-1,Pe=Fe.length-1;Se>=1&&Pe>=0&&ae[Se]!==Fe[Pe];)Pe--;for(;Se>=1&&Pe>=0;Se--,Pe--)if(ae[Se]!==Fe[Pe]){if(Se!==1||Pe!==1)do if(Se--,Pe--,Pe<0||ae[Se]!==Fe[Pe]){var dt=`
21
- `+ae[Se].replace(" at new "," at ");return D.displayName&&dt.includes("<anonymous>")&&(dt=dt.replace("<anonymous>",D.displayName)),typeof D=="function"&&se.set(D,dt),dt}while(Se>=1&&Pe>=0);break}}}finally{Q=!1,Z.current=he,V(),Error.prepareStackTrace=de}var Nr=D?D.displayName||D.name:"",Zn=Nr?Y(Nr):"";return typeof D=="function"&&se.set(D,Zn),Zn}function le(D,q,X){return pe(D,!1)}function ge(D){var q=D.prototype;return!!(q&&q.isReactComponent)}function oe(D,q,X){if(D==null)return"";if(typeof D=="function")return pe(D,ge(D));if(typeof D=="string")return Y(D);switch(D){case l:return Y("Suspense");case u:return Y("SuspenseList")}if(typeof D=="object")switch(D.$$typeof){case a:return le(D.render);case f:return oe(D.type,q,X);case p:{var te=D,de=te._payload,he=te._init;try{return oe(he(de),q,X)}catch{}}}return""}var Ge=Object.prototype.hasOwnProperty,Sn={},ft=A.ReactDebugCurrentFrame;function Qs(D){if(D){var q=D._owner,X=oe(D.type,D._source,q?q.type:null);ft.setExtraStackFrame(X)}else ft.setExtraStackFrame(null)}function yP(D,q,X,te,de){{var he=Function.call.bind(Ge);for(var ue in D)if(he(D,ue)){var ae=void 0;try{if(typeof D[ue]!="function"){var Fe=Error((te||"React class")+": "+X+" type `"+ue+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof D[ue]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw Fe.name="Invariant Violation",Fe}ae=D[ue](q,ue,te,X,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(Se){ae=Se}ae&&!(ae instanceof Error)&&(Qs(de),w("%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",X,ue,typeof ae),Qs(null)),ae instanceof Error&&!(ae.message in Sn)&&(Sn[ae.message]=!0,Qs(de),w("Failed %s type: %s",X,ae.message),Qs(null))}}}var wP=Array.isArray;function Jc(D){return wP(D)}function vP(D){{var q=typeof Symbol=="function"&&Symbol.toStringTag,X=q&&D[Symbol.toStringTag]||D.constructor.name||"Object";return X}}function xP(D){try{return R0(D),!1}catch{return!0}}function R0(D){return""+D}function j0(D){if(xP(D))return w("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",vP(D)),R0(D)}var _0=A.ReactCurrentOwner,EP={key:!0,ref:!0,__self:!0,__source:!0},U0,z0;function SP(D){if(Ge.call(D,"ref")){var q=Object.getOwnPropertyDescriptor(D,"ref").get;if(q&&q.isReactWarning)return!1}return D.ref!==void 0}function PP(D){if(Ge.call(D,"key")){var q=Object.getOwnPropertyDescriptor(D,"key").get;if(q&&q.isReactWarning)return!1}return D.key!==void 0}function $P(D,q){typeof D.ref=="string"&&_0.current}function TP(D,q){{var X=function(){U0||(U0=!0,w("%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))};X.isReactWarning=!0,Object.defineProperty(D,"key",{get:X,configurable:!0})}}function AP(D,q){{var X=function(){z0||(z0=!0,w("%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))};X.isReactWarning=!0,Object.defineProperty(D,"ref",{get:X,configurable:!0})}}var NP=function(D,q,X,te,de,he,ue){var ae={$$typeof:t,type:D,key:q,ref:X,props:ue,_owner:he};return ae._store={},Object.defineProperty(ae._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(ae,"_self",{configurable:!1,enumerable:!1,writable:!1,value:te}),Object.defineProperty(ae,"_source",{configurable:!1,enumerable:!1,writable:!1,value:de}),Object.freeze&&(Object.freeze(ae.props),Object.freeze(ae)),ae};function OP(D,q,X,te,de){{var he,ue={},ae=null,Fe=null;X!==void 0&&(j0(X),ae=""+X),PP(q)&&(j0(q.key),ae=""+q.key),SP(q)&&(Fe=q.ref,$P(q,de));for(he in q)Ge.call(q,he)&&!EP.hasOwnProperty(he)&&(ue[he]=q[he]);if(D&&D.defaultProps){var Se=D.defaultProps;for(he in Se)ue[he]===void 0&&(ue[he]=Se[he])}if(ae||Fe){var Pe=typeof D=="function"?D.displayName||D.name||"Unknown":D;ae&&TP(ue,Pe),Fe&&AP(ue,Pe)}return NP(D,ae,Fe,de,te,_0.current,ue)}}var el=A.ReactCurrentOwner,H0=A.ReactDebugCurrentFrame;function Ar(D){if(D){var q=D._owner,X=oe(D.type,D._source,q?q.type:null);H0.setExtraStackFrame(X)}else H0.setExtraStackFrame(null)}var tl;tl=!1;function nl(D){return typeof D=="object"&&D!==null&&D.$$typeof===t}function W0(){{if(el.current){var D=$(el.current.type);if(D)return`
21
+ `+ae[Se].replace(" at new "," at ");return D.displayName&&dt.includes("<anonymous>")&&(dt=dt.replace("<anonymous>",D.displayName)),typeof D=="function"&&oe.set(D,dt),dt}while(Se>=1&&Pe>=0);break}}}finally{Q=!1,Z.current=he,V(),Error.prepareStackTrace=de}var Nr=D?D.displayName||D.name:"",Zn=Nr?Y(Nr):"";return typeof D=="function"&&oe.set(D,Zn),Zn}function le(D,q,X){return pe(D,!1)}function ge(D){var q=D.prototype;return!!(q&&q.isReactComponent)}function se(D,q,X){if(D==null)return"";if(typeof D=="function")return pe(D,ge(D));if(typeof D=="string")return Y(D);switch(D){case l:return Y("Suspense");case u:return Y("SuspenseList")}if(typeof D=="object")switch(D.$$typeof){case a:return le(D.render);case f:return se(D.type,q,X);case p:{var te=D,de=te._payload,he=te._init;try{return se(he(de),q,X)}catch{}}}return""}var Ge=Object.prototype.hasOwnProperty,Sn={},ft=A.ReactDebugCurrentFrame;function Js(D){if(D){var q=D._owner,X=se(D.type,D._source,q?q.type:null);ft.setExtraStackFrame(X)}else ft.setExtraStackFrame(null)}function yP(D,q,X,te,de){{var he=Function.call.bind(Ge);for(var ue in D)if(he(D,ue)){var ae=void 0;try{if(typeof D[ue]!="function"){var Fe=Error((te||"React class")+": "+X+" type `"+ue+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof D[ue]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw Fe.name="Invariant Violation",Fe}ae=D[ue](q,ue,te,X,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(Se){ae=Se}ae&&!(ae instanceof Error)&&(Js(de),w("%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",X,ue,typeof ae),Js(null)),ae instanceof Error&&!(ae.message in Sn)&&(Sn[ae.message]=!0,Js(de),w("Failed %s type: %s",X,ae.message),Js(null))}}}var wP=Array.isArray;function Jc(D){return wP(D)}function vP(D){{var q=typeof Symbol=="function"&&Symbol.toStringTag,X=q&&D[Symbol.toStringTag]||D.constructor.name||"Object";return X}}function xP(D){try{return R0(D),!1}catch{return!0}}function R0(D){return""+D}function j0(D){if(xP(D))return w("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",vP(D)),R0(D)}var _0=A.ReactCurrentOwner,EP={key:!0,ref:!0,__self:!0,__source:!0},U0,z0;function SP(D){if(Ge.call(D,"ref")){var q=Object.getOwnPropertyDescriptor(D,"ref").get;if(q&&q.isReactWarning)return!1}return D.ref!==void 0}function PP(D){if(Ge.call(D,"key")){var q=Object.getOwnPropertyDescriptor(D,"key").get;if(q&&q.isReactWarning)return!1}return D.key!==void 0}function $P(D,q){typeof D.ref=="string"&&_0.current}function TP(D,q){{var X=function(){U0||(U0=!0,w("%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))};X.isReactWarning=!0,Object.defineProperty(D,"key",{get:X,configurable:!0})}}function AP(D,q){{var X=function(){z0||(z0=!0,w("%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))};X.isReactWarning=!0,Object.defineProperty(D,"ref",{get:X,configurable:!0})}}var NP=function(D,q,X,te,de,he,ue){var ae={$$typeof:t,type:D,key:q,ref:X,props:ue,_owner:he};return ae._store={},Object.defineProperty(ae._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(ae,"_self",{configurable:!1,enumerable:!1,writable:!1,value:te}),Object.defineProperty(ae,"_source",{configurable:!1,enumerable:!1,writable:!1,value:de}),Object.freeze&&(Object.freeze(ae.props),Object.freeze(ae)),ae};function OP(D,q,X,te,de){{var he,ue={},ae=null,Fe=null;X!==void 0&&(j0(X),ae=""+X),PP(q)&&(j0(q.key),ae=""+q.key),SP(q)&&(Fe=q.ref,$P(q,de));for(he in q)Ge.call(q,he)&&!EP.hasOwnProperty(he)&&(ue[he]=q[he]);if(D&&D.defaultProps){var Se=D.defaultProps;for(he in Se)ue[he]===void 0&&(ue[he]=Se[he])}if(ae||Fe){var Pe=typeof D=="function"?D.displayName||D.name||"Unknown":D;ae&&TP(ue,Pe),Fe&&AP(ue,Pe)}return NP(D,ae,Fe,de,te,_0.current,ue)}}var el=A.ReactCurrentOwner,H0=A.ReactDebugCurrentFrame;function Ar(D){if(D){var q=D._owner,X=se(D.type,D._source,q?q.type:null);H0.setExtraStackFrame(X)}else H0.setExtraStackFrame(null)}var tl;tl=!1;function nl(D){return typeof D=="object"&&D!==null&&D.$$typeof===t}function W0(){{if(el.current){var D=$(el.current.type);if(D)return`
22
22
 
23
23
  Check the render method of \``+D+"`."}return""}}function CP(D){return""}var V0={};function IP(D){{var q=W0();if(!q){var X=typeof D=="string"?D:D.displayName||D.name;X&&(q=`
24
24
 
@@ -27,18 +27,18 @@ Check the top-level render call using <`+X+">.")}return q}}function G0(D,q){{if(
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} />`,rl,Zn,RP,Zn),Z0[Zn+rl]=!0}}return D===r?kP(Pe):MP(Pe),Pe}}function BP(D,q,X){return K0(D,q,X,!0)}function LP(D,q,X){return K0(D,q,X,!1)}var DP=LP,FP=BP;Ir.Fragment=r,Ir.jsx=DP,Ir.jsxs=FP}()),Ir}process.env.NODE_ENV==="production"?Js.exports=Q0():Js.exports=J0();var I=Js.exports;const em={deposit:{title:"充值",chain:"链",asset:"资产",amount:"数量",available:"可用",equity:"总资产",confirmDeposit:"充值确认",switchNetwork:"切换网络",max:"最大",arrivalTime:"到账时间",ethCrossChainDepositInitiated:"ETH 跨链充值已发起,预计 2–5 分钟到账。",minDeposit:"最小充值金额",minDepositParsed:"最少充值 {{amount}} {{token}}",maxDeposit:"最大充值金额",depositTipFor25w:"单笔充值金额上限为 200,000。若充值金额大于200,000,请使用Ethereum链充值。",depositAllTip:`仅支持发送 {{coin}} ({{v}}) 资产到此地址。
31
- 充值金额大于 200,000 时,到账时间存在一定延迟,请耐心等待。`,spotDepositNotSupportedTip:"不支持充值,请先充入合约账户再划转。",crossChainDepositFeeTip:`仅支持发送 {{coin}} ({{v}}) 资产到此地址。
30
+ <%s key={someKey} {...props} />`,rl,Zn,RP,Zn),Z0[Zn+rl]=!0}}return D===r?kP(Pe):MP(Pe),Pe}}function BP(D,q,X){return K0(D,q,X,!0)}function LP(D,q,X){return K0(D,q,X,!1)}var DP=LP,FP=BP;Ir.Fragment=r,Ir.jsx=DP,Ir.jsxs=FP}()),Ir}process.env.NODE_ENV==="production"?ei.exports=Q0():ei.exports=J0();var I=ei.exports;const em={deposit:{title:"充值",chain:"链",asset:"资产",amount:"数量",available:"可用",equity:"总资产",confirmDeposit:"充值确认",switchNetwork:"切换网络",max:"最大",arrivalTime:"到账时间",ethCrossChainDepositInitiated:"ETH 跨链充值已发起,预计 2–5 分钟到账。",minDeposit:"最小充值金额",minDepositParsed:"最少充值 {{amount}} {{token}}",maxDeposit:"最大充值金额",depositTipFor25w:"单笔充值金额上限为 200,000。若充值金额大于200,000,请使用Ethereum链充值。",depositAllTip:`仅支持发送 {{coin}} ({{v}}) 资产到此地址。
31
+ 充值金额大于 200,000 时,到账时间存在一定延迟,请耐心等待。`,maxDepositSplitTip:"单笔充值金额上限为200,000。若需要充值金额大于200,000,请分多笔进行操作。",spotDepositNotSupportedTip:"不支持充值,请先充入合约账户再划转。",crossChainDepositFeeTip:`仅支持发送 {{coin}} ({{v}}) 资产到此地址。
32
32
  跨链充值需由您承担 Edge 网络手续费。到账金额会略小于您的充值金额。`,addressUpdatedNotice:"注意:充值地址已更新,请改用新地址。原地址仅在过渡期可用,随后停用。若旧地址已存于其他平台,请尽快更新。",enableSystemProWithToken:"在{{network}}上启用{{token}}",enableTokenDesc:"您首次在{{network}}上存款时必须启用{{token}}。",enableWithToken:"启用 {{token}}",arrivaltimeTooltip1:"资金约在 {{v}} 分钟 内 (达到 {{v1}} 个区块确认后) 到账。",arrivaltimeTooltip2:"预计时间是根据历史数据计算所得,仅供参考。网络拥堵可能会导致实际到账时间变长。",arrivalEstimated:"≈ {{v}}分钟",availableDesc:"您可以充值的最大金额。当可用为0或负数时,无法进行充值。",noPrivateKeyWalletWarning:"请勿使用无私钥钱包进行充值,无私钥钱包充值会导致资金损失且无法追回。",layerZeroDepositTip:"系统会根据充值资金实际情况,将您的充值通过LayerZero完成。",layerZeroDepositTipExceedPool:"由于充值资金大于资金池,将通过LayerZero完成您的充值。",layerZeroDepositTipGte200k:"由于充值资金大于等于200,000 USDT,将通过LayerZero完成您的充值。",layerZeroDepositButton:"使用LayerZero充值"},withdraw:{noticeDesc:"普通提现是一个两步过程。 此步骤将发起您的提现请求,并将在 Layer2 进行处理。 一旦资金准备就绪(可能需要最多 4 小时),您将收到一条将资金提现到钱包的通知。受链同步等情况影响下,时长可能到 48 小时。您需要自行承担交易 gas 费用。",crossChainTips:"跨链提币需在 L2(通过零知识证明)进行验证。提币过程最多约需2小时。相关链的资产池中需有充足的资金来处理跨链提币,其间还将产生矿工费。 edgeX 将收取一定的手续费作为矿工费。",commonWithdraw:"提现说明",withdraw:"提现",speed:"速度",confirmWithdraw:"提现确认",speedNote:"处理时间:",speedNoteSpeed1:"用时约8分钟",speedNoteSpeed2:"用时约 2-4 小时",speedNoteSpeed3:"用时约4小时",receiverAddress:"接收地址",fee:"手续费",feeRate:"费率",withdrawlAmount:"提现金额",amountToReceive:"到账金额",minWithdraw:"最小提现金额",minWithdrawParsed:"最小提现 {{amount}} {{token}}",invalidReceiverAddress:"接收地址不能为空",availableDesc:"您可以提现的最大金额。当可用为0或负数时,无法进行提现。",feeCalculationTip:"提现手续费按照提现金额乘以费率计算,最低为1 USDT/USDC。费率会根据链上实际情况进行调整。",crossChainPoolBalance:"跨链资金池余额",poolBalance:"资金池余额",poolBalanceInsufficientTip:"提现金额大于资金池余额,无法进行提现。请选择资金池余额充足的选项。"},account:{title:"账户",perpetual:"合约账户",spot:"现货账户"}},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",ethCrossChainDepositInitiated:"ETH cross-chain deposit initiated. Estimated arrival in 2–5 minutes.",minDeposit:"Minimum Deposit Amount",minDepositParsed:"Min. Deposit {{amount}} {{token}}",maxDeposit:"Maximum Deposit Amount",depositTipFor25w:"The maximum amount per deposit is 200,000. If your deposit exceeds 200,000, please use the Ethereum chain.",depositAllTip:`Only {{coin}} ({{v}}) is supported for deposits to this address.
33
- If the deposit amount exceeds 200,000, there may be a delay in the arrival time. Please be patient.`,spotDepositNotSupportedTip:"Deposits aren't supported. Please deposit to perpetual account, then transfer.",crossChainDepositFeeTip:`Only {{coin}} ({{v}}) is supported for deposits to this address.
33
+ If the deposit amount exceeds 200,000, there may be a delay in the arrival time. Please be patient.`,maxDepositSplitTip:"The maximum amount per deposit is 200,000. If you need to deposit more than 200,000, please split it into multiple deposits.",spotDepositNotSupportedTip:"Deposits aren't supported. Please deposit to perpetual account, then transfer.",crossChainDepositFeeTip:`Only {{coin}} ({{v}}) is supported for deposits to this address.
34
34
  Cross-chain deposits require you to pay the Edge gas fee. The credited amount will be slightly less than your deposit amount.`,addressUpdatedNotice:"Notice: Your deposit address has been updated. Use the new address. The old one works only during the transition and will be disabled. If saved elsewhere, update it promptly.",enableSystemProWithToken:"Enable {{token}} on {{network}}",enableTokenDesc:"You must enable {{token}} the first time you deposit on {{network}}.",enableWithToken:"Enable {{token}}",arrivaltimeTooltip1:"The funds will arrive in approximately {{v}} minutes (after reaching {{v1}} block confirmations).",arrivaltimeTooltip2:"Estimated time is calculated based on historical data and is for reference only. Network congestion may result in longer actual arrival times.",arrivalEstimated:"≈ {{v}} minutes",availableDesc:"The maximum amount you can deposit. When the available balance is 0 or negative, deposits cannot be made.",noPrivateKeyWalletWarning:"Do not use keyless wallets to make deposits. Depositing with a keyless wallet may result in irreversible loss of funds.",layerZeroDepositTip:"The system will complete your deposit via LayerZero based on the actual deposit conditions.",layerZeroDepositTipExceedPool:"Since the deposit amount exceeds the pool, your deposit will be completed via LayerZero.",layerZeroDepositTipGte200k:"Since the deposit amount is greater than or equal to 200,000 USDT, your deposit will be completed via LayerZero.",layerZeroDepositButton:"Deposit with LayerZero"},withdraw:{noticeDesc:"Normal withdrawals are a two-step process. The current step initiates your withdrawal request and will be processed on Layer 2. Once your funds are ready (can take up to 4 hours), you will receive a notification to withdraw funds to your wallet. Due to chain synchronization and other factors, the duration may take up to 48 hours. You are responsible for any transaction gas fees.",crossChainTips:"Cross-chain withdrawals require verification at L2 (via ZK proofs) and the withdrawal process may take up to 2 hours. Sufficient funds in the corresponding chain's asset pool are required to process cross-chain withdrawals. Gas fees will also be incurred. edgeX will charge a fee to cover this.",commonWithdraw:"Withdrawal FAQ",withdraw:"Withdraw",speed:"Speed",confirmWithdraw:"Confirm Withdrawal",speedNote:"Processing Times:",speedNoteSpeed1:"Approx. 8 Minutes",speedNoteSpeed2:"Approx. 2-4 Hours",speedNoteSpeed3:"Approx. 4 Hours",receiverAddress:"Receiver Address",fee:"Fee",feeRate:"Fee Rate",withdrawlAmount:"Withdrawal amount",amountToReceive:"Amount to Receive",minWithdraw:"Minimum Withdrawal Amount",minWithdrawParsed:"Min. Withdrawal {{amount}} {{token}}",invalidReceiverAddress:"Address cannot be empty",availableDesc:"The maximum amount you can withdraw. When the available balance is 0 or negative, withdrawals cannot be made.",feeCalculationTip:"Withdrawal fees are calculated by multiplying the withdrawal amount by the fee rate, with a minimum of 1 USDT/USDC. The fee rate may be adjusted based on actual on-chain conditions.",crossChainPoolBalance:"Cross-chain pool balance",poolBalance:"Pool balance",poolBalanceInsufficientTip:"The withdrawal amount exceeds the fund pool balance, and the withdrawal cannot be processed. Please select an option with a sufficient fund pool balance."},account:{title:"Account",perpetual:"Perpetual Account",spot:"Spot Account"}},nm={deposit:{title:"入金",chain:"チェーン",asset:"資産",amount:"数量",available:"利用可能",equity:"総資産",confirmDeposit:"入金確認",switchNetwork:"ネットワークを切り替え",max:"最大",arrivalTime:"着金予定時間",ethCrossChainDepositInitiated:"ETH のクロスチェーン入金を開始しました。到着まで約2〜5分です。",minDeposit:"最低入金額",minDepositParsed:"最低入金額 {{amount}} {{token}}",maxDeposit:"最大入金額",depositTipFor25w:"1回の入金上限額は200,000です。200,000を超える場合は、Ethereumチェーンでの入金をご利用ください。",depositAllTip:`このアドレスは{{coin}}({{v}})専用です。他通貨は送金しないでください。
35
- 入金金額が 200,000 を超える場合、反映までに時間がかかることがあります。しばらくお待ちください。`,spotDepositNotSupportedTip:"入金非対応。先に契約アカウント入金後、振替。",crossChainDepositFeeTip:`このアドレスは{{coin}}({{v}})専用です。他通貨は送金しないでください。
35
+ 入金金額が 200,000 を超える場合、反映までに時間がかかることがあります。しばらくお待ちください。`,maxDepositSplitTip:"1回の入金上限は200,000です。200,000を超える金額を入金する場合は、複数回に分けて行ってください。",spotDepositNotSupportedTip:"入金非対応。先に契約アカウント入金後、振替。",crossChainDepositFeeTip:`このアドレスは{{coin}}({{v}})専用です。他通貨は送金しないでください。
36
36
  クロスチェーン入金では Edge ネットワーク手数料はお客様負担となります。入金額はご入金額よりわずかに少なくなります。`,addressUpdatedNotice:"注意:入金アドレスが更新されました。新しいアドレスをご利用ください。旧アドレスは移行期間のみ有効で、その後無効になります。他のサービスに保存している場合は早急に更新してください。",enableSystemProWithToken:"{{network}} 上で {{token}} を有効化",enableTokenDesc:"初めて {{network}} に入金する際は、{{token}} の有効化が必要です。",enableWithToken:"{{token}} を有効化",arrivaltimeTooltip1:"資金は約 {{v}} 分以内({{v1}} 回のブロック確認が完了後)に到账します。",arrivaltimeTooltip2:"着金時間は過去データに基づいた目安であり、ネットワーク状況により遅延する場合があります。",arrivalEstimated:"≈ {{v}}分",availableDesc:"入金可能な最大金額。利用可能残高が0または負の数の場合、入金はできません。",noPrivateKeyWalletWarning:"秘密鍵のないウォレットでの入金は行わないでください。そのような入金は資金を失い、取り戻すことができません。",layerZeroDepositTip:"システムは入金資金の実際の状況に基づき、LayerZeroを通じて入金を完了します。",layerZeroDepositTipExceedPool:"入金額がプールを超えているため、LayerZero を通じて入金が完了します。",layerZeroDepositTipGte200k:"入金額が 200,000 USDT 以上のため、LayerZero を通じて入金が完了します。",layerZeroDepositButton:"LayerZeroで入金"},withdraw:{noticeDesc:"通常出金は2ステップで行われます。このステップで出金リクエストを送信し、Layer2で処理されます。資金の準備が完了すると(最大4時間かかる場合があります)、出金の通知が届きます。チェーンの同期などの影響により、所要時間は最長で48時間かかる場合があります。ガス代はユーザー負担です。",crossChainTips:"クロスチェーン出金はL2上(ゼロ知識証明経由)で検証が必要です。出金処理には最大2時間ほどかかる場合があります。対応するチェーンの資産プールに十分な流動性が必要であり、ガス代も発生します。edgeXはそのコストを補うため、一定の手数料を徴収します。",commonWithdraw:"出金ガイド",withdraw:"出金",speed:"出金時間",confirmWithdraw:"出金確認",speedNote:"処理時間:",speedNoteSpeed1:"約8分",speedNoteSpeed2:"約2~4時間",speedNoteSpeed3:"約4時間",receiverAddress:"受取アドレス",fee:"手数料",feeRate:"手数料率",withdrawlAmount:"出金額",amountToReceive:"受け取り金額",minWithdraw:"最低出金額",minWithdrawParsed:"最低出金 {{amount}} {{token}}",invalidReceiverAddress:"ウォレットアドレスは必須です",availableDesc:"引き出し可能な最大金額。利用可能残高が0または負の数の場合、引き出しはできません。",feeCalculationTip:"出金手数料は、出金金額に料率を乗じて計算され、最低1 USDT/USDCとなります。料率は、ブロックチェーンの実際の状況に基づいて調整される場合があります。",crossChainPoolBalance:"クロスチェーンプール残高",poolBalance:"プール残高",poolBalanceInsufficientTip:"出金額が資金プールの残高を上回っているため、出金は処理できません。資金プールの残高が十分にあるオプションを選択してください。"},account:{title:"アカウント",perpetual:"パーペチュアルアカウント",spot:"スポットアカウント"}},rm={deposit:{title:"Депозит",chain:"Сеть",asset:"Актив",amount:"Сумма",available:"Доступно",equity:"Капитал",confirmDeposit:"Подтвердить депозит",switchNetwork:"Сменить сеть",max:"Максимум",arrivalTime:"Время поступления",ethCrossChainDepositInitiated:"Кроссчейн‑депозит ETH запущен. Ожидаемое зачисление: 2–5 минут.",minDeposit:"Минимальная сумма депозита",minDepositParsed:"Мин. депозит {{amount}} {{token}}",maxDeposit:"Максимальная сумма депозита",depositTipFor25w:"Максимальная сумма одного пополнения — 200 000. Если сумма превышает 200 000, пожалуйста, используйте сеть Ethereum для пополнения.",depositAllTip:`На этот адрес можно внести только {{coin}} ({{v}}).
37
- Если сумма депозита превышает 200 000, время поступления может быть увеличено. Пожалуйста, ожидайте.`,spotDepositNotSupportedTip:"Пополнение недоступно. Сначала контрактный счёт, затем перевод.",crossChainDepositFeeTip:`На этот адрес можно внести только {{coin}} ({{v}}).
37
+ Если сумма депозита превышает 200 000, время поступления может быть увеличено. Пожалуйста, ожидайте.`,maxDepositSplitTip:"Максимальная сумма одного пополнения — 200 000. Если вам нужно пополнить на сумму более 200 000, выполните несколько пополнений.",spotDepositNotSupportedTip:"Пополнение недоступно. Сначала контрактный счёт, затем перевод.",crossChainDepositFeeTip:`На этот адрес можно внести только {{coin}} ({{v}}).
38
38
  За кроссчейн‑депозит вы оплачиваете комиссию сети Edge. Зачисленная сумма будет немного меньше суммы вашего депозита.`,addressUpdatedNotice:"Внимание: ваш адрес пополнения обновлён. Используйте новый адрес. Старый действует только в переходный период и будет отключён. Если он сохранён где‑то ещё, срочно обновите.",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:"Комиссия",feeRate:"Тариф",withdrawlAmount:"Сумма вывода",amountToReceive:"Сумма к получению",minWithdraw:"Минимальная сумма вывода",minWithdrawParsed:"Мин. вывод {{amount}} {{token}}",invalidReceiverAddress:"Укажите адрес кошелька",availableDesc:"Максимальная сумма, которую вы можете вывести. Если доступный баланс равен 0 или отрицательный, вывод средств невозможен.",feeCalculationTip:"Комиссия за вывод средств рассчитывается путем умножения суммы вывода на ставку комиссии, минимальная комиссия составляет 1 USDT/USDC. Ставка комиссии может быть скорректирована в зависимости от фактической ситуации в сети блокчейн.",crossChainPoolBalance:"Баланс кросс-чейн пула",poolBalance:"Баланс пула",poolBalanceInsufficientTip:"Сумма вывода превышает баланс пула средств, и операция не может быть выполнена. Пожалуйста, выберите опцию с достаточным балансом пула средств."},account:{title:"Аккаунт",perpetual:"Перпетуальный счет",spot:"Спотовый счет"}},om={deposit:{title:"充值",chain:"鏈",asset:"資產",amount:"數量",available:"可用",equity:"總資產",confirmDeposit:"充值確認",switchNetwork:"切換網絡",max:"最大",arrivalTime:"到帳時間",ethCrossChainDepositInitiated:"ETH 跨鏈充值已發起 ,預計 2–5 分鐘到賬。",minDeposit:"最小儲值金額",minDepositParsed:"最少充值 {{amount}} {{token}}",maxDeposit:"最大儲值金額",depositTipFor25w:"單筆充值金額上限為 200,000。若充值金額大於 200,000,請使用 Ethereum 鏈充值。",depositAllTip:`僅支援發送 {{coin}} ({{v}}) 資產到此位址。
39
- 充值金額大於 200,000 時,到账時間可能會有延遲,請耐心等待。`,spotDepositNotSupportedTip:"不支援充值,請先充入合約帳戶再劃轉。",crossChainDepositFeeTip:`僅支援發送 {{coin}} ({{v}}) 資產到此位址。
40
- 跨鏈充值需由您承擔 Edge 網路手續費。到帳金額會略小於您的充值金額。`,addressUpdatedNotice:"注意:充值地址已更新,請改用新地址。原地址僅在過渡期內有效,之後將停用。若已在其他平台儲存,請儘速更新。",enableSystemProWithToken:"在{{network}}上啓用{{token}}",enableTokenDesc:"您首次在{{network}}上存款時必須啓用{{token}}。",enableWithToken:"啓用 {{token}}",arrivaltimeTooltip1:"資金約在 {{v}} 分鐘內(達到 {{v1}} 個區塊確認後)到賬。",arrivaltimeTooltip2:"預計時間是根據歷史資料計算所得,僅供參考。網路壅塞可能會導致實際到帳時間變長。",arrivalEstimated:"≈ {{v}}分鐘",availableDesc:"您可以充值的最大金額。當可用餘額為0或負數時,無法進行充值。",noPrivateKeyWalletWarning:"請勿使用無私鑰錢包進行充值,無私鑰錢包充值會導致資金損失且無法追回。",layerZeroDepositTip:"系統會根據充值資金的實際情況,通過 LayerZero 完成您的充值。",layerZeroDepositTipExceedPool:"由於充值資金大於資金池,將透過 LayerZero 完成您的充值。",layerZeroDepositTipGte200k:"由於充值資金大於等於 200,000 USDT,將透過 LayerZero 完成您的充值。",layerZeroDepositButton:"使用LayerZero充值"},withdraw:{noticeDesc:"普通提現是一個兩步過程。此步驟將發起您的提現請求,並將在 Layer2 進行處理。一旦資金準備就緒(可能需要最多 4 小時),您將收到一條將資金提現到錢包的通知。受鏈同步等情況影響下,時長可能需要長達 48 小時。您需要自行承擔交易 gas 費用。",crossChainTips:"跨鏈提幣需在 L2(通過零知識證明)進行驗證。提幣過程最多約需2小時。相關鏈的資產池中需有充足的資金來處理跨鏈提幣,其間還將產生礦工費。 edgeX 將收取一定的手續費作爲礦工費。",commonWithdraw:"提現說明",withdraw:"提現",speed:"速度",confirmWithdraw:"提現確認",speedNote:"處理時間:",speedNoteSpeed1:"用時約8分鐘",speedNoteSpeed2:"用時約 2-4 小時",speedNoteSpeed3:"用時約4小時",receiverAddress:"接收地址",fee:"手續費",feeRate:"費率",withdrawlAmount:"提現金額",amountToReceive:"到账金額",minWithdraw:"最小提現金額",minWithdrawParsed:"最小提現 {{amount}} {{token}}",invalidReceiverAddress:"接收地址不能為空",availableDesc:"您可以提現的最大金額。當可用餘額為0或負數時,無法進行提現。",feeCalculationTip:"提現手續費按照提現金額乘以費率計算,最低為 1 USDT/USDC。費率會根據鏈上實際情況進行調整。",crossChainPoolBalance:"跨鏈資金池餘額",poolBalance:"資金池餘額",poolBalanceInsufficientTip:"提現金額大於資金池餘額,無法進行提現。請選擇資金池餘額充足的選項。"},account:{title:"帳戶",perpetual:"合約帳戶",spot:"現貨帳戶"}},ei=["en-US","ja-JP","ru-RU","zh-CN","zh-TW"],ll={"en-US":tm,"ja-JP":nm,"ru-RU":rm,"zh-CN":em,"zh-TW":om},Lo="en-US",sm={"en-US":"English","zh-CN":"简体中文","zh-TW":"繁體中文","ja-JP":"日本語","ru-RU":"Русский"},im=e=>ei.includes(e)?ll[e]:ll[Lo],am=e=>ei.includes(e),ul=v.createContext(null),cm=({config:e,children:t})=>{const n=v.useMemo(()=>{const r=e.locale||Lo,o=am(r)?r:Lo,s=im(o);return{...e,currentLocale:o,translations:s}},[e]);return I.jsx(ul.Provider,{value:n,children:t})},fl=()=>{const e=v.useContext(ul);if(!e)throw new Error("useComponentConfig must be used within ComponentProvider");return e};var lm=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,ti=Math.ceil,Qe=Math.floor,Re="[BigNumber Error] ",dl=Re+"Number primitive has more than 15 significant digits: ",pt=1e14,ne=14,ni=9007199254740991,ri=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],un=1e7,Ae=1e9;function pl(e){var t,n,r,o=w.prototype={constructor:w,toString:null,valueOf:null},s=new w(1),i=20,c=4,a=-7,l=21,u=-1e7,f=1e7,p=!1,d=1,h=0,m={prefix:"",groupSize:3,secondaryGroupSize:0,groupSeparator:",",decimalSeparator:".",fractionGroupSize:0,fractionGroupSeparator:" ",suffix:""},x="0123456789abcdefghijklmnopqrstuvwxyz",A=!0;function w(g,y){var P,k,C,$,S,E,O,N,b=this;if(!(b instanceof w))return new w(g,y);if(y==null){if(g&&g._isBigNumber===!0){b.s=g.s,!g.c||g.e>f?b.c=b.e=null:g.e<u?b.c=[b.e=0]:(b.e=g.e,b.c=g.c.slice());return}if((E=typeof g=="number")&&g*0==0){if(b.s=1/g<0?(g=-g,-1):1,g===~~g){for($=0,S=g;S>=10;S/=10,$++);$>f?b.c=b.e=null:(b.e=$,b.c=[g]);return}N=String(g)}else{if(!lm.test(N=String(g)))return r(b,N,E);b.s=N.charCodeAt(0)==45?(N=N.slice(1),-1):1}($=N.indexOf("."))>-1&&(N=N.replace(".","")),(S=N.search(/e/i))>0?($<0&&($=S),$+=+N.slice(S+1),N=N.substring(0,S)):$<0&&($=N.length)}else{if(we(y,2,x.length,"Base"),y==10&&A)return b=new w(g),F(b,i+b.e+1,c);if(N=String(g),E=typeof g=="number"){if(g*0!=0)return r(b,N,E,y);if(b.s=1/g<0?(N=N.slice(1),-1):1,w.DEBUG&&N.replace(/^0\.0*|\./,"").length>15)throw Error(dl+g)}else b.s=N.charCodeAt(0)===45?(N=N.slice(1),-1):1;for(P=x.slice(0,y),$=S=0,O=N.length;S<O;S++)if(P.indexOf(k=N.charAt(S))<0){if(k=="."){if(S>$){$=O;continue}}else if(!C&&(N==N.toUpperCase()&&(N=N.toLowerCase())||N==N.toLowerCase()&&(N=N.toUpperCase()))){C=!0,S=-1,$=0;continue}return r(b,String(g),E,y)}E=!1,N=n(N,y,10,b.s),($=N.indexOf("."))>-1?N=N.replace(".",""):$=N.length}for(S=0;N.charCodeAt(S)===48;S++);for(O=N.length;N.charCodeAt(--O)===48;);if(N=N.slice(S,++O)){if(O-=S,E&&w.DEBUG&&O>15&&(g>ni||g!==Qe(g)))throw Error(dl+b.s*g);if(($=$-S-1)>f)b.c=b.e=null;else if($<u)b.c=[b.e=0];else{if(b.e=$,b.c=[],S=($+1)%ne,$<0&&(S+=ne),S<O){for(S&&b.c.push(+N.slice(0,S)),O-=ne;S<O;)b.c.push(+N.slice(S,S+=ne));S=ne-(N=N.slice(S)).length}else S-=O;for(;S--;N+="0");b.c.push(+N)}}else b.c=[b.e=0]}w.clone=pl,w.ROUND_UP=0,w.ROUND_DOWN=1,w.ROUND_CEIL=2,w.ROUND_FLOOR=3,w.ROUND_HALF_UP=4,w.ROUND_HALF_DOWN=5,w.ROUND_HALF_EVEN=6,w.ROUND_HALF_CEIL=7,w.ROUND_HALF_FLOOR=8,w.EUCLID=9,w.config=w.set=function(g){var y,P;if(g!=null)if(typeof g=="object"){if(g.hasOwnProperty(y="DECIMAL_PLACES")&&(P=g[y],we(P,0,Ae,y),i=P),g.hasOwnProperty(y="ROUNDING_MODE")&&(P=g[y],we(P,0,8,y),c=P),g.hasOwnProperty(y="EXPONENTIAL_AT")&&(P=g[y],P&&P.pop?(we(P[0],-Ae,0,y),we(P[1],0,Ae,y),a=P[0],l=P[1]):(we(P,-Ae,Ae,y),a=-(l=P<0?-P:P))),g.hasOwnProperty(y="RANGE"))if(P=g[y],P&&P.pop)we(P[0],-Ae,-1,y),we(P[1],1,Ae,y),u=P[0],f=P[1];else if(we(P,-Ae,Ae,y),P)u=-(f=P<0?-P:P);else throw Error(Re+y+" cannot be zero: "+P);if(g.hasOwnProperty(y="CRYPTO"))if(P=g[y],P===!!P)if(P)if(typeof crypto<"u"&&crypto&&(crypto.getRandomValues||crypto.randomBytes))p=P;else throw p=!P,Error(Re+"crypto unavailable");else p=P;else throw Error(Re+y+" not true or false: "+P);if(g.hasOwnProperty(y="MODULO_MODE")&&(P=g[y],we(P,0,9,y),d=P),g.hasOwnProperty(y="POW_PRECISION")&&(P=g[y],we(P,0,Ae,y),h=P),g.hasOwnProperty(y="FORMAT"))if(P=g[y],typeof P=="object")m=P;else throw Error(Re+y+" not an object: "+P);if(g.hasOwnProperty(y="ALPHABET"))if(P=g[y],typeof P=="string"&&!/^.?$|[+\-.\s]|(.).*\1/.test(P))A=P.slice(0,10)=="0123456789",x=P;else throw Error(Re+y+" invalid: "+P)}else throw Error(Re+"Object expected: "+g);return{DECIMAL_PLACES:i,ROUNDING_MODE:c,EXPONENTIAL_AT:[a,l],RANGE:[u,f],CRYPTO:p,MODULO_MODE:d,POW_PRECISION:h,FORMAT:m,ALPHABET:x}},w.isBigNumber=function(g){if(!g||g._isBigNumber!==!0)return!1;if(!w.DEBUG)return!0;var y,P,k=g.c,C=g.e,$=g.s;e:if({}.toString.call(k)=="[object Array]"){if(($===1||$===-1)&&C>=-Ae&&C<=Ae&&C===Qe(C)){if(k[0]===0){if(C===0&&k.length===1)return!0;break e}if(y=(C+1)%ne,y<1&&(y+=ne),String(k[0]).length==y){for(y=0;y<k.length;y++)if(P=k[y],P<0||P>=pt||P!==Qe(P))break e;if(P!==0)return!0}}}else if(k===null&&C===null&&($===null||$===1||$===-1))return!0;throw Error(Re+"Invalid BigNumber: "+g)},w.maximum=w.max=function(){return B(arguments,-1)},w.minimum=w.min=function(){return B(arguments,1)},w.random=function(){var g=9007199254740992,y=Math.random()*g&2097151?function(){return Qe(Math.random()*g)}:function(){return(Math.random()*1073741824|0)*8388608+(Math.random()*8388608|0)};return function(P){var k,C,$,S,E,O=0,N=[],b=new w(s);if(P==null?P=i:we(P,0,Ae),S=ti(P/ne),p)if(crypto.getRandomValues){for(k=crypto.getRandomValues(new Uint32Array(S*=2));O<S;)E=k[O]*131072+(k[O+1]>>>11),E>=9e15?(C=crypto.getRandomValues(new Uint32Array(2)),k[O]=C[0],k[O+1]=C[1]):(N.push(E%1e14),O+=2);O=S/2}else if(crypto.randomBytes){for(k=crypto.randomBytes(S*=7);O<S;)E=(k[O]&31)*281474976710656+k[O+1]*1099511627776+k[O+2]*4294967296+k[O+3]*16777216+(k[O+4]<<16)+(k[O+5]<<8)+k[O+6],E>=9e15?crypto.randomBytes(7).copy(k,O):(N.push(E%1e14),O+=7);O=S/7}else throw p=!1,Error(Re+"crypto unavailable");if(!p)for(;O<S;)E=y(),E<9e15&&(N[O++]=E%1e14);for(S=N[--O],P%=ne,S&&P&&(E=ri[ne-P],N[O]=Qe(S/E)*E);N[O]===0;N.pop(),O--);if(O<0)N=[$=0];else{for($=-1;N[0]===0;N.splice(0,1),$-=ne);for(O=1,E=N[0];E>=10;E/=10,O++);O<ne&&($-=ne-O)}return b.e=$,b.c=N,b}}(),w.sum=function(){for(var g=1,y=arguments,P=new w(y[0]);g<y.length;)P=P.plus(y[g++]);return P},n=function(){var g="0123456789";function y(P,k,C,$){for(var S,E=[0],O,N=0,b=P.length;N<b;){for(O=E.length;O--;E[O]*=k);for(E[0]+=$.indexOf(P.charAt(N++)),S=0;S<E.length;S++)E[S]>C-1&&(E[S+1]==null&&(E[S+1]=0),E[S+1]+=E[S]/C|0,E[S]%=C)}return E.reverse()}return function(P,k,C,$,S){var E,O,N,b,M,R,_,U,W=P.indexOf("."),K=i,V=c;for(W>=0&&(b=h,h=0,P=P.replace(".",""),U=new w(k),R=U.pow(P.length-W),h=b,U.c=y(zt(et(R.c),R.e,"0"),10,C,g),U.e=U.c.length),_=y(P,k,C,S?(E=x,g):(E=g,x)),N=b=_.length;_[--b]==0;_.pop());if(!_[0])return E.charAt(0);if(W<0?--N:(R.c=_,R.e=N,R.s=$,R=t(R,U,K,V,C),_=R.c,M=R.r,N=R.e),O=N+K+1,W=_[O],b=C/2,M=M||O<0||_[O+1]!=null,M=V<4?(W!=null||M)&&(V==0||V==(R.s<0?3:2)):W>b||W==b&&(V==4||M||V==6&&_[O-1]&1||V==(R.s<0?8:7)),O<1||!_[0])P=M?zt(E.charAt(1),-K,E.charAt(0)):E.charAt(0);else{if(_.length=O,M)for(--C;++_[--O]>C;)_[O]=0,O||(++N,_=[1].concat(_));for(b=_.length;!_[--b];);for(W=0,P="";W<=b;P+=E.charAt(_[W++]));P=zt(P,N,E.charAt(0))}return P}}(),t=function(){function g(k,C,$){var S,E,O,N,b=0,M=k.length,R=C%un,_=C/un|0;for(k=k.slice();M--;)O=k[M]%un,N=k[M]/un|0,S=_*O+N*R,E=R*O+S%un*un+b,b=(E/$|0)+(S/un|0)+_*N,k[M]=E%$;return b&&(k=[b].concat(k)),k}function y(k,C,$,S){var E,O;if($!=S)O=$>S?1:-1;else for(E=O=0;E<$;E++)if(k[E]!=C[E]){O=k[E]>C[E]?1:-1;break}return O}function P(k,C,$,S){for(var E=0;$--;)k[$]-=E,E=k[$]<C[$]?1:0,k[$]=E*S+k[$]-C[$];for(;!k[0]&&k.length>1;k.splice(0,1));}return function(k,C,$,S,E){var O,N,b,M,R,_,U,W,K,V,Z,H,Y,Q,se,me,pe,le=k.s==C.s?1:-1,ge=k.c,oe=C.c;if(!ge||!ge[0]||!oe||!oe[0])return new w(!k.s||!C.s||(ge?oe&&ge[0]==oe[0]:!oe)?NaN:ge&&ge[0]==0||!oe?le*0:le/0);for(W=new w(le),K=W.c=[],N=k.e-C.e,le=$+N+1,E||(E=pt,N=Je(k.e/ne)-Je(C.e/ne),le=le/ne|0),b=0;oe[b]==(ge[b]||0);b++);if(oe[b]>(ge[b]||0)&&N--,le<0)K.push(1),M=!0;else{for(Q=ge.length,me=oe.length,b=0,le+=2,R=Qe(E/(oe[0]+1)),R>1&&(oe=g(oe,R,E),ge=g(ge,R,E),me=oe.length,Q=ge.length),Y=me,V=ge.slice(0,me),Z=V.length;Z<me;V[Z++]=0);pe=oe.slice(),pe=[0].concat(pe),se=oe[0],oe[1]>=E/2&&se++;do{if(R=0,O=y(oe,V,me,Z),O<0){if(H=V[0],me!=Z&&(H=H*E+(V[1]||0)),R=Qe(H/se),R>1)for(R>=E&&(R=E-1),_=g(oe,R,E),U=_.length,Z=V.length;y(_,V,U,Z)==1;)R--,P(_,me<U?pe:oe,U,E),U=_.length,O=1;else R==0&&(O=R=1),_=oe.slice(),U=_.length;if(U<Z&&(_=[0].concat(_)),P(V,_,Z,E),Z=V.length,O==-1)for(;y(oe,V,me,Z)<1;)R++,P(V,me<Z?pe:oe,Z,E),Z=V.length}else O===0&&(R++,V=[0]);K[b++]=R,V[0]?V[Z++]=ge[Y]||0:(V=[ge[Y]],Z=1)}while((Y++<Q||V[0]!=null)&&le--);M=V[0]!=null,K[0]||K.splice(0,1)}if(E==pt){for(b=1,le=K[0];le>=10;le/=10,b++);F(W,$+(W.e=b+N*ne-1)+1,S,M)}else W.e=N,W.r=+M;return W}}();function T(g,y,P,k){var C,$,S,E,O;if(P==null?P=c:we(P,0,8),!g.c)return g.toString();if(C=g.c[0],S=g.e,y==null)O=et(g.c),O=k==1||k==2&&(S<=a||S>=l)?Fo(O,S):zt(O,S,"0");else if(g=F(new w(g),y,P),$=g.e,O=et(g.c),E=O.length,k==1||k==2&&(y<=$||$<=a)){for(;E<y;O+="0",E++);O=Fo(O,$)}else if(y-=S+(k===2&&$>S),O=zt(O,$,"0"),$+1>E){if(--y>0)for(O+=".";y--;O+="0");}else if(y+=$-E,y>0)for($+1==E&&(O+=".");y--;O+="0");return g.s<0&&C?"-"+O:O}function B(g,y){for(var P,k,C=1,$=new w(g[0]);C<g.length;C++)k=new w(g[C]),(!k.s||(P=Pn($,k))===y||P===0&&$.s===y)&&($=k);return $}function L(g,y,P){for(var k=1,C=y.length;!y[--C];y.pop());for(C=y[0];C>=10;C/=10,k++);return(P=k+P*ne-1)>f?g.c=g.e=null:P<u?g.c=[g.e=0]:(g.e=P,g.c=y),g}r=function(){var g=/^(-?)0([xbo])(?=\w[\w.]*$)/i,y=/^([^.]+)\.$/,P=/^\.([^.]+)$/,k=/^-?(Infinity|NaN)$/,C=/^\s*\+(?=[\w.])|^\s+|\s+$/g;return function($,S,E,O){var N,b=E?S:S.replace(C,"");if(k.test(b))$.s=isNaN(b)?null:b<0?-1:1;else{if(!E&&(b=b.replace(g,function(M,R,_){return N=(_=_.toLowerCase())=="x"?16:_=="b"?2:8,!O||O==N?R:M}),O&&(N=O,b=b.replace(y,"$1").replace(P,"0.$1")),S!=b))return new w(b,N);if(w.DEBUG)throw Error(Re+"Not a"+(O?" base "+O:"")+" number: "+S);$.s=null}$.c=$.e=null}}();function F(g,y,P,k){var C,$,S,E,O,N,b,M=g.c,R=ri;if(M){e:{for(C=1,E=M[0];E>=10;E/=10,C++);if($=y-C,$<0)$+=ne,S=y,O=M[N=0],b=Qe(O/R[C-S-1]%10);else if(N=ti(($+1)/ne),N>=M.length)if(k){for(;M.length<=N;M.push(0));O=b=0,C=1,$%=ne,S=$-ne+1}else break e;else{for(O=E=M[N],C=1;E>=10;E/=10,C++);$%=ne,S=$-ne+C,b=S<0?0:Qe(O/R[C-S-1]%10)}if(k=k||y<0||M[N+1]!=null||(S<0?O:O%R[C-S-1]),k=P<4?(b||k)&&(P==0||P==(g.s<0?3:2)):b>5||b==5&&(P==4||k||P==6&&($>0?S>0?O/R[C-S]:0:M[N-1])%10&1||P==(g.s<0?8:7)),y<1||!M[0])return M.length=0,k?(y-=g.e+1,M[0]=R[(ne-y%ne)%ne],g.e=-y||0):M[0]=g.e=0,g;if($==0?(M.length=N,E=1,N--):(M.length=N+1,E=R[ne-$],M[N]=S>0?Qe(O/R[C-S]%R[S])*E:0),k)for(;;)if(N==0){for($=1,S=M[0];S>=10;S/=10,$++);for(S=M[0]+=E,E=1;S>=10;S/=10,E++);$!=E&&(g.e++,M[0]==pt&&(M[0]=1));break}else{if(M[N]+=E,M[N]!=pt)break;M[N--]=0,E=1}for($=M.length;M[--$]===0;M.pop());}g.e>f?g.c=g.e=null:g.e<u&&(g.c=[g.e=0])}return g}function j(g){var y,P=g.e;return P===null?g.toString():(y=et(g.c),y=P<=a||P>=l?Fo(y,P):zt(y,P,"0"),g.s<0?"-"+y:y)}return o.absoluteValue=o.abs=function(){var g=new w(this);return g.s<0&&(g.s=1),g},o.comparedTo=function(g,y){return Pn(this,new w(g,y))},o.decimalPlaces=o.dp=function(g,y){var P,k,C,$=this;if(g!=null)return we(g,0,Ae),y==null?y=c:we(y,0,8),F(new w($),g+$.e+1,y);if(!(P=$.c))return null;if(k=((C=P.length-1)-Je(this.e/ne))*ne,C=P[C])for(;C%10==0;C/=10,k--);return k<0&&(k=0),k},o.dividedBy=o.div=function(g,y){return t(this,new w(g,y),i,c)},o.dividedToIntegerBy=o.idiv=function(g,y){return t(this,new w(g,y),0,1)},o.exponentiatedBy=o.pow=function(g,y){var P,k,C,$,S,E,O,N,b,M=this;if(g=new w(g),g.c&&!g.isInteger())throw Error(Re+"Exponent not an integer: "+j(g));if(y!=null&&(y=new w(y)),E=g.e>14,!M.c||!M.c[0]||M.c[0]==1&&!M.e&&M.c.length==1||!g.c||!g.c[0])return b=new w(Math.pow(+j(M),E?g.s*(2-Do(g)):+j(g))),y?b.mod(y):b;if(O=g.s<0,y){if(y.c?!y.c[0]:!y.s)return new w(NaN);k=!O&&M.isInteger()&&y.isInteger(),k&&(M=M.mod(y))}else{if(g.e>9&&(M.e>0||M.e<-1||(M.e==0?M.c[0]>1||E&&M.c[1]>=24e7:M.c[0]<8e13||E&&M.c[0]<=9999975e7)))return $=M.s<0&&Do(g)?-0:0,M.e>-1&&($=1/$),new w(O?1/$:$);h&&($=ti(h/ne+2))}for(E?(P=new w(.5),O&&(g.s=1),N=Do(g)):(C=Math.abs(+j(g)),N=C%2),b=new w(s);;){if(N){if(b=b.times(M),!b.c)break;$?b.c.length>$&&(b.c.length=$):k&&(b=b.mod(y))}if(C){if(C=Qe(C/2),C===0)break;N=C%2}else if(g=g.times(P),F(g,g.e+1,1),g.e>14)N=Do(g);else{if(C=+j(g),C===0)break;N=C%2}M=M.times(M),$?M.c&&M.c.length>$&&(M.c.length=$):k&&(M=M.mod(y))}return k?b:(O&&(b=s.div(b)),y?b.mod(y):$?F(b,h,c,S):b)},o.integerValue=function(g){var y=new w(this);return g==null?g=c:we(g,0,8),F(y,y.e+1,g)},o.isEqualTo=o.eq=function(g,y){return Pn(this,new w(g,y))===0},o.isFinite=function(){return!!this.c},o.isGreaterThan=o.gt=function(g,y){return Pn(this,new w(g,y))>0},o.isGreaterThanOrEqualTo=o.gte=function(g,y){return(y=Pn(this,new w(g,y)))===1||y===0},o.isInteger=function(){return!!this.c&&Je(this.e/ne)>this.c.length-2},o.isLessThan=o.lt=function(g,y){return Pn(this,new w(g,y))<0},o.isLessThanOrEqualTo=o.lte=function(g,y){return(y=Pn(this,new w(g,y)))===-1||y===0},o.isNaN=function(){return!this.s},o.isNegative=function(){return this.s<0},o.isPositive=function(){return this.s>0},o.isZero=function(){return!!this.c&&this.c[0]==0},o.minus=function(g,y){var P,k,C,$,S=this,E=S.s;if(g=new w(g,y),y=g.s,!E||!y)return new w(NaN);if(E!=y)return g.s=-y,S.plus(g);var O=S.e/ne,N=g.e/ne,b=S.c,M=g.c;if(!O||!N){if(!b||!M)return b?(g.s=-y,g):new w(M?S:NaN);if(!b[0]||!M[0])return M[0]?(g.s=-y,g):new w(b[0]?S:c==3?-0:0)}if(O=Je(O),N=Je(N),b=b.slice(),E=O-N){for(($=E<0)?(E=-E,C=b):(N=O,C=M),C.reverse(),y=E;y--;C.push(0));C.reverse()}else for(k=($=(E=b.length)<(y=M.length))?E:y,E=y=0;y<k;y++)if(b[y]!=M[y]){$=b[y]<M[y];break}if($&&(C=b,b=M,M=C,g.s=-g.s),y=(k=M.length)-(P=b.length),y>0)for(;y--;b[P++]=0);for(y=pt-1;k>E;){if(b[--k]<M[k]){for(P=k;P&&!b[--P];b[P]=y);--b[P],b[k]+=pt}b[k]-=M[k]}for(;b[0]==0;b.splice(0,1),--N);return b[0]?L(g,b,N):(g.s=c==3?-1:1,g.c=[g.e=0],g)},o.modulo=o.mod=function(g,y){var P,k,C=this;return g=new w(g,y),!C.c||!g.s||g.c&&!g.c[0]?new w(NaN):!g.c||C.c&&!C.c[0]?new w(C):(d==9?(k=g.s,g.s=1,P=t(C,g,0,3),g.s=k,P.s*=k):P=t(C,g,0,d),g=C.minus(P.times(g)),!g.c[0]&&d==1&&(g.s=C.s),g)},o.multipliedBy=o.times=function(g,y){var P,k,C,$,S,E,O,N,b,M,R,_,U,W,K,V=this,Z=V.c,H=(g=new w(g,y)).c;if(!Z||!H||!Z[0]||!H[0])return!V.s||!g.s||Z&&!Z[0]&&!H||H&&!H[0]&&!Z?g.c=g.e=g.s=null:(g.s*=V.s,!Z||!H?g.c=g.e=null:(g.c=[0],g.e=0)),g;for(k=Je(V.e/ne)+Je(g.e/ne),g.s*=V.s,O=Z.length,M=H.length,O<M&&(U=Z,Z=H,H=U,C=O,O=M,M=C),C=O+M,U=[];C--;U.push(0));for(W=pt,K=un,C=M;--C>=0;){for(P=0,R=H[C]%K,_=H[C]/K|0,S=O,$=C+S;$>C;)N=Z[--S]%K,b=Z[S]/K|0,E=_*N+b*R,N=R*N+E%K*K+U[$]+P,P=(N/W|0)+(E/K|0)+_*b,U[$--]=N%W;U[$]=P}return P?++k:U.splice(0,1),L(g,U,k)},o.negated=function(){var g=new w(this);return g.s=-g.s||null,g},o.plus=function(g,y){var P,k=this,C=k.s;if(g=new w(g,y),y=g.s,!C||!y)return new w(NaN);if(C!=y)return g.s=-y,k.minus(g);var $=k.e/ne,S=g.e/ne,E=k.c,O=g.c;if(!$||!S){if(!E||!O)return new w(C/0);if(!E[0]||!O[0])return O[0]?g:new w(E[0]?k:C*0)}if($=Je($),S=Je(S),E=E.slice(),C=$-S){for(C>0?(S=$,P=O):(C=-C,P=E),P.reverse();C--;P.push(0));P.reverse()}for(C=E.length,y=O.length,C-y<0&&(P=O,O=E,E=P,y=C),C=0;y;)C=(E[--y]=E[y]+O[y]+C)/pt|0,E[y]=pt===E[y]?0:E[y]%pt;return C&&(E=[C].concat(E),++S),L(g,E,S)},o.precision=o.sd=function(g,y){var P,k,C,$=this;if(g!=null&&g!==!!g)return we(g,1,Ae),y==null?y=c:we(y,0,8),F(new w($),g,y);if(!(P=$.c))return null;if(C=P.length-1,k=C*ne+1,C=P[C]){for(;C%10==0;C/=10,k--);for(C=P[0];C>=10;C/=10,k++);}return g&&$.e+1>k&&(k=$.e+1),k},o.shiftedBy=function(g){return we(g,-ni,ni),this.times("1e"+g)},o.squareRoot=o.sqrt=function(){var g,y,P,k,C,$=this,S=$.c,E=$.s,O=$.e,N=i+4,b=new w("0.5");if(E!==1||!S||!S[0])return new w(!E||E<0&&(!S||S[0])?NaN:S?$:1/0);if(E=Math.sqrt(+j($)),E==0||E==1/0?(y=et(S),(y.length+O)%2==0&&(y+="0"),E=Math.sqrt(+y),O=Je((O+1)/2)-(O<0||O%2),E==1/0?y="5e"+O:(y=E.toExponential(),y=y.slice(0,y.indexOf("e")+1)+O),P=new w(y)):P=new w(E+""),P.c[0]){for(O=P.e,E=O+N,E<3&&(E=0);;)if(C=P,P=b.times(C.plus(t($,C,N,1))),et(C.c).slice(0,E)===(y=et(P.c)).slice(0,E))if(P.e<O&&--E,y=y.slice(E-3,E+1),y=="9999"||!k&&y=="4999"){if(!k&&(F(C,C.e+i+2,0),C.times(C).eq($))){P=C;break}N+=4,E+=4,k=1}else{(!+y||!+y.slice(1)&&y.charAt(0)=="5")&&(F(P,P.e+i+2,1),g=!P.times(P).eq($));break}}return F(P,P.e+i+1,c,g)},o.toExponential=function(g,y){return g!=null&&(we(g,0,Ae),g++),T(this,g,y,1)},o.toFixed=function(g,y){return g!=null&&(we(g,0,Ae),g=g+this.e+1),T(this,g,y)},o.toFormat=function(g,y,P){var k,C=this;if(P==null)g!=null&&y&&typeof y=="object"?(P=y,y=null):g&&typeof g=="object"?(P=g,g=y=null):P=m;else if(typeof P!="object")throw Error(Re+"Argument not an object: "+P);if(k=C.toFixed(g,y),C.c){var $,S=k.split("."),E=+P.groupSize,O=+P.secondaryGroupSize,N=P.groupSeparator||"",b=S[0],M=S[1],R=C.s<0,_=R?b.slice(1):b,U=_.length;if(O&&($=E,E=O,O=$,U-=$),E>0&&U>0){for($=U%E||E,b=_.substr(0,$);$<U;$+=E)b+=N+_.substr($,E);O>0&&(b+=N+_.slice($)),R&&(b="-"+b)}k=M?b+(P.decimalSeparator||"")+((O=+P.fractionGroupSize)?M.replace(new RegExp("\\d{"+O+"}\\B","g"),"$&"+(P.fractionGroupSeparator||"")):M):b}return(P.prefix||"")+k+(P.suffix||"")},o.toFraction=function(g){var y,P,k,C,$,S,E,O,N,b,M,R,_=this,U=_.c;if(g!=null&&(E=new w(g),!E.isInteger()&&(E.c||E.s!==1)||E.lt(s)))throw Error(Re+"Argument "+(E.isInteger()?"out of range: ":"not an integer: ")+j(E));if(!U)return new w(_);for(y=new w(s),N=P=new w(s),k=O=new w(s),R=et(U),$=y.e=R.length-_.e-1,y.c[0]=ri[(S=$%ne)<0?ne+S:S],g=!g||E.comparedTo(y)>0?$>0?y:N:E,S=f,f=1/0,E=new w(R),O.c[0]=0;b=t(E,y,0,1),C=P.plus(b.times(k)),C.comparedTo(g)!=1;)P=k,k=C,N=O.plus(b.times(C=N)),O=C,y=E.minus(b.times(C=y)),E=C;return C=t(g.minus(P),k,0,1),O=O.plus(C.times(N)),P=P.plus(C.times(k)),O.s=N.s=_.s,$=$*2,M=t(N,k,$,c).minus(_).abs().comparedTo(t(O,P,$,c).minus(_).abs())<1?[N,k]:[O,P],f=S,M},o.toNumber=function(){return+j(this)},o.toPrecision=function(g,y){return g!=null&&we(g,1,Ae),T(this,g,y,2)},o.toString=function(g){var y,P=this,k=P.s,C=P.e;return C===null?k?(y="Infinity",k<0&&(y="-"+y)):y="NaN":(g==null?y=C<=a||C>=l?Fo(et(P.c),C):zt(et(P.c),C,"0"):g===10&&A?(P=F(new w(P),i+C+1,c),y=zt(et(P.c),P.e,"0")):(we(g,2,x.length,"Base"),y=n(zt(et(P.c),C,"0"),10,g,k,!0)),k<0&&P.c[0]&&(y="-"+y)),y},o.valueOf=o.toJSON=function(){return j(this)},o._isBigNumber=!0,o[Symbol.toStringTag]="BigNumber",o[Symbol.for("nodejs.util.inspect.custom")]=o.valueOf,e!=null&&w.set(e),w}function 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 Pn(e,t){var n,r,o=e.c,s=t.c,i=e.s,c=t.s,a=e.e,l=t.e;if(!i||!c)return null;if(n=o&&!o[0],r=s&&!s[0],n||r)return n?r?0:-c:i;if(i!=c)return i;if(n=i<0,r=a==l,!o||!s)return r?0:!o^n?1:-1;if(!r)return a>l^n?1:-1;for(c=(a=o.length)<(l=s.length)?a:l,i=0;i<c;i++)if(o[i]!=s[i])return o[i]>s[i]^n?1:-1;return a==l?0:a>l^n?1:-1}function we(e,t,n,r){if(e<t||e>n||e!==Qe(e))throw Error(Re+(r||"Argument")+(typeof e=="number"?e<t||e>n?" out of range: ":" not an integer: ":" not a primitive number: ")+String(e))}function Do(e){var t=e.c.length-1;return Je(e.e/ne)==t&&e.c[t]%2!=0}function Fo(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 Ce=pl();const um=(e,t=6)=>{try{const n=new Ce(e||"0");if(n.isNaN())return"0";const r=n.decimalPlaces(t,Ce.ROUND_DOWN),[o,s=""]=r.toString().split("."),i=o.replace(/\B(?=(\d{3})+(?!\d))/g,",");if(t>0){const c=(s||"").padEnd(t,"0");return`${i}.${c}`}return i}catch(n){return console.warn("formatThousands error:",n),"0"}},ht=()=>{const{translations:e,currentLocale:t}=fl();return{t:(s,i)=>{try{const c=s.split(".");let a=e;for(const u of c)if(a&&typeof a=="object"&&u in a)a=a[u];else return s;let l=typeof a=="string"?a:s;return i&&typeof l=="string"&&Object.keys(i).forEach(u=>{const f=`{{${u}}}`;l=l.replace(new RegExp(f,"g"),String(i[u]))}),l}catch(c){return console.warn(`Translation error for key "${s}":`,c),s}},translations:e,locale:t,getTranslationObject:s=>{try{const i=s.split(".");let c=e;for(const a of i)if(c&&typeof c=="object"&&a in c)c=c[a];else return{};return typeof c=="object"?c:{}}catch(i){return console.warn(`Translation object error for key "${s}":`,i),{}}},hasTranslation:s=>{try{const i=s.split(".");let c=e;for(const a of i)if(c&&typeof c=="object"&&a in c)c=c[a];else return!1;return typeof c=="string"}catch{return!1}}}},fm="1.0.8";let Ze=class ol extends Error{constructor(t,n={}){var i;const r=n.cause instanceof ol?n.cause.details:(i=n.cause)!=null&&i.message?n.cause.message:n.details,o=n.cause instanceof ol&&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@${fm}`].join(`
41
- `);super(s),Object.defineProperty(this,"details",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docsPath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"metaMessages",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"shortMessage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiTypeError"}),n.cause&&(this.cause=n.cause),this.details=r,this.docsPath=o,this.metaMessages=n.metaMessages,this.shortMessage=t}};function Ht(e,t){const n=e.exec(t);return n==null?void 0:n.groups}const hl=/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/,ml=/^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)?$/,gl=/^\(.+?\).*?$/,bl=/^tuple(?<array>(\[(\d*)\])*)$/;function oi(e){let t=e.type;if(bl.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+=oi(s),o<n-1&&(t+=", ")}const r=Ht(bl,e.type);return t+=`)${(r==null?void 0:r.array)??""}`,oi({...e,type:t})}return"indexed"in e&&e.indexed&&(t=`${t} indexed`),e.name?`${t} ${e.name}`:t}function Mr(e){let t="";const n=e.length;for(let r=0;r<n;r++){const o=e[r];t+=oi(o),r!==n-1&&(t+=", ")}return t}function Ro(e){var t;return e.type==="function"?`function ${e.name}(${Mr(e.inputs)})${e.stateMutability&&e.stateMutability!=="nonpayable"?` ${e.stateMutability}`:""}${(t=e.outputs)!=null&&t.length?` returns (${Mr(e.outputs)})`:""}`:e.type==="event"?`event ${e.name}(${Mr(e.inputs)})`:e.type==="error"?`error ${e.name}(${Mr(e.inputs)})`:e.type==="constructor"?`constructor(${Mr(e.inputs)})${e.stateMutability==="payable"?" payable":""}`:e.type==="fallback"?`fallback() external${e.stateMutability==="payable"?" payable":""}`:"receive() external payable"}const yl=/^error (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*)\((?<parameters>.*?)\)$/;function dm(e){return yl.test(e)}function pm(e){return Ht(yl,e)}const wl=/^event (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*)\((?<parameters>.*?)\)$/;function hm(e){return wl.test(e)}function mm(e){return Ht(wl,e)}const vl=/^function (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*)\((?<parameters>.*?)\)(?: (?<scope>external|public{1}))?(?: (?<stateMutability>pure|view|nonpayable|payable{1}))?(?: returns\s?\((?<returns>.*?)\))?$/;function gm(e){return vl.test(e)}function bm(e){return Ht(vl,e)}const xl=/^struct (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*) \{(?<properties>.*?)\}$/;function si(e){return xl.test(e)}function ym(e){return Ht(xl,e)}const El=/^constructor\((?<parameters>.*?)\)(?:\s(?<stateMutability>payable{1}))?$/;function wm(e){return El.test(e)}function vm(e){return Ht(El,e)}const Sl=/^fallback\(\) external(?:\s(?<stateMutability>payable{1}))?$/;function xm(e){return Sl.test(e)}function Em(e){return Ht(Sl,e)}const Sm=/^receive\(\) external payable$/;function Pm(e){return Sm.test(e)}const $m=new Set(["indexed"]),ii=new Set(["calldata","memory","storage"]);class Tm extends Ze{constructor({signature:t}){super("Failed to parse ABI item.",{details:`parseAbiItem(${JSON.stringify(t,null,2)})`,docsPath:"/api/human#parseabiitem-1"}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidAbiItemError"})}}class Am extends Ze{constructor({type:t}){super("Unknown type.",{metaMessages:[`Type "${t}" is not a valid ABI type. Perhaps you forgot to include a struct signature?`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"UnknownTypeError"})}}class Nm extends Ze{constructor({type:t}){super("Unknown type.",{metaMessages:[`Type "${t}" is not a valid ABI type.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"UnknownSolidityTypeError"})}}class Om extends Ze{constructor({param:t}){super("Invalid ABI parameter.",{details:t}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidParameterError"})}}class Cm extends Ze{constructor({param:t,name:n}){super("Invalid ABI parameter.",{details:t,metaMessages:[`"${n}" is a protected Solidity keyword. More info: https://docs.soliditylang.org/en/latest/cheatsheet.html`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"SolidityProtectedKeywordError"})}}class Im extends Ze{constructor({param:t,type:n,modifier:r}){super("Invalid ABI parameter.",{details:t,metaMessages:[`Modifier "${r}" not allowed${n?` in "${n}" type`:""}.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidModifierError"})}}class Mm extends Ze{constructor({param:t,type:n,modifier:r}){super("Invalid ABI parameter.",{details:t,metaMessages:[`Modifier "${r}" not allowed${n?` in "${n}" type`:""}.`,`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 km extends Ze{constructor({abiParameter:t}){super("Invalid ABI parameter.",{details:JSON.stringify(t,null,2),metaMessages:["ABI parameter type is invalid."]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidAbiTypeParameterError"})}}class Kn extends Ze{constructor({signature:t,type:n}){super(`Invalid ${n} signature.`,{details:t}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidSignatureError"})}}class Bm extends Ze{constructor({signature:t}){super("Unknown signature.",{details:t}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"UnknownSignatureError"})}}class Lm extends Ze{constructor({signature:t}){super("Invalid struct signature.",{details:t,metaMessages:["No properties exist."]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidStructSignatureError"})}}class Dm extends Ze{constructor({type:t}){super("Circular reference detected.",{metaMessages:[`Struct "${t}" is a circular reference.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"CircularReferenceError"})}}class Fm extends Ze{constructor({current:t,depth:n}){super("Unbalanced parentheses.",{metaMessages:[`"${t.trim()}" has too many ${n>0?"opening":"closing"} parentheses.`],details:`Depth "${n}"`}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidParenthesisError"})}}function Rm(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 ai=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 ci(e,t={}){if(gm(e))return jm(e,t);if(hm(e))return _m(e,t);if(dm(e))return Um(e,t);if(wm(e))return zm(e,t);if(xm(e))return Hm(e);if(Pm(e))return{type:"receive",stateMutability:"payable"};throw new Bm({signature:e})}function jm(e,t={}){const n=bm(e);if(!n)throw new Kn({signature:e,type:"function"});const r=mt(n.parameters),o=[],s=r.length;for(let c=0;c<s;c++)o.push($n(r[c],{modifiers:ii,structs:t,type:"function"}));const i=[];if(n.returns){const c=mt(n.returns),a=c.length;for(let l=0;l<a;l++)i.push($n(c[l],{modifiers:ii,structs:t,type:"function"}))}return{name:n.name,type:"function",stateMutability:n.stateMutability??"nonpayable",inputs:o,outputs:i}}function _m(e,t={}){const n=mm(e);if(!n)throw new Kn({signature:e,type:"event"});const r=mt(n.parameters),o=[],s=r.length;for(let i=0;i<s;i++)o.push($n(r[i],{modifiers:$m,structs:t,type:"event"}));return{name:n.name,type:"event",inputs:o}}function Um(e,t={}){const n=pm(e);if(!n)throw new Kn({signature:e,type:"error"});const r=mt(n.parameters),o=[],s=r.length;for(let i=0;i<s;i++)o.push($n(r[i],{structs:t,type:"error"}));return{name:n.name,type:"error",inputs:o}}function zm(e,t={}){const n=vm(e);if(!n)throw new Kn({signature:e,type:"constructor"});const r=mt(n.parameters),o=[],s=r.length;for(let i=0;i<s;i++)o.push($n(r[i],{structs:t,type:"constructor"}));return{type:"constructor",stateMutability:n.stateMutability??"nonpayable",inputs:o}}function Hm(e){const t=Em(e);if(!t)throw new Kn({signature:e,type:"fallback"});return{type:"fallback",stateMutability:t.stateMutability??"nonpayable"}}const Wm=/^(?<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$_]*))?$/,Vm=/^\((?<type>.+?)\)(?<array>(?:\[\d*?\])+?)?(?:\s(?<modifier>calldata|indexed|memory|storage{1}))?(?:\s(?<name>[a-zA-Z$_][a-zA-Z0-9$_]*))?$/,Gm=/^u?int$/;function $n(e,t){var f,p;const n=Rm(e,t==null?void 0:t.type,t==null?void 0:t.structs);if(ai.has(n))return ai.get(n);const r=gl.test(e),o=Ht(r?Vm:Wm,e);if(!o)throw new Om({param:e});if(o.name&&Zm(o.name))throw new Cm({param:e,name:o.name});const s=o.name?{name:o.name}:{},i=o.modifier==="indexed"?{indexed:!0}:{},c=(t==null?void 0:t.structs)??{};let a,l={};if(r){a="tuple";const d=mt(o.type),h=[],m=d.length;for(let x=0;x<m;x++)h.push($n(d[x],{structs:c}));l={components:h}}else if(o.type in c)a="tuple",l={components:c[o.type]};else if(Gm.test(o.type))a=`${o.type}256`;else if(a=o.type,(t==null?void 0:t.type)!=="struct"&&!Pl(a))throw new Nm({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 Im({param:e,type:t==null?void 0:t.type,modifier:o.modifier});if(ii.has(o.modifier)&&!Km(a,!!o.array))throw new Mm({param:e,type:t==null?void 0:t.type,modifier:o.modifier})}const u={type:`${a}${o.array??""}`,...s,...i,...l};return ai.set(n,u),u}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 Fm({current:n,depth:r});return t.push(n.trim()),t}function Pl(e){return e==="address"||e==="bool"||e==="function"||e==="string"||hl.test(e)||ml.test(e)}const qm=/^(?: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 Zm(e){return e==="address"||e==="bool"||e==="function"||e==="string"||e==="tuple"||hl.test(e)||ml.test(e)||qm.test(e)}function Km(e,t){return t||e==="bytes"||e==="string"||e==="tuple"}function $l(e){const t={},n=e.length;for(let i=0;i<n;i++){const c=e[i];if(!si(c))continue;const a=ym(c);if(!a)throw new Kn({signature:c,type:"struct"});const l=a.properties.split(";"),u=[],f=l.length;for(let p=0;p<f;p++){const h=l[p].trim();if(!h)continue;const m=$n(h,{type:"struct"});u.push(m)}if(!u.length)throw new Lm({signature:c});t[a.name]=u}const r={},o=Object.entries(t),s=o.length;for(let i=0;i<s;i++){const[c,a]=o[i];r[c]=Tl(a,t)}return r}const Ym=/^(?<type>[a-zA-Z$_][a-zA-Z0-9$_]*)(?<array>(?:\[\d*?\])+?)?$/;function Tl(e,t,n=new Set){const r=[],o=e.length;for(let s=0;s<o;s++){const i=e[s];if(gl.test(i.type))r.push(i);else{const a=Ht(Ym,i.type);if(!(a!=null&&a.type))throw new km({abiParameter:i});const{array:l,type:u}=a;if(u in t){if(n.has(u))throw new Dm({type:u});r.push({...i,type:`tuple${l??""}`,components:Tl(t[u]??[],t,new Set([...n,u]))})}else if(Pl(u))r.push(i);else throw new Am({type:u})}}return r}function Al(e){const t=$l(e),n=[],r=e.length;for(let o=0;o<r;o++){const s=e[o];si(s)||n.push(ci(s,t))}return n}function Nl(e){let t;if(typeof e=="string")t=ci(e);else{const n=$l(e),r=e.length;for(let o=0;o<r;o++){const s=e[o];if(!si(s)){t=ci(s,n);break}}}if(!t)throw new Tm({signature:e});return t}function ee(e,t,n){const r=e[t.name];if(typeof r=="function")return r;const o=e[n];return typeof o=="function"?o:s=>t(e,s)}function gt(e,{includeName:t=!1}={}){if(e.type!=="function"&&e.type!=="event"&&e.type!=="error")throw new lg(e.type);return`${e.name}(${jo(e.inputs,{includeName:t})})`}function jo(e,{includeName:t=!1}={}){return e?e.map(n=>Xm(n,{includeName:t})).join(t?", ":","):""}function Xm(e,{includeName:t}){return e.type.startsWith("tuple")?`(${jo(e.components,{includeName:t})})${e.type.slice(5)}`:e.type+(t&&e.name?` ${e.name}`:"")}function bt(e,{strict:t=!0}={}){return!e||typeof e!="string"?!1:t?/^0x[0-9a-fA-F]*$/.test(e):e.startsWith("0x")}function xe(e){return bt(e,{strict:!1})?Math.ceil((e.length-2)/2):e.length}const Ol="2.34.0";let kr={getDocsUrl:({docsBaseUrl:e,docsPath:t="",docsSlug:n})=>t?`${e??"https://viem.sh"}${t}${n?`#${n}`:""}`:void 0,version:`viem@${Ol}`},G=class sl extends Error{constructor(t,n={}){var c;const r=(()=>{var a;return n.cause instanceof sl?n.cause.details:(a=n.cause)!=null&&a.message?n.cause.message:n.details})(),o=n.cause instanceof sl&&n.cause.docsPath||n.docsPath,s=(c=kr.getDocsUrl)==null?void 0:c.call(kr,{...n,docsPath:o}),i=[t||"An error occurred.","",...n.metaMessages?[...n.metaMessages,""]:[],...s?[`Docs: ${s}`]:[],...r?[`Details: ${r}`]:[],...kr.version?[`Version: ${kr.version}`]:[]].join(`
39
+ 充值金額大於 200,000 時,到账時間可能會有延遲,請耐心等待。`,maxDepositSplitTip:"單筆充值金額上限為 200,000。若需要充值金額大於 200,000,請分多筆進行操作。",spotDepositNotSupportedTip:"不支援充值,請先充入合約帳戶再劃轉。",crossChainDepositFeeTip:`僅支援發送 {{coin}} ({{v}}) 資產到此位址。
40
+ 跨鏈充值需由您承擔 Edge 網路手續費。到帳金額會略小於您的充值金額。`,addressUpdatedNotice:"注意:充值地址已更新,請改用新地址。原地址僅在過渡期內有效,之後將停用。若已在其他平台儲存,請儘速更新。",enableSystemProWithToken:"在{{network}}上啓用{{token}}",enableTokenDesc:"您首次在{{network}}上存款時必須啓用{{token}}。",enableWithToken:"啓用 {{token}}",arrivaltimeTooltip1:"資金約在 {{v}} 分鐘內(達到 {{v1}} 個區塊確認後)到賬。",arrivaltimeTooltip2:"預計時間是根據歷史資料計算所得,僅供參考。網路壅塞可能會導致實際到帳時間變長。",arrivalEstimated:"≈ {{v}}分鐘",availableDesc:"您可以充值的最大金額。當可用餘額為0或負數時,無法進行充值。",noPrivateKeyWalletWarning:"請勿使用無私鑰錢包進行充值,無私鑰錢包充值會導致資金損失且無法追回。",layerZeroDepositTip:"系統會根據充值資金的實際情況,通過 LayerZero 完成您的充值。",layerZeroDepositTipExceedPool:"由於充值資金大於資金池,將透過 LayerZero 完成您的充值。",layerZeroDepositTipGte200k:"由於充值資金大於等於 200,000 USDT,將透過 LayerZero 完成您的充值。",layerZeroDepositButton:"使用LayerZero充值"},withdraw:{noticeDesc:"普通提現是一個兩步過程。此步驟將發起您的提現請求,並將在 Layer2 進行處理。一旦資金準備就緒(可能需要最多 4 小時),您將收到一條將資金提現到錢包的通知。受鏈同步等情況影響下,時長可能需要長達 48 小時。您需要自行承擔交易 gas 費用。",crossChainTips:"跨鏈提幣需在 L2(通過零知識證明)進行驗證。提幣過程最多約需2小時。相關鏈的資產池中需有充足的資金來處理跨鏈提幣,其間還將產生礦工費。 edgeX 將收取一定的手續費作爲礦工費。",commonWithdraw:"提現說明",withdraw:"提現",speed:"速度",confirmWithdraw:"提現確認",speedNote:"處理時間:",speedNoteSpeed1:"用時約8分鐘",speedNoteSpeed2:"用時約 2-4 小時",speedNoteSpeed3:"用時約4小時",receiverAddress:"接收地址",fee:"手續費",feeRate:"費率",withdrawlAmount:"提現金額",amountToReceive:"到账金額",minWithdraw:"最小提現金額",minWithdrawParsed:"最小提現 {{amount}} {{token}}",invalidReceiverAddress:"接收地址不能為空",availableDesc:"您可以提現的最大金額。當可用餘額為0或負數時,無法進行提現。",feeCalculationTip:"提現手續費按照提現金額乘以費率計算,最低為 1 USDT/USDC。費率會根據鏈上實際情況進行調整。",crossChainPoolBalance:"跨鏈資金池餘額",poolBalance:"資金池餘額",poolBalanceInsufficientTip:"提現金額大於資金池餘額,無法進行提現。請選擇資金池餘額充足的選項。"},account:{title:"帳戶",perpetual:"合約帳戶",spot:"現貨帳戶"}},ti=["en-US","ja-JP","ru-RU","zh-CN","zh-TW"],ll={"en-US":tm,"ja-JP":nm,"ru-RU":rm,"zh-CN":em,"zh-TW":om},Lo="en-US",sm={"en-US":"English","zh-CN":"简体中文","zh-TW":"繁體中文","ja-JP":"日本語","ru-RU":"Русский"},im=e=>ti.includes(e)?ll[e]:ll[Lo],am=e=>ti.includes(e),ul=v.createContext(null),cm=({config:e,children:t})=>{const n=v.useMemo(()=>{const r=e.locale||Lo,o=am(r)?r:Lo,s=im(o);return{...e,currentLocale:o,translations:s}},[e]);return I.jsx(ul.Provider,{value:n,children:t})},fl=()=>{const e=v.useContext(ul);if(!e)throw new Error("useComponentConfig must be used within ComponentProvider");return e};var lm=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,ni=Math.ceil,Qe=Math.floor,Re="[BigNumber Error] ",dl=Re+"Number primitive has more than 15 significant digits: ",pt=1e14,ne=14,ri=9007199254740991,oi=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],un=1e7,Ae=1e9;function pl(e){var t,n,r,o=w.prototype={constructor:w,toString:null,valueOf:null},s=new w(1),i=20,c=4,a=-7,l=21,u=-1e7,f=1e7,p=!1,d=1,h=0,m={prefix:"",groupSize:3,secondaryGroupSize:0,groupSeparator:",",decimalSeparator:".",fractionGroupSize:0,fractionGroupSeparator:" ",suffix:""},x="0123456789abcdefghijklmnopqrstuvwxyz",A=!0;function w(g,y){var P,k,C,$,S,E,O,N,b=this;if(!(b instanceof w))return new w(g,y);if(y==null){if(g&&g._isBigNumber===!0){b.s=g.s,!g.c||g.e>f?b.c=b.e=null:g.e<u?b.c=[b.e=0]:(b.e=g.e,b.c=g.c.slice());return}if((E=typeof g=="number")&&g*0==0){if(b.s=1/g<0?(g=-g,-1):1,g===~~g){for($=0,S=g;S>=10;S/=10,$++);$>f?b.c=b.e=null:(b.e=$,b.c=[g]);return}N=String(g)}else{if(!lm.test(N=String(g)))return r(b,N,E);b.s=N.charCodeAt(0)==45?(N=N.slice(1),-1):1}($=N.indexOf("."))>-1&&(N=N.replace(".","")),(S=N.search(/e/i))>0?($<0&&($=S),$+=+N.slice(S+1),N=N.substring(0,S)):$<0&&($=N.length)}else{if(we(y,2,x.length,"Base"),y==10&&A)return b=new w(g),F(b,i+b.e+1,c);if(N=String(g),E=typeof g=="number"){if(g*0!=0)return r(b,N,E,y);if(b.s=1/g<0?(N=N.slice(1),-1):1,w.DEBUG&&N.replace(/^0\.0*|\./,"").length>15)throw Error(dl+g)}else b.s=N.charCodeAt(0)===45?(N=N.slice(1),-1):1;for(P=x.slice(0,y),$=S=0,O=N.length;S<O;S++)if(P.indexOf(k=N.charAt(S))<0){if(k=="."){if(S>$){$=O;continue}}else if(!C&&(N==N.toUpperCase()&&(N=N.toLowerCase())||N==N.toLowerCase()&&(N=N.toUpperCase()))){C=!0,S=-1,$=0;continue}return r(b,String(g),E,y)}E=!1,N=n(N,y,10,b.s),($=N.indexOf("."))>-1?N=N.replace(".",""):$=N.length}for(S=0;N.charCodeAt(S)===48;S++);for(O=N.length;N.charCodeAt(--O)===48;);if(N=N.slice(S,++O)){if(O-=S,E&&w.DEBUG&&O>15&&(g>ri||g!==Qe(g)))throw Error(dl+b.s*g);if(($=$-S-1)>f)b.c=b.e=null;else if($<u)b.c=[b.e=0];else{if(b.e=$,b.c=[],S=($+1)%ne,$<0&&(S+=ne),S<O){for(S&&b.c.push(+N.slice(0,S)),O-=ne;S<O;)b.c.push(+N.slice(S,S+=ne));S=ne-(N=N.slice(S)).length}else S-=O;for(;S--;N+="0");b.c.push(+N)}}else b.c=[b.e=0]}w.clone=pl,w.ROUND_UP=0,w.ROUND_DOWN=1,w.ROUND_CEIL=2,w.ROUND_FLOOR=3,w.ROUND_HALF_UP=4,w.ROUND_HALF_DOWN=5,w.ROUND_HALF_EVEN=6,w.ROUND_HALF_CEIL=7,w.ROUND_HALF_FLOOR=8,w.EUCLID=9,w.config=w.set=function(g){var y,P;if(g!=null)if(typeof g=="object"){if(g.hasOwnProperty(y="DECIMAL_PLACES")&&(P=g[y],we(P,0,Ae,y),i=P),g.hasOwnProperty(y="ROUNDING_MODE")&&(P=g[y],we(P,0,8,y),c=P),g.hasOwnProperty(y="EXPONENTIAL_AT")&&(P=g[y],P&&P.pop?(we(P[0],-Ae,0,y),we(P[1],0,Ae,y),a=P[0],l=P[1]):(we(P,-Ae,Ae,y),a=-(l=P<0?-P:P))),g.hasOwnProperty(y="RANGE"))if(P=g[y],P&&P.pop)we(P[0],-Ae,-1,y),we(P[1],1,Ae,y),u=P[0],f=P[1];else if(we(P,-Ae,Ae,y),P)u=-(f=P<0?-P:P);else throw Error(Re+y+" cannot be zero: "+P);if(g.hasOwnProperty(y="CRYPTO"))if(P=g[y],P===!!P)if(P)if(typeof crypto<"u"&&crypto&&(crypto.getRandomValues||crypto.randomBytes))p=P;else throw p=!P,Error(Re+"crypto unavailable");else p=P;else throw Error(Re+y+" not true or false: "+P);if(g.hasOwnProperty(y="MODULO_MODE")&&(P=g[y],we(P,0,9,y),d=P),g.hasOwnProperty(y="POW_PRECISION")&&(P=g[y],we(P,0,Ae,y),h=P),g.hasOwnProperty(y="FORMAT"))if(P=g[y],typeof P=="object")m=P;else throw Error(Re+y+" not an object: "+P);if(g.hasOwnProperty(y="ALPHABET"))if(P=g[y],typeof P=="string"&&!/^.?$|[+\-.\s]|(.).*\1/.test(P))A=P.slice(0,10)=="0123456789",x=P;else throw Error(Re+y+" invalid: "+P)}else throw Error(Re+"Object expected: "+g);return{DECIMAL_PLACES:i,ROUNDING_MODE:c,EXPONENTIAL_AT:[a,l],RANGE:[u,f],CRYPTO:p,MODULO_MODE:d,POW_PRECISION:h,FORMAT:m,ALPHABET:x}},w.isBigNumber=function(g){if(!g||g._isBigNumber!==!0)return!1;if(!w.DEBUG)return!0;var y,P,k=g.c,C=g.e,$=g.s;e:if({}.toString.call(k)=="[object Array]"){if(($===1||$===-1)&&C>=-Ae&&C<=Ae&&C===Qe(C)){if(k[0]===0){if(C===0&&k.length===1)return!0;break e}if(y=(C+1)%ne,y<1&&(y+=ne),String(k[0]).length==y){for(y=0;y<k.length;y++)if(P=k[y],P<0||P>=pt||P!==Qe(P))break e;if(P!==0)return!0}}}else if(k===null&&C===null&&($===null||$===1||$===-1))return!0;throw Error(Re+"Invalid BigNumber: "+g)},w.maximum=w.max=function(){return B(arguments,-1)},w.minimum=w.min=function(){return B(arguments,1)},w.random=function(){var g=9007199254740992,y=Math.random()*g&2097151?function(){return Qe(Math.random()*g)}:function(){return(Math.random()*1073741824|0)*8388608+(Math.random()*8388608|0)};return function(P){var k,C,$,S,E,O=0,N=[],b=new w(s);if(P==null?P=i:we(P,0,Ae),S=ni(P/ne),p)if(crypto.getRandomValues){for(k=crypto.getRandomValues(new Uint32Array(S*=2));O<S;)E=k[O]*131072+(k[O+1]>>>11),E>=9e15?(C=crypto.getRandomValues(new Uint32Array(2)),k[O]=C[0],k[O+1]=C[1]):(N.push(E%1e14),O+=2);O=S/2}else if(crypto.randomBytes){for(k=crypto.randomBytes(S*=7);O<S;)E=(k[O]&31)*281474976710656+k[O+1]*1099511627776+k[O+2]*4294967296+k[O+3]*16777216+(k[O+4]<<16)+(k[O+5]<<8)+k[O+6],E>=9e15?crypto.randomBytes(7).copy(k,O):(N.push(E%1e14),O+=7);O=S/7}else throw p=!1,Error(Re+"crypto unavailable");if(!p)for(;O<S;)E=y(),E<9e15&&(N[O++]=E%1e14);for(S=N[--O],P%=ne,S&&P&&(E=oi[ne-P],N[O]=Qe(S/E)*E);N[O]===0;N.pop(),O--);if(O<0)N=[$=0];else{for($=-1;N[0]===0;N.splice(0,1),$-=ne);for(O=1,E=N[0];E>=10;E/=10,O++);O<ne&&($-=ne-O)}return b.e=$,b.c=N,b}}(),w.sum=function(){for(var g=1,y=arguments,P=new w(y[0]);g<y.length;)P=P.plus(y[g++]);return P},n=function(){var g="0123456789";function y(P,k,C,$){for(var S,E=[0],O,N=0,b=P.length;N<b;){for(O=E.length;O--;E[O]*=k);for(E[0]+=$.indexOf(P.charAt(N++)),S=0;S<E.length;S++)E[S]>C-1&&(E[S+1]==null&&(E[S+1]=0),E[S+1]+=E[S]/C|0,E[S]%=C)}return E.reverse()}return function(P,k,C,$,S){var E,O,N,b,M,R,U,j,W=P.indexOf("."),K=i,V=c;for(W>=0&&(b=h,h=0,P=P.replace(".",""),j=new w(k),R=j.pow(P.length-W),h=b,j.c=y(zt(et(R.c),R.e,"0"),10,C,g),j.e=j.c.length),U=y(P,k,C,S?(E=x,g):(E=g,x)),N=b=U.length;U[--b]==0;U.pop());if(!U[0])return E.charAt(0);if(W<0?--N:(R.c=U,R.e=N,R.s=$,R=t(R,j,K,V,C),U=R.c,M=R.r,N=R.e),O=N+K+1,W=U[O],b=C/2,M=M||O<0||U[O+1]!=null,M=V<4?(W!=null||M)&&(V==0||V==(R.s<0?3:2)):W>b||W==b&&(V==4||M||V==6&&U[O-1]&1||V==(R.s<0?8:7)),O<1||!U[0])P=M?zt(E.charAt(1),-K,E.charAt(0)):E.charAt(0);else{if(U.length=O,M)for(--C;++U[--O]>C;)U[O]=0,O||(++N,U=[1].concat(U));for(b=U.length;!U[--b];);for(W=0,P="";W<=b;P+=E.charAt(U[W++]));P=zt(P,N,E.charAt(0))}return P}}(),t=function(){function g(k,C,$){var S,E,O,N,b=0,M=k.length,R=C%un,U=C/un|0;for(k=k.slice();M--;)O=k[M]%un,N=k[M]/un|0,S=U*O+N*R,E=R*O+S%un*un+b,b=(E/$|0)+(S/un|0)+U*N,k[M]=E%$;return b&&(k=[b].concat(k)),k}function y(k,C,$,S){var E,O;if($!=S)O=$>S?1:-1;else for(E=O=0;E<$;E++)if(k[E]!=C[E]){O=k[E]>C[E]?1:-1;break}return O}function P(k,C,$,S){for(var E=0;$--;)k[$]-=E,E=k[$]<C[$]?1:0,k[$]=E*S+k[$]-C[$];for(;!k[0]&&k.length>1;k.splice(0,1));}return function(k,C,$,S,E){var O,N,b,M,R,U,j,W,K,V,Z,H,Y,Q,oe,me,pe,le=k.s==C.s?1:-1,ge=k.c,se=C.c;if(!ge||!ge[0]||!se||!se[0])return new w(!k.s||!C.s||(ge?se&&ge[0]==se[0]:!se)?NaN:ge&&ge[0]==0||!se?le*0:le/0);for(W=new w(le),K=W.c=[],N=k.e-C.e,le=$+N+1,E||(E=pt,N=Je(k.e/ne)-Je(C.e/ne),le=le/ne|0),b=0;se[b]==(ge[b]||0);b++);if(se[b]>(ge[b]||0)&&N--,le<0)K.push(1),M=!0;else{for(Q=ge.length,me=se.length,b=0,le+=2,R=Qe(E/(se[0]+1)),R>1&&(se=g(se,R,E),ge=g(ge,R,E),me=se.length,Q=ge.length),Y=me,V=ge.slice(0,me),Z=V.length;Z<me;V[Z++]=0);pe=se.slice(),pe=[0].concat(pe),oe=se[0],se[1]>=E/2&&oe++;do{if(R=0,O=y(se,V,me,Z),O<0){if(H=V[0],me!=Z&&(H=H*E+(V[1]||0)),R=Qe(H/oe),R>1)for(R>=E&&(R=E-1),U=g(se,R,E),j=U.length,Z=V.length;y(U,V,j,Z)==1;)R--,P(U,me<j?pe:se,j,E),j=U.length,O=1;else R==0&&(O=R=1),U=se.slice(),j=U.length;if(j<Z&&(U=[0].concat(U)),P(V,U,Z,E),Z=V.length,O==-1)for(;y(se,V,me,Z)<1;)R++,P(V,me<Z?pe:se,Z,E),Z=V.length}else O===0&&(R++,V=[0]);K[b++]=R,V[0]?V[Z++]=ge[Y]||0:(V=[ge[Y]],Z=1)}while((Y++<Q||V[0]!=null)&&le--);M=V[0]!=null,K[0]||K.splice(0,1)}if(E==pt){for(b=1,le=K[0];le>=10;le/=10,b++);F(W,$+(W.e=b+N*ne-1)+1,S,M)}else W.e=N,W.r=+M;return W}}();function T(g,y,P,k){var C,$,S,E,O;if(P==null?P=c:we(P,0,8),!g.c)return g.toString();if(C=g.c[0],S=g.e,y==null)O=et(g.c),O=k==1||k==2&&(S<=a||S>=l)?Fo(O,S):zt(O,S,"0");else if(g=F(new w(g),y,P),$=g.e,O=et(g.c),E=O.length,k==1||k==2&&(y<=$||$<=a)){for(;E<y;O+="0",E++);O=Fo(O,$)}else if(y-=S+(k===2&&$>S),O=zt(O,$,"0"),$+1>E){if(--y>0)for(O+=".";y--;O+="0");}else if(y+=$-E,y>0)for($+1==E&&(O+=".");y--;O+="0");return g.s<0&&C?"-"+O:O}function B(g,y){for(var P,k,C=1,$=new w(g[0]);C<g.length;C++)k=new w(g[C]),(!k.s||(P=Pn($,k))===y||P===0&&$.s===y)&&($=k);return $}function L(g,y,P){for(var k=1,C=y.length;!y[--C];y.pop());for(C=y[0];C>=10;C/=10,k++);return(P=k+P*ne-1)>f?g.c=g.e=null:P<u?g.c=[g.e=0]:(g.e=P,g.c=y),g}r=function(){var g=/^(-?)0([xbo])(?=\w[\w.]*$)/i,y=/^([^.]+)\.$/,P=/^\.([^.]+)$/,k=/^-?(Infinity|NaN)$/,C=/^\s*\+(?=[\w.])|^\s+|\s+$/g;return function($,S,E,O){var N,b=E?S:S.replace(C,"");if(k.test(b))$.s=isNaN(b)?null:b<0?-1:1;else{if(!E&&(b=b.replace(g,function(M,R,U){return N=(U=U.toLowerCase())=="x"?16:U=="b"?2:8,!O||O==N?R:M}),O&&(N=O,b=b.replace(y,"$1").replace(P,"0.$1")),S!=b))return new w(b,N);if(w.DEBUG)throw Error(Re+"Not a"+(O?" base "+O:"")+" number: "+S);$.s=null}$.c=$.e=null}}();function F(g,y,P,k){var C,$,S,E,O,N,b,M=g.c,R=oi;if(M){e:{for(C=1,E=M[0];E>=10;E/=10,C++);if($=y-C,$<0)$+=ne,S=y,O=M[N=0],b=Qe(O/R[C-S-1]%10);else if(N=ni(($+1)/ne),N>=M.length)if(k){for(;M.length<=N;M.push(0));O=b=0,C=1,$%=ne,S=$-ne+1}else break e;else{for(O=E=M[N],C=1;E>=10;E/=10,C++);$%=ne,S=$-ne+C,b=S<0?0:Qe(O/R[C-S-1]%10)}if(k=k||y<0||M[N+1]!=null||(S<0?O:O%R[C-S-1]),k=P<4?(b||k)&&(P==0||P==(g.s<0?3:2)):b>5||b==5&&(P==4||k||P==6&&($>0?S>0?O/R[C-S]:0:M[N-1])%10&1||P==(g.s<0?8:7)),y<1||!M[0])return M.length=0,k?(y-=g.e+1,M[0]=R[(ne-y%ne)%ne],g.e=-y||0):M[0]=g.e=0,g;if($==0?(M.length=N,E=1,N--):(M.length=N+1,E=R[ne-$],M[N]=S>0?Qe(O/R[C-S]%R[S])*E:0),k)for(;;)if(N==0){for($=1,S=M[0];S>=10;S/=10,$++);for(S=M[0]+=E,E=1;S>=10;S/=10,E++);$!=E&&(g.e++,M[0]==pt&&(M[0]=1));break}else{if(M[N]+=E,M[N]!=pt)break;M[N--]=0,E=1}for($=M.length;M[--$]===0;M.pop());}g.e>f?g.c=g.e=null:g.e<u&&(g.c=[g.e=0])}return g}function _(g){var y,P=g.e;return P===null?g.toString():(y=et(g.c),y=P<=a||P>=l?Fo(y,P):zt(y,P,"0"),g.s<0?"-"+y:y)}return o.absoluteValue=o.abs=function(){var g=new w(this);return g.s<0&&(g.s=1),g},o.comparedTo=function(g,y){return Pn(this,new w(g,y))},o.decimalPlaces=o.dp=function(g,y){var P,k,C,$=this;if(g!=null)return we(g,0,Ae),y==null?y=c:we(y,0,8),F(new w($),g+$.e+1,y);if(!(P=$.c))return null;if(k=((C=P.length-1)-Je(this.e/ne))*ne,C=P[C])for(;C%10==0;C/=10,k--);return k<0&&(k=0),k},o.dividedBy=o.div=function(g,y){return t(this,new w(g,y),i,c)},o.dividedToIntegerBy=o.idiv=function(g,y){return t(this,new w(g,y),0,1)},o.exponentiatedBy=o.pow=function(g,y){var P,k,C,$,S,E,O,N,b,M=this;if(g=new w(g),g.c&&!g.isInteger())throw Error(Re+"Exponent not an integer: "+_(g));if(y!=null&&(y=new w(y)),E=g.e>14,!M.c||!M.c[0]||M.c[0]==1&&!M.e&&M.c.length==1||!g.c||!g.c[0])return b=new w(Math.pow(+_(M),E?g.s*(2-Do(g)):+_(g))),y?b.mod(y):b;if(O=g.s<0,y){if(y.c?!y.c[0]:!y.s)return new w(NaN);k=!O&&M.isInteger()&&y.isInteger(),k&&(M=M.mod(y))}else{if(g.e>9&&(M.e>0||M.e<-1||(M.e==0?M.c[0]>1||E&&M.c[1]>=24e7:M.c[0]<8e13||E&&M.c[0]<=9999975e7)))return $=M.s<0&&Do(g)?-0:0,M.e>-1&&($=1/$),new w(O?1/$:$);h&&($=ni(h/ne+2))}for(E?(P=new w(.5),O&&(g.s=1),N=Do(g)):(C=Math.abs(+_(g)),N=C%2),b=new w(s);;){if(N){if(b=b.times(M),!b.c)break;$?b.c.length>$&&(b.c.length=$):k&&(b=b.mod(y))}if(C){if(C=Qe(C/2),C===0)break;N=C%2}else if(g=g.times(P),F(g,g.e+1,1),g.e>14)N=Do(g);else{if(C=+_(g),C===0)break;N=C%2}M=M.times(M),$?M.c&&M.c.length>$&&(M.c.length=$):k&&(M=M.mod(y))}return k?b:(O&&(b=s.div(b)),y?b.mod(y):$?F(b,h,c,S):b)},o.integerValue=function(g){var y=new w(this);return g==null?g=c:we(g,0,8),F(y,y.e+1,g)},o.isEqualTo=o.eq=function(g,y){return Pn(this,new w(g,y))===0},o.isFinite=function(){return!!this.c},o.isGreaterThan=o.gt=function(g,y){return Pn(this,new w(g,y))>0},o.isGreaterThanOrEqualTo=o.gte=function(g,y){return(y=Pn(this,new w(g,y)))===1||y===0},o.isInteger=function(){return!!this.c&&Je(this.e/ne)>this.c.length-2},o.isLessThan=o.lt=function(g,y){return Pn(this,new w(g,y))<0},o.isLessThanOrEqualTo=o.lte=function(g,y){return(y=Pn(this,new w(g,y)))===-1||y===0},o.isNaN=function(){return!this.s},o.isNegative=function(){return this.s<0},o.isPositive=function(){return this.s>0},o.isZero=function(){return!!this.c&&this.c[0]==0},o.minus=function(g,y){var P,k,C,$,S=this,E=S.s;if(g=new w(g,y),y=g.s,!E||!y)return new w(NaN);if(E!=y)return g.s=-y,S.plus(g);var O=S.e/ne,N=g.e/ne,b=S.c,M=g.c;if(!O||!N){if(!b||!M)return b?(g.s=-y,g):new w(M?S:NaN);if(!b[0]||!M[0])return M[0]?(g.s=-y,g):new w(b[0]?S:c==3?-0:0)}if(O=Je(O),N=Je(N),b=b.slice(),E=O-N){for(($=E<0)?(E=-E,C=b):(N=O,C=M),C.reverse(),y=E;y--;C.push(0));C.reverse()}else for(k=($=(E=b.length)<(y=M.length))?E:y,E=y=0;y<k;y++)if(b[y]!=M[y]){$=b[y]<M[y];break}if($&&(C=b,b=M,M=C,g.s=-g.s),y=(k=M.length)-(P=b.length),y>0)for(;y--;b[P++]=0);for(y=pt-1;k>E;){if(b[--k]<M[k]){for(P=k;P&&!b[--P];b[P]=y);--b[P],b[k]+=pt}b[k]-=M[k]}for(;b[0]==0;b.splice(0,1),--N);return b[0]?L(g,b,N):(g.s=c==3?-1:1,g.c=[g.e=0],g)},o.modulo=o.mod=function(g,y){var P,k,C=this;return g=new w(g,y),!C.c||!g.s||g.c&&!g.c[0]?new w(NaN):!g.c||C.c&&!C.c[0]?new w(C):(d==9?(k=g.s,g.s=1,P=t(C,g,0,3),g.s=k,P.s*=k):P=t(C,g,0,d),g=C.minus(P.times(g)),!g.c[0]&&d==1&&(g.s=C.s),g)},o.multipliedBy=o.times=function(g,y){var P,k,C,$,S,E,O,N,b,M,R,U,j,W,K,V=this,Z=V.c,H=(g=new w(g,y)).c;if(!Z||!H||!Z[0]||!H[0])return!V.s||!g.s||Z&&!Z[0]&&!H||H&&!H[0]&&!Z?g.c=g.e=g.s=null:(g.s*=V.s,!Z||!H?g.c=g.e=null:(g.c=[0],g.e=0)),g;for(k=Je(V.e/ne)+Je(g.e/ne),g.s*=V.s,O=Z.length,M=H.length,O<M&&(j=Z,Z=H,H=j,C=O,O=M,M=C),C=O+M,j=[];C--;j.push(0));for(W=pt,K=un,C=M;--C>=0;){for(P=0,R=H[C]%K,U=H[C]/K|0,S=O,$=C+S;$>C;)N=Z[--S]%K,b=Z[S]/K|0,E=U*N+b*R,N=R*N+E%K*K+j[$]+P,P=(N/W|0)+(E/K|0)+U*b,j[$--]=N%W;j[$]=P}return P?++k:j.splice(0,1),L(g,j,k)},o.negated=function(){var g=new w(this);return g.s=-g.s||null,g},o.plus=function(g,y){var P,k=this,C=k.s;if(g=new w(g,y),y=g.s,!C||!y)return new w(NaN);if(C!=y)return g.s=-y,k.minus(g);var $=k.e/ne,S=g.e/ne,E=k.c,O=g.c;if(!$||!S){if(!E||!O)return new w(C/0);if(!E[0]||!O[0])return O[0]?g:new w(E[0]?k:C*0)}if($=Je($),S=Je(S),E=E.slice(),C=$-S){for(C>0?(S=$,P=O):(C=-C,P=E),P.reverse();C--;P.push(0));P.reverse()}for(C=E.length,y=O.length,C-y<0&&(P=O,O=E,E=P,y=C),C=0;y;)C=(E[--y]=E[y]+O[y]+C)/pt|0,E[y]=pt===E[y]?0:E[y]%pt;return C&&(E=[C].concat(E),++S),L(g,E,S)},o.precision=o.sd=function(g,y){var P,k,C,$=this;if(g!=null&&g!==!!g)return we(g,1,Ae),y==null?y=c:we(y,0,8),F(new w($),g,y);if(!(P=$.c))return null;if(C=P.length-1,k=C*ne+1,C=P[C]){for(;C%10==0;C/=10,k--);for(C=P[0];C>=10;C/=10,k++);}return g&&$.e+1>k&&(k=$.e+1),k},o.shiftedBy=function(g){return we(g,-ri,ri),this.times("1e"+g)},o.squareRoot=o.sqrt=function(){var g,y,P,k,C,$=this,S=$.c,E=$.s,O=$.e,N=i+4,b=new w("0.5");if(E!==1||!S||!S[0])return new w(!E||E<0&&(!S||S[0])?NaN:S?$:1/0);if(E=Math.sqrt(+_($)),E==0||E==1/0?(y=et(S),(y.length+O)%2==0&&(y+="0"),E=Math.sqrt(+y),O=Je((O+1)/2)-(O<0||O%2),E==1/0?y="5e"+O:(y=E.toExponential(),y=y.slice(0,y.indexOf("e")+1)+O),P=new w(y)):P=new w(E+""),P.c[0]){for(O=P.e,E=O+N,E<3&&(E=0);;)if(C=P,P=b.times(C.plus(t($,C,N,1))),et(C.c).slice(0,E)===(y=et(P.c)).slice(0,E))if(P.e<O&&--E,y=y.slice(E-3,E+1),y=="9999"||!k&&y=="4999"){if(!k&&(F(C,C.e+i+2,0),C.times(C).eq($))){P=C;break}N+=4,E+=4,k=1}else{(!+y||!+y.slice(1)&&y.charAt(0)=="5")&&(F(P,P.e+i+2,1),g=!P.times(P).eq($));break}}return F(P,P.e+i+1,c,g)},o.toExponential=function(g,y){return g!=null&&(we(g,0,Ae),g++),T(this,g,y,1)},o.toFixed=function(g,y){return g!=null&&(we(g,0,Ae),g=g+this.e+1),T(this,g,y)},o.toFormat=function(g,y,P){var k,C=this;if(P==null)g!=null&&y&&typeof y=="object"?(P=y,y=null):g&&typeof g=="object"?(P=g,g=y=null):P=m;else if(typeof P!="object")throw Error(Re+"Argument not an object: "+P);if(k=C.toFixed(g,y),C.c){var $,S=k.split("."),E=+P.groupSize,O=+P.secondaryGroupSize,N=P.groupSeparator||"",b=S[0],M=S[1],R=C.s<0,U=R?b.slice(1):b,j=U.length;if(O&&($=E,E=O,O=$,j-=$),E>0&&j>0){for($=j%E||E,b=U.substr(0,$);$<j;$+=E)b+=N+U.substr($,E);O>0&&(b+=N+U.slice($)),R&&(b="-"+b)}k=M?b+(P.decimalSeparator||"")+((O=+P.fractionGroupSize)?M.replace(new RegExp("\\d{"+O+"}\\B","g"),"$&"+(P.fractionGroupSeparator||"")):M):b}return(P.prefix||"")+k+(P.suffix||"")},o.toFraction=function(g){var y,P,k,C,$,S,E,O,N,b,M,R,U=this,j=U.c;if(g!=null&&(E=new w(g),!E.isInteger()&&(E.c||E.s!==1)||E.lt(s)))throw Error(Re+"Argument "+(E.isInteger()?"out of range: ":"not an integer: ")+_(E));if(!j)return new w(U);for(y=new w(s),N=P=new w(s),k=O=new w(s),R=et(j),$=y.e=R.length-U.e-1,y.c[0]=oi[(S=$%ne)<0?ne+S:S],g=!g||E.comparedTo(y)>0?$>0?y:N:E,S=f,f=1/0,E=new w(R),O.c[0]=0;b=t(E,y,0,1),C=P.plus(b.times(k)),C.comparedTo(g)!=1;)P=k,k=C,N=O.plus(b.times(C=N)),O=C,y=E.minus(b.times(C=y)),E=C;return C=t(g.minus(P),k,0,1),O=O.plus(C.times(N)),P=P.plus(C.times(k)),O.s=N.s=U.s,$=$*2,M=t(N,k,$,c).minus(U).abs().comparedTo(t(O,P,$,c).minus(U).abs())<1?[N,k]:[O,P],f=S,M},o.toNumber=function(){return+_(this)},o.toPrecision=function(g,y){return g!=null&&we(g,1,Ae),T(this,g,y,2)},o.toString=function(g){var y,P=this,k=P.s,C=P.e;return C===null?k?(y="Infinity",k<0&&(y="-"+y)):y="NaN":(g==null?y=C<=a||C>=l?Fo(et(P.c),C):zt(et(P.c),C,"0"):g===10&&A?(P=F(new w(P),i+C+1,c),y=zt(et(P.c),P.e,"0")):(we(g,2,x.length,"Base"),y=n(zt(et(P.c),C,"0"),10,g,k,!0)),k<0&&P.c[0]&&(y="-"+y)),y},o.valueOf=o.toJSON=function(){return _(this)},o._isBigNumber=!0,o[Symbol.toStringTag]="BigNumber",o[Symbol.for("nodejs.util.inspect.custom")]=o.valueOf,e!=null&&w.set(e),w}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 Pn(e,t){var n,r,o=e.c,s=t.c,i=e.s,c=t.s,a=e.e,l=t.e;if(!i||!c)return null;if(n=o&&!o[0],r=s&&!s[0],n||r)return n?r?0:-c:i;if(i!=c)return i;if(n=i<0,r=a==l,!o||!s)return r?0:!o^n?1:-1;if(!r)return a>l^n?1:-1;for(c=(a=o.length)<(l=s.length)?a:l,i=0;i<c;i++)if(o[i]!=s[i])return o[i]>s[i]^n?1:-1;return a==l?0:a>l^n?1:-1}function we(e,t,n,r){if(e<t||e>n||e!==Qe(e))throw Error(Re+(r||"Argument")+(typeof e=="number"?e<t||e>n?" out of range: ":" not an integer: ":" not a primitive number: ")+String(e))}function Do(e){var t=e.c.length-1;return Je(e.e/ne)==t&&e.c[t]%2!=0}function Fo(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 Ce=pl();const um=(e,t=6)=>{try{const n=new Ce(e||"0");if(n.isNaN())return"0";const r=n.decimalPlaces(t,Ce.ROUND_DOWN),[o,s=""]=r.toString().split("."),i=o.replace(/\B(?=(\d{3})+(?!\d))/g,",");if(t>0){const c=(s||"").padEnd(t,"0");return`${i}.${c}`}return i}catch(n){return console.warn("formatThousands error:",n),"0"}},ht=()=>{const{translations:e,currentLocale:t}=fl();return{t:(s,i)=>{try{const c=s.split(".");let a=e;for(const u of c)if(a&&typeof a=="object"&&u in a)a=a[u];else return s;let l=typeof a=="string"?a:s;return i&&typeof l=="string"&&Object.keys(i).forEach(u=>{const f=`{{${u}}}`;l=l.replace(new RegExp(f,"g"),String(i[u]))}),l}catch(c){return console.warn(`Translation error for key "${s}":`,c),s}},translations:e,locale:t,getTranslationObject:s=>{try{const i=s.split(".");let c=e;for(const a of i)if(c&&typeof c=="object"&&a in c)c=c[a];else return{};return typeof c=="object"?c:{}}catch(i){return console.warn(`Translation object error for key "${s}":`,i),{}}},hasTranslation:s=>{try{const i=s.split(".");let c=e;for(const a of i)if(c&&typeof c=="object"&&a in c)c=c[a];else return!1;return typeof c=="string"}catch{return!1}}}},fm="1.0.8";let Ze=class ol extends Error{constructor(t,n={}){var i;const r=n.cause instanceof ol?n.cause.details:(i=n.cause)!=null&&i.message?n.cause.message:n.details,o=n.cause instanceof ol&&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@${fm}`].join(`
41
+ `);super(s),Object.defineProperty(this,"details",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docsPath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"metaMessages",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"shortMessage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiTypeError"}),n.cause&&(this.cause=n.cause),this.details=r,this.docsPath=o,this.metaMessages=n.metaMessages,this.shortMessage=t}};function Ht(e,t){const n=e.exec(t);return n==null?void 0:n.groups}const hl=/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/,ml=/^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)?$/,gl=/^\(.+?\).*?$/,bl=/^tuple(?<array>(\[(\d*)\])*)$/;function si(e){let t=e.type;if(bl.test(e.type)&&"components"in e){t="(";const n=e.components.length;for(let o=0;o<n;o++){const s=e.components[o];t+=si(s),o<n-1&&(t+=", ")}const r=Ht(bl,e.type);return t+=`)${(r==null?void 0:r.array)??""}`,si({...e,type:t})}return"indexed"in e&&e.indexed&&(t=`${t} indexed`),e.name?`${t} ${e.name}`:t}function Mr(e){let t="";const n=e.length;for(let r=0;r<n;r++){const o=e[r];t+=si(o),r!==n-1&&(t+=", ")}return t}function Ro(e){var t;return e.type==="function"?`function ${e.name}(${Mr(e.inputs)})${e.stateMutability&&e.stateMutability!=="nonpayable"?` ${e.stateMutability}`:""}${(t=e.outputs)!=null&&t.length?` returns (${Mr(e.outputs)})`:""}`:e.type==="event"?`event ${e.name}(${Mr(e.inputs)})`:e.type==="error"?`error ${e.name}(${Mr(e.inputs)})`:e.type==="constructor"?`constructor(${Mr(e.inputs)})${e.stateMutability==="payable"?" payable":""}`:e.type==="fallback"?`fallback() external${e.stateMutability==="payable"?" payable":""}`:"receive() external payable"}const yl=/^error (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*)\((?<parameters>.*?)\)$/;function dm(e){return yl.test(e)}function pm(e){return Ht(yl,e)}const wl=/^event (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*)\((?<parameters>.*?)\)$/;function hm(e){return wl.test(e)}function mm(e){return Ht(wl,e)}const vl=/^function (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*)\((?<parameters>.*?)\)(?: (?<scope>external|public{1}))?(?: (?<stateMutability>pure|view|nonpayable|payable{1}))?(?: returns\s?\((?<returns>.*?)\))?$/;function gm(e){return vl.test(e)}function bm(e){return Ht(vl,e)}const xl=/^struct (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*) \{(?<properties>.*?)\}$/;function ii(e){return xl.test(e)}function ym(e){return Ht(xl,e)}const El=/^constructor\((?<parameters>.*?)\)(?:\s(?<stateMutability>payable{1}))?$/;function wm(e){return El.test(e)}function vm(e){return Ht(El,e)}const Sl=/^fallback\(\) external(?:\s(?<stateMutability>payable{1}))?$/;function xm(e){return Sl.test(e)}function Em(e){return Ht(Sl,e)}const Sm=/^receive\(\) external payable$/;function Pm(e){return Sm.test(e)}const $m=new Set(["indexed"]),ai=new Set(["calldata","memory","storage"]);class Tm extends Ze{constructor({signature:t}){super("Failed to parse ABI item.",{details:`parseAbiItem(${JSON.stringify(t,null,2)})`,docsPath:"/api/human#parseabiitem-1"}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidAbiItemError"})}}class Am extends Ze{constructor({type:t}){super("Unknown type.",{metaMessages:[`Type "${t}" is not a valid ABI type. Perhaps you forgot to include a struct signature?`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"UnknownTypeError"})}}class Nm extends Ze{constructor({type:t}){super("Unknown type.",{metaMessages:[`Type "${t}" is not a valid ABI type.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"UnknownSolidityTypeError"})}}class Om extends Ze{constructor({param:t}){super("Invalid ABI parameter.",{details:t}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidParameterError"})}}class Cm extends Ze{constructor({param:t,name:n}){super("Invalid ABI parameter.",{details:t,metaMessages:[`"${n}" is a protected Solidity keyword. More info: https://docs.soliditylang.org/en/latest/cheatsheet.html`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"SolidityProtectedKeywordError"})}}class Im extends Ze{constructor({param:t,type:n,modifier:r}){super("Invalid ABI parameter.",{details:t,metaMessages:[`Modifier "${r}" not allowed${n?` in "${n}" type`:""}.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidModifierError"})}}class Mm extends Ze{constructor({param:t,type:n,modifier:r}){super("Invalid ABI parameter.",{details:t,metaMessages:[`Modifier "${r}" not allowed${n?` in "${n}" type`:""}.`,`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 km extends Ze{constructor({abiParameter:t}){super("Invalid ABI parameter.",{details:JSON.stringify(t,null,2),metaMessages:["ABI parameter type is invalid."]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidAbiTypeParameterError"})}}class Kn extends Ze{constructor({signature:t,type:n}){super(`Invalid ${n} signature.`,{details:t}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidSignatureError"})}}class Bm extends Ze{constructor({signature:t}){super("Unknown signature.",{details:t}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"UnknownSignatureError"})}}class Lm extends Ze{constructor({signature:t}){super("Invalid struct signature.",{details:t,metaMessages:["No properties exist."]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidStructSignatureError"})}}class Dm extends Ze{constructor({type:t}){super("Circular reference detected.",{metaMessages:[`Struct "${t}" is a circular reference.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"CircularReferenceError"})}}class Fm extends Ze{constructor({current:t,depth:n}){super("Unbalanced parentheses.",{metaMessages:[`"${t.trim()}" has too many ${n>0?"opening":"closing"} parentheses.`],details:`Depth "${n}"`}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidParenthesisError"})}}function Rm(e,t,n){let r="";if(n)for(const o of Object.entries(n)){if(!o)continue;let s="";for(const i of o[1])s+=`[${i.type}${i.name?`:${i.name}`:""}]`;r+=`(${o[0]}{${s}})`}return t?`${t}:${e}${r}`:e}const ci=new Map([["address",{type:"address"}],["bool",{type:"bool"}],["bytes",{type:"bytes"}],["bytes32",{type:"bytes32"}],["int",{type:"int256"}],["int256",{type:"int256"}],["string",{type:"string"}],["uint",{type:"uint256"}],["uint8",{type:"uint8"}],["uint16",{type:"uint16"}],["uint24",{type:"uint24"}],["uint32",{type:"uint32"}],["uint64",{type:"uint64"}],["uint96",{type:"uint96"}],["uint112",{type:"uint112"}],["uint160",{type:"uint160"}],["uint192",{type:"uint192"}],["uint256",{type:"uint256"}],["address owner",{type:"address",name:"owner"}],["address to",{type:"address",name:"to"}],["bool approved",{type:"bool",name:"approved"}],["bytes _data",{type:"bytes",name:"_data"}],["bytes data",{type:"bytes",name:"data"}],["bytes signature",{type:"bytes",name:"signature"}],["bytes32 hash",{type:"bytes32",name:"hash"}],["bytes32 r",{type:"bytes32",name:"r"}],["bytes32 root",{type:"bytes32",name:"root"}],["bytes32 s",{type:"bytes32",name:"s"}],["string name",{type:"string",name:"name"}],["string symbol",{type:"string",name:"symbol"}],["string tokenURI",{type:"string",name:"tokenURI"}],["uint tokenId",{type:"uint256",name:"tokenId"}],["uint8 v",{type:"uint8",name:"v"}],["uint256 balance",{type:"uint256",name:"balance"}],["uint256 tokenId",{type:"uint256",name:"tokenId"}],["uint256 value",{type:"uint256",name:"value"}],["event:address indexed from",{type:"address",name:"from",indexed:!0}],["event:address indexed to",{type:"address",name:"to",indexed:!0}],["event:uint indexed tokenId",{type:"uint256",name:"tokenId",indexed:!0}],["event:uint256 indexed tokenId",{type:"uint256",name:"tokenId",indexed:!0}]]);function li(e,t={}){if(gm(e))return jm(e,t);if(hm(e))return _m(e,t);if(dm(e))return Um(e,t);if(wm(e))return zm(e,t);if(xm(e))return Hm(e);if(Pm(e))return{type:"receive",stateMutability:"payable"};throw new Bm({signature:e})}function jm(e,t={}){const n=bm(e);if(!n)throw new Kn({signature:e,type:"function"});const r=mt(n.parameters),o=[],s=r.length;for(let c=0;c<s;c++)o.push($n(r[c],{modifiers:ai,structs:t,type:"function"}));const i=[];if(n.returns){const c=mt(n.returns),a=c.length;for(let l=0;l<a;l++)i.push($n(c[l],{modifiers:ai,structs:t,type:"function"}))}return{name:n.name,type:"function",stateMutability:n.stateMutability??"nonpayable",inputs:o,outputs:i}}function _m(e,t={}){const n=mm(e);if(!n)throw new Kn({signature:e,type:"event"});const r=mt(n.parameters),o=[],s=r.length;for(let i=0;i<s;i++)o.push($n(r[i],{modifiers:$m,structs:t,type:"event"}));return{name:n.name,type:"event",inputs:o}}function Um(e,t={}){const n=pm(e);if(!n)throw new Kn({signature:e,type:"error"});const r=mt(n.parameters),o=[],s=r.length;for(let i=0;i<s;i++)o.push($n(r[i],{structs:t,type:"error"}));return{name:n.name,type:"error",inputs:o}}function zm(e,t={}){const n=vm(e);if(!n)throw new Kn({signature:e,type:"constructor"});const r=mt(n.parameters),o=[],s=r.length;for(let i=0;i<s;i++)o.push($n(r[i],{structs:t,type:"constructor"}));return{type:"constructor",stateMutability:n.stateMutability??"nonpayable",inputs:o}}function Hm(e){const t=Em(e);if(!t)throw new Kn({signature:e,type:"fallback"});return{type:"fallback",stateMutability:t.stateMutability??"nonpayable"}}const Wm=/^(?<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$_]*))?$/,Vm=/^\((?<type>.+?)\)(?<array>(?:\[\d*?\])+?)?(?:\s(?<modifier>calldata|indexed|memory|storage{1}))?(?:\s(?<name>[a-zA-Z$_][a-zA-Z0-9$_]*))?$/,Gm=/^u?int$/;function $n(e,t){var f,p;const n=Rm(e,t==null?void 0:t.type,t==null?void 0:t.structs);if(ci.has(n))return ci.get(n);const r=gl.test(e),o=Ht(r?Vm:Wm,e);if(!o)throw new Om({param:e});if(o.name&&Zm(o.name))throw new Cm({param:e,name:o.name});const s=o.name?{name:o.name}:{},i=o.modifier==="indexed"?{indexed:!0}:{},c=(t==null?void 0:t.structs)??{};let a,l={};if(r){a="tuple";const d=mt(o.type),h=[],m=d.length;for(let x=0;x<m;x++)h.push($n(d[x],{structs:c}));l={components:h}}else if(o.type in c)a="tuple",l={components:c[o.type]};else if(Gm.test(o.type))a=`${o.type}256`;else if(a=o.type,(t==null?void 0:t.type)!=="struct"&&!Pl(a))throw new Nm({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 Im({param:e,type:t==null?void 0:t.type,modifier:o.modifier});if(ai.has(o.modifier)&&!Km(a,!!o.array))throw new Mm({param:e,type:t==null?void 0:t.type,modifier:o.modifier})}const u={type:`${a}${o.array??""}`,...s,...i,...l};return ci.set(n,u),u}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 Fm({current:n,depth:r});return t.push(n.trim()),t}function Pl(e){return e==="address"||e==="bool"||e==="function"||e==="string"||hl.test(e)||ml.test(e)}const qm=/^(?: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 Zm(e){return e==="address"||e==="bool"||e==="function"||e==="string"||e==="tuple"||hl.test(e)||ml.test(e)||qm.test(e)}function Km(e,t){return t||e==="bytes"||e==="string"||e==="tuple"}function $l(e){const t={},n=e.length;for(let i=0;i<n;i++){const c=e[i];if(!ii(c))continue;const a=ym(c);if(!a)throw new Kn({signature:c,type:"struct"});const l=a.properties.split(";"),u=[],f=l.length;for(let p=0;p<f;p++){const h=l[p].trim();if(!h)continue;const m=$n(h,{type:"struct"});u.push(m)}if(!u.length)throw new Lm({signature:c});t[a.name]=u}const r={},o=Object.entries(t),s=o.length;for(let i=0;i<s;i++){const[c,a]=o[i];r[c]=Tl(a,t)}return r}const Ym=/^(?<type>[a-zA-Z$_][a-zA-Z0-9$_]*)(?<array>(?:\[\d*?\])+?)?$/;function Tl(e,t,n=new Set){const r=[],o=e.length;for(let s=0;s<o;s++){const i=e[s];if(gl.test(i.type))r.push(i);else{const a=Ht(Ym,i.type);if(!(a!=null&&a.type))throw new km({abiParameter:i});const{array:l,type:u}=a;if(u in t){if(n.has(u))throw new Dm({type:u});r.push({...i,type:`tuple${l??""}`,components:Tl(t[u]??[],t,new Set([...n,u]))})}else if(Pl(u))r.push(i);else throw new Am({type:u})}}return r}function Al(e){const t=$l(e),n=[],r=e.length;for(let o=0;o<r;o++){const s=e[o];ii(s)||n.push(li(s,t))}return n}function Nl(e){let t;if(typeof e=="string")t=li(e);else{const n=$l(e),r=e.length;for(let o=0;o<r;o++){const s=e[o];if(!ii(s)){t=li(s,n);break}}}if(!t)throw new Tm({signature:e});return t}function ee(e,t,n){const r=e[t.name];if(typeof r=="function")return r;const o=e[n];return typeof o=="function"?o:s=>t(e,s)}function gt(e,{includeName:t=!1}={}){if(e.type!=="function"&&e.type!=="event"&&e.type!=="error")throw new lg(e.type);return`${e.name}(${jo(e.inputs,{includeName:t})})`}function jo(e,{includeName:t=!1}={}){return e?e.map(n=>Xm(n,{includeName:t})).join(t?", ":","):""}function Xm(e,{includeName:t}){return e.type.startsWith("tuple")?`(${jo(e.components,{includeName:t})})${e.type.slice(5)}`:e.type+(t&&e.name?` ${e.name}`:"")}function bt(e,{strict:t=!0}={}){return!e||typeof e!="string"?!1:t?/^0x[0-9a-fA-F]*$/.test(e):e.startsWith("0x")}function xe(e){return bt(e,{strict:!1})?Math.ceil((e.length-2)/2):e.length}const Ol="2.34.0";let kr={getDocsUrl:({docsBaseUrl:e,docsPath:t="",docsSlug:n})=>t?`${e??"https://viem.sh"}${t}${n?`#${n}`:""}`:void 0,version:`viem@${Ol}`},G=class sl extends Error{constructor(t,n={}){var c;const r=(()=>{var a;return n.cause instanceof sl?n.cause.details:(a=n.cause)!=null&&a.message?n.cause.message:n.details})(),o=n.cause instanceof sl&&n.cause.docsPath||n.docsPath,s=(c=kr.getDocsUrl)==null?void 0:c.call(kr,{...n,docsPath:o}),i=[t||"An error occurred.","",...n.metaMessages?[...n.metaMessages,""]:[],...s?[`Docs: ${s}`]:[],...r?[`Details: ${r}`]:[],...kr.version?[`Version: ${kr.version}`]:[]].join(`
42
42
  `);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=Ol}walk(t){return Cl(this,t)}};function Cl(e,t){return t!=null&&t(e)?e:e&&typeof e=="object"&&"cause"in e&&e.cause!==void 0?Cl(e.cause,t):t?null:e}class Qm extends G{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(`
43
43
  `),{docsPath:t,name:"AbiConstructorNotFoundError"})}}class Il extends G{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(`
44
44
  `),{docsPath:t,name:"AbiConstructorParamsNotFoundError"})}}class Ml extends G{constructor({data:t,params:n,size:r}){super([`Data size of ${r} bytes is too small for given parameters.`].join(`
@@ -58,7 +58,7 @@ React keys must be passed directly to JSX without using spread:
58
58
  `),{docsPath:n,name:"InvalidAbiEncodingType"})}}class cg extends G{constructor(t,{docsPath:n}){super([`Type "${t}" is not a valid decoding type.`,"Please provide a valid ABI type."].join(`
59
59
  `),{docsPath:n,name:"InvalidAbiDecodingType"})}}let Rl=class extends G{constructor(t){super([`Value "${t}" is not a valid array.`].join(`
60
60
  `),{name:"InvalidArrayError"})}};class lg extends G{constructor(t){super([`"${t}" is not a valid definition type.`,'Valid types: "function", "event", "error"'].join(`
61
- `),{name:"InvalidDefinitionTypeError"})}}class ug extends G{constructor(t){super(`Filter type "${t}" is not supported.`,{name:"FilterTypeNotSupportedError"})}}let jl=class extends G{constructor({offset:t,position:n,size:r}){super(`Slice ${n==="start"?"starting":"ending"} at offset "${t}" is out-of-bounds (size: ${r}).`,{name:"SliceOffsetOutOfBoundsError"})}},_l=class extends G{constructor({size:t,targetSize:n,type:r}){super(`${r.charAt(0).toUpperCase()}${r.slice(1).toLowerCase()} size (${t}) exceeds padding size (${n}).`,{name:"SizeExceedsPaddingSizeError"})}};class Ul extends G{constructor({size:t,targetSize:n,type:r}){super(`${r.charAt(0).toUpperCase()}${r.slice(1).toLowerCase()} is expected to be ${n} ${r} long, but is ${t} ${r} long.`,{name:"InvalidBytesLengthError"})}}function Xn(e,{dir:t,size:n=32}={}){return typeof e=="string"?fn(e,{dir:t,size:n}):fg(e,{dir:t,size:n})}function fn(e,{dir:t,size:n=32}={}){if(n===null)return e;const r=e.replace("0x","");if(r.length>n*2)throw new _l({size:Math.ceil(r.length/2),targetSize:n,type:"hex"});return`0x${r[t==="right"?"padEnd":"padStart"](n*2,"0")}`}function fg(e,{dir:t,size:n=32}={}){if(n===null)return e;if(e.length>n)throw new _l({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 zl=class extends G{constructor({max:t,min:n,signed:r,size:o,value:s}){super(`Number "${s}" is not in safe ${o?`${o*8}-bit ${r?"signed":"unsigned"} `:""}integer range ${t?`(${n} to ${t})`:`(above ${n})`}`,{name:"IntegerOutOfRangeError"})}};class dg extends G{constructor(t){super(`Bytes value "${t}" is not a valid boolean. The bytes array must contain a single byte of either a 0 or 1 value.`,{name:"InvalidBytesBooleanError"})}}class pg extends G{constructor(t){super(`Hex value "${t}" is not a valid boolean. The hex value must be "0x0" (false) or "0x1" (true).`,{name:"InvalidHexBooleanError"})}}let hg=class extends G{constructor({givenSize:t,maxSize:n}){super(`Size cannot exceed ${n} bytes. Given size: ${t} bytes.`,{name:"SizeOverflowError"})}};function Tn(e,{dir:t="left"}={}){let n=typeof e=="string"?e.replace("0x",""):e,r=0;for(let o=0;o<n.length-1&&n[t==="left"?o:n.length-o-1].toString()==="0";o++)r++;return n=t==="left"?n.slice(r):n.slice(0,n.length-r),typeof e=="string"?(n.length===1&&t==="right"&&(n=`${n}0`),`0x${n.length%2===1?`0${n}`:n}`):n}function yt(e,{size:t}){if(xe(e)>t)throw new hg({givenSize:xe(e),maxSize:t})}function Nt(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 mg(e,t={}){let n=e;if(t.size&&(yt(n,{size:t.size}),n=Tn(n)),Tn(n)==="0x00")return!1;if(Tn(n)==="0x01")return!0;throw new pg(n)}function Wt(e,t={}){return Number(Nt(e,t))}const gg=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function Vt(e,t={}){return typeof e=="number"||typeof e=="bigint"?J(e,t):typeof e=="string"?Dr(e,t):typeof e=="boolean"?Hl(e,t):$e(e,t)}function Hl(e,t={}){const n=`0x${Number(e)}`;return typeof t.size=="number"?(yt(n,{size:t.size}),Xn(n,{size:t.size})):n}function $e(e,t={}){let n="";for(let o=0;o<e.length;o++)n+=gg[e[o]];const r=`0x${n}`;return typeof t.size=="number"?(yt(r,{size:t.size}),Xn(r,{dir:"right",size:t.size})):r}function J(e,t={}){const{signed:n,size:r}=t,o=BigInt(e);let s;r?n?s=(1n<<BigInt(r)*8n-1n)-1n:s=2n**(BigInt(r)*8n)-1n:typeof e=="number"&&(s=BigInt(Number.MAX_SAFE_INTEGER));const i=typeof s=="bigint"&&n?-s-1n:0;if(s&&o>s||o<i){const a=typeof e=="bigint"?"n":"";throw new zl({max:s?`${s}${a}`:void 0,min:`${i}${a}`,signed:n,size:r,value:`${e}${a}`})}const c=`0x${(n&&o<0?(1n<<BigInt(r*8))+BigInt(o):o).toString(16)}`;return r?Xn(c,{size:r}):c}const bg=new TextEncoder;function Dr(e,t={}){const n=bg.encode(e);return $e(n,t)}const yg=new TextEncoder;function Qn(e,t={}){return typeof e=="number"||typeof e=="bigint"?vg(e,t):typeof e=="boolean"?wg(e,t):bt(e)?wt(e,t):An(e,t)}function wg(e,t={}){const n=new Uint8Array(1);return n[0]=Number(e),typeof t.size=="number"?(yt(n,{size:t.size}),Xn(n,{size:t.size})):n}const Gt={zero:48,nine:57,A:65,F:70,a:97,f:102};function Wl(e){if(e>=Gt.zero&&e<=Gt.nine)return e-Gt.zero;if(e>=Gt.A&&e<=Gt.F)return e-(Gt.A-10);if(e>=Gt.a&&e<=Gt.f)return e-(Gt.a-10)}function wt(e,t={}){let n=e;t.size&&(yt(n,{size:t.size}),n=Xn(n,{dir:"right",size:t.size}));let r=n.slice(2);r.length%2&&(r=`0${r}`);const o=r.length/2,s=new Uint8Array(o);for(let i=0,c=0;i<o;i++){const a=Wl(r.charCodeAt(c++)),l=Wl(r.charCodeAt(c++));if(a===void 0||l===void 0)throw new G(`Invalid byte sequence ("${r[c-2]}${r[c-1]}" in "${r}").`);s[i]=a*16+l}return s}function vg(e,t){const n=J(e,t);return wt(n)}function An(e,t={}){const n=yg.encode(e);return typeof t.size=="number"?(yt(n,{size:t.size}),Xn(n,{dir:"right",size:t.size})):n}const Uo=BigInt(2**32-1),Vl=BigInt(32);function xg(e,t=!1){return t?{h:Number(e&Uo),l:Number(e>>Vl&Uo)}:{h:Number(e>>Vl&Uo)|0,l:Number(e&Uo)|0}}function Eg(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}=xg(e[s],t);[r[s],o[s]]=[i,c]}return[r,o]}const Sg=(e,t,n)=>e<<n|t>>>32-n,Pg=(e,t,n)=>t<<n|e>>>32-n,$g=(e,t,n)=>t<<n-32|e>>>64-n,Tg=(e,t,n)=>e<<n-32|t>>>64-n,Jn=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0;/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */function zo(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array"}function Fr(e){if(!Number.isSafeInteger(e)||e<0)throw new Error("positive integer expected, got "+e)}function qt(e,...t){if(!zo(e))throw new Error("Uint8Array expected");if(t.length>0&&!t.includes(e.length))throw new Error("Uint8Array expected of length "+t+", got length="+e.length)}function Gl(e){if(typeof e!="function"||typeof e.create!="function")throw new Error("Hash should be wrapped by utils.createHasher");Fr(e.outputLen),Fr(e.blockLen)}function er(e,t=!0){if(e.destroyed)throw new Error("Hash instance has been destroyed");if(t&&e.finished)throw new Error("Hash#digest() has already been called")}function ql(e,t){qt(e);const n=t.outputLen;if(e.length<n)throw new Error("digestInto() expects output buffer of length at least "+n)}function Ag(e){return new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4))}function tr(...e){for(let t=0;t<e.length;t++)e[t].fill(0)}function li(e){return new DataView(e.buffer,e.byteOffset,e.byteLength)}function Ot(e,t){return e<<32-t|e>>>t}const Ng=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;function Og(e){return e<<24&4278190080|e<<8&16711680|e>>>8&65280|e>>>24&255}function Cg(e){for(let t=0;t<e.length;t++)e[t]=Og(e[t]);return e}const Zl=Ng?e=>e:Cg,Kl=typeof Uint8Array.from([]).toHex=="function"&&typeof Uint8Array.fromHex=="function",Ig=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function nr(e){if(qt(e),Kl)return e.toHex();let t="";for(let n=0;n<e.length;n++)t+=Ig[e[n]];return t}const Zt={_0:48,_9:57,A:65,F:70,a:97,f:102};function Yl(e){if(e>=Zt._0&&e<=Zt._9)return e-Zt._0;if(e>=Zt.A&&e<=Zt.F)return e-(Zt.A-10);if(e>=Zt.a&&e<=Zt.f)return e-(Zt.a-10)}function Ho(e){if(typeof e!="string")throw new Error("hex string expected, got "+typeof e);if(Kl)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=Yl(e.charCodeAt(s)),c=Yl(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 Mg(e){if(typeof e!="string")throw new Error("string expected");return new Uint8Array(new TextEncoder().encode(e))}function Wo(e){return typeof e=="string"&&(e=Mg(e)),qt(e),e}function dn(...e){let t=0;for(let r=0;r<e.length;r++){const o=e[r];qt(o),t+=o.length}const n=new Uint8Array(t);for(let r=0,o=0;r<e.length;r++){const s=e[r];n.set(s,o),o+=s.length}return n}class ui{}function Xl(e){const t=r=>e().update(Wo(r)).digest(),n=e();return t.outputLen=n.outputLen,t.blockLen=n.blockLen,t.create=()=>e(),t}function Ql(e=32){if(Jn&&typeof Jn.getRandomValues=="function")return Jn.getRandomValues(new Uint8Array(e));if(Jn&&typeof Jn.randomBytes=="function")return Uint8Array.from(Jn.randomBytes(e));throw new Error("crypto.getRandomValues must be defined")}const kg=BigInt(0),Rr=BigInt(1),Bg=BigInt(2),Lg=BigInt(7),Dg=BigInt(256),Fg=BigInt(113),Jl=[],eu=[],tu=[];for(let e=0,t=Rr,n=1,r=0;e<24;e++){[n,r]=[r,(2*n+3*r)%5],Jl.push(2*(5*r+n)),eu.push((e+1)*(e+2)/2%64);let o=kg;for(let s=0;s<7;s++)t=(t<<Rr^(t>>Lg)*Fg)%Dg,t&Bg&&(o^=Rr<<(Rr<<BigInt(s))-Rr);tu.push(o)}const nu=Eg(tu,!0),Rg=nu[0],jg=nu[1],ru=(e,t,n)=>n>32?$g(e,t,n):Sg(e,t,n),ou=(e,t,n)=>n>32?Tg(e,t,n):Pg(e,t,n);function _g(e,t=24){const n=new Uint32Array(10);for(let r=24-t;r<24;r++){for(let i=0;i<10;i++)n[i]=e[i]^e[i+10]^e[i+20]^e[i+30]^e[i+40];for(let i=0;i<10;i+=2){const c=(i+8)%10,a=(i+2)%10,l=n[a],u=n[a+1],f=ru(l,u,1)^n[c],p=ou(l,u,1)^n[c+1];for(let d=0;d<50;d+=10)e[i+d]^=f,e[i+d+1]^=p}let o=e[2],s=e[3];for(let i=0;i<24;i++){const c=eu[i],a=ru(o,s,c),l=ou(o,s,c),u=Jl[i];o=e[u],s=e[u+1],e[u]=a,e[u+1]=l}for(let i=0;i<50;i+=10){for(let c=0;c<10;c++)n[c]=e[i+c];for(let c=0;c<10;c++)e[i+c]^=~n[(c+2)%10]&n[(c+4)%10]}e[0]^=Rg[r],e[1]^=jg[r]}tr(n)}class fi extends ui{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,Fr(r),!(0<t&&t<200))throw new Error("only keccak-f1600 function is supported");this.state=new Uint8Array(200),this.state32=Ag(this.state)}clone(){return this._cloneInto()}keccak(){Zl(this.state32),_g(this.state32,this.rounds),Zl(this.state32),this.posOut=0,this.pos=0}update(t){er(this),t=Wo(t),qt(t);const{blockLen:n,state:r}=this,o=t.length;for(let s=0;s<o;){const i=Math.min(n-this.pos,o-s);for(let c=0;c<i;c++)r[this.pos++]^=t[s++];this.pos===n&&this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;const{state:t,suffix:n,pos:r,blockLen:o}=this;t[r]^=n,n&128&&r===o-1&&this.keccak(),t[o-1]^=128,this.keccak()}writeInto(t){er(this,!1),qt(t),this.finish();const n=this.state,{blockLen:r}=this;for(let o=0,s=t.length;o<s;){this.posOut>=r&&this.keccak();const i=Math.min(r-this.posOut,s-o);t.set(n.subarray(this.posOut,this.posOut+i),o),this.posOut+=i,o+=i}return t}xofInto(t){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(t)}xof(t){return Fr(t),this.xofInto(new Uint8Array(t))}digestInto(t){if(ql(t,this),this.finished)throw new Error("digest() was already called");return this.writeInto(t),this.destroy(),t}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,tr(this.state)}_cloneInto(t){const{blockLen:n,suffix:r,outputLen:o,rounds:s,enableXOF:i}=this;return t||(t=new fi(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 Ug=(e,t,n)=>Xl(()=>new fi(t,e,n)),su=Ug(1,136,256/8);function Ie(e,t){const n=t||"hex",r=su(bt(e,{strict:!1})?Qn(e):e);return n==="bytes"?r:Vt(r)}const zg=e=>Ie(Qn(e));function Hg(e){return zg(e)}function Wg(e){let t=!0,n="",r=0,o="",s=!1;for(let i=0;i<e.length;i++){const c=e[i];if(["(",")",","].includes(c)&&(t=!0),c==="("&&r++,c===")"&&r--,!!t){if(r===0){if(c===" "&&["event","function",""].includes(o))o="";else if(o+=c,c===")"){s=!0;break}continue}if(c===" "){e[i-1]!==","&&n!==","&&n!==",("&&(n="",t=!1);continue}o+=c,n+=c}}if(!s)throw new G("Unable to normalize signature.");return o}const Vg=e=>{const t=typeof e=="string"?e:Ro(e);return Wg(t)};function iu(e){return Hg(Vg(e))}const Vo=iu;let pn=class extends G{constructor({address:t}){super(`Address "${t}" is invalid.`,{metaMessages:["- Address must be a hex value of 20 bytes (40 hex characters).","- Address must match its checksum counterpart."],name:"InvalidAddressError"})}},di=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 pi=new di(8192);function Go(e,t){if(pi.has(`${e}.${t}`))return pi.get(`${e}.${t}`);const n=e.substring(2).toLowerCase(),r=Ie(An(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 pi.set(`${e}.${t}`,s),s}function Nn(e,t){if(!tt(e,{strict:!1}))throw new pn({address:e});return Go(e,t)}const Gg=/^0x[a-fA-F0-9]{40}$/,hi=new di(8192);function tt(e,t){const{strict:n=!0}=t??{},r=`${e}.${n}`;if(hi.has(r))return hi.get(r);const o=Gg.test(e)?e.toLowerCase()===e?!0:n?Go(e)===e:!0:!1;return hi.set(r,o),o}function vt(e){return typeof e[0]=="string"?rr(e):qg(e)}function qg(e){let t=0;for(const o of e)t+=o.length;const n=new Uint8Array(t);let r=0;for(const o of e)n.set(o,r),r+=o.length;return n}function rr(e){return`0x${e.reduce((t,n)=>t+n.replace("0x",""),"")}`}function or(e,t,n,{strict:r}={}){return bt(e,{strict:!1})?uu(e,t,n,{strict:r}):lu(e,t,n,{strict:r})}function au(e,t){if(typeof t=="number"&&t>0&&t>xe(e)-1)throw new jl({offset:t,position:"start",size:xe(e)})}function cu(e,t,n){if(typeof t=="number"&&typeof n=="number"&&xe(e)!==n-t)throw new jl({offset:n,position:"end",size:xe(e)})}function lu(e,t,n,{strict:r}={}){au(e,t);const o=e.slice(t,n);return r&&cu(o,t,n),o}function uu(e,t,n,{strict:r}={}){au(e,t);const o=`0x${e.replace("0x","").slice((t??0)*2,(n??e.length)*2)}`;return r&&cu(o,t,n),o}const Zg=/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/,fu=/^(u?int)(8|16|24|32|40|48|56|64|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256)?$/;function Kt(e,t){if(e.length!==t.length)throw new tg({expectedLength:e.length,givenLength:t.length});const n=Kg({params:e,values:t}),r=gi(n);return r.length===0?"0x":r}function Kg({params:e,values:t}){const n=[];for(let r=0;r<e.length;r++)n.push(mi({param:e[r],value:t[r]}));return n}function mi({param:e,value:t}){const n=bi(e.type);if(n){const[r,o]=n;return Xg(t,{length:r,param:{...e,type:o}})}if(e.type==="tuple")return nb(t,{param:e});if(e.type==="address")return Yg(t);if(e.type==="bool")return Jg(t);if(e.type.startsWith("uint")||e.type.startsWith("int")){const r=e.type.startsWith("int"),[,,o="256"]=fu.exec(e.type)??[];return eb(t,{signed:r,size:Number(o)})}if(e.type.startsWith("bytes"))return Qg(t,{param:e});if(e.type==="string")return tb(t);throw new ag(e.type,{docsPath:"/docs/contract/encodeAbiParameters"})}function gi(e){let t=0;for(let s=0;s<e.length;s++){const{dynamic:i,encoded:c}=e[s];i?t+=32:t+=xe(c)}const n=[],r=[];let o=0;for(let s=0;s<e.length;s++){const{dynamic:i,encoded:c}=e[s];i?(n.push(J(t+o,{size:32})),r.push(c),o+=xe(c)):n.push(c)}return vt([...n,...r])}function Yg(e){if(!tt(e))throw new pn({address:e});return{dynamic:!1,encoded:fn(e.toLowerCase())}}function Xg(e,{length:t,param:n}){const r=t===null;if(!Array.isArray(e))throw new Rl(e);if(!r&&e.length!==t)throw new Jm({expectedLength:t,givenLength:e.length,type:`${n.type}[${t}]`});let o=!1;const s=[];for(let i=0;i<e.length;i++){const c=mi({param:n,value:e[i]});c.dynamic&&(o=!0),s.push(c)}if(r||o){const i=gi(s);if(r){const c=J(s.length,{size:32});return{dynamic:!0,encoded:s.length>0?vt([c,i]):c}}if(o)return{dynamic:!0,encoded:i}}return{dynamic:!1,encoded:vt(s.map(({encoded:i})=>i))}}function Qg(e,{param:t}){const[,n]=t.type.split("bytes"),r=xe(e);if(!n){let o=e;return r%32!==0&&(o=fn(o,{dir:"right",size:Math.ceil((e.length-2)/2/32)*32})),{dynamic:!0,encoded:vt([fn(J(r,{size:32})),o])}}if(r!==Number.parseInt(n))throw new eg({expectedSize:Number.parseInt(n),value:e});return{dynamic:!1,encoded:fn(e,{dir:"right"})}}function Jg(e){if(typeof e!="boolean")throw new G(`Invalid boolean value: "${e}" (type: ${typeof e}). Expected: \`true\` or \`false\`.`);return{dynamic:!1,encoded:fn(Hl(e))}}function eb(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 zl({max:r.toString(),min:o.toString(),signed:t,size:n/8,value:e.toString()})}return{dynamic:!1,encoded:J(e,{size:32,signed:t})}}function tb(e){const t=Dr(e),n=Math.ceil(xe(t)/32),r=[];for(let o=0;o<n;o++)r.push(fn(or(t,o*32,(o+1)*32),{dir:"right"}));return{dynamic:!0,encoded:vt([fn(J(xe(t),{size:32})),...r])}}function nb(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=mi({param:s,value:e[i]});r.push(c),c.dynamic&&(n=!0)}return{dynamic:n,encoded:n?gi(r):vt(r.map(({encoded:o})=>o))}}function bi(e){const t=e.match(/^(.*)\[(\d+)?\]$/);return t?[t[2]?Number(t[2]):null,t[1]]:void 0}const jr=e=>or(iu(e),0,4);function On(e){const{abi:t,args:n=[],name:r}=e,o=bt(r,{strict:!1}),s=t.filter(c=>o?c.type==="function"?jr(c)===r:c.type==="event"?Vo(c)===r:!1:"name"in c&&c.name===r);if(s.length===0)return;if(s.length===1)return s[0];let i;for(const c of s){if(!("inputs"in c))continue;if(!n||n.length===0){if(!c.inputs||c.inputs.length===0)return c;continue}if(!c.inputs||c.inputs.length===0||c.inputs.length!==n.length)continue;if(n.every((l,u)=>{const f="inputs"in c&&c.inputs[u];return f?yi(l,f):!1})){if(i&&"inputs"in i&&i.inputs){const l=du(c.inputs,i.inputs,n);if(l)throw new sg({abiItem:c,type:l[0]},{abiItem:i,type:l[1]})}i=c}}return i||s[0]}function yi(e,t){const n=typeof e,r=t.type;switch(r){case"address":return tt(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)=>yi(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=>yi(o,{...t,type:r.replace(/(\[[0-9]{0,}\])$/,"")})):!1}}function du(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 du(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")?tt(n[r],{strict:!1}):i.includes("address")&&i.includes("bytes")?tt(n[r],{strict:!1}):!1)return i}}const pu="/docs/contract/encodeEventTopics";function _r(e){var a;const{abi:t,eventName:n,args:r}=e;let o=t[0];if(n){const l=On({abi:t,name:n});if(!l)throw new Dl(n,{docsPath:pu});o=l}if(o.type!=="event")throw new Dl(void 0,{docsPath:pu});const s=gt(o),i=Vo(s);let c=[];if(r&&"inputs"in o){const l=(a=o.inputs)==null?void 0:a.filter(f=>"indexed"in f&&f.indexed),u=Array.isArray(r)?r:Object.values(r).length>0?(l==null?void 0:l.map(f=>r[f.name]))??[]:[];u.length>0&&(c=(l==null?void 0:l.map((f,p)=>Array.isArray(u[p])?u[p].map((d,h)=>hu({param:f,value:u[p][h]})):typeof u[p]<"u"&&u[p]!==null?hu({param:f,value:u[p]}):null))??[])}return[i,...c]}function hu({param:e,value:t}){if(e.type==="string"||e.type==="bytes")return Ie(Qn(t));if(e.type==="tuple"||e.type.match(/^(.*)\[(\d+)?\]$/))throw new ug(e.type);return Kt([e],[t])}function qo(e,{method:t}){var r,o;const n={};return e.transport.type==="fallback"&&((o=(r=e.transport).onResponse)==null||o.call(r,({method:s,response:i,status:c,transport:a})=>{c==="success"&&t===s&&(n[i]=a.request)})),s=>n[s]||e.request}async function mu(e,t){const{address:n,abi:r,args:o,eventName:s,fromBlock:i,strict:c,toBlock:a}=t,l=qo(e,{method:"eth_newFilter"}),u=s?_r({abi:r,args:o,eventName:s}):void 0,f=await e.request({method:"eth_newFilter",params:[{address:n,fromBlock:typeof i=="bigint"?J(i):i,toBlock:typeof a=="bigint"?J(a):a,topics:u}]});return{abi:r,args:o,eventName:s,id:f,request:l(f),strict:!!c,type:"event"}}function xt(e){return typeof e=="string"?{address:e,type:"json-rpc"}:e}const gu="/docs/contract/encodeFunctionData";function rb(e){const{abi:t,args:n,functionName:r}=e;let o=t[0];if(r){const s=On({abi:t,args:n,name:r});if(!s)throw new Yn(r,{docsPath:gu});o=s}if(o.type!=="function")throw new Yn(void 0,{docsPath:gu});return{abi:[o],functionName:jr(gt(o))}}function Ct(e){const{args:t}=e,{abi:n,functionName:r}=(()=>{var c;return e.abi.length===1&&((c=e.functionName)!=null&&c.startsWith("0x"))?e:rb(e)})(),o=n[0],s=r,i="inputs"in o&&o.inputs?Kt(o.inputs,t??[]):void 0;return rr([s,i??"0x"])}const bu={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."},yu={inputs:[{name:"message",type:"string"}],name:"Error",type:"error"},ob={inputs:[{name:"reason",type:"uint256"}],name:"Panic",type:"error"};class wu extends G{constructor({offset:t}){super(`Offset \`${t}\` cannot be negative.`,{name:"NegativeOffsetError"})}}class vu extends G{constructor({length:t,position:n}){super(`Position \`${n}\` is out of bounds (\`0 < position < ${t}\`).`,{name:"PositionOutOfBoundsError"})}}class sb extends G{constructor({count:t,limit:n}){super(`Recursive read limit of \`${n}\` exceeded (recursive read count: \`${t}\`).`,{name:"RecursiveReadLimitExceededError"})}}const ib={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 sb({count:this.recursiveReadCount+1,limit:this.recursiveReadLimit})},assertPosition(e){if(e<0||e>this.bytes.length-1)throw new vu({length:this.bytes.length,position:e})},decrementPosition(e){if(e<0)throw new wu({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 wu({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 wi(e,{recursiveReadLimit:t=8192}={}){const n=Object.create(ib);return n.bytes=e,n.dataView=new DataView(e.buffer,e.byteOffset,e.byteLength),n.positionReadCount=new Map,n.recursiveReadLimit=t,n}function ab(e,t={}){typeof t.size<"u"&&yt(e,{size:t.size});const n=$e(e,t);return Nt(n,t)}function cb(e,t={}){let n=e;if(typeof t.size<"u"&&(yt(n,{size:t.size}),n=Tn(n)),n.length>1||n[0]>1)throw new dg(n);return!!n[0]}function Yt(e,t={}){typeof t.size<"u"&&yt(e,{size:t.size});const n=$e(e,t);return Wt(n,t)}function lb(e,t={}){let n=e;return typeof t.size<"u"&&(yt(n,{size:t.size}),n=Tn(n,{dir:"right"})),new TextDecoder().decode(n)}function Ur(e,t){const n=typeof t=="string"?wt(t):t,r=wi(n);if(xe(n)===0&&e.length>0)throw new Br;if(xe(t)&&xe(t)<32)throw new Ml({data:typeof t=="string"?t:$e(t),params:e,size:xe(t)});let o=0;const s=[];for(let i=0;i<e.length;++i){const c=e[i];r.setPosition(o);const[a,l]=sr(r,c,{staticPosition:0});o+=l,s.push(a)}return s}function sr(e,t,{staticPosition:n}){const r=bi(t.type);if(r){const[o,s]=r;return fb(e,{...t,type:s},{length:o,staticPosition:n})}if(t.type==="tuple")return mb(e,t,{staticPosition:n});if(t.type==="address")return ub(e);if(t.type==="bool")return db(e);if(t.type.startsWith("bytes"))return pb(e,t,{staticPosition:n});if(t.type.startsWith("uint")||t.type.startsWith("int"))return hb(e,t);if(t.type==="string")return gb(e,{staticPosition:n});throw new cg(t.type,{docsPath:"/docs/contract/decodeAbiParameters"})}const xu=32,vi=32;function ub(e){const t=e.readBytes(32);return[Go($e(lu(t,-20))),32]}function fb(e,t,{length:n,staticPosition:r}){if(!n){const i=Yt(e.readBytes(vi)),c=r+i,a=c+xu;e.setPosition(c);const l=Yt(e.readBytes(xu)),u=zr(t);let f=0;const p=[];for(let d=0;d<l;++d){e.setPosition(a+(u?d*32:f));const[h,m]=sr(e,t,{staticPosition:a});f+=m,p.push(h)}return e.setPosition(r+32),[p,32]}if(zr(t)){const i=Yt(e.readBytes(vi)),c=r+i,a=[];for(let l=0;l<n;++l){e.setPosition(c+l*32);const[u]=sr(e,t,{staticPosition:c});a.push(u)}return e.setPosition(r+32),[a,32]}let o=0;const s=[];for(let i=0;i<n;++i){const[c,a]=sr(e,t,{staticPosition:r+o});o+=a,s.push(c)}return[s,o]}function db(e){return[cb(e.readBytes(32),{size:32}),32]}function pb(e,t,{staticPosition:n}){const[r,o]=t.type.split("bytes");if(!o){const i=Yt(e.readBytes(32));e.setPosition(n+i);const c=Yt(e.readBytes(32));if(c===0)return e.setPosition(n+32),["0x",32];const a=e.readBytes(c);return e.setPosition(n+32),[$e(a),32]}return[$e(e.readBytes(Number.parseInt(o),32)),32]}function hb(e,t){const n=t.type.startsWith("int"),r=Number.parseInt(t.type.split("int")[1]||"256"),o=e.readBytes(32);return[r>48?ab(o,{signed:n}):Yt(o,{signed:n}),32]}function mb(e,t,{staticPosition:n}){const r=t.components.length===0||t.components.some(({name:i})=>!i),o=r?[]:{};let s=0;if(zr(t)){const i=Yt(e.readBytes(vi)),c=n+i;for(let a=0;a<t.components.length;++a){const l=t.components[a];e.setPosition(c+s);const[u,f]=sr(e,l,{staticPosition:c});s+=f,o[r?a:l==null?void 0:l.name]=u}return e.setPosition(n+32),[o,32]}for(let i=0;i<t.components.length;++i){const c=t.components[i],[a,l]=sr(e,c,{staticPosition:n});o[r?i:c==null?void 0:c.name]=a,s+=l}return[o,s]}function gb(e,{staticPosition:t}){const n=Yt(e.readBytes(32)),r=t+n;e.setPosition(r);const o=Yt(e.readBytes(32));if(o===0)return e.setPosition(t+32),["",32];const s=e.readBytes(o,32),i=lb(Tn(s));return e.setPosition(t+32),[i,32]}function zr(e){var r;const{type:t}=e;if(t==="string"||t==="bytes"||t.endsWith("[]"))return!0;if(t==="tuple")return(r=e.components)==null?void 0:r.some(zr);const n=bi(e.type);return!!(n&&zr({...e,type:n[1]}))}function Eu(e){const{abi:t,data:n}=e,r=or(n,0,4);if(r==="0x")throw new Br;const s=[...t||[],yu,ob].find(i=>i.type==="error"&&r===jr(gt(i)));if(!s)throw new Bl(r,{docsPath:"/docs/contract/decodeErrorResult"});return{abiItem:s,args:"inputs"in s&&s.inputs&&s.inputs.length>0?Ur(s.inputs,or(n,4)):void 0,errorName:s.name}}const Te=(e,t,n)=>JSON.stringify(e,(r,o)=>typeof o=="bigint"?o.toString():o,n);function Su({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 bb={gwei:9,wei:18},yb={ether:-9,wei:9};function xi(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 Pu(e,t="wei"){return xi(e,bb[t])}function Et(e,t="wei"){return xi(e,yb[t])}class wb extends G{constructor({address:t}){super(`State for account "${t}" is set multiple times.`,{name:"AccountStateConflictError"})}}class vb extends G{constructor(){super("state and stateDiff are set on the same account.",{name:"StateAssignmentConflictError"})}}function $u(e){return e.reduce((t,{slot:n,value:r})=>`${t} ${n}: ${r}
61
+ `),{name:"InvalidDefinitionTypeError"})}}class ug extends G{constructor(t){super(`Filter type "${t}" is not supported.`,{name:"FilterTypeNotSupportedError"})}}let jl=class extends G{constructor({offset:t,position:n,size:r}){super(`Slice ${n==="start"?"starting":"ending"} at offset "${t}" is out-of-bounds (size: ${r}).`,{name:"SliceOffsetOutOfBoundsError"})}},_l=class extends G{constructor({size:t,targetSize:n,type:r}){super(`${r.charAt(0).toUpperCase()}${r.slice(1).toLowerCase()} size (${t}) exceeds padding size (${n}).`,{name:"SizeExceedsPaddingSizeError"})}};class Ul extends G{constructor({size:t,targetSize:n,type:r}){super(`${r.charAt(0).toUpperCase()}${r.slice(1).toLowerCase()} is expected to be ${n} ${r} long, but is ${t} ${r} long.`,{name:"InvalidBytesLengthError"})}}function Xn(e,{dir:t,size:n=32}={}){return typeof e=="string"?fn(e,{dir:t,size:n}):fg(e,{dir:t,size:n})}function fn(e,{dir:t,size:n=32}={}){if(n===null)return e;const r=e.replace("0x","");if(r.length>n*2)throw new _l({size:Math.ceil(r.length/2),targetSize:n,type:"hex"});return`0x${r[t==="right"?"padEnd":"padStart"](n*2,"0")}`}function fg(e,{dir:t,size:n=32}={}){if(n===null)return e;if(e.length>n)throw new _l({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 zl=class extends G{constructor({max:t,min:n,signed:r,size:o,value:s}){super(`Number "${s}" is not in safe ${o?`${o*8}-bit ${r?"signed":"unsigned"} `:""}integer range ${t?`(${n} to ${t})`:`(above ${n})`}`,{name:"IntegerOutOfRangeError"})}};class dg extends G{constructor(t){super(`Bytes value "${t}" is not a valid boolean. The bytes array must contain a single byte of either a 0 or 1 value.`,{name:"InvalidBytesBooleanError"})}}class pg extends G{constructor(t){super(`Hex value "${t}" is not a valid boolean. The hex value must be "0x0" (false) or "0x1" (true).`,{name:"InvalidHexBooleanError"})}}let hg=class extends G{constructor({givenSize:t,maxSize:n}){super(`Size cannot exceed ${n} bytes. Given size: ${t} bytes.`,{name:"SizeOverflowError"})}};function Tn(e,{dir:t="left"}={}){let n=typeof e=="string"?e.replace("0x",""):e,r=0;for(let o=0;o<n.length-1&&n[t==="left"?o:n.length-o-1].toString()==="0";o++)r++;return n=t==="left"?n.slice(r):n.slice(0,n.length-r),typeof e=="string"?(n.length===1&&t==="right"&&(n=`${n}0`),`0x${n.length%2===1?`0${n}`:n}`):n}function yt(e,{size:t}){if(xe(e)>t)throw new hg({givenSize:xe(e),maxSize:t})}function Nt(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 mg(e,t={}){let n=e;if(t.size&&(yt(n,{size:t.size}),n=Tn(n)),Tn(n)==="0x00")return!1;if(Tn(n)==="0x01")return!0;throw new pg(n)}function Wt(e,t={}){return Number(Nt(e,t))}const gg=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function Vt(e,t={}){return typeof e=="number"||typeof e=="bigint"?J(e,t):typeof e=="string"?Dr(e,t):typeof e=="boolean"?Hl(e,t):$e(e,t)}function Hl(e,t={}){const n=`0x${Number(e)}`;return typeof t.size=="number"?(yt(n,{size:t.size}),Xn(n,{size:t.size})):n}function $e(e,t={}){let n="";for(let o=0;o<e.length;o++)n+=gg[e[o]];const r=`0x${n}`;return typeof t.size=="number"?(yt(r,{size:t.size}),Xn(r,{dir:"right",size:t.size})):r}function J(e,t={}){const{signed:n,size:r}=t,o=BigInt(e);let s;r?n?s=(1n<<BigInt(r)*8n-1n)-1n:s=2n**(BigInt(r)*8n)-1n:typeof e=="number"&&(s=BigInt(Number.MAX_SAFE_INTEGER));const i=typeof s=="bigint"&&n?-s-1n:0;if(s&&o>s||o<i){const a=typeof e=="bigint"?"n":"";throw new zl({max:s?`${s}${a}`:void 0,min:`${i}${a}`,signed:n,size:r,value:`${e}${a}`})}const c=`0x${(n&&o<0?(1n<<BigInt(r*8))+BigInt(o):o).toString(16)}`;return r?Xn(c,{size:r}):c}const bg=new TextEncoder;function Dr(e,t={}){const n=bg.encode(e);return $e(n,t)}const yg=new TextEncoder;function Qn(e,t={}){return typeof e=="number"||typeof e=="bigint"?vg(e,t):typeof e=="boolean"?wg(e,t):bt(e)?wt(e,t):An(e,t)}function wg(e,t={}){const n=new Uint8Array(1);return n[0]=Number(e),typeof t.size=="number"?(yt(n,{size:t.size}),Xn(n,{size:t.size})):n}const Gt={zero:48,nine:57,A:65,F:70,a:97,f:102};function Wl(e){if(e>=Gt.zero&&e<=Gt.nine)return e-Gt.zero;if(e>=Gt.A&&e<=Gt.F)return e-(Gt.A-10);if(e>=Gt.a&&e<=Gt.f)return e-(Gt.a-10)}function wt(e,t={}){let n=e;t.size&&(yt(n,{size:t.size}),n=Xn(n,{dir:"right",size:t.size}));let r=n.slice(2);r.length%2&&(r=`0${r}`);const o=r.length/2,s=new Uint8Array(o);for(let i=0,c=0;i<o;i++){const a=Wl(r.charCodeAt(c++)),l=Wl(r.charCodeAt(c++));if(a===void 0||l===void 0)throw new G(`Invalid byte sequence ("${r[c-2]}${r[c-1]}" in "${r}").`);s[i]=a*16+l}return s}function vg(e,t){const n=J(e,t);return wt(n)}function An(e,t={}){const n=yg.encode(e);return typeof t.size=="number"?(yt(n,{size:t.size}),Xn(n,{dir:"right",size:t.size})):n}const Uo=BigInt(2**32-1),Vl=BigInt(32);function xg(e,t=!1){return t?{h:Number(e&Uo),l:Number(e>>Vl&Uo)}:{h:Number(e>>Vl&Uo)|0,l:Number(e&Uo)|0}}function Eg(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}=xg(e[s],t);[r[s],o[s]]=[i,c]}return[r,o]}const Sg=(e,t,n)=>e<<n|t>>>32-n,Pg=(e,t,n)=>t<<n|e>>>32-n,$g=(e,t,n)=>t<<n-32|e>>>64-n,Tg=(e,t,n)=>e<<n-32|t>>>64-n,Jn=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0;/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */function zo(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array"}function Fr(e){if(!Number.isSafeInteger(e)||e<0)throw new Error("positive integer expected, got "+e)}function qt(e,...t){if(!zo(e))throw new Error("Uint8Array expected");if(t.length>0&&!t.includes(e.length))throw new Error("Uint8Array expected of length "+t+", got length="+e.length)}function Gl(e){if(typeof e!="function"||typeof e.create!="function")throw new Error("Hash should be wrapped by utils.createHasher");Fr(e.outputLen),Fr(e.blockLen)}function er(e,t=!0){if(e.destroyed)throw new Error("Hash instance has been destroyed");if(t&&e.finished)throw new Error("Hash#digest() has already been called")}function ql(e,t){qt(e);const n=t.outputLen;if(e.length<n)throw new Error("digestInto() expects output buffer of length at least "+n)}function Ag(e){return new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4))}function tr(...e){for(let t=0;t<e.length;t++)e[t].fill(0)}function ui(e){return new DataView(e.buffer,e.byteOffset,e.byteLength)}function Ot(e,t){return e<<32-t|e>>>t}const Ng=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;function Og(e){return e<<24&4278190080|e<<8&16711680|e>>>8&65280|e>>>24&255}function Cg(e){for(let t=0;t<e.length;t++)e[t]=Og(e[t]);return e}const Zl=Ng?e=>e:Cg,Kl=typeof Uint8Array.from([]).toHex=="function"&&typeof Uint8Array.fromHex=="function",Ig=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function nr(e){if(qt(e),Kl)return e.toHex();let t="";for(let n=0;n<e.length;n++)t+=Ig[e[n]];return t}const Zt={_0:48,_9:57,A:65,F:70,a:97,f:102};function Yl(e){if(e>=Zt._0&&e<=Zt._9)return e-Zt._0;if(e>=Zt.A&&e<=Zt.F)return e-(Zt.A-10);if(e>=Zt.a&&e<=Zt.f)return e-(Zt.a-10)}function Ho(e){if(typeof e!="string")throw new Error("hex string expected, got "+typeof e);if(Kl)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=Yl(e.charCodeAt(s)),c=Yl(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 Mg(e){if(typeof e!="string")throw new Error("string expected");return new Uint8Array(new TextEncoder().encode(e))}function Wo(e){return typeof e=="string"&&(e=Mg(e)),qt(e),e}function dn(...e){let t=0;for(let r=0;r<e.length;r++){const o=e[r];qt(o),t+=o.length}const n=new Uint8Array(t);for(let r=0,o=0;r<e.length;r++){const s=e[r];n.set(s,o),o+=s.length}return n}class fi{}function Xl(e){const t=r=>e().update(Wo(r)).digest(),n=e();return t.outputLen=n.outputLen,t.blockLen=n.blockLen,t.create=()=>e(),t}function Ql(e=32){if(Jn&&typeof Jn.getRandomValues=="function")return Jn.getRandomValues(new Uint8Array(e));if(Jn&&typeof Jn.randomBytes=="function")return Uint8Array.from(Jn.randomBytes(e));throw new Error("crypto.getRandomValues must be defined")}const kg=BigInt(0),Rr=BigInt(1),Bg=BigInt(2),Lg=BigInt(7),Dg=BigInt(256),Fg=BigInt(113),Jl=[],eu=[],tu=[];for(let e=0,t=Rr,n=1,r=0;e<24;e++){[n,r]=[r,(2*n+3*r)%5],Jl.push(2*(5*r+n)),eu.push((e+1)*(e+2)/2%64);let o=kg;for(let s=0;s<7;s++)t=(t<<Rr^(t>>Lg)*Fg)%Dg,t&Bg&&(o^=Rr<<(Rr<<BigInt(s))-Rr);tu.push(o)}const nu=Eg(tu,!0),Rg=nu[0],jg=nu[1],ru=(e,t,n)=>n>32?$g(e,t,n):Sg(e,t,n),ou=(e,t,n)=>n>32?Tg(e,t,n):Pg(e,t,n);function _g(e,t=24){const n=new Uint32Array(10);for(let r=24-t;r<24;r++){for(let i=0;i<10;i++)n[i]=e[i]^e[i+10]^e[i+20]^e[i+30]^e[i+40];for(let i=0;i<10;i+=2){const c=(i+8)%10,a=(i+2)%10,l=n[a],u=n[a+1],f=ru(l,u,1)^n[c],p=ou(l,u,1)^n[c+1];for(let d=0;d<50;d+=10)e[i+d]^=f,e[i+d+1]^=p}let o=e[2],s=e[3];for(let i=0;i<24;i++){const c=eu[i],a=ru(o,s,c),l=ou(o,s,c),u=Jl[i];o=e[u],s=e[u+1],e[u]=a,e[u+1]=l}for(let i=0;i<50;i+=10){for(let c=0;c<10;c++)n[c]=e[i+c];for(let c=0;c<10;c++)e[i+c]^=~n[(c+2)%10]&n[(c+4)%10]}e[0]^=Rg[r],e[1]^=jg[r]}tr(n)}class di extends fi{constructor(t,n,r,o=!1,s=24){if(super(),this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,this.enableXOF=!1,this.blockLen=t,this.suffix=n,this.outputLen=r,this.enableXOF=o,this.rounds=s,Fr(r),!(0<t&&t<200))throw new Error("only keccak-f1600 function is supported");this.state=new Uint8Array(200),this.state32=Ag(this.state)}clone(){return this._cloneInto()}keccak(){Zl(this.state32),_g(this.state32,this.rounds),Zl(this.state32),this.posOut=0,this.pos=0}update(t){er(this),t=Wo(t),qt(t);const{blockLen:n,state:r}=this,o=t.length;for(let s=0;s<o;){const i=Math.min(n-this.pos,o-s);for(let c=0;c<i;c++)r[this.pos++]^=t[s++];this.pos===n&&this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;const{state:t,suffix:n,pos:r,blockLen:o}=this;t[r]^=n,n&128&&r===o-1&&this.keccak(),t[o-1]^=128,this.keccak()}writeInto(t){er(this,!1),qt(t),this.finish();const n=this.state,{blockLen:r}=this;for(let o=0,s=t.length;o<s;){this.posOut>=r&&this.keccak();const i=Math.min(r-this.posOut,s-o);t.set(n.subarray(this.posOut,this.posOut+i),o),this.posOut+=i,o+=i}return t}xofInto(t){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(t)}xof(t){return Fr(t),this.xofInto(new Uint8Array(t))}digestInto(t){if(ql(t,this),this.finished)throw new Error("digest() was already called");return this.writeInto(t),this.destroy(),t}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,tr(this.state)}_cloneInto(t){const{blockLen:n,suffix:r,outputLen:o,rounds:s,enableXOF:i}=this;return t||(t=new di(n,r,o,i,s)),t.state32.set(this.state32),t.pos=this.pos,t.posOut=this.posOut,t.finished=this.finished,t.rounds=s,t.suffix=r,t.outputLen=o,t.enableXOF=i,t.destroyed=this.destroyed,t}}const Ug=(e,t,n)=>Xl(()=>new di(t,e,n)),su=Ug(1,136,256/8);function Ie(e,t){const n=t||"hex",r=su(bt(e,{strict:!1})?Qn(e):e);return n==="bytes"?r:Vt(r)}const zg=e=>Ie(Qn(e));function Hg(e){return zg(e)}function Wg(e){let t=!0,n="",r=0,o="",s=!1;for(let i=0;i<e.length;i++){const c=e[i];if(["(",")",","].includes(c)&&(t=!0),c==="("&&r++,c===")"&&r--,!!t){if(r===0){if(c===" "&&["event","function",""].includes(o))o="";else if(o+=c,c===")"){s=!0;break}continue}if(c===" "){e[i-1]!==","&&n!==","&&n!==",("&&(n="",t=!1);continue}o+=c,n+=c}}if(!s)throw new G("Unable to normalize signature.");return o}const Vg=e=>{const t=typeof e=="string"?e:Ro(e);return Wg(t)};function iu(e){return Hg(Vg(e))}const Vo=iu;let pn=class extends G{constructor({address:t}){super(`Address "${t}" is invalid.`,{metaMessages:["- Address must be a hex value of 20 bytes (40 hex characters).","- Address must match its checksum counterpart."],name:"InvalidAddressError"})}},pi=class extends Map{constructor(t){super(),Object.defineProperty(this,"maxSize",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.maxSize=t}get(t){const n=super.get(t);return super.has(t)&&n!==void 0&&(this.delete(t),super.set(t,n)),n}set(t,n){if(super.set(t,n),this.maxSize&&this.size>this.maxSize){const r=this.keys().next().value;r&&this.delete(r)}return this}};const hi=new pi(8192);function Go(e,t){if(hi.has(`${e}.${t}`))return hi.get(`${e}.${t}`);const n=e.substring(2).toLowerCase(),r=Ie(An(n),"bytes"),o=n.split("");for(let i=0;i<40;i+=2)r[i>>1]>>4>=8&&o[i]&&(o[i]=o[i].toUpperCase()),(r[i>>1]&15)>=8&&o[i+1]&&(o[i+1]=o[i+1].toUpperCase());const s=`0x${o.join("")}`;return hi.set(`${e}.${t}`,s),s}function Nn(e,t){if(!tt(e,{strict:!1}))throw new pn({address:e});return Go(e,t)}const Gg=/^0x[a-fA-F0-9]{40}$/,mi=new pi(8192);function tt(e,t){const{strict:n=!0}=t??{},r=`${e}.${n}`;if(mi.has(r))return mi.get(r);const o=Gg.test(e)?e.toLowerCase()===e?!0:n?Go(e)===e:!0:!1;return mi.set(r,o),o}function vt(e){return typeof e[0]=="string"?rr(e):qg(e)}function qg(e){let t=0;for(const o of e)t+=o.length;const n=new Uint8Array(t);let r=0;for(const o of e)n.set(o,r),r+=o.length;return n}function rr(e){return`0x${e.reduce((t,n)=>t+n.replace("0x",""),"")}`}function or(e,t,n,{strict:r}={}){return bt(e,{strict:!1})?uu(e,t,n,{strict:r}):lu(e,t,n,{strict:r})}function au(e,t){if(typeof t=="number"&&t>0&&t>xe(e)-1)throw new jl({offset:t,position:"start",size:xe(e)})}function cu(e,t,n){if(typeof t=="number"&&typeof n=="number"&&xe(e)!==n-t)throw new jl({offset:n,position:"end",size:xe(e)})}function lu(e,t,n,{strict:r}={}){au(e,t);const o=e.slice(t,n);return r&&cu(o,t,n),o}function uu(e,t,n,{strict:r}={}){au(e,t);const o=`0x${e.replace("0x","").slice((t??0)*2,(n??e.length)*2)}`;return r&&cu(o,t,n),o}const Zg=/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/,fu=/^(u?int)(8|16|24|32|40|48|56|64|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256)?$/;function Kt(e,t){if(e.length!==t.length)throw new tg({expectedLength:e.length,givenLength:t.length});const n=Kg({params:e,values:t}),r=bi(n);return r.length===0?"0x":r}function Kg({params:e,values:t}){const n=[];for(let r=0;r<e.length;r++)n.push(gi({param:e[r],value:t[r]}));return n}function gi({param:e,value:t}){const n=yi(e.type);if(n){const[r,o]=n;return Xg(t,{length:r,param:{...e,type:o}})}if(e.type==="tuple")return nb(t,{param:e});if(e.type==="address")return Yg(t);if(e.type==="bool")return Jg(t);if(e.type.startsWith("uint")||e.type.startsWith("int")){const r=e.type.startsWith("int"),[,,o="256"]=fu.exec(e.type)??[];return eb(t,{signed:r,size:Number(o)})}if(e.type.startsWith("bytes"))return Qg(t,{param:e});if(e.type==="string")return tb(t);throw new ag(e.type,{docsPath:"/docs/contract/encodeAbiParameters"})}function bi(e){let t=0;for(let s=0;s<e.length;s++){const{dynamic:i,encoded:c}=e[s];i?t+=32:t+=xe(c)}const n=[],r=[];let o=0;for(let s=0;s<e.length;s++){const{dynamic:i,encoded:c}=e[s];i?(n.push(J(t+o,{size:32})),r.push(c),o+=xe(c)):n.push(c)}return vt([...n,...r])}function Yg(e){if(!tt(e))throw new pn({address:e});return{dynamic:!1,encoded:fn(e.toLowerCase())}}function Xg(e,{length:t,param:n}){const r=t===null;if(!Array.isArray(e))throw new Rl(e);if(!r&&e.length!==t)throw new Jm({expectedLength:t,givenLength:e.length,type:`${n.type}[${t}]`});let o=!1;const s=[];for(let i=0;i<e.length;i++){const c=gi({param:n,value:e[i]});c.dynamic&&(o=!0),s.push(c)}if(r||o){const i=bi(s);if(r){const c=J(s.length,{size:32});return{dynamic:!0,encoded:s.length>0?vt([c,i]):c}}if(o)return{dynamic:!0,encoded:i}}return{dynamic:!1,encoded:vt(s.map(({encoded:i})=>i))}}function Qg(e,{param:t}){const[,n]=t.type.split("bytes"),r=xe(e);if(!n){let o=e;return r%32!==0&&(o=fn(o,{dir:"right",size:Math.ceil((e.length-2)/2/32)*32})),{dynamic:!0,encoded:vt([fn(J(r,{size:32})),o])}}if(r!==Number.parseInt(n))throw new eg({expectedSize:Number.parseInt(n),value:e});return{dynamic:!1,encoded:fn(e,{dir:"right"})}}function Jg(e){if(typeof e!="boolean")throw new G(`Invalid boolean value: "${e}" (type: ${typeof e}). Expected: \`true\` or \`false\`.`);return{dynamic:!1,encoded:fn(Hl(e))}}function eb(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 zl({max:r.toString(),min:o.toString(),signed:t,size:n/8,value:e.toString()})}return{dynamic:!1,encoded:J(e,{size:32,signed:t})}}function tb(e){const t=Dr(e),n=Math.ceil(xe(t)/32),r=[];for(let o=0;o<n;o++)r.push(fn(or(t,o*32,(o+1)*32),{dir:"right"}));return{dynamic:!0,encoded:vt([fn(J(xe(t),{size:32})),...r])}}function nb(e,{param:t}){let n=!1;const r=[];for(let o=0;o<t.components.length;o++){const s=t.components[o],i=Array.isArray(e)?o:s.name,c=gi({param:s,value:e[i]});r.push(c),c.dynamic&&(n=!0)}return{dynamic:n,encoded:n?bi(r):vt(r.map(({encoded:o})=>o))}}function yi(e){const t=e.match(/^(.*)\[(\d+)?\]$/);return t?[t[2]?Number(t[2]):null,t[1]]:void 0}const jr=e=>or(iu(e),0,4);function On(e){const{abi:t,args:n=[],name:r}=e,o=bt(r,{strict:!1}),s=t.filter(c=>o?c.type==="function"?jr(c)===r:c.type==="event"?Vo(c)===r:!1:"name"in c&&c.name===r);if(s.length===0)return;if(s.length===1)return s[0];let i;for(const c of s){if(!("inputs"in c))continue;if(!n||n.length===0){if(!c.inputs||c.inputs.length===0)return c;continue}if(!c.inputs||c.inputs.length===0||c.inputs.length!==n.length)continue;if(n.every((l,u)=>{const f="inputs"in c&&c.inputs[u];return f?wi(l,f):!1})){if(i&&"inputs"in i&&i.inputs){const l=du(c.inputs,i.inputs,n);if(l)throw new sg({abiItem:c,type:l[0]},{abiItem:i,type:l[1]})}i=c}}return i||s[0]}function wi(e,t){const n=typeof e,r=t.type;switch(r){case"address":return tt(e,{strict:!1});case"bool":return n==="boolean";case"function":return n==="string";case"string":return n==="string";default:return r==="tuple"&&"components"in t?Object.values(t.components).every((o,s)=>wi(Object.values(e)[s],o)):/^u?int(8|16|24|32|40|48|56|64|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256)?$/.test(r)?n==="number"||n==="bigint":/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/.test(r)?n==="string"||e instanceof Uint8Array:/[a-z]+[1-9]{0,3}(\[[0-9]{0,}\])+$/.test(r)?Array.isArray(e)&&e.every(o=>wi(o,{...t,type:r.replace(/(\[[0-9]{0,}\])$/,"")})):!1}}function du(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 du(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")?tt(n[r],{strict:!1}):i.includes("address")&&i.includes("bytes")?tt(n[r],{strict:!1}):!1)return i}}const pu="/docs/contract/encodeEventTopics";function _r(e){var a;const{abi:t,eventName:n,args:r}=e;let o=t[0];if(n){const l=On({abi:t,name:n});if(!l)throw new Dl(n,{docsPath:pu});o=l}if(o.type!=="event")throw new Dl(void 0,{docsPath:pu});const s=gt(o),i=Vo(s);let c=[];if(r&&"inputs"in o){const l=(a=o.inputs)==null?void 0:a.filter(f=>"indexed"in f&&f.indexed),u=Array.isArray(r)?r:Object.values(r).length>0?(l==null?void 0:l.map(f=>r[f.name]))??[]:[];u.length>0&&(c=(l==null?void 0:l.map((f,p)=>Array.isArray(u[p])?u[p].map((d,h)=>hu({param:f,value:u[p][h]})):typeof u[p]<"u"&&u[p]!==null?hu({param:f,value:u[p]}):null))??[])}return[i,...c]}function hu({param:e,value:t}){if(e.type==="string"||e.type==="bytes")return Ie(Qn(t));if(e.type==="tuple"||e.type.match(/^(.*)\[(\d+)?\]$/))throw new ug(e.type);return Kt([e],[t])}function qo(e,{method:t}){var r,o;const n={};return e.transport.type==="fallback"&&((o=(r=e.transport).onResponse)==null||o.call(r,({method:s,response:i,status:c,transport:a})=>{c==="success"&&t===s&&(n[i]=a.request)})),s=>n[s]||e.request}async function mu(e,t){const{address:n,abi:r,args:o,eventName:s,fromBlock:i,strict:c,toBlock:a}=t,l=qo(e,{method:"eth_newFilter"}),u=s?_r({abi:r,args:o,eventName:s}):void 0,f=await e.request({method:"eth_newFilter",params:[{address:n,fromBlock:typeof i=="bigint"?J(i):i,toBlock:typeof a=="bigint"?J(a):a,topics:u}]});return{abi:r,args:o,eventName:s,id:f,request:l(f),strict:!!c,type:"event"}}function xt(e){return typeof e=="string"?{address:e,type:"json-rpc"}:e}const gu="/docs/contract/encodeFunctionData";function rb(e){const{abi:t,args:n,functionName:r}=e;let o=t[0];if(r){const s=On({abi:t,args:n,name:r});if(!s)throw new Yn(r,{docsPath:gu});o=s}if(o.type!=="function")throw new Yn(void 0,{docsPath:gu});return{abi:[o],functionName:jr(gt(o))}}function Ct(e){const{args:t}=e,{abi:n,functionName:r}=(()=>{var c;return e.abi.length===1&&((c=e.functionName)!=null&&c.startsWith("0x"))?e:rb(e)})(),o=n[0],s=r,i="inputs"in o&&o.inputs?Kt(o.inputs,t??[]):void 0;return rr([s,i??"0x"])}const bu={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."},yu={inputs:[{name:"message",type:"string"}],name:"Error",type:"error"},ob={inputs:[{name:"reason",type:"uint256"}],name:"Panic",type:"error"};class wu extends G{constructor({offset:t}){super(`Offset \`${t}\` cannot be negative.`,{name:"NegativeOffsetError"})}}class vu extends G{constructor({length:t,position:n}){super(`Position \`${n}\` is out of bounds (\`0 < position < ${t}\`).`,{name:"PositionOutOfBoundsError"})}}class sb extends G{constructor({count:t,limit:n}){super(`Recursive read limit of \`${n}\` exceeded (recursive read count: \`${t}\`).`,{name:"RecursiveReadLimitExceededError"})}}const ib={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 sb({count:this.recursiveReadCount+1,limit:this.recursiveReadLimit})},assertPosition(e){if(e<0||e>this.bytes.length-1)throw new vu({length:this.bytes.length,position:e})},decrementPosition(e){if(e<0)throw new wu({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 wu({offset:e});const t=this.position+e;this.assertPosition(t),this.position=t},inspectByte(e){const t=e??this.position;return this.assertPosition(t),this.bytes[t]},inspectBytes(e,t){const n=t??this.position;return this.assertPosition(n+e-1),this.bytes.subarray(n,n+e)},inspectUint8(e){const t=e??this.position;return this.assertPosition(t),this.bytes[t]},inspectUint16(e){const t=e??this.position;return this.assertPosition(t+1),this.dataView.getUint16(t)},inspectUint24(e){const t=e??this.position;return this.assertPosition(t+2),(this.dataView.getUint16(t)<<8)+this.dataView.getUint8(t+2)},inspectUint32(e){const t=e??this.position;return this.assertPosition(t+3),this.dataView.getUint32(t)},pushByte(e){this.assertPosition(this.position),this.bytes[this.position]=e,this.position++},pushBytes(e){this.assertPosition(this.position+e.length-1),this.bytes.set(e,this.position),this.position+=e.length},pushUint8(e){this.assertPosition(this.position),this.bytes[this.position]=e,this.position++},pushUint16(e){this.assertPosition(this.position+1),this.dataView.setUint16(this.position,e),this.position+=2},pushUint24(e){this.assertPosition(this.position+2),this.dataView.setUint16(this.position,e>>8),this.dataView.setUint8(this.position+2,e&255),this.position+=3},pushUint32(e){this.assertPosition(this.position+3),this.dataView.setUint32(this.position,e),this.position+=4},readByte(){this.assertReadLimit(),this._touch();const e=this.inspectByte();return this.position++,e},readBytes(e,t){this.assertReadLimit(),this._touch();const n=this.inspectBytes(e);return this.position+=t??e,n},readUint8(){this.assertReadLimit(),this._touch();const e=this.inspectUint8();return this.position+=1,e},readUint16(){this.assertReadLimit(),this._touch();const e=this.inspectUint16();return this.position+=2,e},readUint24(){this.assertReadLimit(),this._touch();const e=this.inspectUint24();return this.position+=3,e},readUint32(){this.assertReadLimit(),this._touch();const e=this.inspectUint32();return this.position+=4,e},get remaining(){return this.bytes.length-this.position},setPosition(e){const t=this.position;return this.assertPosition(e),this.position=e,()=>this.position=t},_touch(){if(this.recursiveReadLimit===Number.POSITIVE_INFINITY)return;const e=this.getReadCount();this.positionReadCount.set(this.position,e+1),e>0&&this.recursiveReadCount++}};function vi(e,{recursiveReadLimit:t=8192}={}){const n=Object.create(ib);return n.bytes=e,n.dataView=new DataView(e.buffer,e.byteOffset,e.byteLength),n.positionReadCount=new Map,n.recursiveReadLimit=t,n}function ab(e,t={}){typeof t.size<"u"&&yt(e,{size:t.size});const n=$e(e,t);return Nt(n,t)}function cb(e,t={}){let n=e;if(typeof t.size<"u"&&(yt(n,{size:t.size}),n=Tn(n)),n.length>1||n[0]>1)throw new dg(n);return!!n[0]}function Yt(e,t={}){typeof t.size<"u"&&yt(e,{size:t.size});const n=$e(e,t);return Wt(n,t)}function lb(e,t={}){let n=e;return typeof t.size<"u"&&(yt(n,{size:t.size}),n=Tn(n,{dir:"right"})),new TextDecoder().decode(n)}function Ur(e,t){const n=typeof t=="string"?wt(t):t,r=vi(n);if(xe(n)===0&&e.length>0)throw new Br;if(xe(t)&&xe(t)<32)throw new Ml({data:typeof t=="string"?t:$e(t),params:e,size:xe(t)});let o=0;const s=[];for(let i=0;i<e.length;++i){const c=e[i];r.setPosition(o);const[a,l]=sr(r,c,{staticPosition:0});o+=l,s.push(a)}return s}function sr(e,t,{staticPosition:n}){const r=yi(t.type);if(r){const[o,s]=r;return fb(e,{...t,type:s},{length:o,staticPosition:n})}if(t.type==="tuple")return mb(e,t,{staticPosition:n});if(t.type==="address")return ub(e);if(t.type==="bool")return db(e);if(t.type.startsWith("bytes"))return pb(e,t,{staticPosition:n});if(t.type.startsWith("uint")||t.type.startsWith("int"))return hb(e,t);if(t.type==="string")return gb(e,{staticPosition:n});throw new cg(t.type,{docsPath:"/docs/contract/decodeAbiParameters"})}const xu=32,xi=32;function ub(e){const t=e.readBytes(32);return[Go($e(lu(t,-20))),32]}function fb(e,t,{length:n,staticPosition:r}){if(!n){const i=Yt(e.readBytes(xi)),c=r+i,a=c+xu;e.setPosition(c);const l=Yt(e.readBytes(xu)),u=zr(t);let f=0;const p=[];for(let d=0;d<l;++d){e.setPosition(a+(u?d*32:f));const[h,m]=sr(e,t,{staticPosition:a});f+=m,p.push(h)}return e.setPosition(r+32),[p,32]}if(zr(t)){const i=Yt(e.readBytes(xi)),c=r+i,a=[];for(let l=0;l<n;++l){e.setPosition(c+l*32);const[u]=sr(e,t,{staticPosition:c});a.push(u)}return e.setPosition(r+32),[a,32]}let o=0;const s=[];for(let i=0;i<n;++i){const[c,a]=sr(e,t,{staticPosition:r+o});o+=a,s.push(c)}return[s,o]}function db(e){return[cb(e.readBytes(32),{size:32}),32]}function pb(e,t,{staticPosition:n}){const[r,o]=t.type.split("bytes");if(!o){const i=Yt(e.readBytes(32));e.setPosition(n+i);const c=Yt(e.readBytes(32));if(c===0)return e.setPosition(n+32),["0x",32];const a=e.readBytes(c);return e.setPosition(n+32),[$e(a),32]}return[$e(e.readBytes(Number.parseInt(o),32)),32]}function hb(e,t){const n=t.type.startsWith("int"),r=Number.parseInt(t.type.split("int")[1]||"256"),o=e.readBytes(32);return[r>48?ab(o,{signed:n}):Yt(o,{signed:n}),32]}function mb(e,t,{staticPosition:n}){const r=t.components.length===0||t.components.some(({name:i})=>!i),o=r?[]:{};let s=0;if(zr(t)){const i=Yt(e.readBytes(xi)),c=n+i;for(let a=0;a<t.components.length;++a){const l=t.components[a];e.setPosition(c+s);const[u,f]=sr(e,l,{staticPosition:c});s+=f,o[r?a:l==null?void 0:l.name]=u}return e.setPosition(n+32),[o,32]}for(let i=0;i<t.components.length;++i){const c=t.components[i],[a,l]=sr(e,c,{staticPosition:n});o[r?i:c==null?void 0:c.name]=a,s+=l}return[o,s]}function gb(e,{staticPosition:t}){const n=Yt(e.readBytes(32)),r=t+n;e.setPosition(r);const o=Yt(e.readBytes(32));if(o===0)return e.setPosition(t+32),["",32];const s=e.readBytes(o,32),i=lb(Tn(s));return e.setPosition(t+32),[i,32]}function zr(e){var r;const{type:t}=e;if(t==="string"||t==="bytes"||t.endsWith("[]"))return!0;if(t==="tuple")return(r=e.components)==null?void 0:r.some(zr);const n=yi(e.type);return!!(n&&zr({...e,type:n[1]}))}function Eu(e){const{abi:t,data:n}=e,r=or(n,0,4);if(r==="0x")throw new Br;const s=[...t||[],yu,ob].find(i=>i.type==="error"&&r===jr(gt(i)));if(!s)throw new Bl(r,{docsPath:"/docs/contract/decodeErrorResult"});return{abiItem:s,args:"inputs"in s&&s.inputs&&s.inputs.length>0?Ur(s.inputs,or(n,4)):void 0,errorName:s.name}}const Te=(e,t,n)=>JSON.stringify(e,(r,o)=>typeof o=="bigint"?o.toString():o,n);function Su({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 bb={gwei:9,wei:18},yb={ether:-9,wei:9};function Ei(e,t){let n=e.toString();const r=n.startsWith("-");r&&(n=n.slice(1)),n=n.padStart(t,"0");let[o,s]=[n.slice(0,n.length-t),n.slice(n.length-t)];return s=s.replace(/(0+)$/,""),`${r?"-":""}${o||"0"}${s?`.${s}`:""}`}function Pu(e,t="wei"){return Ei(e,bb[t])}function Et(e,t="wei"){return Ei(e,yb[t])}class wb extends G{constructor({address:t}){super(`State for account "${t}" is set multiple times.`,{name:"AccountStateConflictError"})}}class vb extends G{constructor(){super("state and stateDiff are set on the same account.",{name:"StateAssignmentConflictError"})}}function $u(e){return e.reduce((t,{slot:n,value:r})=>`${t} ${n}: ${r}
62
62
  `,"")}function xb(e){return e.reduce((t,{address:n,...r})=>{let o=`${t} ${n}:
63
63
  `;return r.nonce&&(o+=` nonce: ${r.nonce}
64
64
  `),r.balance&&(o+=` balance: ${r.balance}
@@ -69,17 +69,17 @@ React keys must be passed directly to JSX without using spread:
69
69
  `).slice(0,-1)}function Zo(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(`
70
70
  `)}class Eb extends G{constructor(){super(["Cannot specify both a `gasPrice` and a `maxFeePerGas`/`maxPriorityFeePerGas`.","Use `maxFeePerGas`/`maxPriorityFeePerGas` for EIP-1559 compatible networks, and `gasPrice` for others."].join(`
71
71
  `),{name:"FeeConflictError"})}}class Sb extends G{constructor({transaction:t}){super("Cannot infer a transaction type from provided transaction.",{metaMessages:["Provided Transaction:","{",Zo(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 Tu extends G{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 Au extends G{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 Pb extends G{constructor({hash:t}){super(`Timed out while waiting for transaction with hash "${t}" to be confirmed.`,{name:"WaitForTransactionReceiptTimeoutError"})}}const $b=e=>e,Hr=e=>e;class Nu extends G{constructor(t,{account:n,docsPath:r,chain:o,data:s,gas:i,gasPrice:c,maxFeePerGas:a,maxPriorityFeePerGas:l,nonce:u,to:f,value:p,stateOverride:d}){var x;const h=n?xt(n):void 0;let m=Zo({from:h==null?void 0:h.address,to:f,value:typeof p<"u"&&`${Pu(p)} ${((x=o==null?void 0:o.nativeCurrency)==null?void 0:x.symbol)||"ETH"}`,data:s,gas:i,gasPrice:typeof c<"u"&&`${Et(c)} gwei`,maxFeePerGas:typeof a<"u"&&`${Et(a)} gwei`,maxPriorityFeePerGas:typeof l<"u"&&`${Et(l)} gwei`,nonce:u});d&&(m+=`
72
- ${xb(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 Tb extends G{constructor(t,{abi:n,args:r,contractAddress:o,docsPath:s,functionName:i,sender:c}){const a=On({abi:n,args:r,name:i}),l=a?Su({abiItem:a,args:r,includeFunctionName:!1,includeName:!1}):void 0,u=a?gt(a,{includeName:!0}):void 0,f=Zo({address:o&&$b(o),function:u,args:l&&l!=="()"&&`${[...Array((i==null?void 0:i.length)??0).keys()].map(()=>" ").join("")}${l}`,sender:c});super(t.shortMessage||`An unknown error occurred while executing the contract function "${i}".`,{cause:t,docsPath:s,metaMessages:[...t.metaMessages?[...t.metaMessages," "]:[],f&&"Contract Call:",f].filter(Boolean),name:"ContractFunctionExecutionError"}),Object.defineProperty(this,"abi",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"args",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"contractAddress",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"formattedArgs",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"functionName",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"sender",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.abi=n,this.args=r,this.cause=t,this.contractAddress=o,this.functionName=i,this.sender=c}}class Ei extends G{constructor({abi:t,data:n,functionName:r,message:o}){let s,i,c,a;if(n&&n!=="0x")try{i=Eu({abi:t,data:n});const{abiItem:u,errorName:f,args:p}=i;if(f==="Error")a=p[0];else if(f==="Panic"){const[d]=p;a=bu[d]}else{const d=u?gt(u,{includeName:!0}):void 0,h=u&&p?Su({abiItem:u,args:p,includeFunctionName:!1,includeName:!1}):void 0;c=[d?`Error: ${d}`:"",h&&h!=="()"?` ${[...Array((f==null?void 0:f.length)??0).keys()].map(()=>" ").join("")}${h}`:""]}}catch(u){s=u}else o&&(a=o);let l;s instanceof Bl&&(l=s.signature,c=[`Unable to decode signature "${l}" as it was not found on the provided ABI.`,"Make sure you are using the correct ABI and that the error exists on it.",`You can look up the decoded signature here: https://openchain.xyz/signatures?query=${l}.`]),super(a&&a!=="execution reverted"||l?[`The contract function "${r}" reverted with the following ${l?"signature":"reason"}:`,a||l].join(`
73
- `):`The contract function "${r}" reverted.`,{cause:s,metaMessages:c,name:"ContractFunctionRevertedError"}),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"raw",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"reason",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"signature",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.data=i,this.raw=n,this.reason=a,this.signature=l}}class Ab extends G{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 Nb extends G{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 Ko extends G{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 Cn extends G{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: ${Hr(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 Si extends G{constructor({body:t,error:n,url:r}){super("RPC Request failed.",{cause:n,details:n.message,metaMessages:[`URL: ${Hr(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 Ou extends G{constructor({body:t,url:n}){super("The request took too long to respond.",{details:"The request timed out.",metaMessages:[`URL: ${Hr(n)}`,`Request body: ${Te(t)}`],name:"TimeoutError"})}}const Ob=-1;class je extends G{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 Si?t.code:n??Ob}}class Ke extends je{constructor(t,n){super(t,n),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.data=n.data}}class Wr extends je{constructor(t){super(t,{code:Wr.code,name:"ParseRpcError",shortMessage:"Invalid JSON was received by the server. An error occurred on the server while parsing the JSON text."})}}Object.defineProperty(Wr,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32700});class Vr extends je{constructor(t){super(t,{code:Vr.code,name:"InvalidRequestRpcError",shortMessage:"JSON is not a valid request object."})}}Object.defineProperty(Vr,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32600});class Gr extends je{constructor(t,{method:n}={}){super(t,{code:Gr.code,name:"MethodNotFoundRpcError",shortMessage:`The method${n?` "${n}"`:""} does not exist / is not available.`})}}Object.defineProperty(Gr,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32601});class qr extends je{constructor(t){super(t,{code:qr.code,name:"InvalidParamsRpcError",shortMessage:["Invalid parameters were provided to the RPC method.","Double check you have provided the correct parameters."].join(`
72
+ ${xb(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 Tb extends G{constructor(t,{abi:n,args:r,contractAddress:o,docsPath:s,functionName:i,sender:c}){const a=On({abi:n,args:r,name:i}),l=a?Su({abiItem:a,args:r,includeFunctionName:!1,includeName:!1}):void 0,u=a?gt(a,{includeName:!0}):void 0,f=Zo({address:o&&$b(o),function:u,args:l&&l!=="()"&&`${[...Array((i==null?void 0:i.length)??0).keys()].map(()=>" ").join("")}${l}`,sender:c});super(t.shortMessage||`An unknown error occurred while executing the contract function "${i}".`,{cause:t,docsPath:s,metaMessages:[...t.metaMessages?[...t.metaMessages," "]:[],f&&"Contract Call:",f].filter(Boolean),name:"ContractFunctionExecutionError"}),Object.defineProperty(this,"abi",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"args",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"contractAddress",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"formattedArgs",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"functionName",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"sender",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.abi=n,this.args=r,this.cause=t,this.contractAddress=o,this.functionName=i,this.sender=c}}class Si extends G{constructor({abi:t,data:n,functionName:r,message:o}){let s,i,c,a;if(n&&n!=="0x")try{i=Eu({abi:t,data:n});const{abiItem:u,errorName:f,args:p}=i;if(f==="Error")a=p[0];else if(f==="Panic"){const[d]=p;a=bu[d]}else{const d=u?gt(u,{includeName:!0}):void 0,h=u&&p?Su({abiItem:u,args:p,includeFunctionName:!1,includeName:!1}):void 0;c=[d?`Error: ${d}`:"",h&&h!=="()"?` ${[...Array((f==null?void 0:f.length)??0).keys()].map(()=>" ").join("")}${h}`:""]}}catch(u){s=u}else o&&(a=o);let l;s instanceof Bl&&(l=s.signature,c=[`Unable to decode signature "${l}" as it was not found on the provided ABI.`,"Make sure you are using the correct ABI and that the error exists on it.",`You can look up the decoded signature here: https://openchain.xyz/signatures?query=${l}.`]),super(a&&a!=="execution reverted"||l?[`The contract function "${r}" reverted with the following ${l?"signature":"reason"}:`,a||l].join(`
73
+ `):`The contract function "${r}" reverted.`,{cause:s,metaMessages:c,name:"ContractFunctionRevertedError"}),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"raw",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"reason",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"signature",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.data=i,this.raw=n,this.reason=a,this.signature=l}}class Ab extends G{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 Nb extends G{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 Ko extends G{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 Cn extends G{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: ${Hr(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 Pi extends G{constructor({body:t,error:n,url:r}){super("RPC Request failed.",{cause:n,details:n.message,metaMessages:[`URL: ${Hr(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 Ou extends G{constructor({body:t,url:n}){super("The request took too long to respond.",{details:"The request timed out.",metaMessages:[`URL: ${Hr(n)}`,`Request body: ${Te(t)}`],name:"TimeoutError"})}}const Ob=-1;class je extends G{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 Pi?t.code:n??Ob}}class Ke extends je{constructor(t,n){super(t,n),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.data=n.data}}class Wr extends je{constructor(t){super(t,{code:Wr.code,name:"ParseRpcError",shortMessage:"Invalid JSON was received by the server. An error occurred on the server while parsing the JSON text."})}}Object.defineProperty(Wr,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32700});class Vr extends je{constructor(t){super(t,{code:Vr.code,name:"InvalidRequestRpcError",shortMessage:"JSON is not a valid request object."})}}Object.defineProperty(Vr,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32600});class Gr extends je{constructor(t,{method:n}={}){super(t,{code:Gr.code,name:"MethodNotFoundRpcError",shortMessage:`The method${n?` "${n}"`:""} does not exist / is not available.`})}}Object.defineProperty(Gr,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32601});class qr extends je{constructor(t){super(t,{code:qr.code,name:"InvalidParamsRpcError",shortMessage:["Invalid parameters were provided to the RPC method.","Double check you have provided the correct parameters."].join(`
74
74
  `)})}}Object.defineProperty(qr,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32602});class In extends je{constructor(t){super(t,{code:In.code,name:"InternalRpcError",shortMessage:"An internal error was received."})}}Object.defineProperty(In,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32603});class Mn extends je{constructor(t){super(t,{code:Mn.code,name:"InvalidInputRpcError",shortMessage:["Missing or invalid parameters.","Double check you have provided the correct parameters."].join(`
75
- `)})}}Object.defineProperty(Mn,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32e3});class Zr extends je{constructor(t){super(t,{code:Zr.code,name:"ResourceNotFoundRpcError",shortMessage:"Requested resource not found."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ResourceNotFoundRpcError"})}}Object.defineProperty(Zr,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32001});class Kr extends je{constructor(t){super(t,{code:Kr.code,name:"ResourceUnavailableRpcError",shortMessage:"Requested resource not available."})}}Object.defineProperty(Kr,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32002});class Yr extends je{constructor(t){super(t,{code:Yr.code,name:"TransactionRejectedRpcError",shortMessage:"Transaction creation failed."})}}Object.defineProperty(Yr,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32003});class kn extends je{constructor(t,{method:n}={}){super(t,{code:kn.code,name:"MethodNotSupportedRpcError",shortMessage:`Method${n?` "${n}"`:""} is not supported.`})}}Object.defineProperty(kn,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32004});class ir extends je{constructor(t){super(t,{code:ir.code,name:"LimitExceededRpcError",shortMessage:"Request exceeds defined limit."})}}Object.defineProperty(ir,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32005});class Xr extends je{constructor(t){super(t,{code:Xr.code,name:"JsonRpcVersionUnsupportedError",shortMessage:"Version of JSON-RPC protocol is not supported."})}}Object.defineProperty(Xr,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32006});class ar extends Ke{constructor(t){super(t,{code:ar.code,name:"UserRejectedRequestError",shortMessage:"User rejected the request."})}}Object.defineProperty(ar,"code",{enumerable:!0,configurable:!0,writable:!0,value:4001});class Qr extends Ke{constructor(t){super(t,{code:Qr.code,name:"UnauthorizedProviderError",shortMessage:"The requested method and/or account has not been authorized by the user."})}}Object.defineProperty(Qr,"code",{enumerable:!0,configurable:!0,writable:!0,value:4100});class Jr extends Ke{constructor(t,{method:n}={}){super(t,{code:Jr.code,name:"UnsupportedProviderMethodError",shortMessage:`The Provider does not support the requested method${n?` " ${n}"`:""}.`})}}Object.defineProperty(Jr,"code",{enumerable:!0,configurable:!0,writable:!0,value:4200});class eo extends Ke{constructor(t){super(t,{code:eo.code,name:"ProviderDisconnectedError",shortMessage:"The Provider is disconnected from all chains."})}}Object.defineProperty(eo,"code",{enumerable:!0,configurable:!0,writable:!0,value:4900});class to extends Ke{constructor(t){super(t,{code:to.code,name:"ChainDisconnectedError",shortMessage:"The Provider is not connected to the requested chain."})}}Object.defineProperty(to,"code",{enumerable:!0,configurable:!0,writable:!0,value:4901});class no extends Ke{constructor(t){super(t,{code:no.code,name:"SwitchChainError",shortMessage:"An error occurred when attempting to switch chain."})}}Object.defineProperty(no,"code",{enumerable:!0,configurable:!0,writable:!0,value:4902});class ro extends Ke{constructor(t){super(t,{code:ro.code,name:"UnsupportedNonOptionalCapabilityError",shortMessage:"This Wallet does not support a capability that was not marked as optional."})}}Object.defineProperty(ro,"code",{enumerable:!0,configurable:!0,writable:!0,value:5700});class oo extends Ke{constructor(t){super(t,{code:oo.code,name:"UnsupportedChainIdError",shortMessage:"This Wallet does not support the requested chain ID."})}}Object.defineProperty(oo,"code",{enumerable:!0,configurable:!0,writable:!0,value:5710});class so extends Ke{constructor(t){super(t,{code:so.code,name:"DuplicateIdError",shortMessage:"There is already a bundle submitted with this ID."})}}Object.defineProperty(so,"code",{enumerable:!0,configurable:!0,writable:!0,value:5720});class io extends Ke{constructor(t){super(t,{code:io.code,name:"UnknownBundleIdError",shortMessage:"This bundle id is unknown / has not been submitted"})}}Object.defineProperty(io,"code",{enumerable:!0,configurable:!0,writable:!0,value:5730});class ao extends Ke{constructor(t){super(t,{code:ao.code,name:"BundleTooLargeError",shortMessage:"The call bundle is too large for the Wallet to process."})}}Object.defineProperty(ao,"code",{enumerable:!0,configurable:!0,writable:!0,value:5740});class co extends Ke{constructor(t){super(t,{code:co.code,name:"AtomicReadyWalletRejectedUpgradeError",shortMessage:"The Wallet can support atomicity after an upgrade, but the user rejected the upgrade."})}}Object.defineProperty(co,"code",{enumerable:!0,configurable:!0,writable:!0,value:5750});class lo extends Ke{constructor(t){super(t,{code:lo.code,name:"AtomicityNotSupportedError",shortMessage:"The wallet does not support atomic execution but the request requires it."})}}Object.defineProperty(lo,"code",{enumerable:!0,configurable:!0,writable:!0,value:5760});class Cb extends je{constructor(t){super(t,{name:"UnknownRpcError",shortMessage:"An unknown RPC error occurred."})}}const Ib=3;function cr(e,{abi:t,address:n,args:r,docsPath:o,functionName:s,sender:i}){const c=e instanceof Ko?e:e instanceof G?e.walk(h=>"data"in h)||e.walk():{},{code:a,data:l,details:u,message:f,shortMessage:p}=c,d=e instanceof Br?new Ab({functionName:s}):[Ib,In.code].includes(a)&&(l||u||f||p)?new Ei({abi:t,data:typeof l=="object"?l.data:l,functionName:s,message:c instanceof Si?u:p??f}):e;return new Tb(d,{abi:t,args:r,contractAddress:n,docsPath:o,functionName:s,sender:i})}function Mb(e){const t=Ie(`0x${e.substring(4)}`).substring(26);return Go(`0x${t}`)}async function kb({hash:e,signature:t}){const n=bt(e)?e:Vt(e),{secp256k1:r}=await Promise.resolve().then(()=>Pv);return`0x${(()=>{if(typeof t=="object"&&"r"in t&&"s"in t){const{r:l,s:u,v:f,yParity:p}=t,d=Number(p??f),h=Cu(d);return new r.Signature(Nt(l),Nt(u)).addRecoveryBit(h)}const i=bt(t)?t:Vt(t);if(xe(i)!==65)throw new Error("invalid signature length");const c=Wt(`0x${i.slice(130)}`),a=Cu(c);return r.Signature.fromCompact(i.substring(2,130)).addRecoveryBit(a)})().recoverPublicKey(n.substring(2)).toHex(!1)}`}function Cu(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 Iu({hash:e,signature:t}){return Mb(await kb({hash:e,signature:t}))}function Bb(e,t="hex"){const n=Mu(e),r=wi(new Uint8Array(n.length));return n.encode(r),t==="hex"?$e(r.bytes):r.bytes}function Mu(e){return Array.isArray(e)?Lb(e.map(t=>Mu(t))):Db(e)}function Lb(e){const t=e.reduce((o,s)=>o+s.length,0),n=ku(t);return{length:t<=55?1+t:1+n+t,encode(o){t<=55?o.pushByte(192+t):(o.pushByte(247+n),n===1?o.pushUint8(t):n===2?o.pushUint16(t):n===3?o.pushUint24(t):o.pushUint32(t));for(const{encode:s}of e)s(o)}}}function Db(e){const t=typeof e=="string"?wt(e):e,n=ku(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 ku(e){if(e<2**8)return 1;if(e<2**16)return 2;if(e<2**24)return 3;if(e<2**32)return 4;throw new G("Length is too large.")}function Fb(e){const{chainId:t,nonce:n,to:r}=e,o=e.contractAddress??e.address,s=Ie(rr(["0x05",Bb([t?J(t):"0x",o,n?J(n):"0x"])]));return r==="bytes"?wt(s):s}async function Rb(e){const{authorization:t,signature:n}=e;return Iu({hash:Fb(t),signature:n??t})}class jb extends G{constructor(t,{account:n,docsPath:r,chain:o,data:s,gas:i,gasPrice:c,maxFeePerGas:a,maxPriorityFeePerGas:l,nonce:u,to:f,value:p}){var h;const d=Zo({from:n==null?void 0:n.address,to:f,value:typeof p<"u"&&`${Pu(p)} ${((h=o==null?void 0:o.nativeCurrency)==null?void 0:h.symbol)||"ETH"}`,data:s,gas:i,gasPrice:typeof c<"u"&&`${Et(c)} gwei`,maxFeePerGas:typeof a<"u"&&`${Et(a)} gwei`,maxPriorityFeePerGas:typeof l<"u"&&`${Et(l)} gwei`,nonce:u});super(t.shortMessage,{cause:t,docsPath:r,metaMessages:[...t.metaMessages?[...t.metaMessages," "]:[],"Estimate Gas Arguments:",d].filter(Boolean),name:"EstimateGasExecutionError"}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.cause=t}}class lr extends G{constructor({cause:t,message:n}={}){var o;const r=(o=n==null?void 0:n.replace("execution reverted: ",""))==null?void 0:o.replace("execution reverted","");super(`Execution reverted ${r?`with reason: ${r}`:"for an unknown reason"}.`,{cause:t,name:"ExecutionRevertedError"})}}Object.defineProperty(lr,"code",{enumerable:!0,configurable:!0,writable:!0,value:3}),Object.defineProperty(lr,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/execution reverted/});class Yo extends G{constructor({cause:t,maxFeePerGas:n}={}){super(`The fee cap (\`maxFeePerGas\`${n?` = ${Et(n)} gwei`:""}) cannot be higher than the maximum allowed value (2^256-1).`,{cause:t,name:"FeeCapTooHighError"})}}Object.defineProperty(Yo,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/max fee per gas higher than 2\^256-1|fee cap higher than 2\^256-1/});class Pi extends G{constructor({cause:t,maxFeePerGas:n}={}){super(`The fee cap (\`maxFeePerGas\`${n?` = ${Et(n)}`:""} gwei) cannot be lower than the block base fee.`,{cause:t,name:"FeeCapTooLowError"})}}Object.defineProperty(Pi,"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 $i extends G{constructor({cause:t,nonce:n}={}){super(`Nonce provided for the transaction ${n?`(${n}) `:""}is higher than the next one expected.`,{cause:t,name:"NonceTooHighError"})}}Object.defineProperty($i,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/nonce too high/});class Ti extends G{constructor({cause:t,nonce:n}={}){super([`Nonce provided for the transaction ${n?`(${n}) `:""}is lower than the current nonce of the account.`,"Try increasing the nonce or find the latest nonce with `getTransactionCount`."].join(`
76
- `),{cause:t,name:"NonceTooLowError"})}}Object.defineProperty(Ti,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/nonce too low|transaction already imported|already known/});class Ai extends G{constructor({cause:t,nonce:n}={}){super(`Nonce provided for the transaction ${n?`(${n}) `:""}exceeds the maximum allowed nonce.`,{cause:t,name:"NonceMaxValueError"})}}Object.defineProperty(Ai,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/nonce has max value/});class Ni extends G{constructor({cause:t}={}){super(["The total cost (gas * gas fee + value) of executing this transaction exceeds the balance of the account."].join(`
77
- `),{cause:t,metaMessages:["This error could arise when the account does not have enough funds to:"," - pay for the total gas fee,"," - pay for the value to send."," ","The cost of the transaction is calculated as `gas * gas fee + value`, where:"," - `gas` is the amount of gas needed for transaction to execute,"," - `gas fee` is the gas fee,"," - `value` is the amount of ether to send to the recipient."],name:"InsufficientFundsError"})}}Object.defineProperty(Ni,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/insufficient funds|exceeds transaction sender account balance/});class Oi extends G{constructor({cause:t,gas:n}={}){super(`The amount of gas ${n?`(${n}) `:""}provided for the transaction exceeds the limit allowed for the block.`,{cause:t,name:"IntrinsicGasTooHighError"})}}Object.defineProperty(Oi,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/intrinsic gas too high|gas limit reached/});class Ci extends G{constructor({cause:t,gas:n}={}){super(`The amount of gas ${n?`(${n}) `:""}provided for the transaction is too low.`,{cause:t,name:"IntrinsicGasTooLowError"})}}Object.defineProperty(Ci,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/intrinsic gas too low/});class Ii extends G{constructor({cause:t}){super("The transaction type is not supported for this chain.",{cause:t,name:"TransactionTypeNotSupportedError"})}}Object.defineProperty(Ii,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/transaction type not valid/});class Xo extends G{constructor({cause:t,maxPriorityFeePerGas:n,maxFeePerGas:r}={}){super([`The provided tip (\`maxPriorityFeePerGas\`${n?` = ${Et(n)} gwei`:""}) cannot be higher than the fee cap (\`maxFeePerGas\`${r?` = ${Et(r)} gwei`:""}).`].join(`
78
- `),{cause:t,name:"TipAboveFeeCapError"})}}Object.defineProperty(Xo,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/max priority fee per gas higher than max fee per gas|tip higher than fee cap/});class Qo extends G{constructor({cause:t}){super(`An error occurred while executing: ${t==null?void 0:t.shortMessage}`,{cause:t,name:"UnknownNodeError"})}}function Mi(e,t){const n=(e.details||"").toLowerCase(),r=e instanceof G?e.walk(o=>(o==null?void 0:o.code)===lr.code):e;return r instanceof G?new lr({cause:e,message:r.details}):lr.nodeMessage.test(n)?new lr({cause:e,message:e.details}):Yo.nodeMessage.test(n)?new Yo({cause:e,maxFeePerGas:t==null?void 0:t.maxFeePerGas}):Pi.nodeMessage.test(n)?new Pi({cause:e,maxFeePerGas:t==null?void 0:t.maxFeePerGas}):$i.nodeMessage.test(n)?new $i({cause:e,nonce:t==null?void 0:t.nonce}):Ti.nodeMessage.test(n)?new Ti({cause:e,nonce:t==null?void 0:t.nonce}):Ai.nodeMessage.test(n)?new Ai({cause:e,nonce:t==null?void 0:t.nonce}):Ni.nodeMessage.test(n)?new Ni({cause:e}):Oi.nodeMessage.test(n)?new Oi({cause:e,gas:t==null?void 0:t.gas}):Ci.nodeMessage.test(n)?new Ci({cause:e,gas:t==null?void 0:t.gas}):Ii.nodeMessage.test(n)?new Ii({cause:e}):Xo.nodeMessage.test(n)?new Xo({cause:e,maxFeePerGas:t==null?void 0:t.maxFeePerGas,maxPriorityFeePerGas:t==null?void 0:t.maxPriorityFeePerGas}):new Qo({cause:e})}function _b(e,{docsPath:t,...n}){const r=(()=>{const o=Mi(e,n);return o instanceof Qo?e:o})();return new jb(r,{docsPath:t,...n})}function ki(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 Ub={legacy:"0x0",eip2930:"0x1",eip1559:"0x2",eip4844:"0x3",eip7702:"0x4"};function Jo(e){const t={};return typeof e.authorizationList<"u"&&(t.authorizationList=zb(e.authorizationList)),typeof e.accessList<"u"&&(t.accessList=e.accessList),typeof e.blobVersionedHashes<"u"&&(t.blobVersionedHashes=e.blobVersionedHashes),typeof e.blobs<"u"&&(typeof e.blobs[0]!="string"?t.blobs=e.blobs.map(n=>$e(n)):t.blobs=e.blobs),typeof e.data<"u"&&(t.data=e.data),typeof e.from<"u"&&(t.from=e.from),typeof e.gas<"u"&&(t.gas=J(e.gas)),typeof e.gasPrice<"u"&&(t.gasPrice=J(e.gasPrice)),typeof e.maxFeePerBlobGas<"u"&&(t.maxFeePerBlobGas=J(e.maxFeePerBlobGas)),typeof e.maxFeePerGas<"u"&&(t.maxFeePerGas=J(e.maxFeePerGas)),typeof e.maxPriorityFeePerGas<"u"&&(t.maxPriorityFeePerGas=J(e.maxPriorityFeePerGas)),typeof e.nonce<"u"&&(t.nonce=J(e.nonce)),typeof e.to<"u"&&(t.to=e.to),typeof e.type<"u"&&(t.type=Ub[e.type]),typeof e.value<"u"&&(t.value=J(e.value)),t}function zb(e){return e.map(t=>({address:t.address,r:t.r?J(BigInt(t.r)):t.r,s:t.s?J(BigInt(t.s)):t.s,chainId:J(t.chainId),nonce:J(t.nonce),...typeof t.yParity<"u"?{yParity:J(t.yParity)}:{},...typeof t.v<"u"&&typeof t.yParity>"u"?{v:J(t.v)}:{}}))}function Bu(e){if(!(!e||e.length===0))return e.reduce((t,{slot:n,value:r})=>{if(n.length!==66)throw new Ul({size:n.length,targetSize:66,type:"hex"});if(r.length!==66)throw new Ul({size:r.length,targetSize:66,type:"hex"});return t[n]=r,t},{})}function Hb(e){const{balance:t,nonce:n,state:r,stateDiff:o,code:s}=e,i={};if(s!==void 0&&(i.code=s),t!==void 0&&(i.balance=J(t)),n!==void 0&&(i.nonce=J(n)),r!==void 0&&(i.state=Bu(r)),o!==void 0){if(i.state)throw new vb;i.stateDiff=Bu(o)}return i}function Bi(e){if(!e)return;const t={};for(const{address:n,...r}of e){if(!tt(n,{strict:!1}))throw new pn({address:n});if(t[n])throw new wb({address:n});t[n]=Hb(r)}return t}const Lu=2n**256n-1n;function uo(e){const{account:t,gasPrice:n,maxFeePerGas:r,maxPriorityFeePerGas:o,to:s}=e,i=t?xt(t):void 0;if(i&&!tt(i.address))throw new pn({address:i.address});if(s&&!tt(s))throw new pn({address:s});if(typeof n<"u"&&(typeof r<"u"||typeof o<"u"))throw new Eb;if(r&&r>Lu)throw new Yo({maxFeePerGas:r});if(o&&r&&o>r)throw new Xo({maxFeePerGas:r,maxPriorityFeePerGas:o})}class Wb extends G{constructor(){super("`baseFeeMultiplier` must be greater than 1.",{name:"BaseFeeScalarError"})}}class Li extends G{constructor(){super("Chain does not support EIP-1559 fees.",{name:"Eip1559FeesNotSupportedError"})}}class Vb extends G{constructor({maxPriorityFeePerGas:t}){super(`\`maxFeePerGas\` cannot be less than the \`maxPriorityFeePerGas\` (${Et(t)} gwei).`,{name:"MaxFeePerGasTooLowError"})}}class Du extends G{constructor({blockHash:t,blockNumber:n}){let r="Block";t&&(r=`Block at hash "${t}"`),n&&(r=`Block at number "${n}"`),super(`${r} could not be found.`,{name:"BlockNotFoundError"})}}const Fu={"0x0":"legacy","0x1":"eip2930","0x2":"eip1559","0x3":"eip4844","0x4":"eip7702"};function Ru(e){const t={...e,blockHash:e.blockHash?e.blockHash:null,blockNumber:e.blockNumber?BigInt(e.blockNumber):null,chainId:e.chainId?Wt(e.chainId):void 0,gas:e.gas?BigInt(e.gas):void 0,gasPrice:e.gasPrice?BigInt(e.gasPrice):void 0,maxFeePerBlobGas:e.maxFeePerBlobGas?BigInt(e.maxFeePerBlobGas):void 0,maxFeePerGas:e.maxFeePerGas?BigInt(e.maxFeePerGas):void 0,maxPriorityFeePerGas:e.maxPriorityFeePerGas?BigInt(e.maxPriorityFeePerGas):void 0,nonce:e.nonce?Wt(e.nonce):void 0,to:e.to?e.to:null,transactionIndex:e.transactionIndex?Number(e.transactionIndex):null,type:e.type?Fu[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=Gb(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 Gb(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 ju(e){const t=(e.transactions??[]).map(n=>typeof n=="string"?n:Ru(n));return{...e,baseFeePerGas:e.baseFeePerGas?BigInt(e.baseFeePerGas):null,blobGasUsed:e.blobGasUsed?BigInt(e.blobGasUsed):void 0,difficulty:e.difficulty?BigInt(e.difficulty):void 0,excessBlobGas:e.excessBlobGas?BigInt(e.excessBlobGas):void 0,gasLimit:e.gasLimit?BigInt(e.gasLimit):void 0,gasUsed:e.gasUsed?BigInt(e.gasUsed):void 0,hash:e.hash?e.hash:null,logsBloom:e.logsBloom?e.logsBloom:null,nonce:e.nonce?e.nonce:null,number:e.number?BigInt(e.number):null,size:e.size?BigInt(e.size):void 0,timestamp:e.timestamp?BigInt(e.timestamp):void 0,transactions:t,totalDifficulty:e.totalDifficulty?BigInt(e.totalDifficulty):null}}async function It(e,{blockHash:t,blockNumber:n,blockTag:r=e.experimental_blockTag??"latest",includeTransactions:o}={}){var l,u,f;const s=o??!1,i=n!==void 0?J(n):void 0;let c=null;if(t?c=await e.request({method:"eth_getBlockByHash",params:[t,s]},{dedupe:!0}):c=await e.request({method:"eth_getBlockByNumber",params:[i||r,s]},{dedupe:!!i}),!c)throw new Du({blockHash:t,blockNumber:n});return(((f=(u=(l=e.chain)==null?void 0:l.formatters)==null?void 0:u.block)==null?void 0:f.format)||ju)(c)}async function Di(e){const t=await e.request({method:"eth_gasPrice"});return BigInt(t)}async function qb(e,t){return _u(e,t)}async function _u(e,t){var s,i;const{block:n,chain:r=e.chain,request:o}=t||{};try{const c=((s=r==null?void 0:r.fees)==null?void 0:s.maxPriorityFeePerGas)??((i=r==null?void 0:r.fees)==null?void 0:i.defaultPriorityFee);if(typeof c=="function"){const l=n||await ee(e,It,"getBlock")({}),u=await c({block:l,client:e,request:o});if(u===null)throw new Error;return u}if(typeof c<"u")return c;const a=await e.request({method:"eth_maxPriorityFeePerGas"});return Nt(a)}catch{const[c,a]=await Promise.all([n?Promise.resolve(n):ee(e,It,"getBlock")({}),ee(e,Di,"getGasPrice")({})]);if(typeof c.baseFeePerGas!="bigint")throw new Li;const l=a-c.baseFeePerGas;return l<0n?0n:l}}async function Zb(e,t){return Fi(e,t)}async function Fi(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 Wb;const a=10**(((p=i.toString().split(".")[1])==null?void 0:p.length)??0),l=h=>h*BigInt(Math.ceil(i*a))/BigInt(a),u=n||await ee(e,It,"getBlock")({});if(typeof((d=r==null?void 0:r.fees)==null?void 0:d.estimateFeesPerGas)=="function"){const h=await r.fees.estimateFeesPerGas({block:n,client:e,multiply:l,request:o,type:s});if(h!==null)return h}if(s==="eip1559"){if(typeof u.baseFeePerGas!="bigint")throw new Li;const h=typeof(o==null?void 0:o.maxPriorityFeePerGas)=="bigint"?o.maxPriorityFeePerGas:await _u(e,{block:u,chain:r,request:o}),m=l(u.baseFeePerGas);return{maxFeePerGas:(o==null?void 0:o.maxFeePerGas)??m+h,maxPriorityFeePerGas:h}}return{gasPrice:(o==null?void 0:o.gasPrice)??l(await ee(e,Di,"getGasPrice")({}))}}async function Uu(e,{address:t,blockTag:n="latest",blockNumber:r}){const o=await e.request({method:"eth_getTransactionCount",params:[t,typeof r=="bigint"?J(r):n]},{dedupe:!!r});return Wt(o)}function zu(e){const{kzg:t}=e,n=e.to??(typeof e.blobs[0]=="string"?"hex":"bytes"),r=typeof e.blobs[0]=="string"?e.blobs.map(s=>wt(s)):e.blobs,o=[];for(const s of r)o.push(Uint8Array.from(t.blobToKzgCommitment(s)));return n==="bytes"?o:o.map(s=>$e(s))}function Hu(e){const{kzg:t}=e,n=e.to??(typeof e.blobs[0]=="string"?"hex":"bytes"),r=typeof e.blobs[0]=="string"?e.blobs.map(i=>wt(i)):e.blobs,o=typeof e.commitments[0]=="string"?e.commitments.map(i=>wt(i)):e.commitments,s=[];for(let i=0;i<r.length;i++){const c=r[i],a=o[i];s.push(Uint8Array.from(t.computeBlobKzgProof(c,a)))}return n==="bytes"?s:s.map(i=>$e(i))}function Kb(e,t,n,r){if(typeof e.setBigUint64=="function")return e.setBigUint64(t,n,r);const o=BigInt(32),s=BigInt(4294967295),i=Number(n>>o&s),c=Number(n&s),a=r?4:0,l=r?0:4;e.setUint32(t+a,i,r),e.setUint32(t+l,c,r)}function Yb(e,t,n){return e&t^~e&n}function Xb(e,t,n){return e&t^e&n^t&n}class Qb extends ui{constructor(t,n,r,o){super(),this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.blockLen=t,this.outputLen=n,this.padOffset=r,this.isLE=o,this.buffer=new Uint8Array(t),this.view=li(this.buffer)}update(t){er(this),t=Wo(t),qt(t);const{view:n,buffer:r,blockLen:o}=this,s=t.length;for(let i=0;i<s;){const c=Math.min(o-this.pos,s-i);if(c===o){const a=li(t);for(;o<=s-i;i+=o)this.process(a,i);continue}r.set(t.subarray(i,i+c),this.pos),this.pos+=c,i+=c,this.pos===o&&(this.process(n,0),this.pos=0)}return this.length+=t.length,this.roundClean(),this}digestInto(t){er(this),ql(t,this),this.finished=!0;const{buffer:n,view:r,blockLen:o,isLE:s}=this;let{pos:i}=this;n[i++]=128,tr(this.buffer.subarray(i)),this.padOffset>o-i&&(this.process(r,0),i=0);for(let f=i;f<o;f++)n[f]=0;Kb(r,o-8,BigInt(this.length*8),s),this.process(r,0);const c=li(t),a=this.outputLen;if(a%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const l=a/4,u=this.get();if(l>u.length)throw new Error("_sha2: outputLen bigger than state");for(let f=0;f<l;f++)c.setUint32(4*f,u[f],s)}digest(){const{buffer:t,outputLen:n}=this;this.digestInto(t);const r=t.slice(0,n);return this.destroy(),r}_cloneInto(t){t||(t=new this.constructor),t.set(...this.get());const{blockLen:n,buffer:r,length:o,finished:s,destroyed:i,pos:c}=this;return t.destroyed=i,t.finished=s,t.length=o,t.pos=c,o%n&&t.buffer.set(r),t}clone(){return this._cloneInto()}}const hn=Uint32Array.from([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),Jb=Uint32Array.from([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),mn=new Uint32Array(64);class ey extends Qb{constructor(t=32){super(64,t,8,!1),this.A=hn[0]|0,this.B=hn[1]|0,this.C=hn[2]|0,this.D=hn[3]|0,this.E=hn[4]|0,this.F=hn[5]|0,this.G=hn[6]|0,this.H=hn[7]|0}get(){const{A:t,B:n,C:r,D:o,E:s,F:i,G:c,H:a}=this;return[t,n,r,o,s,i,c,a]}set(t,n,r,o,s,i,c,a){this.A=t|0,this.B=n|0,this.C=r|0,this.D=o|0,this.E=s|0,this.F=i|0,this.G=c|0,this.H=a|0}process(t,n){for(let f=0;f<16;f++,n+=4)mn[f]=t.getUint32(n,!1);for(let f=16;f<64;f++){const p=mn[f-15],d=mn[f-2],h=Ot(p,7)^Ot(p,18)^p>>>3,m=Ot(d,17)^Ot(d,19)^d>>>10;mn[f]=m+mn[f-7]+h+mn[f-16]|0}let{A:r,B:o,C:s,D:i,E:c,F:a,G:l,H:u}=this;for(let f=0;f<64;f++){const p=Ot(c,6)^Ot(c,11)^Ot(c,25),d=u+p+Yb(c,a,l)+Jb[f]+mn[f]|0,m=(Ot(r,2)^Ot(r,13)^Ot(r,22))+Xb(r,o,s)|0;u=l,l=a,a=c,c=i+d|0,i=s,s=o,o=r,r=d+m|0}r=r+this.A|0,o=o+this.B|0,s=s+this.C|0,i=i+this.D|0,c=c+this.E|0,a=a+this.F|0,l=l+this.G|0,u=u+this.H|0,this.set(r,o,s,i,c,a,l,u)}roundClean(){tr(mn)}destroy(){this.set(0,0,0,0,0,0,0,0),tr(this.buffer)}}const Wu=Xl(()=>new ey),ty=Wu;function ny(e,t){return ty(bt(e,{strict:!1})?Qn(e):e)}function ry(e){const{commitment:t,version:n=1}=e,r=e.to??(typeof t=="string"?"hex":"bytes"),o=ny(t);return o.set([n],0),r==="bytes"?o:$e(o)}function oy(e){const{commitments:t,version:n}=e,r=e.to,o=[];for(const s of t)o.push(ry({commitment:s,to:r,version:n}));return o}const Vu=6,Gu=32,Ri=4096,qu=Gu*Ri,Zu=qu*Vu-1-1*Ri*Vu;class sy extends G{constructor({maxSize:t,size:n}){super("Blob size is too large.",{metaMessages:[`Max: ${t} bytes`,`Given: ${n} bytes`],name:"BlobSizeTooLargeError"})}}class iy extends G{constructor(){super("Blob data must not be empty.",{name:"EmptyBlobError"})}}function ay(e){const t=typeof e.data=="string"?wt(e.data):e.data,n=xe(t);if(!n)throw new iy;if(n>Zu)throw new sy({maxSize:Zu,size:n});const r=[];let o=!0,s=0;for(;o;){const i=wi(new Uint8Array(qu));let c=0;for(;c<Ri;){const a=t.slice(s,s+(Gu-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 cy(e){const{data:t,kzg:n,to:r}=e,o=e.blobs??ay({data:t}),s=e.commitments??zu({blobs:o,kzg:n,to:r}),i=e.proofs??Hu({blobs:o,commitments:s,kzg:n,to:r}),c=[];for(let a=0;a<o.length;a++)c.push({blob:o[a],commitment:s[a],proof:i[a]});return c}function ly(e){if(e.type)return e.type;if(typeof e.authorizationList<"u")return"eip7702";if(typeof e.blobs<"u"||typeof e.blobVersionedHashes<"u"||typeof e.maxFeePerBlobGas<"u"||typeof e.sidecars<"u")return"eip4844";if(typeof e.maxFeePerGas<"u"||typeof e.maxPriorityFeePerGas<"u")return"eip1559";if(typeof e.gasPrice<"u")return typeof e.accessList<"u"?"eip2930":"legacy";throw new Sb({transaction:e})}async function Ku(e){const t=await e.request({method:"eth_chainId"},{dedupe:!0});return Wt(t)}const uy=["blobVersionedHashes","chainId","fees","gas","nonce","type"],Yu=new Map;async function Xu(e,t){const{account:n=e.account,blobs:r,chain:o,gas:s,kzg:i,nonce:c,nonceManager:a,parameters:l=uy,type:u}=t,f=n&&xt(n),p={...t,...f?{from:f==null?void 0:f.address}:{}};let d;async function h(){return d||(d=await ee(e,It,"getBlock")({blockTag:"latest"}),d)}let m;async function x(){return m||(o?o.id:typeof t.chainId<"u"?t.chainId:(m=await ee(e,Ku,"getChainId")({}),m))}if(l.includes("nonce")&&typeof c>"u"&&f)if(a){const A=await x();p.nonce=await a.consume({address:f.address,chainId:A,client:e})}else p.nonce=await ee(e,Uu,"getTransactionCount")({address:f.address,blockTag:"pending"});if((l.includes("blobVersionedHashes")||l.includes("sidecars"))&&r&&i){const A=zu({blobs:r,kzg:i});if(l.includes("blobVersionedHashes")){const w=oy({commitments:A,to:"hex"});p.blobVersionedHashes=w}if(l.includes("sidecars")){const w=Hu({blobs:r,commitments:A,kzg:i}),T=cy({blobs:r,commitments:A,proofs:w,to:"hex"});p.sidecars=T}}if(l.includes("chainId")&&(p.chainId=await x()),(l.includes("fees")||l.includes("type"))&&typeof u>"u")try{p.type=ly(p)}catch{let A=Yu.get(e.uid);if(typeof A>"u"){const w=await h();A=typeof(w==null?void 0:w.baseFeePerGas)=="bigint",Yu.set(e.uid,A)}p.type=A?"eip1559":"legacy"}if(l.includes("fees"))if(p.type!=="legacy"&&p.type!=="eip2930"){if(typeof p.maxFeePerGas>"u"||typeof p.maxPriorityFeePerGas>"u"){const A=await h(),{maxFeePerGas:w,maxPriorityFeePerGas:T}=await Fi(e,{block:A,chain:o,request:p});if(typeof t.maxPriorityFeePerGas>"u"&&t.maxFeePerGas&&t.maxFeePerGas<T)throw new Vb({maxPriorityFeePerGas:T});p.maxPriorityFeePerGas=T,p.maxFeePerGas=w}}else{if(typeof t.maxFeePerGas<"u"||typeof t.maxPriorityFeePerGas<"u")throw new Li;if(typeof t.gasPrice>"u"){const A=await h(),{gasPrice:w}=await Fi(e,{block:A,chain:o,request:p,type:"legacy"});p.gasPrice=w}}return l.includes("gas")&&typeof s>"u"&&(p.gas=await ee(e,ji,"estimateGas")({...p,account:f&&{address:f.address,type:"json-rpc"}})),uo(p),delete p.parameters,p}async function Qu(e,{address:t,blockNumber:n,blockTag:r=e.experimental_blockTag??"latest"}){const o=typeof n=="bigint"?J(n):void 0,s=await e.request({method:"eth_getBalance",params:[t,o||r]});return BigInt(s)}async function ji(e,t){var o,s,i;const{account:n=e.account}=t,r=n?xt(n):void 0;try{let S=function(O){const{block:N,request:b,rpcStateOverride:M}=O;return e.request({method:"eth_estimateGas",params:M?[b,N??e.experimental_blockTag??"latest",M]:N?[b,N]:[b]})};const{accessList:c,authorizationList:a,blobs:l,blobVersionedHashes:u,blockNumber:f,blockTag:p,data:d,gas:h,gasPrice:m,maxFeePerBlobGas:x,maxFeePerGas:A,maxPriorityFeePerGas:w,nonce:T,value:B,stateOverride:L,...F}=await Xu(e,{...t,parameters:(r==null?void 0:r.type)==="local"?void 0:["blobVersionedHashes"]}),g=(typeof f=="bigint"?J(f):void 0)||p,y=Bi(L),P=await(async()=>{if(F.to)return F.to;if(a&&a.length>0)return await Rb({authorization:a[0]}).catch(()=>{throw new G("`to` is required. Could not infer from `authorizationList`")})})();uo(t);const k=(i=(s=(o=e.chain)==null?void 0:o.formatters)==null?void 0:s.transactionRequest)==null?void 0:i.format,$=(k||Jo)({...ki(F,{format:k}),from:r==null?void 0:r.address,accessList:c,authorizationList:a,blobs:l,blobVersionedHashes:u,data:d,gas:h,gasPrice:m,maxFeePerBlobGas:x,maxFeePerGas:A,maxPriorityFeePerGas:w,nonce:T,to:P,value:B});let E=BigInt(await S({block:g,request:$,rpcStateOverride:y}));if(a){const O=await Qu(e,{address:$.from}),N=await Promise.all(a.map(async b=>{const{address:M}=b,R=await S({block:g,request:{authorizationList:void 0,data:d,from:r==null?void 0:r.address,to:M,value:J(O)},rpcStateOverride:y}).catch(()=>100000n);return 2n*BigInt(R)}));E+=N.reduce((b,M)=>b+M,0n)}return E}catch(c){throw _b(c,{...t,account:r,chain:e.chain})}}async function fy(e,t){const{abi:n,address:r,args:o,functionName:s,dataSuffix:i,...c}=t,a=Ct({abi:n,args:o,functionName:s});try{return await ee(e,ji,"estimateGas")({data:`${a}${i?i.replace("0x",""):""}`,to:r,...c})}catch(l){const u=c.account?xt(c.account):void 0;throw cr(l,{abi:n,address:r,args:o,docsPath:"/docs/contract/estimateContractGas",functionName:s,sender:u==null?void 0:u.address})}}function es(e,t){if(!tt(e,{strict:!1}))throw new pn({address:e});if(!tt(t,{strict:!1}))throw new pn({address:t});return e.toLowerCase()===t.toLowerCase()}const Ju="/docs/contract/decodeEventLog";function _i(e){const{abi:t,data:n,strict:r,topics:o}=e,s=r??!0,[i,...c]=o;if(!i)throw new rg({docsPath:Ju});const a=t.find(m=>m.type==="event"&&i===Vo(gt(m)));if(!(a&&"name"in a)||a.type!=="event")throw new Ll(i,{docsPath:Ju});const{name:l,inputs:u}=a,f=u==null?void 0:u.some(m=>!("name"in m&&m.name)),p=f?[]:{},d=u.map((m,x)=>[m,x]).filter(([m])=>"indexed"in m&&m.indexed);for(let m=0;m<d.length;m++){const[x,A]=d[m],w=c[m];if(!w)throw new _o({abiItem:a,param:x});p[f?A:x.name||A]=dy({param:x,value:w})}const h=u.filter(m=>!("indexed"in m&&m.indexed));if(h.length>0){if(n&&n!=="0x")try{const m=Ur(h,n);if(m)if(f)for(let x=0;x<u.length;x++)p[x]=p[x]??m.shift();else for(let x=0;x<h.length;x++)p[h[x].name]=m[x]}catch(m){if(s)throw m instanceof Ml||m instanceof vu?new Lr({abiItem:a,data:n,params:h,size:xe(n)}):m}else if(s)throw new Lr({abiItem:a,data:"0x",params:h,size:0})}return{eventName:l,args:Object.values(p).length>0?p:void 0}}function dy({param:e,value:t}){return e.type==="string"||e.type==="bytes"||e.type==="tuple"||e.type.match(/^(.*)\[(\d+)?\]$/)?t:(Ur([e],t)||[])[0]}function Ui(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(u=>u.type==="event"&&i.topics[0]===Vo(u));if(!a)return null;const l=_i({...i,abi:[a],strict:o});return s&&!s.includes(l.eventName)||!py({args:l.args,inputs:a.inputs,matchArgs:n})?null:{...l,...i}}catch(a){let l,u;if(a instanceof Ll)return null;if(a instanceof Lr||a instanceof _o){if(o)return null;l=a.abiItem.name,u=(c=a.abiItem.inputs)==null?void 0:c.some(f=>!("name"in f&&f.name))}return{...i,args:u?[]:{},eventName:l}}}).filter(Boolean)}function py(e){const{args:t,inputs:n,matchArgs:r}=e;if(!r)return!0;if(!t)return!1;function o(s,i,c){try{return s.type==="address"?es(i,c):s.type==="string"||s.type==="bytes"?Ie(Qn(i))===c:i===c}catch{return!1}}return Array.isArray(t)&&Array.isArray(r)?r.every((s,i)=>{if(s==null)return!0;const c=n[i];return c?(Array.isArray(s)?s:[s]).some(l=>o(c,l,t[i])):!1}):typeof t=="object"&&!Array.isArray(t)&&typeof r=="object"&&!Array.isArray(r)?Object.entries(r).every(([s,i])=>{if(i==null)return!0;const c=n.find(l=>l.name===s);return c?(Array.isArray(i)?i:[i]).some(l=>o(c,l,t[s])):!1}):!1}function Xt(e,{args:t,eventName:n}={}){return{...e,blockHash:e.blockHash?e.blockHash:null,blockNumber:e.blockNumber?BigInt(e.blockNumber):null,logIndex:e.logIndex?Number(e.logIndex):null,transactionHash:e.transactionHash?e.transactionHash:null,transactionIndex:e.transactionIndex?Number(e.transactionIndex):null,...n?{args:t,eventName:n}:{}}}async function zi(e,{address:t,blockHash:n,fromBlock:r,toBlock:o,event:s,events:i,args:c,strict:a}={}){const l=a??!1,u=i??(s?[s]:void 0);let f=[];u&&(f=[u.flatMap(m=>_r({abi:[m],eventName:m.name,args:i?void 0:c}))],s&&(f=f[0]));let p;n?p=await e.request({method:"eth_getLogs",params:[{address:t,topics:f,blockHash:n}]}):p=await e.request({method:"eth_getLogs",params:[{address:t,topics:f,fromBlock:typeof r=="bigint"?J(r):r,toBlock:typeof o=="bigint"?J(o):o}]});const d=p.map(h=>Xt(h));return u?Ui({abi:u,args:c,logs:d,strict:l}):d}async function ef(e,t){const{abi:n,address:r,args:o,blockHash:s,eventName:i,fromBlock:c,toBlock:a,strict:l}=t,u=i?On({abi:n,name:i}):void 0,f=u?void 0:n.filter(p=>p.type==="event");return ee(e,zi,"getLogs")({address:r,args:o,blockHash:s,event:u,events:f,fromBlock:c,toBlock:a,strict:l})}const Hi="/docs/contract/decodeFunctionResult";function Bn(e){const{abi:t,args:n,functionName:r,data:o}=e;let s=t[0];if(r){const c=On({abi:t,args:n,name:r});if(!c)throw new Yn(r,{docsPath:Hi});s=c}if(s.type!=="function")throw new Yn(void 0,{docsPath:Hi});if(!s.outputs)throw new Fl(s.name,{docsPath:Hi});const i=Ur(s.outputs,o);if(i&&i.length>1)return i;if(i&&i.length===1)return i[0]}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const Wi=BigInt(0),Vi=BigInt(1);function ts(e,t=""){if(typeof e!="boolean"){const n=t&&`"${t}"`;throw new Error(n+"expected boolean, got type="+typeof e)}return e}function Ln(e,t,n=""){const r=zo(e),o=e==null?void 0:e.length,s=t!==void 0;if(!r||s&&o!==t){const i=n&&`"${n}" `,c=s?` of length ${t}`:"",a=r?`length=${o}`:`type=${typeof e}`;throw new Error(i+"expected Uint8Array"+c+", got "+a)}return e}function ns(e){const t=e.toString(16);return t.length&1?"0"+t:t}function tf(e){if(typeof e!="string")throw new Error("hex string expected, got "+typeof e);return e===""?Wi:BigInt("0x"+e)}function rs(e){return tf(nr(e))}function nf(e){return qt(e),tf(nr(Uint8Array.from(e).reverse()))}function Gi(e,t){return Ho(e.toString(16).padStart(t*2,"0"))}function rf(e,t){return Gi(e,t).reverse()}function _e(e,t,n){let r;if(typeof t=="string")try{r=Ho(t)}catch(o){throw new Error(e+" must be hex string or Uint8Array, cause: "+o)}else if(zo(t))r=Uint8Array.from(t);else throw new Error(e+" must be hex string or Uint8Array");return r.length,r}const qi=e=>typeof e=="bigint"&&Wi<=e;function hy(e,t,n){return qi(e)&&qi(t)&&qi(n)&&t<=e&&e<n}function my(e,t,n,r){if(!hy(t,n,r))throw new Error("expected valid "+e+": "+n+" <= n < "+r+", got "+t)}function of(e){let t;for(t=0;e>Wi;e>>=Vi,t+=1);return t}const fo=e=>(Vi<<BigInt(e))-Vi;function gy(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},l=(...d)=>n(i,s,...d),u=(d=r(0))=>{i=l(o(0),d),s=l(),d.length!==0&&(i=l(o(1),d),s=l())},f=()=>{if(c++>=1e3)throw new Error("drbg: tried 1000 values");let d=0;const h=[];for(;d<t;){s=l();const m=s.slice();h.push(m),d+=s.length}return dn(...h)};return(d,h)=>{a(),u(d);let m;for(;!(m=h(f()));)u();return a(),m}}function Zi(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 sf(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 by="0.1.1";function yy(){return by}class be extends Error{constructor(t,n={}){const r=(()=>{var a;if(n.cause instanceof be){if(n.cause.details)return n.cause.details;if(n.cause.shortMessage)return n.cause.shortMessage}return n.cause&&"details"in n.cause&&typeof n.cause.details=="string"?n.cause.details:(a=n.cause)!=null&&a.message?n.cause.message:n.details})(),o=n.cause instanceof be&&n.cause.docsPath||n.docsPath,i=`https://oxlib.sh${o??""}`,c=[t||"An error occurred.",...n.metaMessages?["",...n.metaMessages]:[],...r||o?["",r?`Details: ${r}`:void 0,o?`See: ${i}`:void 0]:[]].filter(a=>typeof a=="string").join(`
79
- `);super(c,n.cause?{cause:n.cause}:void 0),Object.defineProperty(this,"details",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docs",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docsPath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"shortMessage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"BaseError"}),Object.defineProperty(this,"version",{enumerable:!0,configurable:!0,writable:!0,value:`ox@${yy()}`}),this.cause=n.cause,this.details=r,this.docs=i,this.docsPath=o,this.shortMessage=t}walk(t){return af(this,t)}}function af(e,t){return t!=null&&t(e)?e:e&&typeof e=="object"&&"cause"in e&&e.cause?af(e.cause,t):t?null:e}const wy="#__bigint";function vy(e,t,n){return JSON.stringify(e,(r,o)=>typeof o=="bigint"?o.toString()+wy:o,n)}function xy(e,t){if(uf(e)>t)throw new Iy({givenSize:uf(e),maxSize:t})}const Qt={zero:48,nine:57,A:65,F:70,a:97,f:102};function cf(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 Ey(e,t={}){const{dir:n,size:r=32}=t;if(r===0)return e;if(e.length>r)throw new My({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 Ki(e,t){if(nt(e)>t)throw new Fy({givenSize:nt(e),maxSize:t})}function Sy(e,t){if(typeof t=="number"&&t>0&&t>nt(e)-1)throw new gf({offset:t,position:"start",size:nt(e)})}function Py(e,t,n){if(typeof t=="number"&&typeof n=="number"&&nt(e)!==n-t)throw new gf({offset:n,position:"end",size:nt(e)})}function lf(e,t={}){const{dir:n,size:r=32}=t;if(r===0)return e;const o=e.replace("0x","");if(o.length>r*2)throw new Ry({size:Math.ceil(o.length/2),targetSize:r,type:"Hex"});return`0x${o[n==="right"?"padEnd":"padStart"](r*2,"0")}`}const $y=new TextEncoder;function Ty(e){return e instanceof Uint8Array?e:typeof e=="string"?Ny(e):Ay(e)}function Ay(e){return e instanceof Uint8Array?e:new Uint8Array(e)}function Ny(e,t={}){const{size:n}=t;let r=e;n&&(Ki(e,n),r=Fn(e,n));let o=r.slice(2);o.length%2&&(o=`0${o}`);const s=o.length/2,i=new Uint8Array(s);for(let c=0,a=0;c<s;c++){const l=cf(o.charCodeAt(a++)),u=cf(o.charCodeAt(a++));if(l===void 0||u===void 0)throw new be(`Invalid byte sequence ("${o[a-2]}${o[a-1]}" in "${o}").`);i[c]=l*16+u}return i}function Oy(e,t={}){const{size:n}=t,r=$y.encode(e);return typeof n=="number"?(xy(r,n),Cy(r,n)):r}function Cy(e,t){return Ey(e,{dir:"right",size:t})}function uf(e){return e.length}let Iy=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"})}},My=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 ky=new TextEncoder,By=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function Ly(e,t={}){const{strict:n=!1}=t;if(!e)throw new hf(e);if(typeof e!="string")throw new hf(e);if(n&&!/^0x[0-9a-fA-F]*$/.test(e))throw new mf(e);if(!e.startsWith("0x"))throw new mf(e)}function Mt(...e){return`0x${e.reduce((t,n)=>t+n.replace("0x",""),"")}`}function ff(e,t={}){const n=`0x${Number(e)}`;return typeof t.size=="number"?(Ki(n,t.size),Dn(n,t.size)):n}function df(e,t={}){let n="";for(let o=0;o<e.length;o++)n+=By[e[o]];const r=`0x${n}`;return typeof t.size=="number"?(Ki(r,t.size),Fn(r,t.size)):r}function Be(e,t={}){const{signed:n,size:r}=t,o=BigInt(e);let s;r?n?s=(1n<<BigInt(r)*8n-1n)-1n:s=2n**(BigInt(r)*8n)-1n:typeof e=="number"&&(s=BigInt(Number.MAX_SAFE_INTEGER));const i=typeof s=="bigint"&&n?-s-1n:0;if(s&&o>s||o<i){const l=typeof e=="bigint"?"n":"";throw new pf({max:s?`${s}${l}`:void 0,min:`${i}${l}`,signed:n,size:r,value:`${e}${l}`})}const a=`0x${(n&&o<0?(1n<<BigInt(r*8))+BigInt(o):o).toString(16)}`;return r?Dn(a,r):a}function Yi(e,t={}){return df(ky.encode(e),t)}function Dn(e,t){return lf(e,{dir:"left",size:t})}function Fn(e,t){return lf(e,{dir:"right",size:t})}function Xi(e,t,n,r={}){const{strict:o}=r;Sy(e,t);const s=`0x${e.replace("0x","").slice((t??0)*2,(n??e.length)*2)}`;return o&&Py(s,t,n),s}function nt(e){return Math.ceil((e.length-2)/2)}function Dy(e,t={}){const{strict:n=!1}=t;try{return Ly(e,{strict:n}),!0}catch{return!1}}class pf 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 hf extends be{constructor(t){super(`Value \`${typeof t=="object"?vy(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 mf 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 Fy 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 gf 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 Ry 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 jy(e){return{address:e.address,amount:Be(e.amount),index:Be(e.index),validatorIndex:Be(e.validatorIndex)}}function bf(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(jy)}}}const Qi=[{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"}],Ji=[{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"}]}],yf=[{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"}],wf=[...yf,{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"}]}],_y=[...yf,{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"}]}],vf=[{name:"text",type:"function",stateMutability:"view",inputs:[{name:"name",type:"bytes32"},{name:"key",type:"string"}],outputs:[{name:"",type:"string"}]}],xf=[{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"}]}],Ef=[{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"}],ur=[{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"}]}],Uy="0x82ad56cb",Sf="0x608060405234801561001057600080fd5b5060405161018e38038061018e83398101604081905261002f91610124565b6000808351602085016000f59050803b61004857600080fd5b6000808351602085016000855af16040513d6000823e81610067573d81fd5b3d81f35b634e487b7160e01b600052604160045260246000fd5b600082601f83011261009257600080fd5b81516001600160401b038111156100ab576100ab61006b565b604051601f8201601f19908116603f011681016001600160401b03811182821017156100d9576100d961006b565b6040528181528382016020018510156100f157600080fd5b60005b82811015610110576020818601810151838301820152016100f4565b506000918101602001919091529392505050565b6000806040838503121561013757600080fd5b82516001600160401b0381111561014d57600080fd5b61015985828601610081565b602085015190935090506001600160401b0381111561017757600080fd5b61018385828601610081565b915050925092905056fe",zy="0x608060405234801561001057600080fd5b506040516102c03803806102c083398101604081905261002f916101e6565b836001600160a01b03163b6000036100e457600080836001600160a01b03168360405161005c9190610270565b6000604051808303816000865af19150503d8060008114610099576040519150601f19603f3d011682016040523d82523d6000602084013e61009e565b606091505b50915091508115806100b857506001600160a01b0386163b155b156100e1578060405163101bb98d60e01b81526004016100d8919061028c565b60405180910390fd5b50505b6000808451602086016000885af16040513d6000823e81610103573d81fd5b3d81f35b80516001600160a01b038116811461011e57600080fd5b919050565b634e487b7160e01b600052604160045260246000fd5b60005b8381101561015457818101518382015260200161013c565b50506000910152565b600082601f83011261016e57600080fd5b81516001600160401b0381111561018757610187610123565b604051601f8201601f19908116603f011681016001600160401b03811182821017156101b5576101b5610123565b6040528181528382016020018510156101cd57600080fd5b6101de826020830160208701610139565b949350505050565b600080600080608085870312156101fc57600080fd5b61020585610107565b60208601519094506001600160401b0381111561022157600080fd5b61022d8782880161015d565b93505061023c60408601610107565b60608601519092506001600160401b0381111561025857600080fd5b6102648782880161015d565b91505092959194509250565b60008251610282818460208701610139565b9190910192915050565b60208152600082518060208401526102ab816040850160208701610139565b601f01601f1916919091016040019291505056fe",Hy="0x608060405234801561001057600080fd5b5060405161069438038061069483398101604081905261002f9161051e565b600061003c848484610048565b9050806000526001601ff35b60007f64926492649264926492649264926492649264926492649264926492649264926100748361040c565b036101e7576000606080848060200190518101906100929190610577565b60405192955090935091506000906001600160a01b038516906100b69085906105dd565b6000604051808303816000865af19150503d80600081146100f3576040519150601f19603f3d011682016040523d82523d6000602084013e6100f8565b606091505b50509050876001600160a01b03163b60000361016057806101605760405162461bcd60e51b815260206004820152601e60248201527f5369676e617475726556616c696461746f723a206465706c6f796d656e74000060448201526064015b60405180910390fd5b604051630b135d3f60e11b808252906001600160a01b038a1690631626ba7e90610190908b9087906004016105f9565b602060405180830381865afa1580156101ad573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101d19190610633565b6001600160e01b03191614945050505050610405565b6001600160a01b0384163b1561027a57604051630b135d3f60e11b808252906001600160a01b03861690631626ba7e9061022790879087906004016105f9565b602060405180830381865afa158015610244573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102689190610633565b6001600160e01b031916149050610405565b81516041146102df5760405162461bcd60e51b815260206004820152603a602482015260008051602061067483398151915260448201527f3a20696e76616c6964207369676e6174757265206c656e6774680000000000006064820152608401610157565b6102e7610425565b5060208201516040808401518451859392600091859190811061030c5761030c61065d565b016020015160f81c9050601b811480159061032b57508060ff16601c14155b1561038c5760405162461bcd60e51b815260206004820152603b602482015260008051602061067483398151915260448201527f3a20696e76616c6964207369676e617475726520762076616c756500000000006064820152608401610157565b60408051600081526020810180835289905260ff83169181019190915260608101849052608081018390526001600160a01b0389169060019060a0016020604051602081039080840390855afa1580156103ea573d6000803e3d6000fd5b505050602060405103516001600160a01b0316149450505050505b9392505050565b600060208251101561041d57600080fd5b508051015190565b60405180606001604052806003906020820280368337509192915050565b6001600160a01b038116811461045857600080fd5b50565b634e487b7160e01b600052604160045260246000fd5b60005b8381101561048c578181015183820152602001610474565b50506000910152565b600082601f8301126104a657600080fd5b81516001600160401b038111156104bf576104bf61045b565b604051601f8201601f19908116603f011681016001600160401b03811182821017156104ed576104ed61045b565b60405281815283820160200185101561050557600080fd5b610516826020830160208701610471565b949350505050565b60008060006060848603121561053357600080fd5b835161053e81610443565b6020850151604086015191945092506001600160401b0381111561056157600080fd5b61056d86828701610495565b9150509250925092565b60008060006060848603121561058c57600080fd5b835161059781610443565b60208501519093506001600160401b038111156105b357600080fd5b6105bf86828701610495565b604086015190935090506001600160401b0381111561056157600080fd5b600082516105ef818460208701610471565b9190910192915050565b828152604060208201526000825180604084015261061e816060850160208701610471565b601f01601f1916919091016060019392505050565b60006020828403121561064557600080fd5b81516001600160e01b03198116811461040557600080fd5b634e487b7160e01b600052603260045260246000fdfe5369676e617475726556616c696461746f72237265636f7665725369676e6572";class ea extends G{constructor({blockNumber:t,chain:n,contract:r}){super(`Chain "${n.name}" does not support contract "${r.name}".`,{metaMessages:["This could be due to any of the following:",...t&&r.blockCreated&&r.blockCreated>t?[`- The contract "${r.name}" was not deployed until block ${r.blockCreated} (current block ${t}).`]:[`- The chain does not have the contract "${r.name}" configured.`]],name:"ChainDoesNotSupportContract"})}}class Pf extends G{constructor(){super("No chain was provided to the Client.",{name:"ClientChainNotConfiguredError"})}}const ta="/docs/contract/encodeDeployData";function na(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 Qm({docsPath:ta});if(!("inputs"in o))throw new Il({docsPath:ta});if(!o.inputs||o.inputs.length===0)throw new Il({docsPath:ta});const s=Kt(o.inputs,n);return rr([r,s])}function fr({blockNumber:e,chain:t,contract:n}){var o;const r=(o=t==null?void 0:t.contracts)==null?void 0:o[n];if(!r)throw new ea({chain:t,contract:{name:n}});if(e&&r.blockCreated&&r.blockCreated>e)throw new ea({blockNumber:e,chain:t,contract:{name:n,blockCreated:r.blockCreated}});return r.address}function $f(e,{docsPath:t,...n}){const r=(()=>{const o=Mi(e,n);return o instanceof Qo?e:o})();return new Nu(r,{docsPath:t,...n})}function Tf(){let e=()=>{},t=()=>{};return{promise:new Promise((r,o)=>{e=r,t=o}),resolve:e,reject:t}}const ra=new Map;function Af({fn:e,id:t,shouldSplitBatch:n,wait:r=0,sort:o}){const s=async()=>{const u=a();i();const f=u.map(({args:p})=>p);f.length!==0&&e(f).then(p=>{o&&Array.isArray(p)&&p.sort(o);for(let d=0;d<u.length;d++){const{resolve:h}=u[d];h==null||h([p[d],p])}}).catch(p=>{for(let d=0;d<u.length;d++){const{reject:h}=u[d];h==null||h(p)}})},i=()=>ra.delete(t),c=()=>a().map(({args:u})=>u),a=()=>ra.get(t)||[],l=u=>ra.set(t,[...a(),u]);return{flush:i,async schedule(u){const{promise:f,resolve:p,reject:d}=Tf();return(n==null?void 0:n([...c(),u]))&&s(),a().length>0?(l({args:u,resolve:p,reject:d}),f):(l({args:u,resolve:p,reject:d}),setTimeout(s,r),f)}}}async function po(e,t){var $,S,E,O;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:l,code:u,data:f,factory:p,factoryData:d,gas:h,gasPrice:m,maxFeePerBlobGas:x,maxFeePerGas:A,maxPriorityFeePerGas:w,nonce:T,to:B,value:L,stateOverride:F,...j}=t,g=n?xt(n):void 0;if(u&&(p||d))throw new G("Cannot provide both `code` & `factory`/`factoryData` as parameters.");if(u&&B)throw new G("Cannot provide both `code` & `to` as parameters.");const y=u&&f,P=p&&d&&B&&f,k=y||P,C=y?Gy({code:u,data:f}):P?qy({data:f,factory:p,factoryData:d,to:B}):f;try{uo(t);const b=(typeof s=="bigint"?J(s):void 0)||i,M=l?bf(l):void 0,R=Bi(F),_=(O=(E=(S=e.chain)==null?void 0:S.formatters)==null?void 0:E.transactionRequest)==null?void 0:O.format,W=(_||Jo)({...ki(j,{format:_}),from:g==null?void 0:g.address,accessList:c,authorizationList:r,blobs:a,data:C,gas:h,gasPrice:m,maxFeePerBlobGas:x,maxFeePerGas:A,maxPriorityFeePerGas:w,nonce:T,to:k?void 0:B,value:L});if(o&&Wy({request:W})&&!R&&!M)try{return await Vy(e,{...W,blockNumber:s,blockTag:i})}catch(Z){if(!(Z instanceof Pf)&&!(Z instanceof ea))throw Z}const K=(()=>{const Z=[W,b];return R&&M?[...Z,R,M]:R?[...Z,R]:M?[...Z,{},M]:Z})(),V=await e.request({method:"eth_call",params:K});return V==="0x"?{data:void 0}:{data:V}}catch(N){const b=Zy(N),{offchainLookup:M,offchainLookupSignature:R}=await Promise.resolve().then(()=>Xw);if(e.ccipRead!==!1&&(b==null?void 0:b.slice(0,10))===R&&B)return{data:await M(e,{data:b,to:B})};throw k&&(b==null?void 0:b.slice(0,10))==="0x101bb98d"?new Nb({factory:p}):$f(N,{...t,account:g,chain:e.chain})}}function Wy({request:e}){const{data:t,to:n,...r}=e;return!(!t||t.startsWith(Uy)||!n||Object.values(r).filter(o=>typeof o<"u").length>0)}async function Vy(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 l=c;if(!l){if(!e.chain)throw new Pf;l=fr({blockNumber:o,chain:e.chain,contract:"multicall3"})}const f=(typeof o=="bigint"?J(o):void 0)||s,{schedule:p}=Af({id:`${e.uid}.${f}`,wait:r,shouldSplitBatch(x){return x.reduce((w,{data:T})=>w+(T.length-2),0)>n*2},fn:async x=>{const A=x.map(B=>({allowFailure:!0,callData:B.data,target:B.to})),w=Ct({abi:Qi,args:[A],functionName:"aggregate3"}),T=await e.request({method:"eth_call",params:[{data:w,to:l},f]});return Bn({abi:Qi,args:[A],functionName:"aggregate3",data:T||"0x"})}}),[{returnData:d,success:h}]=await p({data:i,to:a});if(!h)throw new Ko({data:d});return d==="0x"?{data:void 0}:{data:d}}function Gy(e){const{code:t,data:n}=e;return na({abi:Al(["constructor(bytes, bytes)"]),bytecode:Sf,args:[t,n]})}function qy(e){const{data:t,factory:n,factoryData:r,to:o}=e;return na({abi:Al(["constructor(address, bytes, address, bytes)"]),bytecode:zy,args:[o,t,n,r]})}function Zy(e){var n;if(!(e instanceof G))return;const t=e.walk();return typeof(t==null?void 0:t.data)=="object"?(n=t.data)==null?void 0:n.data:t.data}async function Jt(e,t){const{abi:n,address:r,args:o,functionName:s,...i}=t,c=Ct({abi:n,args:o,functionName:s});try{const{data:a}=await ee(e,po,"call")({...i,data:c,to:r});return Bn({abi:n,args:o,functionName:s,data:a||"0x"})}catch(a){throw cr(a,{abi:n,address:r,args:o,docsPath:"/docs/contract/readContract",functionName:s})}}async function Ky(e,t){const{abi:n,address:r,args:o,dataSuffix:s,functionName:i,...c}=t,a=c.account?xt(c.account):e.account,l=Ct({abi:n,args:o,functionName:i});try{const{data:u}=await ee(e,po,"call")({batch:!1,data:`${l}${s?s.replace("0x",""):""}`,to:r,...c,account:a}),f=Bn({abi:n,args:o,functionName:i,data:u||"0x"}),p=n.filter(d=>"name"in d&&d.name===t.functionName);return{result:f,request:{abi:p,address:r,args:o,dataSuffix:s,functionName:i,...c,account:a}}}catch(u){throw cr(u,{abi:n,address:r,args:o,docsPath:"/docs/contract/simulateContract",functionName:i,sender:a==null?void 0:a.address})}}const oa=new Map,Nf=new Map;let Yy=0;function gn(e,t,n){const r=++Yy,o=()=>oa.get(e)||[],s=()=>{const u=o();oa.set(e,u.filter(f=>f.id!==r))},i=()=>{const u=o();if(!u.some(p=>p.id===r))return;const f=Nf.get(e);if(u.length===1&&f){const p=f();p instanceof Promise&&p.catch(()=>{})}s()},c=o();if(oa.set(e,[...c,{id:r,fns:t}]),c&&c.length>0)return i;const a={};for(const u in t)a[u]=(...f)=>{var d,h;const p=o();if(p.length!==0)for(const m of p)(h=(d=m.fns)[u])==null||h.call(d,...f)};const l=n(a);return typeof l=="function"&&Nf.set(e,l),i}async function sa(e){return new Promise(t=>setTimeout(t,e))}function ho(e,{emitOnBegin:t,initialWaitTime:n,interval:r}){let o=!0;const s=()=>o=!1;return(async()=>{let c;t&&(c=await e({unpoll:s}));const a=await(n==null?void 0:n(c))??r;await sa(a);const l=async()=>{o&&(await e({unpoll:s}),await sa(r),l())};l()})(),s}const Xy=new Map,Qy=new Map;function Jy(e){const t=(o,s)=>({clear:()=>s.delete(o),get:()=>s.get(o),set:i=>s.set(o,i)}),n=t(e,Xy),r=t(e,Qy);return{clear:()=>{n.clear(),r.clear()},promise:n,response:r}}async function ew(e,{cacheKey:t,cacheTime:n=Number.POSITIVE_INFINITY}){const r=Jy(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 tw=e=>`blockNumber.${e}`;async function mo(e,{cacheTime:t=e.cacheTime}={}){const n=await ew(()=>e.request({method:"eth_blockNumber"}),{cacheKey:tw(e.uid),cacheTime:t});return BigInt(n)}async function os(e,{filter:t}){const n="strict"in t&&t.strict,r=await t.request({method:"eth_getFilterChanges",params:[t.id]});if(typeof r[0]=="string")return r;const o=r.map(s=>Xt(s));return!("abi"in t)||!t.abi?o:Ui({abi:t.abi,logs:o,strict:n})}async function ss(e,{filter:t}){return t.request({method:"eth_uninstallFilter",params:[t.id]})}function nw(e,t){const{abi:n,address:r,args:o,batch:s=!0,eventName:i,fromBlock:c,onError:a,onLogs:l,poll:u,pollingInterval:f=e.pollingInterval,strict:p}=t;return(typeof u<"u"?u:typeof c=="bigint"?!0:!(e.transport.type==="webSocket"||e.transport.type==="ipc"||e.transport.type==="fallback"&&(e.transport.transports[0].config.type==="webSocket"||e.transport.transports[0].config.type==="ipc")))?(()=>{const x=p??!1,A=Te(["watchContractEvent",r,o,s,e.uid,i,f,x,c]);return gn(A,{onLogs:l,onError:a},w=>{let T;c!==void 0&&(T=c-1n);let B,L=!1;const F=ho(async()=>{var j;if(!L){try{B=await ee(e,mu,"createContractEventFilter")({abi:n,address:r,args:o,eventName:i,strict:x,fromBlock:c})}catch{}L=!0;return}try{let g;if(B)g=await ee(e,os,"getFilterChanges")({filter:B});else{const y=await ee(e,mo,"getBlockNumber")({});T&&T<y?g=await ee(e,ef,"getContractEvents")({abi:n,address:r,args:o,eventName:i,fromBlock:T+1n,toBlock:y,strict:x}):g=[],T=y}if(g.length===0)return;if(s)w.onLogs(g);else for(const y of g)w.onLogs([y])}catch(g){B&&g instanceof Mn&&(L=!1),(j=w.onError)==null||j.call(w,g)}},{emitOnBegin:!0,interval:f});return async()=>{B&&await ee(e,ss,"uninstallFilter")({filter:B}),F()}})})():(()=>{const x=p??!1,A=Te(["watchContractEvent",r,o,s,e.uid,i,f,x]);let w=!0,T=()=>w=!1;return gn(A,{onLogs:l,onError:a},B=>((async()=>{try{const L=(()=>{if(e.transport.type==="fallback"){const g=e.transport.transports.find(y=>y.config.type==="webSocket"||y.config.type==="ipc");return g?g.value:e.transport}return e.transport})(),F=i?_r({abi:n,eventName:i,args:o}):[],{unsubscribe:j}=await L.subscribe({params:["logs",{address:r,topics:F}],onData(g){var P;if(!w)return;const y=g.result;try{const{eventName:k,args:C}=_i({abi:n,data:y.data,topics:y.topics,strict:p}),$=Xt(y,{args:C,eventName:k});B.onLogs([$])}catch(k){let C,$;if(k instanceof Lr||k instanceof _o){if(p)return;C=k.abiItem.name,$=(P=k.abiItem.inputs)==null?void 0:P.some(E=>!("name"in E&&E.name))}const S=Xt(y,{args:$?[]:{},eventName:C});B.onLogs([S])}},onError(g){var y;(y=B.onError)==null||y.call(B,g)}});T=j,w||T()}catch(L){a==null||a(L)}})(),()=>T()))})()}async function rw(e,{serializedTransaction:t}){return e.request({method:"eth_sendRawTransaction",params:[t]},{retryCount:0})}function ia(e,{delay:t=100,retryCount:n=2,shouldRetry:r=()=>!0}={}){return new Promise((o,s)=>{const i=async({count:c=0}={})=>{const a=async({error:l})=>{const u=typeof t=="function"?t({count:c,error:l}):t;u&&await sa(u),i({count:c+1})};try{const l=await e();o(l)}catch(l){if(c<n&&await r({count:c,error:l}))return a({error:l});s(l)}};i()})}const ow={"0x0":"reverted","0x1":"success"};function sw(e){const t={...e,blockNumber:e.blockNumber?BigInt(e.blockNumber):null,contractAddress:e.contractAddress?e.contractAddress:null,cumulativeGasUsed:e.cumulativeGasUsed?BigInt(e.cumulativeGasUsed):null,effectiveGasPrice:e.effectiveGasPrice?BigInt(e.effectiveGasPrice):null,gasUsed:e.gasUsed?BigInt(e.gasUsed):null,logs:e.logs?e.logs.map(n=>Xt(n)):null,to:e.to?e.to:null,transactionIndex:e.transactionIndex?Wt(e.transactionIndex):null,status:e.status?ow[e.status]:null,type:e.type?Fu[e.type]||e.type:null};return e.blobGasPrice&&(t.blobGasPrice=BigInt(e.blobGasPrice)),e.blobGasUsed&&(t.blobGasUsed=BigInt(e.blobGasUsed)),t}const aa=256;let is=aa,as;function Of(e=11){if(!as||is+e>aa*2){as="",is=0;for(let t=0;t<aa;t++)as+=(256+Math.random()*256|0).toString(16).substring(1)}return as.substring(is,is+++e)}function iw(e){const{batch:t,chain:n,ccipRead:r,key:o="base",name:s="Base Client",type:i="base"}=e,c=e.experimental_blockTag??(typeof(n==null?void 0:n.experimental_preconfirmationTime)=="number"?"pending":void 0),a=(n==null?void 0:n.blockTime)??12e3,l=Math.min(Math.max(Math.floor(a/2),500),4e3),u=e.pollingInterval??l,f=e.cacheTime??u,p=e.account?xt(e.account):void 0,{config:d,request:h,value:m}=e.transport({chain:n,pollingInterval:u}),x={...d,...m},A={account:p,batch:t,cacheTime:f,ccipRead:r,chain:n,key:o,name:s,pollingInterval:u,request:h,transport:x,type:i,uid:Of(),...c?{experimental_blockTag:c}:{}};function w(T){return B=>{const L=B(T);for(const j in A)delete L[j];const F={...T,...L};return Object.assign(F,{extend:w(F)})}}return Object.assign(A,{extend:w(A)})}const cs=new di(8192);function aw(e,{enabled:t=!0,id:n}){if(!t||!n)return e();if(cs.get(n))return cs.get(n);const r=e().finally(()=>cs.delete(n));return cs.set(n,r),r}function cw(e,t={}){return async(n,r={})=>{var f;const{dedupe:o=!1,methods:s,retryDelay:i=150,retryCount:c=3,uid:a}={...t,...r},{method:l}=n;if((f=s==null?void 0:s.exclude)!=null&&f.includes(l))throw new kn(new Error("method not supported"),{method:l});if(s!=null&&s.include&&!s.include.includes(l))throw new kn(new Error("method not supported"),{method:l});const u=o?Dr(`${a}.${Te(n)}`):void 0;return aw(()=>ia(async()=>{try{return await e(n)}catch(p){const d=p;switch(d.code){case Wr.code:throw new Wr(d);case Vr.code:throw new Vr(d);case Gr.code:throw new Gr(d,{method:n.method});case qr.code:throw new qr(d);case In.code:throw new In(d);case Mn.code:throw new Mn(d);case Zr.code:throw new Zr(d);case Kr.code:throw new Kr(d);case Yr.code:throw new Yr(d);case kn.code:throw new kn(d,{method:n.method});case ir.code:throw new ir(d);case Xr.code:throw new Xr(d);case ar.code:throw new ar(d);case Qr.code:throw new Qr(d);case Jr.code:throw new Jr(d);case eo.code:throw new eo(d);case to.code:throw new to(d);case no.code:throw new no(d);case ro.code:throw new ro(d);case oo.code:throw new oo(d);case so.code:throw new so(d);case io.code:throw new io(d);case ao.code:throw new ao(d);case co.code:throw new co(d);case lo.code:throw new lo(d);case 5e3:throw new ar(d);default:throw p instanceof G?p:new Cb(d)}}},{delay:({count:p,error:d})=>{var h;if(d&&d instanceof Cn){const m=(h=d==null?void 0:d.headers)==null?void 0:h.get("Retry-After");if(m!=null&&m.match(/\d/))return Number.parseInt(m)*1e3}return~~(1<<p)*i},retryCount:c,shouldRetry:({error:p})=>lw(p)}),{enabled:o,id:u})}}function lw(e){return"code"in e&&typeof e.code=="number"?e.code===-1||e.code===ir.code||e.code===In.code:e instanceof Cn&&e.status?e.status===403||e.status===408||e.status===413||e.status===429||e.status===500||e.status===502||e.status===503||e.status===504:!0}function uw({key:e,methods:t,name:n,request:r,retryCount:o=3,retryDelay:s=150,timeout:i,type:c},a){const l=Of();return{config:{key:e,methods:t,name:n,request:r,retryCount:o,retryDelay:s,timeout:i,type:c},request:cw(r,{methods:t,retryCount:o,retryDelay:s,uid:l}),value:a}}class fw extends G{constructor(){super("No URL was provided to the Transport. Please provide a valid RPC URL to the Transport.",{docsPath:"/docs/clients/intro",name:"UrlRequiredError"})}}function dw(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 pw(){return{current:0,take(){return this.current++},reset(){this.current=0}}}const Cf=pw();function hw(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:l,signal:u}=c;try{const p=await dw(async({signal:h})=>{const m={...c,body:Array.isArray(r)?Te(r.map(T=>({jsonrpc:"2.0",id:T.id??Cf.take(),...T}))):Te({jsonrpc:"2.0",id:r.id??Cf.take(),...r}),headers:{"Content-Type":"application/json",...a},method:l||"POST",signal:u||(i>0?h:null)},x=new Request(e,m),A=await(o==null?void 0:o(x,m))??{...m,url:e};return await fetch(A.url??e,A)},{errorInstance:new Ou({body:r,url:e}),timeout:i,signal:!0});s&&await s(p);let d;if((f=p.headers.get("Content-Type"))!=null&&f.startsWith("application/json"))d=await p.json();else{d=await p.text();try{d=JSON.parse(d||"{}")}catch(h){if(p.ok)throw h;d={error:d}}}if(!p.ok)throw new Cn({body:r,details:Te(d.error)||p.statusText,headers:p.headers,status:p.status,url:e});return d}catch(p){throw p instanceof Cn||p instanceof Ou?p:new Cn({body:r,cause:p,url:e})}}}}function mw(e,t={}){const{batch:n,fetchOptions:r,key:o="http",methods:s,name:i="HTTP JSON-RPC",onFetchRequest:c,onFetchResponse:a,retryDelay:l,raw:u}=t;return({chain:f,retryCount:p,timeout:d})=>{const{batchSize:h=1e3,wait:m=0}=typeof n=="object"?n:{},x=t.retryCount??p,A=d??t.timeout??1e4,w=e||(f==null?void 0:f.rpcUrls.default.http[0]);if(!w)throw new fw;const T=hw(w,{fetchOptions:r,onRequest:c,onResponse:a,timeout:A});return uw({key:o,methods:s,name:i,async request({method:B,params:L}){const F={method:B,params:L},{schedule:j}=Af({id:w,wait:m,shouldSplitBatch(k){return k.length>h},fn:k=>T.request({body:k}),sort:(k,C)=>k.id-C.id}),g=async k=>n?j(k):[await T.request({body:k})],[{error:y,result:P}]=await g(F);if(u)return{error:y,result:P};if(y)throw new Si({body:F,error:y,url:w});return P},retryCount:x,retryDelay:l,timeout:A,type:"http"},{fetchOptions:r,url:w})}}function ca(e,t){var r,o,s,i,c,a;if(!(e instanceof G))return!1;const n=e.walk(l=>l instanceof Ei);return n instanceof Ei?!!(((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===bu[50]):!1}function gw(e){const{abi:t,data:n}=e,r=or(n,0,4),o=t.find(s=>s.type==="function"&&r===jr(gt(s)));if(!o)throw new og(r,{docsPath:"/docs/contract/decodeFunctionData"});return{functionName:o.name,args:"inputs"in o&&o.inputs&&o.inputs.length>0?Ur(o.inputs,or(n,4)):void 0}}const la="/docs/contract/encodeErrorResult";function If(e){const{abi:t,errorName:n,args:r}=e;let o=t[0];if(n){const a=On({abi:t,args:r,name:n});if(!a)throw new kl(n,{docsPath:la});o=a}if(o.type!=="error")throw new kl(void 0,{docsPath:la});const s=gt(o),i=jr(s);let c="0x";if(r&&r.length>0){if(!o.inputs)throw new ng(o.name,{docsPath:la});c=Kt(o.inputs,r)}return rr([i,c])}const ua="/docs/contract/encodeFunctionResult";function bw(e){const{abi:t,functionName:n,result:r}=e;let o=t[0];if(n){const i=On({abi:t,name:n});if(!i)throw new Yn(n,{docsPath:ua});o=i}if(o.type!=="function")throw new Yn(void 0,{docsPath:ua});if(!o.outputs)throw new Fl(o.name,{docsPath:ua});const s=(()=>{if(o.outputs.length===0)return[];if(o.outputs.length===1)return[r];if(Array.isArray(r))return r;throw new Rl(r)})();return Kt(o.outputs,s)}const ls="x-batch-gateway:true";async function Mf(e){const{data:t,ccipRequest:n}=e,{args:[r]}=gw({abi:Ji,data:t}),o=[],s=[];return await Promise.all(r.map(async(i,c)=>{try{s[c]=i.urls.includes(ls)?await Mf({data:i.data,ccipRequest:n}):await n(i),o[c]=!1}catch(a){o[c]=!0,s[c]=yw(a)}})),bw({abi:Ji,functionName:"query",result:[o,s]})}function yw(e){return e.name==="HttpRequestError"&&e.status?If({abi:Ji,errorName:"HttpError",args:[e.status,e.shortMessage]}):If({abi:[yu],errorName:"Error",args:["shortMessage"in e?e.shortMessage:e.message]})}function kf(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 us(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=kf(n[r]),s=o?Qn(o):Ie(An(n[r]),"bytes");t=Ie(vt([t,s]),"bytes")}return $e(t)}function ww(e){return`[${e.slice(2)}]`}function vw(e){const t=new Uint8Array(32).fill(0);return e?kf(e)||Ie(An(e)):$e(t)}function fs(e){const t=e.replace(/^\.|\.$/gm,"");if(t.length===0)return new Uint8Array(1);const n=new Uint8Array(An(t).byteLength+2);let r=0;const o=t.split(".");for(let s=0;s<o.length;s++){let i=An(o[s]);i.byteLength>255&&(i=An(ww(vw(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 xw(e,t){const{blockNumber:n,blockTag:r,coinType:o,name:s,gatewayUrls:i,strict:c}=t,{chain:a}=e,l=(()=>{if(t.universalResolverAddress)return t.universalResolverAddress;if(!a)throw new Error("client chain not configured. universalResolverAddress is required.");return fr({blockNumber:n,chain:a,contract:"ensUniversalResolver"})})(),u=a==null?void 0:a.ensTlds;if(u&&!u.some(f=>s.endsWith(f)))return null;try{const f=Ct({abi:xf,functionName:"addr",...o!=null?{args:[us(s),BigInt(o)]}:{args:[us(s)]}}),p={address:l,abi:wf,functionName:"resolve",args:[Vt(fs(s)),f,i??[ls]],blockNumber:n,blockTag:r},h=await ee(e,Jt,"readContract")(p);if(h[0]==="0x")return null;const m=Bn({abi:xf,args:o!=null?[us(s),BigInt(o)]:void 0,functionName:"addr",data:h[0]});return m==="0x"||Tn(m)==="0x00"?null:m}catch(f){if(c)throw f;if(ca(f,"resolve"))return null;throw f}}class Ew extends G{constructor({data:t}){super("Unable to extract image from metadata. The metadata may be malformed or invalid.",{metaMessages:["- Metadata must be a JSON object with at least an `image`, `image_url` or `image_data` property.","",`Provided data: ${JSON.stringify(t)}`],name:"EnsAvatarInvalidMetadataError"})}}class go extends G{constructor({reason:t}){super(`ENS NFT avatar URI is invalid. ${t}`,{name:"EnsAvatarInvalidNftUriError"})}}class fa extends G{constructor({uri:t}){super(`Unable to resolve ENS avatar URI "${t}". The URI may be malformed, invalid, or does not respond with a valid image.`,{name:"EnsAvatarUriResolutionError"})}}class Sw extends G{constructor({namespace:t}){super(`ENS NFT avatar namespace "${t}" is not supported. Must be "erc721" or "erc1155".`,{name:"EnsAvatarUnsupportedNamespaceError"})}}const Pw=/(?<protocol>https?:\/\/[^\/]*|ipfs:\/|ipns:\/|ar:\/)?(?<root>\/)?(?<subpath>ipfs\/|ipns\/)?(?<target>[\w\-.]+)(?<subtarget>\/.*)?/,$w=/^(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>\/.*)?$/,Tw=/^data:([a-zA-Z\-/+]*);base64,([^"].*)/,Aw=/^data:([a-zA-Z\-/+]*)?(;[a-zA-Z0-9].*?)?(,)/;async function Nw(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 Bf(e,t){return e?e.endsWith("/")?e.slice(0,-1):e:t}function Lf({uri:e,gatewayUrls:t}){const n=Tw.test(e);if(n)return{uri:e,isOnChain:!0,isEncoded:n};const r=Bf(t==null?void 0:t.ipfs,"https://ipfs.io"),o=Bf(t==null?void 0:t.arweave,"https://arweave.net"),s=e.match(Pw),{protocol:i,subpath:c,target:a,subtarget:l=""}=(s==null?void 0:s.groups)||{},u=i==="ipns:/"||c==="ipns/",f=i==="ipfs:/"||c==="ipfs/"||$w.test(e);if(e.startsWith("http")&&!u&&!f){let d=e;return t!=null&&t.arweave&&(d=e.replace(/https:\/\/arweave.net/g,t==null?void 0:t.arweave)),{uri:d,isOnChain:!1,isEncoded:!1}}if((u||f)&&a)return{uri:`${r}/${u?"ipns":"ipfs"}/${a}${l}`,isOnChain:!1,isEncoded:!1};if(i==="ar:/"&&a)return{uri:`${o}/${a}${l||""}`,isOnChain:!1,isEncoded:!1};let p=e.replace(Aw,"");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 fa({uri:e})}function Df(e){if(typeof e!="object"||!("image"in e)&&!("image_url"in e)&&!("image_data"in e))throw new Ew({data:e});return e.image||e.image_url||e.image_data}async function Ow({gatewayUrls:e,uri:t}){try{const n=await fetch(t).then(o=>o.json());return await da({gatewayUrls:e,uri:Df(n)})}catch{throw new fa({uri:t})}}async function da({gatewayUrls:e,uri:t}){const{uri:n,isOnChain:r}=Lf({uri:t,gatewayUrls:e});if(r||await Nw(n))return n;throw new fa({uri:t})}function Cw(e){let t=e;t.startsWith("did:nft:")&&(t=t.replace("did:nft:","").replace(/_/g,"/"));const[n,r,o]=t.split("/"),[s,i]=n.split(":"),[c,a]=r.split(":");if(!s||s.toLowerCase()!=="eip155")throw new go({reason:"Only EIP-155 supported"});if(!i)throw new go({reason:"Chain ID not found"});if(!a)throw new go({reason:"Contract address not found"});if(!o)throw new go({reason:"Token ID not found"});if(!c)throw new go({reason:"ERC namespace not found"});return{chainID:Number.parseInt(i),namespace:c.toLowerCase(),contractAddress:a,tokenID:o}}async function Iw(e,{nft:t}){if(t.namespace==="erc721")return Jt(e,{address:t.contractAddress,abi:[{name:"tokenURI",type:"function",stateMutability:"view",inputs:[{name:"tokenId",type:"uint256"}],outputs:[{name:"",type:"string"}]}],functionName:"tokenURI",args:[BigInt(t.tokenID)]});if(t.namespace==="erc1155")return Jt(e,{address:t.contractAddress,abi:[{name:"uri",type:"function",stateMutability:"view",inputs:[{name:"_id",type:"uint256"}],outputs:[{name:"",type:"string"}]}],functionName:"uri",args:[BigInt(t.tokenID)]});throw new Sw({namespace:t.namespace})}async function Mw(e,{gatewayUrls:t,record:n}){return/eip155:/i.test(n)?kw(e,{gatewayUrls:t,record:n}):da({uri:n,gatewayUrls:t})}async function kw(e,{gatewayUrls:t,record:n}){const r=Cw(n),o=await Iw(e,{nft:r}),{uri:s,isOnChain:i,isEncoded:c}=Lf({uri:o,gatewayUrls:t});if(i&&(s.includes("data:application/json;base64,")||s.startsWith("{"))){const l=c?atob(s.replace("data:application/json;base64,","")):s,u=JSON.parse(l);return da({uri:Df(u),gatewayUrls:t})}let a=r.tokenID;return r.namespace==="erc1155"&&(a=a.replace("0x","").padStart(64,"0")),Ow({gatewayUrls:t,uri:s.replace(/(?:0x)?{id}/,a)})}async function Ff(e,t){const{blockNumber:n,blockTag:r,key:o,name:s,gatewayUrls:i,strict:c}=t,{chain:a}=e,l=(()=>{if(t.universalResolverAddress)return t.universalResolverAddress;if(!a)throw new Error("client chain not configured. universalResolverAddress is required.");return fr({blockNumber:n,chain:a,contract:"ensUniversalResolver"})})(),u=a==null?void 0:a.ensTlds;if(u&&!u.some(f=>s.endsWith(f)))return null;try{const f={address:l,abi:wf,functionName:"resolve",args:[Vt(fs(s)),Ct({abi:vf,functionName:"text",args:[us(s),o]}),i??[ls]],blockNumber:n,blockTag:r},d=await ee(e,Jt,"readContract")(f);if(d[0]==="0x")return null;const h=Bn({abi:vf,functionName:"text",data:d[0]});return h===""?null:h}catch(f){if(c)throw f;if(ca(f,"resolve"))return null;throw f}}async function Bw(e,{blockNumber:t,blockTag:n,assetGatewayUrls:r,name:o,gatewayUrls:s,strict:i,universalResolverAddress:c}){const a=await ee(e,Ff,"getEnsText")({blockNumber:t,blockTag:n,key:"avatar",name:o,universalResolverAddress:c,gatewayUrls:s,strict:i});if(!a)return null;try{return await Mw(e,{record:a,gatewayUrls:r})}catch{return null}}async function Lw(e,{address:t,blockNumber:n,blockTag:r,gatewayUrls:o,strict:s,universalResolverAddress:i}){let c=i;if(!c){if(!e.chain)throw new Error("client chain not configured. universalResolverAddress is required.");c=fr({blockNumber:n,chain:e.chain,contract:"ensUniversalResolver"})}const a=`${t.toLowerCase().substring(2)}.addr.reverse`;try{const l={address:c,abi:_y,functionName:"reverse",args:[Vt(fs(a))],blockNumber:n,blockTag:r},u=ee(e,Jt,"readContract"),[f,p]=o?await u({...l,args:[...l.args,o]}):await u(l);return t.toLowerCase()!==p.toLowerCase()?null:f}catch(l){if(s)throw l;if(ca(l,"reverse"))return null;throw l}}async function Dw(e,t){const{blockNumber:n,blockTag:r,name:o}=t,{chain:s}=e,i=(()=>{if(t.universalResolverAddress)return t.universalResolverAddress;if(!s)throw new Error("client chain not configured. universalResolverAddress is required.");return fr({blockNumber:n,chain:s,contract:"ensUniversalResolver"})})(),c=s==null?void 0:s.ensTlds;if(c&&!c.some(l=>o.endsWith(l)))throw new Error(`${o} is not a valid ENS TLD (${c==null?void 0:c.join(", ")}) for chain "${s.name}" (id: ${s.id}).`);const[a]=await ee(e,Jt,"readContract")({address:i,abi:[{inputs:[{type:"bytes"}],name:"findResolver",outputs:[{type:"address"},{type:"bytes32"}],stateMutability:"view",type:"function"}],functionName:"findResolver",args:[Vt(fs(o))],blockNumber:n,blockTag:r});return a}async function Rf(e,t){var x,A,w;const{account:n=e.account,blockNumber:r,blockTag:o="latest",blobs:s,data:i,gas:c,gasPrice:a,maxFeePerBlobGas:l,maxFeePerGas:u,maxPriorityFeePerGas:f,to:p,value:d,...h}=t,m=n?xt(n):void 0;try{uo(t);const B=(typeof r=="bigint"?J(r):void 0)||o,L=(w=(A=(x=e.chain)==null?void 0:x.formatters)==null?void 0:A.transactionRequest)==null?void 0:w.format,j=(L||Jo)({...ki(h,{format:L}),from:m==null?void 0:m.address,blobs:s,data:i,gas:c,gasPrice:a,maxFeePerBlobGas:l,maxFeePerGas:u,maxPriorityFeePerGas:f,to:p,value:d}),g=await e.request({method:"eth_createAccessList",params:[j,B]});return{accessList:g.accessList,gasUsed:BigInt(g.gasUsed)}}catch(T){throw $f(T,{...t,account:m,chain:e.chain})}}async function Fw(e){const t=qo(e,{method:"eth_newBlockFilter"}),n=await e.request({method:"eth_newBlockFilter"});return{id:n,request:t(n),type:"block"}}async function jf(e,{address:t,args:n,event:r,events:o,fromBlock:s,strict:i,toBlock:c}={}){const a=o??(r?[r]:void 0),l=qo(e,{method:"eth_newFilter"});let u=[];a&&(u=[a.flatMap(d=>_r({abi:[d],eventName:d.name,args:n}))],r&&(u=u[0]));const f=await e.request({method:"eth_newFilter",params:[{address:t,fromBlock:typeof s=="bigint"?J(s):s,toBlock:typeof c=="bigint"?J(c):c,...u.length?{topics:u}:{}}]});return{abi:a,args:n,eventName:r?r.name:void 0,fromBlock:s,id:f,request:l(f),strict:!!i,toBlock:c,type:"event"}}async function _f(e){const t=qo(e,{method:"eth_newPendingTransactionFilter"}),n=await e.request({method:"eth_newPendingTransactionFilter"});return{id:n,request:t(n),type:"transaction"}}async function Rw(e){const t=await e.request({method:"eth_blobBaseFee"});return BigInt(t)}async function jw(e,{blockHash:t,blockNumber:n,blockTag:r="latest"}={}){const o=n!==void 0?J(n):void 0;let s;return t?s=await e.request({method:"eth_getBlockTransactionCountByHash",params:[t]},{dedupe:!0}):s=await e.request({method:"eth_getBlockTransactionCountByNumber",params:[o||r]},{dedupe:!!o}),Wt(s)}async function Uf(e,{address:t,blockNumber:n,blockTag:r="latest"}){const o=n!==void 0?J(n):void 0,s=await e.request({method:"eth_getCode",params:[t,o||r]},{dedupe:!!o});if(s!=="0x")return s}class _w extends G{constructor({address:t}){super(`No EIP-712 domain found on contract "${t}".`,{metaMessages:["Ensure that:",`- The contract is deployed at the address "${t}".`,"- `eip712Domain()` function exists on the contract.","- `eip712Domain()` function matches signature to ERC-5267 specification."],name:"Eip712DomainNotFoundError"})}}async function Uw(e,t){const{address:n,factory:r,factoryData:o}=t;try{const[s,i,c,a,l,u,f]=await ee(e,Jt,"readContract")({abi:zw,address:n,functionName:"eip712Domain",factory:r,factoryData:o});return{domain:{name:i,version:c,chainId:Number(a),verifyingContract:l,salt:u},extensions:f,fields:s}}catch(s){const i=s;throw i.name==="ContractFunctionExecutionError"&&i.cause.name==="ContractFunctionZeroDataError"?new _w({address:n}):i}}const zw=[{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 Hw(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 Ww(e,{blockCount:t,blockNumber:n,blockTag:r="latest",rewardPercentiles:o}){const s=typeof n=="bigint"?J(n):void 0,i=await e.request({method:"eth_feeHistory",params:[J(t),s||r,o]},{dedupe:!!s});return Hw(i)}async function Vw(e,{filter:t}){const n=t.strict??!1,o=(await t.request({method:"eth_getFilterLogs",params:[t.id]})).map(s=>Xt(s));return t.abi?Ui({abi:t.abi,logs:o,strict:n}):o}class Gw extends G{constructor({callbackSelector:t,cause:n,data:r,extraData:o,sender:s,urls:i}){var c;super(n.shortMessage||"An error occurred while fetching for an offchain result.",{cause:n,metaMessages:[...n.metaMessages||[],(c=n.metaMessages)!=null&&c.length?"":[],"Offchain Gateway Call:",i&&[" Gateway URL(s):",...i.map(a=>` ${Hr(a)}`)],` Sender: ${s}`,` Data: ${r}`,` Callback selector: ${t}`,` Extra data: ${o}`].flat(),name:"OffchainLookupError"})}}class qw extends G{constructor({result:t,url:n}){super("Offchain gateway response is malformed. Response data must be a hex value.",{metaMessages:[`Gateway URL: ${Hr(n)}`,`Response: ${Te(t)}`],name:"OffchainLookupResponseMalformedError"})}}class Zw extends G{constructor({sender:t,to:n}){super("Reverted sender address does not match target contract address (`to`).",{metaMessages:[`Contract address: ${n}`,`OffchainLookup sender address: ${t}`],name:"OffchainLookupSenderMismatchError"})}}const Kw="0x556f1830",zf={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 Yw(e,{blockNumber:t,blockTag:n,data:r,to:o}){const{args:s}=Eu({data:r,abi:[zf]}),[i,c,a,l,u]=s,{ccipRead:f}=e,p=f&&typeof(f==null?void 0:f.request)=="function"?f.request:Hf;try{if(!es(o,i))throw new Zw({sender:i,to:o});const d=c.includes(ls)?await Mf({data:a,ccipRequest:p}):await p({data:a,sender:i,urls:c}),{data:h}=await po(e,{blockNumber:t,blockTag:n,data:vt([l,Kt([{type:"bytes"},{type:"bytes"}],[d,u])]),to:o});return h}catch(d){throw new Gw({callbackSelector:l,cause:d,data:r,extraData:u,sender:i,urls:c})}}async function Hf({data:e,sender:t,urls:n}){var o;let r=new Error("An unknown error occurred.");for(let s=0;s<n.length;s++){const i=n[s],c=i.includes("{data}")?"GET":"POST",a=c==="POST"?{data:e,sender:t}:void 0,l=c==="POST"?{"Content-Type":"application/json"}:{};try{const u=await fetch(i.replace("{sender}",t.toLowerCase()).replace("{data}",e),{body:JSON.stringify(a),headers:l,method:c});let f;if((o=u.headers.get("Content-Type"))!=null&&o.startsWith("application/json")?f=(await u.json()).data:f=await u.text(),!u.ok){r=new Cn({body:a,details:f!=null&&f.error?Te(f.error):u.statusText,headers:u.headers,status:u.status,url:i});continue}if(!bt(f)){r=new qw({result:f,url:i});continue}return f}catch(u){r=new Cn({body:a,details:u.message,url:i})}}throw r}const Xw=Object.freeze(Object.defineProperty({__proto__:null,ccipRequest:Hf,offchainLookup:Yw,offchainLookupAbiItem:zf,offchainLookupSignature:Kw},Symbol.toStringTag,{value:"Module"}));function Qw(e){return{formatters:void 0,fees:void 0,serializers:void 0,...e}}class Jw extends G{constructor({domain:t}){super(`Invalid domain "${Te(t)}".`,{metaMessages:["Must be a valid EIP-712 domain."]})}}class e1 extends G{constructor({primaryType:t,types:n}){super(`Invalid primary type \`${t}\` must be one of \`${JSON.stringify(Object.keys(n))}\`.`,{docsPath:"/api/glossary/Errors#typeddatainvalidprimarytypeerror",metaMessages:["Check that the primary type is a key in `types`."]})}}class t1 extends G{constructor({type:t}){super(`Struct type "${t}" is invalid.`,{metaMessages:["Struct type must not be a Solidity type."],name:"InvalidStructTypeError"})}}function n1(e){const{domain:t={},message:n,primaryType:r}=e,o={EIP712Domain:a1({domain:t}),...e.types};i1({domain:t,message:n,primaryType:r,types:o});const s=["0x1901"];return t&&s.push(r1({domain:t,types:o})),r!=="EIP712Domain"&&s.push(Wf({data:n,primaryType:r,types:o})),Ie(vt(s))}function r1({domain:e,types:t}){return Wf({data:e,primaryType:"EIP712Domain",types:t})}function Wf({data:e,primaryType:t,types:n}){const r=Vf({data:e,primaryType:t,types:n});return Ie(r)}function Vf({data:e,primaryType:t,types:n}){const r=[{type:"bytes32"}],o=[o1({primaryType:t,types:n})];for(const s of n[t]){const[i,c]=qf({types:n,name:s.name,type:s.type,value:e[s.name]});r.push(i),o.push(c)}return Kt(r,o)}function o1({primaryType:e,types:t}){const n=Vt(s1({primaryType:e,types:t}));return Ie(n)}function s1({primaryType:e,types:t}){let n="";const r=Gf({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 Gf({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])Gf({primaryType:s.type,types:t},n);return n}function qf({types:e,name:t,type:n,value:r}){if(e[n]!==void 0)return[{type:"bytes32"},Ie(Vf({data:r,primaryType:n,types:e}))];if(n==="bytes")return r=`0x${(r.length%2?"0":"")+r.slice(2)}`,[{type:"bytes32"},Ie(r)];if(n==="string")return[{type:"bytes32"},Ie(Vt(r))];if(n.lastIndexOf("]")===n.length-1){const o=n.slice(0,n.lastIndexOf("[")),s=r.map(i=>qf({name:t,type:o,types:e,value:i}));return[{type:"bytes32"},Ie(Kt(s.map(([i])=>i),s.map(([,i])=>i)))]}return[{type:n},r]}function i1(e){const{domain:t,message:n,primaryType:r,types:o}=e,s=(i,c)=>{for(const a of i){const{name:l,type:u}=a,f=c[l],p=u.match(fu);if(p&&(typeof f=="number"||typeof f=="bigint")){const[m,x,A]=p;J(f,{signed:x==="int",size:Number.parseInt(A)/8})}if(u==="address"&&typeof f=="string"&&!tt(f))throw new pn({address:f});const d=u.match(Zg);if(d){const[m,x]=d;if(x&&xe(f)!==Number.parseInt(x))throw new ig({expectedSize:Number.parseInt(x),givenSize:xe(f)})}const h=o[u];h&&(c1(u),s(h,f))}};if(o.EIP712Domain&&t){if(typeof t!="object")throw new Jw({domain:t});s(o.EIP712Domain,t)}if(r!=="EIP712Domain")if(o[r])s(o[r],n);else throw new e1({primaryType:r,types:o})}function a1({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 c1(e){if(e==="address"||e==="bool"||e==="string"||e.startsWith("bytes")||e.startsWith("uint")||e.startsWith("int"))throw new t1({type:e})}const l1=`Ethereum Signed Message:
80
- `;function u1(e){const t=typeof e=="string"?Dr(e):typeof e.raw=="string"?e.raw:$e(e.raw),n=Dr(`${l1}${xe(t)}`);return vt([n,t])}function Zf(e,t){return Ie(u1(e),t)}const Kf="0x6492649264926492649264926492649264926492649264926492649264926492";function f1(e){return uu(e,-32)===Kf}function d1(e){const{address:t,data:n,signature:r,to:o="hex"}=e,s=rr([Kt([{type:"address"},{type:"bytes"},{type:"bytes"}],[t,n,r]),Kf]);return o==="hex"?s:wt(s)}class p1 extends G{constructor({value:t}){super(`Number \`${t}\` is not a valid decimal number.`,{name:"InvalidDecimalNumberError"})}}function h1(e,t){if(!/^(-?)([0-9]*)\.?([0-9]*)$/.test(e))throw new p1({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 m1(e){return e.map(t=>({...t,value:BigInt(t.value)}))}function g1(e){return{...e,balance:e.balance?BigInt(e.balance):void 0,nonce:e.nonce?Wt(e.nonce):void 0,storageProof:e.storageProof?m1(e.storageProof):void 0}}async function b1(e,{address:t,blockNumber:n,blockTag:r,storageKeys:o}){const s=r??"latest",i=n!==void 0?J(n):void 0,c=await e.request({method:"eth_getProof",params:[t,o,i||s]});return g1(c)}async function y1(e,{address:t,blockNumber:n,blockTag:r="latest",slot:o}){const s=n!==void 0?J(n):void 0;return await e.request({method:"eth_getStorageAt",params:[t,o,s||r]})}async function pa(e,{blockHash:t,blockNumber:n,blockTag:r,hash:o,index:s}){var u,f,p;const i=r||"latest",c=n!==void 0?J(n):void 0;let a=null;if(o?a=await e.request({method:"eth_getTransactionByHash",params:[o]},{dedupe:!0}):t?a=await e.request({method:"eth_getTransactionByBlockHashAndIndex",params:[t,J(s)]},{dedupe:!0}):a=await e.request({method:"eth_getTransactionByBlockNumberAndIndex",params:[c||i,J(s)]},{dedupe:!!c}),!a)throw new Tu({blockHash:t,blockNumber:n,blockTag:i,hash:o,index:s});return(((p=(f=(u=e.chain)==null?void 0:u.formatters)==null?void 0:f.transaction)==null?void 0:p.format)||Ru)(a)}async function w1(e,{hash:t,transactionReceipt:n}){const[r,o]=await Promise.all([ee(e,mo,"getBlockNumber")({}),t?ee(e,pa,"getTransaction")({hash:t}):void 0]),s=(n==null?void 0:n.blockNumber)||(o==null?void 0:o.blockNumber);return s?r-s+1n:0n}async function ds(e,{hash:t}){var o,s,i;const n=await e.request({method:"eth_getTransactionReceipt",params:[t]},{dedupe:!0});if(!n)throw new Au({hash:t});return(((i=(s=(o=e.chain)==null?void 0:o.formatters)==null?void 0:s.transactionReceipt)==null?void 0:i.format)||sw)(n)}async function v1(e,t){var A;const{account:n,allowFailure:r=!0,batchSize:o,blockNumber:s,blockTag:i,multicallAddress:c,stateOverride:a}=t,l=t.contracts,u=o??(typeof((A=e.batch)==null?void 0:A.multicall)=="object"&&e.batch.multicall.batchSize||1024);let f=c;if(!f){if(!e.chain)throw new Error("client chain not configured. multicallAddress is required.");f=fr({blockNumber:s,chain:e.chain,contract:"multicall3"})}const p=[[]];let d=0,h=0;for(let w=0;w<l.length;w++){const{abi:T,address:B,args:L,functionName:F}=l[w];try{const j=Ct({abi:T,args:L,functionName:F});h+=(j.length-2)/2,u>0&&h>u&&p[d].length>0&&(d++,h=(j.length-2)/2,p[d]=[]),p[d]=[...p[d],{allowFailure:!0,callData:j,target:B}]}catch(j){const g=cr(j,{abi:T,address:B,args:L,docsPath:"/docs/contract/multicall",functionName:F,sender:n});if(!r)throw g;p[d]=[...p[d],{allowFailure:!0,callData:"0x",target:B}]}}const m=await Promise.allSettled(p.map(w=>ee(e,Jt,"readContract")({abi:Qi,account:n,address:f,args:[w],blockNumber:s,blockTag:i,functionName:"aggregate3",stateOverride:a}))),x=[];for(let w=0;w<m.length;w++){const T=m[w];if(T.status==="rejected"){if(!r)throw T.reason;for(let L=0;L<p[w].length;L++)x.push({status:"failure",error:T.reason,result:void 0});continue}const B=T.value;for(let L=0;L<B.length;L++){const{returnData:F,success:j}=B[L],{callData:g}=p[w][L],{abi:y,address:P,functionName:k,args:C}=l[x.length];try{if(g==="0x")throw new Br;if(!j)throw new Ko({data:F});const $=Bn({abi:y,args:C,data:F,functionName:k});x.push(r?{result:$,status:"success"}:$)}catch($){const S=cr($,{abi:y,address:P,args:C,docsPath:"/docs/contract/multicall",functionName:k});if(!r)throw S;x.push({error:S,result:void 0,status:"failure"})}}}if(x.length!==l.length)throw new G("multicall results mismatch");return x}async function ha(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?bf(p.blockOverrides):void 0,h=p.calls.map(x=>{const A=x,w=A.account?xt(A.account):void 0,T=A.abi?Ct(A):A.data,B={...A,data:A.dataSuffix?vt([T||"0x",A.dataSuffix]):T,from:A.from??(w==null?void 0:w.address)};return uo(B),Jo(B)}),m=p.stateOverrides?Bi(p.stateOverrides):void 0;a.push({blockOverrides:d,calls:h,stateOverrides:m})}const u=(typeof n=="bigint"?J(n):void 0)||r;return(await e.request({method:"eth_simulateV1",params:[{blockStateCalls:a,returnFullTransactions:s,traceTransfers:i,validation:c},u]})).map((p,d)=>({...ju(p),calls:p.calls.map((h,m)=>{var P,k;const{abi:x,args:A,functionName:w,to:T}=o[d].calls[m],B=((P=h.error)==null?void 0:P.data)??h.returnData,L=BigInt(h.gasUsed),F=(k=h.logs)==null?void 0:k.map(C=>Xt(C)),j=h.status==="0x1"?"success":"failure",g=x&&j==="success"&&B!=="0x"?Bn({abi:x,data:B,functionName:w}):null,y=(()=>{var $;if(j==="success")return;let C;if((($=h.error)==null?void 0:$.data)==="0x"?C=new Br:h.error&&(C=new Ko(h.error)),!!C)return cr(C,{abi:x??[],address:T??"0x",args:A,functionName:w??"<unknown>"})})();return{data:B,gasUsed:L,logs:F,status:j,...j==="success"?{result:g}:{error:y}}})}))}catch(a){const l=a,u=Mi(l,{});throw u instanceof Qo?l:u}}function Yf(e,t={}){const{as:n=typeof e=="string"?"Hex":"Bytes"}=t,r=su(Ty(e));return n==="Bytes"?r:df(r)}class x1 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 ma={checksum:new x1(8192)}.checksum,E1=/^0x[a-fA-F0-9]{40}$/;function ps(e,t={}){const{strict:n=!0}=t;if(!E1.test(e))throw new Xf({address:e,cause:new P1});if(n){if(e.toLowerCase()===e)return;if(S1(e)!==e)throw new Xf({address:e,cause:new $1})}}function S1(e){if(ma.has(e))return ma.get(e);ps(e,{strict:!1});const t=e.substring(2).toLowerCase(),n=Yf(Oy(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 ma.set(e,o),o}function ga(e,t={}){const{strict:n=!0}=t??{};try{return ps(e,{strict:n}),!0}catch{return!1}}class Xf 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 P1 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 $1 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 ba(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 ya(e,t){const n=typeof e,r=t.type;switch(r){case"address":return ga(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)=>ya(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=>ya(o,{...t,type:r.replace(/(\[[0-9]{0,}\])$/,"")})):!1}}function Qf(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 Qf(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")?ga(n[r],{strict:!1}):i.includes("address")&&i.includes("bytes")?ga(n[r],{strict:!1}):!1)return i}}function Jf(e,t={}){const{prepare:n=!0}=t,r=Array.isArray(e)||typeof e=="string"?Nl(e):e;return{...r,...n?{hash:dr(r)}:{}}}function T1(e,t,n){const{args:r=[],prepare:o=!0}=n??{},s=Dy(t,{strict:!1}),i=e.filter(l=>s?l.type==="function"||l.type==="error"?ed(l)===Xi(t,0,4):l.type==="event"?dr(l)===t:!1:"name"in l&&l.name===t);if(i.length===0)throw new wa({name:t});if(i.length===1)return{...i[0],...o?{hash:dr(i[0])}:{}};let c;for(const l of i){if(!("inputs"in l))continue;if(!r||r.length===0){if(!l.inputs||l.inputs.length===0)return{...l,...o?{hash:dr(l)}:{}};continue}if(!l.inputs||l.inputs.length===0||l.inputs.length!==r.length)continue;if(r.every((f,p)=>{const d="inputs"in l&&l.inputs[p];return d?ya(f,d):!1})){if(c&&"inputs"in c&&c.inputs){const f=Qf(l.inputs,c.inputs,r);if(f)throw new N1({abiItem:l,type:f[0]},{abiItem:c,type:f[1]})}c=l}}const a=(()=>{if(c)return c;const[l,...u]=i;return{...l,overloads:u}})();if(!a)throw new wa({name:t});return{...a,...o?{hash:dr(a)}:{}}}function ed(e){return Xi(dr(e),0,4)}function A1(e){const t=typeof e=="string"?e:Ro(e);return ba(t)}function dr(e){return typeof e!="string"&&"hash"in e&&e.hash?e.hash:Yf(Yi(A1(e)))}class N1 extends be{constructor(t,n){super("Found ambiguous types in overloaded ABI Items.",{metaMessages:[`\`${t.type}\` in \`${ba(Ro(t.abiItem))}\`, and`,`\`${n.type}\` in \`${ba(Ro(n.abiItem))}\``,"","These types encode differently and cannot be distinguished at runtime.","Remove one of the ambiguous items in the ABI."]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiItem.AmbiguityError"})}}class wa 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 O1=/^(.*)\[([0-9]*)\]$/,C1=/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/,td=/^(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 I1({checksumAddress:e,parameters:t,values:n}){const r=[];for(let o=0;o<t.length;o++)r.push(va({checksumAddress:e,parameter:t[o],value:n[o]}));return r}function va({checksumAddress:e=!1,parameter:t,value:n}){const r=t,o=j1(r.type);if(o){const[s,i]=o;return k1(n,{checksumAddress:e,length:s,parameter:{...r,type:i}})}if(r.type==="tuple")return R1(n,{checksumAddress:e,parameter:r});if(r.type==="address")return M1(n,{checksum:e});if(r.type==="bool")return L1(n);if(r.type.startsWith("uint")||r.type.startsWith("int")){const s=r.type.startsWith("int"),[,,i="256"]=td.exec(r.type)??[];return D1(n,{signed:s,size:Number(i)})}if(r.type.startsWith("bytes"))return B1(n,{type:r.type});if(r.type==="string")return F1(n);throw new sd(r.type)}function xa(e){let t=0;for(let s=0;s<e.length;s++){const{dynamic:i,encoded:c}=e[s];i?t+=32:t+=nt(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+=nt(c)):n.push(c)}return Mt(...n,...r)}function M1(e,t){const{checksum:n=!1}=t;return ps(e,{strict:n}),{dynamic:!1,encoded:Dn(e.toLowerCase())}}function k1(e,t){const{checksumAddress:n,length:r,parameter:o}=t,s=r===null;if(!Array.isArray(e))throw new U1(e);if(!s&&e.length!==r)throw new _1({expectedLength:r,givenLength:e.length,type:`${o.type}[${r}]`});let i=!1;const c=[];for(let a=0;a<e.length;a++){const l=va({checksumAddress:n,parameter:o,value:e[a]});l.dynamic&&(i=!0),c.push(l)}if(s||i){const a=xa(c);if(s){const l=Be(c.length,{size:32});return{dynamic:!0,encoded:c.length>0?Mt(l,a):l}}if(i)return{dynamic:!0,encoded:a}}return{dynamic:!1,encoded:Mt(...c.map(({encoded:a})=>a))}}function B1(e,{type:t}){const[,n]=t.split("bytes"),r=nt(e);if(!n){let o=e;return r%32!==0&&(o=Fn(o,Math.ceil((e.length-2)/2/32)*32)),{dynamic:!0,encoded:Mt(Dn(Be(r,{size:32})),o)}}if(r!==Number.parseInt(n))throw new rd({expectedSize:Number.parseInt(n),value:e});return{dynamic:!1,encoded:Fn(e)}}function L1(e){if(typeof e!="boolean")throw new be(`Invalid boolean value: "${e}" (type: ${typeof e}). Expected: \`true\` or \`false\`.`);return{dynamic:!1,encoded:Dn(ff(e))}}function D1(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 pf({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 F1(e){const t=Yi(e),n=Math.ceil(nt(t)/32),r=[];for(let o=0;o<n;o++)r.push(Fn(Xi(t,o*32,(o+1)*32)));return{dynamic:!0,encoded:Mt(Fn(Be(nt(t),{size:32})),...r)}}function R1(e,t){const{checksumAddress:n,parameter:r}=t;let o=!1;const s=[];for(let i=0;i<r.components.length;i++){const c=r.components[i],a=Array.isArray(e)?i:c.name,l=va({checksumAddress:n,parameter:c,value:e[a]});s.push(l),l.dynamic&&(o=!0)}return{dynamic:o,encoded:o?xa(s):Mt(...s.map(({encoded:i})=>i))}}function j1(e){const t=e.match(/^(.*)\[(\d+)?\]$/);return t?[t[2]?Number(t[2]):null,t[1]]:void 0}function nd(e,t,n){const{checksumAddress:r=!1}={};if(e.length!==t.length)throw new od({expectedLength:e.length,givenLength:t.length});const o=I1({checksumAddress:r,parameters:e,values:t}),s=xa(o);return s.length===0?"0x":s}function Ea(e,t){if(e.length!==t.length)throw new od({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(Ea.encode(o,s))}return Mt(...n)}(function(e){function t(n,r,o=!1){if(n==="address"){const a=r;return ps(a),Dn(a.toLowerCase(),o?32:0)}if(n==="string")return Yi(r);if(n==="bytes")return r;if(n==="bool")return Dn(ff(r),o?32:1);const s=n.match(td);if(s){const[a,l,u="256"]=s,f=Number.parseInt(u)/8;return Be(r,{size:o?32:f,signed:l==="int"})}const i=n.match(C1);if(i){const[a,l]=i;if(Number.parseInt(l)!==(r.length-2)/2)throw new rd({expectedSize:Number.parseInt(l),value:r});return Fn(r,o?32:0)}const c=n.match(O1);if(c&&Array.isArray(r)){const[a,l]=c,u=[];for(let f=0;f<r.length;f++)u.push(t(l,r[f],!0));return u.length===0?"0x":Mt(...u)}throw new sd(n)}e.encode=t})(Ea||(Ea={}));class _1 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 rd extends be{constructor({expectedSize:t,value:n}){super(`Size of bytes "${n}" (bytes${nt(n)}) does not match expected size (bytes${t}).`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiParameters.BytesSizeMismatchError"})}}class od extends be{constructor({expectedLength:t,givenLength:n}){super(["ABI encoding parameters/values length mismatch.",`Expected length (parameters): ${t}`,`Given length (values): ${n}`].join(`
81
- `)),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiParameters.LengthMismatchError"})}}class U1 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 sd 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 z1(e,t){var o;const{bytecode:n,args:r}=t;return Mt(n,(o=e.inputs)!=null&&o.length&&(r!=null&&r.length)?nd(e.inputs,r):"0x")}function H1(e){return Jf(e)}function W1(e,...t){const{overloads:n}=e,r=n?V1([e,...n],e.name,{args:t[0]}):e,o=G1(r),s=t.length>0?nd(r.inputs,t[0]):void 0;return s?Mt(o,s):o}function pr(e,t={}){return Jf(e,t)}function V1(e,t,n){const r=T1(e,t,n);if(r.type!=="function")throw new wa({name:t,type:"function"});return r}function G1(e){return ed(e)}const q1="0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",kt="0x0000000000000000000000000000000000000000",Z1="0x6080604052348015600e575f80fd5b5061016d8061001c5f395ff3fe608060405234801561000f575f80fd5b5060043610610029575f3560e01c8063f8b2cb4f1461002d575b5f80fd5b610047600480360381019061004291906100db565b61005d565b604051610054919061011e565b60405180910390f35b5f8173ffffffffffffffffffffffffffffffffffffffff16319050919050565b5f80fd5b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f6100aa82610081565b9050919050565b6100ba816100a0565b81146100c4575f80fd5b50565b5f813590506100d5816100b1565b92915050565b5f602082840312156100f0576100ef61007d565b5b5f6100fd848285016100c7565b91505092915050565b5f819050919050565b61011881610106565b82525050565b5f6020820190506101315f83018461010f565b9291505056fea26469706673582212203b9fe929fe995c7cf9887f0bdba8a36dd78e8b73f149b17d2d9ad7cd09d2dc6264736f6c634300081a0033";async function K1(e,t){const{blockNumber:n,blockTag:r,calls:o,stateOverrides:s,traceAssetChanges:i,traceTransfers:c,validation:a}=t,l=t.account?xt(t.account):void 0;if(i&&!l)throw new G("`account` is required when `traceAssetChanges` is true");const u=l?z1(H1("constructor(bytes, bytes)"),{bytecode:Sf,args:[Z1,W1(pr("function getBalance(address)"),[l.address])]}):void 0,f=i?await Promise.all(t.calls.map(async b=>{if(!b.data&&!b.abi)return;const{accessList:M}=await Rf(e,{account:l.address,...b,data:b.abi?Ct(b):b.data});return M.map(({address:R,storageKeys:_})=>_.length>0?R:null)})).then(b=>b.flat().filter(Boolean)):[],p=await ha(e,{blockNumber:n,blockTag:r,blocks:[...i?[{calls:[{data:u}],stateOverrides:s},{calls:f.map((b,M)=>({abi:[pr("function balanceOf(address) returns (uint256)")],functionName:"balanceOf",args:[l.address],to:b,from:kt,nonce:M})),stateOverrides:[{address:kt,nonce:0}]}]:[],{calls:[...o,{}].map(b=>({...b,from:l==null?void 0:l.address})),stateOverrides:s},...i?[{calls:[{data:u}]},{calls:f.map((b,M)=>({abi:[pr("function balanceOf(address) returns (uint256)")],functionName:"balanceOf",args:[l.address],to:b,from:kt,nonce:M})),stateOverrides:[{address:kt,nonce:0}]},{calls:f.map((b,M)=>({to:b,abi:[pr("function decimals() returns (uint256)")],functionName:"decimals",from:kt,nonce:M})),stateOverrides:[{address:kt,nonce:0}]},{calls:f.map((b,M)=>({to:b,abi:[pr("function tokenURI(uint256) returns (string)")],functionName:"tokenURI",args:[0n],from:kt,nonce:M})),stateOverrides:[{address:kt,nonce:0}]},{calls:f.map((b,M)=>({to:b,abi:[pr("function symbol() returns (string)")],functionName:"symbol",from:kt,nonce:M})),stateOverrides:[{address:kt,nonce:0}]}]:[]],traceTransfers:c,validation:a}),d=i?p[2]:p[0],[h,m,,x,A,w,T,B]=i?p:[],{calls:L,...F}=d,j=L.slice(0,-1)??[],g=(h==null?void 0:h.calls)??[],y=(m==null?void 0:m.calls)??[],P=[...g,...y].map(b=>b.status==="success"?Nt(b.data):null),k=(x==null?void 0:x.calls)??[],C=(A==null?void 0:A.calls)??[],$=[...k,...C].map(b=>b.status==="success"?Nt(b.data):null),S=((w==null?void 0:w.calls)??[]).map(b=>b.status==="success"?b.result:null),E=((B==null?void 0:B.calls)??[]).map(b=>b.status==="success"?b.result:null),O=((T==null?void 0:T.calls)??[]).map(b=>b.status==="success"?b.result:null),N=[];for(const[b,M]of $.entries()){const R=P[b];if(typeof M!="bigint"||typeof R!="bigint")continue;const _=S[b-1],U=E[b-1],W=O[b-1],K=b===0?{address:q1,decimals:18,symbol:"ETH"}:{address:f[b-1],decimals:W||_?Number(_??1):void 0,symbol:U??void 0};N.some(V=>V.token.address===K.address)||N.push({token:K,value:{pre:R,post:M,diff:M-R}})}return{assetChanges:N,block:F,results:j}}class id extends ui{constructor(t,n){super(),this.finished=!1,this.destroyed=!1,Gl(t);const r=Wo(n);if(this.iHash=t.create(),typeof this.iHash.update!="function")throw new Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;const o=this.blockLen,s=new Uint8Array(o);s.set(r.length>o?t.create().update(r).digest():r);for(let i=0;i<s.length;i++)s[i]^=54;this.iHash.update(s),this.oHash=t.create();for(let i=0;i<s.length;i++)s[i]^=106;this.oHash.update(s),tr(s)}update(t){return er(this),this.iHash.update(t),this}digestInto(t){er(this),qt(t,this.outputLen),this.finished=!0,this.iHash.digestInto(t),this.oHash.update(t),this.oHash.digestInto(t),this.destroy()}digest(){const t=new Uint8Array(this.oHash.outputLen);return this.digestInto(t),t}_cloneInto(t){t||(t=Object.create(Object.getPrototypeOf(this),{}));const{oHash:n,iHash:r,finished:o,destroyed:s,blockLen:i,outputLen:c}=this;return t=t,t.finished=o,t.destroyed=s,t.blockLen=i,t.outputLen=c,t.oHash=n._cloneInto(t.oHash),t.iHash=r._cloneInto(t.iHash),t}clone(){return this._cloneInto()}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}}const ad=(e,t,n)=>new id(e,t).update(n).digest();ad.create=(e,t)=>new id(e,t);/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const Ue=BigInt(0),Le=BigInt(1),Rn=BigInt(2),cd=BigInt(3),ld=BigInt(4),ud=BigInt(5),Y1=BigInt(7),fd=BigInt(8),X1=BigInt(9),dd=BigInt(16);function St(e,t){const n=e%t;return n>=Ue?n:t+n}function rt(e,t,n){let r=e;for(;t-- >Ue;)r*=r,r%=n;return r}function pd(e,t){if(e===Ue)throw new Error("invert: expected non-zero number");if(t<=Ue)throw new Error("invert: expected positive modulus, got "+t);let n=St(e,t),r=t,o=Ue,s=Le;for(;n!==Ue;){const c=r/n,a=r%n,l=o-s*c;r=n,n=a,o=s,s=l}if(r!==Le)throw new Error("invert: does not exist");return St(o,t)}function Sa(e,t,n){if(!e.eql(e.sqr(t),n))throw new Error("Cannot find square root")}function hd(e,t){const n=(e.ORDER+Le)/ld,r=e.pow(t,n);return Sa(e,r,t),r}function Q1(e,t){const n=(e.ORDER-ud)/fd,r=e.mul(t,Rn),o=e.pow(r,n),s=e.mul(t,o),i=e.mul(e.mul(s,Rn),o),c=e.mul(s,e.sub(i,e.ONE));return Sa(e,c,t),c}function J1(e){const t=bo(e),n=md(e),r=n(t,t.neg(t.ONE)),o=n(t,r),s=n(t,t.neg(r)),i=(e+Y1)/dd;return(c,a)=>{let l=c.pow(a,i),u=c.mul(l,r);const f=c.mul(l,o),p=c.mul(l,s),d=c.eql(c.sqr(u),a),h=c.eql(c.sqr(f),a);l=c.cmov(l,u,d),u=c.cmov(p,f,h);const m=c.eql(c.sqr(u),a),x=c.cmov(l,u,m);return Sa(c,x,a),x}}function md(e){if(e<cd)throw new Error("sqrt is not defined for small field");let t=e-Le,n=0;for(;t%Rn===Ue;)t/=Rn,n++;let r=Rn;const o=bo(e);for(;bd(o,r)===1;)if(r++>1e3)throw new Error("Cannot find square root: probably non-prime P");if(n===1)return hd;let s=o.pow(r,t);const i=(t+Le)/Rn;return function(a,l){if(a.is0(l))return l;if(bd(a,l)!==1)throw new Error("Cannot find square root");let u=n,f=a.mul(a.ONE,s),p=a.pow(l,t),d=a.pow(l,i);for(;!a.eql(p,a.ONE);){if(a.is0(p))return a.ZERO;let h=1,m=a.sqr(p);for(;!a.eql(m,a.ONE);)if(h++,m=a.sqr(m),h===u)throw new Error("Cannot find square root");const x=Le<<BigInt(u-h-1),A=a.pow(f,x);u=h,f=a.sqr(A),p=a.mul(p,f),d=a.mul(d,A)}return d}}function ev(e){return e%ld===cd?hd:e%fd===ud?Q1:e%dd===X1?J1(e):md(e)}const tv=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function nv(e){const t={ORDER:"bigint",MASK:"bigint",BYTES:"number",BITS:"number"},n=tv.reduce((r,o)=>(r[o]="function",r),t);return Zi(e,n),e}function rv(e,t,n){if(n<Ue)throw new Error("invalid exponent, negatives unsupported");if(n===Ue)return e.ONE;if(n===Le)return t;let r=e.ONE,o=t;for(;n>Ue;)n&Le&&(r=e.mul(r,o)),o=e.sqr(o),n>>=Le;return r}function gd(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 bd(e,t){const n=(e.ORDER-Le)/Rn,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 yd(e,t){t!==void 0&&Fr(t);const n=t!==void 0?t:e.toString(2).length,r=Math.ceil(n/8);return{nBitLength:n,nByteLength:r}}function bo(e,t,n=!1,r={}){if(e<=Ue)throw new Error("invalid field: expected ORDER > 0, got "+e);let o,s,i=!1,c;if(typeof t=="object"&&t!=null){if(r.sqrt||n)throw new Error("cannot specify opts in two arguments");const p=t;p.BITS&&(o=p.BITS),p.sqrt&&(s=p.sqrt),typeof p.isLE=="boolean"&&(n=p.isLE),typeof p.modFromBytes=="boolean"&&(i=p.modFromBytes),c=p.allowedLengths}else typeof t=="number"&&(o=t),r.sqrt&&(s=r.sqrt);const{nBitLength:a,nByteLength:l}=yd(e,o);if(l>2048)throw new Error("invalid field: expected ORDER of <= 2048 bytes");let u;const f=Object.freeze({ORDER:e,isLE:n,BITS:a,BYTES:l,MASK:fo(a),ZERO:Ue,ONE:Le,allowedLengths:c,create:p=>St(p,e),isValid:p=>{if(typeof p!="bigint")throw new Error("invalid field element: expected bigint, got "+typeof p);return Ue<=p&&p<e},is0:p=>p===Ue,isValidNot0:p=>!f.is0(p)&&f.isValid(p),isOdd:p=>(p&Le)===Le,neg:p=>St(-p,e),eql:(p,d)=>p===d,sqr:p=>St(p*p,e),add:(p,d)=>St(p+d,e),sub:(p,d)=>St(p-d,e),mul:(p,d)=>St(p*d,e),pow:(p,d)=>rv(f,p,d),div:(p,d)=>St(p*pd(d,e),e),sqrN:p=>p*p,addN:(p,d)=>p+d,subN:(p,d)=>p-d,mulN:(p,d)=>p*d,inv:p=>pd(p,e),sqrt:s||(p=>(u||(u=ev(e)),u(f,p))),toBytes:p=>n?rf(p,l):Gi(p,l),fromBytes:(p,d=!0)=>{if(c){if(!c.includes(p.length)||p.length>l)throw new Error("Field.fromBytes: expected "+c+" bytes, got "+p.length);const m=new Uint8Array(l);m.set(p,n?0:m.length-p.length),p=m}if(p.length!==l)throw new Error("Field.fromBytes: expected "+l+" bytes, got "+p.length);let h=n?nf(p):rs(p);if(i&&(h=St(h,e)),!d&&!f.isValid(h))throw new Error("invalid field element: outside of range 0..ORDER");return h},invertBatch:p=>gd(f,p),cmov:(p,d,h)=>h?d:p});return Object.freeze(f)}function wd(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 vd(e){const t=wd(e);return t+Math.ceil(t/2)}function ov(e,t,n=!1){const r=e.length,o=wd(t),s=vd(t);if(r<16||r<s||r>1024)throw new Error("expected "+s+"-1024 bytes of input, got "+r);const i=n?nf(e):rs(e),c=St(i,t-Le)+Le;return n?rf(c,o):Gi(c,o)}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const hr=BigInt(0),jn=BigInt(1);function hs(e,t){const n=t.negate();return e?n:t}function Pa(e,t){const n=gd(e.Fp,t.map(r=>r.Z));return t.map((r,o)=>e.fromAffine(r.toAffine(n[o])))}function xd(e,t){if(!Number.isSafeInteger(e)||e<=0||e>t)throw new Error("invalid window size, expected [1.."+t+"], got W="+e)}function $a(e,t){xd(e,t);const n=Math.ceil(t/e)+1,r=2**(e-1),o=2**e,s=fo(e),i=BigInt(e);return{windows:n,windowSize:r,mask:s,maxNumber:o,shiftBy:i}}function Ed(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+=jn);const l=t*r,u=l+Math.abs(c)-1,f=c===0,p=c<0,d=t%2!==0;return{nextN:a,offset:u,isZero:f,isNeg:p,isNegF:d,offsetF:l}}function sv(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 iv(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 Ta=new WeakMap,Sd=new WeakMap;function Aa(e){return Sd.get(e)||1}function Pd(e){if(e!==hr)throw new Error("invalid wNAF")}class av{constructor(t,n){this.BASE=t.BASE,this.ZERO=t.ZERO,this.Fn=t.Fn,this.bits=n}_unsafeLadder(t,n,r=this.ZERO){let o=t;for(;n>hr;)n&jn&&(r=r.add(o)),o=o.double(),n>>=jn;return r}precomputeWindow(t,n){const{windows:r,windowSize:o}=$a(n,this.bits),s=[];let i=t,c=i;for(let a=0;a<r;a++){c=i,s.push(c);for(let l=1;l<o;l++)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=$a(t,this.bits);for(let c=0;c<i.windows;c++){const{nextN:a,offset:l,isZero:u,isNeg:f,isNegF:p,offsetF:d}=Ed(r,c,i);r=a,u?s=s.add(hs(p,n[d])):o=o.add(hs(f,n[l]))}return Pd(r),{p:o,f:s}}wNAFUnsafe(t,n,r,o=this.ZERO){const s=$a(t,this.bits);for(let i=0;i<s.windows&&r!==hr;i++){const{nextN:c,offset:a,isZero:l,isNeg:u}=Ed(r,i,s);if(r=c,!l){const f=n[a];o=o.add(u?f.negate():f)}}return Pd(r),o}getPrecomputes(t,n,r){let o=Ta.get(n);return o||(o=this.precomputeWindow(n,t),t!==1&&(typeof r=="function"&&(o=r(o)),Ta.set(n,o))),o}cached(t,n,r){const o=Aa(t);return this.wNAF(o,this.getPrecomputes(o,t,r),n)}unsafe(t,n,r,o){const s=Aa(t);return s===1?this._unsafeLadder(t,n,o):this.wNAFUnsafe(s,this.getPrecomputes(s,t,r),n,o)}createCache(t,n){xd(n,this.bits),Sd.set(t,n),Ta.delete(t)}hasCache(t){return Aa(t)!==1}}function cv(e,t,n,r){let o=t,s=e.ZERO,i=e.ZERO;for(;n>hr||r>hr;)n&jn&&(s=s.add(o)),r&jn&&(i=i.add(o)),o=o.double(),n>>=jn,r>>=jn;return{p1:s,p2:i}}function lv(e,t,n,r){sv(n,e),iv(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=of(BigInt(o));let a=1;c>12?a=c-3:c>4?a=c-2:c>0&&(a=2);const l=fo(a),u=new Array(Number(l)+1).fill(i),f=Math.floor((t.BITS-1)/a)*a;let p=i;for(let d=f;d>=0;d-=a){u.fill(i);for(let m=0;m<s;m++){const x=r[m],A=Number(x>>BigInt(d)&l);u[A]=u[A].add(n[m])}let h=i;for(let m=u.length-1,x=i;m>0;m--)x=x.add(u[m]),h=h.add(x);if(p=p.add(h),d!==0)for(let m=0;m<a;m++)p=p.double()}return p}function $d(e,t,n){if(t){if(t.ORDER!==e)throw new Error("Field.ORDER must match order: Fp == p, Fn == n");return nv(t),t}else return bo(e,{isLE:n})}function uv(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 l=t[a];if(!(typeof l=="bigint"&&l>hr))throw new Error(`CURVE.${a} must be positive bigint`)}const o=$d(t.p,n.Fp,r),s=$d(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 Td=(e,t)=>(e+(e>=0?t:-t)/Ad)/t;function fv(e,t,n){const[[r,o],[s,i]]=t,c=Td(i*e,n),a=Td(-o*e,n);let l=e-c*r-a*s,u=-c*o-a*i;const f=l<tn,p=u<tn;f&&(l=-l),p&&(u=-u);const d=fo(Math.ceil(of(n)/2))+mr;if(l<tn||l>=d||u<tn||u>=d)throw new Error("splitScalar (endomorphism): failed, k="+e);return{k1neg:f,k1:l,k2neg:p,k2:u}}function Na(e){if(!["compact","recovered","der"].includes(e))throw new Error('Signature format must be "compact", "recovered", or "der"');return e}function Oa(e,t){const n={};for(let r of Object.keys(t))n[r]=e[r]===void 0?t[r]:e[r];return ts(n.lowS,"lowS"),ts(n.prehash,"prehash"),n.format!==void 0&&Na(n.format),n}class dv extends Error{constructor(t=""){super(t)}}const en={Err:dv,_tlv:{encode:(e,t)=>{const{Err:n}=en;if(e<0||e>256)throw new n("tlv.encode: wrong tag");if(t.length&1)throw new n("tlv.encode: unpadded data");const r=t.length/2,o=ns(r);if(o.length/2&128)throw new n("tlv.encode: long form length too big");const s=r>127?ns(o.length/2|128):"";return ns(e)+s+o+t},decode(e,t){const{Err:n}=en;let r=0;if(e<0||e>256)throw new n("tlv.encode: wrong tag");if(t.length<2||t[r++]!==e)throw new n("tlv.decode: wrong tlv");const o=t[r++],s=!!(o&128);let i=0;if(!s)i=o;else{const a=o&127;if(!a)throw new n("tlv.decode(long): indefinite length not supported");if(a>4)throw new n("tlv.decode(long): byte length is too big");const l=t.subarray(r,r+a);if(l.length!==a)throw new n("tlv.decode: length bytes not complete");if(l[0]===0)throw new n("tlv.decode(long): zero leftmost byte");for(const u of l)i=i<<8|u;if(r+=a,i<128)throw new n("tlv.decode(long): not minimal encoding")}const c=t.subarray(r,r+i);if(c.length!==i)throw new n("tlv.decode: wrong value length");return{v:c,l:t.subarray(r+i)}}},_int:{encode(e){const{Err:t}=en;if(e<tn)throw new t("integer: negative integers are not allowed");let n=ns(e);if(Number.parseInt(n[0],16)&8&&(n="00"+n),n.length&1)throw new t("unexpected DER parsing assertion: unpadded hex");return n},decode(e){const{Err:t}=en;if(e[0]&128)throw new t("invalid signature integer: negative");if(e[0]===0&&!(e[1]&128))throw new t("invalid signature integer: unnecessary leading zero");return rs(e)}},toSig(e){const{Err:t,_int:n,_tlv:r}=en,o=_e("signature",e),{v:s,l:i}=r.decode(48,o);if(i.length)throw new t("invalid signature: left bytes after parsing");const{v:c,l:a}=r.decode(2,s),{v:l,l:u}=r.decode(2,a);if(u.length)throw new t("invalid signature: left bytes after parsing");return{r:n.decode(c),s:n.decode(l)}},hexFromSig(e){const{_tlv:t,_int:n}=en,r=t.encode(2,n.encode(e.r)),o=t.encode(2,n.encode(e.s)),s=r+o;return t.encode(48,s)}},tn=BigInt(0),mr=BigInt(1),Ad=BigInt(2),ms=BigInt(3),pv=BigInt(4);function gr(e,t){const{BYTES:n}=e;let r;if(typeof t=="bigint")r=t;else{let o=_e("private key",t);try{r=e.fromBytes(o)}catch{throw new Error(`invalid private key: expected ui8a of size ${n}, got ${typeof t}`)}}if(!e.isValidNot0(r))throw new Error("invalid private key: out of range [1..N-1]");return r}function hv(e,t={}){const n=uv("weierstrass",e,t),{Fp:r,Fn:o}=n;let s=n.CURVE;const{h:i,n:c}=s;Zi(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 l=Od(r,o);function u(){if(!r.isOdd)throw new Error("compression is not supported: Field does not have .isOdd()")}function f(C,$,S){const{x:E,y:O}=$.toAffine(),N=r.toBytes(E);if(ts(S,"isCompressed"),S){u();const b=!r.isOdd(O);return dn(Nd(b),N)}else return dn(Uint8Array.of(4),N,r.toBytes(O))}function p(C){Ln(C,void 0,"Point");const{publicKey:$,publicKeyUncompressed:S}=l,E=C.length,O=C[0],N=C.subarray(1);if(E===$&&(O===2||O===3)){const b=r.fromBytes(N);if(!r.isValid(b))throw new Error("bad point: is not on curve, wrong x");const M=m(b);let R;try{R=r.sqrt(M)}catch(W){const K=W instanceof Error?": "+W.message:"";throw new Error("bad point: is not on curve, sqrt error"+K)}u();const _=r.isOdd(R);return(O&1)===1!==_&&(R=r.neg(R)),{x:b,y:R}}else if(E===S&&O===4){const b=r.BYTES,M=r.fromBytes(N.subarray(0,b)),R=r.fromBytes(N.subarray(b,b*2));if(!x(M,R))throw new Error("bad point: is not on curve");return{x:M,y:R}}else throw new Error(`bad point: got length ${E}, expected compressed=${$} or uncompressed=${S}`)}const d=t.toBytes||f,h=t.fromBytes||p;function m(C){const $=r.sqr(C),S=r.mul($,C);return r.add(r.add(S,r.mul(C,s.a)),s.b)}function x(C,$){const S=r.sqr($),E=m(C);return r.eql(S,E)}if(!x(s.Gx,s.Gy))throw new Error("bad curve params: generator point");const A=r.mul(r.pow(s.a,ms),pv),w=r.mul(r.sqr(s.b),BigInt(27));if(r.is0(r.add(A,w)))throw new Error("bad curve params: a or b");function T(C,$,S=!1){if(!r.isValid($)||S&&r.is0($))throw new Error(`bad point coordinate ${C}`);return $}function B(C){if(!(C instanceof y))throw new Error("ProjectivePoint expected")}function L(C){if(!a||!a.basises)throw new Error("no endo");return fv(C,a.basises,o.ORDER)}const F=sf((C,$)=>{const{X:S,Y:E,Z:O}=C;if(r.eql(O,r.ONE))return{x:S,y:E};const N=C.is0();$==null&&($=N?r.ONE:r.inv(O));const b=r.mul(S,$),M=r.mul(E,$),R=r.mul(O,$);if(N)return{x:r.ZERO,y:r.ZERO};if(!r.eql(R,r.ONE))throw new Error("invZ was invalid");return{x:b,y:M}}),j=sf(C=>{if(C.is0()){if(t.allowInfinityPoint&&!r.is0(C.Y))return;throw new Error("bad point: ZERO")}const{x:$,y:S}=C.toAffine();if(!r.isValid($)||!r.isValid(S))throw new Error("bad point: x or y not field elements");if(!x($,S))throw new Error("bad point: equation left != right");if(!C.isTorsionFree())throw new Error("bad point: not in prime-order subgroup");return!0});function g(C,$,S,E,O){return S=new y(r.mul(S.X,C),S.Y,S.Z),$=hs(E,$),S=hs(O,S),$.add(S)}class y{constructor($,S,E){this.X=T("x",$),this.Y=T("y",S,!0),this.Z=T("z",E),Object.freeze(this)}static CURVE(){return s}static fromAffine($){const{x:S,y:E}=$||{};if(!$||!r.isValid(S)||!r.isValid(E))throw new Error("invalid affine point");if($ instanceof y)throw new Error("projective point not allowed");return r.is0(S)&&r.is0(E)?y.ZERO:new y(S,E,r.ONE)}static fromBytes($){const S=y.fromAffine(h(Ln($,void 0,"point")));return S.assertValidity(),S}static fromHex($){return y.fromBytes(_e("pointHex",$))}get x(){return this.toAffine().x}get y(){return this.toAffine().y}precompute($=8,S=!0){return k.createCache(this,$),S||this.multiply(ms),this}assertValidity(){j(this)}hasEvenY(){const{y:$}=this.toAffine();if(!r.isOdd)throw new Error("Field doesn't support isOdd");return!r.isOdd($)}equals($){B($);const{X:S,Y:E,Z:O}=this,{X:N,Y:b,Z:M}=$,R=r.eql(r.mul(S,M),r.mul(N,O)),_=r.eql(r.mul(E,M),r.mul(b,O));return R&&_}negate(){return new y(this.X,r.neg(this.Y),this.Z)}double(){const{a:$,b:S}=s,E=r.mul(S,ms),{X:O,Y:N,Z:b}=this;let M=r.ZERO,R=r.ZERO,_=r.ZERO,U=r.mul(O,O),W=r.mul(N,N),K=r.mul(b,b),V=r.mul(O,N);return V=r.add(V,V),_=r.mul(O,b),_=r.add(_,_),M=r.mul($,_),R=r.mul(E,K),R=r.add(M,R),M=r.sub(W,R),R=r.add(W,R),R=r.mul(M,R),M=r.mul(V,M),_=r.mul(E,_),K=r.mul($,K),V=r.sub(U,K),V=r.mul($,V),V=r.add(V,_),_=r.add(U,U),U=r.add(_,U),U=r.add(U,K),U=r.mul(U,V),R=r.add(R,U),K=r.mul(N,b),K=r.add(K,K),U=r.mul(K,V),M=r.sub(M,U),_=r.mul(K,W),_=r.add(_,_),_=r.add(_,_),new y(M,R,_)}add($){B($);const{X:S,Y:E,Z:O}=this,{X:N,Y:b,Z:M}=$;let R=r.ZERO,_=r.ZERO,U=r.ZERO;const W=s.a,K=r.mul(s.b,ms);let V=r.mul(S,N),Z=r.mul(E,b),H=r.mul(O,M),Y=r.add(S,E),Q=r.add(N,b);Y=r.mul(Y,Q),Q=r.add(V,Z),Y=r.sub(Y,Q),Q=r.add(S,O);let se=r.add(N,M);return Q=r.mul(Q,se),se=r.add(V,H),Q=r.sub(Q,se),se=r.add(E,O),R=r.add(b,M),se=r.mul(se,R),R=r.add(Z,H),se=r.sub(se,R),U=r.mul(W,Q),R=r.mul(K,H),U=r.add(R,U),R=r.sub(Z,U),U=r.add(Z,U),_=r.mul(R,U),Z=r.add(V,V),Z=r.add(Z,V),H=r.mul(W,H),Q=r.mul(K,Q),Z=r.add(Z,H),H=r.sub(V,H),H=r.mul(W,H),Q=r.add(Q,H),V=r.mul(Z,Q),_=r.add(_,V),V=r.mul(se,Q),R=r.mul(Y,R),R=r.sub(R,V),V=r.mul(Y,Z),U=r.mul(se,U),U=r.add(U,V),new y(R,_,U)}subtract($){return this.add($.negate())}is0(){return this.equals(y.ZERO)}multiply($){const{endo:S}=t;if(!o.isValidNot0($))throw new Error("invalid scalar: out of range");let E,O;const N=b=>k.cached(this,b,M=>Pa(y,M));if(S){const{k1neg:b,k1:M,k2neg:R,k2:_}=L($),{p:U,f:W}=N(M),{p:K,f:V}=N(_);O=W.add(V),E=g(S.beta,U,K,b,R)}else{const{p:b,f:M}=N($);E=b,O=M}return Pa(y,[E,O])[0]}multiplyUnsafe($){const{endo:S}=t,E=this;if(!o.isValid($))throw new Error("invalid scalar: out of range");if($===tn||E.is0())return y.ZERO;if($===mr)return E;if(k.hasCache(this))return this.multiply($);if(S){const{k1neg:O,k1:N,k2neg:b,k2:M}=L($),{p1:R,p2:_}=cv(y,E,N,M);return g(S.beta,R,_,O,b)}else return k.unsafe(E,$)}multiplyAndAddUnsafe($,S,E){const O=this.multiplyUnsafe(S).add($.multiplyUnsafe(E));return O.is0()?void 0:O}toAffine($){return F(this,$)}isTorsionFree(){const{isTorsionFree:$}=t;return i===mr?!0:$?$(y,this):k.unsafe(this,c).is0()}clearCofactor(){const{clearCofactor:$}=t;return i===mr?this:$?$(y,this):this.multiplyUnsafe(i)}isSmallOrder(){return this.multiplyUnsafe(i).is0()}toBytes($=!0){return ts($,"isCompressed"),this.assertValidity(),d(y,this,$)}toHex($=!0){return nr(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 Pa(y,$)}static msm($,S){return lv(y,o,$,S)}static fromPrivateKey($){return y.BASE.multiply(gr(o,$))}}y.BASE=new y(s.Gx,s.Gy,r.ONE),y.ZERO=new y(r.ZERO,r.ONE,r.ZERO),y.Fp=r,y.Fn=o;const P=o.BITS,k=new av(y,t.endo?Math.ceil(P/2):P);return y.BASE.precompute(8),y}function Nd(e){return Uint8Array.of(e?2:3)}function Od(e,t){return{secretKey:t.BYTES,publicKey:1+e.BYTES,publicKeyUncompressed:1+2*e.BYTES,publicKeyHasPrefix:!0,signature:2*t.BYTES}}function mv(e,t={}){const{Fn:n}=e,r=t.randomBytes||Ql,o=Object.assign(Od(e.Fp,n),{seed:vd(n.ORDER)});function s(d){try{return!!gr(n,d)}catch{return!1}}function i(d,h){const{publicKey:m,publicKeyUncompressed:x}=o;try{const A=d.length;return h===!0&&A!==m||h===!1&&A!==x?!1:!!e.fromBytes(d)}catch{return!1}}function c(d=r(o.seed)){return ov(Ln(d,o.seed,"seed"),n.ORDER)}function a(d,h=!0){return e.BASE.multiply(gr(n,d)).toBytes(h)}function l(d){const h=c(d);return{secretKey:h,publicKey:a(h)}}function u(d){if(typeof d=="bigint")return!1;if(d instanceof e)return!0;const{secretKey:h,publicKey:m,publicKeyUncompressed:x}=o;if(n.allowedLengths||h===m)return;const A=_e("key",d).length;return A===m||A===x}function f(d,h,m=!0){if(u(d)===!0)throw new Error("first arg must be private key");if(u(h)===!1)throw new Error("second arg must be public key");const x=gr(n,d);return e.fromHex(h).multiply(x).toBytes(m)}return Object.freeze({getPublicKey:a,getSharedSecret:f,keygen:l,Point:e,utils:{isValidSecretKey:s,isValidPublicKey:i,randomSecretKey:c,isValidPrivateKey:s,randomPrivateKey:c,normPrivateKeyToScalar:d=>gr(n,d),precompute(d=8,h=e.BASE){return h.precompute(d,!1)}},lengths:o})}function gv(e,t,n={}){Gl(t),Zi(n,{},{hmac:"function",lowS:"boolean",randomBytes:"function",bits2int:"function",bits2int_modN:"function"});const r=n.randomBytes||Ql,o=n.hmac||((S,...E)=>ad(t,S,dn(...E))),{Fp:s,Fn:i}=e,{ORDER:c,BITS:a}=i,{keygen:l,getPublicKey:u,getSharedSecret:f,utils:p,lengths:d}=mv(e,n),h={prehash:!1,lowS:typeof n.lowS=="boolean"?n.lowS:!1,format:void 0,extraEntropy:!1},m="compact";function x(S){const E=c>>mr;return S>E}function A(S,E){if(!i.isValidNot0(E))throw new Error(`invalid signature ${S}: out of range 1..Point.Fn.ORDER`);return E}function w(S,E){Na(E);const O=d.signature,N=E==="compact"?O:E==="recovered"?O+1:void 0;return Ln(S,N,`${E} signature`)}class T{constructor(E,O,N){this.r=A("r",E),this.s=A("s",O),N!=null&&(this.recovery=N),Object.freeze(this)}static fromBytes(E,O=m){w(E,O);let N;if(O==="der"){const{r:_,s:U}=en.toSig(Ln(E));return new T(_,U)}O==="recovered"&&(N=E[0],O="compact",E=E.subarray(1));const b=i.BYTES,M=E.subarray(0,b),R=E.subarray(b,b*2);return new T(i.fromBytes(M),i.fromBytes(R),N)}static fromHex(E,O){return this.fromBytes(Ho(E),O)}addRecoveryBit(E){return new T(this.r,this.s,E)}recoverPublicKey(E){const O=s.ORDER,{r:N,s:b,recovery:M}=this;if(M==null||![0,1,2,3].includes(M))throw new Error("recovery id invalid");if(c*Ad<O&&M>1)throw new Error("recovery id is ambiguous for h>1 curve");const _=M===2||M===3?N+c:N;if(!s.isValid(_))throw new Error("recovery id 2 or 3 invalid");const U=s.toBytes(_),W=e.fromBytes(dn(Nd((M&1)===0),U)),K=i.inv(_),V=L(_e("msgHash",E)),Z=i.create(-V*K),H=i.create(b*K),Y=e.BASE.multiplyUnsafe(Z).add(W.multiplyUnsafe(H));if(Y.is0())throw new Error("point at infinify");return Y.assertValidity(),Y}hasHighS(){return x(this.s)}toBytes(E=m){if(Na(E),E==="der")return Ho(en.hexFromSig(this));const O=i.toBytes(this.r),N=i.toBytes(this.s);if(E==="recovered"){if(this.recovery==null)throw new Error("recovery bit must be present");return dn(Uint8Array.of(this.recovery),O,N)}return dn(O,N)}toHex(E){return nr(this.toBytes(E))}assertValidity(){}static fromCompact(E){return T.fromBytes(_e("sig",E),"compact")}static fromDER(E){return T.fromBytes(_e("sig",E),"der")}normalizeS(){return this.hasHighS()?new T(this.r,i.neg(this.s),this.recovery):this}toDERRawBytes(){return this.toBytes("der")}toDERHex(){return nr(this.toBytes("der"))}toCompactRawBytes(){return this.toBytes("compact")}toCompactHex(){return nr(this.toBytes("compact"))}}const B=n.bits2int||function(E){if(E.length>8192)throw new Error("input is too large");const O=rs(E),N=E.length*8-a;return N>0?O>>BigInt(N):O},L=n.bits2int_modN||function(E){return i.create(B(E))},F=fo(a);function j(S){return my("num < 2^"+a,S,tn,F),i.toBytes(S)}function g(S,E){return Ln(S,void 0,"message"),E?Ln(t(S),void 0,"prehashed message"):S}function y(S,E,O){if(["recovered","canonical"].some(Z=>Z in O))throw new Error("sign() legacy options not supported");const{lowS:N,prehash:b,extraEntropy:M}=Oa(O,h);S=g(S,b);const R=L(S),_=gr(i,E),U=[j(_),j(R)];if(M!=null&&M!==!1){const Z=M===!0?r(d.secretKey):M;U.push(_e("extraEntropy",Z))}const W=dn(...U),K=R;function V(Z){const H=B(Z);if(!i.isValidNot0(H))return;const Y=i.inv(H),Q=e.BASE.multiply(H).toAffine(),se=i.create(Q.x);if(se===tn)return;const me=i.create(Y*i.create(K+se*_));if(me===tn)return;let pe=(Q.x===se?0:2)|Number(Q.y&mr),le=me;return N&&x(me)&&(le=i.neg(me),pe^=1),new T(se,le,pe)}return{seed:W,k2sig:V}}function P(S,E,O={}){S=_e("message",S);const{seed:N,k2sig:b}=y(S,E,O);return gy(t.outputLen,i.BYTES,o)(N,b)}function k(S){let E;const O=typeof S=="string"||zo(S),N=!O&&S!==null&&typeof S=="object"&&typeof S.r=="bigint"&&typeof S.s=="bigint";if(!O&&!N)throw new Error("invalid signature, expected Uint8Array, hex string or Signature instance");if(N)E=new T(S.r,S.s);else if(O){try{E=T.fromBytes(_e("sig",S),"der")}catch(b){if(!(b instanceof en.Err))throw b}if(!E)try{E=T.fromBytes(_e("sig",S),"compact")}catch{return!1}}return E||!1}function C(S,E,O,N={}){const{lowS:b,prehash:M,format:R}=Oa(N,h);if(O=_e("publicKey",O),E=g(_e("message",E),M),"strict"in N)throw new Error("options.strict was renamed to lowS");const _=R===void 0?k(S):T.fromBytes(_e("sig",S),R);if(_===!1)return!1;try{const U=e.fromBytes(O);if(b&&_.hasHighS())return!1;const{r:W,s:K}=_,V=L(E),Z=i.inv(K),H=i.create(V*Z),Y=i.create(W*Z),Q=e.BASE.multiplyUnsafe(H).add(U.multiplyUnsafe(Y));return Q.is0()?!1:i.create(Q.x)===W}catch{return!1}}function $(S,E,O={}){const{prehash:N}=Oa(O,h);return E=g(E,N),T.fromBytes(S,"recovered").recoverPublicKey(E).toBytes()}return Object.freeze({keygen:l,getPublicKey:u,getSharedSecret:f,utils:p,lengths:d,Point:e,sign:P,verify:C,recoverPublicKey:$,Signature:T,hash:t})}function bv(e){const t={a:e.a,b:e.b,p:e.Fp.ORDER,n:e.n,h:e.h,Gx:e.Gx,Gy:e.Gy},n=e.Fp;let r=e.allowedPrivateKeyLengths?Array.from(new Set(e.allowedPrivateKeyLengths.map(i=>Math.ceil(i/2)))):void 0;const o=bo(t.n,{BITS:e.nBitLength,allowedLengths:r,modFromBytes:e.wrapPrivateKey}),s={Fp:n,Fn:o,allowInfinityPoint:e.allowInfinityPoint,endo:e.endo,isTorsionFree:e.isTorsionFree,clearCofactor:e.clearCofactor,fromBytes:e.fromBytes,toBytes:e.toBytes};return{CURVE:t,curveOpts:s}}function yv(e){const{CURVE:t,curveOpts:n}=bv(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 wv(e,t){const n=t.Point;return Object.assign({},t,{ProjectivePoint:n,CURVE:Object.assign({},e,yd(n.Fn.ORDER,n.Fn.BITS))})}function vv(e){const{CURVE:t,curveOpts:n,hash:r,ecdsaOpts:o}=yv(e),s=hv(t,n),i=gv(s,r,o);return wv(e,i)}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */function xv(e,t){const n=r=>vv({...e,hash:r});return{...n(t),create:n}}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const Ca={p:BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),n:BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),h:BigInt(1),a:BigInt(0),b:BigInt(7),Gx:BigInt("0x79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798"),Gy:BigInt("0x483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8")},Ev={beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),basises:[[BigInt("0x3086d221a7d46bcde86c90e49284eb15"),-BigInt("0xe4437ed6010e88286f547fa90abfe4c3")],[BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),BigInt("0x3086d221a7d46bcde86c90e49284eb15")]]},Cd=BigInt(2);function Sv(e){const t=Ca.p,n=BigInt(3),r=BigInt(6),o=BigInt(11),s=BigInt(22),i=BigInt(23),c=BigInt(44),a=BigInt(88),l=e*e*e%t,u=l*l*e%t,f=rt(u,n,t)*u%t,p=rt(f,n,t)*u%t,d=rt(p,Cd,t)*l%t,h=rt(d,o,t)*d%t,m=rt(h,s,t)*h%t,x=rt(m,c,t)*m%t,A=rt(x,a,t)*x%t,w=rt(A,c,t)*m%t,T=rt(w,n,t)*u%t,B=rt(T,i,t)*h%t,L=rt(B,r,t)*l%t,F=rt(L,Cd,t);if(!Ia.eql(Ia.sqr(F),e))throw new Error("Cannot find square root");return F}const Ia=bo(Ca.p,{sqrt:Sv}),Id=xv({...Ca,Fp:Ia,lowS:!0,endo:Ev},Wu),Pv=Object.freeze(Object.defineProperty({__proto__:null,secp256k1:Id},Symbol.toStringTag,{value:"Module"}));function $v({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 Id.Signature(Nt(e),Nt(t)).toCompactHex()}${s===0?"1b":"1c"}`;return n==="hex"?i:wt(i)}async function Ma(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,l=bt(i)?i:typeof i=="object"&&"r"in i&&"s"in i?$v(i):$e(i),u=await(async()=>!r&&!o||f1(l)?l:d1({address:r,data:o,signature:l}))();try{const h=c?{to:c,data:Ct({abi:Ef,functionName:"isValidSig",args:[n,s,u]}),...a}:{data:na({abi:Ef,args:[n,s,u],bytecode:Hy}),...a},{data:m}=await ee(e,po,"call")(h);return mg(m??"0x0")}catch(h){try{if(es(Nn(n),await Iu({hash:s,signature:i})))return!0}catch{}if(h instanceof Nu)return!1;throw h}}async function Tv(e,{address:t,message:n,factory:r,factoryData:o,signature:s,...i}){const c=Zf(n);return Ma(e,{address:t,factory:r,factoryData:o,hash:c,signature:s,...i})}async function Av(e,t){const{address:n,factory:r,factoryData:o,signature:s,message:i,primaryType:c,types:a,domain:l,...u}=t,f=n1({message:i,primaryType:c,types:a,domain:l});return Ma(e,{address:n,factory:r,factoryData:o,hash:f,signature:s,...u})}function Md(e,{emitOnBegin:t=!1,emitMissed:n=!1,onBlockNumber:r,onError:o,poll:s,pollingInterval:i=e.pollingInterval}){const c=typeof s<"u"?s:!(e.transport.type==="webSocket"||e.transport.type==="ipc"||e.transport.type==="fallback"&&(e.transport.transports[0].config.type==="webSocket"||e.transport.transports[0].config.type==="ipc"));let a;return c?(()=>{const f=Te(["watchBlockNumber",e.uid,t,n,i]);return gn(f,{onBlockNumber:r,onError:o},p=>ho(async()=>{var d;try{const h=await ee(e,mo,"getBlockNumber")({cacheTime:0});if(a){if(h===a)return;if(h-a>1&&n)for(let m=a+1n;m<h;m++)p.onBlockNumber(m,a),a=m}(!a||h>a)&&(p.onBlockNumber(h,a),a=h)}catch(h){(d=p.onError)==null||d.call(p,h)}},{emitOnBegin:t,interval:i}))})():(()=>{const f=Te(["watchBlockNumber",e.uid,t,n]);return gn(f,{onBlockNumber:r,onError:o},p=>{let d=!0,h=()=>d=!1;return(async()=>{try{const m=(()=>{if(e.transport.type==="fallback"){const A=e.transport.transports.find(w=>w.config.type==="webSocket"||w.config.type==="ipc");return A?A.value:e.transport}return e.transport})(),{unsubscribe:x}=await m.subscribe({params:["newHeads"],onData(A){var T;if(!d)return;const w=Nt((T=A.result)==null?void 0:T.number);p.onBlockNumber(w,a),a=w},onError(A){var w;(w=p.onError)==null||w.call(p,A)}});h=x,d||h()}catch(m){o==null||o(m)}})(),()=>h()})})()}async function Nv(e,t){const{checkReplacement:n=!0,confirmations:r=1,hash:o,onReplaced:s,retryCount:i=6,retryDelay:c=({count:L})=>~~(1<<L)*200,timeout:a=18e4}=t,l=Te(["waitForTransactionReceipt",e.uid,o]),u=(()=>{var L;return t.pollingInterval?t.pollingInterval:(L=e.chain)!=null&&L.experimental_preconfirmationTime?e.chain.experimental_preconfirmationTime:e.pollingInterval})();let f,p,d,h=!1,m,x;const{promise:A,resolve:w,reject:T}=Tf(),B=a?setTimeout(()=>{x(),m(),T(new Pb({hash:o}))},a):void 0;return m=gn(l,{onReplaced:s,resolve:w,reject:T},async L=>{if(d=await ee(e,ds,"getTransactionReceipt")({hash:o}).catch(()=>{}),d&&r<=1){clearTimeout(B),L.resolve(d),m();return}x=ee(e,Md,"watchBlockNumber")({emitMissed:!0,emitOnBegin:!0,poll:!0,pollingInterval:u,async onBlockNumber(F){const j=y=>{clearTimeout(B),x(),y(),m()};let g=F;if(!h)try{if(d){if(r>1&&(!d.blockNumber||g-d.blockNumber+1n<r))return;j(()=>L.resolve(d));return}if(n&&!f&&(h=!0,await ia(async()=>{f=await ee(e,pa,"getTransaction")({hash:o}),f.blockNumber&&(g=f.blockNumber)},{delay:c,retryCount:i}),h=!1),d=await ee(e,ds,"getTransactionReceipt")({hash:o}),r>1&&(!d.blockNumber||g-d.blockNumber+1n<r))return;j(()=>L.resolve(d))}catch(y){if(y instanceof Tu||y instanceof Au){if(!f){h=!1;return}try{p=f,h=!0;const P=await ia(()=>ee(e,It,"getBlock")({blockNumber:g,includeTransactions:!0}),{delay:c,retryCount:i,shouldRetry:({error:$})=>$ instanceof Du});h=!1;const k=P.transactions.find(({from:$,nonce:S})=>$===p.from&&S===p.nonce);if(!k||(d=await ee(e,ds,"getTransactionReceipt")({hash:k.hash}),r>1&&(!d.blockNumber||g-d.blockNumber+1n<r)))return;let C="replaced";k.to===p.to&&k.value===p.value&&k.input===p.input?C="repriced":k.from===k.to&&k.value===0n&&(C="cancelled"),j(()=>{var $;($=L.onReplaced)==null||$.call(L,{reason:C,replacedTransaction:p,transaction:k,transactionReceipt:d}),L.resolve(d)})}catch(P){j(()=>L.reject(P))}}else j(()=>L.reject(y))}}})}),A}function Ov(e,{blockTag:t=e.experimental_blockTag??"latest",emitMissed:n=!1,emitOnBegin:r=!1,onBlock:o,onError:s,includeTransactions:i,poll:c,pollingInterval:a=e.pollingInterval}){const l=typeof c<"u"?c:!(e.transport.type==="webSocket"||e.transport.type==="ipc"||e.transport.type==="fallback"&&(e.transport.transports[0].config.type==="webSocket"||e.transport.transports[0].config.type==="ipc")),u=i??!1;let f;return l?(()=>{const h=Te(["watchBlocks",e.uid,t,n,r,u,a]);return gn(h,{onBlock:o,onError:s},m=>ho(async()=>{var x;try{const A=await ee(e,It,"getBlock")({blockTag:t,includeTransactions:u});if(A.number!==null&&(f==null?void 0:f.number)!=null){if(A.number===f.number)return;if(A.number-f.number>1&&n)for(let w=(f==null?void 0:f.number)+1n;w<A.number;w++){const T=await ee(e,It,"getBlock")({blockNumber:w,includeTransactions:u});m.onBlock(T,f),f=T}}((f==null?void 0:f.number)==null||t==="pending"&&(A==null?void 0:A.number)==null||A.number!==null&&A.number>f.number)&&(m.onBlock(A,f),f=A)}catch(A){(x=m.onError)==null||x.call(m,A)}},{emitOnBegin:r,interval:a}))})():(()=>{let h=!0,m=!0,x=()=>h=!1;return(async()=>{try{r&&ee(e,It,"getBlock")({blockTag:t,includeTransactions:u}).then(T=>{h&&m&&(o(T,void 0),m=!1)}).catch(s);const A=(()=>{if(e.transport.type==="fallback"){const T=e.transport.transports.find(B=>B.config.type==="webSocket"||B.config.type==="ipc");return T?T.value:e.transport}return e.transport})(),{unsubscribe:w}=await A.subscribe({params:["newHeads"],async onData(T){var L;if(!h)return;const B=await ee(e,It,"getBlock")({blockNumber:(L=T.result)==null?void 0:L.number,includeTransactions:u}).catch(()=>{});h&&(o(B,f),m=!1,f=B)},onError(T){s==null||s(T)}});x=w,h||x()}catch(A){s==null||s(A)}})(),()=>x()})()}function Cv(e,{address:t,args:n,batch:r=!0,event:o,events:s,fromBlock:i,onError:c,onLogs:a,poll:l,pollingInterval:u=e.pollingInterval,strict:f}){const p=typeof l<"u"?l:typeof i=="bigint"?!0:!(e.transport.type==="webSocket"||e.transport.type==="ipc"||e.transport.type==="fallback"&&(e.transport.transports[0].config.type==="webSocket"||e.transport.transports[0].config.type==="ipc")),d=f??!1;return p?(()=>{const x=Te(["watchEvent",t,n,r,e.uid,o,u,i]);return gn(x,{onLogs:a,onError:c},A=>{let w;i!==void 0&&(w=i-1n);let T,B=!1;const L=ho(async()=>{var F;if(!B){try{T=await ee(e,jf,"createEventFilter")({address:t,args:n,event:o,events:s,strict:d,fromBlock:i})}catch{}B=!0;return}try{let j;if(T)j=await ee(e,os,"getFilterChanges")({filter:T});else{const g=await ee(e,mo,"getBlockNumber")({});w&&w!==g?j=await ee(e,zi,"getLogs")({address:t,args:n,event:o,events:s,fromBlock:w+1n,toBlock:g}):j=[],w=g}if(j.length===0)return;if(r)A.onLogs(j);else for(const g of j)A.onLogs([g])}catch(j){T&&j instanceof Mn&&(B=!1),(F=A.onError)==null||F.call(A,j)}},{emitOnBegin:!0,interval:u});return async()=>{T&&await ee(e,ss,"uninstallFilter")({filter:T}),L()}})})():(()=>{let x=!0,A=()=>x=!1;return(async()=>{try{const w=(()=>{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})(),T=s??(o?[o]:void 0);let B=[];T&&(B=[T.flatMap(j=>_r({abi:[j],eventName:j.name,args:n}))],o&&(B=B[0]));const{unsubscribe:L}=await w.subscribe({params:["logs",{address:t,topics:B}],onData(F){var g;if(!x)return;const j=F.result;try{const{eventName:y,args:P}=_i({abi:T??[],data:j.data,topics:j.topics,strict:d}),k=Xt(j,{args:P,eventName:y});a([k])}catch(y){let P,k;if(y instanceof Lr||y instanceof _o){if(f)return;P=y.abiItem.name,k=(g=y.abiItem.inputs)==null?void 0:g.some($=>!("name"in $&&$.name))}const C=Xt(j,{args:k?[]:{},eventName:P});a([C])}},onError(F){c==null||c(F)}});A=L,x||A()}catch(w){c==null||c(w)}})(),()=>A()})()}function Iv(e,{batch:t=!0,onError:n,onTransactions:r,poll:o,pollingInterval:s=e.pollingInterval}){return(typeof o<"u"?o:e.transport.type!=="webSocket"&&e.transport.type!=="ipc")?(()=>{const l=Te(["watchPendingTransactions",e.uid,t,s]);return gn(l,{onTransactions:r,onError:n},u=>{let f;const p=ho(async()=>{var d;try{if(!f)try{f=await ee(e,_f,"createPendingTransactionFilter")({});return}catch(m){throw p(),m}const h=await ee(e,os,"getFilterChanges")({filter:f});if(h.length===0)return;if(t)u.onTransactions(h);else for(const m of h)u.onTransactions([m])}catch(h){(d=u.onError)==null||d.call(u,h)}},{emitOnBegin:!0,interval:s});return async()=>{f&&await ee(e,ss,"uninstallFilter")({filter:f}),p()}})})():(()=>{let l=!0,u=()=>l=!1;return(async()=>{try{const{unsubscribe:f}=await e.transport.subscribe({params:["newPendingTransactions"],onData(p){if(!l)return;const d=p.result;r([d])},onError(p){n==null||n(p)}});u=f,l||u()}catch(f){n==null||n(f)}})(),()=>u()})()}function Mv(e){var f,p,d;const{scheme:t,statement:n,...r}=((f=e.match(kv))==null?void 0:f.groups)??{},{chainId:o,expirationTime:s,issuedAt:i,notBefore:c,requestId:a,...l}=((p=e.match(Bv))==null?void 0:p.groups)??{},u=(d=e.split("Resources:")[1])==null?void 0:d.split(`
82
- - `).slice(1);return{...r,...l,...o?{chainId:Number(o)}:{},...s?{expirationTime:new Date(s)}:{},...i?{issuedAt:new Date(i)}:{},...c?{notBefore:new Date(c)}:{},...a?{requestId:a}:{},...u?{resources:u}:{},...t?{scheme:t}:{},...n?{statement:n}:{}}}const kv=/^(?:(?<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)?/,Bv=/(?: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 Lv(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||!tt(r.address,{strict:!1})||t&&!es(r.address,t))return!1}catch{return!1}return!0}async function Dv(e,t){const{address:n,domain:r,message:o,nonce:s,scheme:i,signature:c,time:a=new Date,...l}=t,u=Mv(o);if(!u.address||!Lv({address:n,domain:r,message:u,nonce:s,scheme:i,time:a}))return!1;const p=Zf(o);return Ma(e,{address:u.address,hash:p,signature:c,...l})}function Fv(e){return{call:t=>po(e,t),createAccessList:t=>Rf(e,t),createBlockFilter:()=>Fw(e),createContractEventFilter:t=>mu(e,t),createEventFilter:t=>jf(e,t),createPendingTransactionFilter:()=>_f(e),estimateContractGas:t=>fy(e,t),estimateGas:t=>ji(e,t),getBalance:t=>Qu(e,t),getBlobBaseFee:()=>Rw(e),getBlock:t=>It(e,t),getBlockNumber:t=>mo(e,t),getBlockTransactionCount:t=>jw(e,t),getBytecode:t=>Uf(e,t),getChainId:()=>Ku(e),getCode:t=>Uf(e,t),getContractEvents:t=>ef(e,t),getEip712Domain:t=>Uw(e,t),getEnsAddress:t=>xw(e,t),getEnsAvatar:t=>Bw(e,t),getEnsName:t=>Lw(e,t),getEnsResolver:t=>Dw(e,t),getEnsText:t=>Ff(e,t),getFeeHistory:t=>Ww(e,t),estimateFeesPerGas:t=>Zb(e,t),getFilterChanges:t=>os(e,t),getFilterLogs:t=>Vw(e,t),getGasPrice:()=>Di(e),getLogs:t=>zi(e,t),getProof:t=>b1(e,t),estimateMaxPriorityFeePerGas:t=>qb(e,t),getStorageAt:t=>y1(e,t),getTransaction:t=>pa(e,t),getTransactionConfirmations:t=>w1(e,t),getTransactionCount:t=>Uu(e,t),getTransactionReceipt:t=>ds(e,t),multicall:t=>v1(e,t),prepareTransactionRequest:t=>Xu(e,t),readContract:t=>Jt(e,t),sendRawTransaction:t=>rw(e,t),simulate:t=>ha(e,t),simulateBlocks:t=>ha(e,t),simulateCalls:t=>K1(e,t),simulateContract:t=>Ky(e,t),verifyMessage:t=>Tv(e,t),verifySiweMessage:t=>Dv(e,t),verifyTypedData:t=>Av(e,t),uninstallFilter:t=>ss(e,t),waitForTransactionReceipt:t=>Nv(e,t),watchBlocks:t=>Ov(e,t),watchBlockNumber:t=>Md(e,t),watchContractEvent:t=>nw(e,t),watchEvent:t=>Cv(e,t),watchPendingTransactions:t=>Iv(e,t)}}function Rv(e){const{key:t="public",name:n="Public Client"}=e;return iw({...e,key:t,name:n,type:"publicClient"}).extend(Fv)}const jv=Qw({id:42161,name:"Arbitrum One",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},blockTime:250,rpcUrls:{default:{http:["https://arb1.arbitrum.io/rpc"]}},blockExplorers:{default:{name:"Arbiscan",url:"https://arbiscan.io",apiUrl:"https://api.arbiscan.io/api"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:7654707}}});function _v({client:e,tokenAddress:t,holder:n,decimals:r,fallbackFormatted:o="0",pollingInterval:s=12e3}){const[i,c]=v.useState(null),[a,l]=v.useState(o);return v.useEffect(()=>{let u,f;const p=async()=>{try{const d=await e.readContract({address:t,abi:ur,functionName:"balanceOf",args:[n]});c(d),l(xi(d,r))}catch{l(o)}};p();try{u=e.watchContractEvent({address:t,abi:ur,eventName:"Transfer",args:{to:n},onLogs:()=>{p()},poll:!0,pollingInterval:s}),f=e.watchContractEvent({address:t,abi:ur,eventName:"Transfer",args:{from:n},onLogs:()=>{p()},poll:!0,pollingInterval:s})}catch{}return()=>{u==null||u(),f==null||f()}},[e,t,n,r,o,s]),{value:i,formatted:a}}const Uv=()=>({openDeposit:v.useCallback(t=>{},[])}),zv=()=>({openWithdraw:v.useCallback(t=>{},[])}),bn="MPC",ka="EVM",Hv="spot",Wv="perpetual";/**
75
+ `)})}}Object.defineProperty(Mn,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32e3});class Zr extends je{constructor(t){super(t,{code:Zr.code,name:"ResourceNotFoundRpcError",shortMessage:"Requested resource not found."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ResourceNotFoundRpcError"})}}Object.defineProperty(Zr,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32001});class Kr extends je{constructor(t){super(t,{code:Kr.code,name:"ResourceUnavailableRpcError",shortMessage:"Requested resource not available."})}}Object.defineProperty(Kr,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32002});class Yr extends je{constructor(t){super(t,{code:Yr.code,name:"TransactionRejectedRpcError",shortMessage:"Transaction creation failed."})}}Object.defineProperty(Yr,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32003});class kn extends je{constructor(t,{method:n}={}){super(t,{code:kn.code,name:"MethodNotSupportedRpcError",shortMessage:`Method${n?` "${n}"`:""} is not supported.`})}}Object.defineProperty(kn,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32004});class ir extends je{constructor(t){super(t,{code:ir.code,name:"LimitExceededRpcError",shortMessage:"Request exceeds defined limit."})}}Object.defineProperty(ir,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32005});class Xr extends je{constructor(t){super(t,{code:Xr.code,name:"JsonRpcVersionUnsupportedError",shortMessage:"Version of JSON-RPC protocol is not supported."})}}Object.defineProperty(Xr,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32006});class ar extends Ke{constructor(t){super(t,{code:ar.code,name:"UserRejectedRequestError",shortMessage:"User rejected the request."})}}Object.defineProperty(ar,"code",{enumerable:!0,configurable:!0,writable:!0,value:4001});class Qr extends Ke{constructor(t){super(t,{code:Qr.code,name:"UnauthorizedProviderError",shortMessage:"The requested method and/or account has not been authorized by the user."})}}Object.defineProperty(Qr,"code",{enumerable:!0,configurable:!0,writable:!0,value:4100});class Jr extends Ke{constructor(t,{method:n}={}){super(t,{code:Jr.code,name:"UnsupportedProviderMethodError",shortMessage:`The Provider does not support the requested method${n?` " ${n}"`:""}.`})}}Object.defineProperty(Jr,"code",{enumerable:!0,configurable:!0,writable:!0,value:4200});class eo extends Ke{constructor(t){super(t,{code:eo.code,name:"ProviderDisconnectedError",shortMessage:"The Provider is disconnected from all chains."})}}Object.defineProperty(eo,"code",{enumerable:!0,configurable:!0,writable:!0,value:4900});class to extends Ke{constructor(t){super(t,{code:to.code,name:"ChainDisconnectedError",shortMessage:"The Provider is not connected to the requested chain."})}}Object.defineProperty(to,"code",{enumerable:!0,configurable:!0,writable:!0,value:4901});class no extends Ke{constructor(t){super(t,{code:no.code,name:"SwitchChainError",shortMessage:"An error occurred when attempting to switch chain."})}}Object.defineProperty(no,"code",{enumerable:!0,configurable:!0,writable:!0,value:4902});class ro extends Ke{constructor(t){super(t,{code:ro.code,name:"UnsupportedNonOptionalCapabilityError",shortMessage:"This Wallet does not support a capability that was not marked as optional."})}}Object.defineProperty(ro,"code",{enumerable:!0,configurable:!0,writable:!0,value:5700});class oo extends Ke{constructor(t){super(t,{code:oo.code,name:"UnsupportedChainIdError",shortMessage:"This Wallet does not support the requested chain ID."})}}Object.defineProperty(oo,"code",{enumerable:!0,configurable:!0,writable:!0,value:5710});class so extends Ke{constructor(t){super(t,{code:so.code,name:"DuplicateIdError",shortMessage:"There is already a bundle submitted with this ID."})}}Object.defineProperty(so,"code",{enumerable:!0,configurable:!0,writable:!0,value:5720});class io extends Ke{constructor(t){super(t,{code:io.code,name:"UnknownBundleIdError",shortMessage:"This bundle id is unknown / has not been submitted"})}}Object.defineProperty(io,"code",{enumerable:!0,configurable:!0,writable:!0,value:5730});class ao extends Ke{constructor(t){super(t,{code:ao.code,name:"BundleTooLargeError",shortMessage:"The call bundle is too large for the Wallet to process."})}}Object.defineProperty(ao,"code",{enumerable:!0,configurable:!0,writable:!0,value:5740});class co extends Ke{constructor(t){super(t,{code:co.code,name:"AtomicReadyWalletRejectedUpgradeError",shortMessage:"The Wallet can support atomicity after an upgrade, but the user rejected the upgrade."})}}Object.defineProperty(co,"code",{enumerable:!0,configurable:!0,writable:!0,value:5750});class lo extends Ke{constructor(t){super(t,{code:lo.code,name:"AtomicityNotSupportedError",shortMessage:"The wallet does not support atomic execution but the request requires it."})}}Object.defineProperty(lo,"code",{enumerable:!0,configurable:!0,writable:!0,value:5760});class Cb extends je{constructor(t){super(t,{name:"UnknownRpcError",shortMessage:"An unknown RPC error occurred."})}}const Ib=3;function cr(e,{abi:t,address:n,args:r,docsPath:o,functionName:s,sender:i}){const c=e instanceof Ko?e:e instanceof G?e.walk(h=>"data"in h)||e.walk():{},{code:a,data:l,details:u,message:f,shortMessage:p}=c,d=e instanceof Br?new Ab({functionName:s}):[Ib,In.code].includes(a)&&(l||u||f||p)?new Si({abi:t,data:typeof l=="object"?l.data:l,functionName:s,message:c instanceof Pi?u:p??f}):e;return new Tb(d,{abi:t,args:r,contractAddress:n,docsPath:o,functionName:s,sender:i})}function Mb(e){const t=Ie(`0x${e.substring(4)}`).substring(26);return Go(`0x${t}`)}async function kb({hash:e,signature:t}){const n=bt(e)?e:Vt(e),{secp256k1:r}=await Promise.resolve().then(()=>Pv);return`0x${(()=>{if(typeof t=="object"&&"r"in t&&"s"in t){const{r:l,s:u,v:f,yParity:p}=t,d=Number(p??f),h=Cu(d);return new r.Signature(Nt(l),Nt(u)).addRecoveryBit(h)}const i=bt(t)?t:Vt(t);if(xe(i)!==65)throw new Error("invalid signature length");const c=Wt(`0x${i.slice(130)}`),a=Cu(c);return r.Signature.fromCompact(i.substring(2,130)).addRecoveryBit(a)})().recoverPublicKey(n.substring(2)).toHex(!1)}`}function Cu(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 Iu({hash:e,signature:t}){return Mb(await kb({hash:e,signature:t}))}function Bb(e,t="hex"){const n=Mu(e),r=vi(new Uint8Array(n.length));return n.encode(r),t==="hex"?$e(r.bytes):r.bytes}function Mu(e){return Array.isArray(e)?Lb(e.map(t=>Mu(t))):Db(e)}function Lb(e){const t=e.reduce((o,s)=>o+s.length,0),n=ku(t);return{length:t<=55?1+t:1+n+t,encode(o){t<=55?o.pushByte(192+t):(o.pushByte(247+n),n===1?o.pushUint8(t):n===2?o.pushUint16(t):n===3?o.pushUint24(t):o.pushUint32(t));for(const{encode:s}of e)s(o)}}}function Db(e){const t=typeof e=="string"?wt(e):e,n=ku(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 ku(e){if(e<2**8)return 1;if(e<2**16)return 2;if(e<2**24)return 3;if(e<2**32)return 4;throw new G("Length is too large.")}function Fb(e){const{chainId:t,nonce:n,to:r}=e,o=e.contractAddress??e.address,s=Ie(rr(["0x05",Bb([t?J(t):"0x",o,n?J(n):"0x"])]));return r==="bytes"?wt(s):s}async function Rb(e){const{authorization:t,signature:n}=e;return Iu({hash:Fb(t),signature:n??t})}class jb extends G{constructor(t,{account:n,docsPath:r,chain:o,data:s,gas:i,gasPrice:c,maxFeePerGas:a,maxPriorityFeePerGas:l,nonce:u,to:f,value:p}){var h;const d=Zo({from:n==null?void 0:n.address,to:f,value:typeof p<"u"&&`${Pu(p)} ${((h=o==null?void 0:o.nativeCurrency)==null?void 0:h.symbol)||"ETH"}`,data:s,gas:i,gasPrice:typeof c<"u"&&`${Et(c)} gwei`,maxFeePerGas:typeof a<"u"&&`${Et(a)} gwei`,maxPriorityFeePerGas:typeof l<"u"&&`${Et(l)} gwei`,nonce:u});super(t.shortMessage,{cause:t,docsPath:r,metaMessages:[...t.metaMessages?[...t.metaMessages," "]:[],"Estimate Gas Arguments:",d].filter(Boolean),name:"EstimateGasExecutionError"}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.cause=t}}class lr extends G{constructor({cause:t,message:n}={}){var o;const r=(o=n==null?void 0:n.replace("execution reverted: ",""))==null?void 0:o.replace("execution reverted","");super(`Execution reverted ${r?`with reason: ${r}`:"for an unknown reason"}.`,{cause:t,name:"ExecutionRevertedError"})}}Object.defineProperty(lr,"code",{enumerable:!0,configurable:!0,writable:!0,value:3}),Object.defineProperty(lr,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/execution reverted/});class Yo extends G{constructor({cause:t,maxFeePerGas:n}={}){super(`The fee cap (\`maxFeePerGas\`${n?` = ${Et(n)} gwei`:""}) cannot be higher than the maximum allowed value (2^256-1).`,{cause:t,name:"FeeCapTooHighError"})}}Object.defineProperty(Yo,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/max fee per gas higher than 2\^256-1|fee cap higher than 2\^256-1/});class $i extends G{constructor({cause:t,maxFeePerGas:n}={}){super(`The fee cap (\`maxFeePerGas\`${n?` = ${Et(n)}`:""} gwei) cannot be lower than the block base fee.`,{cause:t,name:"FeeCapTooLowError"})}}Object.defineProperty($i,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/max fee per gas less than block base fee|fee cap less than block base fee|transaction is outdated/});class Ti extends G{constructor({cause:t,nonce:n}={}){super(`Nonce provided for the transaction ${n?`(${n}) `:""}is higher than the next one expected.`,{cause:t,name:"NonceTooHighError"})}}Object.defineProperty(Ti,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/nonce too high/});class Ai extends G{constructor({cause:t,nonce:n}={}){super([`Nonce provided for the transaction ${n?`(${n}) `:""}is lower than the current nonce of the account.`,"Try increasing the nonce or find the latest nonce with `getTransactionCount`."].join(`
76
+ `),{cause:t,name:"NonceTooLowError"})}}Object.defineProperty(Ai,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/nonce too low|transaction already imported|already known/});class Ni extends G{constructor({cause:t,nonce:n}={}){super(`Nonce provided for the transaction ${n?`(${n}) `:""}exceeds the maximum allowed nonce.`,{cause:t,name:"NonceMaxValueError"})}}Object.defineProperty(Ni,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/nonce has max value/});class Oi extends G{constructor({cause:t}={}){super(["The total cost (gas * gas fee + value) of executing this transaction exceeds the balance of the account."].join(`
77
+ `),{cause:t,metaMessages:["This error could arise when the account does not have enough funds to:"," - pay for the total gas fee,"," - pay for the value to send."," ","The cost of the transaction is calculated as `gas * gas fee + value`, where:"," - `gas` is the amount of gas needed for transaction to execute,"," - `gas fee` is the gas fee,"," - `value` is the amount of ether to send to the recipient."],name:"InsufficientFundsError"})}}Object.defineProperty(Oi,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/insufficient funds|exceeds transaction sender account balance/});class Ci extends G{constructor({cause:t,gas:n}={}){super(`The amount of gas ${n?`(${n}) `:""}provided for the transaction exceeds the limit allowed for the block.`,{cause:t,name:"IntrinsicGasTooHighError"})}}Object.defineProperty(Ci,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/intrinsic gas too high|gas limit reached/});class Ii extends G{constructor({cause:t,gas:n}={}){super(`The amount of gas ${n?`(${n}) `:""}provided for the transaction is too low.`,{cause:t,name:"IntrinsicGasTooLowError"})}}Object.defineProperty(Ii,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/intrinsic gas too low/});class Mi extends G{constructor({cause:t}){super("The transaction type is not supported for this chain.",{cause:t,name:"TransactionTypeNotSupportedError"})}}Object.defineProperty(Mi,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/transaction type not valid/});class Xo extends G{constructor({cause:t,maxPriorityFeePerGas:n,maxFeePerGas:r}={}){super([`The provided tip (\`maxPriorityFeePerGas\`${n?` = ${Et(n)} gwei`:""}) cannot be higher than the fee cap (\`maxFeePerGas\`${r?` = ${Et(r)} gwei`:""}).`].join(`
78
+ `),{cause:t,name:"TipAboveFeeCapError"})}}Object.defineProperty(Xo,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/max priority fee per gas higher than max fee per gas|tip higher than fee cap/});class Qo extends G{constructor({cause:t}){super(`An error occurred while executing: ${t==null?void 0:t.shortMessage}`,{cause:t,name:"UnknownNodeError"})}}function ki(e,t){const n=(e.details||"").toLowerCase(),r=e instanceof G?e.walk(o=>(o==null?void 0:o.code)===lr.code):e;return r instanceof G?new lr({cause:e,message:r.details}):lr.nodeMessage.test(n)?new lr({cause:e,message:e.details}):Yo.nodeMessage.test(n)?new Yo({cause:e,maxFeePerGas:t==null?void 0:t.maxFeePerGas}):$i.nodeMessage.test(n)?new $i({cause:e,maxFeePerGas:t==null?void 0:t.maxFeePerGas}):Ti.nodeMessage.test(n)?new Ti({cause:e,nonce:t==null?void 0:t.nonce}):Ai.nodeMessage.test(n)?new Ai({cause:e,nonce:t==null?void 0:t.nonce}):Ni.nodeMessage.test(n)?new Ni({cause:e,nonce:t==null?void 0:t.nonce}):Oi.nodeMessage.test(n)?new Oi({cause:e}):Ci.nodeMessage.test(n)?new Ci({cause:e,gas:t==null?void 0:t.gas}):Ii.nodeMessage.test(n)?new Ii({cause:e,gas:t==null?void 0:t.gas}):Mi.nodeMessage.test(n)?new Mi({cause:e}):Xo.nodeMessage.test(n)?new Xo({cause:e,maxFeePerGas:t==null?void 0:t.maxFeePerGas,maxPriorityFeePerGas:t==null?void 0:t.maxPriorityFeePerGas}):new Qo({cause:e})}function _b(e,{docsPath:t,...n}){const r=(()=>{const o=ki(e,n);return o instanceof Qo?e:o})();return new jb(r,{docsPath:t,...n})}function Bi(e,{format:t}){if(!t)return{};const n={};function r(s){const i=Object.keys(s);for(const c of i)c in e&&(n[c]=e[c]),s[c]&&typeof s[c]=="object"&&!Array.isArray(s[c])&&r(s[c])}const o=t(e||{});return r(o),n}const Ub={legacy:"0x0",eip2930:"0x1",eip1559:"0x2",eip4844:"0x3",eip7702:"0x4"};function Jo(e){const t={};return typeof e.authorizationList<"u"&&(t.authorizationList=zb(e.authorizationList)),typeof e.accessList<"u"&&(t.accessList=e.accessList),typeof e.blobVersionedHashes<"u"&&(t.blobVersionedHashes=e.blobVersionedHashes),typeof e.blobs<"u"&&(typeof e.blobs[0]!="string"?t.blobs=e.blobs.map(n=>$e(n)):t.blobs=e.blobs),typeof e.data<"u"&&(t.data=e.data),typeof e.from<"u"&&(t.from=e.from),typeof e.gas<"u"&&(t.gas=J(e.gas)),typeof e.gasPrice<"u"&&(t.gasPrice=J(e.gasPrice)),typeof e.maxFeePerBlobGas<"u"&&(t.maxFeePerBlobGas=J(e.maxFeePerBlobGas)),typeof e.maxFeePerGas<"u"&&(t.maxFeePerGas=J(e.maxFeePerGas)),typeof e.maxPriorityFeePerGas<"u"&&(t.maxPriorityFeePerGas=J(e.maxPriorityFeePerGas)),typeof e.nonce<"u"&&(t.nonce=J(e.nonce)),typeof e.to<"u"&&(t.to=e.to),typeof e.type<"u"&&(t.type=Ub[e.type]),typeof e.value<"u"&&(t.value=J(e.value)),t}function zb(e){return e.map(t=>({address:t.address,r:t.r?J(BigInt(t.r)):t.r,s:t.s?J(BigInt(t.s)):t.s,chainId:J(t.chainId),nonce:J(t.nonce),...typeof t.yParity<"u"?{yParity:J(t.yParity)}:{},...typeof t.v<"u"&&typeof t.yParity>"u"?{v:J(t.v)}:{}}))}function Bu(e){if(!(!e||e.length===0))return e.reduce((t,{slot:n,value:r})=>{if(n.length!==66)throw new Ul({size:n.length,targetSize:66,type:"hex"});if(r.length!==66)throw new Ul({size:r.length,targetSize:66,type:"hex"});return t[n]=r,t},{})}function Hb(e){const{balance:t,nonce:n,state:r,stateDiff:o,code:s}=e,i={};if(s!==void 0&&(i.code=s),t!==void 0&&(i.balance=J(t)),n!==void 0&&(i.nonce=J(n)),r!==void 0&&(i.state=Bu(r)),o!==void 0){if(i.state)throw new vb;i.stateDiff=Bu(o)}return i}function Li(e){if(!e)return;const t={};for(const{address:n,...r}of e){if(!tt(n,{strict:!1}))throw new pn({address:n});if(t[n])throw new wb({address:n});t[n]=Hb(r)}return t}const Lu=2n**256n-1n;function uo(e){const{account:t,gasPrice:n,maxFeePerGas:r,maxPriorityFeePerGas:o,to:s}=e,i=t?xt(t):void 0;if(i&&!tt(i.address))throw new pn({address:i.address});if(s&&!tt(s))throw new pn({address:s});if(typeof n<"u"&&(typeof r<"u"||typeof o<"u"))throw new Eb;if(r&&r>Lu)throw new Yo({maxFeePerGas:r});if(o&&r&&o>r)throw new Xo({maxFeePerGas:r,maxPriorityFeePerGas:o})}class Wb extends G{constructor(){super("`baseFeeMultiplier` must be greater than 1.",{name:"BaseFeeScalarError"})}}class Di extends G{constructor(){super("Chain does not support EIP-1559 fees.",{name:"Eip1559FeesNotSupportedError"})}}class Vb extends G{constructor({maxPriorityFeePerGas:t}){super(`\`maxFeePerGas\` cannot be less than the \`maxPriorityFeePerGas\` (${Et(t)} gwei).`,{name:"MaxFeePerGasTooLowError"})}}class Du extends G{constructor({blockHash:t,blockNumber:n}){let r="Block";t&&(r=`Block at hash "${t}"`),n&&(r=`Block at number "${n}"`),super(`${r} could not be found.`,{name:"BlockNotFoundError"})}}const Fu={"0x0":"legacy","0x1":"eip2930","0x2":"eip1559","0x3":"eip4844","0x4":"eip7702"};function Ru(e){const t={...e,blockHash:e.blockHash?e.blockHash:null,blockNumber:e.blockNumber?BigInt(e.blockNumber):null,chainId:e.chainId?Wt(e.chainId):void 0,gas:e.gas?BigInt(e.gas):void 0,gasPrice:e.gasPrice?BigInt(e.gasPrice):void 0,maxFeePerBlobGas:e.maxFeePerBlobGas?BigInt(e.maxFeePerBlobGas):void 0,maxFeePerGas:e.maxFeePerGas?BigInt(e.maxFeePerGas):void 0,maxPriorityFeePerGas:e.maxPriorityFeePerGas?BigInt(e.maxPriorityFeePerGas):void 0,nonce:e.nonce?Wt(e.nonce):void 0,to:e.to?e.to:null,transactionIndex:e.transactionIndex?Number(e.transactionIndex):null,type:e.type?Fu[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=Gb(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 Gb(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 ju(e){const t=(e.transactions??[]).map(n=>typeof n=="string"?n:Ru(n));return{...e,baseFeePerGas:e.baseFeePerGas?BigInt(e.baseFeePerGas):null,blobGasUsed:e.blobGasUsed?BigInt(e.blobGasUsed):void 0,difficulty:e.difficulty?BigInt(e.difficulty):void 0,excessBlobGas:e.excessBlobGas?BigInt(e.excessBlobGas):void 0,gasLimit:e.gasLimit?BigInt(e.gasLimit):void 0,gasUsed:e.gasUsed?BigInt(e.gasUsed):void 0,hash:e.hash?e.hash:null,logsBloom:e.logsBloom?e.logsBloom:null,nonce:e.nonce?e.nonce:null,number:e.number?BigInt(e.number):null,size:e.size?BigInt(e.size):void 0,timestamp:e.timestamp?BigInt(e.timestamp):void 0,transactions:t,totalDifficulty:e.totalDifficulty?BigInt(e.totalDifficulty):null}}async function It(e,{blockHash:t,blockNumber:n,blockTag:r=e.experimental_blockTag??"latest",includeTransactions:o}={}){var l,u,f;const s=o??!1,i=n!==void 0?J(n):void 0;let c=null;if(t?c=await e.request({method:"eth_getBlockByHash",params:[t,s]},{dedupe:!0}):c=await e.request({method:"eth_getBlockByNumber",params:[i||r,s]},{dedupe:!!i}),!c)throw new Du({blockHash:t,blockNumber:n});return(((f=(u=(l=e.chain)==null?void 0:l.formatters)==null?void 0:u.block)==null?void 0:f.format)||ju)(c)}async function Fi(e){const t=await e.request({method:"eth_gasPrice"});return BigInt(t)}async function qb(e,t){return _u(e,t)}async function _u(e,t){var s,i;const{block:n,chain:r=e.chain,request:o}=t||{};try{const c=((s=r==null?void 0:r.fees)==null?void 0:s.maxPriorityFeePerGas)??((i=r==null?void 0:r.fees)==null?void 0:i.defaultPriorityFee);if(typeof c=="function"){const l=n||await ee(e,It,"getBlock")({}),u=await c({block:l,client:e,request:o});if(u===null)throw new Error;return u}if(typeof c<"u")return c;const a=await e.request({method:"eth_maxPriorityFeePerGas"});return Nt(a)}catch{const[c,a]=await Promise.all([n?Promise.resolve(n):ee(e,It,"getBlock")({}),ee(e,Fi,"getGasPrice")({})]);if(typeof c.baseFeePerGas!="bigint")throw new Di;const l=a-c.baseFeePerGas;return l<0n?0n:l}}async function Zb(e,t){return Ri(e,t)}async function Ri(e,t){var p,d;const{block:n,chain:r=e.chain,request:o,type:s="eip1559"}=t||{},i=await(async()=>{var h,m;return typeof((h=r==null?void 0:r.fees)==null?void 0:h.baseFeeMultiplier)=="function"?r.fees.baseFeeMultiplier({block:n,client:e,request:o}):((m=r==null?void 0:r.fees)==null?void 0:m.baseFeeMultiplier)??1.2})();if(i<1)throw new Wb;const a=10**(((p=i.toString().split(".")[1])==null?void 0:p.length)??0),l=h=>h*BigInt(Math.ceil(i*a))/BigInt(a),u=n||await ee(e,It,"getBlock")({});if(typeof((d=r==null?void 0:r.fees)==null?void 0:d.estimateFeesPerGas)=="function"){const h=await r.fees.estimateFeesPerGas({block:n,client:e,multiply:l,request:o,type:s});if(h!==null)return h}if(s==="eip1559"){if(typeof u.baseFeePerGas!="bigint")throw new Di;const h=typeof(o==null?void 0:o.maxPriorityFeePerGas)=="bigint"?o.maxPriorityFeePerGas:await _u(e,{block:u,chain:r,request:o}),m=l(u.baseFeePerGas);return{maxFeePerGas:(o==null?void 0:o.maxFeePerGas)??m+h,maxPriorityFeePerGas:h}}return{gasPrice:(o==null?void 0:o.gasPrice)??l(await ee(e,Fi,"getGasPrice")({}))}}async function Uu(e,{address:t,blockTag:n="latest",blockNumber:r}){const o=await e.request({method:"eth_getTransactionCount",params:[t,typeof r=="bigint"?J(r):n]},{dedupe:!!r});return Wt(o)}function zu(e){const{kzg:t}=e,n=e.to??(typeof e.blobs[0]=="string"?"hex":"bytes"),r=typeof e.blobs[0]=="string"?e.blobs.map(s=>wt(s)):e.blobs,o=[];for(const s of r)o.push(Uint8Array.from(t.blobToKzgCommitment(s)));return n==="bytes"?o:o.map(s=>$e(s))}function Hu(e){const{kzg:t}=e,n=e.to??(typeof e.blobs[0]=="string"?"hex":"bytes"),r=typeof e.blobs[0]=="string"?e.blobs.map(i=>wt(i)):e.blobs,o=typeof e.commitments[0]=="string"?e.commitments.map(i=>wt(i)):e.commitments,s=[];for(let i=0;i<r.length;i++){const c=r[i],a=o[i];s.push(Uint8Array.from(t.computeBlobKzgProof(c,a)))}return n==="bytes"?s:s.map(i=>$e(i))}function Kb(e,t,n,r){if(typeof e.setBigUint64=="function")return e.setBigUint64(t,n,r);const o=BigInt(32),s=BigInt(4294967295),i=Number(n>>o&s),c=Number(n&s),a=r?4:0,l=r?0:4;e.setUint32(t+a,i,r),e.setUint32(t+l,c,r)}function Yb(e,t,n){return e&t^~e&n}function Xb(e,t,n){return e&t^e&n^t&n}class Qb extends fi{constructor(t,n,r,o){super(),this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.blockLen=t,this.outputLen=n,this.padOffset=r,this.isLE=o,this.buffer=new Uint8Array(t),this.view=ui(this.buffer)}update(t){er(this),t=Wo(t),qt(t);const{view:n,buffer:r,blockLen:o}=this,s=t.length;for(let i=0;i<s;){const c=Math.min(o-this.pos,s-i);if(c===o){const a=ui(t);for(;o<=s-i;i+=o)this.process(a,i);continue}r.set(t.subarray(i,i+c),this.pos),this.pos+=c,i+=c,this.pos===o&&(this.process(n,0),this.pos=0)}return this.length+=t.length,this.roundClean(),this}digestInto(t){er(this),ql(t,this),this.finished=!0;const{buffer:n,view:r,blockLen:o,isLE:s}=this;let{pos:i}=this;n[i++]=128,tr(this.buffer.subarray(i)),this.padOffset>o-i&&(this.process(r,0),i=0);for(let f=i;f<o;f++)n[f]=0;Kb(r,o-8,BigInt(this.length*8),s),this.process(r,0);const c=ui(t),a=this.outputLen;if(a%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const l=a/4,u=this.get();if(l>u.length)throw new Error("_sha2: outputLen bigger than state");for(let f=0;f<l;f++)c.setUint32(4*f,u[f],s)}digest(){const{buffer:t,outputLen:n}=this;this.digestInto(t);const r=t.slice(0,n);return this.destroy(),r}_cloneInto(t){t||(t=new this.constructor),t.set(...this.get());const{blockLen:n,buffer:r,length:o,finished:s,destroyed:i,pos:c}=this;return t.destroyed=i,t.finished=s,t.length=o,t.pos=c,o%n&&t.buffer.set(r),t}clone(){return this._cloneInto()}}const hn=Uint32Array.from([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),Jb=Uint32Array.from([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),mn=new Uint32Array(64);class ey extends Qb{constructor(t=32){super(64,t,8,!1),this.A=hn[0]|0,this.B=hn[1]|0,this.C=hn[2]|0,this.D=hn[3]|0,this.E=hn[4]|0,this.F=hn[5]|0,this.G=hn[6]|0,this.H=hn[7]|0}get(){const{A:t,B:n,C:r,D:o,E:s,F:i,G:c,H:a}=this;return[t,n,r,o,s,i,c,a]}set(t,n,r,o,s,i,c,a){this.A=t|0,this.B=n|0,this.C=r|0,this.D=o|0,this.E=s|0,this.F=i|0,this.G=c|0,this.H=a|0}process(t,n){for(let f=0;f<16;f++,n+=4)mn[f]=t.getUint32(n,!1);for(let f=16;f<64;f++){const p=mn[f-15],d=mn[f-2],h=Ot(p,7)^Ot(p,18)^p>>>3,m=Ot(d,17)^Ot(d,19)^d>>>10;mn[f]=m+mn[f-7]+h+mn[f-16]|0}let{A:r,B:o,C:s,D:i,E:c,F:a,G:l,H:u}=this;for(let f=0;f<64;f++){const p=Ot(c,6)^Ot(c,11)^Ot(c,25),d=u+p+Yb(c,a,l)+Jb[f]+mn[f]|0,m=(Ot(r,2)^Ot(r,13)^Ot(r,22))+Xb(r,o,s)|0;u=l,l=a,a=c,c=i+d|0,i=s,s=o,o=r,r=d+m|0}r=r+this.A|0,o=o+this.B|0,s=s+this.C|0,i=i+this.D|0,c=c+this.E|0,a=a+this.F|0,l=l+this.G|0,u=u+this.H|0,this.set(r,o,s,i,c,a,l,u)}roundClean(){tr(mn)}destroy(){this.set(0,0,0,0,0,0,0,0),tr(this.buffer)}}const Wu=Xl(()=>new ey),ty=Wu;function ny(e,t){return ty(bt(e,{strict:!1})?Qn(e):e)}function ry(e){const{commitment:t,version:n=1}=e,r=e.to??(typeof t=="string"?"hex":"bytes"),o=ny(t);return o.set([n],0),r==="bytes"?o:$e(o)}function oy(e){const{commitments:t,version:n}=e,r=e.to,o=[];for(const s of t)o.push(ry({commitment:s,to:r,version:n}));return o}const Vu=6,Gu=32,ji=4096,qu=Gu*ji,Zu=qu*Vu-1-1*ji*Vu;class sy extends G{constructor({maxSize:t,size:n}){super("Blob size is too large.",{metaMessages:[`Max: ${t} bytes`,`Given: ${n} bytes`],name:"BlobSizeTooLargeError"})}}class iy extends G{constructor(){super("Blob data must not be empty.",{name:"EmptyBlobError"})}}function ay(e){const t=typeof e.data=="string"?wt(e.data):e.data,n=xe(t);if(!n)throw new iy;if(n>Zu)throw new sy({maxSize:Zu,size:n});const r=[];let o=!0,s=0;for(;o;){const i=vi(new Uint8Array(qu));let c=0;for(;c<ji;){const a=t.slice(s,s+(Gu-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 cy(e){const{data:t,kzg:n,to:r}=e,o=e.blobs??ay({data:t}),s=e.commitments??zu({blobs:o,kzg:n,to:r}),i=e.proofs??Hu({blobs:o,commitments:s,kzg:n,to:r}),c=[];for(let a=0;a<o.length;a++)c.push({blob:o[a],commitment:s[a],proof:i[a]});return c}function ly(e){if(e.type)return e.type;if(typeof e.authorizationList<"u")return"eip7702";if(typeof e.blobs<"u"||typeof e.blobVersionedHashes<"u"||typeof e.maxFeePerBlobGas<"u"||typeof e.sidecars<"u")return"eip4844";if(typeof e.maxFeePerGas<"u"||typeof e.maxPriorityFeePerGas<"u")return"eip1559";if(typeof e.gasPrice<"u")return typeof e.accessList<"u"?"eip2930":"legacy";throw new Sb({transaction:e})}async function Ku(e){const t=await e.request({method:"eth_chainId"},{dedupe:!0});return Wt(t)}const uy=["blobVersionedHashes","chainId","fees","gas","nonce","type"],Yu=new Map;async function Xu(e,t){const{account:n=e.account,blobs:r,chain:o,gas:s,kzg:i,nonce:c,nonceManager:a,parameters:l=uy,type:u}=t,f=n&&xt(n),p={...t,...f?{from:f==null?void 0:f.address}:{}};let d;async function h(){return d||(d=await ee(e,It,"getBlock")({blockTag:"latest"}),d)}let m;async function x(){return m||(o?o.id:typeof t.chainId<"u"?t.chainId:(m=await ee(e,Ku,"getChainId")({}),m))}if(l.includes("nonce")&&typeof c>"u"&&f)if(a){const A=await x();p.nonce=await a.consume({address:f.address,chainId:A,client:e})}else p.nonce=await ee(e,Uu,"getTransactionCount")({address:f.address,blockTag:"pending"});if((l.includes("blobVersionedHashes")||l.includes("sidecars"))&&r&&i){const A=zu({blobs:r,kzg:i});if(l.includes("blobVersionedHashes")){const w=oy({commitments:A,to:"hex"});p.blobVersionedHashes=w}if(l.includes("sidecars")){const w=Hu({blobs:r,commitments:A,kzg:i}),T=cy({blobs:r,commitments:A,proofs:w,to:"hex"});p.sidecars=T}}if(l.includes("chainId")&&(p.chainId=await x()),(l.includes("fees")||l.includes("type"))&&typeof u>"u")try{p.type=ly(p)}catch{let A=Yu.get(e.uid);if(typeof A>"u"){const w=await h();A=typeof(w==null?void 0:w.baseFeePerGas)=="bigint",Yu.set(e.uid,A)}p.type=A?"eip1559":"legacy"}if(l.includes("fees"))if(p.type!=="legacy"&&p.type!=="eip2930"){if(typeof p.maxFeePerGas>"u"||typeof p.maxPriorityFeePerGas>"u"){const A=await h(),{maxFeePerGas:w,maxPriorityFeePerGas:T}=await Ri(e,{block:A,chain:o,request:p});if(typeof t.maxPriorityFeePerGas>"u"&&t.maxFeePerGas&&t.maxFeePerGas<T)throw new Vb({maxPriorityFeePerGas:T});p.maxPriorityFeePerGas=T,p.maxFeePerGas=w}}else{if(typeof t.maxFeePerGas<"u"||typeof t.maxPriorityFeePerGas<"u")throw new Di;if(typeof t.gasPrice>"u"){const A=await h(),{gasPrice:w}=await Ri(e,{block:A,chain:o,request:p,type:"legacy"});p.gasPrice=w}}return l.includes("gas")&&typeof s>"u"&&(p.gas=await ee(e,_i,"estimateGas")({...p,account:f&&{address:f.address,type:"json-rpc"}})),uo(p),delete p.parameters,p}async function Qu(e,{address:t,blockNumber:n,blockTag:r=e.experimental_blockTag??"latest"}){const o=typeof n=="bigint"?J(n):void 0,s=await e.request({method:"eth_getBalance",params:[t,o||r]});return BigInt(s)}async function _i(e,t){var o,s,i;const{account:n=e.account}=t,r=n?xt(n):void 0;try{let S=function(O){const{block:N,request:b,rpcStateOverride:M}=O;return e.request({method:"eth_estimateGas",params:M?[b,N??e.experimental_blockTag??"latest",M]:N?[b,N]:[b]})};const{accessList:c,authorizationList:a,blobs:l,blobVersionedHashes:u,blockNumber:f,blockTag:p,data:d,gas:h,gasPrice:m,maxFeePerBlobGas:x,maxFeePerGas:A,maxPriorityFeePerGas:w,nonce:T,value:B,stateOverride:L,...F}=await Xu(e,{...t,parameters:(r==null?void 0:r.type)==="local"?void 0:["blobVersionedHashes"]}),g=(typeof f=="bigint"?J(f):void 0)||p,y=Li(L),P=await(async()=>{if(F.to)return F.to;if(a&&a.length>0)return await Rb({authorization:a[0]}).catch(()=>{throw new G("`to` is required. Could not infer from `authorizationList`")})})();uo(t);const k=(i=(s=(o=e.chain)==null?void 0:o.formatters)==null?void 0:s.transactionRequest)==null?void 0:i.format,$=(k||Jo)({...Bi(F,{format:k}),from:r==null?void 0:r.address,accessList:c,authorizationList:a,blobs:l,blobVersionedHashes:u,data:d,gas:h,gasPrice:m,maxFeePerBlobGas:x,maxFeePerGas:A,maxPriorityFeePerGas:w,nonce:T,to:P,value:B});let E=BigInt(await S({block:g,request:$,rpcStateOverride:y}));if(a){const O=await Qu(e,{address:$.from}),N=await Promise.all(a.map(async b=>{const{address:M}=b,R=await S({block:g,request:{authorizationList:void 0,data:d,from:r==null?void 0:r.address,to:M,value:J(O)},rpcStateOverride:y}).catch(()=>100000n);return 2n*BigInt(R)}));E+=N.reduce((b,M)=>b+M,0n)}return E}catch(c){throw _b(c,{...t,account:r,chain:e.chain})}}async function fy(e,t){const{abi:n,address:r,args:o,functionName:s,dataSuffix:i,...c}=t,a=Ct({abi:n,args:o,functionName:s});try{return await ee(e,_i,"estimateGas")({data:`${a}${i?i.replace("0x",""):""}`,to:r,...c})}catch(l){const u=c.account?xt(c.account):void 0;throw cr(l,{abi:n,address:r,args:o,docsPath:"/docs/contract/estimateContractGas",functionName:s,sender:u==null?void 0:u.address})}}function es(e,t){if(!tt(e,{strict:!1}))throw new pn({address:e});if(!tt(t,{strict:!1}))throw new pn({address:t});return e.toLowerCase()===t.toLowerCase()}const Ju="/docs/contract/decodeEventLog";function Ui(e){const{abi:t,data:n,strict:r,topics:o}=e,s=r??!0,[i,...c]=o;if(!i)throw new rg({docsPath:Ju});const a=t.find(m=>m.type==="event"&&i===Vo(gt(m)));if(!(a&&"name"in a)||a.type!=="event")throw new Ll(i,{docsPath:Ju});const{name:l,inputs:u}=a,f=u==null?void 0:u.some(m=>!("name"in m&&m.name)),p=f?[]:{},d=u.map((m,x)=>[m,x]).filter(([m])=>"indexed"in m&&m.indexed);for(let m=0;m<d.length;m++){const[x,A]=d[m],w=c[m];if(!w)throw new _o({abiItem:a,param:x});p[f?A:x.name||A]=dy({param:x,value:w})}const h=u.filter(m=>!("indexed"in m&&m.indexed));if(h.length>0){if(n&&n!=="0x")try{const m=Ur(h,n);if(m)if(f)for(let x=0;x<u.length;x++)p[x]=p[x]??m.shift();else for(let x=0;x<h.length;x++)p[h[x].name]=m[x]}catch(m){if(s)throw m instanceof Ml||m instanceof vu?new Lr({abiItem:a,data:n,params:h,size:xe(n)}):m}else if(s)throw new Lr({abiItem:a,data:"0x",params:h,size:0})}return{eventName:l,args:Object.values(p).length>0?p:void 0}}function dy({param:e,value:t}){return e.type==="string"||e.type==="bytes"||e.type==="tuple"||e.type.match(/^(.*)\[(\d+)?\]$/)?t:(Ur([e],t)||[])[0]}function zi(e){const{abi:t,args:n,logs:r,strict:o=!0}=e,s=(()=>{if(e.eventName)return Array.isArray(e.eventName)?e.eventName:[e.eventName]})();return r.map(i=>{var c;try{const a=t.find(u=>u.type==="event"&&i.topics[0]===Vo(u));if(!a)return null;const l=Ui({...i,abi:[a],strict:o});return s&&!s.includes(l.eventName)||!py({args:l.args,inputs:a.inputs,matchArgs:n})?null:{...l,...i}}catch(a){let l,u;if(a instanceof Ll)return null;if(a instanceof Lr||a instanceof _o){if(o)return null;l=a.abiItem.name,u=(c=a.abiItem.inputs)==null?void 0:c.some(f=>!("name"in f&&f.name))}return{...i,args:u?[]:{},eventName:l}}}).filter(Boolean)}function py(e){const{args:t,inputs:n,matchArgs:r}=e;if(!r)return!0;if(!t)return!1;function o(s,i,c){try{return s.type==="address"?es(i,c):s.type==="string"||s.type==="bytes"?Ie(Qn(i))===c:i===c}catch{return!1}}return Array.isArray(t)&&Array.isArray(r)?r.every((s,i)=>{if(s==null)return!0;const c=n[i];return c?(Array.isArray(s)?s:[s]).some(l=>o(c,l,t[i])):!1}):typeof t=="object"&&!Array.isArray(t)&&typeof r=="object"&&!Array.isArray(r)?Object.entries(r).every(([s,i])=>{if(i==null)return!0;const c=n.find(l=>l.name===s);return c?(Array.isArray(i)?i:[i]).some(l=>o(c,l,t[s])):!1}):!1}function Xt(e,{args:t,eventName:n}={}){return{...e,blockHash:e.blockHash?e.blockHash:null,blockNumber:e.blockNumber?BigInt(e.blockNumber):null,logIndex:e.logIndex?Number(e.logIndex):null,transactionHash:e.transactionHash?e.transactionHash:null,transactionIndex:e.transactionIndex?Number(e.transactionIndex):null,...n?{args:t,eventName:n}:{}}}async function Hi(e,{address:t,blockHash:n,fromBlock:r,toBlock:o,event:s,events:i,args:c,strict:a}={}){const l=a??!1,u=i??(s?[s]:void 0);let f=[];u&&(f=[u.flatMap(m=>_r({abi:[m],eventName:m.name,args:i?void 0:c}))],s&&(f=f[0]));let p;n?p=await e.request({method:"eth_getLogs",params:[{address:t,topics:f,blockHash:n}]}):p=await e.request({method:"eth_getLogs",params:[{address:t,topics:f,fromBlock:typeof r=="bigint"?J(r):r,toBlock:typeof o=="bigint"?J(o):o}]});const d=p.map(h=>Xt(h));return u?zi({abi:u,args:c,logs:d,strict:l}):d}async function ef(e,t){const{abi:n,address:r,args:o,blockHash:s,eventName:i,fromBlock:c,toBlock:a,strict:l}=t,u=i?On({abi:n,name:i}):void 0,f=u?void 0:n.filter(p=>p.type==="event");return ee(e,Hi,"getLogs")({address:r,args:o,blockHash:s,event:u,events:f,fromBlock:c,toBlock:a,strict:l})}const Wi="/docs/contract/decodeFunctionResult";function Bn(e){const{abi:t,args:n,functionName:r,data:o}=e;let s=t[0];if(r){const c=On({abi:t,args:n,name:r});if(!c)throw new Yn(r,{docsPath:Wi});s=c}if(s.type!=="function")throw new Yn(void 0,{docsPath:Wi});if(!s.outputs)throw new Fl(s.name,{docsPath:Wi});const i=Ur(s.outputs,o);if(i&&i.length>1)return i;if(i&&i.length===1)return i[0]}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const Vi=BigInt(0),Gi=BigInt(1);function ts(e,t=""){if(typeof e!="boolean"){const n=t&&`"${t}"`;throw new Error(n+"expected boolean, got type="+typeof e)}return e}function Ln(e,t,n=""){const r=zo(e),o=e==null?void 0:e.length,s=t!==void 0;if(!r||s&&o!==t){const i=n&&`"${n}" `,c=s?` of length ${t}`:"",a=r?`length=${o}`:`type=${typeof e}`;throw new Error(i+"expected Uint8Array"+c+", got "+a)}return e}function ns(e){const t=e.toString(16);return t.length&1?"0"+t:t}function tf(e){if(typeof e!="string")throw new Error("hex string expected, got "+typeof e);return e===""?Vi:BigInt("0x"+e)}function rs(e){return tf(nr(e))}function nf(e){return qt(e),tf(nr(Uint8Array.from(e).reverse()))}function qi(e,t){return Ho(e.toString(16).padStart(t*2,"0"))}function rf(e,t){return qi(e,t).reverse()}function _e(e,t,n){let r;if(typeof t=="string")try{r=Ho(t)}catch(o){throw new Error(e+" must be hex string or Uint8Array, cause: "+o)}else if(zo(t))r=Uint8Array.from(t);else throw new Error(e+" must be hex string or Uint8Array");return r.length,r}const Zi=e=>typeof e=="bigint"&&Vi<=e;function hy(e,t,n){return Zi(e)&&Zi(t)&&Zi(n)&&t<=e&&e<n}function my(e,t,n,r){if(!hy(t,n,r))throw new Error("expected valid "+e+": "+n+" <= n < "+r+", got "+t)}function of(e){let t;for(t=0;e>Vi;e>>=Gi,t+=1);return t}const fo=e=>(Gi<<BigInt(e))-Gi;function gy(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},l=(...d)=>n(i,s,...d),u=(d=r(0))=>{i=l(o(0),d),s=l(),d.length!==0&&(i=l(o(1),d),s=l())},f=()=>{if(c++>=1e3)throw new Error("drbg: tried 1000 values");let d=0;const h=[];for(;d<t;){s=l();const m=s.slice();h.push(m),d+=s.length}return dn(...h)};return(d,h)=>{a(),u(d);let m;for(;!(m=h(f()));)u();return a(),m}}function Ki(e,t,n={}){if(!e||typeof e!="object")throw new Error("expected valid options object");function r(o,s,i){const c=e[o];if(i&&c===void 0)return;const a=typeof c;if(a!==s||c===null)throw new Error(`param "${o}" is invalid: expected ${s}, got ${a}`)}Object.entries(t).forEach(([o,s])=>r(o,s,!1)),Object.entries(n).forEach(([o,s])=>r(o,s,!0))}function sf(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 by="0.1.1";function yy(){return by}class be extends Error{constructor(t,n={}){const r=(()=>{var a;if(n.cause instanceof be){if(n.cause.details)return n.cause.details;if(n.cause.shortMessage)return n.cause.shortMessage}return n.cause&&"details"in n.cause&&typeof n.cause.details=="string"?n.cause.details:(a=n.cause)!=null&&a.message?n.cause.message:n.details})(),o=n.cause instanceof be&&n.cause.docsPath||n.docsPath,i=`https://oxlib.sh${o??""}`,c=[t||"An error occurred.",...n.metaMessages?["",...n.metaMessages]:[],...r||o?["",r?`Details: ${r}`:void 0,o?`See: ${i}`:void 0]:[]].filter(a=>typeof a=="string").join(`
79
+ `);super(c,n.cause?{cause:n.cause}:void 0),Object.defineProperty(this,"details",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docs",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docsPath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"shortMessage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"BaseError"}),Object.defineProperty(this,"version",{enumerable:!0,configurable:!0,writable:!0,value:`ox@${yy()}`}),this.cause=n.cause,this.details=r,this.docs=i,this.docsPath=o,this.shortMessage=t}walk(t){return af(this,t)}}function af(e,t){return t!=null&&t(e)?e:e&&typeof e=="object"&&"cause"in e&&e.cause?af(e.cause,t):t?null:e}const wy="#__bigint";function vy(e,t,n){return JSON.stringify(e,(r,o)=>typeof o=="bigint"?o.toString()+wy:o,n)}function xy(e,t){if(uf(e)>t)throw new Iy({givenSize:uf(e),maxSize:t})}const Qt={zero:48,nine:57,A:65,F:70,a:97,f:102};function cf(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 Ey(e,t={}){const{dir:n,size:r=32}=t;if(r===0)return e;if(e.length>r)throw new My({size:e.length,targetSize:r,type:"Bytes"});const o=new Uint8Array(r);for(let s=0;s<r;s++){const i=n==="right";o[i?s:r-s-1]=e[i?s:e.length-s-1]}return o}function Yi(e,t){if(nt(e)>t)throw new Fy({givenSize:nt(e),maxSize:t})}function Sy(e,t){if(typeof t=="number"&&t>0&&t>nt(e)-1)throw new gf({offset:t,position:"start",size:nt(e)})}function Py(e,t,n){if(typeof t=="number"&&typeof n=="number"&&nt(e)!==n-t)throw new gf({offset:n,position:"end",size:nt(e)})}function lf(e,t={}){const{dir:n,size:r=32}=t;if(r===0)return e;const o=e.replace("0x","");if(o.length>r*2)throw new Ry({size:Math.ceil(o.length/2),targetSize:r,type:"Hex"});return`0x${o[n==="right"?"padEnd":"padStart"](r*2,"0")}`}const $y=new TextEncoder;function Ty(e){return e instanceof Uint8Array?e:typeof e=="string"?Ny(e):Ay(e)}function Ay(e){return e instanceof Uint8Array?e:new Uint8Array(e)}function Ny(e,t={}){const{size:n}=t;let r=e;n&&(Yi(e,n),r=Fn(e,n));let o=r.slice(2);o.length%2&&(o=`0${o}`);const s=o.length/2,i=new Uint8Array(s);for(let c=0,a=0;c<s;c++){const l=cf(o.charCodeAt(a++)),u=cf(o.charCodeAt(a++));if(l===void 0||u===void 0)throw new be(`Invalid byte sequence ("${o[a-2]}${o[a-1]}" in "${o}").`);i[c]=l*16+u}return i}function Oy(e,t={}){const{size:n}=t,r=$y.encode(e);return typeof n=="number"?(xy(r,n),Cy(r,n)):r}function Cy(e,t){return Ey(e,{dir:"right",size:t})}function uf(e){return e.length}let Iy=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"})}},My=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 ky=new TextEncoder,By=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function Ly(e,t={}){const{strict:n=!1}=t;if(!e)throw new hf(e);if(typeof e!="string")throw new hf(e);if(n&&!/^0x[0-9a-fA-F]*$/.test(e))throw new mf(e);if(!e.startsWith("0x"))throw new mf(e)}function Mt(...e){return`0x${e.reduce((t,n)=>t+n.replace("0x",""),"")}`}function ff(e,t={}){const n=`0x${Number(e)}`;return typeof t.size=="number"?(Yi(n,t.size),Dn(n,t.size)):n}function df(e,t={}){let n="";for(let o=0;o<e.length;o++)n+=By[e[o]];const r=`0x${n}`;return typeof t.size=="number"?(Yi(r,t.size),Fn(r,t.size)):r}function Be(e,t={}){const{signed:n,size:r}=t,o=BigInt(e);let s;r?n?s=(1n<<BigInt(r)*8n-1n)-1n:s=2n**(BigInt(r)*8n)-1n:typeof e=="number"&&(s=BigInt(Number.MAX_SAFE_INTEGER));const i=typeof s=="bigint"&&n?-s-1n:0;if(s&&o>s||o<i){const l=typeof e=="bigint"?"n":"";throw new pf({max:s?`${s}${l}`:void 0,min:`${i}${l}`,signed:n,size:r,value:`${e}${l}`})}const a=`0x${(n&&o<0?(1n<<BigInt(r*8))+BigInt(o):o).toString(16)}`;return r?Dn(a,r):a}function Xi(e,t={}){return df(ky.encode(e),t)}function Dn(e,t){return lf(e,{dir:"left",size:t})}function Fn(e,t){return lf(e,{dir:"right",size:t})}function Qi(e,t,n,r={}){const{strict:o}=r;Sy(e,t);const s=`0x${e.replace("0x","").slice((t??0)*2,(n??e.length)*2)}`;return o&&Py(s,t,n),s}function nt(e){return Math.ceil((e.length-2)/2)}function Dy(e,t={}){const{strict:n=!1}=t;try{return Ly(e,{strict:n}),!0}catch{return!1}}class pf 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 hf extends be{constructor(t){super(`Value \`${typeof t=="object"?vy(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 mf 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 Fy 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 gf 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 Ry 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 jy(e){return{address:e.address,amount:Be(e.amount),index:Be(e.index),validatorIndex:Be(e.validatorIndex)}}function bf(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(jy)}}}const Ji=[{inputs:[{components:[{name:"target",type:"address"},{name:"allowFailure",type:"bool"},{name:"callData",type:"bytes"}],name:"calls",type:"tuple[]"}],name:"aggregate3",outputs:[{components:[{name:"success",type:"bool"},{name:"returnData",type:"bytes"}],name:"returnData",type:"tuple[]"}],stateMutability:"view",type:"function"}],ea=[{name:"query",type:"function",stateMutability:"view",inputs:[{type:"tuple[]",name:"queries",components:[{type:"address",name:"sender"},{type:"string[]",name:"urls"},{type:"bytes",name:"data"}]}],outputs:[{type:"bool[]",name:"failures"},{type:"bytes[]",name:"responses"}]},{name:"HttpError",type:"error",inputs:[{type:"uint16",name:"status"},{type:"string",name:"message"}]}],yf=[{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"}],wf=[...yf,{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"}]}],_y=[...yf,{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"}]}],vf=[{name:"text",type:"function",stateMutability:"view",inputs:[{name:"name",type:"bytes32"},{name:"key",type:"string"}],outputs:[{name:"",type:"string"}]}],xf=[{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"}]}],Ef=[{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"}],ur=[{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"}]}],Uy="0x82ad56cb",Sf="0x608060405234801561001057600080fd5b5060405161018e38038061018e83398101604081905261002f91610124565b6000808351602085016000f59050803b61004857600080fd5b6000808351602085016000855af16040513d6000823e81610067573d81fd5b3d81f35b634e487b7160e01b600052604160045260246000fd5b600082601f83011261009257600080fd5b81516001600160401b038111156100ab576100ab61006b565b604051601f8201601f19908116603f011681016001600160401b03811182821017156100d9576100d961006b565b6040528181528382016020018510156100f157600080fd5b60005b82811015610110576020818601810151838301820152016100f4565b506000918101602001919091529392505050565b6000806040838503121561013757600080fd5b82516001600160401b0381111561014d57600080fd5b61015985828601610081565b602085015190935090506001600160401b0381111561017757600080fd5b61018385828601610081565b915050925092905056fe",zy="0x608060405234801561001057600080fd5b506040516102c03803806102c083398101604081905261002f916101e6565b836001600160a01b03163b6000036100e457600080836001600160a01b03168360405161005c9190610270565b6000604051808303816000865af19150503d8060008114610099576040519150601f19603f3d011682016040523d82523d6000602084013e61009e565b606091505b50915091508115806100b857506001600160a01b0386163b155b156100e1578060405163101bb98d60e01b81526004016100d8919061028c565b60405180910390fd5b50505b6000808451602086016000885af16040513d6000823e81610103573d81fd5b3d81f35b80516001600160a01b038116811461011e57600080fd5b919050565b634e487b7160e01b600052604160045260246000fd5b60005b8381101561015457818101518382015260200161013c565b50506000910152565b600082601f83011261016e57600080fd5b81516001600160401b0381111561018757610187610123565b604051601f8201601f19908116603f011681016001600160401b03811182821017156101b5576101b5610123565b6040528181528382016020018510156101cd57600080fd5b6101de826020830160208701610139565b949350505050565b600080600080608085870312156101fc57600080fd5b61020585610107565b60208601519094506001600160401b0381111561022157600080fd5b61022d8782880161015d565b93505061023c60408601610107565b60608601519092506001600160401b0381111561025857600080fd5b6102648782880161015d565b91505092959194509250565b60008251610282818460208701610139565b9190910192915050565b60208152600082518060208401526102ab816040850160208701610139565b601f01601f1916919091016040019291505056fe",Hy="0x608060405234801561001057600080fd5b5060405161069438038061069483398101604081905261002f9161051e565b600061003c848484610048565b9050806000526001601ff35b60007f64926492649264926492649264926492649264926492649264926492649264926100748361040c565b036101e7576000606080848060200190518101906100929190610577565b60405192955090935091506000906001600160a01b038516906100b69085906105dd565b6000604051808303816000865af19150503d80600081146100f3576040519150601f19603f3d011682016040523d82523d6000602084013e6100f8565b606091505b50509050876001600160a01b03163b60000361016057806101605760405162461bcd60e51b815260206004820152601e60248201527f5369676e617475726556616c696461746f723a206465706c6f796d656e74000060448201526064015b60405180910390fd5b604051630b135d3f60e11b808252906001600160a01b038a1690631626ba7e90610190908b9087906004016105f9565b602060405180830381865afa1580156101ad573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101d19190610633565b6001600160e01b03191614945050505050610405565b6001600160a01b0384163b1561027a57604051630b135d3f60e11b808252906001600160a01b03861690631626ba7e9061022790879087906004016105f9565b602060405180830381865afa158015610244573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102689190610633565b6001600160e01b031916149050610405565b81516041146102df5760405162461bcd60e51b815260206004820152603a602482015260008051602061067483398151915260448201527f3a20696e76616c6964207369676e6174757265206c656e6774680000000000006064820152608401610157565b6102e7610425565b5060208201516040808401518451859392600091859190811061030c5761030c61065d565b016020015160f81c9050601b811480159061032b57508060ff16601c14155b1561038c5760405162461bcd60e51b815260206004820152603b602482015260008051602061067483398151915260448201527f3a20696e76616c6964207369676e617475726520762076616c756500000000006064820152608401610157565b60408051600081526020810180835289905260ff83169181019190915260608101849052608081018390526001600160a01b0389169060019060a0016020604051602081039080840390855afa1580156103ea573d6000803e3d6000fd5b505050602060405103516001600160a01b0316149450505050505b9392505050565b600060208251101561041d57600080fd5b508051015190565b60405180606001604052806003906020820280368337509192915050565b6001600160a01b038116811461045857600080fd5b50565b634e487b7160e01b600052604160045260246000fd5b60005b8381101561048c578181015183820152602001610474565b50506000910152565b600082601f8301126104a657600080fd5b81516001600160401b038111156104bf576104bf61045b565b604051601f8201601f19908116603f011681016001600160401b03811182821017156104ed576104ed61045b565b60405281815283820160200185101561050557600080fd5b610516826020830160208701610471565b949350505050565b60008060006060848603121561053357600080fd5b835161053e81610443565b6020850151604086015191945092506001600160401b0381111561056157600080fd5b61056d86828701610495565b9150509250925092565b60008060006060848603121561058c57600080fd5b835161059781610443565b60208501519093506001600160401b038111156105b357600080fd5b6105bf86828701610495565b604086015190935090506001600160401b0381111561056157600080fd5b600082516105ef818460208701610471565b9190910192915050565b828152604060208201526000825180604084015261061e816060850160208701610471565b601f01601f1916919091016060019392505050565b60006020828403121561064557600080fd5b81516001600160e01b03198116811461040557600080fd5b634e487b7160e01b600052603260045260246000fdfe5369676e617475726556616c696461746f72237265636f7665725369676e6572";class ta extends G{constructor({blockNumber:t,chain:n,contract:r}){super(`Chain "${n.name}" does not support contract "${r.name}".`,{metaMessages:["This could be due to any of the following:",...t&&r.blockCreated&&r.blockCreated>t?[`- The contract "${r.name}" was not deployed until block ${r.blockCreated} (current block ${t}).`]:[`- The chain does not have the contract "${r.name}" configured.`]],name:"ChainDoesNotSupportContract"})}}class Pf extends G{constructor(){super("No chain was provided to the Client.",{name:"ClientChainNotConfiguredError"})}}const na="/docs/contract/encodeDeployData";function ra(e){const{abi:t,args:n,bytecode:r}=e;if(!n||n.length===0)return r;const o=t.find(i=>"type"in i&&i.type==="constructor");if(!o)throw new Qm({docsPath:na});if(!("inputs"in o))throw new Il({docsPath:na});if(!o.inputs||o.inputs.length===0)throw new Il({docsPath:na});const s=Kt(o.inputs,n);return rr([r,s])}function fr({blockNumber:e,chain:t,contract:n}){var o;const r=(o=t==null?void 0:t.contracts)==null?void 0:o[n];if(!r)throw new ta({chain:t,contract:{name:n}});if(e&&r.blockCreated&&r.blockCreated>e)throw new ta({blockNumber:e,chain:t,contract:{name:n,blockCreated:r.blockCreated}});return r.address}function $f(e,{docsPath:t,...n}){const r=(()=>{const o=ki(e,n);return o instanceof Qo?e:o})();return new Nu(r,{docsPath:t,...n})}function Tf(){let e=()=>{},t=()=>{};return{promise:new Promise((r,o)=>{e=r,t=o}),resolve:e,reject:t}}const oa=new Map;function Af({fn:e,id:t,shouldSplitBatch:n,wait:r=0,sort:o}){const s=async()=>{const u=a();i();const f=u.map(({args:p})=>p);f.length!==0&&e(f).then(p=>{o&&Array.isArray(p)&&p.sort(o);for(let d=0;d<u.length;d++){const{resolve:h}=u[d];h==null||h([p[d],p])}}).catch(p=>{for(let d=0;d<u.length;d++){const{reject:h}=u[d];h==null||h(p)}})},i=()=>oa.delete(t),c=()=>a().map(({args:u})=>u),a=()=>oa.get(t)||[],l=u=>oa.set(t,[...a(),u]);return{flush:i,async schedule(u){const{promise:f,resolve:p,reject:d}=Tf();return(n==null?void 0:n([...c(),u]))&&s(),a().length>0?(l({args:u,resolve:p,reject:d}),f):(l({args:u,resolve:p,reject:d}),setTimeout(s,r),f)}}}async function po(e,t){var $,S,E,O;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:l,code:u,data:f,factory:p,factoryData:d,gas:h,gasPrice:m,maxFeePerBlobGas:x,maxFeePerGas:A,maxPriorityFeePerGas:w,nonce:T,to:B,value:L,stateOverride:F,..._}=t,g=n?xt(n):void 0;if(u&&(p||d))throw new G("Cannot provide both `code` & `factory`/`factoryData` as parameters.");if(u&&B)throw new G("Cannot provide both `code` & `to` as parameters.");const y=u&&f,P=p&&d&&B&&f,k=y||P,C=y?Gy({code:u,data:f}):P?qy({data:f,factory:p,factoryData:d,to:B}):f;try{uo(t);const b=(typeof s=="bigint"?J(s):void 0)||i,M=l?bf(l):void 0,R=Li(F),U=(O=(E=(S=e.chain)==null?void 0:S.formatters)==null?void 0:E.transactionRequest)==null?void 0:O.format,W=(U||Jo)({...Bi(_,{format:U}),from:g==null?void 0:g.address,accessList:c,authorizationList:r,blobs:a,data:C,gas:h,gasPrice:m,maxFeePerBlobGas:x,maxFeePerGas:A,maxPriorityFeePerGas:w,nonce:T,to:k?void 0:B,value:L});if(o&&Wy({request:W})&&!R&&!M)try{return await Vy(e,{...W,blockNumber:s,blockTag:i})}catch(Z){if(!(Z instanceof Pf)&&!(Z instanceof ta))throw Z}const K=(()=>{const Z=[W,b];return R&&M?[...Z,R,M]:R?[...Z,R]:M?[...Z,{},M]:Z})(),V=await e.request({method:"eth_call",params:K});return V==="0x"?{data:void 0}:{data:V}}catch(N){const b=Zy(N),{offchainLookup:M,offchainLookupSignature:R}=await Promise.resolve().then(()=>Xw);if(e.ccipRead!==!1&&(b==null?void 0:b.slice(0,10))===R&&B)return{data:await M(e,{data:b,to:B})};throw k&&(b==null?void 0:b.slice(0,10))==="0x101bb98d"?new Nb({factory:p}):$f(N,{...t,account:g,chain:e.chain})}}function Wy({request:e}){const{data:t,to:n,...r}=e;return!(!t||t.startsWith(Uy)||!n||Object.values(r).filter(o=>typeof o<"u").length>0)}async function Vy(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 l=c;if(!l){if(!e.chain)throw new Pf;l=fr({blockNumber:o,chain:e.chain,contract:"multicall3"})}const f=(typeof o=="bigint"?J(o):void 0)||s,{schedule:p}=Af({id:`${e.uid}.${f}`,wait:r,shouldSplitBatch(x){return x.reduce((w,{data:T})=>w+(T.length-2),0)>n*2},fn:async x=>{const A=x.map(B=>({allowFailure:!0,callData:B.data,target:B.to})),w=Ct({abi:Ji,args:[A],functionName:"aggregate3"}),T=await e.request({method:"eth_call",params:[{data:w,to:l},f]});return Bn({abi:Ji,args:[A],functionName:"aggregate3",data:T||"0x"})}}),[{returnData:d,success:h}]=await p({data:i,to:a});if(!h)throw new Ko({data:d});return d==="0x"?{data:void 0}:{data:d}}function Gy(e){const{code:t,data:n}=e;return ra({abi:Al(["constructor(bytes, bytes)"]),bytecode:Sf,args:[t,n]})}function qy(e){const{data:t,factory:n,factoryData:r,to:o}=e;return ra({abi:Al(["constructor(address, bytes, address, bytes)"]),bytecode:zy,args:[o,t,n,r]})}function Zy(e){var n;if(!(e instanceof G))return;const t=e.walk();return typeof(t==null?void 0:t.data)=="object"?(n=t.data)==null?void 0:n.data:t.data}async function Jt(e,t){const{abi:n,address:r,args:o,functionName:s,...i}=t,c=Ct({abi:n,args:o,functionName:s});try{const{data:a}=await ee(e,po,"call")({...i,data:c,to:r});return Bn({abi:n,args:o,functionName:s,data:a||"0x"})}catch(a){throw cr(a,{abi:n,address:r,args:o,docsPath:"/docs/contract/readContract",functionName:s})}}async function Ky(e,t){const{abi:n,address:r,args:o,dataSuffix:s,functionName:i,...c}=t,a=c.account?xt(c.account):e.account,l=Ct({abi:n,args:o,functionName:i});try{const{data:u}=await ee(e,po,"call")({batch:!1,data:`${l}${s?s.replace("0x",""):""}`,to:r,...c,account:a}),f=Bn({abi:n,args:o,functionName:i,data:u||"0x"}),p=n.filter(d=>"name"in d&&d.name===t.functionName);return{result:f,request:{abi:p,address:r,args:o,dataSuffix:s,functionName:i,...c,account:a}}}catch(u){throw cr(u,{abi:n,address:r,args:o,docsPath:"/docs/contract/simulateContract",functionName:i,sender:a==null?void 0:a.address})}}const sa=new Map,Nf=new Map;let Yy=0;function gn(e,t,n){const r=++Yy,o=()=>sa.get(e)||[],s=()=>{const u=o();sa.set(e,u.filter(f=>f.id!==r))},i=()=>{const u=o();if(!u.some(p=>p.id===r))return;const f=Nf.get(e);if(u.length===1&&f){const p=f();p instanceof Promise&&p.catch(()=>{})}s()},c=o();if(sa.set(e,[...c,{id:r,fns:t}]),c&&c.length>0)return i;const a={};for(const u in t)a[u]=(...f)=>{var d,h;const p=o();if(p.length!==0)for(const m of p)(h=(d=m.fns)[u])==null||h.call(d,...f)};const l=n(a);return typeof l=="function"&&Nf.set(e,l),i}async function ia(e){return new Promise(t=>setTimeout(t,e))}function ho(e,{emitOnBegin:t,initialWaitTime:n,interval:r}){let o=!0;const s=()=>o=!1;return(async()=>{let c;t&&(c=await e({unpoll:s}));const a=await(n==null?void 0:n(c))??r;await ia(a);const l=async()=>{o&&(await e({unpoll:s}),await ia(r),l())};l()})(),s}const Xy=new Map,Qy=new Map;function Jy(e){const t=(o,s)=>({clear:()=>s.delete(o),get:()=>s.get(o),set:i=>s.set(o,i)}),n=t(e,Xy),r=t(e,Qy);return{clear:()=>{n.clear(),r.clear()},promise:n,response:r}}async function ew(e,{cacheKey:t,cacheTime:n=Number.POSITIVE_INFINITY}){const r=Jy(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 tw=e=>`blockNumber.${e}`;async function mo(e,{cacheTime:t=e.cacheTime}={}){const n=await ew(()=>e.request({method:"eth_blockNumber"}),{cacheKey:tw(e.uid),cacheTime:t});return BigInt(n)}async function os(e,{filter:t}){const n="strict"in t&&t.strict,r=await t.request({method:"eth_getFilterChanges",params:[t.id]});if(typeof r[0]=="string")return r;const o=r.map(s=>Xt(s));return!("abi"in t)||!t.abi?o:zi({abi:t.abi,logs:o,strict:n})}async function ss(e,{filter:t}){return t.request({method:"eth_uninstallFilter",params:[t.id]})}function nw(e,t){const{abi:n,address:r,args:o,batch:s=!0,eventName:i,fromBlock:c,onError:a,onLogs:l,poll:u,pollingInterval:f=e.pollingInterval,strict:p}=t;return(typeof u<"u"?u:typeof c=="bigint"?!0:!(e.transport.type==="webSocket"||e.transport.type==="ipc"||e.transport.type==="fallback"&&(e.transport.transports[0].config.type==="webSocket"||e.transport.transports[0].config.type==="ipc")))?(()=>{const x=p??!1,A=Te(["watchContractEvent",r,o,s,e.uid,i,f,x,c]);return gn(A,{onLogs:l,onError:a},w=>{let T;c!==void 0&&(T=c-1n);let B,L=!1;const F=ho(async()=>{var _;if(!L){try{B=await ee(e,mu,"createContractEventFilter")({abi:n,address:r,args:o,eventName:i,strict:x,fromBlock:c})}catch{}L=!0;return}try{let g;if(B)g=await ee(e,os,"getFilterChanges")({filter:B});else{const y=await ee(e,mo,"getBlockNumber")({});T&&T<y?g=await ee(e,ef,"getContractEvents")({abi:n,address:r,args:o,eventName:i,fromBlock:T+1n,toBlock:y,strict:x}):g=[],T=y}if(g.length===0)return;if(s)w.onLogs(g);else for(const y of g)w.onLogs([y])}catch(g){B&&g instanceof Mn&&(L=!1),(_=w.onError)==null||_.call(w,g)}},{emitOnBegin:!0,interval:f});return async()=>{B&&await ee(e,ss,"uninstallFilter")({filter:B}),F()}})})():(()=>{const x=p??!1,A=Te(["watchContractEvent",r,o,s,e.uid,i,f,x]);let w=!0,T=()=>w=!1;return gn(A,{onLogs:l,onError:a},B=>((async()=>{try{const L=(()=>{if(e.transport.type==="fallback"){const g=e.transport.transports.find(y=>y.config.type==="webSocket"||y.config.type==="ipc");return g?g.value:e.transport}return e.transport})(),F=i?_r({abi:n,eventName:i,args:o}):[],{unsubscribe:_}=await L.subscribe({params:["logs",{address:r,topics:F}],onData(g){var P;if(!w)return;const y=g.result;try{const{eventName:k,args:C}=Ui({abi:n,data:y.data,topics:y.topics,strict:p}),$=Xt(y,{args:C,eventName:k});B.onLogs([$])}catch(k){let C,$;if(k instanceof Lr||k instanceof _o){if(p)return;C=k.abiItem.name,$=(P=k.abiItem.inputs)==null?void 0:P.some(E=>!("name"in E&&E.name))}const S=Xt(y,{args:$?[]:{},eventName:C});B.onLogs([S])}},onError(g){var y;(y=B.onError)==null||y.call(B,g)}});T=_,w||T()}catch(L){a==null||a(L)}})(),()=>T()))})()}async function rw(e,{serializedTransaction:t}){return e.request({method:"eth_sendRawTransaction",params:[t]},{retryCount:0})}function aa(e,{delay:t=100,retryCount:n=2,shouldRetry:r=()=>!0}={}){return new Promise((o,s)=>{const i=async({count:c=0}={})=>{const a=async({error:l})=>{const u=typeof t=="function"?t({count:c,error:l}):t;u&&await ia(u),i({count:c+1})};try{const l=await e();o(l)}catch(l){if(c<n&&await r({count:c,error:l}))return a({error:l});s(l)}};i()})}const ow={"0x0":"reverted","0x1":"success"};function sw(e){const t={...e,blockNumber:e.blockNumber?BigInt(e.blockNumber):null,contractAddress:e.contractAddress?e.contractAddress:null,cumulativeGasUsed:e.cumulativeGasUsed?BigInt(e.cumulativeGasUsed):null,effectiveGasPrice:e.effectiveGasPrice?BigInt(e.effectiveGasPrice):null,gasUsed:e.gasUsed?BigInt(e.gasUsed):null,logs:e.logs?e.logs.map(n=>Xt(n)):null,to:e.to?e.to:null,transactionIndex:e.transactionIndex?Wt(e.transactionIndex):null,status:e.status?ow[e.status]:null,type:e.type?Fu[e.type]||e.type:null};return e.blobGasPrice&&(t.blobGasPrice=BigInt(e.blobGasPrice)),e.blobGasUsed&&(t.blobGasUsed=BigInt(e.blobGasUsed)),t}const ca=256;let is=ca,as;function Of(e=11){if(!as||is+e>ca*2){as="",is=0;for(let t=0;t<ca;t++)as+=(256+Math.random()*256|0).toString(16).substring(1)}return as.substring(is,is+++e)}function iw(e){const{batch:t,chain:n,ccipRead:r,key:o="base",name:s="Base Client",type:i="base"}=e,c=e.experimental_blockTag??(typeof(n==null?void 0:n.experimental_preconfirmationTime)=="number"?"pending":void 0),a=(n==null?void 0:n.blockTime)??12e3,l=Math.min(Math.max(Math.floor(a/2),500),4e3),u=e.pollingInterval??l,f=e.cacheTime??u,p=e.account?xt(e.account):void 0,{config:d,request:h,value:m}=e.transport({chain:n,pollingInterval:u}),x={...d,...m},A={account:p,batch:t,cacheTime:f,ccipRead:r,chain:n,key:o,name:s,pollingInterval:u,request:h,transport:x,type:i,uid:Of(),...c?{experimental_blockTag:c}:{}};function w(T){return B=>{const L=B(T);for(const _ in A)delete L[_];const F={...T,...L};return Object.assign(F,{extend:w(F)})}}return Object.assign(A,{extend:w(A)})}const cs=new pi(8192);function aw(e,{enabled:t=!0,id:n}){if(!t||!n)return e();if(cs.get(n))return cs.get(n);const r=e().finally(()=>cs.delete(n));return cs.set(n,r),r}function cw(e,t={}){return async(n,r={})=>{var f;const{dedupe:o=!1,methods:s,retryDelay:i=150,retryCount:c=3,uid:a}={...t,...r},{method:l}=n;if((f=s==null?void 0:s.exclude)!=null&&f.includes(l))throw new kn(new Error("method not supported"),{method:l});if(s!=null&&s.include&&!s.include.includes(l))throw new kn(new Error("method not supported"),{method:l});const u=o?Dr(`${a}.${Te(n)}`):void 0;return aw(()=>aa(async()=>{try{return await e(n)}catch(p){const d=p;switch(d.code){case Wr.code:throw new Wr(d);case Vr.code:throw new Vr(d);case Gr.code:throw new Gr(d,{method:n.method});case qr.code:throw new qr(d);case In.code:throw new In(d);case Mn.code:throw new Mn(d);case Zr.code:throw new Zr(d);case Kr.code:throw new Kr(d);case Yr.code:throw new Yr(d);case kn.code:throw new kn(d,{method:n.method});case ir.code:throw new ir(d);case Xr.code:throw new Xr(d);case ar.code:throw new ar(d);case Qr.code:throw new Qr(d);case Jr.code:throw new Jr(d);case eo.code:throw new eo(d);case to.code:throw new to(d);case no.code:throw new no(d);case ro.code:throw new ro(d);case oo.code:throw new oo(d);case so.code:throw new so(d);case io.code:throw new io(d);case ao.code:throw new ao(d);case co.code:throw new co(d);case lo.code:throw new lo(d);case 5e3:throw new ar(d);default:throw p instanceof G?p:new Cb(d)}}},{delay:({count:p,error:d})=>{var h;if(d&&d instanceof Cn){const m=(h=d==null?void 0:d.headers)==null?void 0:h.get("Retry-After");if(m!=null&&m.match(/\d/))return Number.parseInt(m)*1e3}return~~(1<<p)*i},retryCount:c,shouldRetry:({error:p})=>lw(p)}),{enabled:o,id:u})}}function lw(e){return"code"in e&&typeof e.code=="number"?e.code===-1||e.code===ir.code||e.code===In.code:e instanceof Cn&&e.status?e.status===403||e.status===408||e.status===413||e.status===429||e.status===500||e.status===502||e.status===503||e.status===504:!0}function uw({key:e,methods:t,name:n,request:r,retryCount:o=3,retryDelay:s=150,timeout:i,type:c},a){const l=Of();return{config:{key:e,methods:t,name:n,request:r,retryCount:o,retryDelay:s,timeout:i,type:c},request:cw(r,{methods:t,retryCount:o,retryDelay:s,uid:l}),value:a}}class fw extends G{constructor(){super("No URL was provided to the Transport. Please provide a valid RPC URL to the Transport.",{docsPath:"/docs/clients/intro",name:"UrlRequiredError"})}}function dw(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 pw(){return{current:0,take(){return this.current++},reset(){this.current=0}}}const Cf=pw();function hw(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:l,signal:u}=c;try{const p=await dw(async({signal:h})=>{const m={...c,body:Array.isArray(r)?Te(r.map(T=>({jsonrpc:"2.0",id:T.id??Cf.take(),...T}))):Te({jsonrpc:"2.0",id:r.id??Cf.take(),...r}),headers:{"Content-Type":"application/json",...a},method:l||"POST",signal:u||(i>0?h:null)},x=new Request(e,m),A=await(o==null?void 0:o(x,m))??{...m,url:e};return await fetch(A.url??e,A)},{errorInstance:new Ou({body:r,url:e}),timeout:i,signal:!0});s&&await s(p);let d;if((f=p.headers.get("Content-Type"))!=null&&f.startsWith("application/json"))d=await p.json();else{d=await p.text();try{d=JSON.parse(d||"{}")}catch(h){if(p.ok)throw h;d={error:d}}}if(!p.ok)throw new Cn({body:r,details:Te(d.error)||p.statusText,headers:p.headers,status:p.status,url:e});return d}catch(p){throw p instanceof Cn||p instanceof Ou?p:new Cn({body:r,cause:p,url:e})}}}}function mw(e,t={}){const{batch:n,fetchOptions:r,key:o="http",methods:s,name:i="HTTP JSON-RPC",onFetchRequest:c,onFetchResponse:a,retryDelay:l,raw:u}=t;return({chain:f,retryCount:p,timeout:d})=>{const{batchSize:h=1e3,wait:m=0}=typeof n=="object"?n:{},x=t.retryCount??p,A=d??t.timeout??1e4,w=e||(f==null?void 0:f.rpcUrls.default.http[0]);if(!w)throw new fw;const T=hw(w,{fetchOptions:r,onRequest:c,onResponse:a,timeout:A});return uw({key:o,methods:s,name:i,async request({method:B,params:L}){const F={method:B,params:L},{schedule:_}=Af({id:w,wait:m,shouldSplitBatch(k){return k.length>h},fn:k=>T.request({body:k}),sort:(k,C)=>k.id-C.id}),g=async k=>n?_(k):[await T.request({body:k})],[{error:y,result:P}]=await g(F);if(u)return{error:y,result:P};if(y)throw new Pi({body:F,error:y,url:w});return P},retryCount:x,retryDelay:l,timeout:A,type:"http"},{fetchOptions:r,url:w})}}function la(e,t){var r,o,s,i,c,a;if(!(e instanceof G))return!1;const n=e.walk(l=>l instanceof Si);return n instanceof Si?!!(((r=n.data)==null?void 0:r.errorName)==="ResolverNotFound"||((o=n.data)==null?void 0:o.errorName)==="ResolverWildcardNotSupported"||((s=n.data)==null?void 0:s.errorName)==="ResolverNotContract"||((i=n.data)==null?void 0:i.errorName)==="ResolverError"||((c=n.data)==null?void 0:c.errorName)==="HttpError"||(a=n.reason)!=null&&a.includes("Wildcard on non-extended resolvers is not supported")||t==="reverse"&&n.reason===bu[50]):!1}function gw(e){const{abi:t,data:n}=e,r=or(n,0,4),o=t.find(s=>s.type==="function"&&r===jr(gt(s)));if(!o)throw new og(r,{docsPath:"/docs/contract/decodeFunctionData"});return{functionName:o.name,args:"inputs"in o&&o.inputs&&o.inputs.length>0?Ur(o.inputs,or(n,4)):void 0}}const ua="/docs/contract/encodeErrorResult";function If(e){const{abi:t,errorName:n,args:r}=e;let o=t[0];if(n){const a=On({abi:t,args:r,name:n});if(!a)throw new kl(n,{docsPath:ua});o=a}if(o.type!=="error")throw new kl(void 0,{docsPath:ua});const s=gt(o),i=jr(s);let c="0x";if(r&&r.length>0){if(!o.inputs)throw new ng(o.name,{docsPath:ua});c=Kt(o.inputs,r)}return rr([i,c])}const fa="/docs/contract/encodeFunctionResult";function bw(e){const{abi:t,functionName:n,result:r}=e;let o=t[0];if(n){const i=On({abi:t,name:n});if(!i)throw new Yn(n,{docsPath:fa});o=i}if(o.type!=="function")throw new Yn(void 0,{docsPath:fa});if(!o.outputs)throw new Fl(o.name,{docsPath:fa});const s=(()=>{if(o.outputs.length===0)return[];if(o.outputs.length===1)return[r];if(Array.isArray(r))return r;throw new Rl(r)})();return Kt(o.outputs,s)}const ls="x-batch-gateway:true";async function Mf(e){const{data:t,ccipRequest:n}=e,{args:[r]}=gw({abi:ea,data:t}),o=[],s=[];return await Promise.all(r.map(async(i,c)=>{try{s[c]=i.urls.includes(ls)?await Mf({data:i.data,ccipRequest:n}):await n(i),o[c]=!1}catch(a){o[c]=!0,s[c]=yw(a)}})),bw({abi:ea,functionName:"query",result:[o,s]})}function yw(e){return e.name==="HttpRequestError"&&e.status?If({abi:ea,errorName:"HttpError",args:[e.status,e.shortMessage]}):If({abi:[yu],errorName:"Error",args:["shortMessage"in e?e.shortMessage:e.message]})}function kf(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 us(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=kf(n[r]),s=o?Qn(o):Ie(An(n[r]),"bytes");t=Ie(vt([t,s]),"bytes")}return $e(t)}function ww(e){return`[${e.slice(2)}]`}function vw(e){const t=new Uint8Array(32).fill(0);return e?kf(e)||Ie(An(e)):$e(t)}function fs(e){const t=e.replace(/^\.|\.$/gm,"");if(t.length===0)return new Uint8Array(1);const n=new Uint8Array(An(t).byteLength+2);let r=0;const o=t.split(".");for(let s=0;s<o.length;s++){let i=An(o[s]);i.byteLength>255&&(i=An(ww(vw(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 xw(e,t){const{blockNumber:n,blockTag:r,coinType:o,name:s,gatewayUrls:i,strict:c}=t,{chain:a}=e,l=(()=>{if(t.universalResolverAddress)return t.universalResolverAddress;if(!a)throw new Error("client chain not configured. universalResolverAddress is required.");return fr({blockNumber:n,chain:a,contract:"ensUniversalResolver"})})(),u=a==null?void 0:a.ensTlds;if(u&&!u.some(f=>s.endsWith(f)))return null;try{const f=Ct({abi:xf,functionName:"addr",...o!=null?{args:[us(s),BigInt(o)]}:{args:[us(s)]}}),p={address:l,abi:wf,functionName:"resolve",args:[Vt(fs(s)),f,i??[ls]],blockNumber:n,blockTag:r},h=await ee(e,Jt,"readContract")(p);if(h[0]==="0x")return null;const m=Bn({abi:xf,args:o!=null?[us(s),BigInt(o)]:void 0,functionName:"addr",data:h[0]});return m==="0x"||Tn(m)==="0x00"?null:m}catch(f){if(c)throw f;if(la(f,"resolve"))return null;throw f}}class Ew extends G{constructor({data:t}){super("Unable to extract image from metadata. The metadata may be malformed or invalid.",{metaMessages:["- Metadata must be a JSON object with at least an `image`, `image_url` or `image_data` property.","",`Provided data: ${JSON.stringify(t)}`],name:"EnsAvatarInvalidMetadataError"})}}class go extends G{constructor({reason:t}){super(`ENS NFT avatar URI is invalid. ${t}`,{name:"EnsAvatarInvalidNftUriError"})}}class da extends G{constructor({uri:t}){super(`Unable to resolve ENS avatar URI "${t}". The URI may be malformed, invalid, or does not respond with a valid image.`,{name:"EnsAvatarUriResolutionError"})}}class Sw extends G{constructor({namespace:t}){super(`ENS NFT avatar namespace "${t}" is not supported. Must be "erc721" or "erc1155".`,{name:"EnsAvatarUnsupportedNamespaceError"})}}const Pw=/(?<protocol>https?:\/\/[^\/]*|ipfs:\/|ipns:\/|ar:\/)?(?<root>\/)?(?<subpath>ipfs\/|ipns\/)?(?<target>[\w\-.]+)(?<subtarget>\/.*)?/,$w=/^(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>\/.*)?$/,Tw=/^data:([a-zA-Z\-/+]*);base64,([^"].*)/,Aw=/^data:([a-zA-Z\-/+]*)?(;[a-zA-Z0-9].*?)?(,)/;async function Nw(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 Bf(e,t){return e?e.endsWith("/")?e.slice(0,-1):e:t}function Lf({uri:e,gatewayUrls:t}){const n=Tw.test(e);if(n)return{uri:e,isOnChain:!0,isEncoded:n};const r=Bf(t==null?void 0:t.ipfs,"https://ipfs.io"),o=Bf(t==null?void 0:t.arweave,"https://arweave.net"),s=e.match(Pw),{protocol:i,subpath:c,target:a,subtarget:l=""}=(s==null?void 0:s.groups)||{},u=i==="ipns:/"||c==="ipns/",f=i==="ipfs:/"||c==="ipfs/"||$w.test(e);if(e.startsWith("http")&&!u&&!f){let d=e;return t!=null&&t.arweave&&(d=e.replace(/https:\/\/arweave.net/g,t==null?void 0:t.arweave)),{uri:d,isOnChain:!1,isEncoded:!1}}if((u||f)&&a)return{uri:`${r}/${u?"ipns":"ipfs"}/${a}${l}`,isOnChain:!1,isEncoded:!1};if(i==="ar:/"&&a)return{uri:`${o}/${a}${l||""}`,isOnChain:!1,isEncoded:!1};let p=e.replace(Aw,"");if(p.startsWith("<svg")&&(p=`data:image/svg+xml;base64,${btoa(p)}`),p.startsWith("data:")||p.startsWith("{"))return{uri:p,isOnChain:!0,isEncoded:!1};throw new da({uri:e})}function Df(e){if(typeof e!="object"||!("image"in e)&&!("image_url"in e)&&!("image_data"in e))throw new Ew({data:e});return e.image||e.image_url||e.image_data}async function Ow({gatewayUrls:e,uri:t}){try{const n=await fetch(t).then(o=>o.json());return await pa({gatewayUrls:e,uri:Df(n)})}catch{throw new da({uri:t})}}async function pa({gatewayUrls:e,uri:t}){const{uri:n,isOnChain:r}=Lf({uri:t,gatewayUrls:e});if(r||await Nw(n))return n;throw new da({uri:t})}function Cw(e){let t=e;t.startsWith("did:nft:")&&(t=t.replace("did:nft:","").replace(/_/g,"/"));const[n,r,o]=t.split("/"),[s,i]=n.split(":"),[c,a]=r.split(":");if(!s||s.toLowerCase()!=="eip155")throw new go({reason:"Only EIP-155 supported"});if(!i)throw new go({reason:"Chain ID not found"});if(!a)throw new go({reason:"Contract address not found"});if(!o)throw new go({reason:"Token ID not found"});if(!c)throw new go({reason:"ERC namespace not found"});return{chainID:Number.parseInt(i),namespace:c.toLowerCase(),contractAddress:a,tokenID:o}}async function Iw(e,{nft:t}){if(t.namespace==="erc721")return Jt(e,{address:t.contractAddress,abi:[{name:"tokenURI",type:"function",stateMutability:"view",inputs:[{name:"tokenId",type:"uint256"}],outputs:[{name:"",type:"string"}]}],functionName:"tokenURI",args:[BigInt(t.tokenID)]});if(t.namespace==="erc1155")return Jt(e,{address:t.contractAddress,abi:[{name:"uri",type:"function",stateMutability:"view",inputs:[{name:"_id",type:"uint256"}],outputs:[{name:"",type:"string"}]}],functionName:"uri",args:[BigInt(t.tokenID)]});throw new Sw({namespace:t.namespace})}async function Mw(e,{gatewayUrls:t,record:n}){return/eip155:/i.test(n)?kw(e,{gatewayUrls:t,record:n}):pa({uri:n,gatewayUrls:t})}async function kw(e,{gatewayUrls:t,record:n}){const r=Cw(n),o=await Iw(e,{nft:r}),{uri:s,isOnChain:i,isEncoded:c}=Lf({uri:o,gatewayUrls:t});if(i&&(s.includes("data:application/json;base64,")||s.startsWith("{"))){const l=c?atob(s.replace("data:application/json;base64,","")):s,u=JSON.parse(l);return pa({uri:Df(u),gatewayUrls:t})}let a=r.tokenID;return r.namespace==="erc1155"&&(a=a.replace("0x","").padStart(64,"0")),Ow({gatewayUrls:t,uri:s.replace(/(?:0x)?{id}/,a)})}async function Ff(e,t){const{blockNumber:n,blockTag:r,key:o,name:s,gatewayUrls:i,strict:c}=t,{chain:a}=e,l=(()=>{if(t.universalResolverAddress)return t.universalResolverAddress;if(!a)throw new Error("client chain not configured. universalResolverAddress is required.");return fr({blockNumber:n,chain:a,contract:"ensUniversalResolver"})})(),u=a==null?void 0:a.ensTlds;if(u&&!u.some(f=>s.endsWith(f)))return null;try{const f={address:l,abi:wf,functionName:"resolve",args:[Vt(fs(s)),Ct({abi:vf,functionName:"text",args:[us(s),o]}),i??[ls]],blockNumber:n,blockTag:r},d=await ee(e,Jt,"readContract")(f);if(d[0]==="0x")return null;const h=Bn({abi:vf,functionName:"text",data:d[0]});return h===""?null:h}catch(f){if(c)throw f;if(la(f,"resolve"))return null;throw f}}async function Bw(e,{blockNumber:t,blockTag:n,assetGatewayUrls:r,name:o,gatewayUrls:s,strict:i,universalResolverAddress:c}){const a=await ee(e,Ff,"getEnsText")({blockNumber:t,blockTag:n,key:"avatar",name:o,universalResolverAddress:c,gatewayUrls:s,strict:i});if(!a)return null;try{return await Mw(e,{record:a,gatewayUrls:r})}catch{return null}}async function Lw(e,{address:t,blockNumber:n,blockTag:r,gatewayUrls:o,strict:s,universalResolverAddress:i}){let c=i;if(!c){if(!e.chain)throw new Error("client chain not configured. universalResolverAddress is required.");c=fr({blockNumber:n,chain:e.chain,contract:"ensUniversalResolver"})}const a=`${t.toLowerCase().substring(2)}.addr.reverse`;try{const l={address:c,abi:_y,functionName:"reverse",args:[Vt(fs(a))],blockNumber:n,blockTag:r},u=ee(e,Jt,"readContract"),[f,p]=o?await u({...l,args:[...l.args,o]}):await u(l);return t.toLowerCase()!==p.toLowerCase()?null:f}catch(l){if(s)throw l;if(la(l,"reverse"))return null;throw l}}async function Dw(e,t){const{blockNumber:n,blockTag:r,name:o}=t,{chain:s}=e,i=(()=>{if(t.universalResolverAddress)return t.universalResolverAddress;if(!s)throw new Error("client chain not configured. universalResolverAddress is required.");return fr({blockNumber:n,chain:s,contract:"ensUniversalResolver"})})(),c=s==null?void 0:s.ensTlds;if(c&&!c.some(l=>o.endsWith(l)))throw new Error(`${o} is not a valid ENS TLD (${c==null?void 0:c.join(", ")}) for chain "${s.name}" (id: ${s.id}).`);const[a]=await ee(e,Jt,"readContract")({address:i,abi:[{inputs:[{type:"bytes"}],name:"findResolver",outputs:[{type:"address"},{type:"bytes32"}],stateMutability:"view",type:"function"}],functionName:"findResolver",args:[Vt(fs(o))],blockNumber:n,blockTag:r});return a}async function Rf(e,t){var x,A,w;const{account:n=e.account,blockNumber:r,blockTag:o="latest",blobs:s,data:i,gas:c,gasPrice:a,maxFeePerBlobGas:l,maxFeePerGas:u,maxPriorityFeePerGas:f,to:p,value:d,...h}=t,m=n?xt(n):void 0;try{uo(t);const B=(typeof r=="bigint"?J(r):void 0)||o,L=(w=(A=(x=e.chain)==null?void 0:x.formatters)==null?void 0:A.transactionRequest)==null?void 0:w.format,_=(L||Jo)({...Bi(h,{format:L}),from:m==null?void 0:m.address,blobs:s,data:i,gas:c,gasPrice:a,maxFeePerBlobGas:l,maxFeePerGas:u,maxPriorityFeePerGas:f,to:p,value:d}),g=await e.request({method:"eth_createAccessList",params:[_,B]});return{accessList:g.accessList,gasUsed:BigInt(g.gasUsed)}}catch(T){throw $f(T,{...t,account:m,chain:e.chain})}}async function Fw(e){const t=qo(e,{method:"eth_newBlockFilter"}),n=await e.request({method:"eth_newBlockFilter"});return{id:n,request:t(n),type:"block"}}async function jf(e,{address:t,args:n,event:r,events:o,fromBlock:s,strict:i,toBlock:c}={}){const a=o??(r?[r]:void 0),l=qo(e,{method:"eth_newFilter"});let u=[];a&&(u=[a.flatMap(d=>_r({abi:[d],eventName:d.name,args:n}))],r&&(u=u[0]));const f=await e.request({method:"eth_newFilter",params:[{address:t,fromBlock:typeof s=="bigint"?J(s):s,toBlock:typeof c=="bigint"?J(c):c,...u.length?{topics:u}:{}}]});return{abi:a,args:n,eventName:r?r.name:void 0,fromBlock:s,id:f,request:l(f),strict:!!i,toBlock:c,type:"event"}}async function _f(e){const t=qo(e,{method:"eth_newPendingTransactionFilter"}),n=await e.request({method:"eth_newPendingTransactionFilter"});return{id:n,request:t(n),type:"transaction"}}async function Rw(e){const t=await e.request({method:"eth_blobBaseFee"});return BigInt(t)}async function jw(e,{blockHash:t,blockNumber:n,blockTag:r="latest"}={}){const o=n!==void 0?J(n):void 0;let s;return t?s=await e.request({method:"eth_getBlockTransactionCountByHash",params:[t]},{dedupe:!0}):s=await e.request({method:"eth_getBlockTransactionCountByNumber",params:[o||r]},{dedupe:!!o}),Wt(s)}async function Uf(e,{address:t,blockNumber:n,blockTag:r="latest"}){const o=n!==void 0?J(n):void 0,s=await e.request({method:"eth_getCode",params:[t,o||r]},{dedupe:!!o});if(s!=="0x")return s}class _w extends G{constructor({address:t}){super(`No EIP-712 domain found on contract "${t}".`,{metaMessages:["Ensure that:",`- The contract is deployed at the address "${t}".`,"- `eip712Domain()` function exists on the contract.","- `eip712Domain()` function matches signature to ERC-5267 specification."],name:"Eip712DomainNotFoundError"})}}async function Uw(e,t){const{address:n,factory:r,factoryData:o}=t;try{const[s,i,c,a,l,u,f]=await ee(e,Jt,"readContract")({abi:zw,address:n,functionName:"eip712Domain",factory:r,factoryData:o});return{domain:{name:i,version:c,chainId:Number(a),verifyingContract:l,salt:u},extensions:f,fields:s}}catch(s){const i=s;throw i.name==="ContractFunctionExecutionError"&&i.cause.name==="ContractFunctionZeroDataError"?new _w({address:n}):i}}const zw=[{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 Hw(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 Ww(e,{blockCount:t,blockNumber:n,blockTag:r="latest",rewardPercentiles:o}){const s=typeof n=="bigint"?J(n):void 0,i=await e.request({method:"eth_feeHistory",params:[J(t),s||r,o]},{dedupe:!!s});return Hw(i)}async function Vw(e,{filter:t}){const n=t.strict??!1,o=(await t.request({method:"eth_getFilterLogs",params:[t.id]})).map(s=>Xt(s));return t.abi?zi({abi:t.abi,logs:o,strict:n}):o}class Gw extends G{constructor({callbackSelector:t,cause:n,data:r,extraData:o,sender:s,urls:i}){var c;super(n.shortMessage||"An error occurred while fetching for an offchain result.",{cause:n,metaMessages:[...n.metaMessages||[],(c=n.metaMessages)!=null&&c.length?"":[],"Offchain Gateway Call:",i&&[" Gateway URL(s):",...i.map(a=>` ${Hr(a)}`)],` Sender: ${s}`,` Data: ${r}`,` Callback selector: ${t}`,` Extra data: ${o}`].flat(),name:"OffchainLookupError"})}}class qw extends G{constructor({result:t,url:n}){super("Offchain gateway response is malformed. Response data must be a hex value.",{metaMessages:[`Gateway URL: ${Hr(n)}`,`Response: ${Te(t)}`],name:"OffchainLookupResponseMalformedError"})}}class Zw extends G{constructor({sender:t,to:n}){super("Reverted sender address does not match target contract address (`to`).",{metaMessages:[`Contract address: ${n}`,`OffchainLookup sender address: ${t}`],name:"OffchainLookupSenderMismatchError"})}}const Kw="0x556f1830",zf={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 Yw(e,{blockNumber:t,blockTag:n,data:r,to:o}){const{args:s}=Eu({data:r,abi:[zf]}),[i,c,a,l,u]=s,{ccipRead:f}=e,p=f&&typeof(f==null?void 0:f.request)=="function"?f.request:Hf;try{if(!es(o,i))throw new Zw({sender:i,to:o});const d=c.includes(ls)?await Mf({data:a,ccipRequest:p}):await p({data:a,sender:i,urls:c}),{data:h}=await po(e,{blockNumber:t,blockTag:n,data:vt([l,Kt([{type:"bytes"},{type:"bytes"}],[d,u])]),to:o});return h}catch(d){throw new Gw({callbackSelector:l,cause:d,data:r,extraData:u,sender:i,urls:c})}}async function Hf({data:e,sender:t,urls:n}){var o;let r=new Error("An unknown error occurred.");for(let s=0;s<n.length;s++){const i=n[s],c=i.includes("{data}")?"GET":"POST",a=c==="POST"?{data:e,sender:t}:void 0,l=c==="POST"?{"Content-Type":"application/json"}:{};try{const u=await fetch(i.replace("{sender}",t.toLowerCase()).replace("{data}",e),{body:JSON.stringify(a),headers:l,method:c});let f;if((o=u.headers.get("Content-Type"))!=null&&o.startsWith("application/json")?f=(await u.json()).data:f=await u.text(),!u.ok){r=new Cn({body:a,details:f!=null&&f.error?Te(f.error):u.statusText,headers:u.headers,status:u.status,url:i});continue}if(!bt(f)){r=new qw({result:f,url:i});continue}return f}catch(u){r=new Cn({body:a,details:u.message,url:i})}}throw r}const Xw=Object.freeze(Object.defineProperty({__proto__:null,ccipRequest:Hf,offchainLookup:Yw,offchainLookupAbiItem:zf,offchainLookupSignature:Kw},Symbol.toStringTag,{value:"Module"}));function Qw(e){return{formatters:void 0,fees:void 0,serializers:void 0,...e}}class Jw extends G{constructor({domain:t}){super(`Invalid domain "${Te(t)}".`,{metaMessages:["Must be a valid EIP-712 domain."]})}}class e1 extends G{constructor({primaryType:t,types:n}){super(`Invalid primary type \`${t}\` must be one of \`${JSON.stringify(Object.keys(n))}\`.`,{docsPath:"/api/glossary/Errors#typeddatainvalidprimarytypeerror",metaMessages:["Check that the primary type is a key in `types`."]})}}class t1 extends G{constructor({type:t}){super(`Struct type "${t}" is invalid.`,{metaMessages:["Struct type must not be a Solidity type."],name:"InvalidStructTypeError"})}}function n1(e){const{domain:t={},message:n,primaryType:r}=e,o={EIP712Domain:a1({domain:t}),...e.types};i1({domain:t,message:n,primaryType:r,types:o});const s=["0x1901"];return t&&s.push(r1({domain:t,types:o})),r!=="EIP712Domain"&&s.push(Wf({data:n,primaryType:r,types:o})),Ie(vt(s))}function r1({domain:e,types:t}){return Wf({data:e,primaryType:"EIP712Domain",types:t})}function Wf({data:e,primaryType:t,types:n}){const r=Vf({data:e,primaryType:t,types:n});return Ie(r)}function Vf({data:e,primaryType:t,types:n}){const r=[{type:"bytes32"}],o=[o1({primaryType:t,types:n})];for(const s of n[t]){const[i,c]=qf({types:n,name:s.name,type:s.type,value:e[s.name]});r.push(i),o.push(c)}return Kt(r,o)}function o1({primaryType:e,types:t}){const n=Vt(s1({primaryType:e,types:t}));return Ie(n)}function s1({primaryType:e,types:t}){let n="";const r=Gf({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 Gf({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])Gf({primaryType:s.type,types:t},n);return n}function qf({types:e,name:t,type:n,value:r}){if(e[n]!==void 0)return[{type:"bytes32"},Ie(Vf({data:r,primaryType:n,types:e}))];if(n==="bytes")return r=`0x${(r.length%2?"0":"")+r.slice(2)}`,[{type:"bytes32"},Ie(r)];if(n==="string")return[{type:"bytes32"},Ie(Vt(r))];if(n.lastIndexOf("]")===n.length-1){const o=n.slice(0,n.lastIndexOf("[")),s=r.map(i=>qf({name:t,type:o,types:e,value:i}));return[{type:"bytes32"},Ie(Kt(s.map(([i])=>i),s.map(([,i])=>i)))]}return[{type:n},r]}function i1(e){const{domain:t,message:n,primaryType:r,types:o}=e,s=(i,c)=>{for(const a of i){const{name:l,type:u}=a,f=c[l],p=u.match(fu);if(p&&(typeof f=="number"||typeof f=="bigint")){const[m,x,A]=p;J(f,{signed:x==="int",size:Number.parseInt(A)/8})}if(u==="address"&&typeof f=="string"&&!tt(f))throw new pn({address:f});const d=u.match(Zg);if(d){const[m,x]=d;if(x&&xe(f)!==Number.parseInt(x))throw new ig({expectedSize:Number.parseInt(x),givenSize:xe(f)})}const h=o[u];h&&(c1(u),s(h,f))}};if(o.EIP712Domain&&t){if(typeof t!="object")throw new Jw({domain:t});s(o.EIP712Domain,t)}if(r!=="EIP712Domain")if(o[r])s(o[r],n);else throw new e1({primaryType:r,types:o})}function a1({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 c1(e){if(e==="address"||e==="bool"||e==="string"||e.startsWith("bytes")||e.startsWith("uint")||e.startsWith("int"))throw new t1({type:e})}const l1=`Ethereum Signed Message:
80
+ `;function u1(e){const t=typeof e=="string"?Dr(e):typeof e.raw=="string"?e.raw:$e(e.raw),n=Dr(`${l1}${xe(t)}`);return vt([n,t])}function Zf(e,t){return Ie(u1(e),t)}const Kf="0x6492649264926492649264926492649264926492649264926492649264926492";function f1(e){return uu(e,-32)===Kf}function d1(e){const{address:t,data:n,signature:r,to:o="hex"}=e,s=rr([Kt([{type:"address"},{type:"bytes"},{type:"bytes"}],[t,n,r]),Kf]);return o==="hex"?s:wt(s)}class p1 extends G{constructor({value:t}){super(`Number \`${t}\` is not a valid decimal number.`,{name:"InvalidDecimalNumberError"})}}function h1(e,t){if(!/^(-?)([0-9]*)\.?([0-9]*)$/.test(e))throw new p1({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 m1(e){return e.map(t=>({...t,value:BigInt(t.value)}))}function g1(e){return{...e,balance:e.balance?BigInt(e.balance):void 0,nonce:e.nonce?Wt(e.nonce):void 0,storageProof:e.storageProof?m1(e.storageProof):void 0}}async function b1(e,{address:t,blockNumber:n,blockTag:r,storageKeys:o}){const s=r??"latest",i=n!==void 0?J(n):void 0,c=await e.request({method:"eth_getProof",params:[t,o,i||s]});return g1(c)}async function y1(e,{address:t,blockNumber:n,blockTag:r="latest",slot:o}){const s=n!==void 0?J(n):void 0;return await e.request({method:"eth_getStorageAt",params:[t,o,s||r]})}async function ha(e,{blockHash:t,blockNumber:n,blockTag:r,hash:o,index:s}){var u,f,p;const i=r||"latest",c=n!==void 0?J(n):void 0;let a=null;if(o?a=await e.request({method:"eth_getTransactionByHash",params:[o]},{dedupe:!0}):t?a=await e.request({method:"eth_getTransactionByBlockHashAndIndex",params:[t,J(s)]},{dedupe:!0}):a=await e.request({method:"eth_getTransactionByBlockNumberAndIndex",params:[c||i,J(s)]},{dedupe:!!c}),!a)throw new Tu({blockHash:t,blockNumber:n,blockTag:i,hash:o,index:s});return(((p=(f=(u=e.chain)==null?void 0:u.formatters)==null?void 0:f.transaction)==null?void 0:p.format)||Ru)(a)}async function w1(e,{hash:t,transactionReceipt:n}){const[r,o]=await Promise.all([ee(e,mo,"getBlockNumber")({}),t?ee(e,ha,"getTransaction")({hash:t}):void 0]),s=(n==null?void 0:n.blockNumber)||(o==null?void 0:o.blockNumber);return s?r-s+1n:0n}async function ds(e,{hash:t}){var o,s,i;const n=await e.request({method:"eth_getTransactionReceipt",params:[t]},{dedupe:!0});if(!n)throw new Au({hash:t});return(((i=(s=(o=e.chain)==null?void 0:o.formatters)==null?void 0:s.transactionReceipt)==null?void 0:i.format)||sw)(n)}async function v1(e,t){var A;const{account:n,allowFailure:r=!0,batchSize:o,blockNumber:s,blockTag:i,multicallAddress:c,stateOverride:a}=t,l=t.contracts,u=o??(typeof((A=e.batch)==null?void 0:A.multicall)=="object"&&e.batch.multicall.batchSize||1024);let f=c;if(!f){if(!e.chain)throw new Error("client chain not configured. multicallAddress is required.");f=fr({blockNumber:s,chain:e.chain,contract:"multicall3"})}const p=[[]];let d=0,h=0;for(let w=0;w<l.length;w++){const{abi:T,address:B,args:L,functionName:F}=l[w];try{const _=Ct({abi:T,args:L,functionName:F});h+=(_.length-2)/2,u>0&&h>u&&p[d].length>0&&(d++,h=(_.length-2)/2,p[d]=[]),p[d]=[...p[d],{allowFailure:!0,callData:_,target:B}]}catch(_){const g=cr(_,{abi:T,address:B,args:L,docsPath:"/docs/contract/multicall",functionName:F,sender:n});if(!r)throw g;p[d]=[...p[d],{allowFailure:!0,callData:"0x",target:B}]}}const m=await Promise.allSettled(p.map(w=>ee(e,Jt,"readContract")({abi:Ji,account:n,address:f,args:[w],blockNumber:s,blockTag:i,functionName:"aggregate3",stateOverride:a}))),x=[];for(let w=0;w<m.length;w++){const T=m[w];if(T.status==="rejected"){if(!r)throw T.reason;for(let L=0;L<p[w].length;L++)x.push({status:"failure",error:T.reason,result:void 0});continue}const B=T.value;for(let L=0;L<B.length;L++){const{returnData:F,success:_}=B[L],{callData:g}=p[w][L],{abi:y,address:P,functionName:k,args:C}=l[x.length];try{if(g==="0x")throw new Br;if(!_)throw new Ko({data:F});const $=Bn({abi:y,args:C,data:F,functionName:k});x.push(r?{result:$,status:"success"}:$)}catch($){const S=cr($,{abi:y,address:P,args:C,docsPath:"/docs/contract/multicall",functionName:k});if(!r)throw S;x.push({error:S,result:void 0,status:"failure"})}}}if(x.length!==l.length)throw new G("multicall results mismatch");return x}async function ma(e,t){const{blockNumber:n,blockTag:r=e.experimental_blockTag??"latest",blocks:o,returnFullTransactions:s,traceTransfers:i,validation:c}=t;try{const a=[];for(const p of o){const d=p.blockOverrides?bf(p.blockOverrides):void 0,h=p.calls.map(x=>{const A=x,w=A.account?xt(A.account):void 0,T=A.abi?Ct(A):A.data,B={...A,data:A.dataSuffix?vt([T||"0x",A.dataSuffix]):T,from:A.from??(w==null?void 0:w.address)};return uo(B),Jo(B)}),m=p.stateOverrides?Li(p.stateOverrides):void 0;a.push({blockOverrides:d,calls:h,stateOverrides:m})}const u=(typeof n=="bigint"?J(n):void 0)||r;return(await e.request({method:"eth_simulateV1",params:[{blockStateCalls:a,returnFullTransactions:s,traceTransfers:i,validation:c},u]})).map((p,d)=>({...ju(p),calls:p.calls.map((h,m)=>{var P,k;const{abi:x,args:A,functionName:w,to:T}=o[d].calls[m],B=((P=h.error)==null?void 0:P.data)??h.returnData,L=BigInt(h.gasUsed),F=(k=h.logs)==null?void 0:k.map(C=>Xt(C)),_=h.status==="0x1"?"success":"failure",g=x&&_==="success"&&B!=="0x"?Bn({abi:x,data:B,functionName:w}):null,y=(()=>{var $;if(_==="success")return;let C;if((($=h.error)==null?void 0:$.data)==="0x"?C=new Br:h.error&&(C=new Ko(h.error)),!!C)return cr(C,{abi:x??[],address:T??"0x",args:A,functionName:w??"<unknown>"})})();return{data:B,gasUsed:L,logs:F,status:_,..._==="success"?{result:g}:{error:y}}})}))}catch(a){const l=a,u=ki(l,{});throw u instanceof Qo?l:u}}function Yf(e,t={}){const{as:n=typeof e=="string"?"Hex":"Bytes"}=t,r=su(Ty(e));return n==="Bytes"?r:df(r)}class x1 extends Map{constructor(t){super(),Object.defineProperty(this,"maxSize",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.maxSize=t}get(t){const n=super.get(t);return super.has(t)&&n!==void 0&&(this.delete(t),super.set(t,n)),n}set(t,n){if(super.set(t,n),this.maxSize&&this.size>this.maxSize){const r=this.keys().next().value;r&&this.delete(r)}return this}}const ga={checksum:new x1(8192)}.checksum,E1=/^0x[a-fA-F0-9]{40}$/;function ps(e,t={}){const{strict:n=!0}=t;if(!E1.test(e))throw new Xf({address:e,cause:new P1});if(n){if(e.toLowerCase()===e)return;if(S1(e)!==e)throw new Xf({address:e,cause:new $1})}}function S1(e){if(ga.has(e))return ga.get(e);ps(e,{strict:!1});const t=e.substring(2).toLowerCase(),n=Yf(Oy(t),{as:"Bytes"}),r=t.split("");for(let s=0;s<40;s+=2)n[s>>1]>>4>=8&&r[s]&&(r[s]=r[s].toUpperCase()),(n[s>>1]&15)>=8&&r[s+1]&&(r[s+1]=r[s+1].toUpperCase());const o=`0x${r.join("")}`;return ga.set(e,o),o}function ba(e,t={}){const{strict:n=!0}=t??{};try{return ps(e,{strict:n}),!0}catch{return!1}}class Xf 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 P1 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 $1 extends be{constructor(){super("Address does not match its checksum counterpart."),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Address.InvalidChecksumError"})}}function ya(e){let t=!0,n="",r=0,o="",s=!1;for(let i=0;i<e.length;i++){const c=e[i];if(["(",")",","].includes(c)&&(t=!0),c==="("&&r++,c===")"&&r--,!!t){if(r===0){if(c===" "&&["event","function","error",""].includes(o))o="";else if(o+=c,c===")"){s=!0;break}continue}if(c===" "){e[i-1]!==","&&n!==","&&n!==",("&&(n="",t=!1);continue}o+=c,n+=c}}if(!s)throw new be("Unable to normalize signature.");return o}function wa(e,t){const n=typeof e,r=t.type;switch(r){case"address":return ba(e,{strict:!1});case"bool":return n==="boolean";case"function":return n==="string";case"string":return n==="string";default:return r==="tuple"&&"components"in t?Object.values(t.components).every((o,s)=>wa(Object.values(e)[s],o)):/^u?int(8|16|24|32|40|48|56|64|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256)?$/.test(r)?n==="number"||n==="bigint":/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/.test(r)?n==="string"||e instanceof Uint8Array:/[a-z]+[1-9]{0,3}(\[[0-9]{0,}\])+$/.test(r)?Array.isArray(e)&&e.every(o=>wa(o,{...t,type:r.replace(/(\[[0-9]{0,}\])$/,"")})):!1}}function Qf(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 Qf(o.components,s.components,n[r]);const i=[o.type,s.type];if(i.includes("address")&&i.includes("bytes20")?!0:i.includes("address")&&i.includes("string")?ba(n[r],{strict:!1}):i.includes("address")&&i.includes("bytes")?ba(n[r],{strict:!1}):!1)return i}}function Jf(e,t={}){const{prepare:n=!0}=t,r=Array.isArray(e)||typeof e=="string"?Nl(e):e;return{...r,...n?{hash:dr(r)}:{}}}function T1(e,t,n){const{args:r=[],prepare:o=!0}=n??{},s=Dy(t,{strict:!1}),i=e.filter(l=>s?l.type==="function"||l.type==="error"?ed(l)===Qi(t,0,4):l.type==="event"?dr(l)===t:!1:"name"in l&&l.name===t);if(i.length===0)throw new va({name:t});if(i.length===1)return{...i[0],...o?{hash:dr(i[0])}:{}};let c;for(const l of i){if(!("inputs"in l))continue;if(!r||r.length===0){if(!l.inputs||l.inputs.length===0)return{...l,...o?{hash:dr(l)}:{}};continue}if(!l.inputs||l.inputs.length===0||l.inputs.length!==r.length)continue;if(r.every((f,p)=>{const d="inputs"in l&&l.inputs[p];return d?wa(f,d):!1})){if(c&&"inputs"in c&&c.inputs){const f=Qf(l.inputs,c.inputs,r);if(f)throw new N1({abiItem:l,type:f[0]},{abiItem:c,type:f[1]})}c=l}}const a=(()=>{if(c)return c;const[l,...u]=i;return{...l,overloads:u}})();if(!a)throw new va({name:t});return{...a,...o?{hash:dr(a)}:{}}}function ed(e){return Qi(dr(e),0,4)}function A1(e){const t=typeof e=="string"?e:Ro(e);return ya(t)}function dr(e){return typeof e!="string"&&"hash"in e&&e.hash?e.hash:Yf(Xi(A1(e)))}class N1 extends be{constructor(t,n){super("Found ambiguous types in overloaded ABI Items.",{metaMessages:[`\`${t.type}\` in \`${ya(Ro(t.abiItem))}\`, and`,`\`${n.type}\` in \`${ya(Ro(n.abiItem))}\``,"","These types encode differently and cannot be distinguished at runtime.","Remove one of the ambiguous items in the ABI."]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiItem.AmbiguityError"})}}class va extends be{constructor({name:t,data:n,type:r="item"}){const o=t?` with name "${t}"`:n?` with data "${n}"`:"";super(`ABI ${r}${o} not found.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiItem.NotFoundError"})}}const O1=/^(.*)\[([0-9]*)\]$/,C1=/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/,td=/^(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 I1({checksumAddress:e,parameters:t,values:n}){const r=[];for(let o=0;o<t.length;o++)r.push(xa({checksumAddress:e,parameter:t[o],value:n[o]}));return r}function xa({checksumAddress:e=!1,parameter:t,value:n}){const r=t,o=j1(r.type);if(o){const[s,i]=o;return k1(n,{checksumAddress:e,length:s,parameter:{...r,type:i}})}if(r.type==="tuple")return R1(n,{checksumAddress:e,parameter:r});if(r.type==="address")return M1(n,{checksum:e});if(r.type==="bool")return L1(n);if(r.type.startsWith("uint")||r.type.startsWith("int")){const s=r.type.startsWith("int"),[,,i="256"]=td.exec(r.type)??[];return D1(n,{signed:s,size:Number(i)})}if(r.type.startsWith("bytes"))return B1(n,{type:r.type});if(r.type==="string")return F1(n);throw new sd(r.type)}function Ea(e){let t=0;for(let s=0;s<e.length;s++){const{dynamic:i,encoded:c}=e[s];i?t+=32:t+=nt(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+=nt(c)):n.push(c)}return Mt(...n,...r)}function M1(e,t){const{checksum:n=!1}=t;return ps(e,{strict:n}),{dynamic:!1,encoded:Dn(e.toLowerCase())}}function k1(e,t){const{checksumAddress:n,length:r,parameter:o}=t,s=r===null;if(!Array.isArray(e))throw new U1(e);if(!s&&e.length!==r)throw new _1({expectedLength:r,givenLength:e.length,type:`${o.type}[${r}]`});let i=!1;const c=[];for(let a=0;a<e.length;a++){const l=xa({checksumAddress:n,parameter:o,value:e[a]});l.dynamic&&(i=!0),c.push(l)}if(s||i){const a=Ea(c);if(s){const l=Be(c.length,{size:32});return{dynamic:!0,encoded:c.length>0?Mt(l,a):l}}if(i)return{dynamic:!0,encoded:a}}return{dynamic:!1,encoded:Mt(...c.map(({encoded:a})=>a))}}function B1(e,{type:t}){const[,n]=t.split("bytes"),r=nt(e);if(!n){let o=e;return r%32!==0&&(o=Fn(o,Math.ceil((e.length-2)/2/32)*32)),{dynamic:!0,encoded:Mt(Dn(Be(r,{size:32})),o)}}if(r!==Number.parseInt(n))throw new rd({expectedSize:Number.parseInt(n),value:e});return{dynamic:!1,encoded:Fn(e)}}function L1(e){if(typeof e!="boolean")throw new be(`Invalid boolean value: "${e}" (type: ${typeof e}). Expected: \`true\` or \`false\`.`);return{dynamic:!1,encoded:Dn(ff(e))}}function D1(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 pf({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 F1(e){const t=Xi(e),n=Math.ceil(nt(t)/32),r=[];for(let o=0;o<n;o++)r.push(Fn(Qi(t,o*32,(o+1)*32)));return{dynamic:!0,encoded:Mt(Fn(Be(nt(t),{size:32})),...r)}}function R1(e,t){const{checksumAddress:n,parameter:r}=t;let o=!1;const s=[];for(let i=0;i<r.components.length;i++){const c=r.components[i],a=Array.isArray(e)?i:c.name,l=xa({checksumAddress:n,parameter:c,value:e[a]});s.push(l),l.dynamic&&(o=!0)}return{dynamic:o,encoded:o?Ea(s):Mt(...s.map(({encoded:i})=>i))}}function j1(e){const t=e.match(/^(.*)\[(\d+)?\]$/);return t?[t[2]?Number(t[2]):null,t[1]]:void 0}function nd(e,t,n){const{checksumAddress:r=!1}={};if(e.length!==t.length)throw new od({expectedLength:e.length,givenLength:t.length});const o=I1({checksumAddress:r,parameters:e,values:t}),s=Ea(o);return s.length===0?"0x":s}function Sa(e,t){if(e.length!==t.length)throw new od({expectedLength:e.length,givenLength:t.length});const n=[];for(let r=0;r<e.length;r++){const o=e[r],s=t[r];n.push(Sa.encode(o,s))}return Mt(...n)}(function(e){function t(n,r,o=!1){if(n==="address"){const a=r;return ps(a),Dn(a.toLowerCase(),o?32:0)}if(n==="string")return Xi(r);if(n==="bytes")return r;if(n==="bool")return Dn(ff(r),o?32:1);const s=n.match(td);if(s){const[a,l,u="256"]=s,f=Number.parseInt(u)/8;return Be(r,{size:o?32:f,signed:l==="int"})}const i=n.match(C1);if(i){const[a,l]=i;if(Number.parseInt(l)!==(r.length-2)/2)throw new rd({expectedSize:Number.parseInt(l),value:r});return Fn(r,o?32:0)}const c=n.match(O1);if(c&&Array.isArray(r)){const[a,l]=c,u=[];for(let f=0;f<r.length;f++)u.push(t(l,r[f],!0));return u.length===0?"0x":Mt(...u)}throw new sd(n)}e.encode=t})(Sa||(Sa={}));class _1 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 rd extends be{constructor({expectedSize:t,value:n}){super(`Size of bytes "${n}" (bytes${nt(n)}) does not match expected size (bytes${t}).`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiParameters.BytesSizeMismatchError"})}}class od extends be{constructor({expectedLength:t,givenLength:n}){super(["ABI encoding parameters/values length mismatch.",`Expected length (parameters): ${t}`,`Given length (values): ${n}`].join(`
81
+ `)),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiParameters.LengthMismatchError"})}}class U1 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 sd 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 z1(e,t){var o;const{bytecode:n,args:r}=t;return Mt(n,(o=e.inputs)!=null&&o.length&&(r!=null&&r.length)?nd(e.inputs,r):"0x")}function H1(e){return Jf(e)}function W1(e,...t){const{overloads:n}=e,r=n?V1([e,...n],e.name,{args:t[0]}):e,o=G1(r),s=t.length>0?nd(r.inputs,t[0]):void 0;return s?Mt(o,s):o}function pr(e,t={}){return Jf(e,t)}function V1(e,t,n){const r=T1(e,t,n);if(r.type!=="function")throw new va({name:t,type:"function"});return r}function G1(e){return ed(e)}const q1="0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",kt="0x0000000000000000000000000000000000000000",Z1="0x6080604052348015600e575f80fd5b5061016d8061001c5f395ff3fe608060405234801561000f575f80fd5b5060043610610029575f3560e01c8063f8b2cb4f1461002d575b5f80fd5b610047600480360381019061004291906100db565b61005d565b604051610054919061011e565b60405180910390f35b5f8173ffffffffffffffffffffffffffffffffffffffff16319050919050565b5f80fd5b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f6100aa82610081565b9050919050565b6100ba816100a0565b81146100c4575f80fd5b50565b5f813590506100d5816100b1565b92915050565b5f602082840312156100f0576100ef61007d565b5b5f6100fd848285016100c7565b91505092915050565b5f819050919050565b61011881610106565b82525050565b5f6020820190506101315f83018461010f565b9291505056fea26469706673582212203b9fe929fe995c7cf9887f0bdba8a36dd78e8b73f149b17d2d9ad7cd09d2dc6264736f6c634300081a0033";async function K1(e,t){const{blockNumber:n,blockTag:r,calls:o,stateOverrides:s,traceAssetChanges:i,traceTransfers:c,validation:a}=t,l=t.account?xt(t.account):void 0;if(i&&!l)throw new G("`account` is required when `traceAssetChanges` is true");const u=l?z1(H1("constructor(bytes, bytes)"),{bytecode:Sf,args:[Z1,W1(pr("function getBalance(address)"),[l.address])]}):void 0,f=i?await Promise.all(t.calls.map(async b=>{if(!b.data&&!b.abi)return;const{accessList:M}=await Rf(e,{account:l.address,...b,data:b.abi?Ct(b):b.data});return M.map(({address:R,storageKeys:U})=>U.length>0?R:null)})).then(b=>b.flat().filter(Boolean)):[],p=await ma(e,{blockNumber:n,blockTag:r,blocks:[...i?[{calls:[{data:u}],stateOverrides:s},{calls:f.map((b,M)=>({abi:[pr("function balanceOf(address) returns (uint256)")],functionName:"balanceOf",args:[l.address],to:b,from:kt,nonce:M})),stateOverrides:[{address:kt,nonce:0}]}]:[],{calls:[...o,{}].map(b=>({...b,from:l==null?void 0:l.address})),stateOverrides:s},...i?[{calls:[{data:u}]},{calls:f.map((b,M)=>({abi:[pr("function balanceOf(address) returns (uint256)")],functionName:"balanceOf",args:[l.address],to:b,from:kt,nonce:M})),stateOverrides:[{address:kt,nonce:0}]},{calls:f.map((b,M)=>({to:b,abi:[pr("function decimals() returns (uint256)")],functionName:"decimals",from:kt,nonce:M})),stateOverrides:[{address:kt,nonce:0}]},{calls:f.map((b,M)=>({to:b,abi:[pr("function tokenURI(uint256) returns (string)")],functionName:"tokenURI",args:[0n],from:kt,nonce:M})),stateOverrides:[{address:kt,nonce:0}]},{calls:f.map((b,M)=>({to:b,abi:[pr("function symbol() returns (string)")],functionName:"symbol",from:kt,nonce:M})),stateOverrides:[{address:kt,nonce:0}]}]:[]],traceTransfers:c,validation:a}),d=i?p[2]:p[0],[h,m,,x,A,w,T,B]=i?p:[],{calls:L,...F}=d,_=L.slice(0,-1)??[],g=(h==null?void 0:h.calls)??[],y=(m==null?void 0:m.calls)??[],P=[...g,...y].map(b=>b.status==="success"?Nt(b.data):null),k=(x==null?void 0:x.calls)??[],C=(A==null?void 0:A.calls)??[],$=[...k,...C].map(b=>b.status==="success"?Nt(b.data):null),S=((w==null?void 0:w.calls)??[]).map(b=>b.status==="success"?b.result:null),E=((B==null?void 0:B.calls)??[]).map(b=>b.status==="success"?b.result:null),O=((T==null?void 0:T.calls)??[]).map(b=>b.status==="success"?b.result:null),N=[];for(const[b,M]of $.entries()){const R=P[b];if(typeof M!="bigint"||typeof R!="bigint")continue;const U=S[b-1],j=E[b-1],W=O[b-1],K=b===0?{address:q1,decimals:18,symbol:"ETH"}:{address:f[b-1],decimals:W||U?Number(U??1):void 0,symbol:j??void 0};N.some(V=>V.token.address===K.address)||N.push({token:K,value:{pre:R,post:M,diff:M-R}})}return{assetChanges:N,block:F,results:_}}class id extends fi{constructor(t,n){super(),this.finished=!1,this.destroyed=!1,Gl(t);const r=Wo(n);if(this.iHash=t.create(),typeof this.iHash.update!="function")throw new Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;const o=this.blockLen,s=new Uint8Array(o);s.set(r.length>o?t.create().update(r).digest():r);for(let i=0;i<s.length;i++)s[i]^=54;this.iHash.update(s),this.oHash=t.create();for(let i=0;i<s.length;i++)s[i]^=106;this.oHash.update(s),tr(s)}update(t){return er(this),this.iHash.update(t),this}digestInto(t){er(this),qt(t,this.outputLen),this.finished=!0,this.iHash.digestInto(t),this.oHash.update(t),this.oHash.digestInto(t),this.destroy()}digest(){const t=new Uint8Array(this.oHash.outputLen);return this.digestInto(t),t}_cloneInto(t){t||(t=Object.create(Object.getPrototypeOf(this),{}));const{oHash:n,iHash:r,finished:o,destroyed:s,blockLen:i,outputLen:c}=this;return t=t,t.finished=o,t.destroyed=s,t.blockLen=i,t.outputLen=c,t.oHash=n._cloneInto(t.oHash),t.iHash=r._cloneInto(t.iHash),t}clone(){return this._cloneInto()}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}}const ad=(e,t,n)=>new id(e,t).update(n).digest();ad.create=(e,t)=>new id(e,t);/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const Ue=BigInt(0),Le=BigInt(1),Rn=BigInt(2),cd=BigInt(3),ld=BigInt(4),ud=BigInt(5),Y1=BigInt(7),fd=BigInt(8),X1=BigInt(9),dd=BigInt(16);function St(e,t){const n=e%t;return n>=Ue?n:t+n}function rt(e,t,n){let r=e;for(;t-- >Ue;)r*=r,r%=n;return r}function pd(e,t){if(e===Ue)throw new Error("invert: expected non-zero number");if(t<=Ue)throw new Error("invert: expected positive modulus, got "+t);let n=St(e,t),r=t,o=Ue,s=Le;for(;n!==Ue;){const c=r/n,a=r%n,l=o-s*c;r=n,n=a,o=s,s=l}if(r!==Le)throw new Error("invert: does not exist");return St(o,t)}function Pa(e,t,n){if(!e.eql(e.sqr(t),n))throw new Error("Cannot find square root")}function hd(e,t){const n=(e.ORDER+Le)/ld,r=e.pow(t,n);return Pa(e,r,t),r}function Q1(e,t){const n=(e.ORDER-ud)/fd,r=e.mul(t,Rn),o=e.pow(r,n),s=e.mul(t,o),i=e.mul(e.mul(s,Rn),o),c=e.mul(s,e.sub(i,e.ONE));return Pa(e,c,t),c}function J1(e){const t=bo(e),n=md(e),r=n(t,t.neg(t.ONE)),o=n(t,r),s=n(t,t.neg(r)),i=(e+Y1)/dd;return(c,a)=>{let l=c.pow(a,i),u=c.mul(l,r);const f=c.mul(l,o),p=c.mul(l,s),d=c.eql(c.sqr(u),a),h=c.eql(c.sqr(f),a);l=c.cmov(l,u,d),u=c.cmov(p,f,h);const m=c.eql(c.sqr(u),a),x=c.cmov(l,u,m);return Pa(c,x,a),x}}function md(e){if(e<cd)throw new Error("sqrt is not defined for small field");let t=e-Le,n=0;for(;t%Rn===Ue;)t/=Rn,n++;let r=Rn;const o=bo(e);for(;bd(o,r)===1;)if(r++>1e3)throw new Error("Cannot find square root: probably non-prime P");if(n===1)return hd;let s=o.pow(r,t);const i=(t+Le)/Rn;return function(a,l){if(a.is0(l))return l;if(bd(a,l)!==1)throw new Error("Cannot find square root");let u=n,f=a.mul(a.ONE,s),p=a.pow(l,t),d=a.pow(l,i);for(;!a.eql(p,a.ONE);){if(a.is0(p))return a.ZERO;let h=1,m=a.sqr(p);for(;!a.eql(m,a.ONE);)if(h++,m=a.sqr(m),h===u)throw new Error("Cannot find square root");const x=Le<<BigInt(u-h-1),A=a.pow(f,x);u=h,f=a.sqr(A),p=a.mul(p,f),d=a.mul(d,A)}return d}}function ev(e){return e%ld===cd?hd:e%fd===ud?Q1:e%dd===X1?J1(e):md(e)}const tv=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function nv(e){const t={ORDER:"bigint",MASK:"bigint",BYTES:"number",BITS:"number"},n=tv.reduce((r,o)=>(r[o]="function",r),t);return Ki(e,n),e}function rv(e,t,n){if(n<Ue)throw new Error("invalid exponent, negatives unsupported");if(n===Ue)return e.ONE;if(n===Le)return t;let r=e.ONE,o=t;for(;n>Ue;)n&Le&&(r=e.mul(r,o)),o=e.sqr(o),n>>=Le;return r}function gd(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 bd(e,t){const n=(e.ORDER-Le)/Rn,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 yd(e,t){t!==void 0&&Fr(t);const n=t!==void 0?t:e.toString(2).length,r=Math.ceil(n/8);return{nBitLength:n,nByteLength:r}}function bo(e,t,n=!1,r={}){if(e<=Ue)throw new Error("invalid field: expected ORDER > 0, got "+e);let o,s,i=!1,c;if(typeof t=="object"&&t!=null){if(r.sqrt||n)throw new Error("cannot specify opts in two arguments");const p=t;p.BITS&&(o=p.BITS),p.sqrt&&(s=p.sqrt),typeof p.isLE=="boolean"&&(n=p.isLE),typeof p.modFromBytes=="boolean"&&(i=p.modFromBytes),c=p.allowedLengths}else typeof t=="number"&&(o=t),r.sqrt&&(s=r.sqrt);const{nBitLength:a,nByteLength:l}=yd(e,o);if(l>2048)throw new Error("invalid field: expected ORDER of <= 2048 bytes");let u;const f=Object.freeze({ORDER:e,isLE:n,BITS:a,BYTES:l,MASK:fo(a),ZERO:Ue,ONE:Le,allowedLengths:c,create:p=>St(p,e),isValid:p=>{if(typeof p!="bigint")throw new Error("invalid field element: expected bigint, got "+typeof p);return Ue<=p&&p<e},is0:p=>p===Ue,isValidNot0:p=>!f.is0(p)&&f.isValid(p),isOdd:p=>(p&Le)===Le,neg:p=>St(-p,e),eql:(p,d)=>p===d,sqr:p=>St(p*p,e),add:(p,d)=>St(p+d,e),sub:(p,d)=>St(p-d,e),mul:(p,d)=>St(p*d,e),pow:(p,d)=>rv(f,p,d),div:(p,d)=>St(p*pd(d,e),e),sqrN:p=>p*p,addN:(p,d)=>p+d,subN:(p,d)=>p-d,mulN:(p,d)=>p*d,inv:p=>pd(p,e),sqrt:s||(p=>(u||(u=ev(e)),u(f,p))),toBytes:p=>n?rf(p,l):qi(p,l),fromBytes:(p,d=!0)=>{if(c){if(!c.includes(p.length)||p.length>l)throw new Error("Field.fromBytes: expected "+c+" bytes, got "+p.length);const m=new Uint8Array(l);m.set(p,n?0:m.length-p.length),p=m}if(p.length!==l)throw new Error("Field.fromBytes: expected "+l+" bytes, got "+p.length);let h=n?nf(p):rs(p);if(i&&(h=St(h,e)),!d&&!f.isValid(h))throw new Error("invalid field element: outside of range 0..ORDER");return h},invertBatch:p=>gd(f,p),cmov:(p,d,h)=>h?d:p});return Object.freeze(f)}function wd(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 vd(e){const t=wd(e);return t+Math.ceil(t/2)}function ov(e,t,n=!1){const r=e.length,o=wd(t),s=vd(t);if(r<16||r<s||r>1024)throw new Error("expected "+s+"-1024 bytes of input, got "+r);const i=n?nf(e):rs(e),c=St(i,t-Le)+Le;return n?rf(c,o):qi(c,o)}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const hr=BigInt(0),jn=BigInt(1);function hs(e,t){const n=t.negate();return e?n:t}function $a(e,t){const n=gd(e.Fp,t.map(r=>r.Z));return t.map((r,o)=>e.fromAffine(r.toAffine(n[o])))}function xd(e,t){if(!Number.isSafeInteger(e)||e<=0||e>t)throw new Error("invalid window size, expected [1.."+t+"], got W="+e)}function Ta(e,t){xd(e,t);const n=Math.ceil(t/e)+1,r=2**(e-1),o=2**e,s=fo(e),i=BigInt(e);return{windows:n,windowSize:r,mask:s,maxNumber:o,shiftBy:i}}function Ed(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+=jn);const l=t*r,u=l+Math.abs(c)-1,f=c===0,p=c<0,d=t%2!==0;return{nextN:a,offset:u,isZero:f,isNeg:p,isNegF:d,offsetF:l}}function sv(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 iv(e,t){if(!Array.isArray(e))throw new Error("array of scalars expected");e.forEach((n,r)=>{if(!t.isValid(n))throw new Error("invalid scalar at index "+r)})}const Aa=new WeakMap,Sd=new WeakMap;function Na(e){return Sd.get(e)||1}function Pd(e){if(e!==hr)throw new Error("invalid wNAF")}class av{constructor(t,n){this.BASE=t.BASE,this.ZERO=t.ZERO,this.Fn=t.Fn,this.bits=n}_unsafeLadder(t,n,r=this.ZERO){let o=t;for(;n>hr;)n&jn&&(r=r.add(o)),o=o.double(),n>>=jn;return r}precomputeWindow(t,n){const{windows:r,windowSize:o}=Ta(n,this.bits),s=[];let i=t,c=i;for(let a=0;a<r;a++){c=i,s.push(c);for(let l=1;l<o;l++)c=c.add(i),s.push(c);i=c.double()}return s}wNAF(t,n,r){if(!this.Fn.isValid(r))throw new Error("invalid scalar");let o=this.ZERO,s=this.BASE;const i=Ta(t,this.bits);for(let c=0;c<i.windows;c++){const{nextN:a,offset:l,isZero:u,isNeg:f,isNegF:p,offsetF:d}=Ed(r,c,i);r=a,u?s=s.add(hs(p,n[d])):o=o.add(hs(f,n[l]))}return Pd(r),{p:o,f:s}}wNAFUnsafe(t,n,r,o=this.ZERO){const s=Ta(t,this.bits);for(let i=0;i<s.windows&&r!==hr;i++){const{nextN:c,offset:a,isZero:l,isNeg:u}=Ed(r,i,s);if(r=c,!l){const f=n[a];o=o.add(u?f.negate():f)}}return Pd(r),o}getPrecomputes(t,n,r){let o=Aa.get(n);return o||(o=this.precomputeWindow(n,t),t!==1&&(typeof r=="function"&&(o=r(o)),Aa.set(n,o))),o}cached(t,n,r){const o=Na(t);return this.wNAF(o,this.getPrecomputes(o,t,r),n)}unsafe(t,n,r,o){const s=Na(t);return s===1?this._unsafeLadder(t,n,o):this.wNAFUnsafe(s,this.getPrecomputes(s,t,r),n,o)}createCache(t,n){xd(n,this.bits),Sd.set(t,n),Aa.delete(t)}hasCache(t){return Na(t)!==1}}function cv(e,t,n,r){let o=t,s=e.ZERO,i=e.ZERO;for(;n>hr||r>hr;)n&jn&&(s=s.add(o)),r&jn&&(i=i.add(o)),o=o.double(),n>>=jn,r>>=jn;return{p1:s,p2:i}}function lv(e,t,n,r){sv(n,e),iv(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=of(BigInt(o));let a=1;c>12?a=c-3:c>4?a=c-2:c>0&&(a=2);const l=fo(a),u=new Array(Number(l)+1).fill(i),f=Math.floor((t.BITS-1)/a)*a;let p=i;for(let d=f;d>=0;d-=a){u.fill(i);for(let m=0;m<s;m++){const x=r[m],A=Number(x>>BigInt(d)&l);u[A]=u[A].add(n[m])}let h=i;for(let m=u.length-1,x=i;m>0;m--)x=x.add(u[m]),h=h.add(x);if(p=p.add(h),d!==0)for(let m=0;m<a;m++)p=p.double()}return p}function $d(e,t,n){if(t){if(t.ORDER!==e)throw new Error("Field.ORDER must match order: Fp == p, Fn == n");return nv(t),t}else return bo(e,{isLE:n})}function uv(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 l=t[a];if(!(typeof l=="bigint"&&l>hr))throw new Error(`CURVE.${a} must be positive bigint`)}const o=$d(t.p,n.Fp,r),s=$d(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 Td=(e,t)=>(e+(e>=0?t:-t)/Ad)/t;function fv(e,t,n){const[[r,o],[s,i]]=t,c=Td(i*e,n),a=Td(-o*e,n);let l=e-c*r-a*s,u=-c*o-a*i;const f=l<tn,p=u<tn;f&&(l=-l),p&&(u=-u);const d=fo(Math.ceil(of(n)/2))+mr;if(l<tn||l>=d||u<tn||u>=d)throw new Error("splitScalar (endomorphism): failed, k="+e);return{k1neg:f,k1:l,k2neg:p,k2:u}}function Oa(e){if(!["compact","recovered","der"].includes(e))throw new Error('Signature format must be "compact", "recovered", or "der"');return e}function Ca(e,t){const n={};for(let r of Object.keys(t))n[r]=e[r]===void 0?t[r]:e[r];return ts(n.lowS,"lowS"),ts(n.prehash,"prehash"),n.format!==void 0&&Oa(n.format),n}class dv extends Error{constructor(t=""){super(t)}}const en={Err:dv,_tlv:{encode:(e,t)=>{const{Err:n}=en;if(e<0||e>256)throw new n("tlv.encode: wrong tag");if(t.length&1)throw new n("tlv.encode: unpadded data");const r=t.length/2,o=ns(r);if(o.length/2&128)throw new n("tlv.encode: long form length too big");const s=r>127?ns(o.length/2|128):"";return ns(e)+s+o+t},decode(e,t){const{Err:n}=en;let r=0;if(e<0||e>256)throw new n("tlv.encode: wrong tag");if(t.length<2||t[r++]!==e)throw new n("tlv.decode: wrong tlv");const o=t[r++],s=!!(o&128);let i=0;if(!s)i=o;else{const a=o&127;if(!a)throw new n("tlv.decode(long): indefinite length not supported");if(a>4)throw new n("tlv.decode(long): byte length is too big");const l=t.subarray(r,r+a);if(l.length!==a)throw new n("tlv.decode: length bytes not complete");if(l[0]===0)throw new n("tlv.decode(long): zero leftmost byte");for(const u of l)i=i<<8|u;if(r+=a,i<128)throw new n("tlv.decode(long): not minimal encoding")}const c=t.subarray(r,r+i);if(c.length!==i)throw new n("tlv.decode: wrong value length");return{v:c,l:t.subarray(r+i)}}},_int:{encode(e){const{Err:t}=en;if(e<tn)throw new t("integer: negative integers are not allowed");let n=ns(e);if(Number.parseInt(n[0],16)&8&&(n="00"+n),n.length&1)throw new t("unexpected DER parsing assertion: unpadded hex");return n},decode(e){const{Err:t}=en;if(e[0]&128)throw new t("invalid signature integer: negative");if(e[0]===0&&!(e[1]&128))throw new t("invalid signature integer: unnecessary leading zero");return rs(e)}},toSig(e){const{Err:t,_int:n,_tlv:r}=en,o=_e("signature",e),{v:s,l:i}=r.decode(48,o);if(i.length)throw new t("invalid signature: left bytes after parsing");const{v:c,l:a}=r.decode(2,s),{v:l,l:u}=r.decode(2,a);if(u.length)throw new t("invalid signature: left bytes after parsing");return{r:n.decode(c),s:n.decode(l)}},hexFromSig(e){const{_tlv:t,_int:n}=en,r=t.encode(2,n.encode(e.r)),o=t.encode(2,n.encode(e.s)),s=r+o;return t.encode(48,s)}},tn=BigInt(0),mr=BigInt(1),Ad=BigInt(2),ms=BigInt(3),pv=BigInt(4);function gr(e,t){const{BYTES:n}=e;let r;if(typeof t=="bigint")r=t;else{let o=_e("private key",t);try{r=e.fromBytes(o)}catch{throw new Error(`invalid private key: expected ui8a of size ${n}, got ${typeof t}`)}}if(!e.isValidNot0(r))throw new Error("invalid private key: out of range [1..N-1]");return r}function hv(e,t={}){const n=uv("weierstrass",e,t),{Fp:r,Fn:o}=n;let s=n.CURVE;const{h:i,n:c}=s;Ki(t,{},{allowInfinityPoint:"boolean",clearCofactor:"function",isTorsionFree:"function",fromBytes:"function",toBytes:"function",endo:"object",wrapPrivateKey:"boolean"});const{endo:a}=t;if(a&&(!r.is0(s.a)||typeof a.beta!="bigint"||!Array.isArray(a.basises)))throw new Error('invalid endo: expected "beta": bigint and "basises": array');const l=Od(r,o);function u(){if(!r.isOdd)throw new Error("compression is not supported: Field does not have .isOdd()")}function f(C,$,S){const{x:E,y:O}=$.toAffine(),N=r.toBytes(E);if(ts(S,"isCompressed"),S){u();const b=!r.isOdd(O);return dn(Nd(b),N)}else return dn(Uint8Array.of(4),N,r.toBytes(O))}function p(C){Ln(C,void 0,"Point");const{publicKey:$,publicKeyUncompressed:S}=l,E=C.length,O=C[0],N=C.subarray(1);if(E===$&&(O===2||O===3)){const b=r.fromBytes(N);if(!r.isValid(b))throw new Error("bad point: is not on curve, wrong x");const M=m(b);let R;try{R=r.sqrt(M)}catch(W){const K=W instanceof Error?": "+W.message:"";throw new Error("bad point: is not on curve, sqrt error"+K)}u();const U=r.isOdd(R);return(O&1)===1!==U&&(R=r.neg(R)),{x:b,y:R}}else if(E===S&&O===4){const b=r.BYTES,M=r.fromBytes(N.subarray(0,b)),R=r.fromBytes(N.subarray(b,b*2));if(!x(M,R))throw new Error("bad point: is not on curve");return{x:M,y:R}}else throw new Error(`bad point: got length ${E}, expected compressed=${$} or uncompressed=${S}`)}const d=t.toBytes||f,h=t.fromBytes||p;function m(C){const $=r.sqr(C),S=r.mul($,C);return r.add(r.add(S,r.mul(C,s.a)),s.b)}function x(C,$){const S=r.sqr($),E=m(C);return r.eql(S,E)}if(!x(s.Gx,s.Gy))throw new Error("bad curve params: generator point");const A=r.mul(r.pow(s.a,ms),pv),w=r.mul(r.sqr(s.b),BigInt(27));if(r.is0(r.add(A,w)))throw new Error("bad curve params: a or b");function T(C,$,S=!1){if(!r.isValid($)||S&&r.is0($))throw new Error(`bad point coordinate ${C}`);return $}function B(C){if(!(C instanceof y))throw new Error("ProjectivePoint expected")}function L(C){if(!a||!a.basises)throw new Error("no endo");return fv(C,a.basises,o.ORDER)}const F=sf((C,$)=>{const{X:S,Y:E,Z:O}=C;if(r.eql(O,r.ONE))return{x:S,y:E};const N=C.is0();$==null&&($=N?r.ONE:r.inv(O));const b=r.mul(S,$),M=r.mul(E,$),R=r.mul(O,$);if(N)return{x:r.ZERO,y:r.ZERO};if(!r.eql(R,r.ONE))throw new Error("invZ was invalid");return{x:b,y:M}}),_=sf(C=>{if(C.is0()){if(t.allowInfinityPoint&&!r.is0(C.Y))return;throw new Error("bad point: ZERO")}const{x:$,y:S}=C.toAffine();if(!r.isValid($)||!r.isValid(S))throw new Error("bad point: x or y not field elements");if(!x($,S))throw new Error("bad point: equation left != right");if(!C.isTorsionFree())throw new Error("bad point: not in prime-order subgroup");return!0});function g(C,$,S,E,O){return S=new y(r.mul(S.X,C),S.Y,S.Z),$=hs(E,$),S=hs(O,S),$.add(S)}class y{constructor($,S,E){this.X=T("x",$),this.Y=T("y",S,!0),this.Z=T("z",E),Object.freeze(this)}static CURVE(){return s}static fromAffine($){const{x:S,y:E}=$||{};if(!$||!r.isValid(S)||!r.isValid(E))throw new Error("invalid affine point");if($ instanceof y)throw new Error("projective point not allowed");return r.is0(S)&&r.is0(E)?y.ZERO:new y(S,E,r.ONE)}static fromBytes($){const S=y.fromAffine(h(Ln($,void 0,"point")));return S.assertValidity(),S}static fromHex($){return y.fromBytes(_e("pointHex",$))}get x(){return this.toAffine().x}get y(){return this.toAffine().y}precompute($=8,S=!0){return k.createCache(this,$),S||this.multiply(ms),this}assertValidity(){_(this)}hasEvenY(){const{y:$}=this.toAffine();if(!r.isOdd)throw new Error("Field doesn't support isOdd");return!r.isOdd($)}equals($){B($);const{X:S,Y:E,Z:O}=this,{X:N,Y:b,Z:M}=$,R=r.eql(r.mul(S,M),r.mul(N,O)),U=r.eql(r.mul(E,M),r.mul(b,O));return R&&U}negate(){return new y(this.X,r.neg(this.Y),this.Z)}double(){const{a:$,b:S}=s,E=r.mul(S,ms),{X:O,Y:N,Z:b}=this;let M=r.ZERO,R=r.ZERO,U=r.ZERO,j=r.mul(O,O),W=r.mul(N,N),K=r.mul(b,b),V=r.mul(O,N);return V=r.add(V,V),U=r.mul(O,b),U=r.add(U,U),M=r.mul($,U),R=r.mul(E,K),R=r.add(M,R),M=r.sub(W,R),R=r.add(W,R),R=r.mul(M,R),M=r.mul(V,M),U=r.mul(E,U),K=r.mul($,K),V=r.sub(j,K),V=r.mul($,V),V=r.add(V,U),U=r.add(j,j),j=r.add(U,j),j=r.add(j,K),j=r.mul(j,V),R=r.add(R,j),K=r.mul(N,b),K=r.add(K,K),j=r.mul(K,V),M=r.sub(M,j),U=r.mul(K,W),U=r.add(U,U),U=r.add(U,U),new y(M,R,U)}add($){B($);const{X:S,Y:E,Z:O}=this,{X:N,Y:b,Z:M}=$;let R=r.ZERO,U=r.ZERO,j=r.ZERO;const W=s.a,K=r.mul(s.b,ms);let V=r.mul(S,N),Z=r.mul(E,b),H=r.mul(O,M),Y=r.add(S,E),Q=r.add(N,b);Y=r.mul(Y,Q),Q=r.add(V,Z),Y=r.sub(Y,Q),Q=r.add(S,O);let oe=r.add(N,M);return Q=r.mul(Q,oe),oe=r.add(V,H),Q=r.sub(Q,oe),oe=r.add(E,O),R=r.add(b,M),oe=r.mul(oe,R),R=r.add(Z,H),oe=r.sub(oe,R),j=r.mul(W,Q),R=r.mul(K,H),j=r.add(R,j),R=r.sub(Z,j),j=r.add(Z,j),U=r.mul(R,j),Z=r.add(V,V),Z=r.add(Z,V),H=r.mul(W,H),Q=r.mul(K,Q),Z=r.add(Z,H),H=r.sub(V,H),H=r.mul(W,H),Q=r.add(Q,H),V=r.mul(Z,Q),U=r.add(U,V),V=r.mul(oe,Q),R=r.mul(Y,R),R=r.sub(R,V),V=r.mul(Y,Z),j=r.mul(oe,j),j=r.add(j,V),new y(R,U,j)}subtract($){return this.add($.negate())}is0(){return this.equals(y.ZERO)}multiply($){const{endo:S}=t;if(!o.isValidNot0($))throw new Error("invalid scalar: out of range");let E,O;const N=b=>k.cached(this,b,M=>$a(y,M));if(S){const{k1neg:b,k1:M,k2neg:R,k2:U}=L($),{p:j,f:W}=N(M),{p:K,f:V}=N(U);O=W.add(V),E=g(S.beta,j,K,b,R)}else{const{p:b,f:M}=N($);E=b,O=M}return $a(y,[E,O])[0]}multiplyUnsafe($){const{endo:S}=t,E=this;if(!o.isValid($))throw new Error("invalid scalar: out of range");if($===tn||E.is0())return y.ZERO;if($===mr)return E;if(k.hasCache(this))return this.multiply($);if(S){const{k1neg:O,k1:N,k2neg:b,k2:M}=L($),{p1:R,p2:U}=cv(y,E,N,M);return g(S.beta,R,U,O,b)}else return k.unsafe(E,$)}multiplyAndAddUnsafe($,S,E){const O=this.multiplyUnsafe(S).add($.multiplyUnsafe(E));return O.is0()?void 0:O}toAffine($){return F(this,$)}isTorsionFree(){const{isTorsionFree:$}=t;return i===mr?!0:$?$(y,this):k.unsafe(this,c).is0()}clearCofactor(){const{clearCofactor:$}=t;return i===mr?this:$?$(y,this):this.multiplyUnsafe(i)}isSmallOrder(){return this.multiplyUnsafe(i).is0()}toBytes($=!0){return ts($,"isCompressed"),this.assertValidity(),d(y,this,$)}toHex($=!0){return nr(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 $a(y,$)}static msm($,S){return lv(y,o,$,S)}static fromPrivateKey($){return y.BASE.multiply(gr(o,$))}}y.BASE=new y(s.Gx,s.Gy,r.ONE),y.ZERO=new y(r.ZERO,r.ONE,r.ZERO),y.Fp=r,y.Fn=o;const P=o.BITS,k=new av(y,t.endo?Math.ceil(P/2):P);return y.BASE.precompute(8),y}function Nd(e){return Uint8Array.of(e?2:3)}function Od(e,t){return{secretKey:t.BYTES,publicKey:1+e.BYTES,publicKeyUncompressed:1+2*e.BYTES,publicKeyHasPrefix:!0,signature:2*t.BYTES}}function mv(e,t={}){const{Fn:n}=e,r=t.randomBytes||Ql,o=Object.assign(Od(e.Fp,n),{seed:vd(n.ORDER)});function s(d){try{return!!gr(n,d)}catch{return!1}}function i(d,h){const{publicKey:m,publicKeyUncompressed:x}=o;try{const A=d.length;return h===!0&&A!==m||h===!1&&A!==x?!1:!!e.fromBytes(d)}catch{return!1}}function c(d=r(o.seed)){return ov(Ln(d,o.seed,"seed"),n.ORDER)}function a(d,h=!0){return e.BASE.multiply(gr(n,d)).toBytes(h)}function l(d){const h=c(d);return{secretKey:h,publicKey:a(h)}}function u(d){if(typeof d=="bigint")return!1;if(d instanceof e)return!0;const{secretKey:h,publicKey:m,publicKeyUncompressed:x}=o;if(n.allowedLengths||h===m)return;const A=_e("key",d).length;return A===m||A===x}function f(d,h,m=!0){if(u(d)===!0)throw new Error("first arg must be private key");if(u(h)===!1)throw new Error("second arg must be public key");const x=gr(n,d);return e.fromHex(h).multiply(x).toBytes(m)}return Object.freeze({getPublicKey:a,getSharedSecret:f,keygen:l,Point:e,utils:{isValidSecretKey:s,isValidPublicKey:i,randomSecretKey:c,isValidPrivateKey:s,randomPrivateKey:c,normPrivateKeyToScalar:d=>gr(n,d),precompute(d=8,h=e.BASE){return h.precompute(d,!1)}},lengths:o})}function gv(e,t,n={}){Gl(t),Ki(n,{},{hmac:"function",lowS:"boolean",randomBytes:"function",bits2int:"function",bits2int_modN:"function"});const r=n.randomBytes||Ql,o=n.hmac||((S,...E)=>ad(t,S,dn(...E))),{Fp:s,Fn:i}=e,{ORDER:c,BITS:a}=i,{keygen:l,getPublicKey:u,getSharedSecret:f,utils:p,lengths:d}=mv(e,n),h={prehash:!1,lowS:typeof n.lowS=="boolean"?n.lowS:!1,format:void 0,extraEntropy:!1},m="compact";function x(S){const E=c>>mr;return S>E}function A(S,E){if(!i.isValidNot0(E))throw new Error(`invalid signature ${S}: out of range 1..Point.Fn.ORDER`);return E}function w(S,E){Oa(E);const O=d.signature,N=E==="compact"?O:E==="recovered"?O+1:void 0;return Ln(S,N,`${E} signature`)}class T{constructor(E,O,N){this.r=A("r",E),this.s=A("s",O),N!=null&&(this.recovery=N),Object.freeze(this)}static fromBytes(E,O=m){w(E,O);let N;if(O==="der"){const{r:U,s:j}=en.toSig(Ln(E));return new T(U,j)}O==="recovered"&&(N=E[0],O="compact",E=E.subarray(1));const b=i.BYTES,M=E.subarray(0,b),R=E.subarray(b,b*2);return new T(i.fromBytes(M),i.fromBytes(R),N)}static fromHex(E,O){return this.fromBytes(Ho(E),O)}addRecoveryBit(E){return new T(this.r,this.s,E)}recoverPublicKey(E){const O=s.ORDER,{r:N,s:b,recovery:M}=this;if(M==null||![0,1,2,3].includes(M))throw new Error("recovery id invalid");if(c*Ad<O&&M>1)throw new Error("recovery id is ambiguous for h>1 curve");const U=M===2||M===3?N+c:N;if(!s.isValid(U))throw new Error("recovery id 2 or 3 invalid");const j=s.toBytes(U),W=e.fromBytes(dn(Nd((M&1)===0),j)),K=i.inv(U),V=L(_e("msgHash",E)),Z=i.create(-V*K),H=i.create(b*K),Y=e.BASE.multiplyUnsafe(Z).add(W.multiplyUnsafe(H));if(Y.is0())throw new Error("point at infinify");return Y.assertValidity(),Y}hasHighS(){return x(this.s)}toBytes(E=m){if(Oa(E),E==="der")return Ho(en.hexFromSig(this));const O=i.toBytes(this.r),N=i.toBytes(this.s);if(E==="recovered"){if(this.recovery==null)throw new Error("recovery bit must be present");return dn(Uint8Array.of(this.recovery),O,N)}return dn(O,N)}toHex(E){return nr(this.toBytes(E))}assertValidity(){}static fromCompact(E){return T.fromBytes(_e("sig",E),"compact")}static fromDER(E){return T.fromBytes(_e("sig",E),"der")}normalizeS(){return this.hasHighS()?new T(this.r,i.neg(this.s),this.recovery):this}toDERRawBytes(){return this.toBytes("der")}toDERHex(){return nr(this.toBytes("der"))}toCompactRawBytes(){return this.toBytes("compact")}toCompactHex(){return nr(this.toBytes("compact"))}}const B=n.bits2int||function(E){if(E.length>8192)throw new Error("input is too large");const O=rs(E),N=E.length*8-a;return N>0?O>>BigInt(N):O},L=n.bits2int_modN||function(E){return i.create(B(E))},F=fo(a);function _(S){return my("num < 2^"+a,S,tn,F),i.toBytes(S)}function g(S,E){return Ln(S,void 0,"message"),E?Ln(t(S),void 0,"prehashed message"):S}function y(S,E,O){if(["recovered","canonical"].some(Z=>Z in O))throw new Error("sign() legacy options not supported");const{lowS:N,prehash:b,extraEntropy:M}=Ca(O,h);S=g(S,b);const R=L(S),U=gr(i,E),j=[_(U),_(R)];if(M!=null&&M!==!1){const Z=M===!0?r(d.secretKey):M;j.push(_e("extraEntropy",Z))}const W=dn(...j),K=R;function V(Z){const H=B(Z);if(!i.isValidNot0(H))return;const Y=i.inv(H),Q=e.BASE.multiply(H).toAffine(),oe=i.create(Q.x);if(oe===tn)return;const me=i.create(Y*i.create(K+oe*U));if(me===tn)return;let pe=(Q.x===oe?0:2)|Number(Q.y&mr),le=me;return N&&x(me)&&(le=i.neg(me),pe^=1),new T(oe,le,pe)}return{seed:W,k2sig:V}}function P(S,E,O={}){S=_e("message",S);const{seed:N,k2sig:b}=y(S,E,O);return gy(t.outputLen,i.BYTES,o)(N,b)}function k(S){let E;const O=typeof S=="string"||zo(S),N=!O&&S!==null&&typeof S=="object"&&typeof S.r=="bigint"&&typeof S.s=="bigint";if(!O&&!N)throw new Error("invalid signature, expected Uint8Array, hex string or Signature instance");if(N)E=new T(S.r,S.s);else if(O){try{E=T.fromBytes(_e("sig",S),"der")}catch(b){if(!(b instanceof en.Err))throw b}if(!E)try{E=T.fromBytes(_e("sig",S),"compact")}catch{return!1}}return E||!1}function C(S,E,O,N={}){const{lowS:b,prehash:M,format:R}=Ca(N,h);if(O=_e("publicKey",O),E=g(_e("message",E),M),"strict"in N)throw new Error("options.strict was renamed to lowS");const U=R===void 0?k(S):T.fromBytes(_e("sig",S),R);if(U===!1)return!1;try{const j=e.fromBytes(O);if(b&&U.hasHighS())return!1;const{r:W,s:K}=U,V=L(E),Z=i.inv(K),H=i.create(V*Z),Y=i.create(W*Z),Q=e.BASE.multiplyUnsafe(H).add(j.multiplyUnsafe(Y));return Q.is0()?!1:i.create(Q.x)===W}catch{return!1}}function $(S,E,O={}){const{prehash:N}=Ca(O,h);return E=g(E,N),T.fromBytes(S,"recovered").recoverPublicKey(E).toBytes()}return Object.freeze({keygen:l,getPublicKey:u,getSharedSecret:f,utils:p,lengths:d,Point:e,sign:P,verify:C,recoverPublicKey:$,Signature:T,hash:t})}function bv(e){const t={a:e.a,b:e.b,p:e.Fp.ORDER,n:e.n,h:e.h,Gx:e.Gx,Gy:e.Gy},n=e.Fp;let r=e.allowedPrivateKeyLengths?Array.from(new Set(e.allowedPrivateKeyLengths.map(i=>Math.ceil(i/2)))):void 0;const o=bo(t.n,{BITS:e.nBitLength,allowedLengths:r,modFromBytes:e.wrapPrivateKey}),s={Fp:n,Fn:o,allowInfinityPoint:e.allowInfinityPoint,endo:e.endo,isTorsionFree:e.isTorsionFree,clearCofactor:e.clearCofactor,fromBytes:e.fromBytes,toBytes:e.toBytes};return{CURVE:t,curveOpts:s}}function yv(e){const{CURVE:t,curveOpts:n}=bv(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 wv(e,t){const n=t.Point;return Object.assign({},t,{ProjectivePoint:n,CURVE:Object.assign({},e,yd(n.Fn.ORDER,n.Fn.BITS))})}function vv(e){const{CURVE:t,curveOpts:n,hash:r,ecdsaOpts:o}=yv(e),s=hv(t,n),i=gv(s,r,o);return wv(e,i)}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */function xv(e,t){const n=r=>vv({...e,hash:r});return{...n(t),create:n}}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const Ia={p:BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),n:BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),h:BigInt(1),a:BigInt(0),b:BigInt(7),Gx:BigInt("0x79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798"),Gy:BigInt("0x483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8")},Ev={beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),basises:[[BigInt("0x3086d221a7d46bcde86c90e49284eb15"),-BigInt("0xe4437ed6010e88286f547fa90abfe4c3")],[BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),BigInt("0x3086d221a7d46bcde86c90e49284eb15")]]},Cd=BigInt(2);function Sv(e){const t=Ia.p,n=BigInt(3),r=BigInt(6),o=BigInt(11),s=BigInt(22),i=BigInt(23),c=BigInt(44),a=BigInt(88),l=e*e*e%t,u=l*l*e%t,f=rt(u,n,t)*u%t,p=rt(f,n,t)*u%t,d=rt(p,Cd,t)*l%t,h=rt(d,o,t)*d%t,m=rt(h,s,t)*h%t,x=rt(m,c,t)*m%t,A=rt(x,a,t)*x%t,w=rt(A,c,t)*m%t,T=rt(w,n,t)*u%t,B=rt(T,i,t)*h%t,L=rt(B,r,t)*l%t,F=rt(L,Cd,t);if(!Ma.eql(Ma.sqr(F),e))throw new Error("Cannot find square root");return F}const Ma=bo(Ia.p,{sqrt:Sv}),Id=xv({...Ia,Fp:Ma,lowS:!0,endo:Ev},Wu),Pv=Object.freeze(Object.defineProperty({__proto__:null,secp256k1:Id},Symbol.toStringTag,{value:"Module"}));function $v({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 Id.Signature(Nt(e),Nt(t)).toCompactHex()}${s===0?"1b":"1c"}`;return n==="hex"?i:wt(i)}async function ka(e,t){var f,p,d;const{address:n,factory:r,factoryData:o,hash:s,signature:i,universalSignatureVerifierAddress:c=(d=(p=(f=e.chain)==null?void 0:f.contracts)==null?void 0:p.universalSignatureVerifier)==null?void 0:d.address,...a}=t,l=bt(i)?i:typeof i=="object"&&"r"in i&&"s"in i?$v(i):$e(i),u=await(async()=>!r&&!o||f1(l)?l:d1({address:r,data:o,signature:l}))();try{const h=c?{to:c,data:Ct({abi:Ef,functionName:"isValidSig",args:[n,s,u]}),...a}:{data:ra({abi:Ef,args:[n,s,u],bytecode:Hy}),...a},{data:m}=await ee(e,po,"call")(h);return mg(m??"0x0")}catch(h){try{if(es(Nn(n),await Iu({hash:s,signature:i})))return!0}catch{}if(h instanceof Nu)return!1;throw h}}async function Tv(e,{address:t,message:n,factory:r,factoryData:o,signature:s,...i}){const c=Zf(n);return ka(e,{address:t,factory:r,factoryData:o,hash:c,signature:s,...i})}async function Av(e,t){const{address:n,factory:r,factoryData:o,signature:s,message:i,primaryType:c,types:a,domain:l,...u}=t,f=n1({message:i,primaryType:c,types:a,domain:l});return ka(e,{address:n,factory:r,factoryData:o,hash:f,signature:s,...u})}function Md(e,{emitOnBegin:t=!1,emitMissed:n=!1,onBlockNumber:r,onError:o,poll:s,pollingInterval:i=e.pollingInterval}){const c=typeof s<"u"?s:!(e.transport.type==="webSocket"||e.transport.type==="ipc"||e.transport.type==="fallback"&&(e.transport.transports[0].config.type==="webSocket"||e.transport.transports[0].config.type==="ipc"));let a;return c?(()=>{const f=Te(["watchBlockNumber",e.uid,t,n,i]);return gn(f,{onBlockNumber:r,onError:o},p=>ho(async()=>{var d;try{const h=await ee(e,mo,"getBlockNumber")({cacheTime:0});if(a){if(h===a)return;if(h-a>1&&n)for(let m=a+1n;m<h;m++)p.onBlockNumber(m,a),a=m}(!a||h>a)&&(p.onBlockNumber(h,a),a=h)}catch(h){(d=p.onError)==null||d.call(p,h)}},{emitOnBegin:t,interval:i}))})():(()=>{const f=Te(["watchBlockNumber",e.uid,t,n]);return gn(f,{onBlockNumber:r,onError:o},p=>{let d=!0,h=()=>d=!1;return(async()=>{try{const m=(()=>{if(e.transport.type==="fallback"){const A=e.transport.transports.find(w=>w.config.type==="webSocket"||w.config.type==="ipc");return A?A.value:e.transport}return e.transport})(),{unsubscribe:x}=await m.subscribe({params:["newHeads"],onData(A){var T;if(!d)return;const w=Nt((T=A.result)==null?void 0:T.number);p.onBlockNumber(w,a),a=w},onError(A){var w;(w=p.onError)==null||w.call(p,A)}});h=x,d||h()}catch(m){o==null||o(m)}})(),()=>h()})})()}async function Nv(e,t){const{checkReplacement:n=!0,confirmations:r=1,hash:o,onReplaced:s,retryCount:i=6,retryDelay:c=({count:L})=>~~(1<<L)*200,timeout:a=18e4}=t,l=Te(["waitForTransactionReceipt",e.uid,o]),u=(()=>{var L;return t.pollingInterval?t.pollingInterval:(L=e.chain)!=null&&L.experimental_preconfirmationTime?e.chain.experimental_preconfirmationTime:e.pollingInterval})();let f,p,d,h=!1,m,x;const{promise:A,resolve:w,reject:T}=Tf(),B=a?setTimeout(()=>{x(),m(),T(new Pb({hash:o}))},a):void 0;return m=gn(l,{onReplaced:s,resolve:w,reject:T},async L=>{if(d=await ee(e,ds,"getTransactionReceipt")({hash:o}).catch(()=>{}),d&&r<=1){clearTimeout(B),L.resolve(d),m();return}x=ee(e,Md,"watchBlockNumber")({emitMissed:!0,emitOnBegin:!0,poll:!0,pollingInterval:u,async onBlockNumber(F){const _=y=>{clearTimeout(B),x(),y(),m()};let g=F;if(!h)try{if(d){if(r>1&&(!d.blockNumber||g-d.blockNumber+1n<r))return;_(()=>L.resolve(d));return}if(n&&!f&&(h=!0,await aa(async()=>{f=await ee(e,ha,"getTransaction")({hash:o}),f.blockNumber&&(g=f.blockNumber)},{delay:c,retryCount:i}),h=!1),d=await ee(e,ds,"getTransactionReceipt")({hash:o}),r>1&&(!d.blockNumber||g-d.blockNumber+1n<r))return;_(()=>L.resolve(d))}catch(y){if(y instanceof Tu||y instanceof Au){if(!f){h=!1;return}try{p=f,h=!0;const P=await aa(()=>ee(e,It,"getBlock")({blockNumber:g,includeTransactions:!0}),{delay:c,retryCount:i,shouldRetry:({error:$})=>$ instanceof Du});h=!1;const k=P.transactions.find(({from:$,nonce:S})=>$===p.from&&S===p.nonce);if(!k||(d=await ee(e,ds,"getTransactionReceipt")({hash:k.hash}),r>1&&(!d.blockNumber||g-d.blockNumber+1n<r)))return;let C="replaced";k.to===p.to&&k.value===p.value&&k.input===p.input?C="repriced":k.from===k.to&&k.value===0n&&(C="cancelled"),_(()=>{var $;($=L.onReplaced)==null||$.call(L,{reason:C,replacedTransaction:p,transaction:k,transactionReceipt:d}),L.resolve(d)})}catch(P){_(()=>L.reject(P))}}else _(()=>L.reject(y))}}})}),A}function Ov(e,{blockTag:t=e.experimental_blockTag??"latest",emitMissed:n=!1,emitOnBegin:r=!1,onBlock:o,onError:s,includeTransactions:i,poll:c,pollingInterval:a=e.pollingInterval}){const l=typeof c<"u"?c:!(e.transport.type==="webSocket"||e.transport.type==="ipc"||e.transport.type==="fallback"&&(e.transport.transports[0].config.type==="webSocket"||e.transport.transports[0].config.type==="ipc")),u=i??!1;let f;return l?(()=>{const h=Te(["watchBlocks",e.uid,t,n,r,u,a]);return gn(h,{onBlock:o,onError:s},m=>ho(async()=>{var x;try{const A=await ee(e,It,"getBlock")({blockTag:t,includeTransactions:u});if(A.number!==null&&(f==null?void 0:f.number)!=null){if(A.number===f.number)return;if(A.number-f.number>1&&n)for(let w=(f==null?void 0:f.number)+1n;w<A.number;w++){const T=await ee(e,It,"getBlock")({blockNumber:w,includeTransactions:u});m.onBlock(T,f),f=T}}((f==null?void 0:f.number)==null||t==="pending"&&(A==null?void 0:A.number)==null||A.number!==null&&A.number>f.number)&&(m.onBlock(A,f),f=A)}catch(A){(x=m.onError)==null||x.call(m,A)}},{emitOnBegin:r,interval:a}))})():(()=>{let h=!0,m=!0,x=()=>h=!1;return(async()=>{try{r&&ee(e,It,"getBlock")({blockTag:t,includeTransactions:u}).then(T=>{h&&m&&(o(T,void 0),m=!1)}).catch(s);const A=(()=>{if(e.transport.type==="fallback"){const T=e.transport.transports.find(B=>B.config.type==="webSocket"||B.config.type==="ipc");return T?T.value:e.transport}return e.transport})(),{unsubscribe:w}=await A.subscribe({params:["newHeads"],async onData(T){var L;if(!h)return;const B=await ee(e,It,"getBlock")({blockNumber:(L=T.result)==null?void 0:L.number,includeTransactions:u}).catch(()=>{});h&&(o(B,f),m=!1,f=B)},onError(T){s==null||s(T)}});x=w,h||x()}catch(A){s==null||s(A)}})(),()=>x()})()}function Cv(e,{address:t,args:n,batch:r=!0,event:o,events:s,fromBlock:i,onError:c,onLogs:a,poll:l,pollingInterval:u=e.pollingInterval,strict:f}){const p=typeof l<"u"?l:typeof i=="bigint"?!0:!(e.transport.type==="webSocket"||e.transport.type==="ipc"||e.transport.type==="fallback"&&(e.transport.transports[0].config.type==="webSocket"||e.transport.transports[0].config.type==="ipc")),d=f??!1;return p?(()=>{const x=Te(["watchEvent",t,n,r,e.uid,o,u,i]);return gn(x,{onLogs:a,onError:c},A=>{let w;i!==void 0&&(w=i-1n);let T,B=!1;const L=ho(async()=>{var F;if(!B){try{T=await ee(e,jf,"createEventFilter")({address:t,args:n,event:o,events:s,strict:d,fromBlock:i})}catch{}B=!0;return}try{let _;if(T)_=await ee(e,os,"getFilterChanges")({filter:T});else{const g=await ee(e,mo,"getBlockNumber")({});w&&w!==g?_=await ee(e,Hi,"getLogs")({address:t,args:n,event:o,events:s,fromBlock:w+1n,toBlock:g}):_=[],w=g}if(_.length===0)return;if(r)A.onLogs(_);else for(const g of _)A.onLogs([g])}catch(_){T&&_ instanceof Mn&&(B=!1),(F=A.onError)==null||F.call(A,_)}},{emitOnBegin:!0,interval:u});return async()=>{T&&await ee(e,ss,"uninstallFilter")({filter:T}),L()}})})():(()=>{let x=!0,A=()=>x=!1;return(async()=>{try{const w=(()=>{if(e.transport.type==="fallback"){const F=e.transport.transports.find(_=>_.config.type==="webSocket"||_.config.type==="ipc");return F?F.value:e.transport}return e.transport})(),T=s??(o?[o]:void 0);let B=[];T&&(B=[T.flatMap(_=>_r({abi:[_],eventName:_.name,args:n}))],o&&(B=B[0]));const{unsubscribe:L}=await w.subscribe({params:["logs",{address:t,topics:B}],onData(F){var g;if(!x)return;const _=F.result;try{const{eventName:y,args:P}=Ui({abi:T??[],data:_.data,topics:_.topics,strict:d}),k=Xt(_,{args:P,eventName:y});a([k])}catch(y){let P,k;if(y instanceof Lr||y instanceof _o){if(f)return;P=y.abiItem.name,k=(g=y.abiItem.inputs)==null?void 0:g.some($=>!("name"in $&&$.name))}const C=Xt(_,{args:k?[]:{},eventName:P});a([C])}},onError(F){c==null||c(F)}});A=L,x||A()}catch(w){c==null||c(w)}})(),()=>A()})()}function Iv(e,{batch:t=!0,onError:n,onTransactions:r,poll:o,pollingInterval:s=e.pollingInterval}){return(typeof o<"u"?o:e.transport.type!=="webSocket"&&e.transport.type!=="ipc")?(()=>{const l=Te(["watchPendingTransactions",e.uid,t,s]);return gn(l,{onTransactions:r,onError:n},u=>{let f;const p=ho(async()=>{var d;try{if(!f)try{f=await ee(e,_f,"createPendingTransactionFilter")({});return}catch(m){throw p(),m}const h=await ee(e,os,"getFilterChanges")({filter:f});if(h.length===0)return;if(t)u.onTransactions(h);else for(const m of h)u.onTransactions([m])}catch(h){(d=u.onError)==null||d.call(u,h)}},{emitOnBegin:!0,interval:s});return async()=>{f&&await ee(e,ss,"uninstallFilter")({filter:f}),p()}})})():(()=>{let l=!0,u=()=>l=!1;return(async()=>{try{const{unsubscribe:f}=await e.transport.subscribe({params:["newPendingTransactions"],onData(p){if(!l)return;const d=p.result;r([d])},onError(p){n==null||n(p)}});u=f,l||u()}catch(f){n==null||n(f)}})(),()=>u()})()}function Mv(e){var f,p,d;const{scheme:t,statement:n,...r}=((f=e.match(kv))==null?void 0:f.groups)??{},{chainId:o,expirationTime:s,issuedAt:i,notBefore:c,requestId:a,...l}=((p=e.match(Bv))==null?void 0:p.groups)??{},u=(d=e.split("Resources:")[1])==null?void 0:d.split(`
82
+ - `).slice(1);return{...r,...l,...o?{chainId:Number(o)}:{},...s?{expirationTime:new Date(s)}:{},...i?{issuedAt:new Date(i)}:{},...c?{notBefore:new Date(c)}:{},...a?{requestId:a}:{},...u?{resources:u}:{},...t?{scheme:t}:{},...n?{statement:n}:{}}}const kv=/^(?:(?<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)?/,Bv=/(?: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 Lv(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||!tt(r.address,{strict:!1})||t&&!es(r.address,t))return!1}catch{return!1}return!0}async function Dv(e,t){const{address:n,domain:r,message:o,nonce:s,scheme:i,signature:c,time:a=new Date,...l}=t,u=Mv(o);if(!u.address||!Lv({address:n,domain:r,message:u,nonce:s,scheme:i,time:a}))return!1;const p=Zf(o);return ka(e,{address:u.address,hash:p,signature:c,...l})}function Fv(e){return{call:t=>po(e,t),createAccessList:t=>Rf(e,t),createBlockFilter:()=>Fw(e),createContractEventFilter:t=>mu(e,t),createEventFilter:t=>jf(e,t),createPendingTransactionFilter:()=>_f(e),estimateContractGas:t=>fy(e,t),estimateGas:t=>_i(e,t),getBalance:t=>Qu(e,t),getBlobBaseFee:()=>Rw(e),getBlock:t=>It(e,t),getBlockNumber:t=>mo(e,t),getBlockTransactionCount:t=>jw(e,t),getBytecode:t=>Uf(e,t),getChainId:()=>Ku(e),getCode:t=>Uf(e,t),getContractEvents:t=>ef(e,t),getEip712Domain:t=>Uw(e,t),getEnsAddress:t=>xw(e,t),getEnsAvatar:t=>Bw(e,t),getEnsName:t=>Lw(e,t),getEnsResolver:t=>Dw(e,t),getEnsText:t=>Ff(e,t),getFeeHistory:t=>Ww(e,t),estimateFeesPerGas:t=>Zb(e,t),getFilterChanges:t=>os(e,t),getFilterLogs:t=>Vw(e,t),getGasPrice:()=>Fi(e),getLogs:t=>Hi(e,t),getProof:t=>b1(e,t),estimateMaxPriorityFeePerGas:t=>qb(e,t),getStorageAt:t=>y1(e,t),getTransaction:t=>ha(e,t),getTransactionConfirmations:t=>w1(e,t),getTransactionCount:t=>Uu(e,t),getTransactionReceipt:t=>ds(e,t),multicall:t=>v1(e,t),prepareTransactionRequest:t=>Xu(e,t),readContract:t=>Jt(e,t),sendRawTransaction:t=>rw(e,t),simulate:t=>ma(e,t),simulateBlocks:t=>ma(e,t),simulateCalls:t=>K1(e,t),simulateContract:t=>Ky(e,t),verifyMessage:t=>Tv(e,t),verifySiweMessage:t=>Dv(e,t),verifyTypedData:t=>Av(e,t),uninstallFilter:t=>ss(e,t),waitForTransactionReceipt:t=>Nv(e,t),watchBlocks:t=>Ov(e,t),watchBlockNumber:t=>Md(e,t),watchContractEvent:t=>nw(e,t),watchEvent:t=>Cv(e,t),watchPendingTransactions:t=>Iv(e,t)}}function Rv(e){const{key:t="public",name:n="Public Client"}=e;return iw({...e,key:t,name:n,type:"publicClient"}).extend(Fv)}const jv=Qw({id:42161,name:"Arbitrum One",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},blockTime:250,rpcUrls:{default:{http:["https://arb1.arbitrum.io/rpc"]}},blockExplorers:{default:{name:"Arbiscan",url:"https://arbiscan.io",apiUrl:"https://api.arbiscan.io/api"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:7654707}}});function _v({client:e,tokenAddress:t,holder:n,decimals:r,fallbackFormatted:o="0",pollingInterval:s=12e3}){const[i,c]=v.useState(null),[a,l]=v.useState(o);return v.useEffect(()=>{let u,f;const p=async()=>{try{const d=await e.readContract({address:t,abi:ur,functionName:"balanceOf",args:[n]});c(d),l(Ei(d,r))}catch{l(o)}};p();try{u=e.watchContractEvent({address:t,abi:ur,eventName:"Transfer",args:{to:n},onLogs:()=>{p()},poll:!0,pollingInterval:s}),f=e.watchContractEvent({address:t,abi:ur,eventName:"Transfer",args:{from:n},onLogs:()=>{p()},poll:!0,pollingInterval:s})}catch{}return()=>{u==null||u(),f==null||f()}},[e,t,n,r,o,s]),{value:i,formatted:a}}const Uv=()=>({openDeposit:v.useCallback(t=>{},[])}),zv=()=>({openWithdraw:v.useCallback(t=>{},[])}),bn="MPC",Ba="EVM",Hv="spot",Wv="perpetual";/**
83
83
  * @license lucide-react v0.540.0 - ISC
84
84
  *
85
85
  * This source code is licensed under the ISC license.
@@ -104,10 +104,10 @@ ${xb(d)}`),super(t.shortMessage,{cause:t,docsPath:r,metaMessages:[...t.metaMessa
104
104
  *
105
105
  * This source code is licensed under the ISC license.
106
106
  * See the LICENSE file in the root directory of this source tree.
107
- */const Ld=Yv("x",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]),Dd=typeof document<"u"?v.useLayoutEffect:()=>{};var Ba;const Xv=(Ba=v.useInsertionEffect)!==null&&Ba!==void 0?Ba:Dd;function Qv(e){const t=v.useRef(null);return Xv(()=>{t.current=e},[e]),v.useCallback((...n)=>{const r=t.current;return r==null?void 0:r(...n)},[])}const yn=e=>{var t;return(t=e==null?void 0:e.ownerDocument)!==null&&t!==void 0?t:document},_n=e=>e&&"window"in e&&e.window===e?e:yn(e).defaultView||window;function Jv(e){return e!==null&&typeof e=="object"&&"nodeType"in e&&typeof e.nodeType=="number"}function ex(e){return Jv(e)&&e.nodeType===Node.DOCUMENT_FRAGMENT_NODE&&"host"in e}let tx=!1;function La(){return tx}function Fd(e,t){if(!La())return t&&e?e.contains(t):!1;if(!e||!t)return!1;let n=t;for(;n!==null;){if(n===e)return!0;n.tagName==="SLOT"&&n.assignedSlot?n=n.assignedSlot.parentNode:ex(n)?n=n.host:n=n.parentNode}return!1}const Da=(e=document)=>{var t;if(!La())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 Rd(e){return La()&&e.target.shadowRoot&&e.composedPath?e.composedPath()[0]:e.target}function gs(e){var t;if(typeof window>"u"||window.navigator==null)return!1;let n=(t=window.navigator.userAgentData)===null||t===void 0?void 0:t.brands;return Array.isArray(n)&&n.some(r=>e.test(r.brand))||e.test(window.navigator.userAgent)}function Fa(e){var t;return typeof window<"u"&&window.navigator!=null?e.test(((t=window.navigator.userAgentData)===null||t===void 0?void 0:t.platform)||window.navigator.platform):!1}function nn(e){if(process.env.NODE_ENV==="test")return e;let t=null;return()=>(t==null&&(t=e()),t)}const Ra=nn(function(){return Fa(/^Mac/i)}),nx=nn(function(){return Fa(/^iPhone/i)}),rx=nn(function(){return Fa(/^iPad/i)||Ra()&&navigator.maxTouchPoints>1}),ox=nn(function(){return nx()||rx()});nn(function(){return Ra()||ox()}),nn(function(){return gs(/AppleWebKit/i)&&!sx()});const sx=nn(function(){return gs(/Chrome/i)}),ix=nn(function(){return gs(/Android/i)});nn(function(){return gs(/Firefox/i)});function jd(){let e=v.useRef(new Map),t=v.useCallback((o,s,i,c)=>{let a=c!=null&&c.once?(...l)=>{e.current.delete(i),i(...l)}:i;e.current.set(i,{type:s,eventTarget:o,fn:a,options:c}),o.addEventListener(s,a,c)},[]),n=v.useCallback((o,s,i,c)=>{var a;let l=((a=e.current.get(i))===null||a===void 0?void 0:a.fn)||i;o.removeEventListener(s,l,c),e.current.delete(i)},[]),r=v.useCallback(()=>{e.current.forEach((o,s)=>{n(o.eventTarget,o.type,s,o.options)})},[n]);return v.useEffect(()=>r,[r]),{addGlobalListener:t,removeGlobalListener:n,removeAllGlobalListeners:r}}function ax(e){return e.mozInputSource===0&&e.isTrusted?!0:ix()&&e.pointerType?e.type==="click"&&e.buttons===1:e.detail===0&&!e.pointerType}function _d(e){let t=e;return t.nativeEvent=e,t.isDefaultPrevented=()=>t.defaultPrevented,t.isPropagationStopped=()=>t.cancelBubble,t.persist=()=>{},t}function cx(e,t){Object.defineProperty(e,"target",{value:t}),Object.defineProperty(e,"currentTarget",{value:t})}function Ud(e){let t=v.useRef({isFocused:!1,observer:null});Dd(()=>{const r=t.current;return()=>{r.observer&&(r.observer.disconnect(),r.observer=null)}},[]);let n=Qv(r=>{e==null||e(r)});return v.useCallback(r=>{if(r.target instanceof HTMLButtonElement||r.target instanceof HTMLInputElement||r.target instanceof HTMLTextAreaElement||r.target instanceof HTMLSelectElement){t.current.isFocused=!0;let o=r.target,s=i=>{if(t.current.isFocused=!1,o.disabled){let c=_d(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 lx=!1,yo=null,ja=new Set,wo=new Map,Un=!1,_a=!1;const ux={Tab:!0,Escape:!0};function Ua(e,t){for(let n of ja)n(e,t)}function fx(e){return!(e.metaKey||!Ra()&&e.altKey||e.ctrlKey||e.key==="Control"||e.key==="Shift"||e.key==="Meta")}function bs(e){Un=!0,fx(e)&&(yo="keyboard",Ua("keyboard",e))}function ot(e){yo="pointer",(e.type==="mousedown"||e.type==="pointerdown")&&(Un=!0,Ua("pointer",e))}function zd(e){ax(e)&&(Un=!0,yo="virtual")}function Hd(e){e.target===window||e.target===document||lx||!e.isTrusted||(!Un&&!_a&&(yo="virtual",Ua("virtual",e)),Un=!1,_a=!1)}function Wd(){Un=!1,_a=!0}function za(e){if(typeof window>"u"||typeof document>"u"||wo.get(_n(e)))return;const t=_n(e),n=yn(e);let r=t.HTMLElement.prototype.focus;t.HTMLElement.prototype.focus=function(){Un=!0,r.apply(this,arguments)},n.addEventListener("keydown",bs,!0),n.addEventListener("keyup",bs,!0),n.addEventListener("click",zd,!0),t.addEventListener("focus",Hd,!0),t.addEventListener("blur",Wd,!1),typeof PointerEvent<"u"?(n.addEventListener("pointerdown",ot,!0),n.addEventListener("pointermove",ot,!0),n.addEventListener("pointerup",ot,!0)):process.env.NODE_ENV==="test"&&(n.addEventListener("mousedown",ot,!0),n.addEventListener("mousemove",ot,!0),n.addEventListener("mouseup",ot,!0)),t.addEventListener("beforeunload",()=>{Vd(e)},{once:!0}),wo.set(t,{focus:r})}const Vd=(e,t)=>{const n=_n(e),r=yn(e);t&&r.removeEventListener("DOMContentLoaded",t),wo.has(n)&&(n.HTMLElement.prototype.focus=wo.get(n).focus,r.removeEventListener("keydown",bs,!0),r.removeEventListener("keyup",bs,!0),r.removeEventListener("click",zd,!0),n.removeEventListener("focus",Hd,!0),n.removeEventListener("blur",Wd,!1),typeof PointerEvent<"u"?(r.removeEventListener("pointerdown",ot,!0),r.removeEventListener("pointermove",ot,!0),r.removeEventListener("pointerup",ot,!0)):process.env.NODE_ENV==="test"&&(r.removeEventListener("mousedown",ot,!0),r.removeEventListener("mousemove",ot,!0),r.removeEventListener("mouseup",ot,!0)),wo.delete(n))};function dx(e){const t=yn(e);let n;return t.readyState!=="loading"?za(e):(n=()=>{za(e)},t.addEventListener("DOMContentLoaded",n)),()=>Vd(e,n)}typeof document<"u"&&dx();function Gd(){return yo!=="pointer"}const px=new Set(["checkbox","radio","range","color","file","image","button","submit","reset"]);function hx(e,t,n){let r=yn(n==null?void 0:n.target);const o=typeof window<"u"?_n(n==null?void 0:n.target).HTMLInputElement:HTMLInputElement,s=typeof window<"u"?_n(n==null?void 0:n.target).HTMLTextAreaElement:HTMLTextAreaElement,i=typeof window<"u"?_n(n==null?void 0:n.target).HTMLElement:HTMLElement,c=typeof window<"u"?_n(n==null?void 0:n.target).KeyboardEvent:KeyboardEvent;return e=e||r.activeElement instanceof o&&!px.has(r.activeElement.type)||r.activeElement instanceof s||r.activeElement instanceof i&&r.activeElement.isContentEditable,!(e&&t==="keyboard"&&n instanceof c&&!ux[n.key])}function mx(e,t,n){za(),v.useEffect(()=>{let r=(o,s)=>{hx(!!(n!=null&&n.isTextInput),o,s)&&e(Gd())};return ja.add(r),()=>{ja.delete(r)}},t)}function gx(e){let{isDisabled:t,onFocus:n,onBlur:r,onFocusChange:o}=e;const s=v.useCallback(a=>{if(a.target===a.currentTarget)return r&&r(a),o&&o(!1),!0},[r,o]),i=Ud(s),c=v.useCallback(a=>{const l=yn(a.target),u=l?Da(l):Da();a.target===a.currentTarget&&u===Rd(a.nativeEvent)&&(n&&n(a),o&&o(!0),i(a))},[o,n,i]);return{focusProps:{onFocus:!t&&(n||o||r)?c:void 0,onBlur:!t&&(r||o)?s:void 0}}}function bx(e){let{isDisabled:t,onBlurWithin:n,onFocusWithin:r,onFocusWithinChange:o}=e,s=v.useRef({isFocusWithin:!1}),{addGlobalListener:i,removeAllGlobalListeners:c}=jd(),a=v.useCallback(f=>{f.currentTarget.contains(f.target)&&s.current.isFocusWithin&&!f.currentTarget.contains(f.relatedTarget)&&(s.current.isFocusWithin=!1,c(),n&&n(f),o&&o(!1))},[n,o,s,c]),l=Ud(a),u=v.useCallback(f=>{if(!f.currentTarget.contains(f.target))return;const p=yn(f.target),d=Da(p);if(!s.current.isFocusWithin&&d===Rd(f.nativeEvent)){r&&r(f),o&&o(!0),s.current.isFocusWithin=!0,l(f);let h=f.currentTarget;i(p,"focus",m=>{if(s.current.isFocusWithin&&!Fd(h,m.target)){let x=new p.defaultView.FocusEvent("blur",{relatedTarget:m.target});cx(x,h);let A=_d(x);a(A)}},{capture:!0})}},[r,o,l,i,a]);return t?{focusWithinProps:{onFocus:void 0,onBlur:void 0}}:{focusWithinProps:{onFocus:u,onBlur:a}}}let ys=!1,ws=0;function Ha(){ys=!0,setTimeout(()=>{ys=!1},50)}function qd(e){e.pointerType==="touch"&&Ha()}function yx(){if(!(typeof document>"u"))return ws===0&&(typeof PointerEvent<"u"?document.addEventListener("pointerup",qd):process.env.NODE_ENV==="test"&&document.addEventListener("touchend",Ha)),ws++,()=>{ws--,!(ws>0)&&(typeof PointerEvent<"u"?document.removeEventListener("pointerup",qd):process.env.NODE_ENV==="test"&&document.removeEventListener("touchend",Ha))}}function wx(e){let{onHoverStart:t,onHoverChange:n,onHoverEnd:r,isDisabled:o}=e,[s,i]=v.useState(!1),c=v.useRef({isHovered:!1,ignoreEmulatedMouseEvents:!1,pointerType:"",target:null}).current;v.useEffect(yx,[]);let{addGlobalListener:a,removeAllGlobalListeners:l}=jd(),{hoverProps:u,triggerHoverEnd:f}=v.useMemo(()=>{let p=(m,x)=>{if(c.pointerType=x,o||x==="touch"||c.isHovered||!m.currentTarget.contains(m.target))return;c.isHovered=!0;let A=m.currentTarget;c.target=A,a(yn(m.target),"pointerover",w=>{c.isHovered&&c.target&&!Fd(c.target,w.target)&&d(w,w.pointerType)},{capture:!0}),t&&t({type:"hoverstart",target:A,pointerType:x}),n&&n(!0),i(!0)},d=(m,x)=>{let A=c.target;c.pointerType="",c.target=null,!(x==="touch"||!c.isHovered||!A)&&(c.isHovered=!1,l(),r&&r({type:"hoverend",target:A,pointerType:x}),n&&n(!1),i(!1))},h={};return typeof PointerEvent<"u"?(h.onPointerEnter=m=>{ys&&m.pointerType==="mouse"||p(m,m.pointerType)},h.onPointerLeave=m=>{!o&&m.currentTarget.contains(m.target)&&d(m,m.pointerType)}):process.env.NODE_ENV==="test"&&(h.onTouchStart=()=>{c.ignoreEmulatedMouseEvents=!0},h.onMouseEnter=m=>{!c.ignoreEmulatedMouseEvents&&!ys&&p(m,"mouse"),c.ignoreEmulatedMouseEvents=!1},h.onMouseLeave=m=>{!o&&m.currentTarget.contains(m.target)&&d(m,"mouse")}),{hoverProps:h,triggerHoverEnd:d}},[t,n,r,o,c,a,l]);return v.useEffect(()=>{o&&f({currentTarget:c.target},c.pointerType)},[o]),{hoverProps:u,isHovered:s}}function vx(e={}){let{autoFocus:t=!1,isTextInput:n,within:r}=e,o=v.useRef({isFocused:!1,isFocusVisible:t||Gd()}),[s,i]=v.useState(!1),[c,a]=v.useState(()=>o.current.isFocused&&o.current.isFocusVisible),l=v.useCallback(()=>a(o.current.isFocused&&o.current.isFocusVisible),[]),u=v.useCallback(d=>{o.current.isFocused=d,i(d),l()},[l]);mx(d=>{o.current.isFocusVisible=d,l()},[],{isTextInput:n});let{focusProps:f}=gx({isDisabled:r,onFocusChange:u}),{focusWithinProps:p}=bx({isDisabled:!r,onFocusWithinChange:u});return{isFocused:s,isFocusVisible:c,focusProps:r?p:f}}var xx=Object.defineProperty,Ex=(e,t,n)=>t in e?xx(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Wa=(e,t,n)=>(Ex(e,typeof t!="symbol"?t+"":t,n),n);let Sx=class{constructor(){Wa(this,"current",this.detect()),Wa(this,"handoffState","pending"),Wa(this,"currentId",0)}set(t){this.current!==t&&(this.handoffState="pending",this.currentId=0,this.current=t)}reset(){this.set(this.detect())}nextId(){return++this.currentId}get isServer(){return this.current==="server"}get isClient(){return this.current==="client"}detect(){return typeof window>"u"||typeof document>"u"?"server":"client"}handoff(){this.handoffState==="pending"&&(this.handoffState="complete")}get isHandoffComplete(){return this.handoffState==="complete"}},Bt=new Sx;function vo(e){var t,n;return Bt.isServer?null:e?"ownerDocument"in e?e.ownerDocument:"current"in e?(n=(t=e.current)==null?void 0:t.ownerDocument)!=null?n:document:null:document}function Zd(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 Zd(()=>{r.current&&n[0]()}),t.add(()=>{r.current=!1})},style(n,r,o){let s=n.style.getPropertyValue(r);return Object.assign(n.style,{[r]:o}),this.add(()=>{Object.assign(n.style,{[r]:s})})},group(n){let r=Pt();return n(r),this.add(()=>r.dispose())},add(n){return e.includes(n)||e.push(n),()=>{let r=e.indexOf(n);if(r>=0)for(let o of e.splice(r,1))o()}},dispose(){for(let n of e.splice(0))n()}};return t}function br(){let[e]=v.useState(Pt);return v.useEffect(()=>()=>e.dispose(),[e]),e}let ye=(e,t)=>{Bt.isServer?v.useEffect(e,t):v.useLayoutEffect(e,t)};function zn(e){let t=v.useRef(e);return ye(()=>{t.current=e},[e]),t}let ce=function(e){let t=zn(e);return v.useCallback((...n)=>t.current(...n),[t])};function Px(e){let t=e.width/2,n=e.height/2;return{top:e.clientY-n,right:e.clientX+t,bottom:e.clientY+n,left:e.clientX-t}}function $x(e,t){return!(!e||!t||e.right<t.left||e.left>t.right||e.bottom<t.top||e.top>t.bottom)}function Tx({disabled:e=!1}={}){let t=v.useRef(null),[n,r]=v.useState(!1),o=br(),s=ce(()=>{t.current=null,r(!1),o.dispose()}),i=ce(c=>{if(o.dispose(),t.current===null){t.current=c.currentTarget,r(!0);{let a=vo(c.currentTarget);o.addEventListener(a,"pointerup",s,!1),o.addEventListener(a,"pointermove",l=>{if(t.current){let u=Px(l);r($x(u,t.current.getBoundingClientRect()))}},!1),o.addEventListener(a,"pointercancel",s,!1)}}});return{pressed:n,pressProps:e?{}:{onPointerDown:i,onPointerUp:s,onClick:s}}}let Ax=v.createContext(void 0);function Va(){return v.useContext(Ax)}function Ga(...e){return Array.from(new Set(e.flatMap(t=>typeof t=="string"?t.split(" "):[]))).filter(Boolean).join(" ")}function st(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,st),r}var vs=(e=>(e[e.None=0]="None",e[e.RenderStrategy=1]="RenderStrategy",e[e.Static=2]="Static",e))(vs||{}),wn=(e=>(e[e.Unmount=0]="Unmount",e[e.Hidden=1]="Hidden",e))(wn||{});function Ye(){let e=Ox();return v.useCallback(t=>Nx({mergeRefs:e,...t}),[e])}function Nx({ourProps:e,theirProps:t,slot:n,defaultTag:r,features:o,visible:s=!0,name:i,mergeRefs:c}){c=c??Cx;let a=Kd(t,e);if(s)return xs(a,n,r,i,c);let l=o??0;if(l&2){let{static:u=!1,...f}=a;if(u)return xs(f,n,r,i,c)}if(l&1){let{unmount:u=!0,...f}=a;return st(u?0:1,{0(){return null},1(){return xs({...f,hidden:!0,style:{display:"none"}},n,r,i,c)}})}return xs(a,n,r,i,c)}function xs(e,t={},n,r,o){let{as:s=n,children:i,refName:c="ref",...a}=qa(e,["unmount","static"]),l=e.ref!==void 0?{[c]:e.ref}:{},u=typeof i=="function"?i(t):i;"className"in a&&a.className&&typeof a.className=="function"&&(a.className=a.className(t)),a["aria-labelledby"]&&a["aria-labelledby"]===a.id&&(a["aria-labelledby"]=void 0);let f={};if(t){let p=!1,d=[];for(let[h,m]of Object.entries(t))typeof m=="boolean"&&(p=!0),m===!0&&d.push(h.replace(/([A-Z])/g,x=>`-${x.toLowerCase()}`));if(p){f["data-headlessui-state"]=d.join(" ");for(let h of d)f[`data-${h}`]=""}}if(s===v.Fragment&&(Object.keys(vn(a)).length>0||Object.keys(vn(f)).length>0))if(!v.isValidElement(u)||Array.isArray(u)&&u.length>1){if(Object.keys(vn(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(vn(a)).concat(Object.keys(vn(f))).map(p=>` - ${p}`).join(`
107
+ */const Ld=Yv("x",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]),Dd=typeof document<"u"?v.useLayoutEffect:()=>{};var La;const Xv=(La=v.useInsertionEffect)!==null&&La!==void 0?La:Dd;function Qv(e){const t=v.useRef(null);return Xv(()=>{t.current=e},[e]),v.useCallback((...n)=>{const r=t.current;return r==null?void 0:r(...n)},[])}const yn=e=>{var t;return(t=e==null?void 0:e.ownerDocument)!==null&&t!==void 0?t:document},_n=e=>e&&"window"in e&&e.window===e?e:yn(e).defaultView||window;function Jv(e){return e!==null&&typeof e=="object"&&"nodeType"in e&&typeof e.nodeType=="number"}function ex(e){return Jv(e)&&e.nodeType===Node.DOCUMENT_FRAGMENT_NODE&&"host"in e}let tx=!1;function Da(){return tx}function Fd(e,t){if(!Da())return t&&e?e.contains(t):!1;if(!e||!t)return!1;let n=t;for(;n!==null;){if(n===e)return!0;n.tagName==="SLOT"&&n.assignedSlot?n=n.assignedSlot.parentNode:ex(n)?n=n.host:n=n.parentNode}return!1}const Fa=(e=document)=>{var t;if(!Da())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 Rd(e){return Da()&&e.target.shadowRoot&&e.composedPath?e.composedPath()[0]:e.target}function gs(e){var t;if(typeof window>"u"||window.navigator==null)return!1;let n=(t=window.navigator.userAgentData)===null||t===void 0?void 0:t.brands;return Array.isArray(n)&&n.some(r=>e.test(r.brand))||e.test(window.navigator.userAgent)}function Ra(e){var t;return typeof window<"u"&&window.navigator!=null?e.test(((t=window.navigator.userAgentData)===null||t===void 0?void 0:t.platform)||window.navigator.platform):!1}function nn(e){if(process.env.NODE_ENV==="test")return e;let t=null;return()=>(t==null&&(t=e()),t)}const ja=nn(function(){return Ra(/^Mac/i)}),nx=nn(function(){return Ra(/^iPhone/i)}),rx=nn(function(){return Ra(/^iPad/i)||ja()&&navigator.maxTouchPoints>1}),ox=nn(function(){return nx()||rx()});nn(function(){return ja()||ox()}),nn(function(){return gs(/AppleWebKit/i)&&!sx()});const sx=nn(function(){return gs(/Chrome/i)}),ix=nn(function(){return gs(/Android/i)});nn(function(){return gs(/Firefox/i)});function jd(){let e=v.useRef(new Map),t=v.useCallback((o,s,i,c)=>{let a=c!=null&&c.once?(...l)=>{e.current.delete(i),i(...l)}:i;e.current.set(i,{type:s,eventTarget:o,fn:a,options:c}),o.addEventListener(s,a,c)},[]),n=v.useCallback((o,s,i,c)=>{var a;let l=((a=e.current.get(i))===null||a===void 0?void 0:a.fn)||i;o.removeEventListener(s,l,c),e.current.delete(i)},[]),r=v.useCallback(()=>{e.current.forEach((o,s)=>{n(o.eventTarget,o.type,s,o.options)})},[n]);return v.useEffect(()=>r,[r]),{addGlobalListener:t,removeGlobalListener:n,removeAllGlobalListeners:r}}function ax(e){return e.mozInputSource===0&&e.isTrusted?!0:ix()&&e.pointerType?e.type==="click"&&e.buttons===1:e.detail===0&&!e.pointerType}function _d(e){let t=e;return t.nativeEvent=e,t.isDefaultPrevented=()=>t.defaultPrevented,t.isPropagationStopped=()=>t.cancelBubble,t.persist=()=>{},t}function cx(e,t){Object.defineProperty(e,"target",{value:t}),Object.defineProperty(e,"currentTarget",{value:t})}function Ud(e){let t=v.useRef({isFocused:!1,observer:null});Dd(()=>{const r=t.current;return()=>{r.observer&&(r.observer.disconnect(),r.observer=null)}},[]);let n=Qv(r=>{e==null||e(r)});return v.useCallback(r=>{if(r.target instanceof HTMLButtonElement||r.target instanceof HTMLInputElement||r.target instanceof HTMLTextAreaElement||r.target instanceof HTMLSelectElement){t.current.isFocused=!0;let o=r.target,s=i=>{if(t.current.isFocused=!1,o.disabled){let c=_d(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 lx=!1,yo=null,_a=new Set,wo=new Map,Un=!1,Ua=!1;const ux={Tab:!0,Escape:!0};function za(e,t){for(let n of _a)n(e,t)}function fx(e){return!(e.metaKey||!ja()&&e.altKey||e.ctrlKey||e.key==="Control"||e.key==="Shift"||e.key==="Meta")}function bs(e){Un=!0,fx(e)&&(yo="keyboard",za("keyboard",e))}function ot(e){yo="pointer",(e.type==="mousedown"||e.type==="pointerdown")&&(Un=!0,za("pointer",e))}function zd(e){ax(e)&&(Un=!0,yo="virtual")}function Hd(e){e.target===window||e.target===document||lx||!e.isTrusted||(!Un&&!Ua&&(yo="virtual",za("virtual",e)),Un=!1,Ua=!1)}function Wd(){Un=!1,Ua=!0}function Ha(e){if(typeof window>"u"||typeof document>"u"||wo.get(_n(e)))return;const t=_n(e),n=yn(e);let r=t.HTMLElement.prototype.focus;t.HTMLElement.prototype.focus=function(){Un=!0,r.apply(this,arguments)},n.addEventListener("keydown",bs,!0),n.addEventListener("keyup",bs,!0),n.addEventListener("click",zd,!0),t.addEventListener("focus",Hd,!0),t.addEventListener("blur",Wd,!1),typeof PointerEvent<"u"?(n.addEventListener("pointerdown",ot,!0),n.addEventListener("pointermove",ot,!0),n.addEventListener("pointerup",ot,!0)):process.env.NODE_ENV==="test"&&(n.addEventListener("mousedown",ot,!0),n.addEventListener("mousemove",ot,!0),n.addEventListener("mouseup",ot,!0)),t.addEventListener("beforeunload",()=>{Vd(e)},{once:!0}),wo.set(t,{focus:r})}const Vd=(e,t)=>{const n=_n(e),r=yn(e);t&&r.removeEventListener("DOMContentLoaded",t),wo.has(n)&&(n.HTMLElement.prototype.focus=wo.get(n).focus,r.removeEventListener("keydown",bs,!0),r.removeEventListener("keyup",bs,!0),r.removeEventListener("click",zd,!0),n.removeEventListener("focus",Hd,!0),n.removeEventListener("blur",Wd,!1),typeof PointerEvent<"u"?(r.removeEventListener("pointerdown",ot,!0),r.removeEventListener("pointermove",ot,!0),r.removeEventListener("pointerup",ot,!0)):process.env.NODE_ENV==="test"&&(r.removeEventListener("mousedown",ot,!0),r.removeEventListener("mousemove",ot,!0),r.removeEventListener("mouseup",ot,!0)),wo.delete(n))};function dx(e){const t=yn(e);let n;return t.readyState!=="loading"?Ha(e):(n=()=>{Ha(e)},t.addEventListener("DOMContentLoaded",n)),()=>Vd(e,n)}typeof document<"u"&&dx();function Gd(){return yo!=="pointer"}const px=new Set(["checkbox","radio","range","color","file","image","button","submit","reset"]);function hx(e,t,n){let r=yn(n==null?void 0:n.target);const o=typeof window<"u"?_n(n==null?void 0:n.target).HTMLInputElement:HTMLInputElement,s=typeof window<"u"?_n(n==null?void 0:n.target).HTMLTextAreaElement:HTMLTextAreaElement,i=typeof window<"u"?_n(n==null?void 0:n.target).HTMLElement:HTMLElement,c=typeof window<"u"?_n(n==null?void 0:n.target).KeyboardEvent:KeyboardEvent;return e=e||r.activeElement instanceof o&&!px.has(r.activeElement.type)||r.activeElement instanceof s||r.activeElement instanceof i&&r.activeElement.isContentEditable,!(e&&t==="keyboard"&&n instanceof c&&!ux[n.key])}function mx(e,t,n){Ha(),v.useEffect(()=>{let r=(o,s)=>{hx(!!(n!=null&&n.isTextInput),o,s)&&e(Gd())};return _a.add(r),()=>{_a.delete(r)}},t)}function gx(e){let{isDisabled:t,onFocus:n,onBlur:r,onFocusChange:o}=e;const s=v.useCallback(a=>{if(a.target===a.currentTarget)return r&&r(a),o&&o(!1),!0},[r,o]),i=Ud(s),c=v.useCallback(a=>{const l=yn(a.target),u=l?Fa(l):Fa();a.target===a.currentTarget&&u===Rd(a.nativeEvent)&&(n&&n(a),o&&o(!0),i(a))},[o,n,i]);return{focusProps:{onFocus:!t&&(n||o||r)?c:void 0,onBlur:!t&&(r||o)?s:void 0}}}function bx(e){let{isDisabled:t,onBlurWithin:n,onFocusWithin:r,onFocusWithinChange:o}=e,s=v.useRef({isFocusWithin:!1}),{addGlobalListener:i,removeAllGlobalListeners:c}=jd(),a=v.useCallback(f=>{f.currentTarget.contains(f.target)&&s.current.isFocusWithin&&!f.currentTarget.contains(f.relatedTarget)&&(s.current.isFocusWithin=!1,c(),n&&n(f),o&&o(!1))},[n,o,s,c]),l=Ud(a),u=v.useCallback(f=>{if(!f.currentTarget.contains(f.target))return;const p=yn(f.target),d=Fa(p);if(!s.current.isFocusWithin&&d===Rd(f.nativeEvent)){r&&r(f),o&&o(!0),s.current.isFocusWithin=!0,l(f);let h=f.currentTarget;i(p,"focus",m=>{if(s.current.isFocusWithin&&!Fd(h,m.target)){let x=new p.defaultView.FocusEvent("blur",{relatedTarget:m.target});cx(x,h);let A=_d(x);a(A)}},{capture:!0})}},[r,o,l,i,a]);return t?{focusWithinProps:{onFocus:void 0,onBlur:void 0}}:{focusWithinProps:{onFocus:u,onBlur:a}}}let ys=!1,ws=0;function Wa(){ys=!0,setTimeout(()=>{ys=!1},50)}function qd(e){e.pointerType==="touch"&&Wa()}function yx(){if(!(typeof document>"u"))return ws===0&&(typeof PointerEvent<"u"?document.addEventListener("pointerup",qd):process.env.NODE_ENV==="test"&&document.addEventListener("touchend",Wa)),ws++,()=>{ws--,!(ws>0)&&(typeof PointerEvent<"u"?document.removeEventListener("pointerup",qd):process.env.NODE_ENV==="test"&&document.removeEventListener("touchend",Wa))}}function wx(e){let{onHoverStart:t,onHoverChange:n,onHoverEnd:r,isDisabled:o}=e,[s,i]=v.useState(!1),c=v.useRef({isHovered:!1,ignoreEmulatedMouseEvents:!1,pointerType:"",target:null}).current;v.useEffect(yx,[]);let{addGlobalListener:a,removeAllGlobalListeners:l}=jd(),{hoverProps:u,triggerHoverEnd:f}=v.useMemo(()=>{let p=(m,x)=>{if(c.pointerType=x,o||x==="touch"||c.isHovered||!m.currentTarget.contains(m.target))return;c.isHovered=!0;let A=m.currentTarget;c.target=A,a(yn(m.target),"pointerover",w=>{c.isHovered&&c.target&&!Fd(c.target,w.target)&&d(w,w.pointerType)},{capture:!0}),t&&t({type:"hoverstart",target:A,pointerType:x}),n&&n(!0),i(!0)},d=(m,x)=>{let A=c.target;c.pointerType="",c.target=null,!(x==="touch"||!c.isHovered||!A)&&(c.isHovered=!1,l(),r&&r({type:"hoverend",target:A,pointerType:x}),n&&n(!1),i(!1))},h={};return typeof PointerEvent<"u"?(h.onPointerEnter=m=>{ys&&m.pointerType==="mouse"||p(m,m.pointerType)},h.onPointerLeave=m=>{!o&&m.currentTarget.contains(m.target)&&d(m,m.pointerType)}):process.env.NODE_ENV==="test"&&(h.onTouchStart=()=>{c.ignoreEmulatedMouseEvents=!0},h.onMouseEnter=m=>{!c.ignoreEmulatedMouseEvents&&!ys&&p(m,"mouse"),c.ignoreEmulatedMouseEvents=!1},h.onMouseLeave=m=>{!o&&m.currentTarget.contains(m.target)&&d(m,"mouse")}),{hoverProps:h,triggerHoverEnd:d}},[t,n,r,o,c,a,l]);return v.useEffect(()=>{o&&f({currentTarget:c.target},c.pointerType)},[o]),{hoverProps:u,isHovered:s}}function vx(e={}){let{autoFocus:t=!1,isTextInput:n,within:r}=e,o=v.useRef({isFocused:!1,isFocusVisible:t||Gd()}),[s,i]=v.useState(!1),[c,a]=v.useState(()=>o.current.isFocused&&o.current.isFocusVisible),l=v.useCallback(()=>a(o.current.isFocused&&o.current.isFocusVisible),[]),u=v.useCallback(d=>{o.current.isFocused=d,i(d),l()},[l]);mx(d=>{o.current.isFocusVisible=d,l()},[],{isTextInput:n});let{focusProps:f}=gx({isDisabled:r,onFocusChange:u}),{focusWithinProps:p}=bx({isDisabled:!r,onFocusWithinChange:u});return{isFocused:s,isFocusVisible:c,focusProps:r?p:f}}var xx=Object.defineProperty,Ex=(e,t,n)=>t in e?xx(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Va=(e,t,n)=>(Ex(e,typeof t!="symbol"?t+"":t,n),n);let Sx=class{constructor(){Va(this,"current",this.detect()),Va(this,"handoffState","pending"),Va(this,"currentId",0)}set(t){this.current!==t&&(this.handoffState="pending",this.currentId=0,this.current=t)}reset(){this.set(this.detect())}nextId(){return++this.currentId}get isServer(){return this.current==="server"}get isClient(){return this.current==="client"}detect(){return typeof window>"u"||typeof document>"u"?"server":"client"}handoff(){this.handoffState==="pending"&&(this.handoffState="complete")}get isHandoffComplete(){return this.handoffState==="complete"}},Bt=new Sx;function vo(e){var t,n;return Bt.isServer?null:e?"ownerDocument"in e?e.ownerDocument:"current"in e?(n=(t=e.current)==null?void 0:t.ownerDocument)!=null?n:document:null:document}function Zd(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 Zd(()=>{r.current&&n[0]()}),t.add(()=>{r.current=!1})},style(n,r,o){let s=n.style.getPropertyValue(r);return Object.assign(n.style,{[r]:o}),this.add(()=>{Object.assign(n.style,{[r]:s})})},group(n){let r=Pt();return n(r),this.add(()=>r.dispose())},add(n){return e.includes(n)||e.push(n),()=>{let r=e.indexOf(n);if(r>=0)for(let o of e.splice(r,1))o()}},dispose(){for(let n of e.splice(0))n()}};return t}function br(){let[e]=v.useState(Pt);return v.useEffect(()=>()=>e.dispose(),[e]),e}let ye=(e,t)=>{Bt.isServer?v.useEffect(e,t):v.useLayoutEffect(e,t)};function zn(e){let t=v.useRef(e);return ye(()=>{t.current=e},[e]),t}let ce=function(e){let t=zn(e);return v.useCallback((...n)=>t.current(...n),[t])};function Px(e){let t=e.width/2,n=e.height/2;return{top:e.clientY-n,right:e.clientX+t,bottom:e.clientY+n,left:e.clientX-t}}function $x(e,t){return!(!e||!t||e.right<t.left||e.left>t.right||e.bottom<t.top||e.top>t.bottom)}function Tx({disabled:e=!1}={}){let t=v.useRef(null),[n,r]=v.useState(!1),o=br(),s=ce(()=>{t.current=null,r(!1),o.dispose()}),i=ce(c=>{if(o.dispose(),t.current===null){t.current=c.currentTarget,r(!0);{let a=vo(c.currentTarget);o.addEventListener(a,"pointerup",s,!1),o.addEventListener(a,"pointermove",l=>{if(t.current){let u=Px(l);r($x(u,t.current.getBoundingClientRect()))}},!1),o.addEventListener(a,"pointercancel",s,!1)}}});return{pressed:n,pressProps:e?{}:{onPointerDown:i,onPointerUp:s,onClick:s}}}let Ax=v.createContext(void 0);function Ga(){return v.useContext(Ax)}function qa(...e){return Array.from(new Set(e.flatMap(t=>typeof t=="string"?t.split(" "):[]))).filter(Boolean).join(" ")}function st(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,st),r}var vs=(e=>(e[e.None=0]="None",e[e.RenderStrategy=1]="RenderStrategy",e[e.Static=2]="Static",e))(vs||{}),wn=(e=>(e[e.Unmount=0]="Unmount",e[e.Hidden=1]="Hidden",e))(wn||{});function Ye(){let e=Ox();return v.useCallback(t=>Nx({mergeRefs:e,...t}),[e])}function Nx({ourProps:e,theirProps:t,slot:n,defaultTag:r,features:o,visible:s=!0,name:i,mergeRefs:c}){c=c??Cx;let a=Kd(t,e);if(s)return xs(a,n,r,i,c);let l=o??0;if(l&2){let{static:u=!1,...f}=a;if(u)return xs(f,n,r,i,c)}if(l&1){let{unmount:u=!0,...f}=a;return st(u?0:1,{0(){return null},1(){return xs({...f,hidden:!0,style:{display:"none"}},n,r,i,c)}})}return xs(a,n,r,i,c)}function xs(e,t={},n,r,o){let{as:s=n,children:i,refName:c="ref",...a}=Za(e,["unmount","static"]),l=e.ref!==void 0?{[c]:e.ref}:{},u=typeof i=="function"?i(t):i;"className"in a&&a.className&&typeof a.className=="function"&&(a.className=a.className(t)),a["aria-labelledby"]&&a["aria-labelledby"]===a.id&&(a["aria-labelledby"]=void 0);let f={};if(t){let p=!1,d=[];for(let[h,m]of Object.entries(t))typeof m=="boolean"&&(p=!0),m===!0&&d.push(h.replace(/([A-Z])/g,x=>`-${x.toLowerCase()}`));if(p){f["data-headlessui-state"]=d.join(" ");for(let h of d)f[`data-${h}`]=""}}if(s===v.Fragment&&(Object.keys(vn(a)).length>0||Object.keys(vn(f)).length>0))if(!v.isValidElement(u)||Array.isArray(u)&&u.length>1){if(Object.keys(vn(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(vn(a)).concat(Object.keys(vn(f))).map(p=>` - ${p}`).join(`
108
108
  `),"","You can apply a few solutions:",['Add an `as="..."` prop, to ensure that we render an actual element instead of a "Fragment".',"Render a single element as the child so that we can forward the props onto that element."].map(p=>` - ${p}`).join(`
109
109
  `)].join(`
110
- `))}else{let p=u.props,d=p==null?void 0:p.className,h=typeof d=="function"?(...A)=>Ga(d(...A),a.className):Ga(d,a.className),m=h?{className:h}:{},x=Kd(u.props,vn(qa(a,["ref"])));for(let A in f)A in x&&delete f[A];return v.cloneElement(u,Object.assign({},x,f,l,{ref:o(Ix(u),l.ref)},m))}return v.createElement(s,Object.assign({},qa(a,["ref"]),s!==v.Fragment&&l,s!==v.Fragment&&f),u)}function Ox(){let e=v.useRef([]),t=v.useCallback(n=>{for(let r of e.current)r!=null&&(typeof r=="function"?r(n):r.current=n)},[]);return(...n)=>{if(!n.every(r=>r==null))return e.current=n,t}}function Cx(...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 Kd(...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 Yd(...e){if(e.length===0)return{};if(e.length===1)return e[0];let t={},n={};for(let r of e)for(let o in r)o.startsWith("on")&&typeof r[o]=="function"?(n[o]!=null||(n[o]=[]),n[o].push(r[o])):t[o]=r[o];for(let r in n)Object.assign(t,{[r](...o){let s=n[r];for(let i of s)i==null||i(...o)}});return t}function ze(e){var t;return Object.assign(v.forwardRef(e),{displayName:(t=e.displayName)!=null?t:e.name})}function vn(e){let t=Object.assign({},e);for(let n in t)t[n]===void 0&&delete t[n];return t}function qa(e,t=[]){let n=Object.assign({},e);for(let r of t)r in n&&delete n[r];return n}function Ix(e){return v.version.split(".")[0]>="19"?e.props.ref:e.ref}function Mx(e,t,n){let[r,o]=v.useState(n),s=e!==void 0,i=v.useRef(s),c=v.useRef(!1),a=v.useRef(!1);return s&&!i.current&&!c.current?(c.current=!0,i.current=s,console.error("A component is changing from uncontrolled to controlled. This may be caused by the value changing from undefined to a defined value, which should not happen.")):!s&&i.current&&!a.current&&(a.current=!0,i.current=s,console.error("A component is changing from controlled to uncontrolled. This may be caused by the value changing from a defined value to undefined, which should not happen.")),[s?e:r,ce(l=>(s||o(l),t==null?void 0:t(l)))]}function kx(e){let[t]=v.useState(e);return t}function Xd(e={},t=null,n=[]){for(let[r,o]of Object.entries(e))Jd(n,Qd(t,r),o);return n}function Qd(e,t){return e?e+"["+t+"]":t}function Jd(e,t,n){if(Array.isArray(n))for(let[r,o]of n.entries())Jd(e,Qd(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,""]):Xd(n,t,e)}function Bx(e){var t,n;let r=(t=e==null?void 0:e.form)!=null?t:e.closest("form");if(r){for(let o of r.elements)if(o!==e&&(o.tagName==="INPUT"&&o.type==="submit"||o.tagName==="BUTTON"&&o.type==="submit"||o.nodeName==="INPUT"&&o.type==="image")){o.click();return}(n=r.requestSubmit)==null||n.call(r)}}let Lx="span";var Za=(e=>(e[e.None=1]="None",e[e.Focusable=2]="Focusable",e[e.Hidden=4]="Hidden",e))(Za||{});function Dx(e,t){var n;let{features:r=1,...o}=e,s={ref:t,"aria-hidden":(r&2)===2?!0:(n=o["aria-hidden"])!=null?n:void 0,hidden:(r&4)===4?!0:void 0,style:{position:"fixed",top:1,left:1,width:1,height:0,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0",...(r&4)===4&&(r&2)!==2&&{display:"none"}}};return Ye()({ourProps:s,theirProps:o,slot:{},defaultTag:Lx,name:"Hidden"})}let ep=ze(Dx),Fx=v.createContext(null);function Rx({children:e}){let t=v.useContext(Fx);if(!t)return v.createElement(v.Fragment,null,e);let{target:n}=t;return n?ke.createPortal(v.createElement(v.Fragment,null,e),n):null}function jx({data:e,form:t,disabled:n,onReset:r,overrides:o}){let[s,i]=v.useState(null),c=br();return v.useEffect(()=>{if(r&&s)return c.addEventListener(s,"reset",r)},[s,t,r]),v.createElement(Rx,null,v.createElement(_x,{setForm:i,formId:t}),Xd(e).map(([a,l])=>v.createElement(ep,{features:Za.Hidden,...vn({key:a,as:"input",type:"hidden",hidden:!0,readOnly:!0,form:t,disabled:n,name:a,value:l,...o})})))}function _x({setForm:e,formId:t}){return v.useEffect(()=>{if(t){let n=document.getElementById(t);n&&e(n)}},[e,t]),t?null:v.createElement(ep,{features:Za.Hidden,as:"input",type:"hidden",hidden:!0,readOnly:!0,ref:n=>{if(!n)return;let r=n.closest("form");r&&e(r)}})}let Ux=v.createContext(void 0);function tp(){return v.useContext(Ux)}function Ka(e){return typeof e!="object"||e===null?!1:"nodeType"in e}function Es(e){return Ka(e)&&"tagName"in e}function rn(e){return Es(e)&&"accessKey"in e}function yr(e){return Es(e)&&"tabIndex"in e}function zx(e){return Es(e)&&"style"in e}function Hx(e){return rn(e)&&e.nodeName==="IFRAME"}function np(e){return rn(e)&&e.nodeName==="INPUT"}function rp(e){return rn(e)&&e.nodeName==="LABEL"}function Wx(e){return rn(e)&&e.nodeName==="FIELDSET"}function op(e){return rn(e)&&e.nodeName==="LEGEND"}function Vx(e){return Es(e)?e.matches('a[href],audio[controls],button,details,embed,iframe,img[usemap],input:not([type="hidden"]),label,select,textarea,video[controls]'):!1}function Gx(e){let t=e.parentElement,n=null;for(;t&&!Wx(t);)op(t)&&(n=t),t=t.parentElement;let r=(t==null?void 0:t.getAttribute("disabled"))==="";return r&&qx(n)?!1:r}function qx(e){if(!e)return!1;let t=e.previousElementSibling;for(;t!==null;){if(op(t))return!1;t=t.previousElementSibling}return!0}let sp=Symbol();function Zx(e,t=!0){return Object.assign(e,{[sp]:t})}function it(...e){let t=v.useRef(e);v.useEffect(()=>{t.current=e},[e]);let n=ce(r=>{for(let o of t.current)o!=null&&(typeof o=="function"?o(r):o.current=r)});return e.every(r=>r==null||(r==null?void 0:r[sp]))?void 0:n}let Ya=v.createContext(null);Ya.displayName="DescriptionContext";function ip(){let e=v.useContext(Ya);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,ip),t}return e}function Kx(){var e,t;return(t=(e=v.useContext(Ya))==null?void 0:e.value)!=null?t:void 0}let Yx="p";function Xx(e,t){let n=v.useId(),r=Va(),{id:o=`headlessui-description-${n}`,...s}=e,i=ip(),c=it(t);ye(()=>i.register(o),[o,i.register]);let a=r||!1,l=v.useMemo(()=>({...i.slot,disabled:a}),[i.slot,a]),u={ref:c,...i.props,id:o};return Ye()({ourProps:u,theirProps:s,slot:l,defaultTag:Yx,name:i.name||"Description"})}let Qx=ze(Xx);Object.assign(Qx,{});var Ne=(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))(Ne||{});let Ss=v.createContext(null);Ss.displayName="LabelContext";function ap(){let e=v.useContext(Ss);if(e===null){let t=new Error("You used a <Label /> component, but it is not inside a relevant parent.");throw Error.captureStackTrace&&Error.captureStackTrace(t,ap),t}return e}function cp(e){var t,n,r;let o=(n=(t=v.useContext(Ss))==null?void 0:t.value)!=null?n:void 0;return((r=e==null?void 0:e.length)!=null?r:0)>0?[o,...e].filter(Boolean).join(" "):o}function Jx({inherit:e=!1}={}){let t=cp(),[n,r]=v.useState([]),o=e?[t,...n].filter(Boolean):n;return[o.length>0?o.join(" "):void 0,v.useMemo(()=>function(s){let i=ce(a=>(r(l=>[...l,a]),()=>r(l=>{let u=l.slice(),f=u.indexOf(a);return f!==-1&&u.splice(f,1),u}))),c=v.useMemo(()=>({register:i,slot:s.slot,name:s.name,props:s.props,value:s.value}),[i,s.slot,s.name,s.props,s.value]);return v.createElement(Ss.Provider,{value:c},s.children)},[r])]}let eE="label";function tE(e,t){var n;let r=v.useId(),o=ap(),s=tp(),i=Va(),{id:c=`headlessui-label-${r}`,htmlFor:a=s??((n=o.props)==null?void 0:n.htmlFor),passive:l=!1,...u}=e,f=it(t);ye(()=>o.register(c),[c,o.register]);let p=ce(x=>{let A=x.currentTarget;if(!(x.target!==x.currentTarget&&Vx(x.target))&&(rp(A)&&x.preventDefault(),o.props&&"onClick"in o.props&&typeof o.props.onClick=="function"&&o.props.onClick(x),rp(A))){let w=document.getElementById(A.htmlFor);if(w){let T=w.getAttribute("disabled");if(T==="true"||T==="")return;let B=w.getAttribute("aria-disabled");if(B==="true"||B==="")return;(np(w)&&(w.type==="file"||w.type==="radio"||w.type==="checkbox")||w.role==="radio"||w.role==="checkbox"||w.role==="switch")&&w.click(),w.focus({preventScroll:!0})}}}),d=i||!1,h=v.useMemo(()=>({...o.slot,disabled:d}),[o.slot,d]),m={ref:f,...o.props,id:c,htmlFor:a,onClick:p};return l&&("onClick"in m&&(delete m.htmlFor,delete m.onClick),"onClick"in u&&delete u.onClick),Ye()({ourProps:m,theirProps:u,slot:h,defaultTag:a?eE:"div",name:o.name||"Label"})}let nE=ze(tE),rE=Object.assign(nE,{});function oE(e,t){return e!==null&&t!==null&&typeof e=="object"&&typeof t=="object"&&"id"in e&&"id"in t?e.id===t.id:e===t}function sE(e=oE){return v.useCallback((t,n)=>{if(typeof e=="string"){let r=e;return(t==null?void 0:t[r])===(n==null?void 0:n[r])}return e(t,n)},[e])}function iE(e){if(e===null)return{width:0,height:0};let{width:t,height:n}=e.getBoundingClientRect();return{width:t,height:n}}function aE(e,t=!1){let[n,r]=v.useReducer(()=>({}),{}),o=v.useMemo(()=>iE(e),[e,n]);return ye(()=>{if(!e)return;let s=new ResizeObserver(r);return s.observe(e),()=>{s.disconnect()}},[e]),t?{width:`${o.width}px`,height:`${o.height}px`}:o}let lp=class extends Map{constructor(t){super(),this.factory=t}get(t){let n=super.get(t);return n===void 0&&(n=this.factory(t),this.set(t,n)),n}};var cE=Object.defineProperty,lE=(e,t,n)=>t in e?cE(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,uE=(e,t,n)=>(lE(e,t+"",n),n),up=(e,t,n)=>{if(!t.has(e))throw TypeError("Cannot "+n)},at=(e,t,n)=>(up(e,t,"read from private field"),n?n.call(e):t.get(e)),Xa=(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)},fp=(e,t,n,r)=>(up(e,t,"write to private field"),t.set(e,n),n),Lt,xo,Eo;let dp=class{constructor(t){Xa(this,Lt,{}),Xa(this,xo,new lp(()=>new Set)),Xa(this,Eo,new Set),uE(this,"disposables",Pt()),fp(this,Lt,t),Bt.isServer&&this.disposables.microTask(()=>{this.dispose()})}dispose(){this.disposables.dispose()}get state(){return at(this,Lt)}subscribe(t,n){if(Bt.isServer)return()=>{};let r={selector:t,callback:n,current:t(at(this,Lt))};return at(this,Eo).add(r),this.disposables.add(()=>{at(this,Eo).delete(r)})}on(t,n){return Bt.isServer?()=>{}:(at(this,xo).get(t).add(n),this.disposables.add(()=>{at(this,xo).get(t).delete(n)}))}send(t){let n=this.reduce(at(this,Lt),t);if(n!==at(this,Lt)){fp(this,Lt,n);for(let r of at(this,Eo)){let o=r.selector(at(this,Lt));pp(r.current,o)||(r.current=o,r.callback(o))}for(let r of at(this,xo).get(t.type))r(at(this,Lt),t)}}};Lt=new WeakMap,xo=new WeakMap,Eo=new WeakMap;function pp(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:Qa(e[Symbol.iterator](),t[Symbol.iterator]()):e instanceof Map&&t instanceof Map||e instanceof Set&&t instanceof Set?e.size!==t.size?!1:Qa(e.entries(),t.entries()):hp(e)&&hp(t)?Qa(Object.entries(e)[Symbol.iterator](),Object.entries(t)[Symbol.iterator]()):!1}function Qa(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 hp(e){if(Object.prototype.toString.call(e)!=="[object Object]")return!1;let t=Object.getPrototypeOf(e);return t===null||Object.getPrototypeOf(t)===null}function Ja(e){let[t,n]=e(),r=Pt();return(...o)=>{t(...o),r.dispose(),r.microTask(n)}}var fE=Object.defineProperty,dE=(e,t,n)=>t in e?fE(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,mp=(e,t,n)=>(dE(e,typeof t!="symbol"?t+"":t,n),n),gp=(e=>(e[e.Push=0]="Push",e[e.Pop=1]="Pop",e))(gp||{});let pE={0(e,t){let n=t.id,r=e.stack,o=e.stack.indexOf(n);if(o!==-1){let s=e.stack.slice();return s.splice(o,1),s.push(n),r=s,{...e,stack:r}}return{...e,stack:[...e.stack,n]}},1(e,t){let n=t.id,r=e.stack.indexOf(n);if(r===-1)return e;let o=e.stack.slice();return o.splice(r,1),{...e,stack:o}}},hE=class Y0 extends dp{constructor(){super(...arguments),mp(this,"actions",{push:t=>this.send({type:0,id:t}),pop:t=>this.send({type:1,id:t})}),mp(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 st(n.type,pE,t,n)}};const ec=new lp(()=>hE.new());var tc={exports:{}},nc={};/**
110
+ `))}else{let p=u.props,d=p==null?void 0:p.className,h=typeof d=="function"?(...A)=>qa(d(...A),a.className):qa(d,a.className),m=h?{className:h}:{},x=Kd(u.props,vn(Za(a,["ref"])));for(let A in f)A in x&&delete f[A];return v.cloneElement(u,Object.assign({},x,f,l,{ref:o(Ix(u),l.ref)},m))}return v.createElement(s,Object.assign({},Za(a,["ref"]),s!==v.Fragment&&l,s!==v.Fragment&&f),u)}function Ox(){let e=v.useRef([]),t=v.useCallback(n=>{for(let r of e.current)r!=null&&(typeof r=="function"?r(n):r.current=n)},[]);return(...n)=>{if(!n.every(r=>r==null))return e.current=n,t}}function Cx(...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 Kd(...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 Yd(...e){if(e.length===0)return{};if(e.length===1)return e[0];let t={},n={};for(let r of e)for(let o in r)o.startsWith("on")&&typeof r[o]=="function"?(n[o]!=null||(n[o]=[]),n[o].push(r[o])):t[o]=r[o];for(let r in n)Object.assign(t,{[r](...o){let s=n[r];for(let i of s)i==null||i(...o)}});return t}function ze(e){var t;return Object.assign(v.forwardRef(e),{displayName:(t=e.displayName)!=null?t:e.name})}function vn(e){let t=Object.assign({},e);for(let n in t)t[n]===void 0&&delete t[n];return t}function Za(e,t=[]){let n=Object.assign({},e);for(let r of t)r in n&&delete n[r];return n}function Ix(e){return v.version.split(".")[0]>="19"?e.props.ref:e.ref}function Mx(e,t,n){let[r,o]=v.useState(n),s=e!==void 0,i=v.useRef(s),c=v.useRef(!1),a=v.useRef(!1);return s&&!i.current&&!c.current?(c.current=!0,i.current=s,console.error("A component is changing from uncontrolled to controlled. This may be caused by the value changing from undefined to a defined value, which should not happen.")):!s&&i.current&&!a.current&&(a.current=!0,i.current=s,console.error("A component is changing from controlled to uncontrolled. This may be caused by the value changing from a defined value to undefined, which should not happen.")),[s?e:r,ce(l=>(s||o(l),t==null?void 0:t(l)))]}function kx(e){let[t]=v.useState(e);return t}function Xd(e={},t=null,n=[]){for(let[r,o]of Object.entries(e))Jd(n,Qd(t,r),o);return n}function Qd(e,t){return e?e+"["+t+"]":t}function Jd(e,t,n){if(Array.isArray(n))for(let[r,o]of n.entries())Jd(e,Qd(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,""]):Xd(n,t,e)}function Bx(e){var t,n;let r=(t=e==null?void 0:e.form)!=null?t:e.closest("form");if(r){for(let o of r.elements)if(o!==e&&(o.tagName==="INPUT"&&o.type==="submit"||o.tagName==="BUTTON"&&o.type==="submit"||o.nodeName==="INPUT"&&o.type==="image")){o.click();return}(n=r.requestSubmit)==null||n.call(r)}}let Lx="span";var Ka=(e=>(e[e.None=1]="None",e[e.Focusable=2]="Focusable",e[e.Hidden=4]="Hidden",e))(Ka||{});function Dx(e,t){var n;let{features:r=1,...o}=e,s={ref:t,"aria-hidden":(r&2)===2?!0:(n=o["aria-hidden"])!=null?n:void 0,hidden:(r&4)===4?!0:void 0,style:{position:"fixed",top:1,left:1,width:1,height:0,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0",...(r&4)===4&&(r&2)!==2&&{display:"none"}}};return Ye()({ourProps:s,theirProps:o,slot:{},defaultTag:Lx,name:"Hidden"})}let ep=ze(Dx),Fx=v.createContext(null);function Rx({children:e}){let t=v.useContext(Fx);if(!t)return v.createElement(v.Fragment,null,e);let{target:n}=t;return n?ke.createPortal(v.createElement(v.Fragment,null,e),n):null}function jx({data:e,form:t,disabled:n,onReset:r,overrides:o}){let[s,i]=v.useState(null),c=br();return v.useEffect(()=>{if(r&&s)return c.addEventListener(s,"reset",r)},[s,t,r]),v.createElement(Rx,null,v.createElement(_x,{setForm:i,formId:t}),Xd(e).map(([a,l])=>v.createElement(ep,{features:Ka.Hidden,...vn({key:a,as:"input",type:"hidden",hidden:!0,readOnly:!0,form:t,disabled:n,name:a,value:l,...o})})))}function _x({setForm:e,formId:t}){return v.useEffect(()=>{if(t){let n=document.getElementById(t);n&&e(n)}},[e,t]),t?null:v.createElement(ep,{features:Ka.Hidden,as:"input",type:"hidden",hidden:!0,readOnly:!0,ref:n=>{if(!n)return;let r=n.closest("form");r&&e(r)}})}let Ux=v.createContext(void 0);function tp(){return v.useContext(Ux)}function Ya(e){return typeof e!="object"||e===null?!1:"nodeType"in e}function Es(e){return Ya(e)&&"tagName"in e}function rn(e){return Es(e)&&"accessKey"in e}function yr(e){return Es(e)&&"tabIndex"in e}function zx(e){return Es(e)&&"style"in e}function Hx(e){return rn(e)&&e.nodeName==="IFRAME"}function np(e){return rn(e)&&e.nodeName==="INPUT"}function rp(e){return rn(e)&&e.nodeName==="LABEL"}function Wx(e){return rn(e)&&e.nodeName==="FIELDSET"}function op(e){return rn(e)&&e.nodeName==="LEGEND"}function Vx(e){return Es(e)?e.matches('a[href],audio[controls],button,details,embed,iframe,img[usemap],input:not([type="hidden"]),label,select,textarea,video[controls]'):!1}function Gx(e){let t=e.parentElement,n=null;for(;t&&!Wx(t);)op(t)&&(n=t),t=t.parentElement;let r=(t==null?void 0:t.getAttribute("disabled"))==="";return r&&qx(n)?!1:r}function qx(e){if(!e)return!1;let t=e.previousElementSibling;for(;t!==null;){if(op(t))return!1;t=t.previousElementSibling}return!0}let sp=Symbol();function Zx(e,t=!0){return Object.assign(e,{[sp]:t})}function it(...e){let t=v.useRef(e);v.useEffect(()=>{t.current=e},[e]);let n=ce(r=>{for(let o of t.current)o!=null&&(typeof o=="function"?o(r):o.current=r)});return e.every(r=>r==null||(r==null?void 0:r[sp]))?void 0:n}let Xa=v.createContext(null);Xa.displayName="DescriptionContext";function ip(){let e=v.useContext(Xa);if(e===null){let t=new Error("You used a <Description /> component, but it is not inside a relevant parent.");throw Error.captureStackTrace&&Error.captureStackTrace(t,ip),t}return e}function Kx(){var e,t;return(t=(e=v.useContext(Xa))==null?void 0:e.value)!=null?t:void 0}let Yx="p";function Xx(e,t){let n=v.useId(),r=Ga(),{id:o=`headlessui-description-${n}`,...s}=e,i=ip(),c=it(t);ye(()=>i.register(o),[o,i.register]);let a=r||!1,l=v.useMemo(()=>({...i.slot,disabled:a}),[i.slot,a]),u={ref:c,...i.props,id:o};return Ye()({ourProps:u,theirProps:s,slot:l,defaultTag:Yx,name:i.name||"Description"})}let Qx=ze(Xx);Object.assign(Qx,{});var Ne=(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))(Ne||{});let Ss=v.createContext(null);Ss.displayName="LabelContext";function ap(){let e=v.useContext(Ss);if(e===null){let t=new Error("You used a <Label /> component, but it is not inside a relevant parent.");throw Error.captureStackTrace&&Error.captureStackTrace(t,ap),t}return e}function cp(e){var t,n,r;let o=(n=(t=v.useContext(Ss))==null?void 0:t.value)!=null?n:void 0;return((r=e==null?void 0:e.length)!=null?r:0)>0?[o,...e].filter(Boolean).join(" "):o}function Jx({inherit:e=!1}={}){let t=cp(),[n,r]=v.useState([]),o=e?[t,...n].filter(Boolean):n;return[o.length>0?o.join(" "):void 0,v.useMemo(()=>function(s){let i=ce(a=>(r(l=>[...l,a]),()=>r(l=>{let u=l.slice(),f=u.indexOf(a);return f!==-1&&u.splice(f,1),u}))),c=v.useMemo(()=>({register:i,slot:s.slot,name:s.name,props:s.props,value:s.value}),[i,s.slot,s.name,s.props,s.value]);return v.createElement(Ss.Provider,{value:c},s.children)},[r])]}let eE="label";function tE(e,t){var n;let r=v.useId(),o=ap(),s=tp(),i=Ga(),{id:c=`headlessui-label-${r}`,htmlFor:a=s??((n=o.props)==null?void 0:n.htmlFor),passive:l=!1,...u}=e,f=it(t);ye(()=>o.register(c),[c,o.register]);let p=ce(x=>{let A=x.currentTarget;if(!(x.target!==x.currentTarget&&Vx(x.target))&&(rp(A)&&x.preventDefault(),o.props&&"onClick"in o.props&&typeof o.props.onClick=="function"&&o.props.onClick(x),rp(A))){let w=document.getElementById(A.htmlFor);if(w){let T=w.getAttribute("disabled");if(T==="true"||T==="")return;let B=w.getAttribute("aria-disabled");if(B==="true"||B==="")return;(np(w)&&(w.type==="file"||w.type==="radio"||w.type==="checkbox")||w.role==="radio"||w.role==="checkbox"||w.role==="switch")&&w.click(),w.focus({preventScroll:!0})}}}),d=i||!1,h=v.useMemo(()=>({...o.slot,disabled:d}),[o.slot,d]),m={ref:f,...o.props,id:c,htmlFor:a,onClick:p};return l&&("onClick"in m&&(delete m.htmlFor,delete m.onClick),"onClick"in u&&delete u.onClick),Ye()({ourProps:m,theirProps:u,slot:h,defaultTag:a?eE:"div",name:o.name||"Label"})}let nE=ze(tE),rE=Object.assign(nE,{});function oE(e,t){return e!==null&&t!==null&&typeof e=="object"&&typeof t=="object"&&"id"in e&&"id"in t?e.id===t.id:e===t}function sE(e=oE){return v.useCallback((t,n)=>{if(typeof e=="string"){let r=e;return(t==null?void 0:t[r])===(n==null?void 0:n[r])}return e(t,n)},[e])}function iE(e){if(e===null)return{width:0,height:0};let{width:t,height:n}=e.getBoundingClientRect();return{width:t,height:n}}function aE(e,t=!1){let[n,r]=v.useReducer(()=>({}),{}),o=v.useMemo(()=>iE(e),[e,n]);return ye(()=>{if(!e)return;let s=new ResizeObserver(r);return s.observe(e),()=>{s.disconnect()}},[e]),t?{width:`${o.width}px`,height:`${o.height}px`}:o}let lp=class extends Map{constructor(t){super(),this.factory=t}get(t){let n=super.get(t);return n===void 0&&(n=this.factory(t),this.set(t,n)),n}};var cE=Object.defineProperty,lE=(e,t,n)=>t in e?cE(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,uE=(e,t,n)=>(lE(e,t+"",n),n),up=(e,t,n)=>{if(!t.has(e))throw TypeError("Cannot "+n)},at=(e,t,n)=>(up(e,t,"read from private field"),n?n.call(e):t.get(e)),Qa=(e,t,n)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,n)},fp=(e,t,n,r)=>(up(e,t,"write to private field"),t.set(e,n),n),Lt,xo,Eo;let dp=class{constructor(t){Qa(this,Lt,{}),Qa(this,xo,new lp(()=>new Set)),Qa(this,Eo,new Set),uE(this,"disposables",Pt()),fp(this,Lt,t),Bt.isServer&&this.disposables.microTask(()=>{this.dispose()})}dispose(){this.disposables.dispose()}get state(){return at(this,Lt)}subscribe(t,n){if(Bt.isServer)return()=>{};let r={selector:t,callback:n,current:t(at(this,Lt))};return at(this,Eo).add(r),this.disposables.add(()=>{at(this,Eo).delete(r)})}on(t,n){return Bt.isServer?()=>{}:(at(this,xo).get(t).add(n),this.disposables.add(()=>{at(this,xo).get(t).delete(n)}))}send(t){let n=this.reduce(at(this,Lt),t);if(n!==at(this,Lt)){fp(this,Lt,n);for(let r of at(this,Eo)){let o=r.selector(at(this,Lt));pp(r.current,o)||(r.current=o,r.callback(o))}for(let r of at(this,xo).get(t.type))r(at(this,Lt),t)}}};Lt=new WeakMap,xo=new WeakMap,Eo=new WeakMap;function pp(e,t){return Object.is(e,t)?!0:typeof e!="object"||e===null||typeof t!="object"||t===null?!1:Array.isArray(e)&&Array.isArray(t)?e.length!==t.length?!1:Ja(e[Symbol.iterator](),t[Symbol.iterator]()):e instanceof Map&&t instanceof Map||e instanceof Set&&t instanceof Set?e.size!==t.size?!1:Ja(e.entries(),t.entries()):hp(e)&&hp(t)?Ja(Object.entries(e)[Symbol.iterator](),Object.entries(t)[Symbol.iterator]()):!1}function Ja(e,t){do{let n=e.next(),r=t.next();if(n.done&&r.done)return!0;if(n.done||r.done||!Object.is(n.value,r.value))return!1}while(!0)}function hp(e){if(Object.prototype.toString.call(e)!=="[object Object]")return!1;let t=Object.getPrototypeOf(e);return t===null||Object.getPrototypeOf(t)===null}function ec(e){let[t,n]=e(),r=Pt();return(...o)=>{t(...o),r.dispose(),r.microTask(n)}}var fE=Object.defineProperty,dE=(e,t,n)=>t in e?fE(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,mp=(e,t,n)=>(dE(e,typeof t!="symbol"?t+"":t,n),n),gp=(e=>(e[e.Push=0]="Push",e[e.Pop=1]="Pop",e))(gp||{});let pE={0(e,t){let n=t.id,r=e.stack,o=e.stack.indexOf(n);if(o!==-1){let s=e.stack.slice();return s.splice(o,1),s.push(n),r=s,{...e,stack:r}}return{...e,stack:[...e.stack,n]}},1(e,t){let n=t.id,r=e.stack.indexOf(n);if(r===-1)return e;let o=e.stack.slice();return o.splice(r,1),{...e,stack:o}}},hE=class Y0 extends dp{constructor(){super(...arguments),mp(this,"actions",{push:t=>this.send({type:0,id:t}),pop:t=>this.send({type:1,id:t})}),mp(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 st(n.type,pE,t,n)}};const tc=new lp(()=>hE.new());var nc={exports:{}},rc={};/**
111
111
  * @license React
112
112
  * use-sync-external-store-with-selector.production.js
113
113
  *
@@ -115,7 +115,7 @@ ${xb(d)}`),super(t.shortMessage,{cause:t,docsPath:r,metaMessages:[...t.metaMessa
115
115
  *
116
116
  * This source code is licensed under the MIT license found in the
117
117
  * LICENSE file in the root directory of this source tree.
118
- */var bp;function mE(){if(bp)return nc;bp=1;var e=v;function t(a,l){return a===l&&(a!==0||1/a===1/l)||a!==a&&l!==l}var n=typeof Object.is=="function"?Object.is:t,r=e.useSyncExternalStore,o=e.useRef,s=e.useEffect,i=e.useMemo,c=e.useDebugValue;return nc.useSyncExternalStoreWithSelector=function(a,l,u,f,p){var d=o(null);if(d.current===null){var h={hasValue:!1,value:null};d.current=h}else h=d.current;d=i(function(){function x(L){if(!A){if(A=!0,w=L,L=f(L),p!==void 0&&h.hasValue){var F=h.value;if(p(F,L))return T=F}return T=L}if(F=T,n(w,L))return F;var j=f(L);return p!==void 0&&p(F,j)?(w=L,F):(w=L,T=j)}var A=!1,w,T,B=u===void 0?null:u;return[function(){return x(l())},B===null?void 0:function(){return x(B())}]},[l,u,f,p]);var m=r(a,d[0],d[1]);return s(function(){h.hasValue=!0,h.value=m},[m]),c(m),m},nc}var rc={};/**
118
+ */var bp;function mE(){if(bp)return rc;bp=1;var e=v;function t(a,l){return a===l&&(a!==0||1/a===1/l)||a!==a&&l!==l}var n=typeof Object.is=="function"?Object.is:t,r=e.useSyncExternalStore,o=e.useRef,s=e.useEffect,i=e.useMemo,c=e.useDebugValue;return rc.useSyncExternalStoreWithSelector=function(a,l,u,f,p){var d=o(null);if(d.current===null){var h={hasValue:!1,value:null};d.current=h}else h=d.current;d=i(function(){function x(L){if(!A){if(A=!0,w=L,L=f(L),p!==void 0&&h.hasValue){var F=h.value;if(p(F,L))return T=F}return T=L}if(F=T,n(w,L))return F;var _=f(L);return p!==void 0&&p(F,_)?(w=L,F):(w=L,T=_)}var A=!1,w,T,B=u===void 0?null:u;return[function(){return x(l())},B===null?void 0:function(){return x(B())}]},[l,u,f,p]);var m=r(a,d[0],d[1]);return s(function(){h.hasValue=!0,h.value=m},[m]),c(m),m},rc}var oc={};/**
119
119
  * @license React
120
120
  * use-sync-external-store-with-selector.development.js
121
121
  *
@@ -123,17 +123,17 @@ ${xb(d)}`),super(t.shortMessage,{cause:t,docsPath:r,metaMessages:[...t.metaMessa
123
123
  *
124
124
  * This source code is licensed under the MIT license found in the
125
125
  * LICENSE file in the root directory of this source tree.
126
- */var yp;function gE(){return yp||(yp=1,process.env.NODE_ENV!=="production"&&function(){function e(a,l){return a===l&&(a!==0||1/a===1/l)||a!==a&&l!==l}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var t=v,n=typeof Object.is=="function"?Object.is:e,r=t.useSyncExternalStore,o=t.useRef,s=t.useEffect,i=t.useMemo,c=t.useDebugValue;rc.useSyncExternalStoreWithSelector=function(a,l,u,f,p){var d=o(null);if(d.current===null){var h={hasValue:!1,value:null};d.current=h}else h=d.current;d=i(function(){function x(L){if(!A){if(A=!0,w=L,L=f(L),p!==void 0&&h.hasValue){var F=h.value;if(p(F,L))return T=F}return T=L}if(F=T,n(w,L))return F;var j=f(L);return p!==void 0&&p(F,j)?(w=L,F):(w=L,T=j)}var A=!1,w,T,B=u===void 0?null:u;return[function(){return x(l())},B===null?void 0:function(){return x(B())}]},[l,u,f,p]);var m=r(a,d[0],d[1]);return s(function(){h.hasValue=!0,h.value=m},[m]),c(m),m},typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())}()),rc}process.env.NODE_ENV==="production"?tc.exports=mE():tc.exports=gE();var bE=tc.exports;function ct(e,t,n=pp){return bE.useSyncExternalStoreWithSelector(ce(r=>e.subscribe(yE,r)),ce(()=>e.state),ce(()=>e.state),ce(t),n)}function yE(e){return e}function wp(e,t){let n=v.useId(),r=ec.get(t),[o,s]=ct(r,v.useCallback(i=>[r.selectors.isTop(i,n),r.selectors.inStack(i,n)],[r,n]));return ye(()=>{if(e)return r.actions.push(n),()=>r.actions.pop(n)},[r,e,n]),e?s?o:!0:!1}let oc=new Map,So=new Map;function vp(e){var t;let n=(t=So.get(e))!=null?t:0;return So.set(e,n+1),n!==0?()=>xp(e):(oc.set(e,{"aria-hidden":e.getAttribute("aria-hidden"),inert:e.inert}),e.setAttribute("aria-hidden","true"),e.inert=!0,()=>xp(e))}function xp(e){var t;let n=(t=So.get(e))!=null?t:1;if(n===1?So.delete(e):So.set(e,n-1),n!==1)return;let r=oc.get(e);r&&(r["aria-hidden"]===null?e.removeAttribute("aria-hidden"):e.setAttribute("aria-hidden",r["aria-hidden"]),e.inert=r.inert,oc.delete(e))}function wE(e,{allowed:t,disallowed:n}={}){let r=wp(e,"inert-others");ye(()=>{var o,s;if(!r)return;let i=Pt();for(let a of(o=n==null?void 0:n())!=null?o:[])a&&i.add(vp(a));let c=(s=t==null?void 0:t())!=null?s:[];for(let a of c){if(!a)continue;let l=vo(a);if(!l)continue;let u=a.parentElement;for(;u&&u!==l.body;){for(let f of u.children)c.some(p=>f.contains(p))||i.add(vp(f));u=u.parentElement}}return i.dispose},[r,t,n])}function vE(e,t,n){let r=zn(o=>{let s=o.getBoundingClientRect();s.x===0&&s.y===0&&s.width===0&&s.height===0&&n()});v.useEffect(()=>{if(!e)return;let o=t===null?null:rn(t)?t:t.current;if(!o)return;let s=Pt();if(typeof ResizeObserver<"u"){let i=new ResizeObserver(()=>r.current(o));i.observe(o),s.add(()=>i.disconnect())}if(typeof IntersectionObserver<"u"){let i=new IntersectionObserver(()=>r.current(o));i.observe(o),s.add(()=>i.disconnect())}return()=>s.dispose()},[t,r,e])}let sc=["[contentEditable=true]","[tabindex]","a[href]","area[href]","button:not([disabled])","iframe","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].map(e=>`${e}:not([tabindex='-1'])`).join(","),xE=["[data-autofocus]"].map(e=>`${e}:not([tabindex='-1'])`).join(",");var ic=(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))(ic||{}),EE=(e=>(e[e.Error=0]="Error",e[e.Overflow=1]="Overflow",e[e.Success=2]="Success",e[e.Underflow=3]="Underflow",e))(EE||{}),SE=(e=>(e[e.Previous=-1]="Previous",e[e.Next=1]="Next",e))(SE||{});function Ep(e=document.body){return e==null?[]:Array.from(e.querySelectorAll(sc)).sort((t,n)=>Math.sign((t.tabIndex||Number.MAX_SAFE_INTEGER)-(n.tabIndex||Number.MAX_SAFE_INTEGER)))}function PE(e=document.body){return e==null?[]:Array.from(e.querySelectorAll(xE)).sort((t,n)=>Math.sign((t.tabIndex||Number.MAX_SAFE_INTEGER)-(n.tabIndex||Number.MAX_SAFE_INTEGER)))}var ac=(e=>(e[e.Strict=0]="Strict",e[e.Loose=1]="Loose",e))(ac||{});function Sp(e,t=0){var n;return e===((n=vo(e))==null?void 0:n.body)?!1:st(t,{0(){return e.matches(sc)},1(){let r=e;for(;r!==null;){if(r.matches(sc))return!0;r=r.parentElement}return!1}})}var $E=(e=>(e[e.Keyboard=0]="Keyboard",e[e.Mouse=1]="Mouse",e))($E||{});typeof window<"u"&&typeof document<"u"&&(document.addEventListener("keydown",e=>{e.metaKey||e.altKey||e.ctrlKey||(document.documentElement.dataset.headlessuiFocusVisible="")},!0),document.addEventListener("click",e=>{e.detail===1?delete document.documentElement.dataset.headlessuiFocusVisible:e.detail===0&&(document.documentElement.dataset.headlessuiFocusVisible="")},!0));let TE=["textarea","input"].join(",");function AE(e){var t,n;return(n=(t=e==null?void 0:e.matches)==null?void 0:t.call(e,TE))!=null?n:!1}function Pp(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 NE(e,t){return OE(Ep(),t,{relativeTo:e})}function OE(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?Pp(e):e:t&64?PE(e):Ep(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")})(),l=t&32?{preventScroll:!0}:{},u=0,f=i.length,p;do{if(u>=f||u+f<=0)return 0;let d=a+u;if(t&16)d=(d+f)%f;else{if(d<0)return 3;if(d>=f)return 1}p=i[d],p==null||p.focus(l),u+=c}while(p!==s.activeElement);return t&6&&AE(p)&&p.select(),2}function $p(){return/iPhone/gi.test(window.navigator.platform)||/Mac/gi.test(window.navigator.platform)&&window.navigator.maxTouchPoints>0}function CE(){return/Android/gi.test(window.navigator.userAgent)}function Tp(){return $p()||CE()}function wr(e,t,n,r){let o=zn(n);v.useEffect(()=>{if(!e)return;function s(i){o.current(i)}return document.addEventListener(t,s,r),()=>document.removeEventListener(t,s,r)},[e,t,r])}function IE(e,t,n,r){let o=zn(n);v.useEffect(()=>{if(!e)return;function s(i){o.current(i)}return window.addEventListener(t,s,r),()=>window.removeEventListener(t,s,r)},[e,t,r])}const Ap=30;function ME(e,t,n){let r=zn(n),o=v.useCallback(function(c,a){if(c.defaultPrevented)return;let l=a(c);if(l===null||!l.getRootNode().contains(l)||!l.isConnected)return;let u=function f(p){return typeof p=="function"?f(p()):Array.isArray(p)||p instanceof Set?p:[p]}(t);for(let f of u)if(f!==null&&(f.contains(l)||c.composed&&c.composedPath().includes(f)))return;return!Sp(l,ac.Loose)&&l.tabIndex!==-1&&c.preventDefault(),r.current(c,l)},[r,t]),s=v.useRef(null);wr(e,"pointerdown",c=>{var a,l;Tp()||(s.current=((l=(a=c.composedPath)==null?void 0:a.call(c))==null?void 0:l[0])||c.target)},!0),wr(e,"pointerup",c=>{if(Tp()||!s.current)return;let a=s.current;return s.current=null,o(c,()=>a)},!0);let i=v.useRef({x:0,y:0});wr(e,"touchstart",c=>{i.current.x=c.touches[0].clientX,i.current.y=c.touches[0].clientY},!0),wr(e,"touchend",c=>{let a={x:c.changedTouches[0].clientX,y:c.changedTouches[0].clientY};if(!(Math.abs(a.x-i.current.x)>=Ap||Math.abs(a.y-i.current.y)>=Ap))return o(c,()=>yr(c.target)?c.target:null)},!0),IE(e,"blur",c=>o(c,()=>Hx(window.document.activeElement)?window.document.activeElement:null),!0)}function cc(...e){return v.useMemo(()=>vo(...e),[...e])}var kE=(e=>(e[e.Ignore=0]="Ignore",e[e.Select=1]="Select",e[e.Close=2]="Close",e))(kE||{});const Ps={Ignore:{kind:0},Select:e=>({kind:1,target:e}),Close:{kind:2}},BE=200,Np=5;function LE(e,{trigger:t,action:n,close:r,select:o}){let s=v.useRef(null),i=v.useRef(null),c=v.useRef(null);wr(e&&t!==null,"pointerdown",a=>{Ka(a==null?void 0:a.target)&&t!=null&&t.contains(a.target)&&(i.current=a.x,c.current=a.y,s.current=a.timeStamp)}),wr(e&&t!==null,"pointerup",a=>{var l,u;let f=s.current;if(f===null||(s.current=null,!yr(a.target))||Math.abs(a.x-((l=i.current)!=null?l:a.x))<Np&&Math.abs(a.y-((u=c.current)!=null?u:a.y))<Np)return;let p=n(a);switch(p.kind){case 0:return;case 1:{a.timeStamp-f>BE&&(o(p.target),r());break}case 2:{r();break}}},{capture:!0})}function DE(e,t){return v.useMemo(()=>{var n;if(e.type)return e.type;let r=(n=e.as)!=null?n:"button";if(typeof r=="string"&&r.toLowerCase()==="button"||(t==null?void 0:t.tagName)==="BUTTON"&&!t.hasAttribute("type"))return"button"},[e.type,e.as,t])}function FE(e){return v.useSyncExternalStore(e.subscribe,e.getSnapshot,e.getSnapshot)}function RE(e,t){let n=e(),r=new Set;return{getSnapshot(){return n},subscribe(o){return r.add(o),()=>r.delete(o)},dispatch(o,...s){let i=t[o].call(n,...s);i&&(n=i,r.forEach(c=>c()))}}}function jE(){let e;return{before({doc:t}){var n;let r=t.documentElement,o=(n=t.defaultView)!=null?n:window;e=Math.max(0,o.innerWidth-r.clientWidth)},after({doc:t,d:n}){let r=t.documentElement,o=Math.max(0,r.clientWidth-r.offsetWidth),s=Math.max(0,e-o);n.style(r,"paddingRight",`${s}px`)}}}function _E(){return $p()?{before({doc:e,d:t,meta:n}){function r(o){return n.containers.flatMap(s=>s()).some(s=>s.contains(o))}t.microTask(()=>{var o;if(window.getComputedStyle(e.documentElement).scrollBehavior!=="auto"){let c=Pt();c.style(e.documentElement,"scrollBehavior","auto"),t.add(()=>t.microTask(()=>c.dispose()))}let s=(o=window.scrollY)!=null?o:window.pageYOffset,i=null;t.addEventListener(e,"click",c=>{if(yr(c.target))try{let a=c.target.closest("a");if(!a)return;let{hash:l}=new URL(a.href),u=e.querySelector(l);yr(u)&&!r(u)&&(i=u)}catch{}},!0),t.addEventListener(e,"touchstart",c=>{if(yr(c.target)&&zx(c.target))if(r(c.target)){let a=c.target;for(;a.parentElement&&r(a.parentElement);)a=a.parentElement;t.style(a,"overscrollBehavior","contain")}else t.style(c.target,"touchAction","none")}),t.addEventListener(e,"touchmove",c=>{if(yr(c.target)){if(np(c.target))return;if(r(c.target)){let a=c.target;for(;a.parentElement&&a.dataset.headlessuiPortal!==""&&!(a.scrollHeight>a.clientHeight||a.scrollWidth>a.clientWidth);)a=a.parentElement;a.dataset.headlessuiPortal===""&&c.preventDefault()}else c.preventDefault()}},{passive:!1}),t.add(()=>{var c;let a=(c=window.scrollY)!=null?c:window.pageYOffset;s!==a&&window.scrollTo(0,s),i&&i.isConnected&&(i.scrollIntoView({block:"nearest"}),i=null)})})}}:{}}function UE(){return{before({doc:e,d:t}){t.style(e.documentElement,"overflow","hidden")}}}function zE(e){let t={};for(let n of e)Object.assign(t,n(t));return t}let Hn=RE(()=>new Map,{PUSH(e,t){var n;let r=(n=this.get(e))!=null?n:{doc:e,count:0,d:Pt(),meta:new Set};return r.count++,r.meta.add(t),this.set(e,r),this},POP(e,t){let n=this.get(e);return n&&(n.count--,n.meta.delete(t)),this},SCROLL_PREVENT({doc:e,d:t,meta:n}){let r={doc:e,d:t,meta:zE(n)},o=[_E(),jE(),UE()];o.forEach(({before:s})=>s==null?void 0:s(r)),o.forEach(({after:s})=>s==null?void 0:s(r))},SCROLL_ALLOW({d:e}){e.dispose()},TEARDOWN({doc:e}){this.delete(e)}});Hn.subscribe(()=>{let e=Hn.getSnapshot(),t=new Map;for(let[n]of e)t.set(n,n.documentElement.style.overflow);for(let n of e.values()){let r=t.get(n.doc)==="hidden",o=n.count!==0;(o&&!r||!o&&r)&&Hn.dispatch(n.count>0?"SCROLL_PREVENT":"SCROLL_ALLOW",n),n.count===0&&Hn.dispatch("TEARDOWN",n)}});function HE(e,t,n=()=>({containers:[]})){let r=FE(Hn),o=t?r.get(t):void 0,s=o?o.count>0:!1;return ye(()=>{if(!(!t||!e))return Hn.dispatch("PUSH",t,n),()=>Hn.dispatch("POP",t,n)},[e,t]),s}function WE(e,t,n=()=>[document.body]){let r=wp(e,"scroll-lock");HE(r,t,o=>{var s;return{containers:[...(s=o.containers)!=null?s:[],n]}})}function Op(e){return[e.screenX,e.screenY]}function VE(){let e=v.useRef([-1,-1]);return{wasMoved(t){let n=Op(t);return e.current[0]===n[0]&&e.current[1]===n[1]?!1:(e.current=n,!0)},update(t){e.current=Op(t)}}}function GE(e=0){let[t,n]=v.useState(e),r=v.useCallback(a=>n(a),[t]),o=v.useCallback(a=>n(l=>l|a),[t]),s=v.useCallback(a=>(t&a)===a,[t]),i=v.useCallback(a=>n(l=>l&~a),[n]),c=v.useCallback(a=>n(l=>l^a),[n]);return{flags:t,setFlag:r,addFlag:o,hasFlag:s,removeFlag:i,toggleFlag:c}}var Cp,Ip;typeof process<"u"&&typeof globalThis<"u"&&typeof Element<"u"&&((Cp=process==null?void 0:process.env)==null?void 0:Cp.NODE_ENV)==="test"&&typeof((Ip=Element==null?void 0:Element.prototype)==null?void 0:Ip.getAnimations)>"u"&&(Element.prototype.getAnimations=function(){return console.warn(["Headless UI has polyfilled `Element.prototype.getAnimations` for your tests.","Please install a proper polyfill e.g. `jsdom-testing-mocks`, to silence these warnings.","","Example usage:","```js","import { mockAnimationsApi } from 'jsdom-testing-mocks'","mockAnimationsApi()","```"].join(`
127
- `)),[]});var qE=(e=>(e[e.None=0]="None",e[e.Closed=1]="Closed",e[e.Enter=2]="Enter",e[e.Leave=4]="Leave",e))(qE||{});function Mp(e){let t={};for(let n in e)e[n]===!0&&(t[`data-${n}`]="");return t}function kp(e,t,n,r){let[o,s]=v.useState(n),{hasFlag:i,addFlag:c,removeFlag:a}=GE(e&&o?3:0),l=v.useRef(!1),u=v.useRef(!1),f=br();return ye(()=>{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),ZE(t,{inFlight:l,prepare(){u.current?u.current=!1:u.current=l.current,l.current=!0,!u.current&&(n?(c(3),a(4)):(c(4),a(2)))},run(){u.current?n?(a(3),c(4)):(a(4),c(3)):n?a(1):c(1)},done(){var d;u.current&&typeof t.getAnimations=="function"&&t.getAnimations().length>0||(l.current=!1,a(7),n||s(!1),(d=r==null?void 0:r.end)==null||d.call(r,n))}})}},[e,n,t,f]),e?[o,{closed:i(1),enter:i(2),leave:i(4),transition:i(2)||i(4)}]:[n,{closed:void 0,enter:void 0,leave:void 0,transition:void 0}]}function ZE(e,{prepare:t,run:n,done:r,inFlight:o}){let s=Pt();return YE(e,{prepare:t,inFlight:o}),s.nextFrame(()=>{n(),s.requestAnimationFrame(()=>{s.add(KE(e,r))})}),s.dispose}function KE(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 YE(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 $s(){return typeof window<"u"}function vr(e){return lc(e)?(e.nodeName||"").toLowerCase():"#document"}function He(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Dt(e){var t;return(t=(lc(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function lc(e){return $s()?e instanceof Node||e instanceof He(e).Node:!1}function fe(e){return $s()?e instanceof Element||e instanceof He(e).Element:!1}function De(e){return $s()?e instanceof HTMLElement||e instanceof He(e).HTMLElement:!1}function uc(e){return!$s()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof He(e).ShadowRoot}const XE=new Set(["inline","contents"]);function Po(e){const{overflow:t,overflowX:n,overflowY:r,display:o}=lt(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!XE.has(o)}const QE=new Set(["table","td","th"]);function JE(e){return QE.has(vr(e))}const e2=[":popover-open",":modal"];function Ts(e){return e2.some(t=>{try{return e.matches(t)}catch{return!1}})}const t2=["transform","translate","scale","rotate","perspective"],n2=["transform","translate","scale","rotate","perspective","filter"],r2=["paint","layout","strict","content"];function fc(e){const t=As(),n=fe(e)?lt(e):e;return t2.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)||n2.some(r=>(n.willChange||"").includes(r))||r2.some(r=>(n.contain||"").includes(r))}function o2(e){let t=sn(e);for(;De(t)&&!on(t);){if(fc(t))return t;if(Ts(t))return null;t=sn(t)}return null}function As(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const s2=new Set(["html","body","#document"]);function on(e){return s2.has(vr(e))}function lt(e){return He(e).getComputedStyle(e)}function Ns(e){return fe(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function sn(e){if(vr(e)==="html")return e;const t=e.assignedSlot||e.parentNode||uc(e)&&e.host||Dt(e);return uc(t)?t.host:t}function Bp(e){const t=sn(e);return on(t)?e.ownerDocument?e.ownerDocument.body:e.body:De(t)&&Po(t)?t:Bp(t)}function xn(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const o=Bp(e),s=o===((r=e.ownerDocument)==null?void 0:r.body),i=He(o);if(s){const c=dc(i);return t.concat(i,i.visualViewport||[],Po(o)?o:[],c&&n?xn(c):[])}return t.concat(o,xn(o,[],n))}function dc(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function i2(){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 an=Math.min,Me=Math.max,$o=Math.round,Os=Math.floor,Ft=e=>({x:e,y:e}),a2={left:"right",right:"left",bottom:"top",top:"bottom"},c2={start:"end",end:"start"};function pc(e,t,n){return Me(e,an(t,n))}function Wn(e,t){return typeof e=="function"?e(t):e}function En(e){return e.split("-")[0]}function xr(e){return e.split("-")[1]}function Lp(e){return e==="x"?"y":"x"}function hc(e){return e==="y"?"height":"width"}const l2=new Set(["top","bottom"]);function cn(e){return l2.has(En(e))?"y":"x"}function mc(e){return Lp(cn(e))}function u2(e,t,n){n===void 0&&(n=!1);const r=xr(e),o=mc(e),s=hc(o);let i=o==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[s]>t.floating[s]&&(i=Cs(i)),[i,Cs(i)]}function f2(e){const t=Cs(e);return[gc(e),t,gc(t)]}function gc(e){return e.replace(/start|end/g,t=>c2[t])}const Dp=["left","right"],Fp=["right","left"],d2=["top","bottom"],p2=["bottom","top"];function h2(e,t,n){switch(e){case"top":case"bottom":return n?t?Fp:Dp:t?Dp:Fp;case"left":case"right":return t?d2:p2;default:return[]}}function m2(e,t,n,r){const o=xr(e);let s=h2(En(e),n==="start",r);return o&&(s=s.map(i=>i+"-"+o),t&&(s=s.concat(s.map(gc)))),s}function Cs(e){return e.replace(/left|right|bottom|top/g,t=>a2[t])}function g2(e){return{top:0,right:0,bottom:0,left:0,...e}}function Rp(e){return typeof e!="number"?g2(e):{top:e,right:e,bottom:e,left:e}}function Is(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}}/*!
126
+ */var yp;function gE(){return yp||(yp=1,process.env.NODE_ENV!=="production"&&function(){function e(a,l){return a===l&&(a!==0||1/a===1/l)||a!==a&&l!==l}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var t=v,n=typeof Object.is=="function"?Object.is:e,r=t.useSyncExternalStore,o=t.useRef,s=t.useEffect,i=t.useMemo,c=t.useDebugValue;oc.useSyncExternalStoreWithSelector=function(a,l,u,f,p){var d=o(null);if(d.current===null){var h={hasValue:!1,value:null};d.current=h}else h=d.current;d=i(function(){function x(L){if(!A){if(A=!0,w=L,L=f(L),p!==void 0&&h.hasValue){var F=h.value;if(p(F,L))return T=F}return T=L}if(F=T,n(w,L))return F;var _=f(L);return p!==void 0&&p(F,_)?(w=L,F):(w=L,T=_)}var A=!1,w,T,B=u===void 0?null:u;return[function(){return x(l())},B===null?void 0:function(){return x(B())}]},[l,u,f,p]);var m=r(a,d[0],d[1]);return s(function(){h.hasValue=!0,h.value=m},[m]),c(m),m},typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())}()),oc}process.env.NODE_ENV==="production"?nc.exports=mE():nc.exports=gE();var bE=nc.exports;function ct(e,t,n=pp){return bE.useSyncExternalStoreWithSelector(ce(r=>e.subscribe(yE,r)),ce(()=>e.state),ce(()=>e.state),ce(t),n)}function yE(e){return e}function wp(e,t){let n=v.useId(),r=tc.get(t),[o,s]=ct(r,v.useCallback(i=>[r.selectors.isTop(i,n),r.selectors.inStack(i,n)],[r,n]));return ye(()=>{if(e)return r.actions.push(n),()=>r.actions.pop(n)},[r,e,n]),e?s?o:!0:!1}let sc=new Map,So=new Map;function vp(e){var t;let n=(t=So.get(e))!=null?t:0;return So.set(e,n+1),n!==0?()=>xp(e):(sc.set(e,{"aria-hidden":e.getAttribute("aria-hidden"),inert:e.inert}),e.setAttribute("aria-hidden","true"),e.inert=!0,()=>xp(e))}function xp(e){var t;let n=(t=So.get(e))!=null?t:1;if(n===1?So.delete(e):So.set(e,n-1),n!==1)return;let r=sc.get(e);r&&(r["aria-hidden"]===null?e.removeAttribute("aria-hidden"):e.setAttribute("aria-hidden",r["aria-hidden"]),e.inert=r.inert,sc.delete(e))}function wE(e,{allowed:t,disallowed:n}={}){let r=wp(e,"inert-others");ye(()=>{var o,s;if(!r)return;let i=Pt();for(let a of(o=n==null?void 0:n())!=null?o:[])a&&i.add(vp(a));let c=(s=t==null?void 0:t())!=null?s:[];for(let a of c){if(!a)continue;let l=vo(a);if(!l)continue;let u=a.parentElement;for(;u&&u!==l.body;){for(let f of u.children)c.some(p=>f.contains(p))||i.add(vp(f));u=u.parentElement}}return i.dispose},[r,t,n])}function vE(e,t,n){let r=zn(o=>{let s=o.getBoundingClientRect();s.x===0&&s.y===0&&s.width===0&&s.height===0&&n()});v.useEffect(()=>{if(!e)return;let o=t===null?null:rn(t)?t:t.current;if(!o)return;let s=Pt();if(typeof ResizeObserver<"u"){let i=new ResizeObserver(()=>r.current(o));i.observe(o),s.add(()=>i.disconnect())}if(typeof IntersectionObserver<"u"){let i=new IntersectionObserver(()=>r.current(o));i.observe(o),s.add(()=>i.disconnect())}return()=>s.dispose()},[t,r,e])}let ic=["[contentEditable=true]","[tabindex]","a[href]","area[href]","button:not([disabled])","iframe","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].map(e=>`${e}:not([tabindex='-1'])`).join(","),xE=["[data-autofocus]"].map(e=>`${e}:not([tabindex='-1'])`).join(",");var ac=(e=>(e[e.First=1]="First",e[e.Previous=2]="Previous",e[e.Next=4]="Next",e[e.Last=8]="Last",e[e.WrapAround=16]="WrapAround",e[e.NoScroll=32]="NoScroll",e[e.AutoFocus=64]="AutoFocus",e))(ac||{}),EE=(e=>(e[e.Error=0]="Error",e[e.Overflow=1]="Overflow",e[e.Success=2]="Success",e[e.Underflow=3]="Underflow",e))(EE||{}),SE=(e=>(e[e.Previous=-1]="Previous",e[e.Next=1]="Next",e))(SE||{});function Ep(e=document.body){return e==null?[]:Array.from(e.querySelectorAll(ic)).sort((t,n)=>Math.sign((t.tabIndex||Number.MAX_SAFE_INTEGER)-(n.tabIndex||Number.MAX_SAFE_INTEGER)))}function PE(e=document.body){return e==null?[]:Array.from(e.querySelectorAll(xE)).sort((t,n)=>Math.sign((t.tabIndex||Number.MAX_SAFE_INTEGER)-(n.tabIndex||Number.MAX_SAFE_INTEGER)))}var cc=(e=>(e[e.Strict=0]="Strict",e[e.Loose=1]="Loose",e))(cc||{});function Sp(e,t=0){var n;return e===((n=vo(e))==null?void 0:n.body)?!1:st(t,{0(){return e.matches(ic)},1(){let r=e;for(;r!==null;){if(r.matches(ic))return!0;r=r.parentElement}return!1}})}var $E=(e=>(e[e.Keyboard=0]="Keyboard",e[e.Mouse=1]="Mouse",e))($E||{});typeof window<"u"&&typeof document<"u"&&(document.addEventListener("keydown",e=>{e.metaKey||e.altKey||e.ctrlKey||(document.documentElement.dataset.headlessuiFocusVisible="")},!0),document.addEventListener("click",e=>{e.detail===1?delete document.documentElement.dataset.headlessuiFocusVisible:e.detail===0&&(document.documentElement.dataset.headlessuiFocusVisible="")},!0));let TE=["textarea","input"].join(",");function AE(e){var t,n;return(n=(t=e==null?void 0:e.matches)==null?void 0:t.call(e,TE))!=null?n:!1}function Pp(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 NE(e,t){return OE(Ep(),t,{relativeTo:e})}function OE(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?Pp(e):e:t&64?PE(e):Ep(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")})(),l=t&32?{preventScroll:!0}:{},u=0,f=i.length,p;do{if(u>=f||u+f<=0)return 0;let d=a+u;if(t&16)d=(d+f)%f;else{if(d<0)return 3;if(d>=f)return 1}p=i[d],p==null||p.focus(l),u+=c}while(p!==s.activeElement);return t&6&&AE(p)&&p.select(),2}function $p(){return/iPhone/gi.test(window.navigator.platform)||/Mac/gi.test(window.navigator.platform)&&window.navigator.maxTouchPoints>0}function CE(){return/Android/gi.test(window.navigator.userAgent)}function Tp(){return $p()||CE()}function wr(e,t,n,r){let o=zn(n);v.useEffect(()=>{if(!e)return;function s(i){o.current(i)}return document.addEventListener(t,s,r),()=>document.removeEventListener(t,s,r)},[e,t,r])}function IE(e,t,n,r){let o=zn(n);v.useEffect(()=>{if(!e)return;function s(i){o.current(i)}return window.addEventListener(t,s,r),()=>window.removeEventListener(t,s,r)},[e,t,r])}const Ap=30;function ME(e,t,n){let r=zn(n),o=v.useCallback(function(c,a){if(c.defaultPrevented)return;let l=a(c);if(l===null||!l.getRootNode().contains(l)||!l.isConnected)return;let u=function f(p){return typeof p=="function"?f(p()):Array.isArray(p)||p instanceof Set?p:[p]}(t);for(let f of u)if(f!==null&&(f.contains(l)||c.composed&&c.composedPath().includes(f)))return;return!Sp(l,cc.Loose)&&l.tabIndex!==-1&&c.preventDefault(),r.current(c,l)},[r,t]),s=v.useRef(null);wr(e,"pointerdown",c=>{var a,l;Tp()||(s.current=((l=(a=c.composedPath)==null?void 0:a.call(c))==null?void 0:l[0])||c.target)},!0),wr(e,"pointerup",c=>{if(Tp()||!s.current)return;let a=s.current;return s.current=null,o(c,()=>a)},!0);let i=v.useRef({x:0,y:0});wr(e,"touchstart",c=>{i.current.x=c.touches[0].clientX,i.current.y=c.touches[0].clientY},!0),wr(e,"touchend",c=>{let a={x:c.changedTouches[0].clientX,y:c.changedTouches[0].clientY};if(!(Math.abs(a.x-i.current.x)>=Ap||Math.abs(a.y-i.current.y)>=Ap))return o(c,()=>yr(c.target)?c.target:null)},!0),IE(e,"blur",c=>o(c,()=>Hx(window.document.activeElement)?window.document.activeElement:null),!0)}function lc(...e){return v.useMemo(()=>vo(...e),[...e])}var kE=(e=>(e[e.Ignore=0]="Ignore",e[e.Select=1]="Select",e[e.Close=2]="Close",e))(kE||{});const Ps={Ignore:{kind:0},Select:e=>({kind:1,target:e}),Close:{kind:2}},BE=200,Np=5;function LE(e,{trigger:t,action:n,close:r,select:o}){let s=v.useRef(null),i=v.useRef(null),c=v.useRef(null);wr(e&&t!==null,"pointerdown",a=>{Ya(a==null?void 0:a.target)&&t!=null&&t.contains(a.target)&&(i.current=a.x,c.current=a.y,s.current=a.timeStamp)}),wr(e&&t!==null,"pointerup",a=>{var l,u;let f=s.current;if(f===null||(s.current=null,!yr(a.target))||Math.abs(a.x-((l=i.current)!=null?l:a.x))<Np&&Math.abs(a.y-((u=c.current)!=null?u:a.y))<Np)return;let p=n(a);switch(p.kind){case 0:return;case 1:{a.timeStamp-f>BE&&(o(p.target),r());break}case 2:{r();break}}},{capture:!0})}function DE(e,t){return v.useMemo(()=>{var n;if(e.type)return e.type;let r=(n=e.as)!=null?n:"button";if(typeof r=="string"&&r.toLowerCase()==="button"||(t==null?void 0:t.tagName)==="BUTTON"&&!t.hasAttribute("type"))return"button"},[e.type,e.as,t])}function FE(e){return v.useSyncExternalStore(e.subscribe,e.getSnapshot,e.getSnapshot)}function RE(e,t){let n=e(),r=new Set;return{getSnapshot(){return n},subscribe(o){return r.add(o),()=>r.delete(o)},dispatch(o,...s){let i=t[o].call(n,...s);i&&(n=i,r.forEach(c=>c()))}}}function jE(){let e;return{before({doc:t}){var n;let r=t.documentElement,o=(n=t.defaultView)!=null?n:window;e=Math.max(0,o.innerWidth-r.clientWidth)},after({doc:t,d:n}){let r=t.documentElement,o=Math.max(0,r.clientWidth-r.offsetWidth),s=Math.max(0,e-o);n.style(r,"paddingRight",`${s}px`)}}}function _E(){return $p()?{before({doc:e,d:t,meta:n}){function r(o){return n.containers.flatMap(s=>s()).some(s=>s.contains(o))}t.microTask(()=>{var o;if(window.getComputedStyle(e.documentElement).scrollBehavior!=="auto"){let c=Pt();c.style(e.documentElement,"scrollBehavior","auto"),t.add(()=>t.microTask(()=>c.dispose()))}let s=(o=window.scrollY)!=null?o:window.pageYOffset,i=null;t.addEventListener(e,"click",c=>{if(yr(c.target))try{let a=c.target.closest("a");if(!a)return;let{hash:l}=new URL(a.href),u=e.querySelector(l);yr(u)&&!r(u)&&(i=u)}catch{}},!0),t.addEventListener(e,"touchstart",c=>{if(yr(c.target)&&zx(c.target))if(r(c.target)){let a=c.target;for(;a.parentElement&&r(a.parentElement);)a=a.parentElement;t.style(a,"overscrollBehavior","contain")}else t.style(c.target,"touchAction","none")}),t.addEventListener(e,"touchmove",c=>{if(yr(c.target)){if(np(c.target))return;if(r(c.target)){let a=c.target;for(;a.parentElement&&a.dataset.headlessuiPortal!==""&&!(a.scrollHeight>a.clientHeight||a.scrollWidth>a.clientWidth);)a=a.parentElement;a.dataset.headlessuiPortal===""&&c.preventDefault()}else c.preventDefault()}},{passive:!1}),t.add(()=>{var c;let a=(c=window.scrollY)!=null?c:window.pageYOffset;s!==a&&window.scrollTo(0,s),i&&i.isConnected&&(i.scrollIntoView({block:"nearest"}),i=null)})})}}:{}}function UE(){return{before({doc:e,d:t}){t.style(e.documentElement,"overflow","hidden")}}}function zE(e){let t={};for(let n of e)Object.assign(t,n(t));return t}let Hn=RE(()=>new Map,{PUSH(e,t){var n;let r=(n=this.get(e))!=null?n:{doc:e,count:0,d:Pt(),meta:new Set};return r.count++,r.meta.add(t),this.set(e,r),this},POP(e,t){let n=this.get(e);return n&&(n.count--,n.meta.delete(t)),this},SCROLL_PREVENT({doc:e,d:t,meta:n}){let r={doc:e,d:t,meta:zE(n)},o=[_E(),jE(),UE()];o.forEach(({before:s})=>s==null?void 0:s(r)),o.forEach(({after:s})=>s==null?void 0:s(r))},SCROLL_ALLOW({d:e}){e.dispose()},TEARDOWN({doc:e}){this.delete(e)}});Hn.subscribe(()=>{let e=Hn.getSnapshot(),t=new Map;for(let[n]of e)t.set(n,n.documentElement.style.overflow);for(let n of e.values()){let r=t.get(n.doc)==="hidden",o=n.count!==0;(o&&!r||!o&&r)&&Hn.dispatch(n.count>0?"SCROLL_PREVENT":"SCROLL_ALLOW",n),n.count===0&&Hn.dispatch("TEARDOWN",n)}});function HE(e,t,n=()=>({containers:[]})){let r=FE(Hn),o=t?r.get(t):void 0,s=o?o.count>0:!1;return ye(()=>{if(!(!t||!e))return Hn.dispatch("PUSH",t,n),()=>Hn.dispatch("POP",t,n)},[e,t]),s}function WE(e,t,n=()=>[document.body]){let r=wp(e,"scroll-lock");HE(r,t,o=>{var s;return{containers:[...(s=o.containers)!=null?s:[],n]}})}function Op(e){return[e.screenX,e.screenY]}function VE(){let e=v.useRef([-1,-1]);return{wasMoved(t){let n=Op(t);return e.current[0]===n[0]&&e.current[1]===n[1]?!1:(e.current=n,!0)},update(t){e.current=Op(t)}}}function GE(e=0){let[t,n]=v.useState(e),r=v.useCallback(a=>n(a),[t]),o=v.useCallback(a=>n(l=>l|a),[t]),s=v.useCallback(a=>(t&a)===a,[t]),i=v.useCallback(a=>n(l=>l&~a),[n]),c=v.useCallback(a=>n(l=>l^a),[n]);return{flags:t,setFlag:r,addFlag:o,hasFlag:s,removeFlag:i,toggleFlag:c}}var Cp,Ip;typeof process<"u"&&typeof globalThis<"u"&&typeof Element<"u"&&((Cp=process==null?void 0:process.env)==null?void 0:Cp.NODE_ENV)==="test"&&typeof((Ip=Element==null?void 0:Element.prototype)==null?void 0:Ip.getAnimations)>"u"&&(Element.prototype.getAnimations=function(){return console.warn(["Headless UI has polyfilled `Element.prototype.getAnimations` for your tests.","Please install a proper polyfill e.g. `jsdom-testing-mocks`, to silence these warnings.","","Example usage:","```js","import { mockAnimationsApi } from 'jsdom-testing-mocks'","mockAnimationsApi()","```"].join(`
127
+ `)),[]});var qE=(e=>(e[e.None=0]="None",e[e.Closed=1]="Closed",e[e.Enter=2]="Enter",e[e.Leave=4]="Leave",e))(qE||{});function Mp(e){let t={};for(let n in e)e[n]===!0&&(t[`data-${n}`]="");return t}function kp(e,t,n,r){let[o,s]=v.useState(n),{hasFlag:i,addFlag:c,removeFlag:a}=GE(e&&o?3:0),l=v.useRef(!1),u=v.useRef(!1),f=br();return ye(()=>{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),ZE(t,{inFlight:l,prepare(){u.current?u.current=!1:u.current=l.current,l.current=!0,!u.current&&(n?(c(3),a(4)):(c(4),a(2)))},run(){u.current?n?(a(3),c(4)):(a(4),c(3)):n?a(1):c(1)},done(){var d;u.current&&typeof t.getAnimations=="function"&&t.getAnimations().length>0||(l.current=!1,a(7),n||s(!1),(d=r==null?void 0:r.end)==null||d.call(r,n))}})}},[e,n,t,f]),e?[o,{closed:i(1),enter:i(2),leave:i(4),transition:i(2)||i(4)}]:[n,{closed:void 0,enter:void 0,leave:void 0,transition:void 0}]}function ZE(e,{prepare:t,run:n,done:r,inFlight:o}){let s=Pt();return YE(e,{prepare:t,inFlight:o}),s.nextFrame(()=>{n(),s.requestAnimationFrame(()=>{s.add(KE(e,r))})}),s.dispose}function KE(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 YE(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 $s(){return typeof window<"u"}function vr(e){return uc(e)?(e.nodeName||"").toLowerCase():"#document"}function He(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Dt(e){var t;return(t=(uc(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function uc(e){return $s()?e instanceof Node||e instanceof He(e).Node:!1}function fe(e){return $s()?e instanceof Element||e instanceof He(e).Element:!1}function De(e){return $s()?e instanceof HTMLElement||e instanceof He(e).HTMLElement:!1}function fc(e){return!$s()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof He(e).ShadowRoot}const XE=new Set(["inline","contents"]);function Po(e){const{overflow:t,overflowX:n,overflowY:r,display:o}=lt(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!XE.has(o)}const QE=new Set(["table","td","th"]);function JE(e){return QE.has(vr(e))}const e2=[":popover-open",":modal"];function Ts(e){return e2.some(t=>{try{return e.matches(t)}catch{return!1}})}const t2=["transform","translate","scale","rotate","perspective"],n2=["transform","translate","scale","rotate","perspective","filter"],r2=["paint","layout","strict","content"];function dc(e){const t=As(),n=fe(e)?lt(e):e;return t2.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)||n2.some(r=>(n.willChange||"").includes(r))||r2.some(r=>(n.contain||"").includes(r))}function o2(e){let t=sn(e);for(;De(t)&&!on(t);){if(dc(t))return t;if(Ts(t))return null;t=sn(t)}return null}function As(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const s2=new Set(["html","body","#document"]);function on(e){return s2.has(vr(e))}function lt(e){return He(e).getComputedStyle(e)}function Ns(e){return fe(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function sn(e){if(vr(e)==="html")return e;const t=e.assignedSlot||e.parentNode||fc(e)&&e.host||Dt(e);return fc(t)?t.host:t}function Bp(e){const t=sn(e);return on(t)?e.ownerDocument?e.ownerDocument.body:e.body:De(t)&&Po(t)?t:Bp(t)}function xn(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const o=Bp(e),s=o===((r=e.ownerDocument)==null?void 0:r.body),i=He(o);if(s){const c=pc(i);return t.concat(i,i.visualViewport||[],Po(o)?o:[],c&&n?xn(c):[])}return t.concat(o,xn(o,[],n))}function pc(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function i2(){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 an=Math.min,Me=Math.max,$o=Math.round,Os=Math.floor,Ft=e=>({x:e,y:e}),a2={left:"right",right:"left",bottom:"top",top:"bottom"},c2={start:"end",end:"start"};function hc(e,t,n){return Me(e,an(t,n))}function Wn(e,t){return typeof e=="function"?e(t):e}function En(e){return e.split("-")[0]}function xr(e){return e.split("-")[1]}function Lp(e){return e==="x"?"y":"x"}function mc(e){return e==="y"?"height":"width"}const l2=new Set(["top","bottom"]);function cn(e){return l2.has(En(e))?"y":"x"}function gc(e){return Lp(cn(e))}function u2(e,t,n){n===void 0&&(n=!1);const r=xr(e),o=gc(e),s=mc(o);let i=o==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[s]>t.floating[s]&&(i=Cs(i)),[i,Cs(i)]}function f2(e){const t=Cs(e);return[bc(e),t,bc(t)]}function bc(e){return e.replace(/start|end/g,t=>c2[t])}const Dp=["left","right"],Fp=["right","left"],d2=["top","bottom"],p2=["bottom","top"];function h2(e,t,n){switch(e){case"top":case"bottom":return n?t?Fp:Dp:t?Dp:Fp;case"left":case"right":return t?d2:p2;default:return[]}}function m2(e,t,n,r){const o=xr(e);let s=h2(En(e),n==="start",r);return o&&(s=s.map(i=>i+"-"+o),t&&(s=s.concat(s.map(bc)))),s}function Cs(e){return e.replace(/left|right|bottom|top/g,t=>a2[t])}function g2(e){return{top:0,right:0,bottom:0,left:0,...e}}function Rp(e){return typeof e!="number"?g2(e):{top:e,right:e,bottom:e,left:e}}function Is(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}}/*!
128
128
  * tabbable 6.2.0
129
129
  * @license MIT, https://github.com/focus-trap/tabbable/blob/master/LICENSE
130
- */var b2=["input:not([inert])","select:not([inert])","textarea:not([inert])","a[href]:not([inert])","button:not([inert])","[tabindex]:not(slot):not([inert])","audio[controls]:not([inert])","video[controls]:not([inert])",'[contenteditable]:not([contenteditable="false"]):not([inert])',"details>summary:first-of-type:not([inert])","details:not([inert])"],bc=b2.join(","),jp=typeof Element>"u",To=jp?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,Ms=!jp&&Element.prototype.getRootNode?function(e){var t;return e==null||(t=e.getRootNode)===null||t===void 0?void 0:t.call(e)}:function(e){return e==null?void 0:e.ownerDocument},ks=function e(t,n){var r;n===void 0&&(n=!0);var o=t==null||(r=t.getAttribute)===null||r===void 0?void 0:r.call(t,"inert"),s=o===""||o==="true",i=s||n&&t&&e(t.parentNode);return i},y2=function(t){var n,r=t==null||(n=t.getAttribute)===null||n===void 0?void 0:n.call(t,"contenteditable");return r===""||r==="true"},w2=function(t,n,r){if(ks(t))return[];var o=Array.prototype.slice.apply(t.querySelectorAll(bc));return n&&To.call(t,bc)&&o.unshift(t),o=o.filter(r),o},v2=function e(t,n,r){for(var o=[],s=Array.from(t);s.length;){var i=s.shift();if(!ks(i,!1))if(i.tagName==="SLOT"){var c=i.assignedElements(),a=c.length?c:i.children,l=e(a,!0,r);r.flatten?o.push.apply(o,l):o.push({scopeParent:i,candidates:l})}else{var u=To.call(i,bc);u&&r.filter(i)&&(n||!t.includes(i))&&o.push(i);var f=i.shadowRoot||typeof r.getShadowRoot=="function"&&r.getShadowRoot(i),p=!ks(f,!1)&&(!r.shadowRootFilter||r.shadowRootFilter(i));if(f&&p){var d=e(f===!0?i.children:f.children,!0,r);r.flatten?o.push.apply(o,d):o.push({scopeParent:i,candidates:d})}else s.unshift.apply(s,i.children)}}return o},_p=function(t){return!isNaN(parseInt(t.getAttribute("tabindex"),10))},Up=function(t){if(!t)throw new Error("No node provided");return t.tabIndex<0&&(/^(AUDIO|VIDEO|DETAILS)$/.test(t.tagName)||y2(t))&&!_p(t)?0:t.tabIndex},x2=function(t,n){var r=Up(t);return r<0&&n&&!_p(t)?0:r},E2=function(t,n){return t.tabIndex===n.tabIndex?t.documentOrder-n.documentOrder:t.tabIndex-n.tabIndex},zp=function(t){return t.tagName==="INPUT"},S2=function(t){return zp(t)&&t.type==="hidden"},P2=function(t){var n=t.tagName==="DETAILS"&&Array.prototype.slice.apply(t.children).some(function(r){return r.tagName==="SUMMARY"});return n},$2=function(t,n){for(var r=0;r<t.length;r++)if(t[r].checked&&t[r].form===n)return t[r]},T2=function(t){if(!t.name)return!0;var n=t.form||Ms(t),r=function(c){return n.querySelectorAll('input[type="radio"][name="'+c+'"]')},o;if(typeof window<"u"&&typeof window.CSS<"u"&&typeof window.CSS.escape=="function")o=r(window.CSS.escape(t.name));else try{o=r(t.name)}catch(i){return console.error("Looks like you have a radio button with a name attribute containing invalid CSS selector characters and need the CSS.escape polyfill: %s",i.message),!1}var s=$2(o,t.form);return!s||s===t},A2=function(t){return zp(t)&&t.type==="radio"},N2=function(t){return A2(t)&&!T2(t)},O2=function(t){var n,r=t&&Ms(t),o=(n=r)===null||n===void 0?void 0:n.host,s=!1;if(r&&r!==t){var i,c,a;for(s=!!((i=o)!==null&&i!==void 0&&(c=i.ownerDocument)!==null&&c!==void 0&&c.contains(o)||t!=null&&(a=t.ownerDocument)!==null&&a!==void 0&&a.contains(t));!s&&o;){var l,u,f;r=Ms(o),o=(l=r)===null||l===void 0?void 0:l.host,s=!!((u=o)!==null&&u!==void 0&&(f=u.ownerDocument)!==null&&f!==void 0&&f.contains(o))}}return s},Hp=function(t){var n=t.getBoundingClientRect(),r=n.width,o=n.height;return r===0&&o===0},C2=function(t,n){var r=n.displayCheck,o=n.getShadowRoot;if(getComputedStyle(t).visibility==="hidden")return!0;var s=To.call(t,"details>summary:first-of-type"),i=s?t.parentElement:t;if(To.call(i,"details:not([open]) *"))return!0;if(!r||r==="full"||r==="legacy-full"){if(typeof o=="function"){for(var c=t;t;){var a=t.parentElement,l=Ms(t);if(a&&!a.shadowRoot&&o(a)===!0)return Hp(t);t.assignedSlot?t=t.assignedSlot:!a&&l!==t.ownerDocument?t=l.host:t=a}t=c}if(O2(t))return!t.getClientRects().length;if(r!=="legacy-full")return!0}else if(r==="non-zero-area")return Hp(t);return!1},I2=function(t){if(/^(INPUT|BUTTON|SELECT|TEXTAREA)$/.test(t.tagName))for(var n=t.parentElement;n;){if(n.tagName==="FIELDSET"&&n.disabled){for(var r=0;r<n.children.length;r++){var o=n.children.item(r);if(o.tagName==="LEGEND")return To.call(n,"fieldset[disabled] *")?!0:!o.contains(t)}return!0}n=n.parentElement}return!1},M2=function(t,n){return!(n.disabled||ks(n)||S2(n)||C2(n,t)||P2(n)||I2(n))},Wp=function(t,n){return!(N2(n)||Up(n)<0||!M2(t,n))},k2=function(t){var n=parseInt(t.getAttribute("tabindex"),10);return!!(isNaN(n)||n>=0)},B2=function e(t){var n=[],r=[];return t.forEach(function(o,s){var i=!!o.scopeParent,c=i?o.scopeParent:o,a=x2(c,i),l=i?e(o.candidates):c;a===0?i?n.push.apply(n,l):n.push(c):r.push({documentOrder:s,tabIndex:a,item:o,isScope:i,content:l})}),r.sort(E2).reduce(function(o,s){return s.isScope?o.push.apply(o,s.content):o.push(s.content),o},[]).concat(n)},Vp=function(t,n){n=n||{};var r;return n.getShadowRoot?r=v2([t],n.includeContainer,{filter:Wp.bind(null,n),flatten:!1,getShadowRoot:n.getShadowRoot,shadowRootFilter:k2}):r=w2(t,n.includeContainer,Wp.bind(null,n)),B2(r)};function Gp(e,t,n){let{reference:r,floating:o}=e;const s=cn(t),i=mc(t),c=hc(i),a=En(t),l=s==="y",u=r.x+r.width/2-o.width/2,f=r.y+r.height/2-o.height/2,p=r[c]/2-o[c]/2;let d;switch(a){case"top":d={x:u,y:r.y-o.height};break;case"bottom":d={x:u,y:r.y+r.height};break;case"right":d={x:r.x+r.width,y:f};break;case"left":d={x:r.x-o.width,y:f};break;default:d={x:r.x,y:r.y}}switch(xr(t)){case"start":d[i]-=p*(n&&l?-1:1);break;case"end":d[i]+=p*(n&&l?-1:1);break}return d}const L2=async(e,t,n)=>{const{placement:r="bottom",strategy:o="absolute",middleware:s=[],platform:i}=n,c=s.filter(Boolean),a=await(i.isRTL==null?void 0:i.isRTL(t));let l=await i.getElementRects({reference:e,floating:t,strategy:o}),{x:u,y:f}=Gp(l,r,a),p=r,d={},h=0;for(let m=0;m<c.length;m++){const{name:x,fn:A}=c[m],{x:w,y:T,data:B,reset:L}=await A({x:u,y:f,initialPlacement:r,placement:p,strategy:o,middlewareData:d,rects:l,platform:i,elements:{reference:e,floating:t}});u=w??u,f=T??f,d={...d,[x]:{...d[x],...B}},L&&h<=50&&(h++,typeof L=="object"&&(L.placement&&(p=L.placement),L.rects&&(l=L.rects===!0?await i.getElementRects({reference:e,floating:t,strategy:o}):L.rects),{x:u,y:f}=Gp(l,p,a)),m=-1)}return{x:u,y:f,placement:p,strategy:o,middlewareData:d}};async function Bs(e,t){var n;t===void 0&&(t={});const{x:r,y:o,platform:s,rects:i,elements:c,strategy:a}=e,{boundary:l="clippingAncestors",rootBoundary:u="viewport",elementContext:f="floating",altBoundary:p=!1,padding:d=0}=Wn(t,e),h=Rp(d),x=c[p?f==="floating"?"reference":"floating":f],A=Is(await s.getClippingRect({element:(n=await(s.isElement==null?void 0:s.isElement(x)))==null||n?x:x.contextElement||await(s.getDocumentElement==null?void 0:s.getDocumentElement(c.floating)),boundary:l,rootBoundary:u,strategy:a})),w=f==="floating"?{x:r,y:o,width:i.floating.width,height:i.floating.height}:i.reference,T=await(s.getOffsetParent==null?void 0:s.getOffsetParent(c.floating)),B=await(s.isElement==null?void 0:s.isElement(T))?await(s.getScale==null?void 0:s.getScale(T))||{x:1,y:1}:{x:1,y:1},L=Is(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:c,rect:w,offsetParent:T,strategy:a}):w);return{top:(A.top-L.top+h.top)/B.y,bottom:(L.bottom-A.bottom+h.bottom)/B.y,left:(A.left-L.left+h.left)/B.x,right:(L.right-A.right+h.right)/B.x}}const D2=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:o,rects:s,platform:i,elements:c,middlewareData:a}=t,{element:l,padding:u=0}=Wn(e,t)||{};if(l==null)return{};const f=Rp(u),p={x:n,y:r},d=mc(o),h=hc(d),m=await i.getDimensions(l),x=d==="y",A=x?"top":"left",w=x?"bottom":"right",T=x?"clientHeight":"clientWidth",B=s.reference[h]+s.reference[d]-p[d]-s.floating[h],L=p[d]-s.reference[d],F=await(i.getOffsetParent==null?void 0:i.getOffsetParent(l));let j=F?F[T]:0;(!j||!await(i.isElement==null?void 0:i.isElement(F)))&&(j=c.floating[T]||s.floating[h]);const g=B/2-L/2,y=j/2-m[h]/2-1,P=an(f[A],y),k=an(f[w],y),C=P,$=j-m[h]-k,S=j/2-m[h]/2+g,E=pc(C,S,$),O=!a.arrow&&xr(o)!=null&&S!==E&&s.reference[h]/2-(S<C?P:k)-m[h]/2<0,N=O?S<C?S-C:S-$:0;return{[d]:p[d]+N,data:{[d]:E,centerOffset:S-E-N,...O&&{alignmentOffset:N}},reset:O}}}),F2=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:o,middlewareData:s,rects:i,initialPlacement:c,platform:a,elements:l}=t,{mainAxis:u=!0,crossAxis:f=!0,fallbackPlacements:p,fallbackStrategy:d="bestFit",fallbackAxisSideDirection:h="none",flipAlignment:m=!0,...x}=Wn(e,t);if((n=s.arrow)!=null&&n.alignmentOffset)return{};const A=En(o),w=cn(c),T=En(c)===c,B=await(a.isRTL==null?void 0:a.isRTL(l.floating)),L=p||(T||!m?[Cs(c)]:f2(c)),F=h!=="none";!p&&F&&L.push(...m2(c,m,h,B));const j=[c,...L],g=await Bs(t,x),y=[];let P=((r=s.flip)==null?void 0:r.overflows)||[];if(u&&y.push(g[A]),f){const S=u2(o,i,B);y.push(g[S[0]],g[S[1]])}if(P=[...P,{placement:o,overflows:y}],!y.every(S=>S<=0)){var k,C;const S=(((k=s.flip)==null?void 0:k.index)||0)+1,E=j[S];if(E&&(!(f==="alignment"?w!==cn(E):!1)||P.every(b=>cn(b.placement)===w?b.overflows[0]>0:!0)))return{data:{index:S,overflows:P},reset:{placement:E}};let O=(C=P.filter(N=>N.overflows[0]<=0).sort((N,b)=>N.overflows[1]-b.overflows[1])[0])==null?void 0:C.placement;if(!O)switch(d){case"bestFit":{var $;const N=($=P.filter(b=>{if(F){const M=cn(b.placement);return M===w||M==="y"}return!0}).map(b=>[b.placement,b.overflows.filter(M=>M>0).reduce((M,R)=>M+R,0)]).sort((b,M)=>b[1]-M[1])[0])==null?void 0:$[0];N&&(O=N);break}case"initialPlacement":O=c;break}if(o!==O)return{reset:{placement:O}}}return{}}}},R2=new Set(["left","top"]);async function j2(e,t){const{placement:n,platform:r,elements:o}=e,s=await(r.isRTL==null?void 0:r.isRTL(o.floating)),i=En(n),c=xr(n),a=cn(n)==="y",l=R2.has(i)?-1:1,u=s&&a?-1:1,f=Wn(t,e);let{mainAxis:p,crossAxis:d,alignmentAxis:h}=typeof f=="number"?{mainAxis:f,crossAxis:0,alignmentAxis:null}:{mainAxis:f.mainAxis||0,crossAxis:f.crossAxis||0,alignmentAxis:f.alignmentAxis};return c&&typeof h=="number"&&(d=c==="end"?h*-1:h),a?{x:d*u,y:p*l}:{x:p*l,y:d*u}}const _2=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:o,y:s,placement:i,middlewareData:c}=t,a=await j2(t,e);return i===((n=c.offset)==null?void 0:n.placement)&&(r=c.arrow)!=null&&r.alignmentOffset?{}:{x:o+a.x,y:s+a.y,data:{...a,placement:i}}}}},U2=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:o}=t,{mainAxis:s=!0,crossAxis:i=!1,limiter:c={fn:x=>{let{x:A,y:w}=x;return{x:A,y:w}}},...a}=Wn(e,t),l={x:n,y:r},u=await Bs(t,a),f=cn(En(o)),p=Lp(f);let d=l[p],h=l[f];if(s){const x=p==="y"?"top":"left",A=p==="y"?"bottom":"right",w=d+u[x],T=d-u[A];d=pc(w,d,T)}if(i){const x=f==="y"?"top":"left",A=f==="y"?"bottom":"right",w=h+u[x],T=h-u[A];h=pc(w,h,T)}const m=c.fn({...t,[p]:d,[f]:h});return{...m,data:{x:m.x-n,y:m.y-r,enabled:{[p]:s,[f]:i}}}}}},z2=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var n,r;const{placement:o,rects:s,platform:i,elements:c}=t,{apply:a=()=>{},...l}=Wn(e,t),u=await Bs(t,l),f=En(o),p=xr(o),d=cn(o)==="y",{width:h,height:m}=s.floating;let x,A;f==="top"||f==="bottom"?(x=f,A=p===(await(i.isRTL==null?void 0:i.isRTL(c.floating))?"start":"end")?"left":"right"):(A=f,x=p==="end"?"top":"bottom");const w=m-u.top-u.bottom,T=h-u.left-u.right,B=an(m-u[x],w),L=an(h-u[A],T),F=!t.middlewareData.shift;let j=B,g=L;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(g=T),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(j=w),F&&!p){const P=Me(u.left,0),k=Me(u.right,0),C=Me(u.top,0),$=Me(u.bottom,0);d?g=h-2*(P!==0||k!==0?P+k:Me(u.left,u.right)):j=m-2*(C!==0||$!==0?C+$:Me(u.top,u.bottom))}await a({...t,availableWidth:g,availableHeight:j});const y=await i.getDimensions(c.floating);return h!==y.width||m!==y.height?{reset:{rects:!0}}:{}}}};function qp(e){const t=lt(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const o=De(e),s=o?e.offsetWidth:n,i=o?e.offsetHeight:r,c=$o(n)!==s||$o(r)!==i;return c&&(n=s,r=i),{width:n,height:r,$:c}}function yc(e){return fe(e)?e:e.contextElement}function Er(e){const t=yc(e);if(!De(t))return Ft(1);const n=t.getBoundingClientRect(),{width:r,height:o,$:s}=qp(t);let i=(s?$o(n.width):n.width)/r,c=(s?$o(n.height):n.height)/o;return(!i||!Number.isFinite(i))&&(i=1),(!c||!Number.isFinite(c))&&(c=1),{x:i,y:c}}const H2=Ft(0);function Zp(e){const t=He(e);return!As()||!t.visualViewport?H2:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function W2(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==He(e)?!1:t}function Vn(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const o=e.getBoundingClientRect(),s=yc(e);let i=Ft(1);t&&(r?fe(r)&&(i=Er(r)):i=Er(e));const c=W2(s,n,r)?Zp(s):Ft(0);let a=(o.left+c.x)/i.x,l=(o.top+c.y)/i.y,u=o.width/i.x,f=o.height/i.y;if(s){const p=He(s),d=r&&fe(r)?He(r):r;let h=p,m=dc(h);for(;m&&r&&d!==h;){const x=Er(m),A=m.getBoundingClientRect(),w=lt(m),T=A.left+(m.clientLeft+parseFloat(w.paddingLeft))*x.x,B=A.top+(m.clientTop+parseFloat(w.paddingTop))*x.y;a*=x.x,l*=x.y,u*=x.x,f*=x.y,a+=T,l+=B,h=He(m),m=dc(h)}}return Is({width:u,height:f,x:a,y:l})}function Ls(e,t){const n=Ns(e).scrollLeft;return t?t.left+n:Vn(Dt(e)).left+n}function Kp(e,t){const n=e.getBoundingClientRect(),r=n.left+t.scrollLeft-Ls(e,n),o=n.top+t.scrollTop;return{x:r,y:o}}function V2(e){let{elements:t,rect:n,offsetParent:r,strategy:o}=e;const s=o==="fixed",i=Dt(r),c=t?Ts(t.floating):!1;if(r===i||c&&s)return n;let a={scrollLeft:0,scrollTop:0},l=Ft(1);const u=Ft(0),f=De(r);if((f||!f&&!s)&&((vr(r)!=="body"||Po(i))&&(a=Ns(r)),De(r))){const d=Vn(r);l=Er(r),u.x=d.x+r.clientLeft,u.y=d.y+r.clientTop}const p=i&&!f&&!s?Kp(i,a):Ft(0);return{width:n.width*l.x,height:n.height*l.y,x:n.x*l.x-a.scrollLeft*l.x+u.x+p.x,y:n.y*l.y-a.scrollTop*l.y+u.y+p.y}}function G2(e){return Array.from(e.getClientRects())}function q2(e){const t=Dt(e),n=Ns(e),r=e.ownerDocument.body,o=Me(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),s=Me(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let i=-n.scrollLeft+Ls(e);const c=-n.scrollTop;return lt(r).direction==="rtl"&&(i+=Me(t.clientWidth,r.clientWidth)-o),{width:o,height:s,x:i,y:c}}const Yp=25;function Z2(e,t){const n=He(e),r=Dt(e),o=n.visualViewport;let s=r.clientWidth,i=r.clientHeight,c=0,a=0;if(o){s=o.width,i=o.height;const u=As();(!u||u&&t==="fixed")&&(c=o.offsetLeft,a=o.offsetTop)}const l=Ls(r);if(l<=0){const u=r.ownerDocument,f=u.body,p=getComputedStyle(f),d=u.compatMode==="CSS1Compat"&&parseFloat(p.marginLeft)+parseFloat(p.marginRight)||0,h=Math.abs(r.clientWidth-f.clientWidth-d);h<=Yp&&(s-=h)}else l<=Yp&&(s+=l);return{width:s,height:i,x:c,y:a}}const K2=new Set(["absolute","fixed"]);function Y2(e,t){const n=Vn(e,!0,t==="fixed"),r=n.top+e.clientTop,o=n.left+e.clientLeft,s=De(e)?Er(e):Ft(1),i=e.clientWidth*s.x,c=e.clientHeight*s.y,a=o*s.x,l=r*s.y;return{width:i,height:c,x:a,y:l}}function Xp(e,t,n){let r;if(t==="viewport")r=Z2(e,n);else if(t==="document")r=q2(Dt(e));else if(fe(t))r=Y2(t,n);else{const o=Zp(e);r={x:t.x-o.x,y:t.y-o.y,width:t.width,height:t.height}}return Is(r)}function Qp(e,t){const n=sn(e);return n===t||!fe(n)||on(n)?!1:lt(n).position==="fixed"||Qp(n,t)}function X2(e,t){const n=t.get(e);if(n)return n;let r=xn(e,[],!1).filter(c=>fe(c)&&vr(c)!=="body"),o=null;const s=lt(e).position==="fixed";let i=s?sn(e):e;for(;fe(i)&&!on(i);){const c=lt(i),a=fc(i);!a&&c.position==="fixed"&&(o=null),(s?!a&&!o:!a&&c.position==="static"&&!!o&&K2.has(o.position)||Po(i)&&!a&&Qp(e,i))?r=r.filter(u=>u!==i):o=c,i=sn(i)}return t.set(e,r),r}function Q2(e){let{element:t,boundary:n,rootBoundary:r,strategy:o}=e;const i=[...n==="clippingAncestors"?Ts(t)?[]:X2(t,this._c):[].concat(n),r],c=i[0],a=i.reduce((l,u)=>{const f=Xp(t,u,o);return l.top=Me(f.top,l.top),l.right=an(f.right,l.right),l.bottom=an(f.bottom,l.bottom),l.left=Me(f.left,l.left),l},Xp(t,c,o));return{width:a.right-a.left,height:a.bottom-a.top,x:a.left,y:a.top}}function J2(e){const{width:t,height:n}=qp(e);return{width:t,height:n}}function e6(e,t,n){const r=De(t),o=Dt(t),s=n==="fixed",i=Vn(e,!0,s,t);let c={scrollLeft:0,scrollTop:0};const a=Ft(0);function l(){a.x=Ls(o)}if(r||!r&&!s)if((vr(t)!=="body"||Po(o))&&(c=Ns(t)),r){const d=Vn(t,!0,s,t);a.x=d.x+t.clientLeft,a.y=d.y+t.clientTop}else o&&l();s&&!r&&o&&l();const u=o&&!r&&!s?Kp(o,c):Ft(0),f=i.left+c.scrollLeft-a.x-u.x,p=i.top+c.scrollTop-a.y-u.y;return{x:f,y:p,width:i.width,height:i.height}}function wc(e){return lt(e).position==="static"}function Jp(e,t){if(!De(e)||lt(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return Dt(e)===n&&(n=n.ownerDocument.body),n}function eh(e,t){const n=He(e);if(Ts(e))return n;if(!De(e)){let o=sn(e);for(;o&&!on(o);){if(fe(o)&&!wc(o))return o;o=sn(o)}return n}let r=Jp(e,t);for(;r&&JE(r)&&wc(r);)r=Jp(r,t);return r&&on(r)&&wc(r)&&!fc(r)?n:r||o2(e)||n}const t6=async function(e){const t=this.getOffsetParent||eh,n=this.getDimensions,r=await n(e.floating);return{reference:e6(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function n6(e){return lt(e).direction==="rtl"}const r6={convertOffsetParentRelativeRectToViewportRelativeRect:V2,getDocumentElement:Dt,getClippingRect:Q2,getOffsetParent:eh,getElementRects:t6,getClientRects:G2,getDimensions:J2,getScale:Er,isElement:fe,isRTL:n6};function th(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function o6(e,t){let n=null,r;const o=Dt(e);function s(){var c;clearTimeout(r),(c=n)==null||c.disconnect(),n=null}function i(c,a){c===void 0&&(c=!1),a===void 0&&(a=1),s();const l=e.getBoundingClientRect(),{left:u,top:f,width:p,height:d}=l;if(c||t(),!p||!d)return;const h=Os(f),m=Os(o.clientWidth-(u+p)),x=Os(o.clientHeight-(f+d)),A=Os(u),T={rootMargin:-h+"px "+-m+"px "+-x+"px "+-A+"px",threshold:Me(0,an(1,a))||1};let B=!0;function L(F){const j=F[0].intersectionRatio;if(j!==a){if(!B)return i();j?i(!1,j):r=setTimeout(()=>{i(!1,1e-7)},1e3)}j===1&&!th(l,e.getBoundingClientRect())&&i(),B=!1}try{n=new IntersectionObserver(L,{...T,root:o.ownerDocument})}catch{n=new IntersectionObserver(L,T)}n.observe(e)}return i(!0),s}function nh(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:o=!0,ancestorResize:s=!0,elementResize:i=typeof ResizeObserver=="function",layoutShift:c=typeof IntersectionObserver=="function",animationFrame:a=!1}=r,l=yc(e),u=o||s?[...l?xn(l):[],...xn(t)]:[];u.forEach(A=>{o&&A.addEventListener("scroll",n,{passive:!0}),s&&A.addEventListener("resize",n)});const f=l&&c?o6(l,n):null;let p=-1,d=null;i&&(d=new ResizeObserver(A=>{let[w]=A;w&&w.target===l&&d&&(d.unobserve(t),cancelAnimationFrame(p),p=requestAnimationFrame(()=>{var T;(T=d)==null||T.observe(t)})),n()}),l&&!a&&d.observe(l),d.observe(t));let h,m=a?Vn(e):null;a&&x();function x(){const A=Vn(e);m&&!th(m,A)&&n(),m=A,h=requestAnimationFrame(x)}return n(),()=>{var A;u.forEach(w=>{o&&w.removeEventListener("scroll",n),s&&w.removeEventListener("resize",n)}),f==null||f(),(A=d)==null||A.disconnect(),d=null,a&&cancelAnimationFrame(h)}}const vc=Bs,s6=_2,i6=U2,a6=F2,c6=z2,rh=D2,l6=(e,t,n)=>{const r=new Map,o={platform:r6,...n},s={...o.platform,_c:r};return L2(e,t,{...o,platform:s})};var u6=typeof document<"u",f6=function(){},Ds=u6?v.useLayoutEffect:f6;function Fs(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(!Fs(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)&&!Fs(e[s],t[s]))return!1}return!0}return e!==e&&t!==t}function oh(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function sh(e,t){const n=oh(e);return Math.round(t*n)/n}function xc(e){const t=z.useRef(e);return Ds(()=>{t.current=e}),t}function ih(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:o,elements:{reference:s,floating:i}={},transform:c=!0,whileElementsMounted:a,open:l}=e,[u,f]=z.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[p,d]=z.useState(r);Fs(p,r)||d(r);const[h,m]=z.useState(null),[x,A]=z.useState(null),w=z.useCallback(b=>{b!==F.current&&(F.current=b,m(b))},[]),T=z.useCallback(b=>{b!==j.current&&(j.current=b,A(b))},[]),B=s||h,L=i||x,F=z.useRef(null),j=z.useRef(null),g=z.useRef(u),y=a!=null,P=xc(a),k=xc(o),C=xc(l),$=z.useCallback(()=>{if(!F.current||!j.current)return;const b={placement:t,strategy:n,middleware:p};k.current&&(b.platform=k.current),l6(F.current,j.current,b).then(M=>{const R={...M,isPositioned:C.current!==!1};S.current&&!Fs(g.current,R)&&(g.current=R,Or.flushSync(()=>{f(R)}))})},[p,t,n,k,C]);Ds(()=>{l===!1&&g.current.isPositioned&&(g.current.isPositioned=!1,f(b=>({...b,isPositioned:!1})))},[l]);const S=z.useRef(!1);Ds(()=>(S.current=!0,()=>{S.current=!1}),[]),Ds(()=>{if(B&&(F.current=B),L&&(j.current=L),B&&L){if(P.current)return P.current(B,L,$);$()}},[B,L,$,P,y]);const E=z.useMemo(()=>({reference:F,floating:j,setReference:w,setFloating:T}),[w,T]),O=z.useMemo(()=>({reference:B,floating:L}),[B,L]),N=z.useMemo(()=>{const b={position:n,left:0,top:0};if(!O.floating)return b;const M=sh(O.floating,u.x),R=sh(O.floating,u.y);return c?{...b,transform:"translate("+M+"px, "+R+"px)",...oh(O.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:M,top:R}},[n,c,O.floating,u.x,u.y]);return z.useMemo(()=>({...u,update:$,refs:E,elements:O,floatingStyles:N}),[u,$,E,O,N])}const d6=e=>{function t(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:e,fn(n){const{element:r,padding:o}=typeof e=="function"?e(n):e;return r&&t(r)?r.current!=null?rh({element:r.current,padding:o}).fn(n):{}:r?rh({element:r,padding:o}).fn(n):{}}}},Ec=(e,t)=>({...s6(e),options:[e,t]}),ah=(e,t)=>({...i6(e),options:[e,t]}),ch=(e,t)=>({...a6(e),options:[e,t]}),p6=(e,t)=>({...c6(e),options:[e,t]}),h6=(e,t)=>({...d6(e),options:[e,t]}),lh={...z},m6=lh.useInsertionEffect||(e=>e());function uh(e){const t=z.useRef(()=>{if(process.env.NODE_ENV!=="production")throw new Error("Cannot call an event handler while rendering.")});return m6(()=>{t.current=e}),z.useCallback(function(){for(var n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return t.current==null?void 0:t.current(...r)},[])}var Sc=typeof document<"u"?v.useLayoutEffect:v.useEffect;let fh=!1,g6=0;const dh=()=>"floating-ui-"+Math.random().toString(36).slice(2,6)+g6++;function b6(){const[e,t]=z.useState(()=>fh?dh():void 0);return Sc(()=>{e==null&&t(dh())},[]),z.useEffect(()=>{fh=!0},[]),e}const y6=lh.useId||b6;let Ao;process.env.NODE_ENV!=="production"&&(Ao=new Set);function w6(){for(var e,t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];const o="Floating UI: "+n.join(" ");if(!((e=Ao)!=null&&e.has(o))){var s;(s=Ao)==null||s.add(o),console.warn(o)}}function v6(){for(var e,t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];const o="Floating UI: "+n.join(" ");if(!((e=Ao)!=null&&e.has(o))){var s;(s=Ao)==null||s.add(o),console.error(o)}}function x6(){const e=new Map;return{emit(t,n){var r;(r=e.get(t))==null||r.forEach(o=>o(n))},on(t,n){e.set(t,[...e.get(t)||[],n])},off(t,n){var r;e.set(t,((r=e.get(t))==null?void 0:r.filter(o=>o!==n))||[])}}}const E6=z.createContext(null),S6=z.createContext(null),P6=()=>{var e;return((e=z.useContext(E6))==null?void 0:e.id)||null},$6=()=>z.useContext(S6),T6="data-floating-ui-focusable";function A6(e){const{open:t=!1,onOpenChange:n,elements:r}=e,o=y6(),s=z.useRef({}),[i]=z.useState(()=>x6()),c=P6()!=null;if(process.env.NODE_ENV!=="production"){const d=r.reference;d&&!fe(d)&&v6("Cannot pass a virtual element to the `elements.reference` option,","as it must be a real DOM element. Use `refs.setPositionReference()`","instead.")}const[a,l]=z.useState(r.reference),u=uh((d,h,m)=>{s.current.openEvent=d?h:void 0,i.emit("openchange",{open:d,event:h,reason:m,nested:c}),n==null||n(d,h,m)}),f=z.useMemo(()=>({setPositionReference:l}),[]),p=z.useMemo(()=>({reference:a||r.reference||null,floating:r.floating||null,domReference:r.reference}),[a,r.reference,r.floating]);return z.useMemo(()=>({dataRef:s,open:t,onOpenChange:u,elements:p,events:i,floatingId:o,refs:f}),[t,u,p,i,o,f])}function N6(e){e===void 0&&(e={});const{nodeId:t}=e,n=A6({...e,elements:{reference:null,floating:null,...e.elements}}),r=e.rootContext||n,o=r.elements,[s,i]=z.useState(null),[c,a]=z.useState(null),u=(o==null?void 0:o.domReference)||s,f=z.useRef(null),p=$6();Sc(()=>{u&&(f.current=u)},[u]);const d=ih({...e,elements:{...o,...c&&{reference:c}}}),h=z.useCallback(T=>{const B=fe(T)?{getBoundingClientRect:()=>T.getBoundingClientRect(),contextElement:T}:T;a(B),d.refs.setReference(B)},[d.refs]),m=z.useCallback(T=>{(fe(T)||T===null)&&(f.current=T,i(T)),(fe(d.refs.reference.current)||d.refs.reference.current===null||T!==null&&!fe(T))&&d.refs.setReference(T)},[d.refs]),x=z.useMemo(()=>({...d.refs,setReference:m,setPositionReference:h,domReference:f}),[d.refs,m,h]),A=z.useMemo(()=>({...d.elements,domReference:u}),[d.elements,u]),w=z.useMemo(()=>({...d,...r,refs:x,elements:A,nodeId:t}),[d,x,A,t,r]);return Sc(()=>{r.dataRef.current.floatingContext=w;const T=p==null?void 0:p.nodesRef.current.find(B=>B.id===t);T&&(T.context=w)}),z.useMemo(()=>({...d,context:w,refs:x,elements:A}),[d,x,A,w])}const ph="active",hh="selected";function Pc(e,t,n){const r=new Map,o=n==="item";let s=e;if(o&&e){const{[ph]:i,[hh]:c,...a}=e;s=a}return{...n==="floating"&&{tabIndex:-1,[T6]:""},...s,...t.map(i=>{const c=i?i[n]:null;return typeof c=="function"?e?c(e):null:c}).concat(e).reduce((i,c)=>(c&&Object.entries(c).forEach(a=>{let[l,u]=a;if(!(o&&[ph,hh].includes(l)))if(l.indexOf("on")===0){if(r.has(l)||r.set(l,[]),typeof u=="function"){var f;(f=r.get(l))==null||f.push(u),i[l]=function(){for(var p,d=arguments.length,h=new Array(d),m=0;m<d;m++)h[m]=arguments[m];return(p=r.get(l))==null?void 0:p.map(x=>x(...h)).find(x=>x!==void 0)}}}else i[l]=u}),i),{})}}function O6(e){e===void 0&&(e=[]);const t=e.map(c=>c==null?void 0:c.reference),n=e.map(c=>c==null?void 0:c.floating),r=e.map(c=>c==null?void 0:c.item),o=z.useCallback(c=>Pc(c,e,"reference"),t),s=z.useCallback(c=>Pc(c,e,"floating"),n),i=z.useCallback(c=>Pc(c,e,"item"),r);return z.useMemo(()=>({getReferenceProps:o,getFloatingProps:s,getItemProps:i}),[o,s,i])}function mh(e,t){return{...e,rects:{...e.rects,floating:{...e.rects.floating,height:t}}}}const C6=e=>({name:"inner",options:e,async fn(t){const{listRef:n,overflowRef:r,onFallbackChange:o,offset:s=0,index:i=0,minItemsVisible:c=4,referenceOverflowThreshold:a=0,scrollRef:l,...u}=Wn(e,t),{rects:f,elements:{floating:p}}=t,d=n.current[i],h=(l==null?void 0:l.current)||p,m=p.clientTop||h.clientTop,x=p.clientTop!==0,A=h.clientTop!==0,w=p===h;if(process.env.NODE_ENV!=="production"&&(t.placement.startsWith("bottom")||w6('`placement` side must be "bottom" when using the `inner`',"middleware.")),!d)return{};const T={...t,...await Ec(-d.offsetTop-p.clientTop-f.reference.height/2-d.offsetHeight/2-s).fn(t)},B=await vc(mh(T,h.scrollHeight+m+p.clientTop),u),L=await vc(T,{...u,elementContext:"reference"}),F=Me(0,B.top),j=T.y+F,P=(h.scrollHeight>h.clientHeight?k=>k:$o)(Me(0,h.scrollHeight+(x&&w||A?m*2:0)-F-Me(0,B.bottom)));if(h.style.maxHeight=P+"px",h.scrollTop=F,o){const k=h.offsetHeight<d.offsetHeight*an(c,n.current.length)-1||L.top>=-a||L.bottom>=-a;Or.flushSync(()=>o(k))}return r&&(r.current=await vc(mh({...T,y:j},h.offsetHeight+m+p.clientTop),u)),{y:j}}});function I6(e,t){const{open:n,elements:r}=e,{enabled:o=!0,overflowRef:s,scrollRef:i,onChange:c}=t,a=uh(c),l=z.useRef(!1),u=z.useRef(null),f=z.useRef(null);z.useEffect(()=>{if(!o)return;function d(m){if(m.ctrlKey||!h||s.current==null)return;const x=m.deltaY,A=s.current.top>=-.5,w=s.current.bottom>=-.5,T=h.scrollHeight-h.clientHeight,B=x<0?-1:1,L=x<0?"max":"min";h.scrollHeight<=h.clientHeight||(!A&&x>0||!w&&x<0?(m.preventDefault(),Or.flushSync(()=>{a(F=>F+Math[L](x,T*B))})):/firefox/i.test(i2())&&(h.scrollTop+=x))}const h=(i==null?void 0:i.current)||r.floating;if(n&&h)return h.addEventListener("wheel",d),requestAnimationFrame(()=>{u.current=h.scrollTop,s.current!=null&&(f.current={...s.current})}),()=>{u.current=null,f.current=null,h.removeEventListener("wheel",d)}},[o,n,r.floating,s,i,a]);const p=z.useMemo(()=>({onKeyDown(){l.current=!0},onWheel(){l.current=!1},onPointerMove(){l.current=!1},onScroll(){const d=(i==null?void 0:i.current)||r.floating;if(!(!s.current||!d||!l.current)){if(u.current!==null){const h=d.scrollTop-u.current;(s.current.bottom<-.5&&h<-1||s.current.top<-.5&&h>1)&&Or.flushSync(()=>a(m=>m+h))}requestAnimationFrame(()=>{u.current=d.scrollTop})}}}),[r.floating,a,s,i]);return z.useMemo(()=>o?{floating:p}:{},[o,p])}let Sr=v.createContext({styles:void 0,setReference:()=>{},setFloating:()=>{},getReferenceProps:()=>({}),getFloatingProps:()=>({}),slot:{}});Sr.displayName="FloatingContext";let $c=v.createContext(null);$c.displayName="PlacementContext";function M6(e){return v.useMemo(()=>e?typeof e=="string"?{to:e}:e:null,[e])}function k6(){return v.useContext(Sr).setReference}function B6(){return v.useContext(Sr).getReferenceProps}function L6(){let{getFloatingProps:e,slot:t}=v.useContext(Sr);return v.useCallback((...n)=>Object.assign({},e(...n),{"data-anchor":t.anchor}),[e,t])}function D6(e=null){e===!1&&(e=null),typeof e=="string"&&(e={to:e});let t=v.useContext($c),n=v.useMemo(()=>e,[JSON.stringify(e,(o,s)=>{var i;return(i=s==null?void 0:s.outerHTML)!=null?i:s})]);ye(()=>{t==null||t(n??null)},[t,n]);let r=v.useContext(Sr);return v.useMemo(()=>[r.setFloating,e?r.styles:{}],[r.setFloating,e,r.styles])}let gh=4;function F6({children:e,enabled:t=!0}){let[n,r]=v.useState(null),[o,s]=v.useState(0),i=v.useRef(null),[c,a]=v.useState(null);R6(c);let l=t&&n!==null&&c!==null,{to:u="bottom",gap:f=0,offset:p=0,padding:d=0,inner:h}=j6(n,c),[m,x="center"]=u.split(" ");ye(()=>{l&&s(0)},[l]);let{refs:A,floatingStyles:w,context:T}=N6({open:l,placement:m==="selection"?x==="center"?"bottom":`bottom-${x}`:x==="center"?`${m}`:`${m}-${x}`,strategy:"absolute",transform:!1,middleware:[Ec({mainAxis:m==="selection"?0:f,crossAxis:p}),ah({padding:d}),m!=="selection"&&ch({padding:d}),m==="selection"&&h?C6({...h,padding:d,overflowRef:i,offset:o,minItemsVisible:gh,referenceOverflowThreshold:d,onFallbackChange(k){var C,$;if(!k)return;let S=T.elements.floating;if(!S)return;let E=parseFloat(getComputedStyle(S).scrollPaddingBottom)||0,O=Math.min(gh,S.childElementCount),N=0,b=0;for(let M of($=(C=T.elements.floating)==null?void 0:C.childNodes)!=null?$:[])if(rn(M)){let R=M.offsetTop,_=R+M.clientHeight+E,U=S.scrollTop,W=U+S.clientHeight;if(R>=U&&_<=W)O--;else{b=Math.max(0,Math.min(_,W)-Math.max(R,U)),N=M.clientHeight;break}}O>=1&&s(M=>{let R=N*O-b+E;return M>=R?M:R})}}):null,p6({padding:d,apply({availableWidth:k,availableHeight:C,elements:$}){Object.assign($.floating.style,{overflow:"auto",maxWidth:`${k}px`,maxHeight:`min(var(--anchor-max-height, 100vh), ${C}px)`})}})].filter(Boolean),whileElementsMounted:nh}),[B=m,L=x]=T.placement.split("-");m==="selection"&&(B="selection");let F=v.useMemo(()=>({anchor:[B,L].filter(Boolean).join(" ")}),[B,L]),j=I6(T,{overflowRef:i,onChange:s}),{getReferenceProps:g,getFloatingProps:y}=O6([j]),P=ce(k=>{a(k),A.setFloating(k)});return z.createElement($c.Provider,{value:r},z.createElement(Sr.Provider,{value:{setFloating:P,setReference:A.setReference,styles:w,getReferenceProps:g,getFloatingProps:y,slot:F}},e))}function R6(e){ye(()=>{if(!e)return;let t=new MutationObserver(()=>{let n=window.getComputedStyle(e).maxHeight,r=parseFloat(n);if(isNaN(r))return;let o=parseInt(n);isNaN(o)||r!==o&&(e.style.maxHeight=`${Math.ceil(r)}px`)});return t.observe(e,{attributes:!0,attributeFilter:["style"]}),()=>{t.disconnect()}},[e])}function j6(e,t){var n,r,o;let s=Tc((n=e==null?void 0:e.gap)!=null?n:"var(--anchor-gap, 0)",t),i=Tc((r=e==null?void 0:e.offset)!=null?r:"var(--anchor-offset, 0)",t),c=Tc((o=e==null?void 0:e.padding)!=null?o:"var(--anchor-padding, 0)",t);return{...e,gap:s,offset:i,padding:c}}function Tc(e,t,n=void 0){let r=br(),o=ce((a,l)=>{if(a==null)return[n,null];if(typeof a=="number")return[a,null];if(typeof a=="string"){if(!l)return[n,null];let u=yh(a,l);return[u,f=>{let p=bh(a);{let d=p.map(h=>window.getComputedStyle(l).getPropertyValue(h));r.requestAnimationFrame(function h(){r.nextFrame(h);let m=!1;for(let[A,w]of p.entries()){let T=window.getComputedStyle(l).getPropertyValue(w);if(d[A]!==T){d[A]=T,m=!0;break}}if(!m)return;let x=yh(a,l);u!==x&&(f(x),u=x)})}return r.dispose}]}return[n,null]}),s=v.useMemo(()=>o(e,t)[0],[e,t]),[i=s,c]=v.useState();return ye(()=>{let[a,l]=o(e,t);if(c(a),!!l)return l(c)},[e,t]),i}function bh(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,...bh(o)]:[r]}return[]}function yh(e,t){let n=document.createElement("div");t.appendChild(n),n.style.setProperty("margin-top","0px","important"),n.style.setProperty("margin-top",e,"important");let r=parseFloat(window.getComputedStyle(n).marginTop)||0;return t.removeChild(n),r}function _6(e,t){let[n,r]=v.useState(t);return!e&&n!==t&&r(t),e?n:t}let Ac=v.createContext(null);Ac.displayName="OpenClosedContext";var $t=(e=>(e[e.Open=1]="Open",e[e.Closed=2]="Closed",e[e.Closing=4]="Closing",e[e.Opening=8]="Opening",e))($t||{});function Nc(){return v.useContext(Ac)}function wh({value:e,children:t}){return v.createElement(Ac.Provider,{value:e},t)}function U6(e){throw new Error("Unexpected object: "+e)}var ve=(e=>(e[e.First=0]="First",e[e.Previous=1]="Previous",e[e.Next=2]="Next",e[e.Last=3]="Last",e[e.Specific=4]="Specific",e[e.Nothing=5]="Nothing",e))(ve||{});function Rs(e,t){let n=t.resolveItems();if(n.length<=0)return null;let r=t.resolveActiveIndex(),o=r??-1;switch(e.focus){case 0:{for(let s=0;s<n.length;++s)if(!t.resolveDisabled(n[s],s,n))return s;return r}case 1:{o===-1&&(o=n.length);for(let s=o-1;s>=0;--s)if(!t.resolveDisabled(n[s],s,n))return s;return r}case 2:{for(let s=o+1;s<n.length;++s)if(!t.resolveDisabled(n[s],s,n))return s;return r}case 3:{for(let s=n.length-1;s>=0;--s)if(!t.resolveDisabled(n[s],s,n))return s;return r}case 4:{for(let s=0;s<n.length;++s)if(t.resolveId(n[s],s,n)===e.id)return s;return r}case 5:return null;default:U6(e)}}var vh=(e=>(e[e.Left=0]="Left",e[e.Right=2]="Right",e))(vh||{});function xh(e){let t=ce(e),n=v.useRef(!1);v.useEffect(()=>(n.current=!1,()=>{n.current=!0,Zd(()=>{n.current&&t()})}),[t])}function z6(){let e=typeof document>"u";return"useSyncExternalStore"in z?(t=>t.useSyncExternalStore)(z)(()=>()=>{},()=>!1,()=>!e):!1}function Oc(){let e=z6(),[t,n]=z.useState(Bt.isHandoffComplete);return t&&Bt.isHandoffComplete===!1&&n(!1),z.useEffect(()=>{t!==!0&&n(!0)},[t]),z.useEffect(()=>Bt.handoff(),[]),e?!1:t}let H6=v.createContext(!1);function W6(){return v.useContext(H6)}function V6(e){let t=W6(),n=v.useContext(Sh),[r,o]=v.useState(()=>{var s;if(!t&&n!==null)return(s=n.current)!=null?s:null;if(Bt.isServer)return null;let i=e==null?void 0:e.getElementById("headlessui-portal-root");if(i)return i;if(e===null)return null;let c=e.createElement("div");return c.setAttribute("id","headlessui-portal-root"),e.body.appendChild(c)});return v.useEffect(()=>{r!==null&&(e!=null&&e.body.contains(r)||e==null||e.body.appendChild(r))},[r,e]),v.useEffect(()=>{t||n!==null&&o(n.current)},[n,o,t]),r}let Eh=v.Fragment,G6=ze(function(e,t){let{ownerDocument:n=null,...r}=e,o=v.useRef(null),s=it(Zx(d=>{o.current=d}),t),i=cc(o),c=n??i,a=V6(c),[l]=v.useState(()=>{var d;return Bt.isServer?null:(d=c==null?void 0:c.createElement("div"))!=null?d:null}),u=v.useContext(Y6),f=Oc();ye(()=>{!a||!l||a.contains(l)||(l.setAttribute("data-headlessui-portal",""),a.appendChild(l))},[a,l]),ye(()=>{if(l&&u)return u.register(l)},[u,l]),xh(()=>{var d;!a||!l||(Ka(l)&&a.contains(l)&&a.removeChild(l),a.childNodes.length<=0&&((d=a.parentElement)==null||d.removeChild(a)))});let p=Ye();return f?!a||!l?null:ke.createPortal(p({ourProps:{ref:s},theirProps:r,slot:{},defaultTag:Eh,name:"Portal"}),l):null});function q6(e,t){let n=it(t),{enabled:r=!0,ownerDocument:o,...s}=e,i=Ye();return r?v.createElement(G6,{...s,ownerDocument:o,ref:n}):i({ourProps:{ref:n},theirProps:s,slot:{},defaultTag:Eh,name:"Portal"})}let Z6=v.Fragment,Sh=v.createContext(null);function K6(e,t){let{target:n,...r}=e,o={ref:it(t)},s=Ye();return v.createElement(Sh.Provider,{value:n},s({ourProps:o,theirProps:r,defaultTag:Z6,name:"Popover.Group"}))}let Y6=v.createContext(null),X6=ze(q6),Q6=ze(K6),J6=Object.assign(X6,{Group:Q6});function e5(){let e=v.useRef(!1);return ye(()=>(e.current=!0,()=>{e.current=!1}),[]),e}function Ph(e){var t;return!!(e.enter||e.enterFrom||e.enterTo||e.leave||e.leaveFrom||e.leaveTo)||((t=e.as)!=null?t:Th)!==v.Fragment||v.Children.count(e.children)===1}let js=v.createContext(null);js.displayName="TransitionContext";var t5=(e=>(e.Visible="visible",e.Hidden="hidden",e))(t5||{});function n5(){let e=v.useContext(js);if(e===null)throw new Error("A <Transition.Child /> is used but it is missing a parent <Transition /> or <Transition.Root />.");return e}function r5(){let e=v.useContext(_s);if(e===null)throw new Error("A <Transition.Child /> is used but it is missing a parent <Transition /> or <Transition.Root />.");return e}let _s=v.createContext(null);_s.displayName="NestingContext";function Us(e){return"children"in e?Us(e.children):e.current.filter(({el:t})=>t.current!==null).filter(({state:t})=>t==="visible").length>0}function $h(e,t){let n=zn(e),r=v.useRef([]),o=e5(),s=br(),i=ce((d,h=wn.Hidden)=>{let m=r.current.findIndex(({el:x})=>x===d);m!==-1&&(st(h,{[wn.Unmount](){r.current.splice(m,1)},[wn.Hidden](){r.current[m].state="hidden"}}),s.microTask(()=>{var x;!Us(r)&&o.current&&((x=n.current)==null||x.call(n))}))}),c=ce(d=>{let h=r.current.find(({el:m})=>m===d);return h?h.state!=="visible"&&(h.state="visible"):r.current.push({el:d,state:"visible"}),()=>i(d,wn.Unmount)}),a=v.useRef([]),l=v.useRef(Promise.resolve()),u=v.useRef({enter:[],leave:[]}),f=ce((d,h,m)=>{a.current.splice(0),t&&(t.chains.current[h]=t.chains.current[h].filter(([x])=>x!==d)),t==null||t.chains.current[h].push([d,new Promise(x=>{a.current.push(x)})]),t==null||t.chains.current[h].push([d,new Promise(x=>{Promise.all(u.current[h].map(([A,w])=>w)).then(()=>x())})]),h==="enter"?l.current=l.current.then(()=>t==null?void 0:t.wait.current).then(()=>m(h)):m(h)}),p=ce((d,h,m)=>{Promise.all(u.current[h].splice(0).map(([x,A])=>A)).then(()=>{var x;(x=a.current.shift())==null||x()}).then(()=>m(h))});return v.useMemo(()=>({children:r,register:c,unregister:i,onStart:f,onStop:p,wait:l,chains:u}),[c,i,r,f,p,u,l])}let Th=v.Fragment,Ah=vs.RenderStrategy;function o5(e,t){var n,r;let{transition:o=!0,beforeEnter:s,afterEnter:i,beforeLeave:c,afterLeave:a,enter:l,enterFrom:u,enterTo:f,entered:p,leave:d,leaveFrom:h,leaveTo:m,...x}=e,[A,w]=v.useState(null),T=v.useRef(null),B=Ph(e),L=it(...B?[T,t,w]:t===null?[]:[t]),F=(n=x.unmount)==null||n?wn.Unmount:wn.Hidden,{show:j,appear:g,initial:y}=n5(),[P,k]=v.useState(j?"visible":"hidden"),C=r5(),{register:$,unregister:S}=C;ye(()=>$(T),[$,T]),ye(()=>{if(F===wn.Hidden&&T.current){if(j&&P!=="visible"){k("visible");return}return st(P,{hidden:()=>S(T),visible:()=>$(T)})}},[P,T,$,S,j,F]);let E=Oc();ye(()=>{if(B&&E&&P==="visible"&&T.current===null)throw new Error("Did you forget to passthrough the `ref` to the actual DOM node?")},[T,P,E,B]);let O=y&&!g,N=g&&j&&y,b=v.useRef(!1),M=$h(()=>{b.current||(k("hidden"),S(T))},C),R=ce(H=>{b.current=!0;let Y=H?"enter":"leave";M.onStart(T,Y,Q=>{Q==="enter"?s==null||s():Q==="leave"&&(c==null||c())})}),_=ce(H=>{let Y=H?"enter":"leave";b.current=!1,M.onStop(T,Y,Q=>{Q==="enter"?i==null||i():Q==="leave"&&(a==null||a())}),Y==="leave"&&!Us(M)&&(k("hidden"),S(T))});v.useEffect(()=>{B&&o||(R(j),_(j))},[j,B,o]);let U=!(!o||!B||!E||O),[,W]=kp(U,A,j,{start:R,end:_}),K=vn({ref:L,className:((r=Ga(x.className,N&&l,N&&u,W.enter&&l,W.enter&&W.closed&&u,W.enter&&!W.closed&&f,W.leave&&d,W.leave&&!W.closed&&h,W.leave&&W.closed&&m,!W.transition&&j&&p))==null?void 0:r.trim())||void 0,...Mp(W)}),V=0;P==="visible"&&(V|=$t.Open),P==="hidden"&&(V|=$t.Closed),j&&P==="hidden"&&(V|=$t.Opening),!j&&P==="visible"&&(V|=$t.Closing);let Z=Ye();return v.createElement(_s.Provider,{value:M},v.createElement(wh,{value:V},Z({ourProps:K,theirProps:x,defaultTag:Th,features:Ah,visible:P==="visible",name:"Transition.Child"})))}function s5(e,t){let{show:n,appear:r=!1,unmount:o=!0,...s}=e,i=v.useRef(null),c=Ph(e),a=it(...c?[i,t]:t===null?[]:[t]);Oc();let l=Nc();if(n===void 0&&l!==null&&(n=(l&$t.Open)===$t.Open),n===void 0)throw new Error("A <Transition /> is used but it is missing a `show={true | false}` prop.");let[u,f]=v.useState(n?"visible":"hidden"),p=$h(()=>{n||f("hidden")}),[d,h]=v.useState(!0),m=v.useRef([n]);ye(()=>{d!==!1&&m.current[m.current.length-1]!==n&&(m.current.push(n),h(!1))},[m,n]);let x=v.useMemo(()=>({show:n,appear:r,initial:d}),[n,r,d]);ye(()=>{n?f("visible"):!Us(p)&&i.current!==null&&f("hidden")},[n,p]);let A={unmount:o},w=ce(()=>{var L;d&&h(!1),(L=e.beforeEnter)==null||L.call(e)}),T=ce(()=>{var L;d&&h(!1),(L=e.beforeLeave)==null||L.call(e)}),B=Ye();return v.createElement(_s.Provider,{value:p},v.createElement(js.Provider,{value:x},B({ourProps:{...A,as:v.Fragment,children:v.createElement(Nh,{ref:a,...A,...s,beforeEnter:w,beforeLeave:T})},theirProps:{},defaultTag:v.Fragment,features:Ah,visible:u==="visible",name:"Transition"})))}function i5(e,t){let n=v.useContext(js)!==null,r=Nc()!==null;return v.createElement(v.Fragment,null,!n&&r?v.createElement(Cc,{ref:t,...e}):v.createElement(Nh,{ref:t,...e}))}let Cc=ze(s5),Nh=ze(o5),a5=ze(i5),Ic=Object.assign(Cc,{Child:a5,Root:Cc});function c5(e,t){let n=v.useRef({left:0,top:0});if(ye(()=>{if(!t)return;let o=t.getBoundingClientRect();o&&(n.current=o)},[e,t]),t==null||!e||t===document.activeElement)return!1;let r=t.getBoundingClientRect();return r.top!==n.current.top||r.left!==n.current.left}let Oh=/([\u2700-\u27BF]|[\uE000-\uF8FF]|\uD83C[\uDC00-\uDFFF]|\uD83D[\uDC00-\uDFFF]|[\u2011-\u26FF]|\uD83E[\uDD10-\uDDFF])/g;function Ch(e){var t,n;let r=(t=e.innerText)!=null?t:"",o=e.cloneNode(!0);if(!rn(o))return r;let s=!1;for(let c of o.querySelectorAll('[hidden],[aria-hidden],[role="img"]'))c.remove(),s=!0;let i=s?(n=o.innerText)!=null?n:"":r;return Oh.test(i)&&(i=i.replace(Oh,"")),i}function l5(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():Ch(s).trim()}return null}).filter(Boolean);if(r.length>0)return r.join(", ")}return Ch(e).trim()}function u5(e){let t=v.useRef(""),n=v.useRef("");return ce(()=>{let r=e.current;if(!r)return"";let o=r.innerText;if(t.current===o)return n.current;let s=l5(r).trim().toLowerCase();return t.current=o,n.current=s,s})}var f5=Object.defineProperty,d5=(e,t,n)=>t in e?f5(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Ih=(e,t,n)=>(d5(e,typeof t!="symbol"?t+"":t,n),n),Oe=(e=>(e[e.Open=0]="Open",e[e.Closed=1]="Closed",e))(Oe||{}),Rt=(e=>(e[e.Single=0]="Single",e[e.Multi=1]="Multi",e))(Rt||{}),zs=(e=>(e[e.Pointer=0]="Pointer",e[e.Other=1]="Other",e))(zs||{}),Mh=(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))(Mh||{});function kh(e,t=n=>n){let n=e.activeOptionIndex!==null?e.options[e.activeOptionIndex]:null,r=Pp(t(e.options.slice()),s=>s.dataRef.current.domRef.current),o=n?r.indexOf(n):null;return o===-1&&(o=null),{options:r,activeOptionIndex:o}}let p5={1(e){return e.dataRef.current.disabled||e.listboxState===1?e:{...e,activeOptionIndex:null,pendingFocus:{focus:ve.Nothing},listboxState:1,__demoMode:!1}},0(e,t){if(e.dataRef.current.disabled||e.listboxState===0)return e;let n=e.activeOptionIndex,{isSelected:r}=e.dataRef.current,o=e.options.findIndex(s=>r(s.dataRef.current.value));return o!==-1&&(n=o),{...e,pendingFocus:t.focus,listboxState:0,activeOptionIndex:n,__demoMode:!1}},2(e,t){var n,r,o,s,i;if(e.dataRef.current.disabled||e.listboxState===1)return e;let c={...e,searchQuery:"",activationTrigger:(n=t.trigger)!=null?n:1,__demoMode:!1};if(t.focus===ve.Nothing)return{...c,activeOptionIndex:null};if(t.focus===ve.Specific)return{...c,activeOptionIndex:e.options.findIndex(u=>u.id===t.id)};if(t.focus===ve.Previous){let u=e.activeOptionIndex;if(u!==null){let f=e.options[u].dataRef.current.domRef,p=Rs(t,{resolveItems:()=>e.options,resolveActiveIndex:()=>e.activeOptionIndex,resolveId:d=>d.id,resolveDisabled:d=>d.dataRef.current.disabled});if(p!==null){let d=e.options[p].dataRef.current.domRef;if(((r=f.current)==null?void 0:r.previousElementSibling)===d.current||((o=d.current)==null?void 0:o.previousElementSibling)===null)return{...c,activeOptionIndex:p}}}}else if(t.focus===ve.Next){let u=e.activeOptionIndex;if(u!==null){let f=e.options[u].dataRef.current.domRef,p=Rs(t,{resolveItems:()=>e.options,resolveActiveIndex:()=>e.activeOptionIndex,resolveId:d=>d.id,resolveDisabled:d=>d.dataRef.current.disabled});if(p!==null){let d=e.options[p].dataRef.current.domRef;if(((s=f.current)==null?void 0:s.nextElementSibling)===d.current||((i=d.current)==null?void 0:i.nextElementSibling)===null)return{...c,activeOptionIndex:p}}}}let a=kh(e),l=Rs(t,{resolveItems:()=>a.options,resolveActiveIndex:()=>a.activeOptionIndex,resolveId:u=>u.id,resolveDisabled:u=>u.dataRef.current.disabled});return{...c,...a,activeOptionIndex:l}},3:(e,t)=>{if(e.dataRef.current.disabled||e.listboxState===1)return e;let n=e.searchQuery!==""?0:1,r=e.searchQuery+t.value.toLowerCase(),o=(e.activeOptionIndex!==null?e.options.slice(e.activeOptionIndex+n).concat(e.options.slice(0,e.activeOptionIndex+n)):e.options).find(i=>{var c;return!i.dataRef.current.disabled&&((c=i.dataRef.current.textValue)==null?void 0:c.startsWith(r))}),s=o?e.options.indexOf(o):-1;return s===-1||s===e.activeOptionIndex?{...e,searchQuery:r}:{...e,searchQuery:r,activeOptionIndex:s,activationTrigger:1}},4(e){return e.dataRef.current.disabled||e.listboxState===1||e.searchQuery===""?e:{...e,searchQuery:""}},5:(e,t)=>{let n=e.options.concat(t.options),r=e.activeOptionIndex;if(e.pendingFocus.focus!==ve.Nothing&&(r=Rs(e.pendingFocus,{resolveItems:()=>n,resolveActiveIndex:()=>e.activeOptionIndex,resolveId:o=>o.id,resolveDisabled:o=>o.dataRef.current.disabled})),e.activeOptionIndex===null){let{isSelected:o}=e.dataRef.current;if(o){let s=n.findIndex(i=>o==null?void 0:o(i.dataRef.current.value));s!==-1&&(r=s)}}return{...e,options:n,activeOptionIndex:r,pendingFocus:{focus:ve.Nothing},pendingShouldSort:!0}},6:(e,t)=>{let n=e.options,r=[],o=new Set(t.options);for(let[s,i]of n.entries())if(o.has(i.id)&&(r.push(s),o.delete(i.id),o.size===0))break;if(r.length>0){n=n.slice();for(let s of r.reverse())n.splice(s,1)}return{...e,options:n,activationTrigger:1}},7:(e,t)=>e.buttonElement===t.element?e:{...e,buttonElement:t.element},8:(e,t)=>e.optionsElement===t.element?e:{...e,optionsElement:t.element},9:e=>e.pendingShouldSort?{...e,...kh(e),pendingShouldSort:!1}:e};class Mc extends dp{constructor(t){super(t),Ih(this,"actions",{onChange:n=>{let{onChange:r,compare:o,mode:s,value:i}=this.state.dataRef.current;return st(s,{0:()=>r==null?void 0:r(n),1:()=>{let c=i.slice(),a=c.findIndex(l=>o(l,n));return a===-1?c.push(n):c.splice(a,1),r==null?void 0:r(c)}})},registerOption:Ja(()=>{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:Ja(()=>{let n=[];return[r=>n.push(r),()=>{this.send({type:6,options:n.splice(0)})}]}),goToOption:Ja(()=>{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})}}),Ih(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=ec.get(null);this.disposables.add(r.on(gp.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 Mc({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 st(n.type,p5,t,n)}}const Bh=v.createContext(null);function kc(e){let t=v.useContext(Bh);if(t===null){let n=new Error(`<${e} /> is missing a parent <Listbox /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,Lh),n}return t}function Lh({id:e,__demoMode:t=!1}){let n=v.useMemo(()=>Mc.new({id:e,__demoMode:t}),[]);return xh(()=>n.dispose()),n}let Hs=v.createContext(null);Hs.displayName="ListboxDataContext";function No(e){let t=v.useContext(Hs);if(t===null){let n=new Error(`<${e} /> is missing a parent <Listbox /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,No),n}return t}let h5=v.Fragment;function m5(e,t){let n=v.useId(),r=Va(),{value:o,defaultValue:s,form:i,name:c,onChange:a,by:l,invalid:u=!1,disabled:f=r||!1,horizontal:p=!1,multiple:d=!1,__demoMode:h=!1,...m}=e;const x=p?"horizontal":"vertical";let A=it(t),w=kx(s),[T=d?[]:void 0,B]=Mx(o,a,w),L=Lh({id:n,__demoMode:h}),F=v.useRef({static:!1,hold:!1}),j=v.useRef(new Map),g=sE(l),y=v.useCallback(U=>st(P.mode,{[Rt.Multi]:()=>T.some(W=>g(W,U)),[Rt.Single]:()=>g(T,U)}),[T]),P=v.useMemo(()=>({value:T,disabled:f,invalid:u,mode:d?Rt.Multi:Rt.Single,orientation:x,onChange:B,compare:g,isSelected:y,optionsPropsRef:F,listRef:j}),[T,f,u,d,x,B,g,y,F,j]);ye(()=>{L.state.dataRef.current=P},[P]);let k=ct(L,U=>U.listboxState),C=ec.get(null),$=ct(C,v.useCallback(U=>C.selectors.isTop(U,n),[C,n])),[S,E]=ct(L,U=>[U.buttonElement,U.optionsElement]);ME($,[S,E],(U,W)=>{L.send({type:Mh.CloseListbox}),Sp(W,ac.Loose)||(U.preventDefault(),S==null||S.focus())});let O=v.useMemo(()=>({open:k===Oe.Open,disabled:f,invalid:u,value:T}),[k,f,u,T]),[N,b]=Jx({inherit:!0}),M={ref:A},R=v.useCallback(()=>{if(w!==void 0)return B==null?void 0:B(w)},[B,w]),_=Ye();return v.createElement(b,{value:N,props:{htmlFor:S==null?void 0:S.id},slot:{open:k===Oe.Open,disabled:f}},v.createElement(F6,null,v.createElement(Bh.Provider,{value:L},v.createElement(Hs.Provider,{value:P},v.createElement(wh,{value:st(k,{[Oe.Open]:$t.Open,[Oe.Closed]:$t.Closed})},c!=null&&T!=null&&v.createElement(jx,{disabled:f,data:{[c]:T},form:i,onReset:R}),_({ourProps:M,theirProps:m,slot:O,defaultTag:h5,name:"Listbox"}))))))}let g5="button";function b5(e,t){let n=v.useId(),r=tp(),o=No("Listbox.Button"),s=kc("Listbox.Button"),{id:i=r||`headlessui-listbox-button-${n}`,disabled:c=o.disabled||!1,autoFocus:a=!1,...l}=e,u=it(t,k6(),s.actions.setButtonElement),f=B6(),[p,d,h]=ct(s,b=>[b.listboxState,b.buttonElement,b.optionsElement]),m=p===Oe.Open;LE(m,{trigger:d,action:v.useCallback(b=>{if(d!=null&&d.contains(b.target))return Ps.Ignore;let M=b.target.closest('[role="option"]:not([data-disabled])');return rn(M)?Ps.Select(M):h!=null&&h.contains(b.target)?Ps.Ignore:Ps.Close},[d,h]),close:s.actions.closeListbox,select:s.actions.selectActiveOption});let x=ce(b=>{switch(b.key){case Ne.Enter:Bx(b.currentTarget);break;case Ne.Space:case Ne.ArrowDown:b.preventDefault(),s.actions.openListbox({focus:o.value?ve.Nothing:ve.First});break;case Ne.ArrowUp:b.preventDefault(),s.actions.openListbox({focus:o.value?ve.Nothing:ve.Last});break}}),A=ce(b=>{switch(b.key){case Ne.Space:b.preventDefault();break}}),w=ce(b=>{var M;if(b.button===vh.Left){if(Gx(b.currentTarget))return b.preventDefault();s.state.listboxState===Oe.Open?(ke.flushSync(()=>s.actions.closeListbox()),(M=s.state.buttonElement)==null||M.focus({preventScroll:!0})):(b.preventDefault(),s.actions.openListbox({focus:ve.Nothing}))}}),T=v.useRef(null),B=ce(b=>{T.current=b.pointerType,b.pointerType==="mouse"&&w(b)}),L=ce(b=>{T.current!=="mouse"&&w(b)}),F=ce(b=>b.preventDefault()),j=cp([i]),g=Kx(),{isFocusVisible:y,focusProps:P}=vx({autoFocus:a}),{isHovered:k,hoverProps:C}=wx({isDisabled:c}),{pressed:$,pressProps:S}=Tx({disabled:c}),E=v.useMemo(()=>({open:p===Oe.Open,active:$||p===Oe.Open,disabled:c,invalid:o.invalid,value:o.value,hover:k,focus:y,autofocus:a}),[p,o.value,c,k,y,$,o.invalid,a]),O=ct(s,b=>b.listboxState===Oe.Open),N=Yd(f(),{ref:u,id:i,type:DE(e,d),"aria-haspopup":"listbox","aria-controls":h==null?void 0:h.id,"aria-expanded":O,"aria-labelledby":j,"aria-describedby":g,disabled:c||void 0,autoFocus:a,onKeyDown:x,onKeyUp:A,onKeyPress:F,onPointerDown:B,onClick:L},P,C,S);return Ye()({ourProps:N,theirProps:l,slot:E,defaultTag:g5,name:"Listbox.Button"})}let Dh=v.createContext(!1),y5="div",w5=vs.RenderStrategy|vs.Static;function v5(e,t){let n=v.useId(),{id:r=`headlessui-listbox-options-${n}`,anchor:o,portal:s=!1,modal:i=!0,transition:c=!1,...a}=e,l=M6(o),[u,f]=v.useState(null);l&&(s=!0);let p=No("Listbox.Options"),d=kc("Listbox.Options"),[h,m,x,A]=ct(d,H=>[H.listboxState,H.buttonElement,H.optionsElement,H.__demoMode]),w=cc(m),T=cc(x),B=Nc(),[L,F]=kp(c,u,B!==null?(B&$t.Open)===$t.Open:h===Oe.Open);vE(L,m,d.actions.closeListbox);let j=A?!1:i&&h===Oe.Open;WE(j,T);let g=A?!1:i&&h===Oe.Open;wE(g,{allowed:v.useCallback(()=>[m,x],[m,x])});let y=h!==Oe.Open,P=c5(y,m)?!1:L,k=L&&h===Oe.Closed,C=_6(k,p.value),$=ce(H=>p.compare(C,H)),S=ct(d,H=>{var Y;if(l==null||!((Y=l==null?void 0:l.to)!=null&&Y.includes("selection")))return null;let Q=H.options.findIndex(se=>$(se.dataRef.current.value));return Q===-1&&(Q=0),Q}),E=(()=>{if(l==null)return;if(S===null)return{...l,inner:void 0};let H=Array.from(p.listRef.current.values());return{...l,inner:{listRef:{current:H},index:S}}})(),[O,N]=D6(E),b=L6(),M=it(t,l?O:null,d.actions.setOptionsElement,f),R=br();v.useEffect(()=>{var H;let Y=x;Y&&h===Oe.Open&&Y!==((H=vo(Y))==null?void 0:H.activeElement)&&(Y==null||Y.focus({preventScroll:!0}))},[h,x]);let _=ce(H=>{var Y,Q;switch(R.dispose(),H.key){case Ne.Space:if(d.state.searchQuery!=="")return H.preventDefault(),H.stopPropagation(),d.actions.search(H.key);case Ne.Enter:if(H.preventDefault(),H.stopPropagation(),d.state.activeOptionIndex!==null){let{dataRef:se}=d.state.options[d.state.activeOptionIndex];d.actions.onChange(se.current.value)}p.mode===Rt.Single&&(ke.flushSync(()=>d.actions.closeListbox()),(Y=d.state.buttonElement)==null||Y.focus({preventScroll:!0}));break;case st(p.orientation,{vertical:Ne.ArrowDown,horizontal:Ne.ArrowRight}):return H.preventDefault(),H.stopPropagation(),d.actions.goToOption({focus:ve.Next});case st(p.orientation,{vertical:Ne.ArrowUp,horizontal:Ne.ArrowLeft}):return H.preventDefault(),H.stopPropagation(),d.actions.goToOption({focus:ve.Previous});case Ne.Home:case Ne.PageUp:return H.preventDefault(),H.stopPropagation(),d.actions.goToOption({focus:ve.First});case Ne.End:case Ne.PageDown:return H.preventDefault(),H.stopPropagation(),d.actions.goToOption({focus:ve.Last});case Ne.Escape:H.preventDefault(),H.stopPropagation(),ke.flushSync(()=>d.actions.closeListbox()),(Q=d.state.buttonElement)==null||Q.focus({preventScroll:!0});return;case Ne.Tab:H.preventDefault(),H.stopPropagation(),ke.flushSync(()=>d.actions.closeListbox()),NE(d.state.buttonElement,H.shiftKey?ic.Previous:ic.Next);break;default:H.key.length===1&&(d.actions.search(H.key),R.setTimeout(()=>d.actions.clearSearch(),350));break}}),U=ct(d,H=>{var Y;return(Y=H.buttonElement)==null?void 0:Y.id}),W=v.useMemo(()=>({open:h===Oe.Open}),[h]),K=Yd(l?b():{},{id:r,ref:M,"aria-activedescendant":ct(d,d.selectors.activeDescendantId),"aria-multiselectable":p.mode===Rt.Multi?!0:void 0,"aria-labelledby":U,"aria-orientation":p.orientation,onKeyDown:_,role:"listbox",tabIndex:h===Oe.Open?0:void 0,style:{...a.style,...N,"--button-width":aE(m,!0).width},...Mp(F)}),V=Ye(),Z=v.useMemo(()=>p.mode===Rt.Multi?p:{...p,isSelected:$},[p,$]);return v.createElement(J6,{enabled:s?e.static||L:!1,ownerDocument:w},v.createElement(Hs.Provider,{value:Z},V({ourProps:K,theirProps:a,slot:W,defaultTag:y5,features:w5,visible:P,name:"Listbox.Options"})))}let x5="div";function E5(e,t){let n=v.useId(),{id:r=`headlessui-listbox-option-${n}`,disabled:o=!1,value:s,...i}=e,c=v.useContext(Dh)===!0,a=No("Listbox.Option"),l=kc("Listbox.Option"),u=ct(l,P=>l.selectors.isActive(P,r)),f=a.isSelected(s),p=v.useRef(null),d=u5(p),h=zn({disabled:o,value:s,domRef:p,get textValue(){return d()}}),m=it(t,p,P=>{P?a.listRef.current.set(r,P):a.listRef.current.delete(r)}),x=ct(l,P=>l.selectors.shouldScrollIntoView(P,r));ye(()=>{if(x)return Pt().requestAnimationFrame(()=>{var P,k;(k=(P=p.current)==null?void 0:P.scrollIntoView)==null||k.call(P,{block:"nearest"})})},[x,p]),ye(()=>{if(!c)return l.actions.registerOption(r,h),()=>l.actions.unregisterOption(r)},[h,r,c]);let A=ce(P=>{var k;if(o)return P.preventDefault();l.actions.onChange(s),a.mode===Rt.Single&&(ke.flushSync(()=>l.actions.closeListbox()),(k=l.state.buttonElement)==null||k.focus({preventScroll:!0}))}),w=ce(()=>{if(o)return l.actions.goToOption({focus:ve.Nothing});l.actions.goToOption({focus:ve.Specific,id:r})}),T=VE(),B=ce(P=>T.update(P)),L=ce(P=>{T.wasMoved(P)&&(o||u&&l.state.activationTrigger===zs.Pointer||l.actions.goToOption({focus:ve.Specific,id:r},zs.Pointer))}),F=ce(P=>{T.wasMoved(P)&&(o||u&&l.state.activationTrigger===zs.Pointer&&l.actions.goToOption({focus:ve.Nothing}))}),j=v.useMemo(()=>({active:u,focus:u,selected:f,disabled:o,selectedOption:f&&c}),[u,f,o,c]),g=c?{}:{id:r,ref:m,role:"option",tabIndex:o===!0?void 0:-1,"aria-disabled":o===!0?!0:void 0,"aria-selected":f,disabled:void 0,onClick:A,onFocus:w,onPointerEnter:B,onMouseEnter:B,onPointerMove:L,onMouseMove:L,onPointerLeave:F,onMouseLeave:F},y=Ye();return!f&&c?null:y({ourProps:g,theirProps:i,slot:j,defaultTag:x5,name:"Listbox.Option"})}let S5=v.Fragment;function P5(e,t){let{options:n,placeholder:r,...o}=e,s={ref:it(t)},i=No("ListboxSelectedOption"),c=v.useMemo(()=>({}),[]),a=i.value===void 0||i.value===null||i.mode===Rt.Multi&&Array.isArray(i.value)&&i.value.length===0,l=Ye();return v.createElement(Dh.Provider,{value:!0},l({ourProps:s,theirProps:{...o,children:v.createElement(v.Fragment,null,r&&a?r:n)},slot:c,defaultTag:S5,name:"ListboxSelectedOption"}))}let $5=ze(m5),T5=ze(b5),A5=rE,N5=ze(v5),O5=ze(E5),C5=ze(P5),Xe=Object.assign($5,{Button:T5,Label:A5,Options:N5,Option:O5,SelectedOption:C5});const I5=()=>I.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",children:[I.jsx("g",{clipPath:"url(#clip0_active)",children:I.jsx("path",{d:"M4.63791 6.91929H2.62541C2.36266 6.91929 2.18141 6.65629 2.27491 6.41091L4.27466 1.16191C4.30172 1.0909 4.34971 1.02978 4.41228 0.986649C4.47485 0.943521 4.54905 0.920422 4.62504 0.92041H7.99954C8.26579 0.92041 8.44729 1.19016 8.34679 1.43679L7.18241 4.29479H9.37441C9.69679 4.29479 9.86879 4.67479 9.65616 4.91704L4.28191 11.0408C4.02066 11.3385 3.53629 11.0805 3.63766 10.6977L4.63791 6.91929Z",fill:"#22FD73"})}),I.jsx("defs",{children:I.jsx("clipPath",{id:"clip0_active",children:I.jsx("rect",{width:"12",height:"12",fill:"white",transform:"translate(0 0.0454102)"})})})]}),M5=()=>I.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",children:[I.jsx("g",{clipPath:"url(#clip0_inactive)",children:I.jsx("path",{d:"M4.63791 6.91929H2.62541C2.36266 6.91929 2.18141 6.65629 2.27491 6.41091L4.27466 1.16191C4.30172 1.0909 4.34971 1.02978 4.41228 0.986649C4.47485 0.943521 4.54905 0.920422 4.62504 0.92041H7.99954C8.26579 0.92041 8.44729 1.19016 8.34679 1.43679L7.18241 4.29479H9.37441C9.69679 4.29479 9.86879 4.67479 9.65616 4.91704L4.28191 11.0408C4.02066 11.3385 3.53629 11.0805 3.63766 10.6977L4.63791 6.91929Z",fill:"#F9F9F9"})}),I.jsx("defs",{children:I.jsx("clipPath",{id:"clip0_inactive",children:I.jsx("rect",{width:"12",height:"12",fill:"white",transform:"translate(0 0.0454102)"})})})]}),Oo=({selectedLevel:e,maxLevel:t,className:n=""})=>{const r=Array.from({length:t},(o,s)=>s+1);return I.jsx("div",{className:`flex items-center ${n}`,children:r.map(o=>I.jsx("div",{className:"flex items-center justify-center",children:o>t-e?I.jsx(I5,{}):I.jsx(M5,{})},o))})};class Tt{}Bo(Tt,"FAST",3),Bo(Tt,"Medium",2),Bo(Tt,"SLOW",1),Bo(Tt,"NONE",0);const k5=Object.values({MAINNET:1,SEPOLIA:11155111}),ln=e=>{const t=typeof e=="string"?parseInt(e,10):e;return k5.includes(t)},B5={USDT:!0},Fh=(e,t)=>{const n=typeof e=="string"?parseInt(e,10):e;return n===1||n===11155111?!1:(n===42161||n===421614)&&t?t.toUpperCase()==="ETH"?!1:!B5[t.toUpperCase()]:!0},L5=({chains:e,selectedChain:t,onChainChange:n,disabled:r=!1,className:o="",walletType:s="mpc"})=>{const{t:i}=ht();return I.jsx("div",{className:`relative ${o}`,children:I.jsx(Xe,{value:t,onChange:n,disabled:r,children:({open:c})=>I.jsxs(I.Fragment,{children:[I.jsxs(Xe.Button,{className:`
130
+ */var b2=["input:not([inert])","select:not([inert])","textarea:not([inert])","a[href]:not([inert])","button:not([inert])","[tabindex]:not(slot):not([inert])","audio[controls]:not([inert])","video[controls]:not([inert])",'[contenteditable]:not([contenteditable="false"]):not([inert])',"details>summary:first-of-type:not([inert])","details:not([inert])"],yc=b2.join(","),jp=typeof Element>"u",To=jp?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,Ms=!jp&&Element.prototype.getRootNode?function(e){var t;return e==null||(t=e.getRootNode)===null||t===void 0?void 0:t.call(e)}:function(e){return e==null?void 0:e.ownerDocument},ks=function e(t,n){var r;n===void 0&&(n=!0);var o=t==null||(r=t.getAttribute)===null||r===void 0?void 0:r.call(t,"inert"),s=o===""||o==="true",i=s||n&&t&&e(t.parentNode);return i},y2=function(t){var n,r=t==null||(n=t.getAttribute)===null||n===void 0?void 0:n.call(t,"contenteditable");return r===""||r==="true"},w2=function(t,n,r){if(ks(t))return[];var o=Array.prototype.slice.apply(t.querySelectorAll(yc));return n&&To.call(t,yc)&&o.unshift(t),o=o.filter(r),o},v2=function e(t,n,r){for(var o=[],s=Array.from(t);s.length;){var i=s.shift();if(!ks(i,!1))if(i.tagName==="SLOT"){var c=i.assignedElements(),a=c.length?c:i.children,l=e(a,!0,r);r.flatten?o.push.apply(o,l):o.push({scopeParent:i,candidates:l})}else{var u=To.call(i,yc);u&&r.filter(i)&&(n||!t.includes(i))&&o.push(i);var f=i.shadowRoot||typeof r.getShadowRoot=="function"&&r.getShadowRoot(i),p=!ks(f,!1)&&(!r.shadowRootFilter||r.shadowRootFilter(i));if(f&&p){var d=e(f===!0?i.children:f.children,!0,r);r.flatten?o.push.apply(o,d):o.push({scopeParent:i,candidates:d})}else s.unshift.apply(s,i.children)}}return o},_p=function(t){return!isNaN(parseInt(t.getAttribute("tabindex"),10))},Up=function(t){if(!t)throw new Error("No node provided");return t.tabIndex<0&&(/^(AUDIO|VIDEO|DETAILS)$/.test(t.tagName)||y2(t))&&!_p(t)?0:t.tabIndex},x2=function(t,n){var r=Up(t);return r<0&&n&&!_p(t)?0:r},E2=function(t,n){return t.tabIndex===n.tabIndex?t.documentOrder-n.documentOrder:t.tabIndex-n.tabIndex},zp=function(t){return t.tagName==="INPUT"},S2=function(t){return zp(t)&&t.type==="hidden"},P2=function(t){var n=t.tagName==="DETAILS"&&Array.prototype.slice.apply(t.children).some(function(r){return r.tagName==="SUMMARY"});return n},$2=function(t,n){for(var r=0;r<t.length;r++)if(t[r].checked&&t[r].form===n)return t[r]},T2=function(t){if(!t.name)return!0;var n=t.form||Ms(t),r=function(c){return n.querySelectorAll('input[type="radio"][name="'+c+'"]')},o;if(typeof window<"u"&&typeof window.CSS<"u"&&typeof window.CSS.escape=="function")o=r(window.CSS.escape(t.name));else try{o=r(t.name)}catch(i){return console.error("Looks like you have a radio button with a name attribute containing invalid CSS selector characters and need the CSS.escape polyfill: %s",i.message),!1}var s=$2(o,t.form);return!s||s===t},A2=function(t){return zp(t)&&t.type==="radio"},N2=function(t){return A2(t)&&!T2(t)},O2=function(t){var n,r=t&&Ms(t),o=(n=r)===null||n===void 0?void 0:n.host,s=!1;if(r&&r!==t){var i,c,a;for(s=!!((i=o)!==null&&i!==void 0&&(c=i.ownerDocument)!==null&&c!==void 0&&c.contains(o)||t!=null&&(a=t.ownerDocument)!==null&&a!==void 0&&a.contains(t));!s&&o;){var l,u,f;r=Ms(o),o=(l=r)===null||l===void 0?void 0:l.host,s=!!((u=o)!==null&&u!==void 0&&(f=u.ownerDocument)!==null&&f!==void 0&&f.contains(o))}}return s},Hp=function(t){var n=t.getBoundingClientRect(),r=n.width,o=n.height;return r===0&&o===0},C2=function(t,n){var r=n.displayCheck,o=n.getShadowRoot;if(getComputedStyle(t).visibility==="hidden")return!0;var s=To.call(t,"details>summary:first-of-type"),i=s?t.parentElement:t;if(To.call(i,"details:not([open]) *"))return!0;if(!r||r==="full"||r==="legacy-full"){if(typeof o=="function"){for(var c=t;t;){var a=t.parentElement,l=Ms(t);if(a&&!a.shadowRoot&&o(a)===!0)return Hp(t);t.assignedSlot?t=t.assignedSlot:!a&&l!==t.ownerDocument?t=l.host:t=a}t=c}if(O2(t))return!t.getClientRects().length;if(r!=="legacy-full")return!0}else if(r==="non-zero-area")return Hp(t);return!1},I2=function(t){if(/^(INPUT|BUTTON|SELECT|TEXTAREA)$/.test(t.tagName))for(var n=t.parentElement;n;){if(n.tagName==="FIELDSET"&&n.disabled){for(var r=0;r<n.children.length;r++){var o=n.children.item(r);if(o.tagName==="LEGEND")return To.call(n,"fieldset[disabled] *")?!0:!o.contains(t)}return!0}n=n.parentElement}return!1},M2=function(t,n){return!(n.disabled||ks(n)||S2(n)||C2(n,t)||P2(n)||I2(n))},Wp=function(t,n){return!(N2(n)||Up(n)<0||!M2(t,n))},k2=function(t){var n=parseInt(t.getAttribute("tabindex"),10);return!!(isNaN(n)||n>=0)},B2=function e(t){var n=[],r=[];return t.forEach(function(o,s){var i=!!o.scopeParent,c=i?o.scopeParent:o,a=x2(c,i),l=i?e(o.candidates):c;a===0?i?n.push.apply(n,l):n.push(c):r.push({documentOrder:s,tabIndex:a,item:o,isScope:i,content:l})}),r.sort(E2).reduce(function(o,s){return s.isScope?o.push.apply(o,s.content):o.push(s.content),o},[]).concat(n)},Vp=function(t,n){n=n||{};var r;return n.getShadowRoot?r=v2([t],n.includeContainer,{filter:Wp.bind(null,n),flatten:!1,getShadowRoot:n.getShadowRoot,shadowRootFilter:k2}):r=w2(t,n.includeContainer,Wp.bind(null,n)),B2(r)};function Gp(e,t,n){let{reference:r,floating:o}=e;const s=cn(t),i=gc(t),c=mc(i),a=En(t),l=s==="y",u=r.x+r.width/2-o.width/2,f=r.y+r.height/2-o.height/2,p=r[c]/2-o[c]/2;let d;switch(a){case"top":d={x:u,y:r.y-o.height};break;case"bottom":d={x:u,y:r.y+r.height};break;case"right":d={x:r.x+r.width,y:f};break;case"left":d={x:r.x-o.width,y:f};break;default:d={x:r.x,y:r.y}}switch(xr(t)){case"start":d[i]-=p*(n&&l?-1:1);break;case"end":d[i]+=p*(n&&l?-1:1);break}return d}const L2=async(e,t,n)=>{const{placement:r="bottom",strategy:o="absolute",middleware:s=[],platform:i}=n,c=s.filter(Boolean),a=await(i.isRTL==null?void 0:i.isRTL(t));let l=await i.getElementRects({reference:e,floating:t,strategy:o}),{x:u,y:f}=Gp(l,r,a),p=r,d={},h=0;for(let m=0;m<c.length;m++){const{name:x,fn:A}=c[m],{x:w,y:T,data:B,reset:L}=await A({x:u,y:f,initialPlacement:r,placement:p,strategy:o,middlewareData:d,rects:l,platform:i,elements:{reference:e,floating:t}});u=w??u,f=T??f,d={...d,[x]:{...d[x],...B}},L&&h<=50&&(h++,typeof L=="object"&&(L.placement&&(p=L.placement),L.rects&&(l=L.rects===!0?await i.getElementRects({reference:e,floating:t,strategy:o}):L.rects),{x:u,y:f}=Gp(l,p,a)),m=-1)}return{x:u,y:f,placement:p,strategy:o,middlewareData:d}};async function Bs(e,t){var n;t===void 0&&(t={});const{x:r,y:o,platform:s,rects:i,elements:c,strategy:a}=e,{boundary:l="clippingAncestors",rootBoundary:u="viewport",elementContext:f="floating",altBoundary:p=!1,padding:d=0}=Wn(t,e),h=Rp(d),x=c[p?f==="floating"?"reference":"floating":f],A=Is(await s.getClippingRect({element:(n=await(s.isElement==null?void 0:s.isElement(x)))==null||n?x:x.contextElement||await(s.getDocumentElement==null?void 0:s.getDocumentElement(c.floating)),boundary:l,rootBoundary:u,strategy:a})),w=f==="floating"?{x:r,y:o,width:i.floating.width,height:i.floating.height}:i.reference,T=await(s.getOffsetParent==null?void 0:s.getOffsetParent(c.floating)),B=await(s.isElement==null?void 0:s.isElement(T))?await(s.getScale==null?void 0:s.getScale(T))||{x:1,y:1}:{x:1,y:1},L=Is(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:c,rect:w,offsetParent:T,strategy:a}):w);return{top:(A.top-L.top+h.top)/B.y,bottom:(L.bottom-A.bottom+h.bottom)/B.y,left:(A.left-L.left+h.left)/B.x,right:(L.right-A.right+h.right)/B.x}}const D2=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:o,rects:s,platform:i,elements:c,middlewareData:a}=t,{element:l,padding:u=0}=Wn(e,t)||{};if(l==null)return{};const f=Rp(u),p={x:n,y:r},d=gc(o),h=mc(d),m=await i.getDimensions(l),x=d==="y",A=x?"top":"left",w=x?"bottom":"right",T=x?"clientHeight":"clientWidth",B=s.reference[h]+s.reference[d]-p[d]-s.floating[h],L=p[d]-s.reference[d],F=await(i.getOffsetParent==null?void 0:i.getOffsetParent(l));let _=F?F[T]:0;(!_||!await(i.isElement==null?void 0:i.isElement(F)))&&(_=c.floating[T]||s.floating[h]);const g=B/2-L/2,y=_/2-m[h]/2-1,P=an(f[A],y),k=an(f[w],y),C=P,$=_-m[h]-k,S=_/2-m[h]/2+g,E=hc(C,S,$),O=!a.arrow&&xr(o)!=null&&S!==E&&s.reference[h]/2-(S<C?P:k)-m[h]/2<0,N=O?S<C?S-C:S-$:0;return{[d]:p[d]+N,data:{[d]:E,centerOffset:S-E-N,...O&&{alignmentOffset:N}},reset:O}}}),F2=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:o,middlewareData:s,rects:i,initialPlacement:c,platform:a,elements:l}=t,{mainAxis:u=!0,crossAxis:f=!0,fallbackPlacements:p,fallbackStrategy:d="bestFit",fallbackAxisSideDirection:h="none",flipAlignment:m=!0,...x}=Wn(e,t);if((n=s.arrow)!=null&&n.alignmentOffset)return{};const A=En(o),w=cn(c),T=En(c)===c,B=await(a.isRTL==null?void 0:a.isRTL(l.floating)),L=p||(T||!m?[Cs(c)]:f2(c)),F=h!=="none";!p&&F&&L.push(...m2(c,m,h,B));const _=[c,...L],g=await Bs(t,x),y=[];let P=((r=s.flip)==null?void 0:r.overflows)||[];if(u&&y.push(g[A]),f){const S=u2(o,i,B);y.push(g[S[0]],g[S[1]])}if(P=[...P,{placement:o,overflows:y}],!y.every(S=>S<=0)){var k,C;const S=(((k=s.flip)==null?void 0:k.index)||0)+1,E=_[S];if(E&&(!(f==="alignment"?w!==cn(E):!1)||P.every(b=>cn(b.placement)===w?b.overflows[0]>0:!0)))return{data:{index:S,overflows:P},reset:{placement:E}};let O=(C=P.filter(N=>N.overflows[0]<=0).sort((N,b)=>N.overflows[1]-b.overflows[1])[0])==null?void 0:C.placement;if(!O)switch(d){case"bestFit":{var $;const N=($=P.filter(b=>{if(F){const M=cn(b.placement);return M===w||M==="y"}return!0}).map(b=>[b.placement,b.overflows.filter(M=>M>0).reduce((M,R)=>M+R,0)]).sort((b,M)=>b[1]-M[1])[0])==null?void 0:$[0];N&&(O=N);break}case"initialPlacement":O=c;break}if(o!==O)return{reset:{placement:O}}}return{}}}},R2=new Set(["left","top"]);async function j2(e,t){const{placement:n,platform:r,elements:o}=e,s=await(r.isRTL==null?void 0:r.isRTL(o.floating)),i=En(n),c=xr(n),a=cn(n)==="y",l=R2.has(i)?-1:1,u=s&&a?-1:1,f=Wn(t,e);let{mainAxis:p,crossAxis:d,alignmentAxis:h}=typeof f=="number"?{mainAxis:f,crossAxis:0,alignmentAxis:null}:{mainAxis:f.mainAxis||0,crossAxis:f.crossAxis||0,alignmentAxis:f.alignmentAxis};return c&&typeof h=="number"&&(d=c==="end"?h*-1:h),a?{x:d*u,y:p*l}:{x:p*l,y:d*u}}const _2=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:o,y:s,placement:i,middlewareData:c}=t,a=await j2(t,e);return i===((n=c.offset)==null?void 0:n.placement)&&(r=c.arrow)!=null&&r.alignmentOffset?{}:{x:o+a.x,y:s+a.y,data:{...a,placement:i}}}}},U2=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:o}=t,{mainAxis:s=!0,crossAxis:i=!1,limiter:c={fn:x=>{let{x:A,y:w}=x;return{x:A,y:w}}},...a}=Wn(e,t),l={x:n,y:r},u=await Bs(t,a),f=cn(En(o)),p=Lp(f);let d=l[p],h=l[f];if(s){const x=p==="y"?"top":"left",A=p==="y"?"bottom":"right",w=d+u[x],T=d-u[A];d=hc(w,d,T)}if(i){const x=f==="y"?"top":"left",A=f==="y"?"bottom":"right",w=h+u[x],T=h-u[A];h=hc(w,h,T)}const m=c.fn({...t,[p]:d,[f]:h});return{...m,data:{x:m.x-n,y:m.y-r,enabled:{[p]:s,[f]:i}}}}}},z2=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var n,r;const{placement:o,rects:s,platform:i,elements:c}=t,{apply:a=()=>{},...l}=Wn(e,t),u=await Bs(t,l),f=En(o),p=xr(o),d=cn(o)==="y",{width:h,height:m}=s.floating;let x,A;f==="top"||f==="bottom"?(x=f,A=p===(await(i.isRTL==null?void 0:i.isRTL(c.floating))?"start":"end")?"left":"right"):(A=f,x=p==="end"?"top":"bottom");const w=m-u.top-u.bottom,T=h-u.left-u.right,B=an(m-u[x],w),L=an(h-u[A],T),F=!t.middlewareData.shift;let _=B,g=L;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(g=T),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(_=w),F&&!p){const P=Me(u.left,0),k=Me(u.right,0),C=Me(u.top,0),$=Me(u.bottom,0);d?g=h-2*(P!==0||k!==0?P+k:Me(u.left,u.right)):_=m-2*(C!==0||$!==0?C+$:Me(u.top,u.bottom))}await a({...t,availableWidth:g,availableHeight:_});const y=await i.getDimensions(c.floating);return h!==y.width||m!==y.height?{reset:{rects:!0}}:{}}}};function qp(e){const t=lt(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const o=De(e),s=o?e.offsetWidth:n,i=o?e.offsetHeight:r,c=$o(n)!==s||$o(r)!==i;return c&&(n=s,r=i),{width:n,height:r,$:c}}function wc(e){return fe(e)?e:e.contextElement}function Er(e){const t=wc(e);if(!De(t))return Ft(1);const n=t.getBoundingClientRect(),{width:r,height:o,$:s}=qp(t);let i=(s?$o(n.width):n.width)/r,c=(s?$o(n.height):n.height)/o;return(!i||!Number.isFinite(i))&&(i=1),(!c||!Number.isFinite(c))&&(c=1),{x:i,y:c}}const H2=Ft(0);function Zp(e){const t=He(e);return!As()||!t.visualViewport?H2:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function W2(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==He(e)?!1:t}function Vn(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const o=e.getBoundingClientRect(),s=wc(e);let i=Ft(1);t&&(r?fe(r)&&(i=Er(r)):i=Er(e));const c=W2(s,n,r)?Zp(s):Ft(0);let a=(o.left+c.x)/i.x,l=(o.top+c.y)/i.y,u=o.width/i.x,f=o.height/i.y;if(s){const p=He(s),d=r&&fe(r)?He(r):r;let h=p,m=pc(h);for(;m&&r&&d!==h;){const x=Er(m),A=m.getBoundingClientRect(),w=lt(m),T=A.left+(m.clientLeft+parseFloat(w.paddingLeft))*x.x,B=A.top+(m.clientTop+parseFloat(w.paddingTop))*x.y;a*=x.x,l*=x.y,u*=x.x,f*=x.y,a+=T,l+=B,h=He(m),m=pc(h)}}return Is({width:u,height:f,x:a,y:l})}function Ls(e,t){const n=Ns(e).scrollLeft;return t?t.left+n:Vn(Dt(e)).left+n}function Kp(e,t){const n=e.getBoundingClientRect(),r=n.left+t.scrollLeft-Ls(e,n),o=n.top+t.scrollTop;return{x:r,y:o}}function V2(e){let{elements:t,rect:n,offsetParent:r,strategy:o}=e;const s=o==="fixed",i=Dt(r),c=t?Ts(t.floating):!1;if(r===i||c&&s)return n;let a={scrollLeft:0,scrollTop:0},l=Ft(1);const u=Ft(0),f=De(r);if((f||!f&&!s)&&((vr(r)!=="body"||Po(i))&&(a=Ns(r)),De(r))){const d=Vn(r);l=Er(r),u.x=d.x+r.clientLeft,u.y=d.y+r.clientTop}const p=i&&!f&&!s?Kp(i,a):Ft(0);return{width:n.width*l.x,height:n.height*l.y,x:n.x*l.x-a.scrollLeft*l.x+u.x+p.x,y:n.y*l.y-a.scrollTop*l.y+u.y+p.y}}function G2(e){return Array.from(e.getClientRects())}function q2(e){const t=Dt(e),n=Ns(e),r=e.ownerDocument.body,o=Me(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),s=Me(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let i=-n.scrollLeft+Ls(e);const c=-n.scrollTop;return lt(r).direction==="rtl"&&(i+=Me(t.clientWidth,r.clientWidth)-o),{width:o,height:s,x:i,y:c}}const Yp=25;function Z2(e,t){const n=He(e),r=Dt(e),o=n.visualViewport;let s=r.clientWidth,i=r.clientHeight,c=0,a=0;if(o){s=o.width,i=o.height;const u=As();(!u||u&&t==="fixed")&&(c=o.offsetLeft,a=o.offsetTop)}const l=Ls(r);if(l<=0){const u=r.ownerDocument,f=u.body,p=getComputedStyle(f),d=u.compatMode==="CSS1Compat"&&parseFloat(p.marginLeft)+parseFloat(p.marginRight)||0,h=Math.abs(r.clientWidth-f.clientWidth-d);h<=Yp&&(s-=h)}else l<=Yp&&(s+=l);return{width:s,height:i,x:c,y:a}}const K2=new Set(["absolute","fixed"]);function Y2(e,t){const n=Vn(e,!0,t==="fixed"),r=n.top+e.clientTop,o=n.left+e.clientLeft,s=De(e)?Er(e):Ft(1),i=e.clientWidth*s.x,c=e.clientHeight*s.y,a=o*s.x,l=r*s.y;return{width:i,height:c,x:a,y:l}}function Xp(e,t,n){let r;if(t==="viewport")r=Z2(e,n);else if(t==="document")r=q2(Dt(e));else if(fe(t))r=Y2(t,n);else{const o=Zp(e);r={x:t.x-o.x,y:t.y-o.y,width:t.width,height:t.height}}return Is(r)}function Qp(e,t){const n=sn(e);return n===t||!fe(n)||on(n)?!1:lt(n).position==="fixed"||Qp(n,t)}function X2(e,t){const n=t.get(e);if(n)return n;let r=xn(e,[],!1).filter(c=>fe(c)&&vr(c)!=="body"),o=null;const s=lt(e).position==="fixed";let i=s?sn(e):e;for(;fe(i)&&!on(i);){const c=lt(i),a=dc(i);!a&&c.position==="fixed"&&(o=null),(s?!a&&!o:!a&&c.position==="static"&&!!o&&K2.has(o.position)||Po(i)&&!a&&Qp(e,i))?r=r.filter(u=>u!==i):o=c,i=sn(i)}return t.set(e,r),r}function Q2(e){let{element:t,boundary:n,rootBoundary:r,strategy:o}=e;const i=[...n==="clippingAncestors"?Ts(t)?[]:X2(t,this._c):[].concat(n),r],c=i[0],a=i.reduce((l,u)=>{const f=Xp(t,u,o);return l.top=Me(f.top,l.top),l.right=an(f.right,l.right),l.bottom=an(f.bottom,l.bottom),l.left=Me(f.left,l.left),l},Xp(t,c,o));return{width:a.right-a.left,height:a.bottom-a.top,x:a.left,y:a.top}}function J2(e){const{width:t,height:n}=qp(e);return{width:t,height:n}}function e6(e,t,n){const r=De(t),o=Dt(t),s=n==="fixed",i=Vn(e,!0,s,t);let c={scrollLeft:0,scrollTop:0};const a=Ft(0);function l(){a.x=Ls(o)}if(r||!r&&!s)if((vr(t)!=="body"||Po(o))&&(c=Ns(t)),r){const d=Vn(t,!0,s,t);a.x=d.x+t.clientLeft,a.y=d.y+t.clientTop}else o&&l();s&&!r&&o&&l();const u=o&&!r&&!s?Kp(o,c):Ft(0),f=i.left+c.scrollLeft-a.x-u.x,p=i.top+c.scrollTop-a.y-u.y;return{x:f,y:p,width:i.width,height:i.height}}function vc(e){return lt(e).position==="static"}function Jp(e,t){if(!De(e)||lt(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return Dt(e)===n&&(n=n.ownerDocument.body),n}function eh(e,t){const n=He(e);if(Ts(e))return n;if(!De(e)){let o=sn(e);for(;o&&!on(o);){if(fe(o)&&!vc(o))return o;o=sn(o)}return n}let r=Jp(e,t);for(;r&&JE(r)&&vc(r);)r=Jp(r,t);return r&&on(r)&&vc(r)&&!dc(r)?n:r||o2(e)||n}const t6=async function(e){const t=this.getOffsetParent||eh,n=this.getDimensions,r=await n(e.floating);return{reference:e6(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function n6(e){return lt(e).direction==="rtl"}const r6={convertOffsetParentRelativeRectToViewportRelativeRect:V2,getDocumentElement:Dt,getClippingRect:Q2,getOffsetParent:eh,getElementRects:t6,getClientRects:G2,getDimensions:J2,getScale:Er,isElement:fe,isRTL:n6};function th(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function o6(e,t){let n=null,r;const o=Dt(e);function s(){var c;clearTimeout(r),(c=n)==null||c.disconnect(),n=null}function i(c,a){c===void 0&&(c=!1),a===void 0&&(a=1),s();const l=e.getBoundingClientRect(),{left:u,top:f,width:p,height:d}=l;if(c||t(),!p||!d)return;const h=Os(f),m=Os(o.clientWidth-(u+p)),x=Os(o.clientHeight-(f+d)),A=Os(u),T={rootMargin:-h+"px "+-m+"px "+-x+"px "+-A+"px",threshold:Me(0,an(1,a))||1};let B=!0;function L(F){const _=F[0].intersectionRatio;if(_!==a){if(!B)return i();_?i(!1,_):r=setTimeout(()=>{i(!1,1e-7)},1e3)}_===1&&!th(l,e.getBoundingClientRect())&&i(),B=!1}try{n=new IntersectionObserver(L,{...T,root:o.ownerDocument})}catch{n=new IntersectionObserver(L,T)}n.observe(e)}return i(!0),s}function nh(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:o=!0,ancestorResize:s=!0,elementResize:i=typeof ResizeObserver=="function",layoutShift:c=typeof IntersectionObserver=="function",animationFrame:a=!1}=r,l=wc(e),u=o||s?[...l?xn(l):[],...xn(t)]:[];u.forEach(A=>{o&&A.addEventListener("scroll",n,{passive:!0}),s&&A.addEventListener("resize",n)});const f=l&&c?o6(l,n):null;let p=-1,d=null;i&&(d=new ResizeObserver(A=>{let[w]=A;w&&w.target===l&&d&&(d.unobserve(t),cancelAnimationFrame(p),p=requestAnimationFrame(()=>{var T;(T=d)==null||T.observe(t)})),n()}),l&&!a&&d.observe(l),d.observe(t));let h,m=a?Vn(e):null;a&&x();function x(){const A=Vn(e);m&&!th(m,A)&&n(),m=A,h=requestAnimationFrame(x)}return n(),()=>{var A;u.forEach(w=>{o&&w.removeEventListener("scroll",n),s&&w.removeEventListener("resize",n)}),f==null||f(),(A=d)==null||A.disconnect(),d=null,a&&cancelAnimationFrame(h)}}const xc=Bs,s6=_2,i6=U2,a6=F2,c6=z2,rh=D2,l6=(e,t,n)=>{const r=new Map,o={platform:r6,...n},s={...o.platform,_c:r};return L2(e,t,{...o,platform:s})};var u6=typeof document<"u",f6=function(){},Ds=u6?v.useLayoutEffect:f6;function Fs(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(!Fs(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)&&!Fs(e[s],t[s]))return!1}return!0}return e!==e&&t!==t}function oh(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function sh(e,t){const n=oh(e);return Math.round(t*n)/n}function Ec(e){const t=z.useRef(e);return Ds(()=>{t.current=e}),t}function ih(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:o,elements:{reference:s,floating:i}={},transform:c=!0,whileElementsMounted:a,open:l}=e,[u,f]=z.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[p,d]=z.useState(r);Fs(p,r)||d(r);const[h,m]=z.useState(null),[x,A]=z.useState(null),w=z.useCallback(b=>{b!==F.current&&(F.current=b,m(b))},[]),T=z.useCallback(b=>{b!==_.current&&(_.current=b,A(b))},[]),B=s||h,L=i||x,F=z.useRef(null),_=z.useRef(null),g=z.useRef(u),y=a!=null,P=Ec(a),k=Ec(o),C=Ec(l),$=z.useCallback(()=>{if(!F.current||!_.current)return;const b={placement:t,strategy:n,middleware:p};k.current&&(b.platform=k.current),l6(F.current,_.current,b).then(M=>{const R={...M,isPositioned:C.current!==!1};S.current&&!Fs(g.current,R)&&(g.current=R,Or.flushSync(()=>{f(R)}))})},[p,t,n,k,C]);Ds(()=>{l===!1&&g.current.isPositioned&&(g.current.isPositioned=!1,f(b=>({...b,isPositioned:!1})))},[l]);const S=z.useRef(!1);Ds(()=>(S.current=!0,()=>{S.current=!1}),[]),Ds(()=>{if(B&&(F.current=B),L&&(_.current=L),B&&L){if(P.current)return P.current(B,L,$);$()}},[B,L,$,P,y]);const E=z.useMemo(()=>({reference:F,floating:_,setReference:w,setFloating:T}),[w,T]),O=z.useMemo(()=>({reference:B,floating:L}),[B,L]),N=z.useMemo(()=>{const b={position:n,left:0,top:0};if(!O.floating)return b;const M=sh(O.floating,u.x),R=sh(O.floating,u.y);return c?{...b,transform:"translate("+M+"px, "+R+"px)",...oh(O.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:M,top:R}},[n,c,O.floating,u.x,u.y]);return z.useMemo(()=>({...u,update:$,refs:E,elements:O,floatingStyles:N}),[u,$,E,O,N])}const d6=e=>{function t(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:e,fn(n){const{element:r,padding:o}=typeof e=="function"?e(n):e;return r&&t(r)?r.current!=null?rh({element:r.current,padding:o}).fn(n):{}:r?rh({element:r,padding:o}).fn(n):{}}}},Sc=(e,t)=>({...s6(e),options:[e,t]}),ah=(e,t)=>({...i6(e),options:[e,t]}),ch=(e,t)=>({...a6(e),options:[e,t]}),p6=(e,t)=>({...c6(e),options:[e,t]}),h6=(e,t)=>({...d6(e),options:[e,t]}),lh={...z},m6=lh.useInsertionEffect||(e=>e());function uh(e){const t=z.useRef(()=>{if(process.env.NODE_ENV!=="production")throw new Error("Cannot call an event handler while rendering.")});return m6(()=>{t.current=e}),z.useCallback(function(){for(var n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return t.current==null?void 0:t.current(...r)},[])}var Pc=typeof document<"u"?v.useLayoutEffect:v.useEffect;let fh=!1,g6=0;const dh=()=>"floating-ui-"+Math.random().toString(36).slice(2,6)+g6++;function b6(){const[e,t]=z.useState(()=>fh?dh():void 0);return Pc(()=>{e==null&&t(dh())},[]),z.useEffect(()=>{fh=!0},[]),e}const y6=lh.useId||b6;let Ao;process.env.NODE_ENV!=="production"&&(Ao=new Set);function w6(){for(var e,t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];const o="Floating UI: "+n.join(" ");if(!((e=Ao)!=null&&e.has(o))){var s;(s=Ao)==null||s.add(o),console.warn(o)}}function v6(){for(var e,t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];const o="Floating UI: "+n.join(" ");if(!((e=Ao)!=null&&e.has(o))){var s;(s=Ao)==null||s.add(o),console.error(o)}}function x6(){const e=new Map;return{emit(t,n){var r;(r=e.get(t))==null||r.forEach(o=>o(n))},on(t,n){e.set(t,[...e.get(t)||[],n])},off(t,n){var r;e.set(t,((r=e.get(t))==null?void 0:r.filter(o=>o!==n))||[])}}}const E6=z.createContext(null),S6=z.createContext(null),P6=()=>{var e;return((e=z.useContext(E6))==null?void 0:e.id)||null},$6=()=>z.useContext(S6),T6="data-floating-ui-focusable";function A6(e){const{open:t=!1,onOpenChange:n,elements:r}=e,o=y6(),s=z.useRef({}),[i]=z.useState(()=>x6()),c=P6()!=null;if(process.env.NODE_ENV!=="production"){const d=r.reference;d&&!fe(d)&&v6("Cannot pass a virtual element to the `elements.reference` option,","as it must be a real DOM element. Use `refs.setPositionReference()`","instead.")}const[a,l]=z.useState(r.reference),u=uh((d,h,m)=>{s.current.openEvent=d?h:void 0,i.emit("openchange",{open:d,event:h,reason:m,nested:c}),n==null||n(d,h,m)}),f=z.useMemo(()=>({setPositionReference:l}),[]),p=z.useMemo(()=>({reference:a||r.reference||null,floating:r.floating||null,domReference:r.reference}),[a,r.reference,r.floating]);return z.useMemo(()=>({dataRef:s,open:t,onOpenChange:u,elements:p,events:i,floatingId:o,refs:f}),[t,u,p,i,o,f])}function N6(e){e===void 0&&(e={});const{nodeId:t}=e,n=A6({...e,elements:{reference:null,floating:null,...e.elements}}),r=e.rootContext||n,o=r.elements,[s,i]=z.useState(null),[c,a]=z.useState(null),u=(o==null?void 0:o.domReference)||s,f=z.useRef(null),p=$6();Pc(()=>{u&&(f.current=u)},[u]);const d=ih({...e,elements:{...o,...c&&{reference:c}}}),h=z.useCallback(T=>{const B=fe(T)?{getBoundingClientRect:()=>T.getBoundingClientRect(),contextElement:T}:T;a(B),d.refs.setReference(B)},[d.refs]),m=z.useCallback(T=>{(fe(T)||T===null)&&(f.current=T,i(T)),(fe(d.refs.reference.current)||d.refs.reference.current===null||T!==null&&!fe(T))&&d.refs.setReference(T)},[d.refs]),x=z.useMemo(()=>({...d.refs,setReference:m,setPositionReference:h,domReference:f}),[d.refs,m,h]),A=z.useMemo(()=>({...d.elements,domReference:u}),[d.elements,u]),w=z.useMemo(()=>({...d,...r,refs:x,elements:A,nodeId:t}),[d,x,A,t,r]);return Pc(()=>{r.dataRef.current.floatingContext=w;const T=p==null?void 0:p.nodesRef.current.find(B=>B.id===t);T&&(T.context=w)}),z.useMemo(()=>({...d,context:w,refs:x,elements:A}),[d,x,A,w])}const ph="active",hh="selected";function $c(e,t,n){const r=new Map,o=n==="item";let s=e;if(o&&e){const{[ph]:i,[hh]:c,...a}=e;s=a}return{...n==="floating"&&{tabIndex:-1,[T6]:""},...s,...t.map(i=>{const c=i?i[n]:null;return typeof c=="function"?e?c(e):null:c}).concat(e).reduce((i,c)=>(c&&Object.entries(c).forEach(a=>{let[l,u]=a;if(!(o&&[ph,hh].includes(l)))if(l.indexOf("on")===0){if(r.has(l)||r.set(l,[]),typeof u=="function"){var f;(f=r.get(l))==null||f.push(u),i[l]=function(){for(var p,d=arguments.length,h=new Array(d),m=0;m<d;m++)h[m]=arguments[m];return(p=r.get(l))==null?void 0:p.map(x=>x(...h)).find(x=>x!==void 0)}}}else i[l]=u}),i),{})}}function O6(e){e===void 0&&(e=[]);const t=e.map(c=>c==null?void 0:c.reference),n=e.map(c=>c==null?void 0:c.floating),r=e.map(c=>c==null?void 0:c.item),o=z.useCallback(c=>$c(c,e,"reference"),t),s=z.useCallback(c=>$c(c,e,"floating"),n),i=z.useCallback(c=>$c(c,e,"item"),r);return z.useMemo(()=>({getReferenceProps:o,getFloatingProps:s,getItemProps:i}),[o,s,i])}function mh(e,t){return{...e,rects:{...e.rects,floating:{...e.rects.floating,height:t}}}}const C6=e=>({name:"inner",options:e,async fn(t){const{listRef:n,overflowRef:r,onFallbackChange:o,offset:s=0,index:i=0,minItemsVisible:c=4,referenceOverflowThreshold:a=0,scrollRef:l,...u}=Wn(e,t),{rects:f,elements:{floating:p}}=t,d=n.current[i],h=(l==null?void 0:l.current)||p,m=p.clientTop||h.clientTop,x=p.clientTop!==0,A=h.clientTop!==0,w=p===h;if(process.env.NODE_ENV!=="production"&&(t.placement.startsWith("bottom")||w6('`placement` side must be "bottom" when using the `inner`',"middleware.")),!d)return{};const T={...t,...await Sc(-d.offsetTop-p.clientTop-f.reference.height/2-d.offsetHeight/2-s).fn(t)},B=await xc(mh(T,h.scrollHeight+m+p.clientTop),u),L=await xc(T,{...u,elementContext:"reference"}),F=Me(0,B.top),_=T.y+F,P=(h.scrollHeight>h.clientHeight?k=>k:$o)(Me(0,h.scrollHeight+(x&&w||A?m*2:0)-F-Me(0,B.bottom)));if(h.style.maxHeight=P+"px",h.scrollTop=F,o){const k=h.offsetHeight<d.offsetHeight*an(c,n.current.length)-1||L.top>=-a||L.bottom>=-a;Or.flushSync(()=>o(k))}return r&&(r.current=await xc(mh({...T,y:_},h.offsetHeight+m+p.clientTop),u)),{y:_}}});function I6(e,t){const{open:n,elements:r}=e,{enabled:o=!0,overflowRef:s,scrollRef:i,onChange:c}=t,a=uh(c),l=z.useRef(!1),u=z.useRef(null),f=z.useRef(null);z.useEffect(()=>{if(!o)return;function d(m){if(m.ctrlKey||!h||s.current==null)return;const x=m.deltaY,A=s.current.top>=-.5,w=s.current.bottom>=-.5,T=h.scrollHeight-h.clientHeight,B=x<0?-1:1,L=x<0?"max":"min";h.scrollHeight<=h.clientHeight||(!A&&x>0||!w&&x<0?(m.preventDefault(),Or.flushSync(()=>{a(F=>F+Math[L](x,T*B))})):/firefox/i.test(i2())&&(h.scrollTop+=x))}const h=(i==null?void 0:i.current)||r.floating;if(n&&h)return h.addEventListener("wheel",d),requestAnimationFrame(()=>{u.current=h.scrollTop,s.current!=null&&(f.current={...s.current})}),()=>{u.current=null,f.current=null,h.removeEventListener("wheel",d)}},[o,n,r.floating,s,i,a]);const p=z.useMemo(()=>({onKeyDown(){l.current=!0},onWheel(){l.current=!1},onPointerMove(){l.current=!1},onScroll(){const d=(i==null?void 0:i.current)||r.floating;if(!(!s.current||!d||!l.current)){if(u.current!==null){const h=d.scrollTop-u.current;(s.current.bottom<-.5&&h<-1||s.current.top<-.5&&h>1)&&Or.flushSync(()=>a(m=>m+h))}requestAnimationFrame(()=>{u.current=d.scrollTop})}}}),[r.floating,a,s,i]);return z.useMemo(()=>o?{floating:p}:{},[o,p])}let Sr=v.createContext({styles:void 0,setReference:()=>{},setFloating:()=>{},getReferenceProps:()=>({}),getFloatingProps:()=>({}),slot:{}});Sr.displayName="FloatingContext";let Tc=v.createContext(null);Tc.displayName="PlacementContext";function M6(e){return v.useMemo(()=>e?typeof e=="string"?{to:e}:e:null,[e])}function k6(){return v.useContext(Sr).setReference}function B6(){return v.useContext(Sr).getReferenceProps}function L6(){let{getFloatingProps:e,slot:t}=v.useContext(Sr);return v.useCallback((...n)=>Object.assign({},e(...n),{"data-anchor":t.anchor}),[e,t])}function D6(e=null){e===!1&&(e=null),typeof e=="string"&&(e={to:e});let t=v.useContext(Tc),n=v.useMemo(()=>e,[JSON.stringify(e,(o,s)=>{var i;return(i=s==null?void 0:s.outerHTML)!=null?i:s})]);ye(()=>{t==null||t(n??null)},[t,n]);let r=v.useContext(Sr);return v.useMemo(()=>[r.setFloating,e?r.styles:{}],[r.setFloating,e,r.styles])}let gh=4;function F6({children:e,enabled:t=!0}){let[n,r]=v.useState(null),[o,s]=v.useState(0),i=v.useRef(null),[c,a]=v.useState(null);R6(c);let l=t&&n!==null&&c!==null,{to:u="bottom",gap:f=0,offset:p=0,padding:d=0,inner:h}=j6(n,c),[m,x="center"]=u.split(" ");ye(()=>{l&&s(0)},[l]);let{refs:A,floatingStyles:w,context:T}=N6({open:l,placement:m==="selection"?x==="center"?"bottom":`bottom-${x}`:x==="center"?`${m}`:`${m}-${x}`,strategy:"absolute",transform:!1,middleware:[Sc({mainAxis:m==="selection"?0:f,crossAxis:p}),ah({padding:d}),m!=="selection"&&ch({padding:d}),m==="selection"&&h?C6({...h,padding:d,overflowRef:i,offset:o,minItemsVisible:gh,referenceOverflowThreshold:d,onFallbackChange(k){var C,$;if(!k)return;let S=T.elements.floating;if(!S)return;let E=parseFloat(getComputedStyle(S).scrollPaddingBottom)||0,O=Math.min(gh,S.childElementCount),N=0,b=0;for(let M of($=(C=T.elements.floating)==null?void 0:C.childNodes)!=null?$:[])if(rn(M)){let R=M.offsetTop,U=R+M.clientHeight+E,j=S.scrollTop,W=j+S.clientHeight;if(R>=j&&U<=W)O--;else{b=Math.max(0,Math.min(U,W)-Math.max(R,j)),N=M.clientHeight;break}}O>=1&&s(M=>{let R=N*O-b+E;return M>=R?M:R})}}):null,p6({padding:d,apply({availableWidth:k,availableHeight:C,elements:$}){Object.assign($.floating.style,{overflow:"auto",maxWidth:`${k}px`,maxHeight:`min(var(--anchor-max-height, 100vh), ${C}px)`})}})].filter(Boolean),whileElementsMounted:nh}),[B=m,L=x]=T.placement.split("-");m==="selection"&&(B="selection");let F=v.useMemo(()=>({anchor:[B,L].filter(Boolean).join(" ")}),[B,L]),_=I6(T,{overflowRef:i,onChange:s}),{getReferenceProps:g,getFloatingProps:y}=O6([_]),P=ce(k=>{a(k),A.setFloating(k)});return z.createElement(Tc.Provider,{value:r},z.createElement(Sr.Provider,{value:{setFloating:P,setReference:A.setReference,styles:w,getReferenceProps:g,getFloatingProps:y,slot:F}},e))}function R6(e){ye(()=>{if(!e)return;let t=new MutationObserver(()=>{let n=window.getComputedStyle(e).maxHeight,r=parseFloat(n);if(isNaN(r))return;let o=parseInt(n);isNaN(o)||r!==o&&(e.style.maxHeight=`${Math.ceil(r)}px`)});return t.observe(e,{attributes:!0,attributeFilter:["style"]}),()=>{t.disconnect()}},[e])}function j6(e,t){var n,r,o;let s=Ac((n=e==null?void 0:e.gap)!=null?n:"var(--anchor-gap, 0)",t),i=Ac((r=e==null?void 0:e.offset)!=null?r:"var(--anchor-offset, 0)",t),c=Ac((o=e==null?void 0:e.padding)!=null?o:"var(--anchor-padding, 0)",t);return{...e,gap:s,offset:i,padding:c}}function Ac(e,t,n=void 0){let r=br(),o=ce((a,l)=>{if(a==null)return[n,null];if(typeof a=="number")return[a,null];if(typeof a=="string"){if(!l)return[n,null];let u=yh(a,l);return[u,f=>{let p=bh(a);{let d=p.map(h=>window.getComputedStyle(l).getPropertyValue(h));r.requestAnimationFrame(function h(){r.nextFrame(h);let m=!1;for(let[A,w]of p.entries()){let T=window.getComputedStyle(l).getPropertyValue(w);if(d[A]!==T){d[A]=T,m=!0;break}}if(!m)return;let x=yh(a,l);u!==x&&(f(x),u=x)})}return r.dispose}]}return[n,null]}),s=v.useMemo(()=>o(e,t)[0],[e,t]),[i=s,c]=v.useState();return ye(()=>{let[a,l]=o(e,t);if(c(a),!!l)return l(c)},[e,t]),i}function bh(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,...bh(o)]:[r]}return[]}function yh(e,t){let n=document.createElement("div");t.appendChild(n),n.style.setProperty("margin-top","0px","important"),n.style.setProperty("margin-top",e,"important");let r=parseFloat(window.getComputedStyle(n).marginTop)||0;return t.removeChild(n),r}function _6(e,t){let[n,r]=v.useState(t);return!e&&n!==t&&r(t),e?n:t}let Nc=v.createContext(null);Nc.displayName="OpenClosedContext";var $t=(e=>(e[e.Open=1]="Open",e[e.Closed=2]="Closed",e[e.Closing=4]="Closing",e[e.Opening=8]="Opening",e))($t||{});function Oc(){return v.useContext(Nc)}function wh({value:e,children:t}){return v.createElement(Nc.Provider,{value:e},t)}function U6(e){throw new Error("Unexpected object: "+e)}var ve=(e=>(e[e.First=0]="First",e[e.Previous=1]="Previous",e[e.Next=2]="Next",e[e.Last=3]="Last",e[e.Specific=4]="Specific",e[e.Nothing=5]="Nothing",e))(ve||{});function Rs(e,t){let n=t.resolveItems();if(n.length<=0)return null;let r=t.resolveActiveIndex(),o=r??-1;switch(e.focus){case 0:{for(let s=0;s<n.length;++s)if(!t.resolveDisabled(n[s],s,n))return s;return r}case 1:{o===-1&&(o=n.length);for(let s=o-1;s>=0;--s)if(!t.resolveDisabled(n[s],s,n))return s;return r}case 2:{for(let s=o+1;s<n.length;++s)if(!t.resolveDisabled(n[s],s,n))return s;return r}case 3:{for(let s=n.length-1;s>=0;--s)if(!t.resolveDisabled(n[s],s,n))return s;return r}case 4:{for(let s=0;s<n.length;++s)if(t.resolveId(n[s],s,n)===e.id)return s;return r}case 5:return null;default:U6(e)}}var vh=(e=>(e[e.Left=0]="Left",e[e.Right=2]="Right",e))(vh||{});function xh(e){let t=ce(e),n=v.useRef(!1);v.useEffect(()=>(n.current=!1,()=>{n.current=!0,Zd(()=>{n.current&&t()})}),[t])}function z6(){let e=typeof document>"u";return"useSyncExternalStore"in z?(t=>t.useSyncExternalStore)(z)(()=>()=>{},()=>!1,()=>!e):!1}function Cc(){let e=z6(),[t,n]=z.useState(Bt.isHandoffComplete);return t&&Bt.isHandoffComplete===!1&&n(!1),z.useEffect(()=>{t!==!0&&n(!0)},[t]),z.useEffect(()=>Bt.handoff(),[]),e?!1:t}let H6=v.createContext(!1);function W6(){return v.useContext(H6)}function V6(e){let t=W6(),n=v.useContext(Sh),[r,o]=v.useState(()=>{var s;if(!t&&n!==null)return(s=n.current)!=null?s:null;if(Bt.isServer)return null;let i=e==null?void 0:e.getElementById("headlessui-portal-root");if(i)return i;if(e===null)return null;let c=e.createElement("div");return c.setAttribute("id","headlessui-portal-root"),e.body.appendChild(c)});return v.useEffect(()=>{r!==null&&(e!=null&&e.body.contains(r)||e==null||e.body.appendChild(r))},[r,e]),v.useEffect(()=>{t||n!==null&&o(n.current)},[n,o,t]),r}let Eh=v.Fragment,G6=ze(function(e,t){let{ownerDocument:n=null,...r}=e,o=v.useRef(null),s=it(Zx(d=>{o.current=d}),t),i=lc(o),c=n??i,a=V6(c),[l]=v.useState(()=>{var d;return Bt.isServer?null:(d=c==null?void 0:c.createElement("div"))!=null?d:null}),u=v.useContext(Y6),f=Cc();ye(()=>{!a||!l||a.contains(l)||(l.setAttribute("data-headlessui-portal",""),a.appendChild(l))},[a,l]),ye(()=>{if(l&&u)return u.register(l)},[u,l]),xh(()=>{var d;!a||!l||(Ya(l)&&a.contains(l)&&a.removeChild(l),a.childNodes.length<=0&&((d=a.parentElement)==null||d.removeChild(a)))});let p=Ye();return f?!a||!l?null:ke.createPortal(p({ourProps:{ref:s},theirProps:r,slot:{},defaultTag:Eh,name:"Portal"}),l):null});function q6(e,t){let n=it(t),{enabled:r=!0,ownerDocument:o,...s}=e,i=Ye();return r?v.createElement(G6,{...s,ownerDocument:o,ref:n}):i({ourProps:{ref:n},theirProps:s,slot:{},defaultTag:Eh,name:"Portal"})}let Z6=v.Fragment,Sh=v.createContext(null);function K6(e,t){let{target:n,...r}=e,o={ref:it(t)},s=Ye();return v.createElement(Sh.Provider,{value:n},s({ourProps:o,theirProps:r,defaultTag:Z6,name:"Popover.Group"}))}let Y6=v.createContext(null),X6=ze(q6),Q6=ze(K6),J6=Object.assign(X6,{Group:Q6});function e5(){let e=v.useRef(!1);return ye(()=>(e.current=!0,()=>{e.current=!1}),[]),e}function Ph(e){var t;return!!(e.enter||e.enterFrom||e.enterTo||e.leave||e.leaveFrom||e.leaveTo)||((t=e.as)!=null?t:Th)!==v.Fragment||v.Children.count(e.children)===1}let js=v.createContext(null);js.displayName="TransitionContext";var t5=(e=>(e.Visible="visible",e.Hidden="hidden",e))(t5||{});function n5(){let e=v.useContext(js);if(e===null)throw new Error("A <Transition.Child /> is used but it is missing a parent <Transition /> or <Transition.Root />.");return e}function r5(){let e=v.useContext(_s);if(e===null)throw new Error("A <Transition.Child /> is used but it is missing a parent <Transition /> or <Transition.Root />.");return e}let _s=v.createContext(null);_s.displayName="NestingContext";function Us(e){return"children"in e?Us(e.children):e.current.filter(({el:t})=>t.current!==null).filter(({state:t})=>t==="visible").length>0}function $h(e,t){let n=zn(e),r=v.useRef([]),o=e5(),s=br(),i=ce((d,h=wn.Hidden)=>{let m=r.current.findIndex(({el:x})=>x===d);m!==-1&&(st(h,{[wn.Unmount](){r.current.splice(m,1)},[wn.Hidden](){r.current[m].state="hidden"}}),s.microTask(()=>{var x;!Us(r)&&o.current&&((x=n.current)==null||x.call(n))}))}),c=ce(d=>{let h=r.current.find(({el:m})=>m===d);return h?h.state!=="visible"&&(h.state="visible"):r.current.push({el:d,state:"visible"}),()=>i(d,wn.Unmount)}),a=v.useRef([]),l=v.useRef(Promise.resolve()),u=v.useRef({enter:[],leave:[]}),f=ce((d,h,m)=>{a.current.splice(0),t&&(t.chains.current[h]=t.chains.current[h].filter(([x])=>x!==d)),t==null||t.chains.current[h].push([d,new Promise(x=>{a.current.push(x)})]),t==null||t.chains.current[h].push([d,new Promise(x=>{Promise.all(u.current[h].map(([A,w])=>w)).then(()=>x())})]),h==="enter"?l.current=l.current.then(()=>t==null?void 0:t.wait.current).then(()=>m(h)):m(h)}),p=ce((d,h,m)=>{Promise.all(u.current[h].splice(0).map(([x,A])=>A)).then(()=>{var x;(x=a.current.shift())==null||x()}).then(()=>m(h))});return v.useMemo(()=>({children:r,register:c,unregister:i,onStart:f,onStop:p,wait:l,chains:u}),[c,i,r,f,p,u,l])}let Th=v.Fragment,Ah=vs.RenderStrategy;function o5(e,t){var n,r;let{transition:o=!0,beforeEnter:s,afterEnter:i,beforeLeave:c,afterLeave:a,enter:l,enterFrom:u,enterTo:f,entered:p,leave:d,leaveFrom:h,leaveTo:m,...x}=e,[A,w]=v.useState(null),T=v.useRef(null),B=Ph(e),L=it(...B?[T,t,w]:t===null?[]:[t]),F=(n=x.unmount)==null||n?wn.Unmount:wn.Hidden,{show:_,appear:g,initial:y}=n5(),[P,k]=v.useState(_?"visible":"hidden"),C=r5(),{register:$,unregister:S}=C;ye(()=>$(T),[$,T]),ye(()=>{if(F===wn.Hidden&&T.current){if(_&&P!=="visible"){k("visible");return}return st(P,{hidden:()=>S(T),visible:()=>$(T)})}},[P,T,$,S,_,F]);let E=Cc();ye(()=>{if(B&&E&&P==="visible"&&T.current===null)throw new Error("Did you forget to passthrough the `ref` to the actual DOM node?")},[T,P,E,B]);let O=y&&!g,N=g&&_&&y,b=v.useRef(!1),M=$h(()=>{b.current||(k("hidden"),S(T))},C),R=ce(H=>{b.current=!0;let Y=H?"enter":"leave";M.onStart(T,Y,Q=>{Q==="enter"?s==null||s():Q==="leave"&&(c==null||c())})}),U=ce(H=>{let Y=H?"enter":"leave";b.current=!1,M.onStop(T,Y,Q=>{Q==="enter"?i==null||i():Q==="leave"&&(a==null||a())}),Y==="leave"&&!Us(M)&&(k("hidden"),S(T))});v.useEffect(()=>{B&&o||(R(_),U(_))},[_,B,o]);let j=!(!o||!B||!E||O),[,W]=kp(j,A,_,{start:R,end:U}),K=vn({ref:L,className:((r=qa(x.className,N&&l,N&&u,W.enter&&l,W.enter&&W.closed&&u,W.enter&&!W.closed&&f,W.leave&&d,W.leave&&!W.closed&&h,W.leave&&W.closed&&m,!W.transition&&_&&p))==null?void 0:r.trim())||void 0,...Mp(W)}),V=0;P==="visible"&&(V|=$t.Open),P==="hidden"&&(V|=$t.Closed),_&&P==="hidden"&&(V|=$t.Opening),!_&&P==="visible"&&(V|=$t.Closing);let Z=Ye();return v.createElement(_s.Provider,{value:M},v.createElement(wh,{value:V},Z({ourProps:K,theirProps:x,defaultTag:Th,features:Ah,visible:P==="visible",name:"Transition.Child"})))}function s5(e,t){let{show:n,appear:r=!1,unmount:o=!0,...s}=e,i=v.useRef(null),c=Ph(e),a=it(...c?[i,t]:t===null?[]:[t]);Cc();let l=Oc();if(n===void 0&&l!==null&&(n=(l&$t.Open)===$t.Open),n===void 0)throw new Error("A <Transition /> is used but it is missing a `show={true | false}` prop.");let[u,f]=v.useState(n?"visible":"hidden"),p=$h(()=>{n||f("hidden")}),[d,h]=v.useState(!0),m=v.useRef([n]);ye(()=>{d!==!1&&m.current[m.current.length-1]!==n&&(m.current.push(n),h(!1))},[m,n]);let x=v.useMemo(()=>({show:n,appear:r,initial:d}),[n,r,d]);ye(()=>{n?f("visible"):!Us(p)&&i.current!==null&&f("hidden")},[n,p]);let A={unmount:o},w=ce(()=>{var L;d&&h(!1),(L=e.beforeEnter)==null||L.call(e)}),T=ce(()=>{var L;d&&h(!1),(L=e.beforeLeave)==null||L.call(e)}),B=Ye();return v.createElement(_s.Provider,{value:p},v.createElement(js.Provider,{value:x},B({ourProps:{...A,as:v.Fragment,children:v.createElement(Nh,{ref:a,...A,...s,beforeEnter:w,beforeLeave:T})},theirProps:{},defaultTag:v.Fragment,features:Ah,visible:u==="visible",name:"Transition"})))}function i5(e,t){let n=v.useContext(js)!==null,r=Oc()!==null;return v.createElement(v.Fragment,null,!n&&r?v.createElement(Ic,{ref:t,...e}):v.createElement(Nh,{ref:t,...e}))}let Ic=ze(s5),Nh=ze(o5),a5=ze(i5),Mc=Object.assign(Ic,{Child:a5,Root:Ic});function c5(e,t){let n=v.useRef({left:0,top:0});if(ye(()=>{if(!t)return;let o=t.getBoundingClientRect();o&&(n.current=o)},[e,t]),t==null||!e||t===document.activeElement)return!1;let r=t.getBoundingClientRect();return r.top!==n.current.top||r.left!==n.current.left}let Oh=/([\u2700-\u27BF]|[\uE000-\uF8FF]|\uD83C[\uDC00-\uDFFF]|\uD83D[\uDC00-\uDFFF]|[\u2011-\u26FF]|\uD83E[\uDD10-\uDDFF])/g;function Ch(e){var t,n;let r=(t=e.innerText)!=null?t:"",o=e.cloneNode(!0);if(!rn(o))return r;let s=!1;for(let c of o.querySelectorAll('[hidden],[aria-hidden],[role="img"]'))c.remove(),s=!0;let i=s?(n=o.innerText)!=null?n:"":r;return Oh.test(i)&&(i=i.replace(Oh,"")),i}function l5(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():Ch(s).trim()}return null}).filter(Boolean);if(r.length>0)return r.join(", ")}return Ch(e).trim()}function u5(e){let t=v.useRef(""),n=v.useRef("");return ce(()=>{let r=e.current;if(!r)return"";let o=r.innerText;if(t.current===o)return n.current;let s=l5(r).trim().toLowerCase();return t.current=o,n.current=s,s})}var f5=Object.defineProperty,d5=(e,t,n)=>t in e?f5(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Ih=(e,t,n)=>(d5(e,typeof t!="symbol"?t+"":t,n),n),Oe=(e=>(e[e.Open=0]="Open",e[e.Closed=1]="Closed",e))(Oe||{}),Rt=(e=>(e[e.Single=0]="Single",e[e.Multi=1]="Multi",e))(Rt||{}),zs=(e=>(e[e.Pointer=0]="Pointer",e[e.Other=1]="Other",e))(zs||{}),Mh=(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))(Mh||{});function kh(e,t=n=>n){let n=e.activeOptionIndex!==null?e.options[e.activeOptionIndex]:null,r=Pp(t(e.options.slice()),s=>s.dataRef.current.domRef.current),o=n?r.indexOf(n):null;return o===-1&&(o=null),{options:r,activeOptionIndex:o}}let p5={1(e){return e.dataRef.current.disabled||e.listboxState===1?e:{...e,activeOptionIndex:null,pendingFocus:{focus:ve.Nothing},listboxState:1,__demoMode:!1}},0(e,t){if(e.dataRef.current.disabled||e.listboxState===0)return e;let n=e.activeOptionIndex,{isSelected:r}=e.dataRef.current,o=e.options.findIndex(s=>r(s.dataRef.current.value));return o!==-1&&(n=o),{...e,pendingFocus:t.focus,listboxState:0,activeOptionIndex:n,__demoMode:!1}},2(e,t){var n,r,o,s,i;if(e.dataRef.current.disabled||e.listboxState===1)return e;let c={...e,searchQuery:"",activationTrigger:(n=t.trigger)!=null?n:1,__demoMode:!1};if(t.focus===ve.Nothing)return{...c,activeOptionIndex:null};if(t.focus===ve.Specific)return{...c,activeOptionIndex:e.options.findIndex(u=>u.id===t.id)};if(t.focus===ve.Previous){let u=e.activeOptionIndex;if(u!==null){let f=e.options[u].dataRef.current.domRef,p=Rs(t,{resolveItems:()=>e.options,resolveActiveIndex:()=>e.activeOptionIndex,resolveId:d=>d.id,resolveDisabled:d=>d.dataRef.current.disabled});if(p!==null){let d=e.options[p].dataRef.current.domRef;if(((r=f.current)==null?void 0:r.previousElementSibling)===d.current||((o=d.current)==null?void 0:o.previousElementSibling)===null)return{...c,activeOptionIndex:p}}}}else if(t.focus===ve.Next){let u=e.activeOptionIndex;if(u!==null){let f=e.options[u].dataRef.current.domRef,p=Rs(t,{resolveItems:()=>e.options,resolveActiveIndex:()=>e.activeOptionIndex,resolveId:d=>d.id,resolveDisabled:d=>d.dataRef.current.disabled});if(p!==null){let d=e.options[p].dataRef.current.domRef;if(((s=f.current)==null?void 0:s.nextElementSibling)===d.current||((i=d.current)==null?void 0:i.nextElementSibling)===null)return{...c,activeOptionIndex:p}}}}let a=kh(e),l=Rs(t,{resolveItems:()=>a.options,resolveActiveIndex:()=>a.activeOptionIndex,resolveId:u=>u.id,resolveDisabled:u=>u.dataRef.current.disabled});return{...c,...a,activeOptionIndex:l}},3:(e,t)=>{if(e.dataRef.current.disabled||e.listboxState===1)return e;let n=e.searchQuery!==""?0:1,r=e.searchQuery+t.value.toLowerCase(),o=(e.activeOptionIndex!==null?e.options.slice(e.activeOptionIndex+n).concat(e.options.slice(0,e.activeOptionIndex+n)):e.options).find(i=>{var c;return!i.dataRef.current.disabled&&((c=i.dataRef.current.textValue)==null?void 0:c.startsWith(r))}),s=o?e.options.indexOf(o):-1;return s===-1||s===e.activeOptionIndex?{...e,searchQuery:r}:{...e,searchQuery:r,activeOptionIndex:s,activationTrigger:1}},4(e){return e.dataRef.current.disabled||e.listboxState===1||e.searchQuery===""?e:{...e,searchQuery:""}},5:(e,t)=>{let n=e.options.concat(t.options),r=e.activeOptionIndex;if(e.pendingFocus.focus!==ve.Nothing&&(r=Rs(e.pendingFocus,{resolveItems:()=>n,resolveActiveIndex:()=>e.activeOptionIndex,resolveId:o=>o.id,resolveDisabled:o=>o.dataRef.current.disabled})),e.activeOptionIndex===null){let{isSelected:o}=e.dataRef.current;if(o){let s=n.findIndex(i=>o==null?void 0:o(i.dataRef.current.value));s!==-1&&(r=s)}}return{...e,options:n,activeOptionIndex:r,pendingFocus:{focus:ve.Nothing},pendingShouldSort:!0}},6:(e,t)=>{let n=e.options,r=[],o=new Set(t.options);for(let[s,i]of n.entries())if(o.has(i.id)&&(r.push(s),o.delete(i.id),o.size===0))break;if(r.length>0){n=n.slice();for(let s of r.reverse())n.splice(s,1)}return{...e,options:n,activationTrigger:1}},7:(e,t)=>e.buttonElement===t.element?e:{...e,buttonElement:t.element},8:(e,t)=>e.optionsElement===t.element?e:{...e,optionsElement:t.element},9:e=>e.pendingShouldSort?{...e,...kh(e),pendingShouldSort:!1}:e};class kc extends dp{constructor(t){super(t),Ih(this,"actions",{onChange:n=>{let{onChange:r,compare:o,mode:s,value:i}=this.state.dataRef.current;return st(s,{0:()=>r==null?void 0:r(n),1:()=>{let c=i.slice(),a=c.findIndex(l=>o(l,n));return a===-1?c.push(n):c.splice(a,1),r==null?void 0:r(c)}})},registerOption:ec(()=>{let n=[],r=new Set;return[(o,s)=>{r.has(s)||(r.add(s),n.push({id:o,dataRef:s}))},()=>(r.clear(),this.send({type:5,options:n.splice(0)}))]}),unregisterOption:ec(()=>{let n=[];return[r=>n.push(r),()=>{this.send({type:6,options:n.splice(0)})}]}),goToOption:ec(()=>{let n=null;return[(r,o)=>{n={type:2,...r,trigger:o}},()=>n&&this.send(n)]}),closeListbox:()=>{this.send({type:1})},openListbox:n=>{this.send({type:0,focus:n})},selectActiveOption:()=>{if(this.state.activeOptionIndex!==null){let{dataRef:n,id:r}=this.state.options[this.state.activeOptionIndex];this.actions.onChange(n.current.value),this.send({type:2,focus:ve.Specific,id:r})}},selectOption:n=>{let r=this.state.options.find(o=>o.id===n);r&&this.actions.onChange(r.dataRef.current.value)},search:n=>{this.send({type:3,value:n})},clearSearch:()=>{this.send({type:4})},setButtonElement:n=>{this.send({type:7,element:n})},setOptionsElement:n=>{this.send({type:8,element:n})}}),Ih(this,"selectors",{activeDescendantId(n){var r;let o=n.activeOptionIndex,s=n.options;return o===null||(r=s[o])==null?void 0:r.id},isActive(n,r){var o;let s=n.activeOptionIndex,i=n.options;return s!==null?((o=i[s])==null?void 0:o.id)===r:!1},shouldScrollIntoView(n,r){return n.__demoMode||n.listboxState!==0||n.activationTrigger===0?!1:this.isActive(n,r)}}),this.on(5,()=>{requestAnimationFrame(()=>{this.send({type:9})})});{let n=this.state.id,r=tc.get(null);this.disposables.add(r.on(gp.Push,o=>{!r.selectors.isTop(o,n)&&this.state.listboxState===0&&this.actions.closeListbox()})),this.on(0,()=>r.actions.push(n)),this.on(1,()=>r.actions.pop(n))}}static new({id:t,__demoMode:n=!1}){return new kc({id:t,dataRef:{current:{}},listboxState:n?0:1,options:[],searchQuery:"",activeOptionIndex:null,activationTrigger:1,buttonElement:null,optionsElement:null,pendingShouldSort:!1,pendingFocus:{focus:ve.Nothing},__demoMode:n})}reduce(t,n){return st(n.type,p5,t,n)}}const Bh=v.createContext(null);function Bc(e){let t=v.useContext(Bh);if(t===null){let n=new Error(`<${e} /> is missing a parent <Listbox /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,Lh),n}return t}function Lh({id:e,__demoMode:t=!1}){let n=v.useMemo(()=>kc.new({id:e,__demoMode:t}),[]);return xh(()=>n.dispose()),n}let Hs=v.createContext(null);Hs.displayName="ListboxDataContext";function No(e){let t=v.useContext(Hs);if(t===null){let n=new Error(`<${e} /> is missing a parent <Listbox /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,No),n}return t}let h5=v.Fragment;function m5(e,t){let n=v.useId(),r=Ga(),{value:o,defaultValue:s,form:i,name:c,onChange:a,by:l,invalid:u=!1,disabled:f=r||!1,horizontal:p=!1,multiple:d=!1,__demoMode:h=!1,...m}=e;const x=p?"horizontal":"vertical";let A=it(t),w=kx(s),[T=d?[]:void 0,B]=Mx(o,a,w),L=Lh({id:n,__demoMode:h}),F=v.useRef({static:!1,hold:!1}),_=v.useRef(new Map),g=sE(l),y=v.useCallback(j=>st(P.mode,{[Rt.Multi]:()=>T.some(W=>g(W,j)),[Rt.Single]:()=>g(T,j)}),[T]),P=v.useMemo(()=>({value:T,disabled:f,invalid:u,mode:d?Rt.Multi:Rt.Single,orientation:x,onChange:B,compare:g,isSelected:y,optionsPropsRef:F,listRef:_}),[T,f,u,d,x,B,g,y,F,_]);ye(()=>{L.state.dataRef.current=P},[P]);let k=ct(L,j=>j.listboxState),C=tc.get(null),$=ct(C,v.useCallback(j=>C.selectors.isTop(j,n),[C,n])),[S,E]=ct(L,j=>[j.buttonElement,j.optionsElement]);ME($,[S,E],(j,W)=>{L.send({type:Mh.CloseListbox}),Sp(W,cc.Loose)||(j.preventDefault(),S==null||S.focus())});let O=v.useMemo(()=>({open:k===Oe.Open,disabled:f,invalid:u,value:T}),[k,f,u,T]),[N,b]=Jx({inherit:!0}),M={ref:A},R=v.useCallback(()=>{if(w!==void 0)return B==null?void 0:B(w)},[B,w]),U=Ye();return v.createElement(b,{value:N,props:{htmlFor:S==null?void 0:S.id},slot:{open:k===Oe.Open,disabled:f}},v.createElement(F6,null,v.createElement(Bh.Provider,{value:L},v.createElement(Hs.Provider,{value:P},v.createElement(wh,{value:st(k,{[Oe.Open]:$t.Open,[Oe.Closed]:$t.Closed})},c!=null&&T!=null&&v.createElement(jx,{disabled:f,data:{[c]:T},form:i,onReset:R}),U({ourProps:M,theirProps:m,slot:O,defaultTag:h5,name:"Listbox"}))))))}let g5="button";function b5(e,t){let n=v.useId(),r=tp(),o=No("Listbox.Button"),s=Bc("Listbox.Button"),{id:i=r||`headlessui-listbox-button-${n}`,disabled:c=o.disabled||!1,autoFocus:a=!1,...l}=e,u=it(t,k6(),s.actions.setButtonElement),f=B6(),[p,d,h]=ct(s,b=>[b.listboxState,b.buttonElement,b.optionsElement]),m=p===Oe.Open;LE(m,{trigger:d,action:v.useCallback(b=>{if(d!=null&&d.contains(b.target))return Ps.Ignore;let M=b.target.closest('[role="option"]:not([data-disabled])');return rn(M)?Ps.Select(M):h!=null&&h.contains(b.target)?Ps.Ignore:Ps.Close},[d,h]),close:s.actions.closeListbox,select:s.actions.selectActiveOption});let x=ce(b=>{switch(b.key){case Ne.Enter:Bx(b.currentTarget);break;case Ne.Space:case Ne.ArrowDown:b.preventDefault(),s.actions.openListbox({focus:o.value?ve.Nothing:ve.First});break;case Ne.ArrowUp:b.preventDefault(),s.actions.openListbox({focus:o.value?ve.Nothing:ve.Last});break}}),A=ce(b=>{switch(b.key){case Ne.Space:b.preventDefault();break}}),w=ce(b=>{var M;if(b.button===vh.Left){if(Gx(b.currentTarget))return b.preventDefault();s.state.listboxState===Oe.Open?(ke.flushSync(()=>s.actions.closeListbox()),(M=s.state.buttonElement)==null||M.focus({preventScroll:!0})):(b.preventDefault(),s.actions.openListbox({focus:ve.Nothing}))}}),T=v.useRef(null),B=ce(b=>{T.current=b.pointerType,b.pointerType==="mouse"&&w(b)}),L=ce(b=>{T.current!=="mouse"&&w(b)}),F=ce(b=>b.preventDefault()),_=cp([i]),g=Kx(),{isFocusVisible:y,focusProps:P}=vx({autoFocus:a}),{isHovered:k,hoverProps:C}=wx({isDisabled:c}),{pressed:$,pressProps:S}=Tx({disabled:c}),E=v.useMemo(()=>({open:p===Oe.Open,active:$||p===Oe.Open,disabled:c,invalid:o.invalid,value:o.value,hover:k,focus:y,autofocus:a}),[p,o.value,c,k,y,$,o.invalid,a]),O=ct(s,b=>b.listboxState===Oe.Open),N=Yd(f(),{ref:u,id:i,type:DE(e,d),"aria-haspopup":"listbox","aria-controls":h==null?void 0:h.id,"aria-expanded":O,"aria-labelledby":_,"aria-describedby":g,disabled:c||void 0,autoFocus:a,onKeyDown:x,onKeyUp:A,onKeyPress:F,onPointerDown:B,onClick:L},P,C,S);return Ye()({ourProps:N,theirProps:l,slot:E,defaultTag:g5,name:"Listbox.Button"})}let Dh=v.createContext(!1),y5="div",w5=vs.RenderStrategy|vs.Static;function v5(e,t){let n=v.useId(),{id:r=`headlessui-listbox-options-${n}`,anchor:o,portal:s=!1,modal:i=!0,transition:c=!1,...a}=e,l=M6(o),[u,f]=v.useState(null);l&&(s=!0);let p=No("Listbox.Options"),d=Bc("Listbox.Options"),[h,m,x,A]=ct(d,H=>[H.listboxState,H.buttonElement,H.optionsElement,H.__demoMode]),w=lc(m),T=lc(x),B=Oc(),[L,F]=kp(c,u,B!==null?(B&$t.Open)===$t.Open:h===Oe.Open);vE(L,m,d.actions.closeListbox);let _=A?!1:i&&h===Oe.Open;WE(_,T);let g=A?!1:i&&h===Oe.Open;wE(g,{allowed:v.useCallback(()=>[m,x],[m,x])});let y=h!==Oe.Open,P=c5(y,m)?!1:L,k=L&&h===Oe.Closed,C=_6(k,p.value),$=ce(H=>p.compare(C,H)),S=ct(d,H=>{var Y;if(l==null||!((Y=l==null?void 0:l.to)!=null&&Y.includes("selection")))return null;let Q=H.options.findIndex(oe=>$(oe.dataRef.current.value));return Q===-1&&(Q=0),Q}),E=(()=>{if(l==null)return;if(S===null)return{...l,inner:void 0};let H=Array.from(p.listRef.current.values());return{...l,inner:{listRef:{current:H},index:S}}})(),[O,N]=D6(E),b=L6(),M=it(t,l?O:null,d.actions.setOptionsElement,f),R=br();v.useEffect(()=>{var H;let Y=x;Y&&h===Oe.Open&&Y!==((H=vo(Y))==null?void 0:H.activeElement)&&(Y==null||Y.focus({preventScroll:!0}))},[h,x]);let U=ce(H=>{var Y,Q;switch(R.dispose(),H.key){case Ne.Space:if(d.state.searchQuery!=="")return H.preventDefault(),H.stopPropagation(),d.actions.search(H.key);case Ne.Enter:if(H.preventDefault(),H.stopPropagation(),d.state.activeOptionIndex!==null){let{dataRef:oe}=d.state.options[d.state.activeOptionIndex];d.actions.onChange(oe.current.value)}p.mode===Rt.Single&&(ke.flushSync(()=>d.actions.closeListbox()),(Y=d.state.buttonElement)==null||Y.focus({preventScroll:!0}));break;case st(p.orientation,{vertical:Ne.ArrowDown,horizontal:Ne.ArrowRight}):return H.preventDefault(),H.stopPropagation(),d.actions.goToOption({focus:ve.Next});case st(p.orientation,{vertical:Ne.ArrowUp,horizontal:Ne.ArrowLeft}):return H.preventDefault(),H.stopPropagation(),d.actions.goToOption({focus:ve.Previous});case Ne.Home:case Ne.PageUp:return H.preventDefault(),H.stopPropagation(),d.actions.goToOption({focus:ve.First});case Ne.End:case Ne.PageDown:return H.preventDefault(),H.stopPropagation(),d.actions.goToOption({focus:ve.Last});case Ne.Escape:H.preventDefault(),H.stopPropagation(),ke.flushSync(()=>d.actions.closeListbox()),(Q=d.state.buttonElement)==null||Q.focus({preventScroll:!0});return;case Ne.Tab:H.preventDefault(),H.stopPropagation(),ke.flushSync(()=>d.actions.closeListbox()),NE(d.state.buttonElement,H.shiftKey?ac.Previous:ac.Next);break;default:H.key.length===1&&(d.actions.search(H.key),R.setTimeout(()=>d.actions.clearSearch(),350));break}}),j=ct(d,H=>{var Y;return(Y=H.buttonElement)==null?void 0:Y.id}),W=v.useMemo(()=>({open:h===Oe.Open}),[h]),K=Yd(l?b():{},{id:r,ref:M,"aria-activedescendant":ct(d,d.selectors.activeDescendantId),"aria-multiselectable":p.mode===Rt.Multi?!0:void 0,"aria-labelledby":j,"aria-orientation":p.orientation,onKeyDown:U,role:"listbox",tabIndex:h===Oe.Open?0:void 0,style:{...a.style,...N,"--button-width":aE(m,!0).width},...Mp(F)}),V=Ye(),Z=v.useMemo(()=>p.mode===Rt.Multi?p:{...p,isSelected:$},[p,$]);return v.createElement(J6,{enabled:s?e.static||L:!1,ownerDocument:w},v.createElement(Hs.Provider,{value:Z},V({ourProps:K,theirProps:a,slot:W,defaultTag:y5,features:w5,visible:P,name:"Listbox.Options"})))}let x5="div";function E5(e,t){let n=v.useId(),{id:r=`headlessui-listbox-option-${n}`,disabled:o=!1,value:s,...i}=e,c=v.useContext(Dh)===!0,a=No("Listbox.Option"),l=Bc("Listbox.Option"),u=ct(l,P=>l.selectors.isActive(P,r)),f=a.isSelected(s),p=v.useRef(null),d=u5(p),h=zn({disabled:o,value:s,domRef:p,get textValue(){return d()}}),m=it(t,p,P=>{P?a.listRef.current.set(r,P):a.listRef.current.delete(r)}),x=ct(l,P=>l.selectors.shouldScrollIntoView(P,r));ye(()=>{if(x)return Pt().requestAnimationFrame(()=>{var P,k;(k=(P=p.current)==null?void 0:P.scrollIntoView)==null||k.call(P,{block:"nearest"})})},[x,p]),ye(()=>{if(!c)return l.actions.registerOption(r,h),()=>l.actions.unregisterOption(r)},[h,r,c]);let A=ce(P=>{var k;if(o)return P.preventDefault();l.actions.onChange(s),a.mode===Rt.Single&&(ke.flushSync(()=>l.actions.closeListbox()),(k=l.state.buttonElement)==null||k.focus({preventScroll:!0}))}),w=ce(()=>{if(o)return l.actions.goToOption({focus:ve.Nothing});l.actions.goToOption({focus:ve.Specific,id:r})}),T=VE(),B=ce(P=>T.update(P)),L=ce(P=>{T.wasMoved(P)&&(o||u&&l.state.activationTrigger===zs.Pointer||l.actions.goToOption({focus:ve.Specific,id:r},zs.Pointer))}),F=ce(P=>{T.wasMoved(P)&&(o||u&&l.state.activationTrigger===zs.Pointer&&l.actions.goToOption({focus:ve.Nothing}))}),_=v.useMemo(()=>({active:u,focus:u,selected:f,disabled:o,selectedOption:f&&c}),[u,f,o,c]),g=c?{}:{id:r,ref:m,role:"option",tabIndex:o===!0?void 0:-1,"aria-disabled":o===!0?!0:void 0,"aria-selected":f,disabled:void 0,onClick:A,onFocus:w,onPointerEnter:B,onMouseEnter:B,onPointerMove:L,onMouseMove:L,onPointerLeave:F,onMouseLeave:F},y=Ye();return!f&&c?null:y({ourProps:g,theirProps:i,slot:_,defaultTag:x5,name:"Listbox.Option"})}let S5=v.Fragment;function P5(e,t){let{options:n,placeholder:r,...o}=e,s={ref:it(t)},i=No("ListboxSelectedOption"),c=v.useMemo(()=>({}),[]),a=i.value===void 0||i.value===null||i.mode===Rt.Multi&&Array.isArray(i.value)&&i.value.length===0,l=Ye();return v.createElement(Dh.Provider,{value:!0},l({ourProps:s,theirProps:{...o,children:v.createElement(v.Fragment,null,r&&a?r:n)},slot:c,defaultTag:S5,name:"ListboxSelectedOption"}))}let $5=ze(m5),T5=ze(b5),A5=rE,N5=ze(v5),O5=ze(E5),C5=ze(P5),Xe=Object.assign($5,{Button:T5,Label:A5,Options:N5,Option:O5,SelectedOption:C5});const I5=()=>I.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",children:[I.jsx("g",{clipPath:"url(#clip0_active)",children:I.jsx("path",{d:"M4.63791 6.91929H2.62541C2.36266 6.91929 2.18141 6.65629 2.27491 6.41091L4.27466 1.16191C4.30172 1.0909 4.34971 1.02978 4.41228 0.986649C4.47485 0.943521 4.54905 0.920422 4.62504 0.92041H7.99954C8.26579 0.92041 8.44729 1.19016 8.34679 1.43679L7.18241 4.29479H9.37441C9.69679 4.29479 9.86879 4.67479 9.65616 4.91704L4.28191 11.0408C4.02066 11.3385 3.53629 11.0805 3.63766 10.6977L4.63791 6.91929Z",fill:"#22FD73"})}),I.jsx("defs",{children:I.jsx("clipPath",{id:"clip0_active",children:I.jsx("rect",{width:"12",height:"12",fill:"white",transform:"translate(0 0.0454102)"})})})]}),M5=()=>I.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",children:[I.jsx("g",{clipPath:"url(#clip0_inactive)",children:I.jsx("path",{d:"M4.63791 6.91929H2.62541C2.36266 6.91929 2.18141 6.65629 2.27491 6.41091L4.27466 1.16191C4.30172 1.0909 4.34971 1.02978 4.41228 0.986649C4.47485 0.943521 4.54905 0.920422 4.62504 0.92041H7.99954C8.26579 0.92041 8.44729 1.19016 8.34679 1.43679L7.18241 4.29479H9.37441C9.69679 4.29479 9.86879 4.67479 9.65616 4.91704L4.28191 11.0408C4.02066 11.3385 3.53629 11.0805 3.63766 10.6977L4.63791 6.91929Z",fill:"#F9F9F9"})}),I.jsx("defs",{children:I.jsx("clipPath",{id:"clip0_inactive",children:I.jsx("rect",{width:"12",height:"12",fill:"white",transform:"translate(0 0.0454102)"})})})]}),Oo=({selectedLevel:e,maxLevel:t,className:n=""})=>{const r=Array.from({length:t},(o,s)=>s+1);return I.jsx("div",{className:`flex items-center ${n}`,children:r.map(o=>I.jsx("div",{className:"flex items-center justify-center",children:o>t-e?I.jsx(I5,{}):I.jsx(M5,{})},o))})};class Tt{}Bo(Tt,"FAST",3),Bo(Tt,"Medium",2),Bo(Tt,"SLOW",1),Bo(Tt,"NONE",0);const k5=Object.values({MAINNET:1,SEPOLIA:11155111}),ln=e=>{const t=typeof e=="string"?parseInt(e,10):e;return k5.includes(t)},B5={USDT:!0},Fh=(e,t)=>{const n=typeof e=="string"?parseInt(e,10):e;return n===1||n===11155111?!1:(n===42161||n===421614)&&t?t.toUpperCase()==="ETH"?!1:!B5[t.toUpperCase()]:!0},L5=({chains:e,selectedChain:t,onChainChange:n,disabled:r=!1,className:o="",walletType:s="mpc"})=>{const{t:i}=ht();return I.jsx("div",{className:`relative ${o}`,children:I.jsx(Xe,{value:t,onChange:n,disabled:r,children:({open:c})=>I.jsxs(I.Fragment,{children:[I.jsxs(Xe.Button,{className:`
131
131
  relative w-full h-9 text-text-primary bg-fill-input-primary
132
132
  items-center justify-between flex px-3 rounded-lg
133
133
  focus:outline-none
134
134
  ${r?"opacity-50 cursor-not-allowed":"cursor-pointer hover:bg-fill-btn-secondary-hover"}
135
135
  ${c?"ring-1 ring-white":""}
136
- `,children:[I.jsx("span",{className:"text-sm leading-[18px] font-medium",children:i("deposit.chain")}),I.jsxs("div",{className:"flex items-center space-x-2",children:[t.chainIconUrl?I.jsx("img",{src:t.chainIconUrl,alt:t.chain,className:"w-4 h-4 rounded-full"}):I.jsx("div",{className:"w-4 h-4 rounded-full bg-blue-500 flex items-center justify-center",children:I.jsx("span",{className:"text-xs text-white font-bold",children:t.chain.charAt(0)})}),I.jsx("span",{className:"text-sm text-white ml-1",children:t.chain}),I.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:[I.jsx("g",{clipPath:"url(#clip0_12919_27745)",children:I.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"})}),I.jsx("defs",{children:I.jsx("clipPath",{id:"clip0_12919_27745",children:I.jsx("rect",{width:"10",height:"10",fill:"white",transform:"translate(0 0.955078)"})})})]})]})]}),I.jsx(Ic,{as:v.Fragment,enter:"transition ease-out duration-100",enterFrom:"transform opacity-0 scale-95",enterTo:"transform opacity-100 scale-100",leave:"transition ease-in duration-75",leaveFrom:"transform opacity-100 scale-100",leaveTo:"transform opacity-0 scale-95",children:I.jsx(Xe.Options,{className:`
136
+ `,children:[I.jsx("span",{className:"text-sm leading-[18px] font-medium",children:i("deposit.chain")}),I.jsxs("div",{className:"flex items-center space-x-2",children:[t.chainIconUrl?I.jsx("img",{src:t.chainIconUrl,alt:t.chain,className:"w-4 h-4 rounded-full"}):I.jsx("div",{className:"w-4 h-4 rounded-full bg-blue-500 flex items-center justify-center",children:I.jsx("span",{className:"text-xs text-white font-bold",children:t.chain.charAt(0)})}),I.jsx("span",{className:"text-sm text-white ml-1",children:t.chain}),I.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:[I.jsx("g",{clipPath:"url(#clip0_12919_27745)",children:I.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"})}),I.jsx("defs",{children:I.jsx("clipPath",{id:"clip0_12919_27745",children:I.jsx("rect",{width:"10",height:"10",fill:"white",transform:"translate(0 0.955078)"})})})]})]})]}),I.jsx(Mc,{as:v.Fragment,enter:"transition ease-out duration-100",enterFrom:"transform opacity-0 scale-95",enterTo:"transform opacity-100 scale-100",leave:"transition ease-in duration-75",leaveFrom:"transform opacity-100 scale-100",leaveTo:"transform opacity-0 scale-95",children:I.jsx(Xe.Options,{className:`
137
137
  absolute z-50 mt-1 w-full max-h-60 overflow-auto rounded-lg
138
138
  bg-fill-input-primary border border-line-divider-secondary shadow-lg
139
139
  focus:outline-none
@@ -143,21 +143,21 @@ ${xb(d)}`),super(t.shortMessage,{cause:t,docsPath:r,metaMessages:[...t.metaMessa
143
143
  focus:outline-none
144
144
  ${r?"opacity-50 cursor-not-allowed":"cursor-pointer hover:bg-fill-btn-secondary-hover"}
145
145
  ${u?"ring-1 ring-white":""}
146
- `,children:[I.jsx("span",{className:"text-sm leading-[18px] font-medium",children:i("deposit.asset")}),I.jsxs("div",{className:"flex items-center space-x-2",children:[I.jsx("img",{src:t.iconUrl,alt:c(t),className:"w-4 h-4 rounded-full"}),I.jsx("span",{className:"text-sm text-white ml-1",children:c(t)}),I.jsxs("svg",{className:`w-3 h-3 ml-2 transition-transform duration-200 ${u?"rotate-180":""}`,xmlns:"http://www.w3.org/2000/svg",width:"10",height:"11",viewBox:"0 0 10 11",fill:"none",children:[I.jsx("g",{clipPath:"url(#clip0_asset_selector)",children:I.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"})}),I.jsx("defs",{children:I.jsx("clipPath",{id:"clip0_asset_selector",children:I.jsx("rect",{width:"10",height:"10",fill:"white",transform:"translate(0 0.955078)"})})})]})]})]}),I.jsx(Ic,{as:v.Fragment,enter:"transition ease-out duration-100",enterFrom:"transform opacity-0 scale-95",enterTo:"transform opacity-100 scale-100",leave:"transition ease-in duration-75",leaveFrom:"transform opacity-100 scale-100",leaveTo:"transform opacity-0 scale-95",children:I.jsxs(Xe.Options,{className:`
146
+ `,children:[I.jsx("span",{className:"text-sm leading-[18px] font-medium",children:i("deposit.asset")}),I.jsxs("div",{className:"flex items-center space-x-2",children:[I.jsx("img",{src:t.iconUrl,alt:c(t),className:"w-4 h-4 rounded-full"}),I.jsx("span",{className:"text-sm text-white ml-1",children:c(t)}),I.jsxs("svg",{className:`w-3 h-3 ml-2 transition-transform duration-200 ${u?"rotate-180":""}`,xmlns:"http://www.w3.org/2000/svg",width:"10",height:"11",viewBox:"0 0 10 11",fill:"none",children:[I.jsx("g",{clipPath:"url(#clip0_asset_selector)",children:I.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"})}),I.jsx("defs",{children:I.jsx("clipPath",{id:"clip0_asset_selector",children:I.jsx("rect",{width:"10",height:"10",fill:"white",transform:"translate(0 0.955078)"})})})]})]})]}),I.jsx(Mc,{as:v.Fragment,enter:"transition ease-out duration-100",enterFrom:"transform opacity-0 scale-95",enterTo:"transform opacity-100 scale-100",leave:"transition ease-in duration-75",leaveFrom:"transform opacity-100 scale-100",leaveTo:"transform opacity-0 scale-95",children:I.jsxs(Xe.Options,{className:`
147
147
  absolute z-50 mt-1 w-full max-h-60 overflow-auto rounded-lg
148
148
  bg-fill-input-primary border border-line-divider-secondary shadow-lg
149
149
  focus:outline-none
150
- `,children:[e.map(f=>I.jsx(Xe.Option,{value:f,className:({active:p,selected:d})=>`relative cursor-pointer select-none py-3 px-3 ${d?"bg-fill-btn-secondary":p?"bg-fill-input-secondary":""}`,children:({selected:p,active:d})=>I.jsxs("div",{className:"flex items-center space-x-3",children:[I.jsx("img",{src:f.iconUrl,alt:c(f),className:"w-5 h-5 rounded-full"}),I.jsx("div",{className:"flex flex-col",children:I.jsx("span",{className:`text-sm font-medium ${p||d?"text-text-primary":"text-text-tertiary"}`,children:c(f)})})]})},c(f))),s&&I.jsx(Xe.Option,{value:l,disabled:!0,className:"relative select-none py-3 px-3 cursor-not-allowed",children:I.jsxs("div",{className:"flex flex-col",children:[I.jsxs("div",{className:"flex items-center space-x-3 opacity-60",children:[I.jsx("img",{src:l.iconUrl,alt:c(l),className:"w-5 h-5 rounded-full"}),I.jsx("div",{className:"flex flex-col",children:I.jsx("span",{className:"text-sm font-medium text-text-tertiary",children:c(l)})})]}),I.jsx("div",{className:"mt-2 text-xs text-text-tertiary",children:i("deposit.spotDepositNotSupportedTip")})]})},"USDC_DISABLED")]})})]})})})},Rh=({currentActiveChain:e,chainList:t,onChainChange:n,curSelectToken:r,onTokenChange:o,walletType:s=bn,txType:i="deposit",accountType:c})=>{const a=v.useCallback(A=>i==="withdraw"?s===bn?A.allowAaWithdraw!==!1:A.allowWithdraw!==!1:s===bn?A.allowAaDeposit!==!1:A.allowDeposit!==!1,[i,s]),l=v.useMemo(()=>{const A=new Set,w=[];for(const T of t)if(a(T))for(const B of T.tokenList||[]){const L=B.symbol||B.token;!L||!(i!=="withdraw"||B.withdrawEnable===!0&&B.pullOff===!1)||A.has(L)||(A.add(L),w.push({token:L,symbol:L,iconUrl:B.iconUrl,decimals:B.decimals,tokenAddress:B.tokenAddress}))}return w},[t,a,i]),u=A=>{n(A.chainId)},f=A=>{const w=A.symbol||A.token;o(w);const T=[];for(const B of t){if(!a(B))continue;(B.tokenList||[]).some(F=>(F.symbol||F.token)===w)&&T.push(B.chainId)}!T.includes(e.chainId)&&T[0]!==void 0&&n(T[0])},p=v.useMemo(()=>{var T,B;const A=r||((T=l[0])==null?void 0:T.symbol)||((B=l[0])==null?void 0:B.token);if(!A)return[];const w=[];for(const L of t){if(!a(L))continue;const F=(L.tokenList||[]).find(j=>(j.symbol||j.token)===A?i==="withdraw"?j.withdrawEnable===!0&&j.pullOff===!1:!0:!1);F&&w.push({...L,tokenList:[{token:F.token,symbol:F.symbol,iconUrl:F.iconUrl,decimals:F.decimals,tokenAddress:F.tokenAddress}]})}return w},[t,r,l,a,i]),d=v.useMemo(()=>p.find(A=>A.chainId===e.chainId)||p[0],[p,e.chainId]),h=v.useMemo(()=>l,[l]),m=v.useMemo(()=>{if(i!=="deposit"||s!==bn||c!=="spot")return!1;const A=Number(e.chainId);console.log("numericChainId:",A);const w=!Number.isNaN(A)&&(A===42161||A===421614);return console.log("isArbitrumChain:",w),w},[c,e.chainId,i,s]),x=v.useMemo(()=>{if(h.length!==0)return h.find(A=>A.token===r||A.symbol===r)||h[0]},[h,r]);return v.useEffect(()=>{if(h.length===0)return;if(!h.some(w=>(w.symbol||w.token)===r)){const w=h[0];o(w.symbol||w.token)}},[h,r,o]),v.useEffect(()=>{if(p.length===0)return;p.some(w=>w.chainId===e.chainId)||n(p[0].chainId)},[p,e.chainId,n]),I.jsxs("div",{className:"space-y-4",children:[h.length>0&&x&&I.jsx(D5,{tokens:h,selectedToken:x,onTokenChange:f,showSpotDepositNotSupportedTip:m}),I.jsx(L5,{chains:p,selectedChain:d,onChainChange:A=>{const w=t.find(T=>T.chainId===A.chainId);w&&u(w)},walletType:s,className:"w-full"})]})},F5=({options:e})=>I.jsx(I.Fragment,{children:e.map(t=>I.jsx(Xe.Option,{value:t.value,className:({active:n,selected:r})=>`relative cursor-pointer select-none py-3 px-3 ${r?"bg-fill-btn-secondary":n?"bg-fill-input-secondary":""}`,children:({selected:n,active:r})=>I.jsx("div",{className:"flex items-center justify-between",children:I.jsx("div",{className:"flex items-center space-x-3",children:I.jsx("div",{className:"flex flex-col",children:I.jsx("span",{className:`text-sm font-medium ${n||r?"text-text-primary":"text-text-tertiary"}`,children:t.label})})})})},t.value))}),jh=({selectedAccount:e,onAccountChange:t,disabled:n=!1,className:r=""})=>{var f;const{t:o}=ht(),s=v.useMemo(()=>[{value:"spot",label:o("account.spot")},{value:"perpetual",label:o("account.perpetual")}],[o]),i=((f=s.find(p=>p.value===(e??"spot")))==null?void 0:f.label)||"",[c,a]=v.useState(e??"spot"),l=e??c,u=p=>{t==null||t(p),e||a(p)};return I.jsx("div",{className:`relative mb-4 ${r}`,children:I.jsx(Xe,{value:l,onChange:u,disabled:n,children:({open:p})=>I.jsxs(I.Fragment,{children:[I.jsxs(Xe.Button,{className:`
150
+ `,children:[e.map(f=>I.jsx(Xe.Option,{value:f,className:({active:p,selected:d})=>`relative cursor-pointer select-none py-3 px-3 ${d?"bg-fill-btn-secondary":p?"bg-fill-input-secondary":""}`,children:({selected:p,active:d})=>I.jsxs("div",{className:"flex items-center space-x-3",children:[I.jsx("img",{src:f.iconUrl,alt:c(f),className:"w-5 h-5 rounded-full"}),I.jsx("div",{className:"flex flex-col",children:I.jsx("span",{className:`text-sm font-medium ${p||d?"text-text-primary":"text-text-tertiary"}`,children:c(f)})})]})},c(f))),s&&I.jsx(Xe.Option,{value:l,disabled:!0,className:"relative select-none py-3 px-3 cursor-not-allowed",children:I.jsxs("div",{className:"flex flex-col",children:[I.jsxs("div",{className:"flex items-center space-x-3 opacity-60",children:[I.jsx("img",{src:l.iconUrl,alt:c(l),className:"w-5 h-5 rounded-full"}),I.jsx("div",{className:"flex flex-col",children:I.jsx("span",{className:"text-sm font-medium text-text-tertiary",children:c(l)})})]}),I.jsx("div",{className:"mt-2 text-xs text-text-tertiary",children:i("deposit.spotDepositNotSupportedTip")})]})},"USDC_DISABLED")]})})]})})})},Rh=({currentActiveChain:e,chainList:t,onChainChange:n,curSelectToken:r,onTokenChange:o,walletType:s=bn,txType:i="deposit",accountType:c})=>{const a=v.useCallback(A=>i==="withdraw"?s===bn?A.allowAaWithdraw!==!1:A.allowWithdraw!==!1:s===bn?A.allowAaDeposit!==!1:A.allowDeposit!==!1,[i,s]),l=v.useMemo(()=>{const A=new Set,w=[];for(const T of t)if(a(T))for(const B of T.tokenList||[]){const L=B.symbol||B.token;!L||!(i!=="withdraw"||B.withdrawEnable===!0&&B.pullOff===!1)||A.has(L)||(A.add(L),w.push({token:L,symbol:L,iconUrl:B.iconUrl,decimals:B.decimals,tokenAddress:B.tokenAddress}))}return w},[t,a,i]),u=A=>{n(A.chainId)},f=A=>{const w=A.symbol||A.token;o(w);const T=[];for(const B of t){if(!a(B))continue;(B.tokenList||[]).some(F=>(F.symbol||F.token)===w)&&T.push(B.chainId)}!T.includes(e.chainId)&&T[0]!==void 0&&n(T[0])},p=v.useMemo(()=>{var T,B;const A=r||((T=l[0])==null?void 0:T.symbol)||((B=l[0])==null?void 0:B.token);if(!A)return[];const w=[];for(const L of t){if(!a(L))continue;const F=(L.tokenList||[]).find(_=>(_.symbol||_.token)===A?i==="withdraw"?_.withdrawEnable===!0&&_.pullOff===!1:!0:!1);F&&w.push({...L,tokenList:[{token:F.token,symbol:F.symbol,iconUrl:F.iconUrl,decimals:F.decimals,tokenAddress:F.tokenAddress}]})}return w},[t,r,l,a,i]),d=v.useMemo(()=>p.find(A=>A.chainId===e.chainId)||p[0],[p,e.chainId]),h=v.useMemo(()=>l,[l]),m=v.useMemo(()=>{if(i!=="deposit"||s!==bn||c!=="spot")return!1;const A=Number(e.chainId);console.log("numericChainId:",A);const w=!Number.isNaN(A)&&(A===42161||A===421614);return console.log("isArbitrumChain:",w),w},[c,e.chainId,i,s]),x=v.useMemo(()=>{if(h.length!==0)return h.find(A=>A.token===r||A.symbol===r)||h[0]},[h,r]);return v.useEffect(()=>{if(h.length===0)return;if(!h.some(w=>(w.symbol||w.token)===r)){const w=h[0];o(w.symbol||w.token)}},[h,r,o]),v.useEffect(()=>{if(p.length===0)return;p.some(w=>w.chainId===e.chainId)||n(p[0].chainId)},[p,e.chainId,n]),I.jsxs("div",{className:"space-y-4",children:[h.length>0&&x&&I.jsx(D5,{tokens:h,selectedToken:x,onTokenChange:f,showSpotDepositNotSupportedTip:m}),I.jsx(L5,{chains:p,selectedChain:d,onChainChange:A=>{const w=t.find(T=>T.chainId===A.chainId);w&&u(w)},walletType:s,className:"w-full"})]})},F5=({options:e})=>I.jsx(I.Fragment,{children:e.map(t=>I.jsx(Xe.Option,{value:t.value,className:({active:n,selected:r})=>`relative cursor-pointer select-none py-3 px-3 ${r?"bg-fill-btn-secondary":n?"bg-fill-input-secondary":""}`,children:({selected:n,active:r})=>I.jsx("div",{className:"flex items-center justify-between",children:I.jsx("div",{className:"flex items-center space-x-3",children:I.jsx("div",{className:"flex flex-col",children:I.jsx("span",{className:`text-sm font-medium ${n||r?"text-text-primary":"text-text-tertiary"}`,children:t.label})})})})},t.value))}),jh=({selectedAccount:e,onAccountChange:t,disabled:n=!1,className:r=""})=>{var f;const{t:o}=ht(),s=v.useMemo(()=>[{value:"spot",label:o("account.spot")},{value:"perpetual",label:o("account.perpetual")}],[o]),i=((f=s.find(p=>p.value===(e??"spot")))==null?void 0:f.label)||"",[c,a]=v.useState(e??"spot"),l=e??c,u=p=>{t==null||t(p),e||a(p)};return I.jsx("div",{className:`relative mb-4 ${r}`,children:I.jsx(Xe,{value:l,onChange:u,disabled:n,children:({open:p})=>I.jsxs(I.Fragment,{children:[I.jsxs(Xe.Button,{className:`
151
151
  relative w-full h-9 text-text-primary bg-fill-input-primary
152
152
  items-center justify-between flex px-3 rounded-lg
153
153
  focus:outline-none
154
154
  ${n?"opacity-50 cursor-not-allowed":"cursor-pointer hover:bg-fill-btn-secondary-hover"}
155
155
  ${p?"ring-1 ring-white":""}
156
- `,children:[I.jsx("span",{className:"text-sm leading-[18px] font-medium",children:o("account.title")}),I.jsxs("div",{className:"flex items-center space-x-2",children:[I.jsx("span",{className:"text-sm text-white ml-1",children:i}),I.jsxs("svg",{className:`w-3 h-3 ml-2 transition-transform duration-200 ${p?"rotate-180":""}`,xmlns:"http://www.w3.org/2000/svg",width:"10",height:"11",viewBox:"0 0 10 11",fill:"none",children:[I.jsx("g",{clipPath:"url(#clip0_asset_selector)",children:I.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"})}),I.jsx("defs",{children:I.jsx("clipPath",{id:"clip0_asset_selector",children:I.jsx("rect",{width:"10",height:"10",fill:"white",transform:"translate(0 0.955078)"})})})]})]})]}),I.jsx(Ic,{as:v.Fragment,enter:"transition ease-out duration-100",enterFrom:"transform opacity-0 scale-95",enterTo:"transform opacity-100 scale-100",leave:"transition ease-in duration-75",leaveFrom:"transform opacity-100 scale-100",leaveTo:"transform opacity-0 scale-95",children:I.jsx(Xe.Options,{className:`
156
+ `,children:[I.jsx("span",{className:"text-sm leading-[18px] font-medium",children:o("account.title")}),I.jsxs("div",{className:"flex items-center space-x-2",children:[I.jsx("span",{className:"text-sm text-white ml-1",children:i}),I.jsxs("svg",{className:`w-3 h-3 ml-2 transition-transform duration-200 ${p?"rotate-180":""}`,xmlns:"http://www.w3.org/2000/svg",width:"10",height:"11",viewBox:"0 0 10 11",fill:"none",children:[I.jsx("g",{clipPath:"url(#clip0_asset_selector)",children:I.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"})}),I.jsx("defs",{children:I.jsx("clipPath",{id:"clip0_asset_selector",children:I.jsx("rect",{width:"10",height:"10",fill:"white",transform:"translate(0 0.955078)"})})})]})]})]}),I.jsx(Mc,{as:v.Fragment,enter:"transition ease-out duration-100",enterFrom:"transform opacity-0 scale-95",enterTo:"transform opacity-100 scale-100",leave:"transition ease-in duration-75",leaveFrom:"transform opacity-100 scale-100",leaveTo:"transform opacity-0 scale-95",children:I.jsx(Xe.Options,{className:`
157
157
  absolute z-50 mt-1 w-full max-h-60 overflow-auto rounded-lg
158
158
  bg-fill-input-primary border border-line-divider-secondary shadow-lg
159
159
  focus:outline-none
160
- `,children:I.jsx(F5,{options:s})})})]})})})};var Ws={},R5=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()}},j5=R5,_h={"text/plain":"Text","text/html":"Url",default:"Text"},_5="Copy to clipboard: #{key}, Enter";function U5(e){var t=(/mac os x/i.test(navigator.userAgent)?"⌘":"Ctrl")+"+C";return e.replace(/#{\s*key\s*}/g,t)}function z5(e,t){var n,r,o,s,i,c,a=!1;t||(t={}),n=t.debug||!1;try{o=j5(),s=document.createRange(),i=document.getSelection(),c=document.createElement("span"),c.textContent=e,c.ariaHidden="true",c.style.all="unset",c.style.position="fixed",c.style.top=0,c.style.clip="rect(0, 0, 0, 0)",c.style.whiteSpace="pre",c.style.webkitUserSelect="text",c.style.MozUserSelect="text",c.style.msUserSelect="text",c.style.userSelect="text",c.addEventListener("copy",function(u){if(u.stopPropagation(),t.format)if(u.preventDefault(),typeof u.clipboardData>"u"){n&&console.warn("unable to use e.clipboardData"),n&&console.warn("trying IE specific stuff"),window.clipboardData.clearData();var f=_h[t.format]||_h.default;window.clipboardData.setData(f,e)}else u.clipboardData.clearData(),u.clipboardData.setData(t.format,e);t.onCopy&&(u.preventDefault(),t.onCopy(u.clipboardData))}),document.body.appendChild(c),s.selectNodeContents(c),i.addRange(s);var l=document.execCommand("copy");if(!l)throw new Error("copy command was unsuccessful");a=!0}catch(u){n&&console.error("unable to copy using execCommand: ",u),n&&console.warn("trying IE specific stuff");try{window.clipboardData.setData(t.format||"text",e),t.onCopy&&t.onCopy(window.clipboardData),a=!0}catch(f){n&&console.error("unable to copy using clipboardData: ",f),n&&console.error("falling back to prompt"),r=U5("message"in t?t.message:_5),window.prompt(r,e)}}finally{i&&(typeof i.removeRange=="function"?i.removeRange(s):i.removeAllRanges()),c&&document.body.removeChild(c),o()}return a}var H5=z5;function Bc(e){"@babel/helpers - typeof";return Bc=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},Bc(e)}Object.defineProperty(Ws,"__esModule",{value:!0}),Ws.CopyToClipboard=void 0;var Vs=Uh(v),W5=Uh(H5),V5=["text","onCopy","options","children"];function Uh(e){return e&&e.__esModule?e:{default:e}}function zh(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 Hh(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?zh(Object(n),!0).forEach(function(r){Dc(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):zh(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function G5(e,t){if(e==null)return{};var n=q5(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 q5(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 Z5(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function K5(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 Y5(e,t,n){return t&&K5(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function X5(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&&Lc(e,t)}function Lc(e,t){return Lc=Object.setPrototypeOf||function(r,o){return r.__proto__=o,r},Lc(e,t)}function Q5(e){var t=eS();return function(){var r=Gs(e),o;if(t){var s=Gs(this).constructor;o=Reflect.construct(r,arguments,s)}else o=r.apply(this,arguments);return J5(this,o)}}function J5(e,t){if(t&&(Bc(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Wh(e)}function Wh(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function eS(){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 Gs(e){return Gs=Object.setPrototypeOf?Object.getPrototypeOf:function(n){return n.__proto__||Object.getPrototypeOf(n)},Gs(e)}function Dc(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Vh=function(e){X5(n,e);var t=Q5(n);function n(){var r;Z5(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)),Dc(Wh(r),"onClick",function(c){var a=r.props,l=a.text,u=a.onCopy,f=a.children,p=a.options,d=Vs.default.Children.only(f),h=(0,W5.default)(l,p);u&&u(l,h),d&&d.props&&typeof d.props.onClick=="function"&&d.props.onClick(c)}),r}return Y5(n,[{key:"render",value:function(){var o=this.props;o.text,o.onCopy,o.options;var s=o.children,i=G5(o,V5),c=Vs.default.Children.only(s);return Vs.default.cloneElement(c,Hh(Hh({},i),{},{onClick:this.onClick}))}}]),n}(Vs.default.PureComponent);Ws.CopyToClipboard=Vh,Dc(Vh,"defaultProps",{onCopy:void 0,options:void 0});var tS=Ws,Fc=tS.CopyToClipboard;Fc.CopyToClipboard=Fc;var nS=Fc;const rS=X0(nS);var oS=Object.defineProperty,qs=Object.getOwnPropertySymbols,Gh=Object.prototype.hasOwnProperty,qh=Object.prototype.propertyIsEnumerable,Zh=(e,t,n)=>t in e?oS(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Rc=(e,t)=>{for(var n in t||(t={}))Gh.call(t,n)&&Zh(e,n,t[n]);if(qs)for(var n of qs(t))qh.call(t,n)&&Zh(e,n,t[n]);return e},jc=(e,t)=>{var n={};for(var r in e)Gh.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&qs)for(var r of qs(e))t.indexOf(r)<0&&qh.call(e,r)&&(n[r]=e[r]);return n};/**
160
+ `,children:I.jsx(F5,{options:s})})})]})})})};var Ws={},R5=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()}},j5=R5,_h={"text/plain":"Text","text/html":"Url",default:"Text"},_5="Copy to clipboard: #{key}, Enter";function U5(e){var t=(/mac os x/i.test(navigator.userAgent)?"⌘":"Ctrl")+"+C";return e.replace(/#{\s*key\s*}/g,t)}function z5(e,t){var n,r,o,s,i,c,a=!1;t||(t={}),n=t.debug||!1;try{o=j5(),s=document.createRange(),i=document.getSelection(),c=document.createElement("span"),c.textContent=e,c.ariaHidden="true",c.style.all="unset",c.style.position="fixed",c.style.top=0,c.style.clip="rect(0, 0, 0, 0)",c.style.whiteSpace="pre",c.style.webkitUserSelect="text",c.style.MozUserSelect="text",c.style.msUserSelect="text",c.style.userSelect="text",c.addEventListener("copy",function(u){if(u.stopPropagation(),t.format)if(u.preventDefault(),typeof u.clipboardData>"u"){n&&console.warn("unable to use e.clipboardData"),n&&console.warn("trying IE specific stuff"),window.clipboardData.clearData();var f=_h[t.format]||_h.default;window.clipboardData.setData(f,e)}else u.clipboardData.clearData(),u.clipboardData.setData(t.format,e);t.onCopy&&(u.preventDefault(),t.onCopy(u.clipboardData))}),document.body.appendChild(c),s.selectNodeContents(c),i.addRange(s);var l=document.execCommand("copy");if(!l)throw new Error("copy command was unsuccessful");a=!0}catch(u){n&&console.error("unable to copy using execCommand: ",u),n&&console.warn("trying IE specific stuff");try{window.clipboardData.setData(t.format||"text",e),t.onCopy&&t.onCopy(window.clipboardData),a=!0}catch(f){n&&console.error("unable to copy using clipboardData: ",f),n&&console.error("falling back to prompt"),r=U5("message"in t?t.message:_5),window.prompt(r,e)}}finally{i&&(typeof i.removeRange=="function"?i.removeRange(s):i.removeAllRanges()),c&&document.body.removeChild(c),o()}return a}var H5=z5;function Lc(e){"@babel/helpers - typeof";return Lc=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},Lc(e)}Object.defineProperty(Ws,"__esModule",{value:!0}),Ws.CopyToClipboard=void 0;var Vs=Uh(v),W5=Uh(H5),V5=["text","onCopy","options","children"];function Uh(e){return e&&e.__esModule?e:{default:e}}function zh(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 Hh(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?zh(Object(n),!0).forEach(function(r){Fc(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):zh(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function G5(e,t){if(e==null)return{};var n=q5(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 q5(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 Z5(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function K5(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 Y5(e,t,n){return t&&K5(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function X5(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&&Dc(e,t)}function Dc(e,t){return Dc=Object.setPrototypeOf||function(r,o){return r.__proto__=o,r},Dc(e,t)}function Q5(e){var t=eS();return function(){var r=Gs(e),o;if(t){var s=Gs(this).constructor;o=Reflect.construct(r,arguments,s)}else o=r.apply(this,arguments);return J5(this,o)}}function J5(e,t){if(t&&(Lc(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Wh(e)}function Wh(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function eS(){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 Gs(e){return Gs=Object.setPrototypeOf?Object.getPrototypeOf:function(n){return n.__proto__||Object.getPrototypeOf(n)},Gs(e)}function Fc(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Vh=function(e){X5(n,e);var t=Q5(n);function n(){var r;Z5(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)),Fc(Wh(r),"onClick",function(c){var a=r.props,l=a.text,u=a.onCopy,f=a.children,p=a.options,d=Vs.default.Children.only(f),h=(0,W5.default)(l,p);u&&u(l,h),d&&d.props&&typeof d.props.onClick=="function"&&d.props.onClick(c)}),r}return Y5(n,[{key:"render",value:function(){var o=this.props;o.text,o.onCopy,o.options;var s=o.children,i=G5(o,V5),c=Vs.default.Children.only(s);return Vs.default.cloneElement(c,Hh(Hh({},i),{},{onClick:this.onClick}))}}]),n}(Vs.default.PureComponent);Ws.CopyToClipboard=Vh,Fc(Vh,"defaultProps",{onCopy:void 0,options:void 0});var tS=Ws,Rc=tS.CopyToClipboard;Rc.CopyToClipboard=Rc;var nS=Rc;const rS=X0(nS);var oS=Object.defineProperty,qs=Object.getOwnPropertySymbols,Gh=Object.prototype.hasOwnProperty,qh=Object.prototype.propertyIsEnumerable,Zh=(e,t,n)=>t in e?oS(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,jc=(e,t)=>{for(var n in t||(t={}))Gh.call(t,n)&&Zh(e,n,t[n]);if(qs)for(var n of qs(t))qh.call(t,n)&&Zh(e,n,t[n]);return e},_c=(e,t)=>{var n={};for(var r in e)Gh.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&qs)for(var r of qs(e))t.indexOf(r)<0&&qh.call(e,r)&&(n[r]=e[r]);return n};/**
161
161
  * @license QR Code generator library (TypeScript)
162
162
  * Copyright (c) Project Nayuki.
163
163
  * SPDX-License-Identifier: MIT
@@ -165,7 +165,7 @@ ${xb(d)}`),super(t.shortMessage,{cause:t,docsPath:r,metaMessages:[...t.metaMessa
165
165
  * @license qrcode.react
166
166
  * Copyright (c) Paul O'Shannessy
167
167
  * SPDX-License-Identifier: ISC
168
- */var sS={L:Pr.QrCode.Ecc.LOW,M:Pr.QrCode.Ecc.MEDIUM,Q:Pr.QrCode.Ecc.QUARTILE,H:Pr.QrCode.Ecc.HIGH},Kh=128,Yh="L",Xh="#FFFFFF",Qh="#000000",Jh=!1,e0=1,iS=4,aS=0,cS=.1;function t0(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 n0(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 lS(e,t,n,r){if(r==null)return null;const o=e.length+n*2,s=Math.floor(t*cS),i=o/t,c=(r.width||s)*i,a=(r.height||s)*i,l=r.x==null?e.length/2-c/2:r.x*i,u=r.y==null?e.length/2-a/2:r.y*i,f=r.opacity==null?1:r.opacity;let p=null;if(r.excavate){let h=Math.floor(l),m=Math.floor(u),x=Math.ceil(c+l-h),A=Math.ceil(a+u-m);p={x:h,y:m,w:x,h:A}}const d=r.crossOrigin;return{x:l,y:u,h:a,w:c,excavation:p,opacity:f,crossOrigin:d}}function uS(e,t){return t!=null?Math.max(Math.floor(t),0):e?iS:aS}function r0({value:e,level:t,minVersion:n,includeMargin:r,marginSize:o,imageSettings:s,size:i,boostLevel:c}){let a=v.useMemo(()=>{const h=(Array.isArray(e)?e:[e]).reduce((m,x)=>(m.push(...Pr.QrSegment.makeSegments(x)),m),[]);return Pr.QrCode.encodeSegments(h,sS[t],n,void 0,void 0,c)},[e,t,n,c]);const{cells:l,margin:u,numCells:f,calculatedImageSettings:p}=v.useMemo(()=>{let d=a.getModules();const h=uS(r,o),m=d.length+h*2,x=lS(d,i,h,s);return{cells:d,margin:h,numCells:m,calculatedImageSettings:x}},[a,i,s,r,o]);return{qrcode:a,margin:u,cells:l,numCells:f,calculatedImageSettings:p}}var fS=function(){try{new Path2D().addPath(new Path2D)}catch{return!1}return!0}(),dS=v.forwardRef(function(t,n){const r=t,{value:o,size:s=Kh,level:i=Yh,bgColor:c=Xh,fgColor:a=Qh,includeMargin:l=Jh,minVersion:u=e0,boostLevel:f,marginSize:p,imageSettings:d}=r,m=jc(r,["value","size","level","bgColor","fgColor","includeMargin","minVersion","boostLevel","marginSize","imageSettings"]),{style:x}=m,A=jc(m,["style"]),w=d==null?void 0:d.src,T=v.useRef(null),B=v.useRef(null),L=v.useCallback(S=>{T.current=S,typeof n=="function"?n(S):n&&(n.current=S)},[n]),[F,j]=v.useState(!1),{margin:g,cells:y,numCells:P,calculatedImageSettings:k}=r0({value:o,level:i,minVersion:u,boostLevel:f,includeMargin:l,marginSize:p,imageSettings:d,size:s});v.useEffect(()=>{if(T.current!=null){const S=T.current,E=S.getContext("2d");if(!E)return;let O=y;const N=B.current,b=k!=null&&N!==null&&N.complete&&N.naturalHeight!==0&&N.naturalWidth!==0;b&&k.excavation!=null&&(O=n0(y,k.excavation));const M=window.devicePixelRatio||1;S.height=S.width=s*M;const R=s/P*M;E.scale(R,R),E.fillStyle=c,E.fillRect(0,0,P,P),E.fillStyle=a,fS?E.fill(new Path2D(t0(O,g))):y.forEach(function(_,U){_.forEach(function(W,K){W&&E.fillRect(K+g,U+g,1,1)})}),k&&(E.globalAlpha=k.opacity),b&&E.drawImage(N,k.x+g,k.y+g,k.w,k.h)}}),v.useEffect(()=>{j(!1)},[w]);const C=Rc({height:s,width:s},x);let $=null;return w!=null&&($=v.createElement("img",{src:w,key:w,style:{display:"none"},onLoad:()=>{j(!0)},ref:B,crossOrigin:k==null?void 0:k.crossOrigin})),v.createElement(v.Fragment,null,v.createElement("canvas",Rc({style:C,height:s,width:s,ref:L,role:"img"},A)),$)});dS.displayName="QRCodeCanvas";var o0=v.forwardRef(function(t,n){const r=t,{value:o,size:s=Kh,level:i=Yh,bgColor:c=Xh,fgColor:a=Qh,includeMargin:l=Jh,minVersion:u=e0,boostLevel:f,title:p,marginSize:d,imageSettings:h}=r,m=jc(r,["value","size","level","bgColor","fgColor","includeMargin","minVersion","boostLevel","title","marginSize","imageSettings"]),{margin:x,cells:A,numCells:w,calculatedImageSettings:T}=r0({value:o,level:i,minVersion:u,boostLevel:f,includeMargin:l,marginSize:d,imageSettings:h,size:s});let B=A,L=null;h!=null&&T!=null&&(T.excavation!=null&&(B=n0(A,T.excavation)),L=v.createElement("image",{href:h.src,height:T.h,width:T.w,x:T.x+x,y:T.y+x,preserveAspectRatio:"none",opacity:T.opacity,crossOrigin:T.crossOrigin}));const F=t0(B,x);return v.createElement("svg",Rc({height:s,width:s,viewBox:`0 0 ${w} ${w}`,ref:n,role:"img"},m),!!p&&v.createElement("title",null,p),v.createElement("path",{fill:c,d:`M0,0 h${w}v${w}H0z`,shapeRendering:"crispEdges"}),v.createElement("path",{fill:a,d:F,shapeRendering:"crispEdges"}),L)});o0.displayName="QRCodeSVG";function pS(){const e=navigator.userAgentData;return e!=null&&e.platform?e.platform:navigator.platform}function hS(){const e=navigator.userAgentData;return e&&Array.isArray(e.brands)?e.brands.map(t=>{let{brand:n,version:r}=t;return n+"/"+r}).join(" "):navigator.userAgent}function s0(){return/apple/i.test(navigator.vendor)}function mS(){return pS().toLowerCase().startsWith("mac")&&!navigator.maxTouchPoints}function gS(){return hS().includes("jsdom/")}const i0="data-floating-ui-focusable",bS="input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])";function _c(e){let t=e.activeElement;for(;((n=t)==null||(n=n.shadowRoot)==null?void 0:n.activeElement)!=null;){var n;t=t.shadowRoot.activeElement}return t}function $r(e,t){if(!e||!t)return!1;const n=t.getRootNode==null?void 0:t.getRootNode();if(e.contains(t))return!0;if(n&&uc(n)){let r=t;for(;r;){if(e===r)return!0;r=r.parentNode||r.host}}return!1}function Tr(e){return"composedPath"in e?e.composedPath()[0]:e.target}function Uc(e,t){if(t==null)return!1;if("composedPath"in e)return e.composedPath().includes(t);const n=e;return n.target!=null&&t.contains(n.target)}function yS(e){return e.matches("html,body")}function jt(e){return(e==null?void 0:e.ownerDocument)||document}function a0(e){return De(e)&&e.matches(bS)}function wS(e){if(!e||gS())return!0;try{return e.matches(":focus-visible")}catch{return!0}}function vS(e){return e?e.hasAttribute(i0)?e:e.querySelector("["+i0+"]")||e:null}function Zs(e,t,n){return n===void 0&&(n=!0),e.filter(o=>{var s;return o.parentId===t&&(!n||((s=o.context)==null?void 0:s.open))}).flatMap(o=>[o,...Zs(e,o.id,n)])}function xS(e){return"nativeEvent"in e}function Co(e,t){const n=["mouse","pen"];return t||n.push("",void 0),n.includes(e)}var ES=typeof document<"u",SS=function(){},_t=ES?v.useLayoutEffect:SS;const PS={...z};function Ks(e){const t=z.useRef(e);return _t(()=>{t.current=e}),t}const $S=PS.useInsertionEffect||(e=>e());function Ut(e){const t=z.useRef(()=>{if(process.env.NODE_ENV!=="production")throw new Error("Cannot call an event handler while rendering.")});return $S(()=>{t.current=e}),z.useCallback(function(){for(var n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return t.current==null?void 0:t.current(...r)},[])}const c0=()=>({getShadowRoot:!0,displayCheck:typeof ResizeObserver=="function"&&ResizeObserver.toString().includes("[native code]")?"full":"none"});function l0(e,t){const n=Vp(e,c0()),r=n.length;if(r===0)return;const o=_c(jt(e)),s=n.indexOf(o),i=s===-1?t===1?0:r-1:s+t;return n[i]}function TS(e){return l0(jt(e).body,1)||e}function AS(e){return l0(jt(e).body,-1)||e}function zc(e,t){const n=t||e.currentTarget,r=e.relatedTarget;return!r||!$r(n,r)}function NS(e){Vp(e,c0()).forEach(n=>{n.dataset.tabindex=n.getAttribute("tabindex")||"",n.setAttribute("tabindex","-1")})}function u0(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 OS="data-floating-ui-focusable",f0="active",d0="selected",CS={...z};let p0=!1,IS=0;const h0=()=>"floating-ui-"+Math.random().toString(36).slice(2,6)+IS++;function MS(){const[e,t]=z.useState(()=>p0?h0():void 0);return _t(()=>{e==null&&t(h0())},[]),z.useEffect(()=>{p0=!0},[]),e}const Hc=CS.useId||MS;let Wc;process.env.NODE_ENV!=="production"&&(Wc=new Set);function kS(){for(var e,t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];const o="Floating UI: "+n.join(" ");if(!((e=Wc)!=null&&e.has(o))){var s;(s=Wc)==null||s.add(o),console.error(o)}}function BS(){const e=new Map;return{emit(t,n){var r;(r=e.get(t))==null||r.forEach(o=>o(n))},on(t,n){e.has(t)||e.set(t,new Set),e.get(t).add(n)},off(t,n){var r;(r=e.get(t))==null||r.delete(n)}}}const LS=z.createContext(null),DS=z.createContext(null),Vc=()=>{var e;return((e=z.useContext(LS))==null?void 0:e.id)||null},Gc=()=>z.useContext(DS);function Io(e){return"data-floating-ui-"+e}function ut(e){e.current!==-1&&(clearTimeout(e.current),e.current=-1)}const m0=Io("safe-polygon");function qc(e,t,n){if(n&&!Co(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 Zc(e){return typeof e=="function"?e():e}function FS(e,t){t===void 0&&(t={});const{open:n,onOpenChange:r,dataRef:o,events:s,elements:i}=e,{enabled:c=!0,delay:a=0,handleClose:l=null,mouseOnly:u=!1,restMs:f=0,move:p=!0}=t,d=Gc(),h=Vc(),m=Ks(l),x=Ks(a),A=Ks(n),w=Ks(f),T=z.useRef(),B=z.useRef(-1),L=z.useRef(),F=z.useRef(-1),j=z.useRef(!0),g=z.useRef(!1),y=z.useRef(()=>{}),P=z.useRef(!1),k=Ut(()=>{var N;const b=(N=o.current.openEvent)==null?void 0:N.type;return(b==null?void 0:b.includes("mouse"))&&b!=="mousedown"});z.useEffect(()=>{if(!c)return;function N(b){let{open:M}=b;M||(ut(B),ut(F),j.current=!0,P.current=!1)}return s.on("openchange",N),()=>{s.off("openchange",N)}},[c,s]),z.useEffect(()=>{if(!c||!m.current||!n)return;function N(M){k()&&r(!1,M,"hover")}const b=jt(i.floating).documentElement;return b.addEventListener("mouseleave",N),()=>{b.removeEventListener("mouseleave",N)}},[i.floating,n,r,c,m,k]);const C=z.useCallback(function(N,b,M){b===void 0&&(b=!0),M===void 0&&(M="hover");const R=qc(x.current,"close",T.current);R&&!L.current?(ut(B),B.current=window.setTimeout(()=>r(!1,N,M),R)):b&&(ut(B),r(!1,N,M))},[x,r]),$=Ut(()=>{y.current(),L.current=void 0}),S=Ut(()=>{if(g.current){const N=jt(i.floating).body;N.style.pointerEvents="",N.removeAttribute(m0),g.current=!1}}),E=Ut(()=>o.current.openEvent?["click","mousedown"].includes(o.current.openEvent.type):!1);z.useEffect(()=>{if(!c)return;function N(U){if(ut(B),j.current=!1,u&&!Co(T.current)||Zc(w.current)>0&&!qc(x.current,"open"))return;const W=qc(x.current,"open",T.current);W?B.current=window.setTimeout(()=>{A.current||r(!0,U,"hover")},W):n||r(!0,U,"hover")}function b(U){if(E()){S();return}y.current();const W=jt(i.floating);if(ut(F),P.current=!1,m.current&&o.current.floatingContext){n||ut(B),L.current=m.current({...o.current.floatingContext,tree:d,x:U.clientX,y:U.clientY,onClose(){S(),$(),E()||C(U,!0,"safe-polygon")}});const V=L.current;W.addEventListener("mousemove",V),y.current=()=>{W.removeEventListener("mousemove",V)};return}(T.current==="touch"?!$r(i.floating,U.relatedTarget):!0)&&C(U)}function M(U){E()||o.current.floatingContext&&(m.current==null||m.current({...o.current.floatingContext,tree:d,x:U.clientX,y:U.clientY,onClose(){S(),$(),E()||C(U)}})(U))}function R(){ut(B)}function _(U){E()||C(U,!1)}if(fe(i.domReference)){const U=i.domReference,W=i.floating;return n&&U.addEventListener("mouseleave",M),p&&U.addEventListener("mousemove",N,{once:!0}),U.addEventListener("mouseenter",N),U.addEventListener("mouseleave",b),W&&(W.addEventListener("mouseleave",M),W.addEventListener("mouseenter",R),W.addEventListener("mouseleave",_)),()=>{n&&U.removeEventListener("mouseleave",M),p&&U.removeEventListener("mousemove",N),U.removeEventListener("mouseenter",N),U.removeEventListener("mouseleave",b),W&&(W.removeEventListener("mouseleave",M),W.removeEventListener("mouseenter",R),W.removeEventListener("mouseleave",_))}}},[i,c,e,u,p,C,$,S,r,n,A,d,x,m,o,E,w]),_t(()=>{var N;if(c&&n&&(N=m.current)!=null&&(N=N.__options)!=null&&N.blockPointerEvents&&k()){g.current=!0;const M=i.floating;if(fe(i.domReference)&&M){var b;const R=jt(i.floating).body;R.setAttribute(m0,"");const _=i.domReference,U=d==null||(b=d.nodesRef.current.find(W=>W.id===h))==null||(b=b.context)==null?void 0:b.elements.floating;return U&&(U.style.pointerEvents=""),R.style.pointerEvents="none",_.style.pointerEvents="auto",M.style.pointerEvents="auto",()=>{R.style.pointerEvents="",_.style.pointerEvents="",M.style.pointerEvents=""}}}},[c,n,h,i,d,m,k]),_t(()=>{n||(T.current=void 0,P.current=!1,$(),S())},[n,$,S]),z.useEffect(()=>()=>{$(),ut(B),ut(F),S()},[c,i.domReference,$,S]);const O=z.useMemo(()=>{function N(b){T.current=b.pointerType}return{onPointerDown:N,onPointerEnter:N,onMouseMove(b){const{nativeEvent:M}=b;function R(){!j.current&&!A.current&&r(!0,M,"hover")}u&&!Co(T.current)||n||Zc(w.current)===0||P.current&&b.movementX**2+b.movementY**2<2||(ut(F),T.current==="touch"?R():(P.current=!0,F.current=window.setTimeout(R,Zc(w.current))))}}},[u,r,n,A,w]);return z.useMemo(()=>c?{reference:O}:{},[c,O])}const g0={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},b0=z.forwardRef(function(t,n){const[r,o]=z.useState();_t(()=>{s0()&&o("button")},[]);const s={ref:n,tabIndex:0,role:r,"aria-hidden":r?void 0:!0,[Io("focus-guard")]:"",style:g0};return I.jsx("span",{...t,...s})}),y0=z.createContext(null),w0=Io("portal");function RS(e){e===void 0&&(e={});const{id:t,root:n}=e,r=Hc(),o=_S(),[s,i]=z.useState(null),c=z.useRef(null);return _t(()=>()=>{s==null||s.remove(),queueMicrotask(()=>{c.current=null})},[s]),_t(()=>{if(!r||c.current)return;const a=t?document.getElementById(t):null;if(!a)return;const l=document.createElement("div");l.id=r,l.setAttribute(w0,""),a.appendChild(l),c.current=l,i(l)},[t,r]),_t(()=>{if(n===null||!r||c.current)return;let a=n||(o==null?void 0:o.portalNode);a&&!lc(a)&&(a=a.current),a=a||document.body;let l=null;t&&(l=document.createElement("div"),l.id=t,a.appendChild(l));const u=document.createElement("div");u.id=r,u.setAttribute(w0,""),a=l||a,a.appendChild(u),c.current=u,i(u)},[t,n,r,o]),s}function jS(e){const{children:t,id:n,root:r,preserveTabOrder:o=!0}=e,s=RS({id:n,root:r}),[i,c]=z.useState(null),a=z.useRef(null),l=z.useRef(null),u=z.useRef(null),f=z.useRef(null),p=i==null?void 0:i.modal,d=i==null?void 0:i.open,h=!!i&&!i.modal&&i.open&&o&&!!(r||s);return z.useEffect(()=>{if(!s||!o||p)return;function m(x){s&&zc(x)&&(x.type==="focusin"?u0:NS)(s)}return s.addEventListener("focusin",m,!0),s.addEventListener("focusout",m,!0),()=>{s.removeEventListener("focusin",m,!0),s.removeEventListener("focusout",m,!0)}},[s,o,p]),z.useEffect(()=>{s&&(d||u0(s))},[d,s]),I.jsxs(y0.Provider,{value:z.useMemo(()=>({preserveTabOrder:o,beforeOutsideRef:a,afterOutsideRef:l,beforeInsideRef:u,afterInsideRef:f,portalNode:s,setFocusManagerState:c}),[o,s]),children:[h&&s&&I.jsx(b0,{"data-type":"outside",ref:a,onFocus:m=>{if(zc(m,s)){var x;(x=u.current)==null||x.focus()}else{const A=i?i.domReference:null,w=AS(A);w==null||w.focus()}}}),h&&s&&I.jsx("span",{"aria-owns":s.id,style:g0}),s&&Or.createPortal(t,s),h&&s&&I.jsx(b0,{"data-type":"outside",ref:l,onFocus:m=>{if(zc(m,s)){var x;(x=f.current)==null||x.focus()}else{const A=i?i.domReference:null,w=TS(A);w==null||w.focus(),i!=null&&i.closeOnFocusOut&&(i==null||i.onOpenChange(!1,m.nativeEvent,"focus-out"))}}})]})}const _S=()=>z.useContext(y0);function v0(e){return De(e.target)&&e.target.tagName==="BUTTON"}function US(e){return De(e.target)&&e.target.tagName==="A"}function x0(e){return a0(e)}function zS(e,t){t===void 0&&(t={});const{open:n,onOpenChange:r,dataRef:o,elements:{domReference:s}}=e,{enabled:i=!0,event:c="click",toggle:a=!0,ignoreMouse:l=!1,keyboardHandlers:u=!0,stickIfOpen:f=!0}=t,p=z.useRef(),d=z.useRef(!1),h=z.useMemo(()=>({onPointerDown(m){p.current=m.pointerType},onMouseDown(m){const x=p.current;m.button===0&&c!=="click"&&(Co(x,!0)&&l||(n&&a&&(!(o.current.openEvent&&f)||o.current.openEvent.type==="mousedown")?r(!1,m.nativeEvent,"click"):(m.preventDefault(),r(!0,m.nativeEvent,"click"))))},onClick(m){const x=p.current;if(c==="mousedown"&&p.current){p.current=void 0;return}Co(x,!0)&&l||(n&&a&&(!(o.current.openEvent&&f)||o.current.openEvent.type==="click")?r(!1,m.nativeEvent,"click"):r(!0,m.nativeEvent,"click"))},onKeyDown(m){p.current=void 0,!(m.defaultPrevented||!u||v0(m))&&(m.key===" "&&!x0(s)&&(m.preventDefault(),d.current=!0),!US(m)&&m.key==="Enter"&&r(!(n&&a),m.nativeEvent,"click"))},onKeyUp(m){m.defaultPrevented||!u||v0(m)||x0(s)||m.key===" "&&d.current&&(d.current=!1,r(!(n&&a),m.nativeEvent,"click"))}}),[o,s,c,l,u,r,n,f,a]);return z.useMemo(()=>i?{reference:h}:{},[i,h])}const HS={pointerdown:"onPointerDown",mousedown:"onMouseDown",click:"onClick"},WS={pointerdown:"onPointerDownCapture",mousedown:"onMouseDownCapture",click:"onClickCapture"},E0=e=>{var t,n;return{escapeKey:typeof e=="boolean"?e:(t=e==null?void 0:e.escapeKey)!=null?t:!1,outsidePress:typeof e=="boolean"?e:(n=e==null?void 0:e.outsidePress)!=null?n:!0}};function VS(e,t){t===void 0&&(t={});const{open:n,onOpenChange:r,elements:o,dataRef:s}=e,{enabled:i=!0,escapeKey:c=!0,outsidePress:a=!0,outsidePressEvent:l="pointerdown",referencePress:u=!1,referencePressEvent:f="pointerdown",ancestorScroll:p=!1,bubbles:d,capture:h}=t,m=Gc(),x=Ut(typeof a=="function"?a:()=>!1),A=typeof a=="function"?x:a,w=z.useRef(!1),{escapeKey:T,outsidePress:B}=E0(d),{escapeKey:L,outsidePress:F}=E0(h),j=z.useRef(!1),g=Ut(S=>{var E;if(!n||!i||!c||S.key!=="Escape"||j.current)return;const O=(E=s.current.floatingContext)==null?void 0:E.nodeId,N=m?Zs(m.nodesRef.current,O):[];if(!T&&(S.stopPropagation(),N.length>0)){let b=!0;if(N.forEach(M=>{var R;if((R=M.context)!=null&&R.open&&!M.context.dataRef.current.__escapeKeyBubbles){b=!1;return}}),!b)return}r(!1,xS(S)?S.nativeEvent:S,"escape-key")}),y=Ut(S=>{var E;const O=()=>{var N;g(S),(N=Tr(S))==null||N.removeEventListener("keydown",O)};(E=Tr(S))==null||E.addEventListener("keydown",O)}),P=Ut(S=>{var E;const O=s.current.insideReactTree;s.current.insideReactTree=!1;const N=w.current;if(w.current=!1,l==="click"&&N||O||typeof A=="function"&&!A(S))return;const b=Tr(S),M="["+Io("inert")+"]",R=jt(o.floating).querySelectorAll(M);let _=fe(b)?b:null;for(;_&&!on(_);){const V=sn(_);if(on(V)||!fe(V))break;_=V}if(R.length&&fe(b)&&!yS(b)&&!$r(b,o.floating)&&Array.from(R).every(V=>!$r(_,V)))return;if(De(b)&&$){const V=on(b),Z=lt(b),H=/auto|scroll/,Y=V||H.test(Z.overflowX),Q=V||H.test(Z.overflowY),se=Y&&b.clientWidth>0&&b.scrollWidth>b.clientWidth,me=Q&&b.clientHeight>0&&b.scrollHeight>b.clientHeight,pe=Z.direction==="rtl",le=me&&(pe?S.offsetX<=b.offsetWidth-b.clientWidth:S.offsetX>b.clientWidth),ge=se&&S.offsetY>b.clientHeight;if(le||ge)return}const U=(E=s.current.floatingContext)==null?void 0:E.nodeId,W=m&&Zs(m.nodesRef.current,U).some(V=>{var Z;return Uc(S,(Z=V.context)==null?void 0:Z.elements.floating)});if(Uc(S,o.floating)||Uc(S,o.domReference)||W)return;const K=m?Zs(m.nodesRef.current,U):[];if(K.length>0){let V=!0;if(K.forEach(Z=>{var H;if((H=Z.context)!=null&&H.open&&!Z.context.dataRef.current.__outsidePressBubbles){V=!1;return}}),!V)return}r(!1,S,"outside-press")}),k=Ut(S=>{var E;const O=()=>{var N;P(S),(N=Tr(S))==null||N.removeEventListener(l,O)};(E=Tr(S))==null||E.addEventListener(l,O)});z.useEffect(()=>{if(!n||!i)return;s.current.__escapeKeyBubbles=T,s.current.__outsidePressBubbles=B;let S=-1;function E(R){r(!1,R,"ancestor-scroll")}function O(){window.clearTimeout(S),j.current=!0}function N(){S=window.setTimeout(()=>{j.current=!1},As()?5:0)}const b=jt(o.floating);c&&(b.addEventListener("keydown",L?y:g,L),b.addEventListener("compositionstart",O),b.addEventListener("compositionend",N)),A&&b.addEventListener(l,F?k:P,F);let M=[];return p&&(fe(o.domReference)&&(M=xn(o.domReference)),fe(o.floating)&&(M=M.concat(xn(o.floating))),!fe(o.reference)&&o.reference&&o.reference.contextElement&&(M=M.concat(xn(o.reference.contextElement)))),M=M.filter(R=>{var _;return R!==((_=b.defaultView)==null?void 0:_.visualViewport)}),M.forEach(R=>{R.addEventListener("scroll",E,{passive:!0})}),()=>{c&&(b.removeEventListener("keydown",L?y:g,L),b.removeEventListener("compositionstart",O),b.removeEventListener("compositionend",N)),A&&b.removeEventListener(l,F?k:P,F),M.forEach(R=>{R.removeEventListener("scroll",E)}),window.clearTimeout(S)}},[s,o,c,A,l,n,r,p,i,T,B,g,L,y,P,F,k]),z.useEffect(()=>{s.current.insideReactTree=!1},[s,A,l]);const C=z.useMemo(()=>({onKeyDown:g,...u&&{[HS[f]]:S=>{r(!1,S.nativeEvent,"reference-press")},...f!=="click"&&{onClick(S){r(!1,S.nativeEvent,"reference-press")}}}}),[g,r,u,f]),$=z.useMemo(()=>({onKeyDown:g,onMouseDown(){w.current=!0},onMouseUp(){w.current=!0},[WS[l]]:()=>{s.current.insideReactTree=!0}}),[g,l,s]);return z.useMemo(()=>i?{reference:C,floating:$}:{},[i,C,$])}function GS(e){const{open:t=!1,onOpenChange:n,elements:r}=e,o=Hc(),s=z.useRef({}),[i]=z.useState(()=>BS()),c=Vc()!=null;if(process.env.NODE_ENV!=="production"){const d=r.reference;d&&!fe(d)&&kS("Cannot pass a virtual element to the `elements.reference` option,","as it must be a real DOM element. Use `refs.setPositionReference()`","instead.")}const[a,l]=z.useState(r.reference),u=Ut((d,h,m)=>{s.current.openEvent=d?h:void 0,i.emit("openchange",{open:d,event:h,reason:m,nested:c}),n==null||n(d,h,m)}),f=z.useMemo(()=>({setPositionReference:l}),[]),p=z.useMemo(()=>({reference:a||r.reference||null,floating:r.floating||null,domReference:r.reference}),[a,r.reference,r.floating]);return z.useMemo(()=>({dataRef:s,open:t,onOpenChange:u,elements:p,events:i,floatingId:o,refs:f}),[t,u,p,i,o,f])}function qS(e){e===void 0&&(e={});const{nodeId:t}=e,n=GS({...e,elements:{reference:null,floating:null,...e.elements}}),r=e.rootContext||n,o=r.elements,[s,i]=z.useState(null),[c,a]=z.useState(null),u=(o==null?void 0:o.domReference)||s,f=z.useRef(null),p=Gc();_t(()=>{u&&(f.current=u)},[u]);const d=ih({...e,elements:{...o,...c&&{reference:c}}}),h=z.useCallback(T=>{const B=fe(T)?{getBoundingClientRect:()=>T.getBoundingClientRect(),getClientRects:()=>T.getClientRects(),contextElement:T}:T;a(B),d.refs.setReference(B)},[d.refs]),m=z.useCallback(T=>{(fe(T)||T===null)&&(f.current=T,i(T)),(fe(d.refs.reference.current)||d.refs.reference.current===null||T!==null&&!fe(T))&&d.refs.setReference(T)},[d.refs]),x=z.useMemo(()=>({...d.refs,setReference:m,setPositionReference:h,domReference:f}),[d.refs,m,h]),A=z.useMemo(()=>({...d.elements,domReference:u}),[d.elements,u]),w=z.useMemo(()=>({...d,...r,refs:x,elements:A,nodeId:t}),[d,x,A,t,r]);return _t(()=>{r.dataRef.current.floatingContext=w;const T=p==null?void 0:p.nodesRef.current.find(B=>B.id===t);T&&(T.context=w)}),z.useMemo(()=>({...d,context:w,refs:x,elements:A}),[d,x,A,w])}function Kc(){return mS()&&s0()}function ZS(e,t){t===void 0&&(t={});const{open:n,onOpenChange:r,events:o,dataRef:s,elements:i}=e,{enabled:c=!0,visibleOnly:a=!0}=t,l=z.useRef(!1),u=z.useRef(-1),f=z.useRef(!0);z.useEffect(()=>{if(!c)return;const d=He(i.domReference);function h(){!n&&De(i.domReference)&&i.domReference===_c(jt(i.domReference))&&(l.current=!0)}function m(){f.current=!0}function x(){f.current=!1}return d.addEventListener("blur",h),Kc()&&(d.addEventListener("keydown",m,!0),d.addEventListener("pointerdown",x,!0)),()=>{d.removeEventListener("blur",h),Kc()&&(d.removeEventListener("keydown",m,!0),d.removeEventListener("pointerdown",x,!0))}},[i.domReference,n,c]),z.useEffect(()=>{if(!c)return;function d(h){let{reason:m}=h;(m==="reference-press"||m==="escape-key")&&(l.current=!0)}return o.on("openchange",d),()=>{o.off("openchange",d)}},[o,c]),z.useEffect(()=>()=>{ut(u)},[]);const p=z.useMemo(()=>({onMouseLeave(){l.current=!1},onFocus(d){if(l.current)return;const h=Tr(d.nativeEvent);if(a&&fe(h)){if(Kc()&&!d.relatedTarget){if(!f.current&&!a0(h))return}else if(!wS(h))return}r(!0,d.nativeEvent,"focus")},onBlur(d){l.current=!1;const h=d.relatedTarget,m=d.nativeEvent,x=fe(h)&&h.hasAttribute(Io("focus-guard"))&&h.getAttribute("data-type")==="outside";u.current=window.setTimeout(()=>{var A;const w=_c(i.domReference?i.domReference.ownerDocument:document);!h&&w===i.domReference||$r((A=s.current.floatingContext)==null?void 0:A.refs.floating.current,w)||$r(i.domReference,w)||x||r(!1,m,"focus")})}}),[s,i.domReference,r,a]);return z.useMemo(()=>c?{reference:p}:{},[c,p])}function Yc(e,t,n){const r=new Map,o=n==="item";let s=e;if(o&&e){const{[f0]:i,[d0]:c,...a}=e;s=a}return{...n==="floating"&&{tabIndex:-1,[OS]:""},...s,...t.map(i=>{const c=i?i[n]:null;return typeof c=="function"?e?c(e):null:c}).concat(e).reduce((i,c)=>(c&&Object.entries(c).forEach(a=>{let[l,u]=a;if(!(o&&[f0,d0].includes(l)))if(l.indexOf("on")===0){if(r.has(l)||r.set(l,[]),typeof u=="function"){var f;(f=r.get(l))==null||f.push(u),i[l]=function(){for(var p,d=arguments.length,h=new Array(d),m=0;m<d;m++)h[m]=arguments[m];return(p=r.get(l))==null?void 0:p.map(x=>x(...h)).find(x=>x!==void 0)}}}else i[l]=u}),i),{})}}function KS(e){e===void 0&&(e=[]);const t=e.map(c=>c==null?void 0:c.reference),n=e.map(c=>c==null?void 0:c.floating),r=e.map(c=>c==null?void 0:c.item),o=z.useCallback(c=>Yc(c,e,"reference"),t),s=z.useCallback(c=>Yc(c,e,"floating"),n),i=z.useCallback(c=>Yc(c,e,"item"),r);return z.useMemo(()=>({getReferenceProps:o,getFloatingProps:s,getItemProps:i}),[o,s,i])}const YS=new Map([["select","listbox"],["combobox","listbox"],["label",!1]]);function XS(e,t){var n,r;t===void 0&&(t={});const{open:o,elements:s,floatingId:i}=e,{enabled:c=!0,role:a="dialog"}=t,l=Hc(),u=((n=s.domReference)==null?void 0:n.id)||l,f=z.useMemo(()=>{var w;return((w=vS(s.floating))==null?void 0:w.id)||i},[s.floating,i]),p=(r=YS.get(a))!=null?r:a,h=Vc()!=null,m=z.useMemo(()=>p==="tooltip"||a==="label"?{["aria-"+(a==="label"?"labelledby":"describedby")]:o?f:void 0}:{"aria-expanded":o?"true":"false","aria-haspopup":p==="alertdialog"?"dialog":p,"aria-controls":o?f:void 0,...p==="listbox"&&{role:"combobox"},...p==="menu"&&{id:u},...p==="menu"&&h&&{role:"menuitem"},...a==="select"&&{"aria-autocomplete":"none"},...a==="combobox"&&{"aria-autocomplete":"list"}},[p,f,h,o,u,a]),x=z.useMemo(()=>{const w={id:f,...p&&{role:p}};return p==="tooltip"||a==="label"?w:{...w,...p==="menu"&&{"aria-labelledby":u}}},[p,f,u,a]),A=z.useCallback(w=>{let{active:T,selected:B}=w;const L={role:"option",...T&&{id:f+"-fui-option"}};switch(a){case"select":case"combobox":return{...L,"aria-selected":B}}return{}},[f,a]);return z.useMemo(()=>c?{reference:m,floating:x,item:A}:{},[c,m,x,A])}const S0=v.forwardRef(({placement:e,className:t=""},n)=>{const o=(s=>{switch(s.split("-")[0]){case"top":return{bottom:"-4px",left:"50%",transform:"translateX(-50%)",borderLeft:"4px solid transparent",borderRight:"4px solid transparent",borderTop:"4px solid #242424"};case"bottom":return{top:"-4px",left:"50%",transform:"translateX(-50%)",borderLeft:"4px solid transparent",borderRight:"4px solid transparent",borderBottom:"4px solid #242424"};case"left":return{right:"-4px",top:"50%",transform:"translateY(-50%)",borderTop:"4px solid transparent",borderBottom:"4px solid transparent",borderLeft:"4px solid #242424"};case"right":return{left:"-4px",top:"50%",transform:"translateY(-50%)",borderTop:"4px solid transparent",borderBottom:"4px solid transparent",borderRight:"4px solid #242424"};default:return{}}})(e);return I.jsx("div",{ref:n,className:`absolute w-0 h-0 ${t}`,style:o})});S0.displayName="TooltipArrow";const qn=({children:e,content:t,placement:n="top",delay:r=200,showArrow:o=!0,className:s="",disabled:i=!1,maxWidth:c="max-w-xs",trigger:a=["hover","focus"]})=>{const[l,u]=v.useState(!1),f=v.useRef(null),{refs:p,floatingStyles:d,context:h}=qS({open:l&&!i,onOpenChange:u,placement:n,whileElementsMounted:nh,middleware:[Ec(o?12:8),ch({fallbackAxisSideDirection:"start",padding:8}),ah({padding:8}),...o?[h6({element:f})]:[]]}),m=FS(h,{enabled:a.includes("hover"),delay:{open:r,close:150}}),x=ZS(h,{enabled:a.includes("focus")}),A=zS(h,{enabled:a.includes("click")}),w=VS(h),T=XS(h,{role:"tooltip"}),{getReferenceProps:B,getFloatingProps:L}=KS([m,x,A,w,T]);return i?I.jsx(I.Fragment,{children:e}):I.jsxs(I.Fragment,{children:[I.jsx("div",{ref:p.setReference,...B(),className:"cursor-help",children:e}),l&&I.jsx(jS,{children:I.jsxs("div",{ref:p.setFloating,...L(),style:{...d,zIndex:101},className:`
168
+ */var sS={L:Pr.QrCode.Ecc.LOW,M:Pr.QrCode.Ecc.MEDIUM,Q:Pr.QrCode.Ecc.QUARTILE,H:Pr.QrCode.Ecc.HIGH},Kh=128,Yh="L",Xh="#FFFFFF",Qh="#000000",Jh=!1,e0=1,iS=4,aS=0,cS=.1;function t0(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 n0(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 lS(e,t,n,r){if(r==null)return null;const o=e.length+n*2,s=Math.floor(t*cS),i=o/t,c=(r.width||s)*i,a=(r.height||s)*i,l=r.x==null?e.length/2-c/2:r.x*i,u=r.y==null?e.length/2-a/2:r.y*i,f=r.opacity==null?1:r.opacity;let p=null;if(r.excavate){let h=Math.floor(l),m=Math.floor(u),x=Math.ceil(c+l-h),A=Math.ceil(a+u-m);p={x:h,y:m,w:x,h:A}}const d=r.crossOrigin;return{x:l,y:u,h:a,w:c,excavation:p,opacity:f,crossOrigin:d}}function uS(e,t){return t!=null?Math.max(Math.floor(t),0):e?iS:aS}function r0({value:e,level:t,minVersion:n,includeMargin:r,marginSize:o,imageSettings:s,size:i,boostLevel:c}){let a=v.useMemo(()=>{const h=(Array.isArray(e)?e:[e]).reduce((m,x)=>(m.push(...Pr.QrSegment.makeSegments(x)),m),[]);return Pr.QrCode.encodeSegments(h,sS[t],n,void 0,void 0,c)},[e,t,n,c]);const{cells:l,margin:u,numCells:f,calculatedImageSettings:p}=v.useMemo(()=>{let d=a.getModules();const h=uS(r,o),m=d.length+h*2,x=lS(d,i,h,s);return{cells:d,margin:h,numCells:m,calculatedImageSettings:x}},[a,i,s,r,o]);return{qrcode:a,margin:u,cells:l,numCells:f,calculatedImageSettings:p}}var fS=function(){try{new Path2D().addPath(new Path2D)}catch{return!1}return!0}(),dS=v.forwardRef(function(t,n){const r=t,{value:o,size:s=Kh,level:i=Yh,bgColor:c=Xh,fgColor:a=Qh,includeMargin:l=Jh,minVersion:u=e0,boostLevel:f,marginSize:p,imageSettings:d}=r,m=_c(r,["value","size","level","bgColor","fgColor","includeMargin","minVersion","boostLevel","marginSize","imageSettings"]),{style:x}=m,A=_c(m,["style"]),w=d==null?void 0:d.src,T=v.useRef(null),B=v.useRef(null),L=v.useCallback(S=>{T.current=S,typeof n=="function"?n(S):n&&(n.current=S)},[n]),[F,_]=v.useState(!1),{margin:g,cells:y,numCells:P,calculatedImageSettings:k}=r0({value:o,level:i,minVersion:u,boostLevel:f,includeMargin:l,marginSize:p,imageSettings:d,size:s});v.useEffect(()=>{if(T.current!=null){const S=T.current,E=S.getContext("2d");if(!E)return;let O=y;const N=B.current,b=k!=null&&N!==null&&N.complete&&N.naturalHeight!==0&&N.naturalWidth!==0;b&&k.excavation!=null&&(O=n0(y,k.excavation));const M=window.devicePixelRatio||1;S.height=S.width=s*M;const R=s/P*M;E.scale(R,R),E.fillStyle=c,E.fillRect(0,0,P,P),E.fillStyle=a,fS?E.fill(new Path2D(t0(O,g))):y.forEach(function(U,j){U.forEach(function(W,K){W&&E.fillRect(K+g,j+g,1,1)})}),k&&(E.globalAlpha=k.opacity),b&&E.drawImage(N,k.x+g,k.y+g,k.w,k.h)}}),v.useEffect(()=>{_(!1)},[w]);const C=jc({height:s,width:s},x);let $=null;return w!=null&&($=v.createElement("img",{src:w,key:w,style:{display:"none"},onLoad:()=>{_(!0)},ref:B,crossOrigin:k==null?void 0:k.crossOrigin})),v.createElement(v.Fragment,null,v.createElement("canvas",jc({style:C,height:s,width:s,ref:L,role:"img"},A)),$)});dS.displayName="QRCodeCanvas";var o0=v.forwardRef(function(t,n){const r=t,{value:o,size:s=Kh,level:i=Yh,bgColor:c=Xh,fgColor:a=Qh,includeMargin:l=Jh,minVersion:u=e0,boostLevel:f,title:p,marginSize:d,imageSettings:h}=r,m=_c(r,["value","size","level","bgColor","fgColor","includeMargin","minVersion","boostLevel","title","marginSize","imageSettings"]),{margin:x,cells:A,numCells:w,calculatedImageSettings:T}=r0({value:o,level:i,minVersion:u,boostLevel:f,includeMargin:l,marginSize:d,imageSettings:h,size:s});let B=A,L=null;h!=null&&T!=null&&(T.excavation!=null&&(B=n0(A,T.excavation)),L=v.createElement("image",{href:h.src,height:T.h,width:T.w,x:T.x+x,y:T.y+x,preserveAspectRatio:"none",opacity:T.opacity,crossOrigin:T.crossOrigin}));const F=t0(B,x);return v.createElement("svg",jc({height:s,width:s,viewBox:`0 0 ${w} ${w}`,ref:n,role:"img"},m),!!p&&v.createElement("title",null,p),v.createElement("path",{fill:c,d:`M0,0 h${w}v${w}H0z`,shapeRendering:"crispEdges"}),v.createElement("path",{fill:a,d:F,shapeRendering:"crispEdges"}),L)});o0.displayName="QRCodeSVG";function pS(){const e=navigator.userAgentData;return e!=null&&e.platform?e.platform:navigator.platform}function hS(){const e=navigator.userAgentData;return e&&Array.isArray(e.brands)?e.brands.map(t=>{let{brand:n,version:r}=t;return n+"/"+r}).join(" "):navigator.userAgent}function s0(){return/apple/i.test(navigator.vendor)}function mS(){return pS().toLowerCase().startsWith("mac")&&!navigator.maxTouchPoints}function gS(){return hS().includes("jsdom/")}const i0="data-floating-ui-focusable",bS="input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])";function Uc(e){let t=e.activeElement;for(;((n=t)==null||(n=n.shadowRoot)==null?void 0:n.activeElement)!=null;){var n;t=t.shadowRoot.activeElement}return t}function $r(e,t){if(!e||!t)return!1;const n=t.getRootNode==null?void 0:t.getRootNode();if(e.contains(t))return!0;if(n&&fc(n)){let r=t;for(;r;){if(e===r)return!0;r=r.parentNode||r.host}}return!1}function Tr(e){return"composedPath"in e?e.composedPath()[0]:e.target}function zc(e,t){if(t==null)return!1;if("composedPath"in e)return e.composedPath().includes(t);const n=e;return n.target!=null&&t.contains(n.target)}function yS(e){return e.matches("html,body")}function jt(e){return(e==null?void 0:e.ownerDocument)||document}function a0(e){return De(e)&&e.matches(bS)}function wS(e){if(!e||gS())return!0;try{return e.matches(":focus-visible")}catch{return!0}}function vS(e){return e?e.hasAttribute(i0)?e:e.querySelector("["+i0+"]")||e:null}function Zs(e,t,n){return n===void 0&&(n=!0),e.filter(o=>{var s;return o.parentId===t&&(!n||((s=o.context)==null?void 0:s.open))}).flatMap(o=>[o,...Zs(e,o.id,n)])}function xS(e){return"nativeEvent"in e}function Co(e,t){const n=["mouse","pen"];return t||n.push("",void 0),n.includes(e)}var ES=typeof document<"u",SS=function(){},_t=ES?v.useLayoutEffect:SS;const PS={...z};function Ks(e){const t=z.useRef(e);return _t(()=>{t.current=e}),t}const $S=PS.useInsertionEffect||(e=>e());function Ut(e){const t=z.useRef(()=>{if(process.env.NODE_ENV!=="production")throw new Error("Cannot call an event handler while rendering.")});return $S(()=>{t.current=e}),z.useCallback(function(){for(var n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return t.current==null?void 0:t.current(...r)},[])}const c0=()=>({getShadowRoot:!0,displayCheck:typeof ResizeObserver=="function"&&ResizeObserver.toString().includes("[native code]")?"full":"none"});function l0(e,t){const n=Vp(e,c0()),r=n.length;if(r===0)return;const o=Uc(jt(e)),s=n.indexOf(o),i=s===-1?t===1?0:r-1:s+t;return n[i]}function TS(e){return l0(jt(e).body,1)||e}function AS(e){return l0(jt(e).body,-1)||e}function Hc(e,t){const n=t||e.currentTarget,r=e.relatedTarget;return!r||!$r(n,r)}function NS(e){Vp(e,c0()).forEach(n=>{n.dataset.tabindex=n.getAttribute("tabindex")||"",n.setAttribute("tabindex","-1")})}function u0(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 OS="data-floating-ui-focusable",f0="active",d0="selected",CS={...z};let p0=!1,IS=0;const h0=()=>"floating-ui-"+Math.random().toString(36).slice(2,6)+IS++;function MS(){const[e,t]=z.useState(()=>p0?h0():void 0);return _t(()=>{e==null&&t(h0())},[]),z.useEffect(()=>{p0=!0},[]),e}const Wc=CS.useId||MS;let Vc;process.env.NODE_ENV!=="production"&&(Vc=new Set);function kS(){for(var e,t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];const o="Floating UI: "+n.join(" ");if(!((e=Vc)!=null&&e.has(o))){var s;(s=Vc)==null||s.add(o),console.error(o)}}function BS(){const e=new Map;return{emit(t,n){var r;(r=e.get(t))==null||r.forEach(o=>o(n))},on(t,n){e.has(t)||e.set(t,new Set),e.get(t).add(n)},off(t,n){var r;(r=e.get(t))==null||r.delete(n)}}}const LS=z.createContext(null),DS=z.createContext(null),Gc=()=>{var e;return((e=z.useContext(LS))==null?void 0:e.id)||null},qc=()=>z.useContext(DS);function Io(e){return"data-floating-ui-"+e}function ut(e){e.current!==-1&&(clearTimeout(e.current),e.current=-1)}const m0=Io("safe-polygon");function Zc(e,t,n){if(n&&!Co(n))return 0;if(typeof e=="number")return e;if(typeof e=="function"){const r=e();return typeof r=="number"?r:r==null?void 0:r[t]}return e==null?void 0:e[t]}function Kc(e){return typeof e=="function"?e():e}function FS(e,t){t===void 0&&(t={});const{open:n,onOpenChange:r,dataRef:o,events:s,elements:i}=e,{enabled:c=!0,delay:a=0,handleClose:l=null,mouseOnly:u=!1,restMs:f=0,move:p=!0}=t,d=qc(),h=Gc(),m=Ks(l),x=Ks(a),A=Ks(n),w=Ks(f),T=z.useRef(),B=z.useRef(-1),L=z.useRef(),F=z.useRef(-1),_=z.useRef(!0),g=z.useRef(!1),y=z.useRef(()=>{}),P=z.useRef(!1),k=Ut(()=>{var N;const b=(N=o.current.openEvent)==null?void 0:N.type;return(b==null?void 0:b.includes("mouse"))&&b!=="mousedown"});z.useEffect(()=>{if(!c)return;function N(b){let{open:M}=b;M||(ut(B),ut(F),_.current=!0,P.current=!1)}return s.on("openchange",N),()=>{s.off("openchange",N)}},[c,s]),z.useEffect(()=>{if(!c||!m.current||!n)return;function N(M){k()&&r(!1,M,"hover")}const b=jt(i.floating).documentElement;return b.addEventListener("mouseleave",N),()=>{b.removeEventListener("mouseleave",N)}},[i.floating,n,r,c,m,k]);const C=z.useCallback(function(N,b,M){b===void 0&&(b=!0),M===void 0&&(M="hover");const R=Zc(x.current,"close",T.current);R&&!L.current?(ut(B),B.current=window.setTimeout(()=>r(!1,N,M),R)):b&&(ut(B),r(!1,N,M))},[x,r]),$=Ut(()=>{y.current(),L.current=void 0}),S=Ut(()=>{if(g.current){const N=jt(i.floating).body;N.style.pointerEvents="",N.removeAttribute(m0),g.current=!1}}),E=Ut(()=>o.current.openEvent?["click","mousedown"].includes(o.current.openEvent.type):!1);z.useEffect(()=>{if(!c)return;function N(j){if(ut(B),_.current=!1,u&&!Co(T.current)||Kc(w.current)>0&&!Zc(x.current,"open"))return;const W=Zc(x.current,"open",T.current);W?B.current=window.setTimeout(()=>{A.current||r(!0,j,"hover")},W):n||r(!0,j,"hover")}function b(j){if(E()){S();return}y.current();const W=jt(i.floating);if(ut(F),P.current=!1,m.current&&o.current.floatingContext){n||ut(B),L.current=m.current({...o.current.floatingContext,tree:d,x:j.clientX,y:j.clientY,onClose(){S(),$(),E()||C(j,!0,"safe-polygon")}});const V=L.current;W.addEventListener("mousemove",V),y.current=()=>{W.removeEventListener("mousemove",V)};return}(T.current==="touch"?!$r(i.floating,j.relatedTarget):!0)&&C(j)}function M(j){E()||o.current.floatingContext&&(m.current==null||m.current({...o.current.floatingContext,tree:d,x:j.clientX,y:j.clientY,onClose(){S(),$(),E()||C(j)}})(j))}function R(){ut(B)}function U(j){E()||C(j,!1)}if(fe(i.domReference)){const j=i.domReference,W=i.floating;return n&&j.addEventListener("mouseleave",M),p&&j.addEventListener("mousemove",N,{once:!0}),j.addEventListener("mouseenter",N),j.addEventListener("mouseleave",b),W&&(W.addEventListener("mouseleave",M),W.addEventListener("mouseenter",R),W.addEventListener("mouseleave",U)),()=>{n&&j.removeEventListener("mouseleave",M),p&&j.removeEventListener("mousemove",N),j.removeEventListener("mouseenter",N),j.removeEventListener("mouseleave",b),W&&(W.removeEventListener("mouseleave",M),W.removeEventListener("mouseenter",R),W.removeEventListener("mouseleave",U))}}},[i,c,e,u,p,C,$,S,r,n,A,d,x,m,o,E,w]),_t(()=>{var N;if(c&&n&&(N=m.current)!=null&&(N=N.__options)!=null&&N.blockPointerEvents&&k()){g.current=!0;const M=i.floating;if(fe(i.domReference)&&M){var b;const R=jt(i.floating).body;R.setAttribute(m0,"");const U=i.domReference,j=d==null||(b=d.nodesRef.current.find(W=>W.id===h))==null||(b=b.context)==null?void 0:b.elements.floating;return j&&(j.style.pointerEvents=""),R.style.pointerEvents="none",U.style.pointerEvents="auto",M.style.pointerEvents="auto",()=>{R.style.pointerEvents="",U.style.pointerEvents="",M.style.pointerEvents=""}}}},[c,n,h,i,d,m,k]),_t(()=>{n||(T.current=void 0,P.current=!1,$(),S())},[n,$,S]),z.useEffect(()=>()=>{$(),ut(B),ut(F),S()},[c,i.domReference,$,S]);const O=z.useMemo(()=>{function N(b){T.current=b.pointerType}return{onPointerDown:N,onPointerEnter:N,onMouseMove(b){const{nativeEvent:M}=b;function R(){!_.current&&!A.current&&r(!0,M,"hover")}u&&!Co(T.current)||n||Kc(w.current)===0||P.current&&b.movementX**2+b.movementY**2<2||(ut(F),T.current==="touch"?R():(P.current=!0,F.current=window.setTimeout(R,Kc(w.current))))}}},[u,r,n,A,w]);return z.useMemo(()=>c?{reference:O}:{},[c,O])}const g0={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},b0=z.forwardRef(function(t,n){const[r,o]=z.useState();_t(()=>{s0()&&o("button")},[]);const s={ref:n,tabIndex:0,role:r,"aria-hidden":r?void 0:!0,[Io("focus-guard")]:"",style:g0};return I.jsx("span",{...t,...s})}),y0=z.createContext(null),w0=Io("portal");function RS(e){e===void 0&&(e={});const{id:t,root:n}=e,r=Wc(),o=_S(),[s,i]=z.useState(null),c=z.useRef(null);return _t(()=>()=>{s==null||s.remove(),queueMicrotask(()=>{c.current=null})},[s]),_t(()=>{if(!r||c.current)return;const a=t?document.getElementById(t):null;if(!a)return;const l=document.createElement("div");l.id=r,l.setAttribute(w0,""),a.appendChild(l),c.current=l,i(l)},[t,r]),_t(()=>{if(n===null||!r||c.current)return;let a=n||(o==null?void 0:o.portalNode);a&&!uc(a)&&(a=a.current),a=a||document.body;let l=null;t&&(l=document.createElement("div"),l.id=t,a.appendChild(l));const u=document.createElement("div");u.id=r,u.setAttribute(w0,""),a=l||a,a.appendChild(u),c.current=u,i(u)},[t,n,r,o]),s}function jS(e){const{children:t,id:n,root:r,preserveTabOrder:o=!0}=e,s=RS({id:n,root:r}),[i,c]=z.useState(null),a=z.useRef(null),l=z.useRef(null),u=z.useRef(null),f=z.useRef(null),p=i==null?void 0:i.modal,d=i==null?void 0:i.open,h=!!i&&!i.modal&&i.open&&o&&!!(r||s);return z.useEffect(()=>{if(!s||!o||p)return;function m(x){s&&Hc(x)&&(x.type==="focusin"?u0:NS)(s)}return s.addEventListener("focusin",m,!0),s.addEventListener("focusout",m,!0),()=>{s.removeEventListener("focusin",m,!0),s.removeEventListener("focusout",m,!0)}},[s,o,p]),z.useEffect(()=>{s&&(d||u0(s))},[d,s]),I.jsxs(y0.Provider,{value:z.useMemo(()=>({preserveTabOrder:o,beforeOutsideRef:a,afterOutsideRef:l,beforeInsideRef:u,afterInsideRef:f,portalNode:s,setFocusManagerState:c}),[o,s]),children:[h&&s&&I.jsx(b0,{"data-type":"outside",ref:a,onFocus:m=>{if(Hc(m,s)){var x;(x=u.current)==null||x.focus()}else{const A=i?i.domReference:null,w=AS(A);w==null||w.focus()}}}),h&&s&&I.jsx("span",{"aria-owns":s.id,style:g0}),s&&Or.createPortal(t,s),h&&s&&I.jsx(b0,{"data-type":"outside",ref:l,onFocus:m=>{if(Hc(m,s)){var x;(x=f.current)==null||x.focus()}else{const A=i?i.domReference:null,w=TS(A);w==null||w.focus(),i!=null&&i.closeOnFocusOut&&(i==null||i.onOpenChange(!1,m.nativeEvent,"focus-out"))}}})]})}const _S=()=>z.useContext(y0);function v0(e){return De(e.target)&&e.target.tagName==="BUTTON"}function US(e){return De(e.target)&&e.target.tagName==="A"}function x0(e){return a0(e)}function zS(e,t){t===void 0&&(t={});const{open:n,onOpenChange:r,dataRef:o,elements:{domReference:s}}=e,{enabled:i=!0,event:c="click",toggle:a=!0,ignoreMouse:l=!1,keyboardHandlers:u=!0,stickIfOpen:f=!0}=t,p=z.useRef(),d=z.useRef(!1),h=z.useMemo(()=>({onPointerDown(m){p.current=m.pointerType},onMouseDown(m){const x=p.current;m.button===0&&c!=="click"&&(Co(x,!0)&&l||(n&&a&&(!(o.current.openEvent&&f)||o.current.openEvent.type==="mousedown")?r(!1,m.nativeEvent,"click"):(m.preventDefault(),r(!0,m.nativeEvent,"click"))))},onClick(m){const x=p.current;if(c==="mousedown"&&p.current){p.current=void 0;return}Co(x,!0)&&l||(n&&a&&(!(o.current.openEvent&&f)||o.current.openEvent.type==="click")?r(!1,m.nativeEvent,"click"):r(!0,m.nativeEvent,"click"))},onKeyDown(m){p.current=void 0,!(m.defaultPrevented||!u||v0(m))&&(m.key===" "&&!x0(s)&&(m.preventDefault(),d.current=!0),!US(m)&&m.key==="Enter"&&r(!(n&&a),m.nativeEvent,"click"))},onKeyUp(m){m.defaultPrevented||!u||v0(m)||x0(s)||m.key===" "&&d.current&&(d.current=!1,r(!(n&&a),m.nativeEvent,"click"))}}),[o,s,c,l,u,r,n,f,a]);return z.useMemo(()=>i?{reference:h}:{},[i,h])}const HS={pointerdown:"onPointerDown",mousedown:"onMouseDown",click:"onClick"},WS={pointerdown:"onPointerDownCapture",mousedown:"onMouseDownCapture",click:"onClickCapture"},E0=e=>{var t,n;return{escapeKey:typeof e=="boolean"?e:(t=e==null?void 0:e.escapeKey)!=null?t:!1,outsidePress:typeof e=="boolean"?e:(n=e==null?void 0:e.outsidePress)!=null?n:!0}};function VS(e,t){t===void 0&&(t={});const{open:n,onOpenChange:r,elements:o,dataRef:s}=e,{enabled:i=!0,escapeKey:c=!0,outsidePress:a=!0,outsidePressEvent:l="pointerdown",referencePress:u=!1,referencePressEvent:f="pointerdown",ancestorScroll:p=!1,bubbles:d,capture:h}=t,m=qc(),x=Ut(typeof a=="function"?a:()=>!1),A=typeof a=="function"?x:a,w=z.useRef(!1),{escapeKey:T,outsidePress:B}=E0(d),{escapeKey:L,outsidePress:F}=E0(h),_=z.useRef(!1),g=Ut(S=>{var E;if(!n||!i||!c||S.key!=="Escape"||_.current)return;const O=(E=s.current.floatingContext)==null?void 0:E.nodeId,N=m?Zs(m.nodesRef.current,O):[];if(!T&&(S.stopPropagation(),N.length>0)){let b=!0;if(N.forEach(M=>{var R;if((R=M.context)!=null&&R.open&&!M.context.dataRef.current.__escapeKeyBubbles){b=!1;return}}),!b)return}r(!1,xS(S)?S.nativeEvent:S,"escape-key")}),y=Ut(S=>{var E;const O=()=>{var N;g(S),(N=Tr(S))==null||N.removeEventListener("keydown",O)};(E=Tr(S))==null||E.addEventListener("keydown",O)}),P=Ut(S=>{var E;const O=s.current.insideReactTree;s.current.insideReactTree=!1;const N=w.current;if(w.current=!1,l==="click"&&N||O||typeof A=="function"&&!A(S))return;const b=Tr(S),M="["+Io("inert")+"]",R=jt(o.floating).querySelectorAll(M);let U=fe(b)?b:null;for(;U&&!on(U);){const V=sn(U);if(on(V)||!fe(V))break;U=V}if(R.length&&fe(b)&&!yS(b)&&!$r(b,o.floating)&&Array.from(R).every(V=>!$r(U,V)))return;if(De(b)&&$){const V=on(b),Z=lt(b),H=/auto|scroll/,Y=V||H.test(Z.overflowX),Q=V||H.test(Z.overflowY),oe=Y&&b.clientWidth>0&&b.scrollWidth>b.clientWidth,me=Q&&b.clientHeight>0&&b.scrollHeight>b.clientHeight,pe=Z.direction==="rtl",le=me&&(pe?S.offsetX<=b.offsetWidth-b.clientWidth:S.offsetX>b.clientWidth),ge=oe&&S.offsetY>b.clientHeight;if(le||ge)return}const j=(E=s.current.floatingContext)==null?void 0:E.nodeId,W=m&&Zs(m.nodesRef.current,j).some(V=>{var Z;return zc(S,(Z=V.context)==null?void 0:Z.elements.floating)});if(zc(S,o.floating)||zc(S,o.domReference)||W)return;const K=m?Zs(m.nodesRef.current,j):[];if(K.length>0){let V=!0;if(K.forEach(Z=>{var H;if((H=Z.context)!=null&&H.open&&!Z.context.dataRef.current.__outsidePressBubbles){V=!1;return}}),!V)return}r(!1,S,"outside-press")}),k=Ut(S=>{var E;const O=()=>{var N;P(S),(N=Tr(S))==null||N.removeEventListener(l,O)};(E=Tr(S))==null||E.addEventListener(l,O)});z.useEffect(()=>{if(!n||!i)return;s.current.__escapeKeyBubbles=T,s.current.__outsidePressBubbles=B;let S=-1;function E(R){r(!1,R,"ancestor-scroll")}function O(){window.clearTimeout(S),_.current=!0}function N(){S=window.setTimeout(()=>{_.current=!1},As()?5:0)}const b=jt(o.floating);c&&(b.addEventListener("keydown",L?y:g,L),b.addEventListener("compositionstart",O),b.addEventListener("compositionend",N)),A&&b.addEventListener(l,F?k:P,F);let M=[];return p&&(fe(o.domReference)&&(M=xn(o.domReference)),fe(o.floating)&&(M=M.concat(xn(o.floating))),!fe(o.reference)&&o.reference&&o.reference.contextElement&&(M=M.concat(xn(o.reference.contextElement)))),M=M.filter(R=>{var U;return R!==((U=b.defaultView)==null?void 0:U.visualViewport)}),M.forEach(R=>{R.addEventListener("scroll",E,{passive:!0})}),()=>{c&&(b.removeEventListener("keydown",L?y:g,L),b.removeEventListener("compositionstart",O),b.removeEventListener("compositionend",N)),A&&b.removeEventListener(l,F?k:P,F),M.forEach(R=>{R.removeEventListener("scroll",E)}),window.clearTimeout(S)}},[s,o,c,A,l,n,r,p,i,T,B,g,L,y,P,F,k]),z.useEffect(()=>{s.current.insideReactTree=!1},[s,A,l]);const C=z.useMemo(()=>({onKeyDown:g,...u&&{[HS[f]]:S=>{r(!1,S.nativeEvent,"reference-press")},...f!=="click"&&{onClick(S){r(!1,S.nativeEvent,"reference-press")}}}}),[g,r,u,f]),$=z.useMemo(()=>({onKeyDown:g,onMouseDown(){w.current=!0},onMouseUp(){w.current=!0},[WS[l]]:()=>{s.current.insideReactTree=!0}}),[g,l,s]);return z.useMemo(()=>i?{reference:C,floating:$}:{},[i,C,$])}function GS(e){const{open:t=!1,onOpenChange:n,elements:r}=e,o=Wc(),s=z.useRef({}),[i]=z.useState(()=>BS()),c=Gc()!=null;if(process.env.NODE_ENV!=="production"){const d=r.reference;d&&!fe(d)&&kS("Cannot pass a virtual element to the `elements.reference` option,","as it must be a real DOM element. Use `refs.setPositionReference()`","instead.")}const[a,l]=z.useState(r.reference),u=Ut((d,h,m)=>{s.current.openEvent=d?h:void 0,i.emit("openchange",{open:d,event:h,reason:m,nested:c}),n==null||n(d,h,m)}),f=z.useMemo(()=>({setPositionReference:l}),[]),p=z.useMemo(()=>({reference:a||r.reference||null,floating:r.floating||null,domReference:r.reference}),[a,r.reference,r.floating]);return z.useMemo(()=>({dataRef:s,open:t,onOpenChange:u,elements:p,events:i,floatingId:o,refs:f}),[t,u,p,i,o,f])}function qS(e){e===void 0&&(e={});const{nodeId:t}=e,n=GS({...e,elements:{reference:null,floating:null,...e.elements}}),r=e.rootContext||n,o=r.elements,[s,i]=z.useState(null),[c,a]=z.useState(null),u=(o==null?void 0:o.domReference)||s,f=z.useRef(null),p=qc();_t(()=>{u&&(f.current=u)},[u]);const d=ih({...e,elements:{...o,...c&&{reference:c}}}),h=z.useCallback(T=>{const B=fe(T)?{getBoundingClientRect:()=>T.getBoundingClientRect(),getClientRects:()=>T.getClientRects(),contextElement:T}:T;a(B),d.refs.setReference(B)},[d.refs]),m=z.useCallback(T=>{(fe(T)||T===null)&&(f.current=T,i(T)),(fe(d.refs.reference.current)||d.refs.reference.current===null||T!==null&&!fe(T))&&d.refs.setReference(T)},[d.refs]),x=z.useMemo(()=>({...d.refs,setReference:m,setPositionReference:h,domReference:f}),[d.refs,m,h]),A=z.useMemo(()=>({...d.elements,domReference:u}),[d.elements,u]),w=z.useMemo(()=>({...d,...r,refs:x,elements:A,nodeId:t}),[d,x,A,t,r]);return _t(()=>{r.dataRef.current.floatingContext=w;const T=p==null?void 0:p.nodesRef.current.find(B=>B.id===t);T&&(T.context=w)}),z.useMemo(()=>({...d,context:w,refs:x,elements:A}),[d,x,A,w])}function Yc(){return mS()&&s0()}function ZS(e,t){t===void 0&&(t={});const{open:n,onOpenChange:r,events:o,dataRef:s,elements:i}=e,{enabled:c=!0,visibleOnly:a=!0}=t,l=z.useRef(!1),u=z.useRef(-1),f=z.useRef(!0);z.useEffect(()=>{if(!c)return;const d=He(i.domReference);function h(){!n&&De(i.domReference)&&i.domReference===Uc(jt(i.domReference))&&(l.current=!0)}function m(){f.current=!0}function x(){f.current=!1}return d.addEventListener("blur",h),Yc()&&(d.addEventListener("keydown",m,!0),d.addEventListener("pointerdown",x,!0)),()=>{d.removeEventListener("blur",h),Yc()&&(d.removeEventListener("keydown",m,!0),d.removeEventListener("pointerdown",x,!0))}},[i.domReference,n,c]),z.useEffect(()=>{if(!c)return;function d(h){let{reason:m}=h;(m==="reference-press"||m==="escape-key")&&(l.current=!0)}return o.on("openchange",d),()=>{o.off("openchange",d)}},[o,c]),z.useEffect(()=>()=>{ut(u)},[]);const p=z.useMemo(()=>({onMouseLeave(){l.current=!1},onFocus(d){if(l.current)return;const h=Tr(d.nativeEvent);if(a&&fe(h)){if(Yc()&&!d.relatedTarget){if(!f.current&&!a0(h))return}else if(!wS(h))return}r(!0,d.nativeEvent,"focus")},onBlur(d){l.current=!1;const h=d.relatedTarget,m=d.nativeEvent,x=fe(h)&&h.hasAttribute(Io("focus-guard"))&&h.getAttribute("data-type")==="outside";u.current=window.setTimeout(()=>{var A;const w=Uc(i.domReference?i.domReference.ownerDocument:document);!h&&w===i.domReference||$r((A=s.current.floatingContext)==null?void 0:A.refs.floating.current,w)||$r(i.domReference,w)||x||r(!1,m,"focus")})}}),[s,i.domReference,r,a]);return z.useMemo(()=>c?{reference:p}:{},[c,p])}function Xc(e,t,n){const r=new Map,o=n==="item";let s=e;if(o&&e){const{[f0]:i,[d0]:c,...a}=e;s=a}return{...n==="floating"&&{tabIndex:-1,[OS]:""},...s,...t.map(i=>{const c=i?i[n]:null;return typeof c=="function"?e?c(e):null:c}).concat(e).reduce((i,c)=>(c&&Object.entries(c).forEach(a=>{let[l,u]=a;if(!(o&&[f0,d0].includes(l)))if(l.indexOf("on")===0){if(r.has(l)||r.set(l,[]),typeof u=="function"){var f;(f=r.get(l))==null||f.push(u),i[l]=function(){for(var p,d=arguments.length,h=new Array(d),m=0;m<d;m++)h[m]=arguments[m];return(p=r.get(l))==null?void 0:p.map(x=>x(...h)).find(x=>x!==void 0)}}}else i[l]=u}),i),{})}}function KS(e){e===void 0&&(e=[]);const t=e.map(c=>c==null?void 0:c.reference),n=e.map(c=>c==null?void 0:c.floating),r=e.map(c=>c==null?void 0:c.item),o=z.useCallback(c=>Xc(c,e,"reference"),t),s=z.useCallback(c=>Xc(c,e,"floating"),n),i=z.useCallback(c=>Xc(c,e,"item"),r);return z.useMemo(()=>({getReferenceProps:o,getFloatingProps:s,getItemProps:i}),[o,s,i])}const YS=new Map([["select","listbox"],["combobox","listbox"],["label",!1]]);function XS(e,t){var n,r;t===void 0&&(t={});const{open:o,elements:s,floatingId:i}=e,{enabled:c=!0,role:a="dialog"}=t,l=Wc(),u=((n=s.domReference)==null?void 0:n.id)||l,f=z.useMemo(()=>{var w;return((w=vS(s.floating))==null?void 0:w.id)||i},[s.floating,i]),p=(r=YS.get(a))!=null?r:a,h=Gc()!=null,m=z.useMemo(()=>p==="tooltip"||a==="label"?{["aria-"+(a==="label"?"labelledby":"describedby")]:o?f:void 0}:{"aria-expanded":o?"true":"false","aria-haspopup":p==="alertdialog"?"dialog":p,"aria-controls":o?f:void 0,...p==="listbox"&&{role:"combobox"},...p==="menu"&&{id:u},...p==="menu"&&h&&{role:"menuitem"},...a==="select"&&{"aria-autocomplete":"none"},...a==="combobox"&&{"aria-autocomplete":"list"}},[p,f,h,o,u,a]),x=z.useMemo(()=>{const w={id:f,...p&&{role:p}};return p==="tooltip"||a==="label"?w:{...w,...p==="menu"&&{"aria-labelledby":u}}},[p,f,u,a]),A=z.useCallback(w=>{let{active:T,selected:B}=w;const L={role:"option",...T&&{id:f+"-fui-option"}};switch(a){case"select":case"combobox":return{...L,"aria-selected":B}}return{}},[f,a]);return z.useMemo(()=>c?{reference:m,floating:x,item:A}:{},[c,m,x,A])}const S0=v.forwardRef(({placement:e,className:t=""},n)=>{const o=(s=>{switch(s.split("-")[0]){case"top":return{bottom:"-4px",left:"50%",transform:"translateX(-50%)",borderLeft:"4px solid transparent",borderRight:"4px solid transparent",borderTop:"4px solid #242424"};case"bottom":return{top:"-4px",left:"50%",transform:"translateX(-50%)",borderLeft:"4px solid transparent",borderRight:"4px solid transparent",borderBottom:"4px solid #242424"};case"left":return{right:"-4px",top:"50%",transform:"translateY(-50%)",borderTop:"4px solid transparent",borderBottom:"4px solid transparent",borderLeft:"4px solid #242424"};case"right":return{left:"-4px",top:"50%",transform:"translateY(-50%)",borderTop:"4px solid transparent",borderBottom:"4px solid transparent",borderRight:"4px solid #242424"};default:return{}}})(e);return I.jsx("div",{ref:n,className:`absolute w-0 h-0 ${t}`,style:o})});S0.displayName="TooltipArrow";const qn=({children:e,content:t,placement:n="top",delay:r=200,showArrow:o=!0,className:s="",disabled:i=!1,maxWidth:c="max-w-xs",trigger:a=["hover","focus"]})=>{const[l,u]=v.useState(!1),f=v.useRef(null),{refs:p,floatingStyles:d,context:h}=qS({open:l&&!i,onOpenChange:u,placement:n,whileElementsMounted:nh,middleware:[Sc(o?12:8),ch({fallbackAxisSideDirection:"start",padding:8}),ah({padding:8}),...o?[h6({element:f})]:[]]}),m=FS(h,{enabled:a.includes("hover"),delay:{open:r,close:150}}),x=ZS(h,{enabled:a.includes("focus")}),A=zS(h,{enabled:a.includes("click")}),w=VS(h),T=XS(h,{role:"tooltip"}),{getReferenceProps:B,getFloatingProps:L}=KS([m,x,A,w,T]);return i?I.jsx(I.Fragment,{children:e}):I.jsxs(I.Fragment,{children:[I.jsx("div",{ref:p.setReference,...B(),className:"cursor-help",children:e}),l&&I.jsx(jS,{children:I.jsxs("div",{ref:p.setFloating,...L(),style:{...d,zIndex:101},className:`
169
169
  z-[101] px-3 py-2 cursor-help
170
170
  bg-fill-page-secondary
171
171
  text-text-primary text-sm font-medium
@@ -173,5 +173,5 @@ ${xb(d)}`),super(t.shortMessage,{cause:t,docsPath:r,metaMessages:[...t.metaMessa
173
173
  relative
174
174
  ${c}
175
175
  ${s}
176
- `,children:[t,o&&I.jsx(S0,{ref:f,placement:h.placement||n})]})})]})},Mo="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAACXBIWXMAABYlAAAWJQFJUiTwAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAIcSURBVHgBxZc/T8JAGMafA4mDEXFw0DiQmDi4CP5JHGFx0qizg8QvIHwCZHYAvwEm7mji5CJuJv7DxcWYYMLmIEYXY/R8j6tQaBvuaCm/pOlbSu99+rZ97zlgwDBowvNLCdrF6NJ50891OvNC+wrL3JShgZIAnl+JAj97FKXoMNLl7ySGnQDBHMtcVeFGAM8nKNlnlsI0eoIVuwlhzsmXqcwoURSFK1iVRCSdRDDn5PwC3cutingsJOK60nkiYE0unrdi8uFRIDwFBSJiTKOqzgKMl00teXgS2D0Fto+BiVkoIMYs8Xws4iiAkmeVn/n0oqyA2NQEQI4dytoKMEqfQt/haZmrQ4C8e7/4TtsI4JvwDbYDswCjvXr1yakQMXI2KxCD/8RMAtx2ux5gcjIzBAT8LH8bAQwYbwR8fUAb/vtuEsAr0OX5Eng8o30ZqN1BHzFLAkPGkb4AcdfnObigkbM5HdN3+Qb/ekGdrNu4CMyd8Ag6iElo/QBYzcpYByYsm8QkIFSADmI2nEkAc2sUL0ALHsxZBEjLxA+hSu22tb0+KV9Gd18027M2SybNQui+f53R6g/b+gDLVMi7YQsND+c5dTtzamlE0jiyJLwVYZhSqzO27YRSxFD8v1m4Q4xh74gdBUgRQm2QKsH0Ps82xEs9EndK3sgDlWGkW96naANqSzMSHSy4XprZi2kuTqN09VjrBH9AD4vTgfMHJt+rxIFF7EgAAAAASUVORK5CYII=",QS=({currentActiveChain:e,selectedToken:t,address:n,accountType:r,onDeposit:o,onCopy:s,onClose:i})=>{const{t:c}=ht(),a=v.useMemo(()=>{if(!e)return!1;const f=r===Hv,p=Number(e.chainId),d=!Number.isNaN(p)&&(p===42161||p===421614),h=(t||"").toUpperCase()==="ETH";return f&&d&&h},[r,e,t]),l=v.useMemo(()=>{var f;return(f=e==null?void 0:e.tokenList)==null?void 0:f.find(p=>p.token===t||p.symbol===t)},[e,t]),u=(l==null?void 0:l.minDepositSize)||"10";return I.jsxs(I.Fragment,{children:[I.jsx("div",{className:"flex justify-center mt-4 mb-3",children:n&&I.jsx("div",{className:"bg-white rounded-lg",children:I.jsx(o0,{value:n,size:120,level:"L",bgColor:"#ffffff",fgColor:"#000000",marginSize:0})})}),n&&I.jsxs("div",{className:"flex items-center justify-between bg-fill-input-primary rounded-lg py-2 px-3 mb-3",children:[I.jsx("span",{className:"flex-1 text-text-primary text-sm font-medium break-all mr-3",children:n}),I.jsx(rS,{onCopy:()=>{s&&s(n)},text:n,children:I.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:[I.jsx("rect",{x:"2.08496",y:"4.02295",width:"9.89893",height:"9.89893",rx:"2",stroke:"#F9F9F9"}),I.jsx("path",{d:"M5.85547 2.07861H11.415C12.7957 2.07861 13.915 3.1979 13.915 4.57861V10.0786",stroke:"#F9F9F9",strokeLinecap:"round"})]})},"copy")]}),I.jsxs("div",{className:"border-b border-dashed border-line-divider-secondary pb-4",children:[I.jsxs("div",{className:"flex items-start",children:[I.jsx("div",{className:"w-5",children:I.jsx("img",{src:Mo,className:"w-4 h-4",alt:"Warning"})}),I.jsx("div",{className:"flex-1",children:I.jsx("p",{className:"text-xs text-functional-orange-1",children:c(a?"deposit.crossChainDepositFeeTip":"deposit.depositAllTip",{coin:t,v:e==null?void 0:e.chain})})})]}),r===Wv&&I.jsxs(I.Fragment,{children:[I.jsx("div",{className:"my-2 ml-5 h-[1px] border-b border-dashed border-line-divider-secondary"}),I.jsx("div",{className:"flex items-start pl-5 text-functional-orange-1 text-xs",children:c("deposit.addressUpdatedNotice")})]})]}),I.jsxs("div",{className:"text-sm",children:[I.jsxs("div",{className:"flex justify-between items-center h-[18px] mt-4",children:[I.jsx("span",{className:"text-text-tertiary",children:c("deposit.arrivalTime")}),I.jsx(qn,{content:I.jsxs("div",{className:"grid flex-grow max-w-[300px] min-w-[80px] rounded-2xl flex-col gap-[10px]",children:[I.jsx("p",{children:c("deposit.arrivaltimeTooltip1",{v:(e==null?void 0:e.blockTime)*e.txConfirm/60,v1:e==null?void 0:e.txConfirm})}),I.jsx("p",{children:c("deposit.arrivaltimeTooltip2")})]}),placement:"top",children:I.jsx("span",{className:"text-text-primary font-medium text-right border-b-[2px] border-dashed border-line-divider-primary decoration-dashed",children:c("deposit.arrivalEstimated",{v:(e==null?void 0:e.blockTime)*e.txConfirm/60})})})]}),I.jsxs("div",{className:"flex justify-between items-center h-[18px] mt-1",children:[I.jsx("span",{className:"text-text-tertiary",children:c("deposit.minDeposit")}),I.jsxs("span",{className:"text-text-primary font-medium text-right",children:[u," ",t]})]}),I.jsxs("div",{className:"flex justify-between items-center h-[18px] mt-1",children:[I.jsx("span",{className:"text-text-tertiary",children:c("deposit.maxDeposit")}),I.jsxs("span",{className:"text-text-primary font-medium text-right",children:["200,000 ",t]})]})]}),I.jsx("button",{className:"w-full h-[38px] bg-fill-btn-primary rounded-xl text-sm font-medium text-text-on-sec-btn mt-4",onClick:()=>{o&&o({amount:"",chainId:e.chainId,tokenAddress:n,tokenSymbol:t}),i()},children:c("deposit.title")})]})},ko=({size:e="xs",color:t,className:n="",label:r="Loading...",inline:o=!1})=>{const s=t?`loading-${t}`:"",i=o?"loading-inline":"";return I.jsx("span",{className:`loading loading-${e} loading-spinner ${s} ${i} ${n}`.trim(),"aria-label":r,role:"status","aria-live":"polite"})},JS=(e,t)=>Number(e)>Number(t),At=e=>{if(!e||e===""||isNaN(Number(e)))return"0.00";const t=Number(e);if(t===0)return"0.00";let n=t.toString();n.includes("e")&&(n=t.toFixed(20));const r=n.split("."),o=r[0];let s=r[1]||"";return s.length>6&&(s=s.substring(0,6)),s=s.replace(/0+$/,""),s?(s.length===1&&(s+="0"),o+"."+s):o+".00"},Xc=(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 Xc(a,t)}const s=parseFloat(e),i=parseFloat(t);return!isNaN(s)&&!isNaN(i)&&s>i?{isValid:!0,formattedValue:At(t),errorType:"auto_adjusted_to_max"}:{isValid:!0,formattedValue:e}},eP=(e,t,n)=>{const r=parseFloat(String(e)||"0"),o=parseFloat(String(t)||"0");if(o>0){const s=r-o,i=At(Math.max(0,s).toString());return I.jsxs("span",{className:"flex items-center gap-1",children:[At(e),I.jsx("span",{className:"text-sm font-edgex-harmony text-functional-green-1 leading-[18px] font-medium",children:"→"}),i," ",n]})}return`${At(e)} ${n}`},tP=(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)},nP=(e,t,n)=>{if(!Fh(e,n))return!1;try{const r=new Ce(t||"0"),o=new Ce("200000");return r.isNaN()||o.isNaN()?!1:r.gte(o)}catch{return!1}},rP=(e,t,n)=>{let r=t||"0";if(Fh(e,n))try{const o=new Ce(r),s=new Ce("200000");o.gt(s)&&(r="200000")}catch(o){console.warn("Error calculating max amount limit:",o)}try{const o=new Ce(r||"0");return o.isNaN()?r:o.decimalPlaces(6,Ce.ROUND_DOWN).toString()}catch{return r}},P0={chains:[],spotChains:[],currentActiveAccount:{wallet:"EVM",ethAddress:"",accountId:"",smartWalletAddress:""},defaultChainId:1,defaultAccountType:"perpetual",balances:{spot:{},perpetual:{}}};let We=null;const $0=v.forwardRef((e,t)=>{const[n,r]=v.useState(!1),[o,s]=v.useState(!1),[i,c]=v.useState(P0),a=v.useCallback(h=>{c(h),r(!0)},[]),l=v.useCallback(h=>{c(m=>({...m,...h}))},[]),u=v.useCallback(()=>{r(!1),s(!1),i.onClose&&i.onClose()},[i.onClose]),f=v.useCallback(h=>{s(h)},[]),p=v.useCallback(()=>n,[n]),d=v.useCallback(()=>o,[o]);return v.useImperativeHandle(t,()=>({openDeposit:a,closeDeposit:u,updateDepositOptions:l,setDepositLoading:f,isOpen:p,isLoading:d}),[a,u,l,f,p,d]),v.useEffect(()=>(We={openDeposit:a,closeDeposit:u,updateDepositOptions:l,setDepositLoading:f,isOpen:p,isLoading:d},()=>{We=null}),[a,u,l,f,p,d]),n?I.jsx(I0,{isOpen:n,isLoading:o,onClose:u,currentActiveAccount:i.currentActiveAccount,chains:i.chains,spotChains:i.spotChains,defaultChainId:i.defaultChainId,defaultSymbol:i.defaultSymbol,defaultAccountType:i.defaultAccountType,balances:i.balances,wagmiHooks:i.wagmiHooks,onDeposit:i.onDeposit,onCopy:i.onCopy,onChainChange:h=>{var m;return(m=i.onChainChange)==null?void 0:m.call(i,h)},onTokenChange:h=>{var m;return(m=i.onTokenChange)==null?void 0:m.call(i,h)}}):null});$0.displayName="DepositManager";const T0=e=>{if(!We){console.error("DepositManager not initialized. Make sure to render <DepositManager /> in your app.");return}We.openDeposit(e||P0)},A0=()=>{if(!We){console.error("DepositManager not initialized. Make sure to render <DepositManager /> in your app.");return}We.closeDeposit()},N0=e=>{We&&We.updateDepositOptions(e)},Ys=e=>{if(!We){console.error("DepositManager not initialized. Make sure to render <DepositManager /> in your app.");return}We.setDepositLoading(e)},oP=()=>We?We.isOpen():!1,O0=()=>We?We.isLoading():!1,sP=()=>({openDeposit:T0,closeDeposit:A0,updateDepositOptions:N0,setDepositLoading:Ys,isOpen:oP,isLoading:O0}),iP=e=>{const{t}=ht(),{isNetworkMismatch:n,depositAmount:r,approved:o,currentTokenBalance:s,selectedToken:i,showLayerZeroTip:c,minDeposit:a=10}=e;return v.useMemo(()=>{if(n)return{text:t("deposit.switchNetwork"),disabled:!0,isNetworkSwitch:!0};const l=parseFloat(r||"0"),u=a,f=tP(r,s||"0",o);return!r||l===0||!o?{text:t(c?"deposit.layerZeroDepositButton":"deposit.confirmDeposit"),disabled:!0,isNetworkSwitch:!1}:l<u?{text:t("deposit.minDepositParsed",{amount:u,token:i}),disabled:!0,isNetworkSwitch:!1}:{text:t(c?"deposit.layerZeroDepositButton":"deposit.confirmDeposit"),disabled:!f,isNetworkSwitch:!1}},[n,r,o,s,i,c,a,t])};function aP(e){const{account:t,accountChainId:n,targetChainId:r,tokenInfo:o,amount:s}=e,{useReadContract:i,useWriteContract:c,usePublicClient:a,useSwitchChain:l}=e.wagmiHooks,u=o==null?void 0:o.tokenAddress,f=(o==null?void 0:o.decimals)??18,p=o==null?void 0:o.contractAddress,d=!u||u.toLowerCase()==="0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",{switchChainAsync:h}=l(),{writeContractAsync:m}=c(),x=a(),A=i({address:u,abi:ur,functionName:"allowance",args:[Nn(t||""),p],chainId:r,query:{enabled:!!(!d&&t&&r&&u&&p)}}),w=A!=null&&A.isSuccess?A.data:void 0,T=v.useMemo(()=>{if(d)return!0;if(!A.isSuccess||w===void 0||w===0n)return!1;try{const L=h1(String(Number(s||"0")||0),Number(f));return w>=L}catch{return!1}},[d,A.isSuccess,w,s,f]),B=v.useCallback(async()=>{try{if(r&&n&&+n!=+r&&await h({chainId:+r}),!m||!x||!u||!p)return;const F=Nn(u),j=Nn(p);if((w||0n)>0n){const P=await m({abi:ur,address:F,functionName:"approve",args:[j,0n]});await x.waitForTransactionReceipt({hash:P})}const y=await m({abi:ur,address:F,functionName:"approve",args:[j,Lu]});await x.waitForTransactionReceipt({hash:y}),A!=null&&A.refetch&&await A.refetch()}catch(L){console.error("[useApprove] onApprove failed:",L)}},[r,n,u,p,w,A,m,x,h]);return{approve:T,onApprove:B}}const cP=({token:e,account:t,chainId:n,wagmiHooks:r,onResult:o})=>{var i;const s=(i=r==null?void 0:r.useBalance)==null?void 0:i.call(r,{address:t,token:e.tokenAddress,chainId:n,query:{enabled:!!t&&!!n&&!!e.tokenAddress&&!!(r!=null&&r.useBalance)}});return v.useEffect(()=>{o(Nn(e.tokenAddress),{balance:s})},[s,e.tokenAddress,o]),null},lP=({account:e,chainId:t,contractAddress:n,tokens:r=[],wagmiHooks:o})=>{var w;const s=typeof t=="string"?Number.isFinite(Number(t))?Number(t):void 0:t,i=v.useMemo(()=>{const T="0x0000000000000000000000000000000000000000",B="0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee";return r.filter(L=>{const F=L.tokenAddress;if(!F)return!1;const j=F.toLowerCase();return!(F===T||j===B)})},[r]),[c,a]=v.useState({}),l=v.useCallback((T,B)=>{a(L=>({...L,[T]:B}))},[]),u=(w=o==null?void 0:o.useBalance)==null?void 0:w.call(o,{address:e,chainId:s,query:{enabled:!!e&&!!s&&!!(o!=null&&o.useBalance)}}),[f,p]=v.useState(0),d=v.useMemo(()=>i.map(T=>v.createElement(cP,{key:`${T.tokenAddress}-${f}`,token:T,account:e,chainId:s,contractAddress:n,wagmiHooks:o,onResult:l})),[i,e,s,n,o,l,f]),h=v.useMemo(()=>{const T=u!=null&&u.data?{value:u.data.value,formatted:u.data.formatted,decimals:u.data.decimals,symbol:u.data.symbol}:{value:BigInt(0),formatted:"0",decimals:18,symbol:"ETH"},B=i.map(F=>{const j=c[Nn(F.tokenAddress)],g=j==null?void 0:j.balance,y=g==null?void 0:g.data;return{address:Nn(F.tokenAddress),value:(y==null?void 0:y.value)||BigInt(0),formatted:(y==null?void 0:y.formatted)||"0",decimals:(y==null?void 0:y.decimals)||F.decimals}}).filter(F=>F.address),L=B.reduce((F,j)=>({...F,[j.address]:{balance:j}}),{});return{balanceList:B,baseTokenBalance:T,combinedData:L}},[u,c,i]),m=v.useCallback(async()=>h,[h]),x=v.useMemo(()=>{const T=(u==null?void 0:u.isLoading)||!1,B=Object.values(c).some(L=>{var F;return(F=L.balance)==null?void 0:F.isLoading});return T||B},[u==null?void 0:u.isLoading,c]),A=v.useCallback(()=>p(T=>T+1),[]);return{multicallRun:m,multicallRefresh:A,multicallResult:h,validErcTokens:i,isLoading:x,queryComponents:d}},uP=({address:e,currentActiveChain:t,selectedToken:n,accountType:r,platformBalance:o,isLoading:s,wagmiHooks:i,onChainChange:c,onDeposit:a})=>{const{t:l}=ht(),u=i.useAccount(),f=t.tokenList.find(_=>_.token===n||_.symbol===n),p=t.chainId,[d,h]=v.useState("");v.useEffect(()=>{h("")},[n,t.chainId]);const{multicallResult:m,queryComponents:x}=lP({account:e,chainId:t.chainId,contractAddress:(f==null?void 0:f.contractAddress)||(t==null?void 0:t.contractAddress),tokens:(t==null?void 0:t.tokenList)||[],wagmiHooks:i}),A=v.useMemo(()=>{var U;if(!f)return"0";if(!f.tokenAddress||f.tokenAddress.toLowerCase()==="0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee")return m.baseTokenBalance.formatted;const _=m.combinedData[f.tokenAddress];return((U=_==null?void 0:_.balance)==null?void 0:U.formatted)||"0"},[f,m]),w="0xfd086bc7cd5c481dcc9c85ebe478a1c0b69fcbb9",T="0xceeed84620e5eb9ab1d6dfc316867d2cda332e41",B=v.useMemo(()=>{var _,U;return Rv({chain:jv,transport:mw(t.rpcUrl||((_=window==null?void 0:window.ENV)==null?void 0:_.CHAIN_RPC_URL_42161)||((U=window==null?void 0:window.ENV)==null?void 0:U.CHAIN_RPC_URL_421614))})},[t.rpcUrl]),L="1000000000000",{formatted:F}=_v({client:B,tokenAddress:w,holder:T,decimals:6,fallbackFormatted:L,pollingInterval:12e3}),[j,g]=v.useState(!1),{approve:y,onApprove:P}=aP({account:e,accountChainId:u.chainId,targetChainId:+t.chainId,tokenInfo:f,amount:d,wagmiHooks:i}),k=v.useCallback(async()=>{if(!j)try{g(!0),await P()}catch(_){console.error("Approve failed:",_)}finally{g(!1)}},[j,P]),C=v.useMemo(()=>+u.chainId!=+t.chainId,[u.chainId,t.chainId]),$=v.useCallback(async()=>{c&&c(p)},[c,p]);v.useEffect(()=>{C&&$()},[C,$]);const{showLayerZeroTip:S,layerZeroTipKey:E}=v.useMemo(()=>{const _=+t.chainId==42161||+t.chainId==421614,U=(n==null?void 0:n.toUpperCase())==="USDT",W=new Ce(d||"0"),K=new Ce("200000");let V=!1,Z;if(_&&U&&d)if(W.gte(K))V=!0,Z="deposit.layerZeroDepositTipGte200k";else{const H=F;if(typeof H=="string"&&H.length>0){const Q=new Ce(H);!Q.isNaN()&&W.gte(Q)&&(V=!0,Z="deposit.layerZeroDepositTipExceedPool")}}return{showLayerZeroTip:V,layerZeroTipKey:Z}},[t.chainId,n,d,F]),O=v.useCallback(()=>rP(+t.chainId,A||"0",n),[A,t==null?void 0:t.chainId,n]),N=v.useMemo(()=>nP(+t.chainId,d,n),[t==null?void 0:t.chainId,d,n]),b=iP({isNetworkMismatch:C,depositAmount:d,approved:y,currentTokenBalance:A,selectedToken:n,showLayerZeroTip:S,minDeposit:f!=null&&f.minDepositSize?parseFloat(f.minDepositSize):10}),M=_=>{const U=_.target.value,W=O(),K=Xc(U,W);if(K.isValid)h(K.formattedValue),K.errorType;else return K.errorType==="exceed_balance",void 0},R=v.useCallback(async()=>{Ys(!0);try{a&&a({amount:d,chainId:p,tokenAddress:(f==null?void 0:f.tokenAddress)||"",tokenSymbol:n,accountType:r})}catch(_){console.error("Deposit error:",_),Ys(!1)}},[a,d,p,f==null?void 0:f.tokenAddress,r,n]);return I.jsxs(I.Fragment,{children:[x,I.jsxs("div",{className:"bg-fill-input-primary rounded-lg px-3 py-3 my-4",children:[I.jsxs("div",{className:"flex justify-between items-center h-[18px] mb-3",children:[I.jsx("input",{type:"text",placeholder:l("deposit.amount"),value:d,onChange:M,className:"flex-1 bg-transparent text-text-primary text-sm font-medium placeholder-text-tertiary placeholder:font-normal focus:outline-none border-none p-0 h-full"}),I.jsx("button",{onClick:()=>{const _=O();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")})]}),I.jsx("div",{className:"h-[1px] bg-line-divider-secondary mb-2"}),I.jsxs("div",{className:"flex justify-between items-center",children:[I.jsx(qn,{content:l("deposit.availableDesc"),children:I.jsx("span",{className:"text-text-tertiary text-xs leading-[14px] border-b border-dashed border-line-divider-primary",children:l("deposit.available")})}),I.jsx("span",{className:"text-text-primary text-xs leading-[14px]",children:eP(A||"0",d,n)})]})]}),!y&&JS(d||"0",0)&&I.jsxs("div",{className:"flex justify-center flex-col items-center",children:[I.jsx("h3",{className:"text-text-primary text-sm leading-4 font-medium",children:l("deposit.enableSystemProWithToken",{token:n,network:t==null?void 0:t.chain})}),I.jsx("p",{className:"text-text-secondary text-xs leading-3 mt-4",children:l("deposit.enableTokenDesc",{token:n,network:t==null?void 0:t.chain})}),I.jsx("button",{className:"w-[180px] h-8 bg-fill-btn-primary hover:bg-fill-btn-primary-hover text-text-on-sec-btn rounded-xl text-sm font-medium transition-colors my-4 disabled:opacity-50 disabled:cursor-not-allowed flex items-center justify-center",onClick:k,disabled:j,children:j?I.jsx(ko,{size:"xs",inline:!0}):l("deposit.enableWithToken",{token:n})})]}),S&&I.jsxs(I.Fragment,{children:[I.jsxs("div",{className:"flex mb-4",children:[I.jsx("div",{className:"w-5",children:I.jsx("img",{src:Mo,className:"w-4 h-4",alt:"Warning"})}),I.jsx("div",{className:"flex-1 text-xs text-functional-orange-1",children:l(E||"deposit.layerZeroDepositTip")})]}),I.jsx("div",{className:"my-2 ml-5 h-[1px] border-b border-dashed border-line-divider-secondary"})]}),N&&I.jsxs("div",{className:"flex mb-4",children:[I.jsx("div",{className:"w-5",children:I.jsx("img",{src:Mo,className:"w-4 h-4",alt:"Warning"})}),I.jsx("div",{className:"flex-1 text-xs text-functional-orange-1",children:l("deposit.depositTipFor25w")})]}),N&&I.jsx("div",{className:"my-2 ml-5 h-[1px] border-b border-dashed border-line-divider-secondary"}),I.jsxs("div",{className:"flex mb-4",children:[I.jsx("div",{className:"w-5",children:!(N||S)&&I.jsx("img",{src:Mo,className:"w-4 h-4",alt:"Warning"})}),I.jsx("div",{className:"flex-1 text-xs text-functional-orange-1",children:l("deposit.noPrivateKeyWalletWarning")})]}),I.jsxs("div",{className:"border-t border-line-divider-secondary border-dashed py-4",children:[I.jsxs("div",{className:"flex justify-between items-center h-[18px] leading-4",children:[I.jsx("span",{className:"text-sm text-text-tertiary",children:l("deposit.arrivalTime")}),I.jsx(qn,{content:I.jsxs("div",{className:"grid flex-grow max-w-[300px] min-w-[80px] rounded-2xl flex-col gap-[10px]",children:[I.jsx("p",{children:l("deposit.arrivaltimeTooltip1",{v:(t==null?void 0:t.blockTime)*t.txConfirm/60,v1:t==null?void 0:t.txConfirm})}),I.jsx("p",{children:l("deposit.arrivaltimeTooltip2")})]}),placement:"top",children:I.jsx("span",{className:"text-text-primary font-medium text-right border-b-[2px] border-dashed border-line-divider-primary decoration-dashed text-sm",children:l("deposit.arrivalEstimated",{v:(t==null?void 0:t.blockTime)*t.txConfirm/60})})})]}),I.jsxs("div",{className:"flex justify-between items-center h-[18px] leading-4 mt-2",children:[I.jsx("span",{className:"text-sm text-text-tertiary",children:l("deposit.equity")}),I.jsx("span",{className:"text-sm text-text-primary font-medium",children:d?I.jsxs("span",{className:"flex items-center gap-1",children:[At(o),I.jsx("span",{className:"text-sm font-edgex-harmony text-functional-green-1 leading-[18px] font-medium",children:"→"}),At((parseFloat(o)+parseFloat(d)).toString())," ",n]}):`${At(o)} ${n}`})]})]}),I.jsxs("button",{className:`w-full h-[38px] text-sm rounded-xl font-medium transition-colors flex items-center justify-center gap-2 ${b.disabled||s?"bg-text-disabled text-text-secondary cursor-not-allowed":"bg-fill-btn-primary text-text-on-sec-btn"}`,onClick:R,disabled:b.disabled||s,children:[(s||C)&&I.jsx(ko,{size:"xs"}),b.text]})]})},C0=e=>e.toLocaleUpperCase()===bn?bn:ka,Qc=e=>C0(e.wallet)===bn,fP=e=>C0(e.wallet)===ka,I0=({isOpen:e,isLoading:t=!1,onClose:n,currentActiveAccount:r,chains:o,spotChains:s=[],defaultChainId:i,defaultSymbol:c,defaultAccountType:a="perpetual",balances:l,wagmiHooks:u,onDeposit:f,onCopy:p,onChainChange:d,onTokenChange:h})=>{const{t:m}=ht(),[x,A]=v.useState(a),w=v.useCallback(N=>N==="spot"&&s&&s.length>0?s:o,[o,s]),T=w(a),[B,L]=v.useState(()=>{var N;return!T||T.length===0?1:i||((N=T[0])==null?void 0:N.chainId)||1}),F=v.useMemo(()=>w(x),[x,w]),j=F.find(N=>N.chainId===B)||F[0],[g,y]=v.useState(()=>{var U;if(!T||T.length===0)return"";const N=i||((U=T[0])==null?void 0:U.chainId),b=T.find(W=>W.chainId===N)||T[0],M=((b==null?void 0:b.tokenList)||[]).length>0?b:T.find(W=>(W.tokenList||[]).length>0),R=(M==null?void 0:M.tokenList)||[];if(c&&R.length>0){const W=c.toUpperCase(),K=R.find(V=>(V.token||V.symbol||"").toUpperCase()===W);if(K)return K.token||K.symbol||""}const _=R[0];return(_==null?void 0:_.token)||(_==null?void 0:_.symbol)||""}),P=v.useCallback(N=>{L(N),d==null||d(N)},[d]),k=v.useCallback(N=>{y(N),h==null||h(N)},[h]),C=v.useMemo(()=>{const N=(g||"").toLowerCase();if(!N)return"0";const b=x==="spot"?l==null?void 0:l.spot:l==null?void 0:l.perpetual,M=b==null?void 0:b[N];return typeof M=="string"&&M.length>0?M:"0"},[l,x,g]),[$,S]=v.useState(!1),E=N=>{N.target===N.currentTarget?S(!0):S(!1)},O=N=>{$&&N.target===N.currentTarget&&n(),S(!1)};return e?ke.createPortal(I.jsx("div",{className:"fixed top-0 left-0 right-0 bottom-0 w-screen h-screen",style:{zIndex:98},children:I.jsx("div",{className:"fixed top-0 left-0 right-0 bottom-0 z-[99] flex items-center justify-center",style:{background:"rgba(0, 0, 0, 0.6)",backdropFilter:"blur(10px)",WebkitBackdropFilter:"blur(10px)"},onMouseDown:E,onMouseUp:O,"aria-hidden":"true",children:I.jsxs("div",{className:"relative w-[420px] max-h-[85vh] bg-fill-page-secondary overflow-auto rounded-lg p-6 shadow-xl border-[2px] border-solid border-line-divider-secondary",onClick:N=>{N.stopPropagation()},children:[I.jsxs("div",{className:"flex items-center justify-between mb-4",children:[I.jsx("h2",{className:"text-lg font-semibold text-white",children:m("deposit.title")}),I.jsx("button",{className:"text-gray-400 hover:text-gray-200 transition-colors",onClick:n,"aria-label":"Close",children:I.jsx(Ld,{className:"h-4 w-4"})})]}),I.jsx(jh,{selectedAccount:x,onAccountChange:N=>{var Z,H;const b=N||"perpetual";A(b);const M=w(b);if(!M||M.length===0)return;const R=M.find(Y=>Y.chainId===B),_=R?R.chainId:M[0].chainId;L(_),d==null||d(_);const U=M.find(Y=>Y.chainId===_),W=(U==null?void 0:U.tokenList)||[],V=W.some(Y=>(Y.symbol||Y.token)===g)?g:((Z=W[0])==null?void 0:Z.symbol)||((H=W[0])==null?void 0:H.token)||"";V&&(y(V),h==null||h(V))},className:"w-full"}),I.jsx(Rh,{currentActiveChain:j,chainList:F,onChainChange:P,curSelectToken:g,onTokenChange:k,walletType:Qc(r)?bn:ka,accountType:x}),Qc(r)&&I.jsx(QS,{address:r.smartWalletAddress,currentActiveChain:j,selectedToken:g,accountType:x,onDeposit:f,onCopy:p,onClose:n}),fP(r)&&I.jsx(uP,{address:r.ethAddress,currentActiveChain:j,selectedToken:g,accountType:x,platformBalance:C,isLoading:t,wagmiHooks:u,onChainChange:P,onDeposit:f,onClose:n})]})})}),document.body):null},dP=e=>{if(e==null||e==="")return 2;const t=String(e),n=t.indexOf(".");if(n===-1)return 0;const r=t.length-n-1;return r>0?r:2},pP=({withdrawAmount:e,curSelectToken:t,tokenInfo:n,currentActiveChain:r,platformBalance:o="0",fee:s="0.00",walletType:i="evm",receiverAddress:c="",accountType:a="perpetual",onWithdrawAmountChange:l,onReceiverAddressChange:u,onAmountChanged:f,showPoolBalanceInsufficientTip:p=!1})=>{const{t:d}=ht(),h=v.useMemo(()=>{const F=dP(n==null?void 0:n.showStepSize);if(a==="spot"||!ln(r==null?void 0:r.chainId)){const j=new Ce(e||"0").minus(s||"0").decimalPlaces(F,Ce.ROUND_DOWN);return j.isNegative()?"0.00":j.toString()}return e||"0"},[e,s,r==null?void 0:r.chainId,a,n==null?void 0:n.showStepSize]),m=v.useMemo(()=>o||"0",[o]),x=v.useMemo(()=>{const F=(n==null?void 0:n.feeRate)||(n==null?void 0:n.withdrawFeeRate)||(r==null?void 0:r.feeRate)||0;try{return new Ce(F||0).times(100).toString()}catch{return"0"}},[n==null?void 0:n.feeRate,n==null?void 0:n.withdrawFeeRate,r==null?void 0:r.feeRate]),A=v.useMemo(()=>x==="0",[x]),w=v.useMemo(()=>{const F=(t||"").toUpperCase();return F==="USDT"||F==="USDC"},[t]),T=F=>{const j=F.target.value,y=Xc(j,m||"0");if(y.isValid)l(y.formattedValue),y.errorType;else return y.errorType==="exceed_balance",void 0;f==null||f(y.formattedValue)},B=()=>{l(m),f==null||f(m)},L=()=>{const F=parseFloat(o||"0"),j=parseFloat(e||"0");if(j>0){const g=F-j,y=At(Math.max(0,g).toString());return I.jsxs("span",{className:"flex items-center gap-1",children:[At(o||"0"),I.jsx("span",{className:"text-sm font-edgex-harmony text-functional-green-1 leading-[18px] font-medium",children:"→"}),y," ",t]})}return`${At(o||"0")} ${t}`};return I.jsxs(I.Fragment,{children:[I.jsxs("div",{className:"bg-fill-input-primary rounded-lg px-3 py-3 my-4",children:[I.jsxs("div",{className:"flex justify-between items-center h-[18px] mb-3",children:[I.jsx("input",{type:"text",placeholder:d("deposit.amount"),value:e,onChange:T,className:"flex-1 bg-transparent text-text-primary text-sm font-medium placeholder-text-tertiary placeholder:font-normal focus:outline-none border-none p-0 h-full"}),I.jsx("button",{onClick:B,className:"text-theme-normal text-xs font-medium cursor-pointer hover:opacity-80 transition-opacity h-full flex items-center",children:d("deposit.max")})]}),I.jsx("div",{className:"h-[1px] bg-line-divider-secondary mb-2"}),I.jsxs("div",{className:"flex justify-between items-center",children:[I.jsx(qn,{content:d("withdraw.availableDesc"),children:I.jsx("span",{className:"text-text-tertiary text-xs leading-[14px] border-b border-dashed border-line-divider-primary",children:d("deposit.available")})}),I.jsx("span",{className:"text-text-primary text-xs leading-[14px]",children:L()})]})]}),i==="mpc"&&(a==="spot"||!ln(r==null?void 0:r.chainId))?I.jsx("div",{className:"bg-fill-input-primary rounded-lg my-4 h-9 flex items-center px-3",children:I.jsx("input",{type:"text",placeholder:d("withdraw.receiverAddress"),value:c,onChange:F=>u==null?void 0:u(F.target.value),className:"flex-1 bg-transparent text-text-primary text-sm font-medium placeholder-text-tertiary placeholder:font-normal focus:outline-none border-none p-0 h-full"})}):null,I.jsx("div",{className:"bg-fill-page-secondary rounded-lg mb-4",children:ln(r==null?void 0:r.chainId)?I.jsxs(I.Fragment,{children:[I.jsx("p",{className:"text-text-tertiary text-xs leading-[18px]",children:d("withdraw.noticeDesc")}),I.jsx("a",{className:"block text-xs leading-[18px] mt-1 text-theme-normal",href:"https://edgex-1.gitbook.io/edgeX-documentation/getting-started/deposits-and-withdrawals/withdrawals",rel:"noreferrer",target:"_blank",children:d("withdraw.commonWithdraw")})]}):I.jsx("p",{className:"text-text-tertiary text-xs leading-[18px]",children:d("withdraw.crossChainTips")})}),p&&I.jsxs("div",{className:"flex mb-4",children:[I.jsx("div",{className:"w-5",children:I.jsx("img",{src:Mo,className:"w-4 h-4",alt:"Warning"})}),I.jsx("div",{className:"flex-1 text-xs text-functional-orange-1",children:d("withdraw.poolBalanceInsufficientTip")})]}),I.jsxs("div",{className:"py-4 border-t border-line-divider-secondary border-dashed",children:[I.jsxs("div",{className:"flex items-center justify-between h-[18px] leading-[18px]",children:[I.jsx(qn,{content:I.jsxs("div",{children:[I.jsx("div",{children:d("withdraw.speedNote")}),I.jsxs("div",{className:"flex gap-1 items-center mt-1",children:[I.jsx(Oo,{selectedLevel:Tt.FAST,maxLevel:3}),I.jsx("span",{children:d("withdraw.speedNoteSpeed1")})]}),I.jsxs("div",{className:"flex gap-1 items-center mt-1",children:[I.jsx(Oo,{selectedLevel:Tt.Medium,maxLevel:3}),I.jsx("span",{children:d("withdraw.speedNoteSpeed2")})]}),I.jsxs("div",{className:"flex gap-1 items-center mt-1",children:[I.jsx(Oo,{selectedLevel:Tt.SLOW,maxLevel:3}),I.jsx("span",{children:d("withdraw.speedNoteSpeed3")})]})]}),children:I.jsx("span",{className:"text-text-tertiary text-sm leading-4 border-b border-dashed border-line-divider-primary",children:d("withdraw.speed")})}),I.jsx("div",{className:"flex items-center",children:I.jsx(Oo,{selectedLevel:ln(r==null?void 0:r.chainId)?Tt.SLOW:Tt.FAST,maxLevel:3})})]}),(a==="spot"||!ln(r==null?void 0:r.chainId))&&I.jsxs("div",{className:"flex items-center justify-between mt-2 h-[18px]",children:[A||!w?I.jsx("span",{className:"text-text-tertiary text-sm leading-4",children:A?d("withdraw.fee"):`${d("withdraw.fee")}/${d("withdraw.feeRate")}`}):I.jsx(qn,{className:"w-[320px] font-normal flex items-center justify-center",content:I.jsx("span",{className:"flex items-center justify-center text-center",children:d("withdraw.feeCalculationTip")}),children:I.jsx("span",{className:"text-text-tertiary text-sm leading-4 border-b border-dashed border-line-divider-primary",children:`${d("withdraw.fee")}/${d("withdraw.feeRate")}`})}),I.jsxs("span",{className:"text-text-primary text-sm leading-4 font-medium",children:[s," ",t,!A&&` / ${x}%`]})]}),I.jsxs("div",{className:"flex items-center justify-between mt-2 h-[18px]",children:[I.jsx("span",{className:"text-text-tertiary text-sm leading-4",children:d(ln(r==null?void 0:r.chainId)?"withdraw.withdrawlAmount":"withdraw.amountToReceive")}),I.jsxs("span",{className:"text-text-primary text-sm leading-4 font-medium",children:[At(h)," ",t]})]})]})]})},hP=[];let Ve=null;const M0=v.forwardRef((e,t)=>{const[n,r]=v.useState(!1),[o,s]=v.useState(!1),[i,c]=v.useState({chains:[],currentActiveAccount:{wallet:"EVM",ethAddress:"",accountId:"",smartWalletAddress:""}}),a=v.useCallback(h=>{c(h||{chains:[],currentActiveAccount:{wallet:"EVM",ethAddress:"",accountId:"",smartWalletAddress:""}}),r(!0)},[]),l=v.useCallback(h=>{c(m=>({...m,...h}))},[]),u=v.useCallback(()=>{r(!1),s(!1),i.onClose&&i.onClose()},[i.onClose]),f=v.useCallback(h=>{s(h)},[]),p=v.useCallback(()=>n,[n]),d=v.useCallback(()=>o,[o]);return v.useImperativeHandle(t,()=>({openWithdraw:a,closeWithdraw:u,updateWithdrawOptions:l,setWithdrawLoading:f,isOpen:p,isLoading:d}),[a,u,l,f,p,d]),v.useEffect(()=>(Ve={openWithdraw:a,closeWithdraw:u,updateWithdrawOptions:l,setWithdrawLoading:f,isOpen:p,isLoading:d},()=>{Ve=null}),[a,u,l,f,p,d]),n?I.jsx(F0,{isOpen:n,isLoading:o,onClose:u,config:i.config||{symbol:"USDT"},currentActiveAccount:i.currentActiveAccount,chains:i.chains||hP,spotChains:i.spotChains,balances:i.balances,defaultChainId:i.defaultChainId,defaultSymbol:i.defaultSymbol,defaultAmount:i.defaultAmount,defaultAccountType:i.defaultAccountType,currentEquity:i.currentEquity??5e3,platformBalance:i.platformBalance||"0",fee:i.fee,wagmiHooks:i.wagmiHooks,onWithdraw:i.onWithdraw,onAccountChange:i.onAccountChange,onChainChange:i.onChainChange,onTokenChange:i.onTokenChange,onAmountChanged:i.onAmountChanged}):null});M0.displayName="WithdrawManager";const k0=e=>{if(!Ve){console.error("WithdrawManager not initialized. Make sure to render <WithdrawManager /> in your app.");return}Ve.openWithdraw(e||{chains:[],currentActiveAccount:{wallet:"EVM",ethAddress:"",accountId:"",smartWalletAddress:""}})},B0=()=>{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)},Xs=e=>{if(!Ve){console.error("WithdrawManager not initialized. Make sure to render <WithdrawManager /> in your app.");return}Ve.setWithdrawLoading(e)},mP=()=>Ve?Ve.isOpen():!1,D0=()=>Ve?Ve.isLoading():!1,gP=()=>({openWithdraw:k0,closeWithdraw:B0,updateWithdrawOptions:L0,setWithdrawLoading:Xs,isOpen:mP,isLoading:D0}),bP=({walletType:e,chains:t,spotChains:n=[],defaultChainId:r,defaultSymbol:o,defaultAmount:s="",defaultAccountType:i="perpetual",currentEquity:c,platformBalance:a="0",balances:l,fee:u="0.00",isLoading:f=!1,onWithdraw:p,onClose:d,onChainChange:h,onTokenChange:m,onAmountChanged:x,onAccountChange:A})=>{var Z;const{t:w}=ht(),[T,B]=v.useState(i),L=v.useCallback(H=>H==="spot"&&n&&n.length>0?n:t,[t,n]),F=v.useMemo(()=>L(T),[T,L]),j=v.useMemo(()=>{if(!F||F.length===0)return{chainId:1,tokenSymbol:""};const H=pe=>{const le=pe||[];if(!le.length)return"";const oe="USDC".toUpperCase(),Sn=le.find(ft=>(ft.token||ft.symbol||"").toUpperCase()===oe)||le[0];return Sn.token||Sn.symbol||""};if(o){const pe=o==null?void 0:o.toUpperCase();for(const le of F){const ge=le.tokenList||[];let oe;if(pe&&(oe=ge.find(Ge=>(Ge.token||Ge.symbol||"").toUpperCase()===pe)),oe){const Ge=oe.token||oe.symbol||o||"";return{chainId:le.chainId,tokenSymbol:Ge}}}}if(r){const pe=F.find(oe=>oe.chainId===r)||F[0],le=pe.tokenList||[],ge=H(le);return{chainId:pe.chainId,tokenSymbol:ge}}const Y="USDC",Q=pe=>Array.isArray(pe.tokenList)&&pe.tokenList.some(le=>(le.token||le.symbol||"").toUpperCase()===Y),se=F.find(Q)||F[0];if(!se)return{chainId:1,tokenSymbol:""};const me=H(se.tokenList);return{chainId:se.chainId,tokenSymbol:me}},[F,r,o]),[g,y]=v.useState(()=>j.chainId),[P,k]=v.useState(()=>j.tokenSymbol),[C,$]=v.useState(s),[S,E]=v.useState(""),O=v.useCallback(H=>{y(H),h==null||h(H)},[h]),N=v.useCallback(H=>{k(H),m==null||m(H)},[m]),b=v.useRef(!0),M=v.useRef(P),R=v.useRef(g);v.useEffect(()=>{if(b.current){b.current=!1,M.current=P,R.current=g;return}(M.current!==P||R.current!==g)&&($(""),M.current=P,R.current=g)},[P,g]);const _=F&&F.length>0?F.find(H=>H.chainId===g)||F[0]:null,U=(Z=_==null?void 0:_.tokenList)==null?void 0:Z.find(H=>H.token===P),W=v.useMemo(()=>{const H=new Ce(C||"0"),Y=new Ce(u||"0"),Q=ln(g);return U!=null&&U.minWithdrawSize&&H.lt(U.minWithdrawSize)?{text:w("withdraw.minWithdrawParsed",{amount:U.minWithdrawSize,token:U.symbol||U.token}),disabled:!0}:!C||H.isZero()||!Q&&H.isLessThan(Y)?{text:w("withdraw.confirmWithdraw"),disabled:!0}:e==="mpc"&&(!Q||T==="spot")&&!S.trim()?{text:w("withdraw.invalidReceiverAddress"),disabled:!0}:{text:w("withdraw.confirmWithdraw"),disabled:!1}},[w,g,C,e,S,u,T,U]),K=v.useMemo(()=>{const H=(P||"").toLowerCase();if(!H)return a||"0";const Y=T==="spot"?l==null?void 0:l.spot:l==null?void 0:l.perpetual,Q=Y==null?void 0:Y[H];return typeof Q=="string"&&Q.length>0?Q:a||"0"},[l,T,P,a]),V=v.useCallback(async()=>{Xs(!0);try{if(p){const Y={amount:new Ce(C||"0").toString(),chainId:g,tokenAddress:(U==null?void 0:U.tokenAddress)||"",coinId:(U==null?void 0:U.coinId)||"",tokenSymbol:P,accountType:T,selectedToken:U};e==="mpc"&&(!ln(g)||T==="spot")&&(Y.receiverAddress=S),p(Y)}}catch{Xs(!1)}},[p,T,U,C,g,P,e,S]);return!F||F.length===0?I.jsx("div",{className:"text-center py-8",children:I.jsx("p",{className:"text-gray-400",children:"No chains available"})}):_?I.jsxs(I.Fragment,{children:[I.jsx(jh,{selectedAccount:T,onAccountChange:H=>{var Ge,Sn;const Y=H||"perpetual";B(Y),A==null||A(Y);const Q=L(Y);if(!Q||Q.length===0)return;const se=Q.find(ft=>ft.chainId===g),me=se?se.chainId:Q[0].chainId;y(me),h==null||h(me);const pe=Q.find(ft=>ft.chainId===me),le=(pe==null?void 0:pe.tokenList)||[],oe=le.some(ft=>(ft.symbol||ft.token)===P)?P:((Ge=le[0])==null?void 0:Ge.symbol)||((Sn=le[0])==null?void 0:Sn.token)||"";oe&&(k(oe),m==null||m(oe))},className:"w-full"}),I.jsx(Rh,{currentActiveChain:_,chainList:F,onChainChange:O,curSelectToken:P,onTokenChange:N,walletType:"EVM",txType:"withdraw"}),I.jsx(pP,{withdrawAmount:C,curSelectToken:P,tokenInfo:U,curSelectTokenData:{balance:U==null?void 0:U.balance,allowance:U==null?void 0:U.allowance},currentActiveChain:_,currentEquity:c||0,decimals:(U==null?void 0:U.decimals)||6,platformBalance:K,fee:u,walletType:e,accountType:T,receiverAddress:S,onWithdrawAmountChange:$,onReceiverAddressChange:E,onAmountChanged:x}),I.jsxs("button",{className:`w-full h-[38px] text-sm rounded-xl font-medium transition-colors flex items-center justify-center gap-2 ${W.disabled||f?"bg-text-disabled text-text-secondary cursor-not-allowed":"bg-fill-btn-primary text-text-on-sec-btn"}`,onClick:V,disabled:W.disabled||f,children:[f&&I.jsx(ko,{size:"xs"}),W.text]})]}):I.jsx("div",{className:"text-center py-8",children:I.jsx("p",{className:"text-gray-400",children:"Loading..."})})},F0=({isOpen:e,isLoading:t=!1,defaultAccountType:n="perpetual",onClose:r,config:o,currentActiveAccount:s,chains:i,spotChains:c=[],defaultChainId:a,defaultSymbol:l,defaultAmount:u="",currentEquity:f=5e3,platformBalance:p="0",balances:d,fee:h,wagmiHooks:m,onWithdraw:x,onChainChange:A,onTokenChange:w,onAmountChanged:T,onAccountChange:B})=>{const{t:L}=ht(),[F,j]=v.useState(!1),g=P=>{P.target===P.currentTarget?j(!0):j(!1)},y=P=>{F&&P.target===P.currentTarget&&r(),j(!1)};return e?ke.createPortal(I.jsx("div",{className:"fixed top-0 left-0 right-0 bottom-0 w-screen h-screen",style:{zIndex:98},children:I.jsx("div",{className:"fixed top-0 left-0 right-0 bottom-0 z-[99] flex items-center justify-center",style:{background:"rgba(0, 0, 0, 0.6)",backdropFilter:"blur(10px)",WebkitBackdropFilter:"blur(10px)"},onMouseDown:g,onMouseUp:y,"aria-hidden":"true",children:I.jsxs("div",{className:"relative w-[420px] max-h-[85vh] bg-fill-page-secondary overflow-auto rounded-lg p-6 shadow-xl",onClick:P=>{P.stopPropagation()},children:[I.jsxs("div",{className:"flex items-center justify-between mb-4",children:[I.jsx("h2",{className:"text-lg font-semibold text-white",children:L("withdraw.withdraw")}),I.jsx("button",{className:"text-gray-400 hover:text-gray-200 transition-colors",onClick:r,"aria-label":"Close",children:I.jsx(Ld,{className:"h-4 w-4"})})]}),I.jsx(bP,{chains:i,spotChains:c,walletType:Qc(s)?"mpc":"evm",defaultChainId:a,defaultSymbol:l,defaultAmount:u,defaultAccountType:n,currentEquity:f,platformBalance:p,balances:d,fee:h,isLoading:t,wagmiHooks:m,onWithdraw:x,onClose:r,onChainChange:A,onTokenChange:w,onAmountChanged:T,onAccountChange:B})]})})}),document.body):null};re.ChromeLoader=ko,re.ComponentProvider=cm,re.DEFAULT_LOCALE=Lo,re.Deposit=I0,re.DepositManager=$0,re.LOCALE_NAMES=sm,re.LoadingSpinner=ko,re.SUPPORTED_LOCALES=ei,re.Tooltip=qn,re.Withdraw=F0,re.WithdrawManager=M0,re.closeDeposit=A0,re.closeWithdraw=B0,re.formatThousands=um,re.isDepositLoading=O0,re.isWithdrawLoading=D0,re.openDeposit=T0,re.openWithdraw=k0,re.setDepositLoading=Ys,re.setWithdrawLoading=Xs,re.updateDepositOptions=N0,re.updateWithdrawOptions=L0,re.useComponentConfig=fl,re.useDeposit=Uv,re.useDepositManager=sP,re.useTranslation=ht,re.useWithdraw=zv,re.useWithdrawManager=gP,Object.defineProperty(re,Symbol.toStringTag,{value:"Module"})});
176
+ `,children:[t,o&&I.jsx(S0,{ref:f,placement:h.placement||n})]})})]})},Mo="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAACXBIWXMAABYlAAAWJQFJUiTwAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAIcSURBVHgBxZc/T8JAGMafA4mDEXFw0DiQmDi4CP5JHGFx0qizg8QvIHwCZHYAvwEm7mji5CJuJv7DxcWYYMLmIEYXY/R8j6tQaBvuaCm/pOlbSu99+rZ97zlgwDBowvNLCdrF6NJ50891OvNC+wrL3JShgZIAnl+JAj97FKXoMNLl7ySGnQDBHMtcVeFGAM8nKNlnlsI0eoIVuwlhzsmXqcwoURSFK1iVRCSdRDDn5PwC3cutingsJOK60nkiYE0unrdi8uFRIDwFBSJiTKOqzgKMl00teXgS2D0Fto+BiVkoIMYs8Xws4iiAkmeVn/n0oqyA2NQEQI4dytoKMEqfQt/haZmrQ4C8e7/4TtsI4JvwDbYDswCjvXr1yakQMXI2KxCD/8RMAtx2ux5gcjIzBAT8LH8bAQwYbwR8fUAb/vtuEsAr0OX5Eng8o30ZqN1BHzFLAkPGkb4AcdfnObigkbM5HdN3+Qb/ekGdrNu4CMyd8Ag6iElo/QBYzcpYByYsm8QkIFSADmI2nEkAc2sUL0ALHsxZBEjLxA+hSu22tb0+KV9Gd18027M2SybNQui+f53R6g/b+gDLVMi7YQsND+c5dTtzamlE0jiyJLwVYZhSqzO27YRSxFD8v1m4Q4xh74gdBUgRQm2QKsH0Ps82xEs9EndK3sgDlWGkW96naANqSzMSHSy4XprZi2kuTqN09VjrBH9AD4vTgfMHJt+rxIFF7EgAAAAASUVORK5CYII=",QS=({currentActiveChain:e,selectedToken:t,address:n,accountType:r,onDeposit:o,onCopy:s,onClose:i})=>{const{t:c}=ht(),a=v.useMemo(()=>{if(!e)return!1;const f=r===Hv,p=Number(e.chainId),d=!Number.isNaN(p)&&(p===42161||p===421614),h=(t||"").toUpperCase()==="ETH";return f&&d&&h},[r,e,t]),l=v.useMemo(()=>{var f;return(f=e==null?void 0:e.tokenList)==null?void 0:f.find(p=>p.token===t||p.symbol===t)},[e,t]),u=(l==null?void 0:l.minDepositSize)||"10";return I.jsxs(I.Fragment,{children:[I.jsx("div",{className:"flex justify-center mt-4 mb-3",children:n&&I.jsx("div",{className:"bg-white rounded-lg",children:I.jsx(o0,{value:n,size:120,level:"L",bgColor:"#ffffff",fgColor:"#000000",marginSize:0})})}),n&&I.jsxs("div",{className:"flex items-center justify-between bg-fill-input-primary rounded-lg py-2 px-3 mb-3",children:[I.jsx("span",{className:"flex-1 text-text-primary text-sm font-medium break-all mr-3",children:n}),I.jsx(rS,{onCopy:()=>{s&&s(n)},text:n,children:I.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:[I.jsx("rect",{x:"2.08496",y:"4.02295",width:"9.89893",height:"9.89893",rx:"2",stroke:"#F9F9F9"}),I.jsx("path",{d:"M5.85547 2.07861H11.415C12.7957 2.07861 13.915 3.1979 13.915 4.57861V10.0786",stroke:"#F9F9F9",strokeLinecap:"round"})]})},"copy")]}),I.jsxs("div",{className:"border-b border-dashed border-line-divider-secondary pb-4",children:[I.jsxs("div",{className:"flex items-start",children:[I.jsx("div",{className:"w-5",children:I.jsx("img",{src:Mo,className:"w-4 h-4",alt:"Warning"})}),I.jsx("div",{className:"flex-1",children:I.jsx("p",{className:"text-xs text-functional-orange-1",children:c(a?"deposit.crossChainDepositFeeTip":"deposit.depositAllTip",{coin:t,v:e==null?void 0:e.chain})})})]}),r===Wv&&I.jsxs(I.Fragment,{children:[I.jsx("div",{className:"my-2 ml-5 h-[1px] border-b border-dashed border-line-divider-secondary"}),I.jsx("div",{className:"flex items-start pl-5 text-functional-orange-1 text-xs",children:c("deposit.addressUpdatedNotice")})]})]}),I.jsxs("div",{className:"text-sm",children:[I.jsxs("div",{className:"flex justify-between items-center h-[18px] mt-4",children:[I.jsx("span",{className:"text-text-tertiary",children:c("deposit.arrivalTime")}),I.jsx(qn,{content:I.jsxs("div",{className:"grid flex-grow max-w-[300px] min-w-[80px] rounded-2xl flex-col gap-[10px]",children:[I.jsx("p",{children:c("deposit.arrivaltimeTooltip1",{v:(e==null?void 0:e.blockTime)*e.txConfirm/60,v1:e==null?void 0:e.txConfirm})}),I.jsx("p",{children:c("deposit.arrivaltimeTooltip2")})]}),placement:"top",children:I.jsx("span",{className:"text-text-primary font-medium text-right border-b-[2px] border-dashed border-line-divider-primary decoration-dashed",children:c("deposit.arrivalEstimated",{v:(e==null?void 0:e.blockTime)*e.txConfirm/60})})})]}),I.jsxs("div",{className:"flex justify-between items-center h-[18px] mt-1",children:[I.jsx("span",{className:"text-text-tertiary",children:c("deposit.minDeposit")}),I.jsxs("span",{className:"text-text-primary font-medium text-right",children:[u," ",t]})]}),I.jsxs("div",{className:"flex justify-between items-center h-[18px] mt-1",children:[I.jsx("span",{className:"text-text-tertiary",children:c("deposit.maxDeposit")}),I.jsxs("span",{className:"text-text-primary font-medium text-right",children:["200,000 ",t]})]})]}),I.jsx("button",{className:"w-full h-[38px] bg-fill-btn-primary rounded-xl text-sm font-medium text-text-on-sec-btn mt-4",onClick:()=>{o&&o({amount:"",chainId:e.chainId,tokenAddress:n,tokenSymbol:t}),i()},children:c("deposit.title")})]})},ko=({size:e="xs",color:t,className:n="",label:r="Loading...",inline:o=!1})=>{const s=t?`loading-${t}`:"",i=o?"loading-inline":"";return I.jsx("span",{className:`loading loading-${e} loading-spinner ${s} ${i} ${n}`.trim(),"aria-label":r,role:"status","aria-live":"polite"})},JS=(e,t)=>Number(e)>Number(t),At=e=>{if(!e||e===""||isNaN(Number(e)))return"0.00";const t=Number(e);if(t===0)return"0.00";let n=t.toString();n.includes("e")&&(n=t.toFixed(20));const r=n.split("."),o=r[0];let s=r[1]||"";return s.length>6&&(s=s.substring(0,6)),s=s.replace(/0+$/,""),s?(s.length===1&&(s+="0"),o+"."+s):o+".00"},Ys=(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 Ys(a,t)}const s=parseFloat(e),i=parseFloat(t);return!isNaN(s)&&!isNaN(i)&&s>i?{isValid:!0,formattedValue:At(t),errorType:"auto_adjusted_to_max"}:{isValid:!0,formattedValue:e}},eP=(e,t,n)=>{const r=parseFloat(String(e)||"0"),o=parseFloat(String(t)||"0");if(o>0){const s=r-o,i=At(Math.max(0,s).toString());return I.jsxs("span",{className:"flex items-center gap-1",children:[At(e),I.jsx("span",{className:"text-sm font-edgex-harmony text-functional-green-1 leading-[18px] font-medium",children:"→"}),i," ",n]})}return`${At(e)} ${n}`},tP=(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)},nP=(e,t,n)=>{if(!Fh(e,n))return!1;try{const r=new Ce(t||"0"),o=new Ce("200000");return r.isNaN()||o.isNaN()?!1:r.gte(o)}catch{return!1}},rP=(e,t,n)=>{let r=t||"0";if(Fh(e,n))try{const o=new Ce(r),s=new Ce("200000");o.gt(s)&&(r="200000")}catch(o){console.warn("Error calculating max amount limit:",o)}try{const o=new Ce(r||"0");return console.log("bn:",o),console.log("bn:",o.isNaN()),o.isNaN()?r:o.decimalPlaces(6,Ce.ROUND_DOWN).toString()}catch{return r}},P0={chains:[],spotChains:[],currentActiveAccount:{wallet:"EVM",ethAddress:"",accountId:"",smartWalletAddress:""},defaultChainId:1,defaultAccountType:"perpetual",balances:{spot:{},perpetual:{}}};let We=null;const $0=v.forwardRef((e,t)=>{const[n,r]=v.useState(!1),[o,s]=v.useState(!1),[i,c]=v.useState(P0),a=v.useCallback(h=>{c(h),r(!0)},[]),l=v.useCallback(h=>{c(m=>({...m,...h}))},[]),u=v.useCallback(()=>{r(!1),s(!1),i.onClose&&i.onClose()},[i.onClose]),f=v.useCallback(h=>{s(h)},[]),p=v.useCallback(()=>n,[n]),d=v.useCallback(()=>o,[o]);return v.useImperativeHandle(t,()=>({openDeposit:a,closeDeposit:u,updateDepositOptions:l,setDepositLoading:f,isOpen:p,isLoading:d}),[a,u,l,f,p,d]),v.useEffect(()=>(We={openDeposit:a,closeDeposit:u,updateDepositOptions:l,setDepositLoading:f,isOpen:p,isLoading:d},()=>{We=null}),[a,u,l,f,p,d]),n?I.jsx(I0,{isOpen:n,isLoading:o,onClose:u,currentActiveAccount:i.currentActiveAccount,chains:i.chains,spotChains:i.spotChains,defaultChainId:i.defaultChainId,defaultSymbol:i.defaultSymbol,defaultAccountType:i.defaultAccountType,balances:i.balances,wagmiHooks:i.wagmiHooks,onDeposit:i.onDeposit,onCopy:i.onCopy,onChainChange:h=>{var m;return(m=i.onChainChange)==null?void 0:m.call(i,h)},onTokenChange:h=>{var m;return(m=i.onTokenChange)==null?void 0:m.call(i,h)}}):null});$0.displayName="DepositManager";const T0=e=>{if(!We){console.error("DepositManager not initialized. Make sure to render <DepositManager /> in your app.");return}We.openDeposit(e||P0)},A0=()=>{if(!We){console.error("DepositManager not initialized. Make sure to render <DepositManager /> in your app.");return}We.closeDeposit()},N0=e=>{We&&We.updateDepositOptions(e)},Xs=e=>{if(!We){console.error("DepositManager not initialized. Make sure to render <DepositManager /> in your app.");return}We.setDepositLoading(e)},oP=()=>We?We.isOpen():!1,O0=()=>We?We.isLoading():!1,sP=()=>({openDeposit:T0,closeDeposit:A0,updateDepositOptions:N0,setDepositLoading:Xs,isOpen:oP,isLoading:O0}),iP=e=>{const{t}=ht(),{isNetworkMismatch:n,depositAmount:r,approved:o,currentTokenBalance:s,selectedToken:i,showLayerZeroTip:c,minDeposit:a=10}=e;return v.useMemo(()=>{if(n)return{text:t("deposit.switchNetwork"),disabled:!0,isNetworkSwitch:!0};const l=parseFloat(r||"0"),u=a,f=tP(r,s||"0",o);return!r||l===0||!o?{text:t(c?"deposit.layerZeroDepositButton":"deposit.confirmDeposit"),disabled:!0,isNetworkSwitch:!1}:l<u?{text:t("deposit.minDepositParsed",{amount:u,token:i}),disabled:!0,isNetworkSwitch:!1}:{text:t(c?"deposit.layerZeroDepositButton":"deposit.confirmDeposit"),disabled:!f,isNetworkSwitch:!1}},[n,r,o,s,i,c,a,t])};function aP(e){const{account:t,accountChainId:n,targetChainId:r,tokenInfo:o,amount:s}=e,{useReadContract:i,useWriteContract:c,usePublicClient:a,useSwitchChain:l}=e.wagmiHooks,u=o==null?void 0:o.tokenAddress,f=(o==null?void 0:o.decimals)??18,p=o==null?void 0:o.contractAddress,d=!u||u.toLowerCase()==="0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",{switchChainAsync:h}=l(),{writeContractAsync:m}=c(),x=a(),A=i({address:u,abi:ur,functionName:"allowance",args:[Nn(t||""),p],chainId:r,query:{enabled:!!(!d&&t&&r&&u&&p)}}),w=A!=null&&A.isSuccess?A.data:void 0,T=v.useMemo(()=>{if(d)return!0;if(!A.isSuccess||w===void 0||w===0n)return!1;try{const L=h1(String(Number(s||"0")||0),Number(f));return w>=L}catch{return!1}},[d,A.isSuccess,w,s,f]),B=v.useCallback(async()=>{try{if(r&&n&&+n!=+r&&await h({chainId:+r}),!m||!x||!u||!p)return;const F=Nn(u),_=Nn(p);if((w||0n)>0n){const P=await m({abi:ur,address:F,functionName:"approve",args:[_,0n]});await x.waitForTransactionReceipt({hash:P})}const y=await m({abi:ur,address:F,functionName:"approve",args:[_,Lu]});await x.waitForTransactionReceipt({hash:y}),A!=null&&A.refetch&&await A.refetch()}catch(L){console.error("[useApprove] onApprove failed:",L)}},[r,n,u,p,w,A,m,x,h]);return{approve:T,onApprove:B}}const cP=({token:e,account:t,chainId:n,wagmiHooks:r,onResult:o})=>{var i;const s=(i=r==null?void 0:r.useBalance)==null?void 0:i.call(r,{address:t,token:e.tokenAddress,chainId:n,query:{enabled:!!t&&!!n&&!!e.tokenAddress&&!!(r!=null&&r.useBalance)}});return v.useEffect(()=>{o(Nn(e.tokenAddress),{balance:s})},[s,e.tokenAddress,o]),null},lP=({account:e,chainId:t,contractAddress:n,tokens:r=[],wagmiHooks:o})=>{var w;const s=typeof t=="string"?Number.isFinite(Number(t))?Number(t):void 0:t,i=v.useMemo(()=>{const T="0x0000000000000000000000000000000000000000",B="0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee";return r.filter(L=>{const F=L.tokenAddress;if(!F)return!1;const _=F.toLowerCase();return!(F===T||_===B)})},[r]),[c,a]=v.useState({}),l=v.useCallback((T,B)=>{a(L=>({...L,[T]:B}))},[]),u=(w=o==null?void 0:o.useBalance)==null?void 0:w.call(o,{address:e,chainId:s,query:{enabled:!!e&&!!s&&!!(o!=null&&o.useBalance)}}),[f,p]=v.useState(0),d=v.useMemo(()=>i.map(T=>v.createElement(cP,{key:`${T.tokenAddress}-${f}`,token:T,account:e,chainId:s,contractAddress:n,wagmiHooks:o,onResult:l})),[i,e,s,n,o,l,f]),h=v.useMemo(()=>{const T=u!=null&&u.data?{value:u.data.value,formatted:u.data.formatted,decimals:u.data.decimals,symbol:u.data.symbol}:{value:BigInt(0),formatted:"0",decimals:18,symbol:"ETH"},B=i.map(F=>{const _=c[Nn(F.tokenAddress)],g=_==null?void 0:_.balance,y=g==null?void 0:g.data;return{address:Nn(F.tokenAddress),value:(y==null?void 0:y.value)||BigInt(0),formatted:(y==null?void 0:y.formatted)||"0",decimals:(y==null?void 0:y.decimals)||F.decimals}}).filter(F=>F.address),L=B.reduce((F,_)=>({...F,[_.address]:{balance:_}}),{});return{balanceList:B,baseTokenBalance:T,combinedData:L}},[u,c,i]),m=v.useCallback(async()=>h,[h]),x=v.useMemo(()=>{const T=(u==null?void 0:u.isLoading)||!1,B=Object.values(c).some(L=>{var F;return(F=L.balance)==null?void 0:F.isLoading});return T||B},[u==null?void 0:u.isLoading,c]),A=v.useCallback(()=>p(T=>T+1),[]);return{multicallRun:m,multicallRefresh:A,multicallResult:h,validErcTokens:i,isLoading:x,queryComponents:d}},uP=({address:e,currentActiveChain:t,selectedToken:n,accountType:r,platformBalance:o,isLoading:s,wagmiHooks:i,onChainChange:c,onDeposit:a})=>{const{t:l}=ht(),u=i.useAccount(),f=t.tokenList.find(j=>j.token===n||j.symbol===n),p=t.chainId,[d,h]=v.useState("");v.useEffect(()=>{h("")},[n,t.chainId]);const{multicallResult:m,queryComponents:x}=lP({account:e,chainId:t.chainId,contractAddress:(f==null?void 0:f.contractAddress)||(t==null?void 0:t.contractAddress),tokens:(t==null?void 0:t.tokenList)||[],wagmiHooks:i}),A=v.useMemo(()=>{var W;if(!f)return"0";if(!f.tokenAddress||f.tokenAddress.toLowerCase()==="0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee")return m.baseTokenBalance.formatted;const j=m.combinedData[f.tokenAddress];return((W=j==null?void 0:j.balance)==null?void 0:W.formatted)||"0"},[f,m]),w="0xfd086bc7cd5c481dcc9c85ebe478a1c0b69fcbb9",T="0xceeed84620e5eb9ab1d6dfc316867d2cda332e41",B=v.useMemo(()=>{var j,W;return Rv({chain:jv,transport:mw(t.rpcUrl||((j=window==null?void 0:window.ENV)==null?void 0:j.CHAIN_RPC_URL_42161)||((W=window==null?void 0:window.ENV)==null?void 0:W.CHAIN_RPC_URL_421614))})},[t.rpcUrl]),L="1000000000000",{formatted:F}=_v({client:B,tokenAddress:w,holder:T,decimals:6,fallbackFormatted:L,pollingInterval:12e3}),[_,g]=v.useState(!1),{approve:y,onApprove:P}=aP({account:e,accountChainId:u.chainId,targetChainId:+t.chainId,tokenInfo:f,amount:d,wagmiHooks:i}),k=v.useCallback(async()=>{if(!_)try{g(!0),await P()}catch(j){console.error("Approve failed:",j)}finally{g(!1)}},[_,P]),C=v.useMemo(()=>+u.chainId!=+t.chainId,[u.chainId,t.chainId]),$=v.useCallback(async()=>{c&&c(p)},[c,p]);v.useEffect(()=>{C&&$()},[C,$]);const{showLayerZeroTip:S,layerZeroTipKey:E}=v.useMemo(()=>{const j=+t.chainId==42161||+t.chainId==421614,W=(n==null?void 0:n.toUpperCase())==="USDT",K=new Ce(d||"0"),V=new Ce("200000");let Z=!1,H;if(j&&W&&d)if(K.gte(V))Z=!0,H="deposit.layerZeroDepositTipGte200k";else{const Y=F;if(typeof Y=="string"&&Y.length>0){const oe=new Ce(Y);!oe.isNaN()&&K.gte(oe)&&(Z=!0,H="deposit.layerZeroDepositTipExceedPool")}}return{showLayerZeroTip:Z,layerZeroTipKey:H}},[t.chainId,n,d,F]),O=v.useCallback(()=>rP(+t.chainId,A||"0",n),[A,t==null?void 0:t.chainId,n]),N=v.useMemo(()=>nP(+t.chainId,d,n),[t==null?void 0:t.chainId,d,n]),b=v.useMemo(()=>r==="spot"?"deposit.maxDepositSplitTip":"deposit.depositTipFor25w",[r]),M=iP({isNetworkMismatch:C,depositAmount:d,approved:y,currentTokenBalance:A,selectedToken:n,showLayerZeroTip:S,minDeposit:f!=null&&f.minDepositSize?parseFloat(f.minDepositSize):10}),R=j=>{const W=j.target.value,K=O(),V=Ys(W,K);if(V.isValid)h(V.formattedValue),V.errorType;else return V.errorType==="exceed_balance",void 0},U=v.useCallback(async()=>{Xs(!0);try{a&&a({amount:d,chainId:p,tokenAddress:(f==null?void 0:f.tokenAddress)||"",tokenSymbol:n,accountType:r})}catch(j){console.error("Deposit error:",j),Xs(!1)}},[a,d,p,f==null?void 0:f.tokenAddress,r,n]);return I.jsxs(I.Fragment,{children:[x,I.jsxs("div",{className:"bg-fill-input-primary rounded-lg px-3 py-3 my-4",children:[I.jsxs("div",{className:"flex justify-between items-center h-[18px] mb-3",children:[I.jsx("input",{type:"text",placeholder:l("deposit.amount"),value:d,onChange:R,className:"flex-1 bg-transparent text-text-primary text-sm font-medium placeholder-text-tertiary placeholder:font-normal focus:outline-none border-none p-0 h-full"}),I.jsx("button",{onClick:()=>{const j=O();h(j)},className:"text-theme-normal text-xs font-medium cursor-pointer hover:opacity-80 transition-opacity h-full flex items-center",children:l("deposit.max")})]}),I.jsx("div",{className:"h-[1px] bg-line-divider-secondary mb-2"}),I.jsxs("div",{className:"flex justify-between items-center",children:[I.jsx(qn,{content:l("deposit.availableDesc"),children:I.jsx("span",{className:"text-text-tertiary text-xs leading-[14px] border-b border-dashed border-line-divider-primary",children:l("deposit.available")})}),I.jsx("span",{className:"text-text-primary text-xs leading-[14px]",children:eP(A||"0",d,n)})]})]}),!y&&JS(d||"0",0)&&I.jsxs("div",{className:"flex justify-center flex-col items-center",children:[I.jsx("h3",{className:"text-text-primary text-sm leading-4 font-medium",children:l("deposit.enableSystemProWithToken",{token:n,network:t==null?void 0:t.chain})}),I.jsx("p",{className:"text-text-secondary text-xs leading-3 mt-4",children:l("deposit.enableTokenDesc",{token:n,network:t==null?void 0:t.chain})}),I.jsx("button",{className:"w-[180px] h-8 bg-fill-btn-primary hover:bg-fill-btn-primary-hover text-text-on-sec-btn rounded-xl text-sm font-medium transition-colors my-4 disabled:opacity-50 disabled:cursor-not-allowed flex items-center justify-center",onClick:k,disabled:_,children:_?I.jsx(ko,{size:"xs",inline:!0}):l("deposit.enableWithToken",{token:n})})]}),S&&I.jsxs(I.Fragment,{children:[I.jsxs("div",{className:"flex mb-4",children:[I.jsx("div",{className:"w-5",children:I.jsx("img",{src:Mo,className:"w-4 h-4",alt:"Warning"})}),I.jsx("div",{className:"flex-1 text-xs text-functional-orange-1",children:l(E||"deposit.layerZeroDepositTip")})]}),I.jsx("div",{className:"my-2 ml-5 h-[1px] border-b border-dashed border-line-divider-secondary"})]}),N&&I.jsxs("div",{className:"flex mb-4",children:[I.jsx("div",{className:"w-5",children:I.jsx("img",{src:Mo,className:"w-4 h-4",alt:"Warning"})}),I.jsx("div",{className:"flex-1 text-xs text-functional-orange-1",children:l(b)})]}),N&&I.jsx("div",{className:"my-2 ml-5 h-[1px] border-b border-dashed border-line-divider-secondary"}),I.jsxs("div",{className:"flex mb-4",children:[I.jsx("div",{className:"w-5",children:!(N||S)&&I.jsx("img",{src:Mo,className:"w-4 h-4",alt:"Warning"})}),I.jsx("div",{className:"flex-1 text-xs text-functional-orange-1",children:l("deposit.noPrivateKeyWalletWarning")})]}),I.jsxs("div",{className:"border-t border-line-divider-secondary border-dashed py-4",children:[I.jsxs("div",{className:"flex justify-between items-center h-[18px] leading-4",children:[I.jsx("span",{className:"text-sm text-text-tertiary",children:l("deposit.arrivalTime")}),I.jsx(qn,{content:I.jsxs("div",{className:"grid flex-grow max-w-[300px] min-w-[80px] rounded-2xl flex-col gap-[10px]",children:[I.jsx("p",{children:l("deposit.arrivaltimeTooltip1",{v:(t==null?void 0:t.blockTime)*t.txConfirm/60,v1:t==null?void 0:t.txConfirm})}),I.jsx("p",{children:l("deposit.arrivaltimeTooltip2")})]}),placement:"top",children:I.jsx("span",{className:"text-text-primary font-medium text-right border-b-[2px] border-dashed border-line-divider-primary decoration-dashed text-sm",children:l("deposit.arrivalEstimated",{v:(t==null?void 0:t.blockTime)*t.txConfirm/60})})})]}),I.jsxs("div",{className:"flex justify-between items-center h-[18px] leading-4 mt-2",children:[I.jsx("span",{className:"text-sm text-text-tertiary",children:l("deposit.equity")}),I.jsx("span",{className:"text-sm text-text-primary font-medium",children:d?I.jsxs("span",{className:"flex items-center gap-1",children:[At(o),I.jsx("span",{className:"text-sm font-edgex-harmony text-functional-green-1 leading-[18px] font-medium",children:"→"}),At((parseFloat(o)+parseFloat(d)).toString())," ",n]}):`${At(o)} ${n}`})]})]}),I.jsxs("button",{className:`w-full h-[38px] text-sm rounded-xl font-medium transition-colors flex items-center justify-center gap-2 ${M.disabled||s?"bg-text-disabled text-text-secondary cursor-not-allowed":"bg-fill-btn-primary text-text-on-sec-btn"}`,onClick:U,disabled:M.disabled||s,children:[(s||C)&&I.jsx(ko,{size:"xs"}),M.text]})]})},C0=e=>e.toLocaleUpperCase()===bn?bn:Ba,Qc=e=>C0(e.wallet)===bn,fP=e=>C0(e.wallet)===Ba,I0=({isOpen:e,isLoading:t=!1,onClose:n,currentActiveAccount:r,chains:o,spotChains:s=[],defaultChainId:i,defaultSymbol:c,defaultAccountType:a="perpetual",balances:l,wagmiHooks:u,onDeposit:f,onCopy:p,onChainChange:d,onTokenChange:h})=>{const{t:m}=ht(),[x,A]=v.useState(a),w=v.useCallback(N=>N==="spot"&&s&&s.length>0?s:o,[o,s]),T=w(a),[B,L]=v.useState(()=>{var N;return!T||T.length===0?1:i||((N=T[0])==null?void 0:N.chainId)||1}),F=v.useMemo(()=>w(x),[x,w]),_=F.find(N=>N.chainId===B)||F[0],[g,y]=v.useState(()=>{var j;if(!T||T.length===0)return"";const N=i||((j=T[0])==null?void 0:j.chainId),b=T.find(W=>W.chainId===N)||T[0],M=((b==null?void 0:b.tokenList)||[]).length>0?b:T.find(W=>(W.tokenList||[]).length>0),R=(M==null?void 0:M.tokenList)||[];if(c&&R.length>0){const W=c.toUpperCase(),K=R.find(V=>(V.token||V.symbol||"").toUpperCase()===W);if(K)return K.token||K.symbol||""}const U=R[0];return(U==null?void 0:U.token)||(U==null?void 0:U.symbol)||""}),P=v.useCallback(N=>{L(N),d==null||d(N)},[d]),k=v.useCallback(N=>{y(N),h==null||h(N)},[h]),C=v.useMemo(()=>{const N=(g||"").toLowerCase();if(!N)return"0";const b=x==="spot"?l==null?void 0:l.spot:l==null?void 0:l.perpetual,M=b==null?void 0:b[N];return typeof M=="string"&&M.length>0?M:"0"},[l,x,g]),[$,S]=v.useState(!1),E=N=>{N.target===N.currentTarget?S(!0):S(!1)},O=N=>{$&&N.target===N.currentTarget&&n(),S(!1)};return e?ke.createPortal(I.jsx("div",{className:"fixed top-0 left-0 right-0 bottom-0 w-screen h-screen",style:{zIndex:98},children:I.jsx("div",{className:"fixed top-0 left-0 right-0 bottom-0 z-[99] flex items-center justify-center",style:{background:"rgba(0, 0, 0, 0.6)",backdropFilter:"blur(10px)",WebkitBackdropFilter:"blur(10px)"},onMouseDown:E,onMouseUp:O,"aria-hidden":"true",children:I.jsxs("div",{className:"relative w-[420px] max-h-[85vh] bg-fill-page-secondary overflow-auto rounded-lg p-6 shadow-xl border-[2px] border-solid border-line-divider-secondary",onClick:N=>{N.stopPropagation()},children:[I.jsxs("div",{className:"flex items-center justify-between mb-4",children:[I.jsx("h2",{className:"text-lg font-semibold text-white",children:m("deposit.title")}),I.jsx("button",{className:"text-gray-400 hover:text-gray-200 transition-colors",onClick:n,"aria-label":"Close",children:I.jsx(Ld,{className:"h-4 w-4"})})]}),I.jsx(jh,{selectedAccount:x,onAccountChange:N=>{var Z,H;const b=N||"perpetual";A(b);const M=w(b);if(!M||M.length===0)return;const R=M.find(Y=>Y.chainId===B),U=R?R.chainId:M[0].chainId;L(U),d==null||d(U);const j=M.find(Y=>Y.chainId===U),W=(j==null?void 0:j.tokenList)||[],V=W.some(Y=>(Y.symbol||Y.token)===g)?g:((Z=W[0])==null?void 0:Z.symbol)||((H=W[0])==null?void 0:H.token)||"";V&&(y(V),h==null||h(V))},className:"w-full"}),I.jsx(Rh,{currentActiveChain:_,chainList:F,onChainChange:P,curSelectToken:g,onTokenChange:k,walletType:Qc(r)?bn:Ba,accountType:x}),Qc(r)&&I.jsx(QS,{address:r.smartWalletAddress,currentActiveChain:_,selectedToken:g,accountType:x,onDeposit:f,onCopy:p,onClose:n}),fP(r)&&I.jsx(uP,{address:r.ethAddress,currentActiveChain:_,selectedToken:g,accountType:x,platformBalance:C,isLoading:t,wagmiHooks:u,onChainChange:P,onDeposit:f,onClose:n})]})})}),document.body):null},dP=e=>{if(e==null||e==="")return 2;const t=String(e),n=t.indexOf(".");if(n===-1)return 0;const r=t.length-n-1;return r>0?r:2},pP=({withdrawAmount:e,curSelectToken:t,tokenInfo:n,currentActiveChain:r,platformBalance:o="0",fee:s="0.00",walletType:i="evm",receiverAddress:c="",accountType:a="perpetual",onWithdrawAmountChange:l,onReceiverAddressChange:u,onAmountChanged:f,showPoolBalanceInsufficientTip:p=!1})=>{const{t:d}=ht(),h=v.useMemo(()=>{const F=dP(n==null?void 0:n.showStepSize);if(a==="spot"||!ln(r==null?void 0:r.chainId)){const _=new Ce(e||"0").minus(s||"0").decimalPlaces(F,Ce.ROUND_DOWN);return _.isNegative()?"0.00":_.toString()}return e||"0"},[e,s,r==null?void 0:r.chainId,a,n==null?void 0:n.showStepSize]),m=v.useMemo(()=>o||"0",[o]),x=v.useMemo(()=>{const F=(n==null?void 0:n.feeRate)||(n==null?void 0:n.withdrawFeeRate)||(r==null?void 0:r.feeRate)||0;try{return new Ce(F||0).times(100).toString()}catch{return"0"}},[n==null?void 0:n.feeRate,n==null?void 0:n.withdrawFeeRate,r==null?void 0:r.feeRate]),A=v.useMemo(()=>x==="0",[x]),w=v.useMemo(()=>{const F=(t||"").toUpperCase();return F==="USDT"||F==="USDC"},[t]),T=F=>{const _=F.target.value,y=Ys(_,m||"0");if(y.isValid)l(y.formattedValue),y.errorType;else return y.errorType==="exceed_balance",void 0;f==null||f(y.formattedValue)},B=()=>{const F=m||"0",g=Ys(F,F).formattedValue;l(g),f==null||f(g)},L=()=>{const F=parseFloat(o||"0"),_=parseFloat(e||"0");if(_>0){const g=F-_,y=At(Math.max(0,g).toString());return I.jsxs("span",{className:"flex items-center gap-1",children:[At(o||"0"),I.jsx("span",{className:"text-sm font-edgex-harmony text-functional-green-1 leading-[18px] font-medium",children:"→"}),y," ",t]})}return`${At(o||"0")} ${t}`};return I.jsxs(I.Fragment,{children:[I.jsxs("div",{className:"bg-fill-input-primary rounded-lg px-3 py-3 my-4",children:[I.jsxs("div",{className:"flex justify-between items-center h-[18px] mb-3",children:[I.jsx("input",{type:"text",placeholder:d("deposit.amount"),value:e,onChange:T,className:"flex-1 bg-transparent text-text-primary text-sm font-medium placeholder-text-tertiary placeholder:font-normal focus:outline-none border-none p-0 h-full"}),I.jsx("button",{onClick:B,className:"text-theme-normal text-xs font-medium cursor-pointer hover:opacity-80 transition-opacity h-full flex items-center",children:d("deposit.max")})]}),I.jsx("div",{className:"h-[1px] bg-line-divider-secondary mb-2"}),I.jsxs("div",{className:"flex justify-between items-center",children:[I.jsx(qn,{content:d("withdraw.availableDesc"),children:I.jsx("span",{className:"text-text-tertiary text-xs leading-[14px] border-b border-dashed border-line-divider-primary",children:d("deposit.available")})}),I.jsx("span",{className:"text-text-primary text-xs leading-[14px]",children:L()})]})]}),i==="mpc"&&(a==="spot"||!ln(r==null?void 0:r.chainId))?I.jsx("div",{className:"bg-fill-input-primary rounded-lg my-4 h-9 flex items-center px-3",children:I.jsx("input",{type:"text",placeholder:d("withdraw.receiverAddress"),value:c,onChange:F=>u==null?void 0:u(F.target.value),className:"flex-1 bg-transparent text-text-primary text-sm font-medium placeholder-text-tertiary placeholder:font-normal focus:outline-none border-none p-0 h-full"})}):null,I.jsx("div",{className:"bg-fill-page-secondary rounded-lg mb-4",children:ln(r==null?void 0:r.chainId)?I.jsxs(I.Fragment,{children:[I.jsx("p",{className:"text-text-tertiary text-xs leading-[18px]",children:d("withdraw.noticeDesc")}),I.jsx("a",{className:"block text-xs leading-[18px] mt-1 text-theme-normal",href:"https://edgex-1.gitbook.io/edgeX-documentation/getting-started/deposits-and-withdrawals/withdrawals",rel:"noreferrer",target:"_blank",children:d("withdraw.commonWithdraw")})]}):I.jsx("p",{className:"text-text-tertiary text-xs leading-[18px]",children:d("withdraw.crossChainTips")})}),p&&I.jsxs("div",{className:"flex mb-4",children:[I.jsx("div",{className:"w-5",children:I.jsx("img",{src:Mo,className:"w-4 h-4",alt:"Warning"})}),I.jsx("div",{className:"flex-1 text-xs text-functional-orange-1",children:d("withdraw.poolBalanceInsufficientTip")})]}),I.jsxs("div",{className:"py-4 border-t border-line-divider-secondary border-dashed",children:[I.jsxs("div",{className:"flex items-center justify-between h-[18px] leading-[18px]",children:[I.jsx(qn,{content:I.jsxs("div",{children:[I.jsx("div",{children:d("withdraw.speedNote")}),I.jsxs("div",{className:"flex gap-1 items-center mt-1",children:[I.jsx(Oo,{selectedLevel:Tt.FAST,maxLevel:3}),I.jsx("span",{children:d("withdraw.speedNoteSpeed1")})]}),I.jsxs("div",{className:"flex gap-1 items-center mt-1",children:[I.jsx(Oo,{selectedLevel:Tt.Medium,maxLevel:3}),I.jsx("span",{children:d("withdraw.speedNoteSpeed2")})]}),I.jsxs("div",{className:"flex gap-1 items-center mt-1",children:[I.jsx(Oo,{selectedLevel:Tt.SLOW,maxLevel:3}),I.jsx("span",{children:d("withdraw.speedNoteSpeed3")})]})]}),children:I.jsx("span",{className:"text-text-tertiary text-sm leading-4 border-b border-dashed border-line-divider-primary",children:d("withdraw.speed")})}),I.jsx("div",{className:"flex items-center",children:I.jsx(Oo,{selectedLevel:ln(r==null?void 0:r.chainId)?Tt.SLOW:Tt.FAST,maxLevel:3})})]}),(a==="spot"||!ln(r==null?void 0:r.chainId))&&I.jsxs("div",{className:"flex items-center justify-between mt-2 h-[18px]",children:[A||!w?I.jsx("span",{className:"text-text-tertiary text-sm leading-4",children:A?d("withdraw.fee"):`${d("withdraw.fee")}/${d("withdraw.feeRate")}`}):I.jsx(qn,{className:"w-[320px] font-normal flex items-center justify-center",content:I.jsx("span",{className:"flex items-center justify-center text-center",children:d("withdraw.feeCalculationTip")}),children:I.jsx("span",{className:"text-text-tertiary text-sm leading-4 border-b border-dashed border-line-divider-primary",children:`${d("withdraw.fee")}/${d("withdraw.feeRate")}`})}),I.jsxs("span",{className:"text-text-primary text-sm leading-4 font-medium",children:[s," ",t,!A&&` / ${x}%`]})]}),I.jsxs("div",{className:"flex items-center justify-between mt-2 h-[18px]",children:[I.jsx("span",{className:"text-text-tertiary text-sm leading-4",children:d(ln(r==null?void 0:r.chainId)?"withdraw.withdrawlAmount":"withdraw.amountToReceive")}),I.jsxs("span",{className:"text-text-primary text-sm leading-4 font-medium",children:[At(h)," ",t]})]})]})]})},hP=[];let Ve=null;const M0=v.forwardRef((e,t)=>{const[n,r]=v.useState(!1),[o,s]=v.useState(!1),[i,c]=v.useState({chains:[],currentActiveAccount:{wallet:"EVM",ethAddress:"",accountId:"",smartWalletAddress:""}}),a=v.useCallback(h=>{c(h||{chains:[],currentActiveAccount:{wallet:"EVM",ethAddress:"",accountId:"",smartWalletAddress:""}}),r(!0)},[]),l=v.useCallback(h=>{c(m=>({...m,...h}))},[]),u=v.useCallback(()=>{r(!1),s(!1),i.onClose&&i.onClose()},[i.onClose]),f=v.useCallback(h=>{s(h)},[]),p=v.useCallback(()=>n,[n]),d=v.useCallback(()=>o,[o]);return v.useImperativeHandle(t,()=>({openWithdraw:a,closeWithdraw:u,updateWithdrawOptions:l,setWithdrawLoading:f,isOpen:p,isLoading:d}),[a,u,l,f,p,d]),v.useEffect(()=>(Ve={openWithdraw:a,closeWithdraw:u,updateWithdrawOptions:l,setWithdrawLoading:f,isOpen:p,isLoading:d},()=>{Ve=null}),[a,u,l,f,p,d]),n?I.jsx(F0,{isOpen:n,isLoading:o,onClose:u,config:i.config||{symbol:"USDT"},currentActiveAccount:i.currentActiveAccount,chains:i.chains||hP,spotChains:i.spotChains,balances:i.balances,defaultChainId:i.defaultChainId,defaultSymbol:i.defaultSymbol,defaultAmount:i.defaultAmount,defaultAccountType:i.defaultAccountType,currentEquity:i.currentEquity??5e3,platformBalance:i.platformBalance||"0",fee:i.fee,wagmiHooks:i.wagmiHooks,onWithdraw:i.onWithdraw,onAccountChange:i.onAccountChange,onChainChange:i.onChainChange,onTokenChange:i.onTokenChange,onAmountChanged:i.onAmountChanged}):null});M0.displayName="WithdrawManager";const k0=e=>{if(!Ve){console.error("WithdrawManager not initialized. Make sure to render <WithdrawManager /> in your app.");return}Ve.openWithdraw(e||{chains:[],currentActiveAccount:{wallet:"EVM",ethAddress:"",accountId:"",smartWalletAddress:""}})},B0=()=>{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)},Qs=e=>{if(!Ve){console.error("WithdrawManager not initialized. Make sure to render <WithdrawManager /> in your app.");return}Ve.setWithdrawLoading(e)},mP=()=>Ve?Ve.isOpen():!1,D0=()=>Ve?Ve.isLoading():!1,gP=()=>({openWithdraw:k0,closeWithdraw:B0,updateWithdrawOptions:L0,setWithdrawLoading:Qs,isOpen:mP,isLoading:D0}),bP=({walletType:e,chains:t,spotChains:n=[],defaultChainId:r,defaultSymbol:o,defaultAmount:s="",defaultAccountType:i="perpetual",currentEquity:c,platformBalance:a="0",balances:l,fee:u="0.00",isLoading:f=!1,onWithdraw:p,onClose:d,onChainChange:h,onTokenChange:m,onAmountChanged:x,onAccountChange:A})=>{var Z;const{t:w}=ht(),[T,B]=v.useState(i),L=v.useCallback(H=>H==="spot"&&n&&n.length>0?n:t,[t,n]),F=v.useMemo(()=>L(T),[T,L]),_=v.useMemo(()=>{if(!F||F.length===0)return{chainId:1,tokenSymbol:""};const H=pe=>{const le=pe||[];if(!le.length)return"";const se="USDC".toUpperCase(),Sn=le.find(ft=>(ft.token||ft.symbol||"").toUpperCase()===se)||le[0];return Sn.token||Sn.symbol||""};if(o){const pe=o==null?void 0:o.toUpperCase();for(const le of F){const ge=le.tokenList||[];let se;if(pe&&(se=ge.find(Ge=>(Ge.token||Ge.symbol||"").toUpperCase()===pe)),se){const Ge=se.token||se.symbol||o||"";return{chainId:le.chainId,tokenSymbol:Ge}}}}if(r){const pe=F.find(se=>se.chainId===r)||F[0],le=pe.tokenList||[],ge=H(le);return{chainId:pe.chainId,tokenSymbol:ge}}const Y="USDC",Q=pe=>Array.isArray(pe.tokenList)&&pe.tokenList.some(le=>(le.token||le.symbol||"").toUpperCase()===Y),oe=F.find(Q)||F[0];if(!oe)return{chainId:1,tokenSymbol:""};const me=H(oe.tokenList);return{chainId:oe.chainId,tokenSymbol:me}},[F,r,o]),[g,y]=v.useState(()=>_.chainId),[P,k]=v.useState(()=>_.tokenSymbol),[C,$]=v.useState(s),[S,E]=v.useState(""),O=v.useCallback(H=>{y(H),h==null||h(H)},[h]),N=v.useCallback(H=>{k(H),m==null||m(H)},[m]),b=v.useRef(!0),M=v.useRef(P),R=v.useRef(g);v.useEffect(()=>{if(b.current){b.current=!1,M.current=P,R.current=g;return}(M.current!==P||R.current!==g)&&($(""),M.current=P,R.current=g)},[P,g]);const U=F&&F.length>0?F.find(H=>H.chainId===g)||F[0]:null,j=(Z=U==null?void 0:U.tokenList)==null?void 0:Z.find(H=>H.token===P),W=v.useMemo(()=>{const H=new Ce(C||"0"),Y=new Ce(u||"0"),Q=ln(g);return j!=null&&j.minWithdrawSize&&H.lt(j.minWithdrawSize)?{text:w("withdraw.minWithdrawParsed",{amount:j.minWithdrawSize,token:j.symbol||j.token}),disabled:!0}:!C||H.isZero()||!Q&&H.isLessThan(Y)?{text:w("withdraw.confirmWithdraw"),disabled:!0}:e==="mpc"&&(!Q||T==="spot")&&!S.trim()?{text:w("withdraw.invalidReceiverAddress"),disabled:!0}:{text:w("withdraw.confirmWithdraw"),disabled:!1}},[w,g,C,e,S,u,T,j]),K=v.useMemo(()=>{const H=(P||"").toLowerCase();if(!H)return a||"0";const Y=T==="spot"?l==null?void 0:l.spot:l==null?void 0:l.perpetual,Q=Y==null?void 0:Y[H];return typeof Q=="string"&&Q.length>0?Q:a||"0"},[l,T,P,a]),V=v.useCallback(async()=>{Qs(!0);try{if(p){const Y={amount:new Ce(C||"0").toString(),chainId:g,tokenAddress:(j==null?void 0:j.tokenAddress)||"",coinId:(j==null?void 0:j.coinId)||"",tokenSymbol:P,accountType:T,selectedToken:j};e==="mpc"&&(!ln(g)||T==="spot")&&(Y.receiverAddress=S),p(Y)}}catch{Qs(!1)}},[p,T,j,C,g,P,e,S]);return!F||F.length===0?I.jsx("div",{className:"text-center py-8",children:I.jsx("p",{className:"text-gray-400",children:"No chains available"})}):U?I.jsxs(I.Fragment,{children:[I.jsx(jh,{selectedAccount:T,onAccountChange:H=>{var Ge,Sn;const Y=H||"perpetual";B(Y),A==null||A(Y);const Q=L(Y);if(!Q||Q.length===0)return;const oe=Q.find(ft=>ft.chainId===g),me=oe?oe.chainId:Q[0].chainId;y(me),h==null||h(me);const pe=Q.find(ft=>ft.chainId===me),le=(pe==null?void 0:pe.tokenList)||[],se=le.some(ft=>(ft.symbol||ft.token)===P)?P:((Ge=le[0])==null?void 0:Ge.symbol)||((Sn=le[0])==null?void 0:Sn.token)||"";se&&(k(se),m==null||m(se))},className:"w-full"}),I.jsx(Rh,{currentActiveChain:U,chainList:F,onChainChange:O,curSelectToken:P,onTokenChange:N,walletType:"EVM",txType:"withdraw"}),I.jsx(pP,{withdrawAmount:C,curSelectToken:P,tokenInfo:j,curSelectTokenData:{balance:j==null?void 0:j.balance,allowance:j==null?void 0:j.allowance},currentActiveChain:U,currentEquity:c||0,decimals:(j==null?void 0:j.decimals)||6,platformBalance:K,fee:u,walletType:e,accountType:T,receiverAddress:S,onWithdrawAmountChange:$,onReceiverAddressChange:E,onAmountChanged:x}),I.jsxs("button",{className:`w-full h-[38px] text-sm rounded-xl font-medium transition-colors flex items-center justify-center gap-2 ${W.disabled||f?"bg-text-disabled text-text-secondary cursor-not-allowed":"bg-fill-btn-primary text-text-on-sec-btn"}`,onClick:V,disabled:W.disabled||f,children:[f&&I.jsx(ko,{size:"xs"}),W.text]})]}):I.jsx("div",{className:"text-center py-8",children:I.jsx("p",{className:"text-gray-400",children:"Loading..."})})},F0=({isOpen:e,isLoading:t=!1,defaultAccountType:n="perpetual",onClose:r,config:o,currentActiveAccount:s,chains:i,spotChains:c=[],defaultChainId:a,defaultSymbol:l,defaultAmount:u="",currentEquity:f=5e3,platformBalance:p="0",balances:d,fee:h,wagmiHooks:m,onWithdraw:x,onChainChange:A,onTokenChange:w,onAmountChanged:T,onAccountChange:B})=>{const{t:L}=ht(),[F,_]=v.useState(!1),g=P=>{P.target===P.currentTarget?_(!0):_(!1)},y=P=>{F&&P.target===P.currentTarget&&r(),_(!1)};return e?ke.createPortal(I.jsx("div",{className:"fixed top-0 left-0 right-0 bottom-0 w-screen h-screen",style:{zIndex:98},children:I.jsx("div",{className:"fixed top-0 left-0 right-0 bottom-0 z-[99] flex items-center justify-center",style:{background:"rgba(0, 0, 0, 0.6)",backdropFilter:"blur(10px)",WebkitBackdropFilter:"blur(10px)"},onMouseDown:g,onMouseUp:y,"aria-hidden":"true",children:I.jsxs("div",{className:"relative w-[420px] max-h-[85vh] bg-fill-page-secondary overflow-auto rounded-lg p-6 shadow-xl",onClick:P=>{P.stopPropagation()},children:[I.jsxs("div",{className:"flex items-center justify-between mb-4",children:[I.jsx("h2",{className:"text-lg font-semibold text-white",children:L("withdraw.withdraw")}),I.jsx("button",{className:"text-gray-400 hover:text-gray-200 transition-colors",onClick:r,"aria-label":"Close",children:I.jsx(Ld,{className:"h-4 w-4"})})]}),I.jsx(bP,{chains:i,spotChains:c,walletType:Qc(s)?"mpc":"evm",defaultChainId:a,defaultSymbol:l,defaultAmount:u,defaultAccountType:n,currentEquity:f,platformBalance:p,balances:d,fee:h,isLoading:t,wagmiHooks:m,onWithdraw:x,onClose:r,onChainChange:A,onTokenChange:w,onAmountChanged:T,onAccountChange:B})]})})}),document.body):null};re.ChromeLoader=ko,re.ComponentProvider=cm,re.DEFAULT_LOCALE=Lo,re.Deposit=I0,re.DepositManager=$0,re.LOCALE_NAMES=sm,re.LoadingSpinner=ko,re.SUPPORTED_LOCALES=ti,re.Tooltip=qn,re.Withdraw=F0,re.WithdrawManager=M0,re.closeDeposit=A0,re.closeWithdraw=B0,re.formatThousands=um,re.isDepositLoading=O0,re.isWithdrawLoading=D0,re.openDeposit=T0,re.openWithdraw=k0,re.setDepositLoading=Xs,re.setWithdrawLoading=Qs,re.updateDepositOptions=N0,re.updateWithdrawOptions=L0,re.useComponentConfig=fl,re.useDeposit=Uv,re.useDepositManager=sP,re.useTranslation=ht,re.useWithdraw=zv,re.useWithdrawManager=gP,Object.defineProperty(re,Symbol.toStringTag,{value:"Module"})});
177
177
  //# sourceMappingURL=index.umd.js.map