@edgex-web/components 1.0.0-beta.12 → 1.0.0-beta.13

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(le,g){typeof exports=="object"&&typeof module<"u"?g(exports,require("react"),require("react-dom")):typeof define=="function"&&define.amd?define(["exports","react","react-dom"],g):(le=typeof globalThis<"u"?globalThis:le||self,g(le.EdgeXComponents={},le.React,le.ReactDOM))})(this,function(le,g,Ke){"use strict";var PP=Object.defineProperty;var TP=(le,g,Ke)=>g in le?PP(le,g,{enumerable:!0,configurable:!0,writable:!0,value:Ke}):le[g]=Ke;var ds=(le,g,Ke)=>TP(le,typeof g!="symbol"?g+"":g,Ke);function Yc(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const n in e)if(n!=="default"){const r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:()=>e[n]})}}return t.default=e,Object.freeze(t)}const U=Yc(g),Jr=Yc(Ke);function Ym(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Fi={exports:{}},Qr={};/**
1
+ (function(le,g){typeof exports=="object"&&typeof module<"u"?g(exports,require("react"),require("react-dom")):typeof define=="function"&&define.amd?define(["exports","react","react-dom"],g):(le=typeof globalThis<"u"?globalThis:le||self,g(le.EdgeXComponents={},le.React,le.ReactDOM))})(this,function(le,g,Ke){"use strict";var PP=Object.defineProperty;var TP=(le,g,Ke)=>g in le?PP(le,g,{enumerable:!0,configurable:!0,writable:!0,value:Ke}):le[g]=Ke;var ds=(le,g,Ke)=>TP(le,typeof g!="symbol"?g+"":g,Ke);function Yc(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const n in e)if(n!=="default"){const r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:()=>e[n]})}}return t.default=e,Object.freeze(t)}const U=Yc(g),Qr=Yc(Ke);function Ym(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Fi={exports:{}},eo={};/**
2
2
  * @license React
3
3
  * react-jsx-runtime.production.min.js
4
4
  *
@@ -6,7 +6,7 @@
6
6
  *
7
7
  * This source code is licensed under the MIT license found in the
8
8
  * LICENSE file in the root directory of this source tree.
9
- */var Xc;function Xm(){if(Xc)return Qr;Xc=1;var e=g,t=Symbol.for("react.element"),n=Symbol.for("react.fragment"),r=Object.prototype.hasOwnProperty,o=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,s={key:!0,ref:!0,__self:!0,__source:!0};function i(l,a,c){var u,f={},p=null,d=null;c!==void 0&&(p=""+c),a.key!==void 0&&(p=""+a.key),a.ref!==void 0&&(d=a.ref);for(u in a)r.call(a,u)&&!s.hasOwnProperty(u)&&(f[u]=a[u]);if(l&&l.defaultProps)for(u in a=l.defaultProps,a)f[u]===void 0&&(f[u]=a[u]);return{$$typeof:t,type:l,key:p,ref:d,props:f,_owner:o.current}}return Qr.Fragment=n,Qr.jsx=i,Qr.jsxs=i,Qr}var eo={};/**
9
+ */var Xc;function Xm(){if(Xc)return eo;Xc=1;var e=g,t=Symbol.for("react.element"),n=Symbol.for("react.fragment"),r=Object.prototype.hasOwnProperty,o=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,s={key:!0,ref:!0,__self:!0,__source:!0};function i(l,a,c){var u,f={},p=null,d=null;c!==void 0&&(p=""+c),a.key!==void 0&&(p=""+a.key),a.ref!==void 0&&(d=a.ref);for(u in a)r.call(a,u)&&!s.hasOwnProperty(u)&&(f[u]=a[u]);if(l&&l.defaultProps)for(u in a=l.defaultProps,a)f[u]===void 0&&(f[u]=a[u]);return{$$typeof:t,type:l,key:p,ref:d,props:f,_owner:o.current}}return eo.Fragment=n,eo.jsx=i,eo.jsxs=i,eo}var to={};/**
10
10
  * @license React
11
11
  * react-jsx-runtime.development.js
12
12
  *
@@ -14,45 +14,45 @@
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 Jc;function Jm(){return Jc||(Jc=1,process.env.NODE_ENV!=="production"&&function(){var e=g,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"),l=Symbol.for("react.context"),a=Symbol.for("react.forward_ref"),c=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,b="@@iterator";function w(j){if(j===null||typeof j!="object")return null;var q=h&&j[h]||j[b];return typeof q=="function"?q:null}var P=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function x(j){{for(var q=arguments.length,X=new Array(q>1?q-1:0),se=1;se<q;se++)X[se-1]=arguments[se];E("error",j,X)}}function E(j,q,X){{var se=P.ReactDebugCurrentFrame,ge=se.getStackAddendum();ge!==""&&(q+="%s",X=X.concat([ge]));var Se=X.map(function(de){return String(de)});Se.unshift("Warning: "+q),Function.prototype.apply.call(console[j],console,Se)}}var A=!1,D=!1,L=!1,F=!1,m=!1,v;v=Symbol.for("react.module.reference");function S(j){return!!(typeof j=="string"||typeof j=="function"||j===r||j===s||m||j===o||j===c||j===u||F||j===d||A||D||L||typeof j=="object"&&j!==null&&(j.$$typeof===p||j.$$typeof===f||j.$$typeof===i||j.$$typeof===l||j.$$typeof===a||j.$$typeof===v||j.getModuleId!==void 0))}function $(j,q,X){var se=j.displayName;if(se)return se;var ge=q.displayName||q.name||"";return ge!==""?X+"("+ge+")":X}function I(j){return j.displayName||"Context"}function C(j){if(j==null)return null;if(typeof j.tag=="number"&&x("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),typeof j=="function")return j.displayName||j.name||null;if(typeof j=="string")return j;switch(j){case r:return"Fragment";case n:return"Portal";case s:return"Profiler";case o:return"StrictMode";case c:return"Suspense";case u:return"SuspenseList"}if(typeof j=="object")switch(j.$$typeof){case l:var q=j;return I(q)+".Consumer";case i:var X=j;return I(X._context)+".Provider";case a:return $(j,j.render,"ForwardRef");case f:var se=j.displayName||null;return se!==null?se:C(j.type)||"Memo";case p:{var ge=j,Se=ge._payload,de=ge._init;try{return C(de(Se))}catch{return null}}}return null}var M=Object.assign,y=0,O,k,T,B,R,z,_;function G(){}G.__reactDisabledLog=!0;function J(){{if(y===0){O=console.log,k=console.info,T=console.warn,B=console.error,R=console.group,z=console.groupCollapsed,_=console.groupEnd;var j={configurable:!0,enumerable:!0,value:G,writable:!0};Object.defineProperties(console,{info:j,log:j,warn:j,error:j,group:j,groupCollapsed:j,groupEnd:j})}y++}}function K(){{if(y--,y===0){var j={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:M({},j,{value:O}),info:M({},j,{value:k}),warn:M({},j,{value:T}),error:M({},j,{value:B}),group:M({},j,{value:R}),groupCollapsed:M({},j,{value:z}),groupEnd:M({},j,{value:_})})}y<0&&x("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var W=P.ReactCurrentDispatcher,ne;function be(j,q,X){{if(ne===void 0)try{throw Error()}catch(ge){var se=ge.stack.trim().match(/\n( *(at )?)/);ne=se&&se[1]||""}return`
18
- `+ne+j}}var fe=!1,xe;{var ye=typeof WeakMap=="function"?WeakMap:Map;xe=new ye}function Y(j,q){if(!j||fe)return"";{var X=xe.get(j);if(X!==void 0)return X}var se;fe=!0;var ge=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var Se;Se=W.current,W.current=null,J();try{if(q){var de=function(){throw Error()};if(Object.defineProperty(de.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(de,[])}catch(ct){se=ct}Reflect.construct(j,[],de)}else{try{de.call()}catch(ct){se=ct}j.call(de.prototype)}}else{try{throw Error()}catch(ct){se=ct}j()}}catch(ct){if(ct&&se&&typeof ct.stack=="string"){for(var ue=ct.stack.split(`
17
+ */var Jc;function Jm(){return Jc||(Jc=1,process.env.NODE_ENV!=="production"&&function(){var e=g,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"),l=Symbol.for("react.context"),a=Symbol.for("react.forward_ref"),c=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,b="@@iterator";function v(j){if(j===null||typeof j!="object")return null;var q=h&&j[h]||j[b];return typeof q=="function"?q:null}var P=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function x(j){{for(var q=arguments.length,X=new Array(q>1?q-1:0),se=1;se<q;se++)X[se-1]=arguments[se];E("error",j,X)}}function E(j,q,X){{var se=P.ReactDebugCurrentFrame,ge=se.getStackAddendum();ge!==""&&(q+="%s",X=X.concat([ge]));var Se=X.map(function(de){return String(de)});Se.unshift("Warning: "+q),Function.prototype.apply.call(console[j],console,Se)}}var N=!1,D=!1,F=!1,L=!1,m=!1,w;w=Symbol.for("react.module.reference");function S(j){return!!(typeof j=="string"||typeof j=="function"||j===r||j===s||m||j===o||j===c||j===u||L||j===d||N||D||F||typeof j=="object"&&j!==null&&(j.$$typeof===p||j.$$typeof===f||j.$$typeof===i||j.$$typeof===l||j.$$typeof===a||j.$$typeof===w||j.getModuleId!==void 0))}function $(j,q,X){var se=j.displayName;if(se)return se;var ge=q.displayName||q.name||"";return ge!==""?X+"("+ge+")":X}function I(j){return j.displayName||"Context"}function A(j){if(j==null)return null;if(typeof j.tag=="number"&&x("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),typeof j=="function")return j.displayName||j.name||null;if(typeof j=="string")return j;switch(j){case r:return"Fragment";case n:return"Portal";case s:return"Profiler";case o:return"StrictMode";case c:return"Suspense";case u:return"SuspenseList"}if(typeof j=="object")switch(j.$$typeof){case l:var q=j;return I(q)+".Consumer";case i:var X=j;return I(X._context)+".Provider";case a:return $(j,j.render,"ForwardRef");case f:var se=j.displayName||null;return se!==null?se:A(j.type)||"Memo";case p:{var ge=j,Se=ge._payload,de=ge._init;try{return A(de(Se))}catch{return null}}}return null}var k=Object.assign,y=0,O,M,T,B,R,z,W;function G(){}G.__reactDisabledLog=!0;function J(){{if(y===0){O=console.log,M=console.info,T=console.warn,B=console.error,R=console.group,z=console.groupCollapsed,W=console.groupEnd;var j={configurable:!0,enumerable:!0,value:G,writable:!0};Object.defineProperties(console,{info:j,log:j,warn:j,error:j,group:j,groupCollapsed:j,groupEnd:j})}y++}}function K(){{if(y--,y===0){var j={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:k({},j,{value:O}),info:k({},j,{value:M}),warn:k({},j,{value:T}),error:k({},j,{value:B}),group:k({},j,{value:R}),groupCollapsed:k({},j,{value:z}),groupEnd:k({},j,{value:W})})}y<0&&x("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var _=P.ReactCurrentDispatcher,ne;function be(j,q,X){{if(ne===void 0)try{throw Error()}catch(ge){var se=ge.stack.trim().match(/\n( *(at )?)/);ne=se&&se[1]||""}return`
18
+ `+ne+j}}var fe=!1,xe;{var ye=typeof WeakMap=="function"?WeakMap:Map;xe=new ye}function Y(j,q){if(!j||fe)return"";{var X=xe.get(j);if(X!==void 0)return X}var se;fe=!0;var ge=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var Se;Se=_.current,_.current=null,J();try{if(q){var de=function(){throw Error()};if(Object.defineProperty(de.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(de,[])}catch(ct){se=ct}Reflect.construct(j,[],de)}else{try{de.call()}catch(ct){se=ct}j.call(de.prototype)}}else{try{throw Error()}catch(ct){se=ct}j()}}catch(ct){if(ct&&se&&typeof ct.stack=="string"){for(var ue=ct.stack.split(`
19
19
  `),qe=se.stack.split(`
20
20
  `),Ie=ue.length-1,$e=qe.length-1;Ie>=1&&$e>=0&&ue[Ie]!==qe[$e];)$e--;for(;Ie>=1&&$e>=0;Ie--,$e--)if(ue[Ie]!==qe[$e]){if(Ie!==1||$e!==1)do if(Ie--,$e--,$e<0||ue[Ie]!==qe[$e]){var Ot=`
21
- `+ue[Ie].replace(" at new "," at ");return j.displayName&&Ot.includes("<anonymous>")&&(Ot=Ot.replace("<anonymous>",j.displayName)),typeof j=="function"&&xe.set(j,Ot),Ot}while(Ie>=1&&$e>=0);break}}}finally{fe=!1,W.current=Se,K(),Error.prepareStackTrace=ge}var Xr=j?j.displayName||j.name:"",hr=Xr?be(Xr):"";return typeof j=="function"&&xe.set(j,hr),hr}function H(j,q,X){return Y(j,!1)}function ee(j){var q=j.prototype;return!!(q&&q.isReactComponent)}function Q(j,q,X){if(j==null)return"";if(typeof j=="function")return Y(j,ee(j));if(typeof j=="string")return be(j);switch(j){case c:return be("Suspense");case u:return be("SuspenseList")}if(typeof j=="object")switch(j.$$typeof){case a:return H(j.render);case f:return Q(j.type,q,X);case p:{var se=j,ge=se._payload,Se=se._init;try{return Q(Se(ge),q,X)}catch{}}}return""}var ve=Object.prototype.hasOwnProperty,Z={},ie=P.ReactDebugCurrentFrame;function he(j){if(j){var q=j._owner,X=Q(j.type,j._source,q?q.type:null);ie.setExtraStackFrame(X)}else ie.setExtraStackFrame(null)}function Ee(j,q,X,se,ge){{var Se=Function.call.bind(ve);for(var de in j)if(Se(j,de)){var ue=void 0;try{if(typeof j[de]!="function"){var qe=Error((se||"React class")+": "+X+" type `"+de+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof j[de]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw qe.name="Invariant Violation",qe}ue=j[de](q,de,se,X,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(Ie){ue=Ie}ue&&!(ue instanceof Error)&&(he(ge),x("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).",se||"React class",X,de,typeof ue),he(null)),ue instanceof Error&&!(ue.message in Z)&&(Z[ue.message]=!0,he(ge),x("Failed %s type: %s",X,ue.message),he(null))}}}var Fe=Array.isArray;function we(j){return Fe(j)}function Ae(j){{var q=typeof Symbol=="function"&&Symbol.toStringTag,X=q&&j[Symbol.toStringTag]||j.constructor.name||"Object";return X}}function lt(j){try{return Ge(j),!1}catch{return!0}}function Ge(j){return""+j}function Vt(j){if(lt(j))return x("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",Ae(j)),Ge(j)}var Vn=P.ReactCurrentOwner,Ht={key:!0,ref:!0,__self:!0,__source:!0},zm,Um;function aP(j){if(ve.call(j,"ref")){var q=Object.getOwnPropertyDescriptor(j,"ref").get;if(q&&q.isReactWarning)return!1}return j.ref!==void 0}function lP(j){if(ve.call(j,"key")){var q=Object.getOwnPropertyDescriptor(j,"key").get;if(q&&q.isReactWarning)return!1}return j.key!==void 0}function cP(j,q){typeof j.ref=="string"&&Vn.current}function uP(j,q){{var X=function(){zm||(zm=!0,x("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",q))};X.isReactWarning=!0,Object.defineProperty(j,"key",{get:X,configurable:!0})}}function fP(j,q){{var X=function(){Um||(Um=!0,x("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",q))};X.isReactWarning=!0,Object.defineProperty(j,"ref",{get:X,configurable:!0})}}var dP=function(j,q,X,se,ge,Se,de){var ue={$$typeof:t,type:j,key:q,ref:X,props:de,_owner:Se};return ue._store={},Object.defineProperty(ue._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(ue,"_self",{configurable:!1,enumerable:!1,writable:!1,value:se}),Object.defineProperty(ue,"_source",{configurable:!1,enumerable:!1,writable:!1,value:ge}),Object.freeze&&(Object.freeze(ue.props),Object.freeze(ue)),ue};function pP(j,q,X,se,ge){{var Se,de={},ue=null,qe=null;X!==void 0&&(Vt(X),ue=""+X),lP(q)&&(Vt(q.key),ue=""+q.key),aP(q)&&(qe=q.ref,cP(q,ge));for(Se in q)ve.call(q,Se)&&!Ht.hasOwnProperty(Se)&&(de[Se]=q[Se]);if(j&&j.defaultProps){var Ie=j.defaultProps;for(Se in Ie)de[Se]===void 0&&(de[Se]=Ie[Se])}if(ue||qe){var $e=typeof j=="function"?j.displayName||j.name||"Unknown":j;ue&&uP(de,$e),qe&&fP(de,$e)}return dP(j,ue,qe,ge,se,Vn.current,de)}}var Vc=P.ReactCurrentOwner,_m=P.ReactDebugCurrentFrame;function Yr(j){if(j){var q=j._owner,X=Q(j.type,j._source,q?q.type:null);_m.setExtraStackFrame(X)}else _m.setExtraStackFrame(null)}var Hc;Hc=!1;function Gc(j){return typeof j=="object"&&j!==null&&j.$$typeof===t}function Wm(){{if(Vc.current){var j=C(Vc.current.type);if(j)return`
21
+ `+ue[Ie].replace(" at new "," at ");return j.displayName&&Ot.includes("<anonymous>")&&(Ot=Ot.replace("<anonymous>",j.displayName)),typeof j=="function"&&xe.set(j,Ot),Ot}while(Ie>=1&&$e>=0);break}}}finally{fe=!1,_.current=Se,K(),Error.prepareStackTrace=ge}var Jr=j?j.displayName||j.name:"",hr=Jr?be(Jr):"";return typeof j=="function"&&xe.set(j,hr),hr}function H(j,q,X){return Y(j,!1)}function ee(j){var q=j.prototype;return!!(q&&q.isReactComponent)}function Q(j,q,X){if(j==null)return"";if(typeof j=="function")return Y(j,ee(j));if(typeof j=="string")return be(j);switch(j){case c:return be("Suspense");case u:return be("SuspenseList")}if(typeof j=="object")switch(j.$$typeof){case a:return H(j.render);case f:return Q(j.type,q,X);case p:{var se=j,ge=se._payload,Se=se._init;try{return Q(Se(ge),q,X)}catch{}}}return""}var ve=Object.prototype.hasOwnProperty,Z={},ie=P.ReactDebugCurrentFrame;function he(j){if(j){var q=j._owner,X=Q(j.type,j._source,q?q.type:null);ie.setExtraStackFrame(X)}else ie.setExtraStackFrame(null)}function Ee(j,q,X,se,ge){{var Se=Function.call.bind(ve);for(var de in j)if(Se(j,de)){var ue=void 0;try{if(typeof j[de]!="function"){var qe=Error((se||"React class")+": "+X+" type `"+de+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof j[de]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw qe.name="Invariant Violation",qe}ue=j[de](q,de,se,X,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(Ie){ue=Ie}ue&&!(ue instanceof Error)&&(he(ge),x("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).",se||"React class",X,de,typeof ue),he(null)),ue instanceof Error&&!(ue.message in Z)&&(Z[ue.message]=!0,he(ge),x("Failed %s type: %s",X,ue.message),he(null))}}}var Fe=Array.isArray;function we(j){return Fe(j)}function Ae(j){{var q=typeof Symbol=="function"&&Symbol.toStringTag,X=q&&j[Symbol.toStringTag]||j.constructor.name||"Object";return X}}function lt(j){try{return Ge(j),!1}catch{return!0}}function Ge(j){return""+j}function Vt(j){if(lt(j))return x("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",Ae(j)),Ge(j)}var Vn=P.ReactCurrentOwner,Ht={key:!0,ref:!0,__self:!0,__source:!0},zm,Um;function aP(j){if(ve.call(j,"ref")){var q=Object.getOwnPropertyDescriptor(j,"ref").get;if(q&&q.isReactWarning)return!1}return j.ref!==void 0}function lP(j){if(ve.call(j,"key")){var q=Object.getOwnPropertyDescriptor(j,"key").get;if(q&&q.isReactWarning)return!1}return j.key!==void 0}function cP(j,q){typeof j.ref=="string"&&Vn.current}function uP(j,q){{var X=function(){zm||(zm=!0,x("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",q))};X.isReactWarning=!0,Object.defineProperty(j,"key",{get:X,configurable:!0})}}function fP(j,q){{var X=function(){Um||(Um=!0,x("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",q))};X.isReactWarning=!0,Object.defineProperty(j,"ref",{get:X,configurable:!0})}}var dP=function(j,q,X,se,ge,Se,de){var ue={$$typeof:t,type:j,key:q,ref:X,props:de,_owner:Se};return ue._store={},Object.defineProperty(ue._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(ue,"_self",{configurable:!1,enumerable:!1,writable:!1,value:se}),Object.defineProperty(ue,"_source",{configurable:!1,enumerable:!1,writable:!1,value:ge}),Object.freeze&&(Object.freeze(ue.props),Object.freeze(ue)),ue};function pP(j,q,X,se,ge){{var Se,de={},ue=null,qe=null;X!==void 0&&(Vt(X),ue=""+X),lP(q)&&(Vt(q.key),ue=""+q.key),aP(q)&&(qe=q.ref,cP(q,ge));for(Se in q)ve.call(q,Se)&&!Ht.hasOwnProperty(Se)&&(de[Se]=q[Se]);if(j&&j.defaultProps){var Ie=j.defaultProps;for(Se in Ie)de[Se]===void 0&&(de[Se]=Ie[Se])}if(ue||qe){var $e=typeof j=="function"?j.displayName||j.name||"Unknown":j;ue&&uP(de,$e),qe&&fP(de,$e)}return dP(j,ue,qe,ge,se,Vn.current,de)}}var Vc=P.ReactCurrentOwner,Wm=P.ReactDebugCurrentFrame;function Xr(j){if(j){var q=j._owner,X=Q(j.type,j._source,q?q.type:null);Wm.setExtraStackFrame(X)}else Wm.setExtraStackFrame(null)}var Hc;Hc=!1;function Gc(j){return typeof j=="object"&&j!==null&&j.$$typeof===t}function _m(){{if(Vc.current){var j=A(Vc.current.type);if(j)return`
22
22
 
23
- Check the render method of \``+j+"`."}return""}}function hP(j){return""}var Vm={};function mP(j){{var q=Wm();if(!q){var X=typeof j=="string"?j:j.displayName||j.name;X&&(q=`
23
+ Check the render method of \``+j+"`."}return""}}function hP(j){return""}var Vm={};function mP(j){{var q=_m();if(!q){var X=typeof j=="string"?j:j.displayName||j.name;X&&(q=`
24
24
 
25
- Check the top-level render call using <`+X+">.")}return q}}function Hm(j,q){{if(!j._store||j._store.validated||j.key!=null)return;j._store.validated=!0;var X=mP(q);if(Vm[X])return;Vm[X]=!0;var se="";j&&j._owner&&j._owner!==Vc.current&&(se=" It was passed a child from "+C(j._owner.type)+"."),Yr(j),x('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',X,se),Yr(null)}}function Gm(j,q){{if(typeof j!="object")return;if(we(j))for(var X=0;X<j.length;X++){var se=j[X];Gc(se)&&Hm(se,q)}else if(Gc(j))j._store&&(j._store.validated=!0);else if(j){var ge=w(j);if(typeof ge=="function"&&ge!==j.entries)for(var Se=ge.call(j),de;!(de=Se.next()).done;)Gc(de.value)&&Hm(de.value,q)}}}function bP(j){{var q=j.type;if(q==null||typeof q=="string")return;var X;if(typeof q=="function")X=q.propTypes;else if(typeof q=="object"&&(q.$$typeof===a||q.$$typeof===f))X=q.propTypes;else return;if(X){var se=C(q);Ee(X,j.props,"prop",se,j)}else if(q.PropTypes!==void 0&&!Hc){Hc=!0;var ge=C(q);x("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",ge||"Unknown")}typeof q.getDefaultProps=="function"&&!q.getDefaultProps.isReactClassApproved&&x("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function gP(j){{for(var q=Object.keys(j.props),X=0;X<q.length;X++){var se=q[X];if(se!=="children"&&se!=="key"){Yr(j),x("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",se),Yr(null);break}}j.ref!==null&&(Yr(j),x("Invalid attribute `ref` supplied to `React.Fragment`."),Yr(null))}}var qm={};function Km(j,q,X,se,ge,Se){{var de=S(j);if(!de){var ue="";(j===void 0||typeof j=="object"&&j!==null&&Object.keys(j).length===0)&&(ue+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");var qe=hP();qe?ue+=qe:ue+=Wm();var Ie;j===null?Ie="null":we(j)?Ie="array":j!==void 0&&j.$$typeof===t?(Ie="<"+(C(j.type)||"Unknown")+" />",ue=" Did you accidentally export a JSX literal instead of a component?"):Ie=typeof j,x("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",Ie,ue)}var $e=pP(j,q,X,ge,Se);if($e==null)return $e;if(de){var Ot=q.children;if(Ot!==void 0)if(se)if(we(Ot)){for(var Xr=0;Xr<Ot.length;Xr++)Gm(Ot[Xr],j);Object.freeze&&Object.freeze(Ot)}else x("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else Gm(Ot,j)}if(ve.call(q,"key")){var hr=C(j),ct=Object.keys(q).filter(function(SP){return SP!=="key"}),qc=ct.length>0?"{key: someKey, "+ct.join(": ..., ")+": ...}":"{key: someKey}";if(!qm[hr+qc]){var EP=ct.length>0?"{"+ct.join(": ..., ")+": ...}":"{}";x(`A props object containing a "key" prop is being spread into JSX:
25
+ Check the top-level render call using <`+X+">.")}return q}}function Hm(j,q){{if(!j._store||j._store.validated||j.key!=null)return;j._store.validated=!0;var X=mP(q);if(Vm[X])return;Vm[X]=!0;var se="";j&&j._owner&&j._owner!==Vc.current&&(se=" It was passed a child from "+A(j._owner.type)+"."),Xr(j),x('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',X,se),Xr(null)}}function Gm(j,q){{if(typeof j!="object")return;if(we(j))for(var X=0;X<j.length;X++){var se=j[X];Gc(se)&&Hm(se,q)}else if(Gc(j))j._store&&(j._store.validated=!0);else if(j){var ge=v(j);if(typeof ge=="function"&&ge!==j.entries)for(var Se=ge.call(j),de;!(de=Se.next()).done;)Gc(de.value)&&Hm(de.value,q)}}}function bP(j){{var q=j.type;if(q==null||typeof q=="string")return;var X;if(typeof q=="function")X=q.propTypes;else if(typeof q=="object"&&(q.$$typeof===a||q.$$typeof===f))X=q.propTypes;else return;if(X){var se=A(q);Ee(X,j.props,"prop",se,j)}else if(q.PropTypes!==void 0&&!Hc){Hc=!0;var ge=A(q);x("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",ge||"Unknown")}typeof q.getDefaultProps=="function"&&!q.getDefaultProps.isReactClassApproved&&x("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function gP(j){{for(var q=Object.keys(j.props),X=0;X<q.length;X++){var se=q[X];if(se!=="children"&&se!=="key"){Xr(j),x("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",se),Xr(null);break}}j.ref!==null&&(Xr(j),x("Invalid attribute `ref` supplied to `React.Fragment`."),Xr(null))}}var qm={};function Km(j,q,X,se,ge,Se){{var de=S(j);if(!de){var ue="";(j===void 0||typeof j=="object"&&j!==null&&Object.keys(j).length===0)&&(ue+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");var qe=hP();qe?ue+=qe:ue+=_m();var Ie;j===null?Ie="null":we(j)?Ie="array":j!==void 0&&j.$$typeof===t?(Ie="<"+(A(j.type)||"Unknown")+" />",ue=" Did you accidentally export a JSX literal instead of a component?"):Ie=typeof j,x("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",Ie,ue)}var $e=pP(j,q,X,ge,Se);if($e==null)return $e;if(de){var Ot=q.children;if(Ot!==void 0)if(se)if(we(Ot)){for(var Jr=0;Jr<Ot.length;Jr++)Gm(Ot[Jr],j);Object.freeze&&Object.freeze(Ot)}else x("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else Gm(Ot,j)}if(ve.call(q,"key")){var hr=A(j),ct=Object.keys(q).filter(function(SP){return SP!=="key"}),qc=ct.length>0?"{key: someKey, "+ct.join(": ..., ")+": ...}":"{key: someKey}";if(!qm[hr+qc]){var EP=ct.length>0?"{"+ct.join(": ..., ")+": ...}":"{}";x(`A props object containing a "key" prop is being spread into JSX:
26
26
  let props = %s;
27
27
  <%s {...props} />
28
28
  React keys must be passed directly to JSX without using spread:
29
29
  let props = %s;
30
- <%s key={someKey} {...props} />`,qc,hr,EP,hr),qm[hr+qc]=!0}}return j===r?gP($e):bP($e),$e}}function yP(j,q,X){return Km(j,q,X,!0)}function vP(j,q,X){return Km(j,q,X,!1)}var wP=vP,xP=yP;eo.Fragment=r,eo.jsx=wP,eo.jsxs=xP}()),eo}process.env.NODE_ENV==="production"?Fi.exports=Xm():Fi.exports=Jm();var N=Fi.exports;const Qm={deposit:{title:"Einzahlen",chain:"Chain",asset:"Asset",amount:"Betrag",available:"Verfügbar",equity:"Eigenkapital",confirmDeposit:"Einzahlung bestätigen",switchNetwork:"Netzwerk wechseln",max:"Max.",fast:"Schnell",standard:"Standard",arrivalTime:"Ankunftszeit",ethCrossChainDepositInitiated:"ETH-Cross-Chain-Einzahlung initiiert. Voraussichtliche Ankunft in 2 bis 5 Minuten.",minDeposit:"Mindestbetrag der Einzahlung",minDepositParsed:"Min. {{amount}} {{token}} einzahlen",maxDeposit:"Maximaler Einzahlungsbetrag",depositTipFor25w:"Der Höchstbetrag pro Einzahlung beträgt 200.000. Wenn deine Einzahlung 200.000 übersteigt, verwende bitte die Ethereum-Chain.",depositAllTip:`Für Einzahlungen an diese Adresse wird nur {{coin}} ({{v}}) unterstützt.
30
+ <%s key={someKey} {...props} />`,qc,hr,EP,hr),qm[hr+qc]=!0}}return j===r?gP($e):bP($e),$e}}function yP(j,q,X){return Km(j,q,X,!0)}function vP(j,q,X){return Km(j,q,X,!1)}var wP=vP,xP=yP;to.Fragment=r,to.jsx=wP,to.jsxs=xP}()),to}process.env.NODE_ENV==="production"?Fi.exports=Xm():Fi.exports=Jm();var C=Fi.exports;const Qm={deposit:{title:"Einzahlen",chain:"Chain",asset:"Asset",amount:"Betrag",available:"Verfügbar",equity:"Eigenkapital",confirmDeposit:"Einzahlung bestätigen",switchNetwork:"Netzwerk wechseln",max:"Max.",fast:"Schnell",standard:"Standard",arrivalTime:"Ankunftszeit",ethCrossChainDepositInitiated:"ETH-Cross-Chain-Einzahlung initiiert. Voraussichtliche Ankunft in 2 bis 5 Minuten.",minDeposit:"Mindestbetrag der Einzahlung",minDepositParsed:"Min. {{amount}} {{token}} einzahlen",maxDeposit:"Maximaler Einzahlungsbetrag",depositTipFor25w:"Der Höchstbetrag pro Einzahlung beträgt 200.000. Wenn deine Einzahlung 200.000 übersteigt, verwende bitte die Ethereum-Chain.",depositAllTip:`Für Einzahlungen an diese Adresse wird nur {{coin}} ({{v}}) unterstützt.
31
31
  Wenn der Einzahlungsbetrag 200.000 übersteigt, kann es zu einer Verzögerung der Ankunftszeit kommen. Bitte hab etwas Geduld.`,maxDepositSplitTip:"Der Höchstbetrag pro Einzahlung beträgt 200.000. Falls du mehr als 200.000 einzahlen musst, teile den Betrag bitte in mehrere Einzahlungen auf.",spotDepositNotSupportedTip:"Einzahlungen werden nicht unterstützt. Bitte zahle auf das Perpetual-Konto ein und überweise den Betrag anschließend.",crossChainDepositFeeTip:`Für Einzahlungen an diese Adresse wird nur {{coin}} ({{v}}) unterstützt.
32
- Bei Chain-übergreifenden Einzahlungen musst du die Edge-Gas-Gebühr zahlen. Der gutgeschriebene Betrag wird etwas geringer sein als dein Einzahlungsbetrag.`,addressUpdatedNotice:"Hinweis: Deine Einzahlungsadresse wurde aktualisiert. Verwende die neue Adresse. Die alte Adresse funktioniert nur während der Übergangszeit und wird dann deaktiviert. Wenn sie an einem anderen Ort gespeichert wurde, aktualisiere sie umgehend.",enableSystemProWithToken:"{{token}} auf {{network}} aktivieren",enableTokenDesc:"Bei der ersten Einzahlung auf {{network}} musst du {{token}} aktivieren.",enableWithToken:"{{token}} aktivieren",arrivaltimeTooltip1:"Die Gelder kommen in etwa {{v}} Minuten an (nach Erreichen von {{v1}} Blockbestätigungen).",arrivaltimeTooltip2:"Die geschätzte Zeit wird auf der Grundlage historischer Daten berechnet und dient nur als Referenz. Eine Überlastung des Netzwerks kann zu längeren tatsächlichen Ankunftszeiten führen.",arrivalEstimated:"≈ {{v}} Minuten",feeRateTooltip:"Geschätzte Gebühr, tatsächliche Abzug maßgeblich.",availableDesc:"Der maximale Betrag, den du einzahlen kannst. Wenn das verfügbare Guthaben 0 oder negativ ist, können keine Einzahlungen vorgenommen werden.",noPrivateKeyWalletWarning:"Verwende für Einzahlungen keine schlüssellosen Wallets. Einzahlungen mit einer schlüssellosen Wallet können zu einem unwiderruflichen Verlust der Gelder führen.",layerZeroDepositTip:"Das System wird deine Einzahlung über LayerZero auf Basis der tatsächlichen Einzahlungsbedingungen abschließen.",layerZeroDepositTipExceedPool:"Da der Einzahlungsbetrag den Pool übersteigt, wird deine Einzahlung über LayerZero abgewickelt.",layerZeroDepositTipGte200k:"Da der Einzahlungsbetrag größer als oder gleich 200.000 USDT ist, wird deine Einzahlung über LayerZero abgewickelt.",layerZeroDepositButton:"Mit LayerZero einzahlen",defaultSpotNotice:"Standardeinzahlungen werden dem Spot-Konto gutgeschrieben.",defaultSpotToPerpNotice:"Für Einzahlungen an diese Adresse wird nur {{coin}} ({{v}}) unterstützt. Standardeinzahlungen werden dem Spot-Konto gutgeschrieben. Überweise Gelder vom Spot-Konto auf das Futures-Konto, um das Futures-Konto zu finanzieren.",connectedWalletTitle:"Einzahlung von einer verbundenen Wallet",connectedWalletDesc:"Verwende MetaMask, WalletConnect oder einen anderen Anbieter, um Geld von deiner Krypto-Wallet einzuzahlen",externalWalletTitle:"Einzahlung von externem Konto",externalWalletDesc:"Überweise Gelder von Binance oder anderen Börsen, Chains wie Arbitrum und anderen Wallets",or:"OR"},withdraw:{noticeDesc:"Normale Auszahlungen erfolgen in zwei Schritten. Im aktuellen Schritt wird dein Auszahlungsantrag eingeleitet und auf Layer 2 bearbeitet. Sobald deine Gelder zur Verfügung stehen (dies kann bis zu 4 Stunden dauern), erhältst du eine Benachrichtigung, um deine Gelder in deine Wallet auszuzahlen. Aufgrund der Chain-Synchronisierung und anderer Faktoren kann die Dauer bis zu 48 Stunden betragen. Du bist für alle Gas-Gebühren der Transaktion verantwortlich.",crossChainTips:"Bei Chain-übergreifenden Auszahlungen ist eine Verifizierung über L2 (über ZK-Proofs) erforderlich. Die Auszahlung kann bis zu 2 Stunden dauern. Für die Abwicklung von Chain-übergreifenden Auszahlungen sind ausreichende Mittel im Asset-Pool der entsprechenden Chain erforderlich. Außerdem fallen Gas-Gebühren an. edgeX erhebt eine Gebühr zur Deckung dieser Kosten.",commonWithdraw:"FAQ zu Auszahlungen",withdraw:"Auszahlen",speed:"Geschwindigkeit",confirmWithdraw:"Auszahlung bestätigen",speedNote:"Bearbeitungszeiten:",speedNoteSpeed1:"Ca. 8 Minuten",speedNoteSpeed2:"Ca. 2-4 Stunden",speedNoteSpeed3:"Ca. 4 Stunden",receiverAddress:"Empfängeradresse",fee:"Gebühr",feeRate:"Gebührensatz",withdrawlAmount:"Auszahlungsbetrag",amountToReceive:"Zu erhaltender Betrag",minWithdraw:"Mindestauszahlungsbetrag",minWithdrawParsed:"Min. Auszahlung {{amount}} {{token}}",invalidReceiverAddress:"Die Adresse darf nicht leer sein.",availableDesc:"Der maximale Betrag, den du auszahlen kannst. Wenn das verfügbare Guthaben 0 oder negativ ist, können keine Auszahlungen vorgenommen werden.",feeCalculationTip:"Die Auszahlungsgebühren werden berechnet, indem der Auszahlungsbetrag mit dem Gebührensatz multipliziert wird. Der Mindestbetrag liegt bei 1 USDT/USDC. Der Gebührensatz kann auf Basis der tatsächlichen On-chain-Bedingungen angepasst werden.",crossChainPoolBalance:"Guthaben des Cross-Chain-Pools",poolBalance:"Pool-Guthaben",poolBalanceInsufficientTip:"Da der Auszahlungsbetrag das Pool-Guthaben übersteigt, kann die Auszahlung nicht bearbeitet werden. Bitte wähle eine Option mit ausreichendem Pool-Guthaben.",connectedWalletTitle:"Auszahlung an verbundene Wallet",connectedWalletDesc:"Zahle Geld an deine verbundene Krypto-Wallet, MetaMask, WalletConnect oder einen anderen Anbieter aus",externalWalletTitle:"Auszahlung an externes Konto",externalWalletDesc:"Zahle Geld an Binance oder anderen Börsen, Chains wie Arbitrum und anderen Wallets aus"},account:{title:"Konto",perp:"Perpetual-Konto","perpetual-v1":"Perpetuals-V1-Konto","perpetual-v2":"Perpetuals-V2-Konto",spot:"Spot-Konto"}},eb={deposit:{title:"Deposit",chain:"Chain",asset:"Asset",amount:"Amount",available:"Available",equity:"Equity",confirmDeposit:"Confirm Deposit",switchNetwork:"Switch Network",max:"Max",fast:"Fast",standard:"Standard",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.
32
+ Bei Chain-übergreifenden Einzahlungen musst du die Edge-Gas-Gebühr zahlen. Der gutgeschriebene Betrag wird etwas geringer sein als dein Einzahlungsbetrag.`,addressUpdatedNotice:"Hinweis: Deine Einzahlungsadresse wurde aktualisiert. Verwende die neue Adresse. Die alte Adresse funktioniert nur während der Übergangszeit und wird dann deaktiviert. Wenn sie an einem anderen Ort gespeichert wurde, aktualisiere sie umgehend.",enableSystemProWithToken:"{{token}} auf {{network}} aktivieren",enableTokenDesc:"Bei der ersten Einzahlung auf {{network}} musst du {{token}} aktivieren.",enableWithToken:"{{token}} aktivieren",arrivaltimeTooltip1:"Die Gelder kommen in etwa {{v}} Minuten an (nach Erreichen von {{v1}} Blockbestätigungen).",arrivaltimeTooltip2:"Die geschätzte Zeit wird auf der Grundlage historischer Daten berechnet und dient nur als Referenz. Eine Überlastung des Netzwerks kann zu längeren tatsächlichen Ankunftszeiten führen.",arrivalEstimated:"≈ {{v}} Minuten",feeRateTooltip:"Geschätzte Gebühr, tatsächliche Abzug maßgeblich.",availableDesc:"Der maximale Betrag, den du einzahlen kannst. Wenn das verfügbare Guthaben 0 oder negativ ist, können keine Einzahlungen vorgenommen werden.",noPrivateKeyWalletWarning:"Verwende für Einzahlungen keine schlüssellosen Wallets. Einzahlungen mit einer schlüssellosen Wallet können zu einem unwiderruflichen Verlust der Gelder führen.",layerZeroDepositTip:"Das System wird deine Einzahlung über LayerZero auf Basis der tatsächlichen Einzahlungsbedingungen abschließen.",layerZeroDepositTipExceedPool:"Da der Einzahlungsbetrag den Pool übersteigt, wird deine Einzahlung über LayerZero abgewickelt.",layerZeroDepositTipGte200k:"Da der Einzahlungsbetrag größer als oder gleich 200.000 USDT ist, wird deine Einzahlung über LayerZero abgewickelt.",layerZeroDepositButton:"Mit LayerZero einzahlen",defaultSpotNotice:"Standardeinzahlungen werden dem Spot-Konto gutgeschrieben.",defaultSpotToPerpNotice:"Für Einzahlungen an diese Adresse wird nur {{coin}} ({{v}}) unterstützt. Standardeinzahlungen werden dem Spot-Konto gutgeschrieben. Überweise Gelder vom Spot-Konto auf das Futures-Konto, um das Futures-Konto zu finanzieren.",connectedWalletTitle:"Einzahlung von einer verbundenen Wallet",connectedWalletDesc:"Verwende MetaMask, WalletConnect oder einen anderen Anbieter, um Geld von deiner Krypto-Wallet einzuzahlen",externalWalletTitle:"Einzahlung von externem Konto",externalWalletDesc:"Überweise Gelder von Binance oder anderen Börsen, Chains wie Arbitrum und anderen Wallets",or:"OR"},withdraw:{noticeDesc:"Normale Auszahlungen erfolgen in zwei Schritten. Im aktuellen Schritt wird dein Auszahlungsantrag eingeleitet und auf Layer 2 bearbeitet. Sobald deine Gelder zur Verfügung stehen (dies kann bis zu 4 Stunden dauern), erhältst du eine Benachrichtigung, um deine Gelder in deine Wallet auszuzahlen. Aufgrund der Chain-Synchronisierung und anderer Faktoren kann die Dauer bis zu 48 Stunden betragen. Du bist für alle Gas-Gebühren der Transaktion verantwortlich.",crossChainTips:"Bei Chain-übergreifenden Auszahlungen ist eine Verifizierung über L2 (über ZK-Proofs) erforderlich. Die Auszahlung kann bis zu 2 Stunden dauern. Für die Abwicklung von Chain-übergreifenden Auszahlungen sind ausreichende Mittel im Asset-Pool der entsprechenden Chain erforderlich. Außerdem fallen Gas-Gebühren an. edgeX erhebt eine Gebühr zur Deckung dieser Kosten.",commonWithdraw:"FAQ zu Auszahlungen",withdraw:"Auszahlen",speed:"Geschwindigkeit",confirmWithdraw:"Auszahlung bestätigen",speedNote:"Bearbeitungszeiten:",speedNoteSpeed1:"Ca. 8 Minuten",speedNoteSpeed2:"Ca. 2-4 Stunden",speedNoteSpeed3:"Ca. 4 Stunden",receiverAddress:"Empfängeradresse",fee:"Gebühr",feeRate:"Gebührensatz",withdrawlAmount:"Auszahlungsbetrag",amountToReceive:"Zu erhaltender Betrag",minWithdraw:"Mindestauszahlungsbetrag",minWithdrawParsed:"Min. Auszahlung {{amount}} {{token}}",invalidReceiverAddress:"Die Adresse darf nicht leer sein.",availableDesc:"Der maximale Betrag, den du auszahlen kannst. Wenn das verfügbare Guthaben 0 oder negativ ist, können keine Auszahlungen vorgenommen werden.",feeCalculationTip:"Die Auszahlungsgebühren werden berechnet, indem der Auszahlungsbetrag mit dem Gebührensatz multipliziert wird. Der Mindestbetrag liegt bei 1 USDT/USDC. Der Gebührensatz kann auf Basis der tatsächlichen On-chain-Bedingungen angepasst werden.",largeWithdrawFeeTip:"Die Auszahlungsgebühr beträgt 0,015 % und wird direkt vom Auszahlungsbetrag abgezogen.",crossChainPoolBalance:"Guthaben des Cross-Chain-Pools",poolBalance:"Pool-Guthaben",poolBalanceInsufficientTip:"Da der Auszahlungsbetrag das Pool-Guthaben übersteigt, kann die Auszahlung nicht bearbeitet werden. Bitte wähle eine Option mit ausreichendem Pool-Guthaben.",connectedWalletTitle:"Auszahlung an verbundene Wallet",connectedWalletDesc:"Zahle Geld an deine verbundene Krypto-Wallet, MetaMask, WalletConnect oder einen anderen Anbieter aus",externalWalletTitle:"Auszahlung an externes Konto",externalWalletDesc:"Zahle Geld an Binance oder anderen Börsen, Chains wie Arbitrum und anderen Wallets aus"},account:{title:"Konto",perp:"Perpetual-Konto","perpetual-v1":"Perpetuals-V1-Konto","perpetual-v2":"Perpetuals-V2-Konto",spot:"Spot-Konto"}},eb={deposit:{title:"Deposit",chain:"Chain",asset:"Asset",amount:"Amount",available:"Available",equity:"Equity",confirmDeposit:"Confirm Deposit",switchNetwork:"Switch Network",max:"Max",fast:"Fast",standard:"Standard",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
33
  If the deposit amount exceeds 200,000, there may be a delay in the arrival time. Please be patient.`,maxDepositSplitTip:"The maximum amount per deposit is 200,000. If you need to deposit more than 200,000, please split it into multiple deposits.",spotDepositNotSupportedTip:"Deposits aren't supported. Please deposit to perpetual account, then transfer.",crossChainDepositFeeTip:`Only {{coin}} ({{v}}) is supported for deposits to this address.
34
- Cross-chain deposits require you to pay the Edge gas fee. The credited amount will be slightly less than your deposit amount.`,addressUpdatedNotice:"Notice: Your deposit address has been updated. Use the new address. The old one works only during the transition and will be disabled. If saved elsewhere, update it promptly.",enableSystemProWithToken:"Enable {{token}} on {{network}}",enableTokenDesc:"You must enable {{token}} the first time you deposit on {{network}}.",enableWithToken:"Enable {{token}}",arrivaltimeTooltip1:"The funds will arrive in approximately {{v}} minutes (after reaching {{v1}} block confirmations).",arrivaltimeTooltip2:"Estimated time is calculated based on historical data and is for reference only. Network congestion may result in longer actual arrival times.",arrivalEstimated:"≈ {{v}} minutes",feeRateTooltip:"Estimated fee, subject to actual deduction.",availableDesc:"The maximum amount you can deposit. When the available balance is 0 or negative, deposits cannot be made.",noPrivateKeyWalletWarning:"Do not use keyless wallets to make deposits. Depositing with a keyless wallet may result in irreversible loss of funds.",layerZeroDepositTip:"The system will complete your deposit via LayerZero based on the actual deposit conditions.",layerZeroDepositTipExceedPool:"Since the deposit amount exceeds the pool, your deposit will be completed via LayerZero.",layerZeroDepositTipGte200k:"Since the deposit amount is greater than or equal to 200,000 USDT, your deposit will be completed via LayerZero.",layerZeroDepositButton:"Deposit with LayerZero",defaultSpotNotice:"Default deposits go to the spot account.",defaultSpotToPerpNotice:"Only {{coin}} ({{v}}) is supported for deposits to this address. Default deposits go to the spot account. To fund the futures account, transfer from the spot account to the futures account.",connectedWalletTitle:"Deposit from connected wallet",connectedWalletDesc:"Use MetaMask, WalletConnect, or another provider to deposit funds from your crypto wallet",externalWalletTitle:"Deposit from external account",externalWalletDesc:"Transfer funds from Binance or other exchanges, chains like Arbitrum, and other wallets",or:"OR"},withdraw:{noticeDesc:"Normal withdrawals are a two-step process. The current step initiates your withdrawal request and will be processed on Layer 2. Once your funds are ready (can take up to 4 hours), you will receive a notification to withdraw funds to your wallet. Due to chain synchronization and other factors, the duration may take up to 48 hours. You are responsible for any transaction gas fees.",crossChainTips:"Cross-chain withdrawals require verification at L2 (via ZK proofs) and the withdrawal process may take up to 2 hours. Sufficient funds in the corresponding chain's asset pool are required to process cross-chain withdrawals. Gas fees will also be incurred. edgeX will charge a fee to cover this.",commonWithdraw:"Withdrawal FAQ",withdraw:"Withdraw",speed:"Speed",confirmWithdraw:"Confirm Withdrawal",speedNote:"Processing Times:",speedNoteSpeed1:"Approx. 8 Minutes",speedNoteSpeed2:"Approx. 2-4 Hours",speedNoteSpeed3:"Approx. 4 Hours",receiverAddress:"Receiver Address",fee:"Fee",feeRate:"Fee Rate",withdrawlAmount:"Withdrawal amount",amountToReceive:"Amount to Receive",minWithdraw:"Minimum Withdrawal Amount",minWithdrawParsed:"Min. Withdrawal {{amount}} {{token}}",invalidReceiverAddress:"Address cannot be empty",availableDesc:"The maximum amount you can withdraw. When the available balance is 0 or negative, withdrawals cannot be made.",feeCalculationTip:"Withdrawal fees are calculated by multiplying the withdrawal amount by the fee rate, with a minimum of 1 USDT/USDC. The fee rate may be adjusted based on actual on-chain conditions.",crossChainPoolBalance:"Cross-chain pool balance",poolBalance:"Pool balance",poolBalanceInsufficientTip:"The withdrawal amount exceeds the fund pool balance, and the withdrawal cannot be processed. Please select an option with a sufficient fund pool balance.",connectedWalletTitle:"Withdraw to connected wallet",connectedWalletDesc:"Withdraw funds to your connected crypto wallet, MetaMask, WalletConnect, or another provider",externalWalletTitle:"Withdraw to external account",externalWalletDesc:"Withdraw funds to Binance or other exchanges, chains like Arbitrum, and other wallets"},account:{title:"Account",perp:"Perpetual Account","perpetual-v1":"Perpetuals V1 Account","perpetual-v2":"Perpetuals V2 Account",spot:"Spot Account"}},tb={deposit:{title:"Depósito",chain:"Cadena",asset:"Activo",amount:"Monto",available:"Disponible",equity:"Capital",confirmDeposit:"Confirmar depósito",switchNetwork:"Cambiar de red",max:"Máx.",fast:"Rápido",standard:"Estándar",arrivalTime:"Hora de llegada",ethCrossChainDepositInitiated:"Se inició el depósito entre cadenas de ETH. Llegada estimada en 2 a 5 minutos.",minDeposit:"Monto mínimo de depósito",minDepositParsed:"Mín. de depósito: {{amount}} {{token}}",maxDeposit:"Monto máximo de depósito",depositTipFor25w:"El monto máximo por depósito es de 200,000. Si tu depósito supera los 200,000, usa la cadena Ethereum.",depositAllTip:`Esta dirección solo admite depósitos en {{coin}} ({{v}})
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",feeRateTooltip:"Estimated fee, subject to actual deduction.",availableDesc:"The maximum amount you can deposit. When the available balance is 0 or negative, deposits cannot be made.",noPrivateKeyWalletWarning:"Do not use keyless wallets to make deposits. Depositing with a keyless wallet may result in irreversible loss of funds.",layerZeroDepositTip:"The system will complete your deposit via LayerZero based on the actual deposit conditions.",layerZeroDepositTipExceedPool:"Since the deposit amount exceeds the pool, your deposit will be completed via LayerZero.",layerZeroDepositTipGte200k:"Since the deposit amount is greater than or equal to 200,000 USDT, your deposit will be completed via LayerZero.",layerZeroDepositButton:"Deposit with LayerZero",defaultSpotNotice:"Default deposits go to the spot account.",defaultSpotToPerpNotice:"Only {{coin}} ({{v}}) is supported for deposits to this address. Default deposits go to the spot account. To fund the futures account, transfer from the spot account to the futures account.",connectedWalletTitle:"Deposit from connected wallet",connectedWalletDesc:"Use MetaMask, WalletConnect, or another provider to deposit funds from your crypto wallet",externalWalletTitle:"Deposit from external account",externalWalletDesc:"Transfer funds from Binance or other exchanges, chains like Arbitrum, and other wallets",or:"OR"},withdraw:{noticeDesc:"Normal withdrawals are a two-step process. The current step initiates your withdrawal request and will be processed on Layer 2. Once your funds are ready (can take up to 4 hours), you will receive a notification to withdraw funds to your wallet. Due to chain synchronization and other factors, the duration may take up to 48 hours. You are responsible for any transaction gas fees.",crossChainTips:"Cross-chain withdrawals require verification at L2 (via ZK proofs) and the withdrawal process may take up to 2 hours. Sufficient funds in the corresponding chain's asset pool are required to process cross-chain withdrawals. Gas fees will also be incurred. edgeX will charge a fee to cover this.",commonWithdraw:"Withdrawal FAQ",withdraw:"Withdraw",speed:"Speed",confirmWithdraw:"Confirm Withdrawal",speedNote:"Processing Times:",speedNoteSpeed1:"Approx. 8 Minutes",speedNoteSpeed2:"Approx. 2-4 Hours",speedNoteSpeed3:"Approx. 4 Hours",receiverAddress:"Receiver Address",fee:"Fee",feeRate:"Fee Rate",withdrawlAmount:"Withdrawal amount",amountToReceive:"Amount to Receive",minWithdraw:"Minimum Withdrawal Amount",minWithdrawParsed:"Min. Withdrawal {{amount}} {{token}}",invalidReceiverAddress:"Address cannot be empty",availableDesc:"The maximum amount you can withdraw. When the available balance is 0 or negative, withdrawals cannot be made.",feeCalculationTip:"Withdrawal fees are calculated by multiplying the withdrawal amount by the fee rate, with a minimum of 1 USDT/USDC. The fee rate may be adjusted based on actual on-chain conditions.",largeWithdrawFeeTip:"A withdrawal fee of 0.015% will be deducted from the withdrawal amount.",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.",connectedWalletTitle:"Withdraw to connected wallet",connectedWalletDesc:"Withdraw funds to your connected crypto wallet, MetaMask, WalletConnect, or another provider",externalWalletTitle:"Withdraw to external account",externalWalletDesc:"Withdraw funds to Binance or other exchanges, chains like Arbitrum, and other wallets"},account:{title:"Account",perp:"Perpetual Account","perpetual-v1":"Perpetuals V1 Account","perpetual-v2":"Perpetuals V2 Account",spot:"Spot Account"}},tb={deposit:{title:"Depósito",chain:"Cadena",asset:"Activo",amount:"Monto",available:"Disponible",equity:"Capital",confirmDeposit:"Confirmar depósito",switchNetwork:"Cambiar de red",max:"Máx.",fast:"Rápido",standard:"Estándar",arrivalTime:"Hora de llegada",ethCrossChainDepositInitiated:"Se inició el depósito entre cadenas de ETH. Llegada estimada en 2 a 5 minutos.",minDeposit:"Monto mínimo de depósito",minDepositParsed:"Mín. de depósito: {{amount}} {{token}}",maxDeposit:"Monto máximo de depósito",depositTipFor25w:"El monto máximo por depósito es de 200,000. Si tu depósito supera los 200,000, usa la cadena Ethereum.",depositAllTip:`Esta dirección solo admite depósitos en {{coin}} ({{v}})
35
35
  Si el monto del depósito supera los 200,000, puede haber un retraso en la hora de llegada. Ten paciencia.`,maxDepositSplitTip:"El monto máximo por depósito es de 200,000. Si necesitas depositar más de 200,000, divídelo en varios depósitos.",spotDepositNotSupportedTip:"No se admiten depósitos. Deposita en la cuenta de perpetuos y luego haz la transferencia.",crossChainDepositFeeTip:`Esta dirección solo admite depósitos en {{coin}} ({{v}})
36
- Los depósitos entre cadenas requieren el pago de la comisión de gas de Edge. El monto acreditado será ligeramente inferior al monto depositado.`,addressUpdatedNotice:"Aviso: Se actualizó tu dirección de depósito. Usa esta nueva dirección. La anterior solo funciona durante la transición y pronto se desactivará. Si la tienes guardada en otros dispositivos, actualízala lo antes posible.",enableSystemProWithToken:"Habilitar {{token}} en {{network}}",enableTokenDesc:"Debes habilitar {{token}} la primera vez que deposites en {{network}}.",enableWithToken:"Habilitar {{token}}",arrivaltimeTooltip1:"Los fondos se acreditarán en aproximadamente {{v}} minutos (tras obtener {{v1}} confirmaciones de bloque).",arrivaltimeTooltip2:"El tiempo estimado se calcula a partir de datos históricos y es solo de referencia. La congestión de la red puede ocasionar tiempos de acreditación más largos.",arrivalEstimated:"Aprox. {{v}} minutos",feeRateTooltip:"Tarifa estimada, deducción real prevalece.",availableDesc:"Lo máximo que puedes depositar. Si el saldo disponible es 0 o negativo, los depósitos no están permitidos.",noPrivateKeyWalletWarning:"No uses billeteras sin clave para realizar depósitos. Existe el riesgo de una pérdida irreversible de los fondos.",layerZeroDepositTip:"El sistema completará tu depósito a través de LayerZero según las condiciones de depósito reales.",layerZeroDepositTipExceedPool:"Dado que el importe del depósito supera el pool, tu depósito se completará a través de LayerZero.",layerZeroDepositTipGte200k:"El depósito es de 200,000 USDT o más. Se completará a través de LayerZero.",layerZeroDepositButton:"Depositar con LayerZero",defaultSpotNotice:"Los depósitos predeterminados van a la cuenta spot.",defaultSpotToPerpNotice:"Esta dirección solo admite depósitos en {{coin}} ({{v}}) Los depósitos predeterminados van a la cuenta spot. Para agregar fondos a la cuenta de futuros, transfiere desde la cuenta spot a la cuenta de futuros.",connectedWalletTitle:"Depósito desde una billetera conectada",connectedWalletDesc:"Usa MetaMask, WalletConnect u otro proveedor para depositar fondos desde tu billetera cripto.",externalWalletTitle:"Depósito desde una cuenta externa",externalWalletDesc:"Transfiere fondos desde Binance u otros exchanges, cadenas como Arbitrum y otras billeteras.",or:"OR"},withdraw:{noticeDesc:"Los retiros normales son un proceso de dos pasos. Este paso inicia tu solicitud de retiro, que se procesará en la capa 2. Una vez que tus fondos estén listos (puede tardar hasta 4 horas), recibirás una notificación para retirar fondos a tu billetera. Debido a la sincronización de la cadena y a otros factores, el proceso puede llevar hasta 48 horas. Las comisiones de gas de las transacciones corren por tu cuenta.",crossChainTips:"Los retiros entre cadenas requieren verificación en la capa 2 (mediante pruebas ZK) y el proceso de retiro puede tardar hasta 2 horas. Para procesar retiros entre cadenas, se requieren fondos suficientes en el pool de activos de la cadena correspondiente. También se incurrirá en comisiones de gas. edgeX cobrará una tarifa para cubrirlos.",commonWithdraw:"Preguntas frecuentes sobre los retiros",withdraw:"Retirar",speed:"Velocidad",confirmWithdraw:"Confirmar el retiro",speedNote:"Plazos de procesamiento:",speedNoteSpeed1:"Aprox. 8 minutos",speedNoteSpeed2:"Aprox. 2-4 horas",speedNoteSpeed3:"Aprox. 4 horas",receiverAddress:"Dirección del destinatario",fee:"Comisión",feeRate:"Tasa de comisión",withdrawlAmount:"Monto del retiro",amountToReceive:"Monto a recibir",minWithdraw:"Monto mínimo de retiro",minWithdrawParsed:"Min. de retiro: {{amount}} {{token}}",invalidReceiverAddress:"La dirección no puede estar vacía",availableDesc:"Lo máximo que puedes retirar. Si el saldo disponible es 0 o negativo, los retiros no están permitidos.",feeCalculationTip:"Las comisiones de retiro se calculan multiplicando el monto de retiro por la tasa de comisión, con un mínimo de 1 USDT/USDC. La tasa de la comisión puede modificarse en función de las condiciones reales de la cadena.",crossChainPoolBalance:"Saldo del pool cross-chain",poolBalance:"Saldo del pool",poolBalanceInsufficientTip:"El monto a retirar excede el saldo del pool. El retiro no se puede procesar. Selecciona una opción con un saldo suficiente en el pool.",connectedWalletTitle:"Retiro a una billetera conectada",connectedWalletDesc:"Retira fondos a la billetera cripto que tengas conectada: MetaMask, WalletConnect u otro proveedor.",externalWalletTitle:"Retiro a una cuenta externa",externalWalletDesc:"Retira fondos a Binance u otros exchanges, cadenas como Arbitrum y otras billeteras."},account:{title:"Cuenta",perp:"Cuenta de perpetuos","perpetual-v1":"Cuenta de perpetuos V1","perpetual-v2":"Cuenta de perpetuos V2",spot:"Cuenta spot"}},nb={deposit:{title:"Dépôt",chain:"Blockchain",asset:"Actif",amount:"Montant",available:"Disponible",equity:"Actif net",confirmDeposit:"Confirmer le dépôt",switchNetwork:"Changer de réseau",max:"Max.",fast:"Rapide",standard:"Standard",arrivalTime:"Heure d’arrivée",ethCrossChainDepositInitiated:"Dépôt ETH inter-blockchains initié. Arrivée estimée dans 2 à 5 minutes.",minDeposit:"Montant minimum de dépôt",minDepositParsed:"Dépôt min. {{amount}} {{token}}",maxDeposit:"Montant maximum de dépôt",depositTipFor25w:"Le montant maximum par dépôt est de 200 000. Si votre dépôt dépasse 200 000, utilisez la blockchain Ethereum.",depositAllTip:`Seuls les dépôts en {{coin}} ({{v}}) sont pris en charge pour cette adresse.
36
+ Los depósitos entre cadenas requieren el pago de la comisión de gas de Edge. El monto acreditado será ligeramente inferior al monto depositado.`,addressUpdatedNotice:"Aviso: Se actualizó tu dirección de depósito. Usa esta nueva dirección. La anterior solo funciona durante la transición y pronto se desactivará. Si la tienes guardada en otros dispositivos, actualízala lo antes posible.",enableSystemProWithToken:"Habilitar {{token}} en {{network}}",enableTokenDesc:"Debes habilitar {{token}} la primera vez que deposites en {{network}}.",enableWithToken:"Habilitar {{token}}",arrivaltimeTooltip1:"Los fondos se acreditarán en aproximadamente {{v}} minutos (tras obtener {{v1}} confirmaciones de bloque).",arrivaltimeTooltip2:"El tiempo estimado se calcula a partir de datos históricos y es solo de referencia. La congestión de la red puede ocasionar tiempos de acreditación más largos.",arrivalEstimated:"Aprox. {{v}} minutos",feeRateTooltip:"Tarifa estimada, deducción real prevalece.",availableDesc:"Lo máximo que puedes depositar. Si el saldo disponible es 0 o negativo, los depósitos no están permitidos.",noPrivateKeyWalletWarning:"No uses billeteras sin clave para realizar depósitos. Existe el riesgo de una pérdida irreversible de los fondos.",layerZeroDepositTip:"El sistema completará tu depósito a través de LayerZero según las condiciones de depósito reales.",layerZeroDepositTipExceedPool:"Dado que el importe del depósito supera el pool, tu depósito se completará a través de LayerZero.",layerZeroDepositTipGte200k:"El depósito es de 200,000 USDT o más. Se completará a través de LayerZero.",layerZeroDepositButton:"Depositar con LayerZero",defaultSpotNotice:"Los depósitos predeterminados van a la cuenta spot.",defaultSpotToPerpNotice:"Esta dirección solo admite depósitos en {{coin}} ({{v}}) Los depósitos predeterminados van a la cuenta spot. Para agregar fondos a la cuenta de futuros, transfiere desde la cuenta spot a la cuenta de futuros.",connectedWalletTitle:"Depósito desde una billetera conectada",connectedWalletDesc:"Usa MetaMask, WalletConnect u otro proveedor para depositar fondos desde tu billetera cripto.",externalWalletTitle:"Depósito desde una cuenta externa",externalWalletDesc:"Transfiere fondos desde Binance u otros exchanges, cadenas como Arbitrum y otras billeteras.",or:"OR"},withdraw:{noticeDesc:"Los retiros normales son un proceso de dos pasos. Este paso inicia tu solicitud de retiro, que se procesará en la capa 2. Una vez que tus fondos estén listos (puede tardar hasta 4 horas), recibirás una notificación para retirar fondos a tu billetera. Debido a la sincronización de la cadena y a otros factores, el proceso puede llevar hasta 48 horas. Las comisiones de gas de las transacciones corren por tu cuenta.",crossChainTips:"Los retiros entre cadenas requieren verificación en la capa 2 (mediante pruebas ZK) y el proceso de retiro puede tardar hasta 2 horas. Para procesar retiros entre cadenas, se requieren fondos suficientes en el pool de activos de la cadena correspondiente. También se incurrirá en comisiones de gas. edgeX cobrará una tarifa para cubrirlos.",commonWithdraw:"Preguntas frecuentes sobre los retiros",withdraw:"Retirar",speed:"Velocidad",confirmWithdraw:"Confirmar el retiro",speedNote:"Plazos de procesamiento:",speedNoteSpeed1:"Aprox. 8 minutos",speedNoteSpeed2:"Aprox. 2-4 horas",speedNoteSpeed3:"Aprox. 4 horas",receiverAddress:"Dirección del destinatario",fee:"Comisión",feeRate:"Tasa de comisión",withdrawlAmount:"Monto del retiro",amountToReceive:"Monto a recibir",minWithdraw:"Monto mínimo de retiro",minWithdrawParsed:"Min. de retiro: {{amount}} {{token}}",invalidReceiverAddress:"La dirección no puede estar vacía",availableDesc:"Lo máximo que puedes retirar. Si el saldo disponible es 0 o negativo, los retiros no están permitidos.",feeCalculationTip:"Las comisiones de retiro se calculan multiplicando el monto de retiro por la tasa de comisión, con un mínimo de 1 USDT/USDC. La tasa de la comisión puede modificarse en función de las condiciones reales de la cadena.",largeWithdrawFeeTip:"La comisión por retiro es del 0,015 % y se deducirá directamente del monto retirado.",crossChainPoolBalance:"Saldo del pool cross-chain",poolBalance:"Saldo del pool",poolBalanceInsufficientTip:"El monto a retirar excede el saldo del pool. El retiro no se puede procesar. Selecciona una opción con un saldo suficiente en el pool.",connectedWalletTitle:"Retiro a una billetera conectada",connectedWalletDesc:"Retira fondos a la billetera cripto que tengas conectada: MetaMask, WalletConnect u otro proveedor.",externalWalletTitle:"Retiro a una cuenta externa",externalWalletDesc:"Retira fondos a Binance u otros exchanges, cadenas como Arbitrum y otras billeteras."},account:{title:"Cuenta",perp:"Cuenta de perpetuos","perpetual-v1":"Cuenta de perpetuos V1","perpetual-v2":"Cuenta de perpetuos V2",spot:"Cuenta spot"}},nb={deposit:{title:"Dépôt",chain:"Blockchain",asset:"Actif",amount:"Montant",available:"Disponible",equity:"Actif net",confirmDeposit:"Confirmer le dépôt",switchNetwork:"Changer de réseau",max:"Max.",fast:"Rapide",standard:"Standard",arrivalTime:"Heure d’arrivée",ethCrossChainDepositInitiated:"Dépôt ETH inter-blockchains initié. Arrivée estimée dans 2 à 5 minutes.",minDeposit:"Montant minimum de dépôt",minDepositParsed:"Dépôt min. {{amount}} {{token}}",maxDeposit:"Montant maximum de dépôt",depositTipFor25w:"Le montant maximum par dépôt est de 200 000. Si votre dépôt dépasse 200 000, utilisez la blockchain Ethereum.",depositAllTip:`Seuls les dépôts en {{coin}} ({{v}}) sont pris en charge pour cette adresse.
37
37
  Si le montant du dépôt dépasse 200 000, l’heure d’arrivée peut être retardée. Merci de patienter.`,maxDepositSplitTip:"Le montant maximum par dépôt est de 200 000. Si vous devez déposer plus de 200 000, veuillez effectuer plusieurs dépôts.",spotDepositNotSupportedTip:"Les dépôts ne sont pas pris en charge. Veuillez effectuer le dépôt sur le compte perpétuel, puis transférer les fonds.",crossChainDepositFeeTip:`Seuls les dépôts en {{coin}} ({{v}}) sont pris en charge pour cette adresse.
38
- Les dépôts inter-blockchains nécessitent le paiement des frais de gas Edge. Le montant crédité sera légèrement inférieur au montant déposé.`,addressUpdatedNotice:"Avis : Votre adresse de dépôt a été mise à jour. Utilisez la nouvelle adresse. L’ancienne ne fonctionne que pendant la transition et sera désactivée. Si vous l’avez enregistrée ailleurs, modifiez-la sans tarder.",enableSystemProWithToken:"Activer {{token}} sur {{network}}",enableTokenDesc:"Vous devez activer {{token}} lors de votre premier dépôt sur {{network}}.",enableWithToken:"Activer {{token}}",arrivaltimeTooltip1:"Les fonds arriveront dans environ {{v}} minutes (après {{v1}} confirmations de bloc).",arrivaltimeTooltip2:"La durée estimée est calculée sur la base de données historiques et n’est donnée qu’à titre indicatif. L’encombrement du réseau peut rallonger l’heure d’arrivée réelle.",arrivalEstimated:"≈ {{v}} minutes",feeRateTooltip:"Frais estimés, déduction réelle fait foi.",availableDesc:"Montant maximal que vous pouvez déposer. Lorsque le solde disponible est nul ou négatif, aucun dépôt ne peut être effectué.",noPrivateKeyWalletWarning:"N’utilisez pas de wallets sans clé pour effectuer des dépôts. Un dépôt effectué depuis un wallet sans clé peut entraîner une perte irréversible des fonds.",layerZeroDepositTip:"Le système effectuera votre dépôt via LayerZero en fonction des conditions réelles du dépôt.",layerZeroDepositTipExceedPool:"Comme le montant du dépôt est supérieur au pool, votre dépôt sera effectué via LayerZero.",layerZeroDepositTipGte200k:"Comme le montant du dépôt est supérieur ou égal à 200 000 USDT, votre dépôt sera effectué via LayerZero.",layerZeroDepositButton:"Déposer via LayerZero",defaultSpotNotice:"Par défaut, les dépôts sont crédités sur le compte spot.",defaultSpotToPerpNotice:"Seuls les dépôts en {{coin}} ({{v}}) sont pris en charge pour cette adresse. Par défaut, les dépôts sont crédités sur le compte spot. Pour alimenter le compte futures, transférez des fonds du compte spot vers le compte futures.",connectedWalletTitle:"Dépôt depuis un wallet connecté",connectedWalletDesc:"Utilisez MetaMask, WalletConnect ou un autre fournisseur pour déposer des fonds depuis votre wallet crypto",externalWalletTitle:"Dépôt depuis un compte externe",externalWalletDesc:"Transférez des fonds depuis Binance ou d’autres plateformes, des chaînes comme Arbitrum, ou d’autres wallets",or:"OR"},withdraw:{noticeDesc:"Les retraits classiques s’effectuent en deux étapes. Cette étape initie votre demande de retrait et sera traitée sur la Layer 2. Une fois vos fonds prêts (cela peut prendre jusqu’à 4 heures), vous recevrez une notification pour retirer les fonds vers votre wallet. En raison de la synchronisation de la chaîne et d’autres facteurs, le délai peut atteindre 48 heures. Vous êtes responsable de tous les frais de gas liés aux transactions.",crossChainTips:"Les retraits inter-blockchains nécessitent une vérification sur L2 (via des preuves ZK) et le processus de retrait peut prendre jusqu’à 2 heures. Des fonds suffisants dans le pool d’actifs de la chaîne concernée sont nécessaires pour traiter les retraits inter-blockchains. Des frais de gas seront également appliqués. edgeX facturera des frais pour les couvrir.",commonWithdraw:"FAQ sur les retraits",withdraw:"Retrait",speed:"Vitesse",confirmWithdraw:"Confirmer le retrait",speedNote:"Délais de traitement :",speedNoteSpeed1:"Env. 8 minutes",speedNoteSpeed2:"Env. 2 à 4 heures",speedNoteSpeed3:"Env. 4 heures",receiverAddress:"Adresse de réception",fee:"Frais",feeRate:"Taux de frais",withdrawlAmount:"Montant du retrait",amountToReceive:"Montant à recevoir",minWithdraw:"Montant minimum de retrait",minWithdrawParsed:"Retrait min. {{amount}} {{token}}",invalidReceiverAddress:"L’adresse ne peut pas être vide",availableDesc:"Montant maximal que vous pouvez retirer. Lorsque le solde disponible est nul ou négatif, aucun retrait ne peut être effectué.",feeCalculationTip:"Les frais de retrait sont calculés en multipliant le montant du retrait par le taux de frais, avec un minimum de 1 USDT/USDC. Le taux de frais peut être ajusté en fonction des conditions réelles on-chain.",crossChainPoolBalance:"Solde du pool inter-blockchains",poolBalance:"Solde du pool",poolBalanceInsufficientTip:"Le montant du retrait dépasse le solde du pool de fonds ; le retrait ne peut pas être traité. Sélectionnez une option disposant d’un solde de pool de fonds suffisant.",connectedWalletTitle:"Retrait vers un wallet connecté",connectedWalletDesc:"Retirez des fonds vers votre wallet crypto connecté, MetaMask, WalletConnect ou un autre fournisseur",externalWalletTitle:"Retrait vers un compte externe",externalWalletDesc:"Retirez des fonds vers Binance ou d’autres plateformes, des chaînes comme Arbitrum, ou d’autres wallets"},account:{title:"Compte",perp:"Compte perpétuel","perpetual-v1":"Compte Perpétuels V1","perpetual-v2":"Compte Perpétuels V2",spot:"Compte spot"}},rb={deposit:{title:"Deposita",chain:"Blockchain",asset:"Asset",amount:"Importo",available:"Disponibile",equity:"Equity",confirmDeposit:"Conferma il deposito",switchNetwork:"Cambia rete",max:"Max",fast:"Rapido",standard:"Standard",arrivalTime:"Orario di arrivo",ethCrossChainDepositInitiated:"Deposito cross-chain di ETH avviato. Il deposito arriverà tra 2-5 minuti.",minDeposit:"Importo minimo del deposito",minDepositParsed:"Deposito min. {{amount}} {{token}}",maxDeposit:"Importo massimo del deposito",depositTipFor25w:"L'importo massimo per deposito è 200.000. Se il tuo deposito supera i 200.000, utilizza la catena Ethereum.",depositAllTip:`I depositi a questo indirizzo supportano solo {{coin}} ({{v}}).
38
+ Les dépôts inter-blockchains nécessitent le paiement des frais de gas Edge. Le montant crédité sera légèrement inférieur au montant déposé.`,addressUpdatedNotice:"Avis : Votre adresse de dépôt a été mise à jour. Utilisez la nouvelle adresse. L’ancienne ne fonctionne que pendant la transition et sera désactivée. Si vous l’avez enregistrée ailleurs, modifiez-la sans tarder.",enableSystemProWithToken:"Activer {{token}} sur {{network}}",enableTokenDesc:"Vous devez activer {{token}} lors de votre premier dépôt sur {{network}}.",enableWithToken:"Activer {{token}}",arrivaltimeTooltip1:"Les fonds arriveront dans environ {{v}} minutes (après {{v1}} confirmations de bloc).",arrivaltimeTooltip2:"La durée estimée est calculée sur la base de données historiques et n’est donnée qu’à titre indicatif. L’encombrement du réseau peut rallonger l’heure d’arrivée réelle.",arrivalEstimated:"≈ {{v}} minutes",feeRateTooltip:"Frais estimés, déduction réelle fait foi.",availableDesc:"Montant maximal que vous pouvez déposer. Lorsque le solde disponible est nul ou négatif, aucun dépôt ne peut être effectué.",noPrivateKeyWalletWarning:"N’utilisez pas de wallets sans clé pour effectuer des dépôts. Un dépôt effectué depuis un wallet sans clé peut entraîner une perte irréversible des fonds.",layerZeroDepositTip:"Le système effectuera votre dépôt via LayerZero en fonction des conditions réelles du dépôt.",layerZeroDepositTipExceedPool:"Comme le montant du dépôt est supérieur au pool, votre dépôt sera effectué via LayerZero.",layerZeroDepositTipGte200k:"Comme le montant du dépôt est supérieur ou égal à 200 000 USDT, votre dépôt sera effectué via LayerZero.",layerZeroDepositButton:"Déposer via LayerZero",defaultSpotNotice:"Par défaut, les dépôts sont crédités sur le compte spot.",defaultSpotToPerpNotice:"Seuls les dépôts en {{coin}} ({{v}}) sont pris en charge pour cette adresse. Par défaut, les dépôts sont crédités sur le compte spot. Pour alimenter le compte futures, transférez des fonds du compte spot vers le compte futures.",connectedWalletTitle:"Dépôt depuis un wallet connecté",connectedWalletDesc:"Utilisez MetaMask, WalletConnect ou un autre fournisseur pour déposer des fonds depuis votre wallet crypto",externalWalletTitle:"Dépôt depuis un compte externe",externalWalletDesc:"Transférez des fonds depuis Binance ou d’autres plateformes, des chaînes comme Arbitrum, ou d’autres wallets",or:"OR"},withdraw:{noticeDesc:"Les retraits classiques s’effectuent en deux étapes. Cette étape initie votre demande de retrait et sera traitée sur la Layer 2. Une fois vos fonds prêts (cela peut prendre jusqu’à 4 heures), vous recevrez une notification pour retirer les fonds vers votre wallet. En raison de la synchronisation de la chaîne et d’autres facteurs, le délai peut atteindre 48 heures. Vous êtes responsable de tous les frais de gas liés aux transactions.",crossChainTips:"Les retraits inter-blockchains nécessitent une vérification sur L2 (via des preuves ZK) et le processus de retrait peut prendre jusqu’à 2 heures. Des fonds suffisants dans le pool d’actifs de la chaîne concernée sont nécessaires pour traiter les retraits inter-blockchains. Des frais de gas seront également appliqués. edgeX facturera des frais pour les couvrir.",commonWithdraw:"FAQ sur les retraits",withdraw:"Retrait",speed:"Vitesse",confirmWithdraw:"Confirmer le retrait",speedNote:"Délais de traitement :",speedNoteSpeed1:"Env. 8 minutes",speedNoteSpeed2:"Env. 2 à 4 heures",speedNoteSpeed3:"Env. 4 heures",receiverAddress:"Adresse de réception",fee:"Frais",feeRate:"Taux de frais",withdrawlAmount:"Montant du retrait",amountToReceive:"Montant à recevoir",minWithdraw:"Montant minimum de retrait",minWithdrawParsed:"Retrait min. {{amount}} {{token}}",invalidReceiverAddress:"L’adresse ne peut pas être vide",availableDesc:"Montant maximal que vous pouvez retirer. Lorsque le solde disponible est nul ou négatif, aucun retrait ne peut être effectué.",feeCalculationTip:"Les frais de retrait sont calculés en multipliant le montant du retrait par le taux de frais, avec un minimum de 1 USDT/USDC. Le taux de frais peut être ajusté en fonction des conditions réelles on-chain.",largeWithdrawFeeTip:"Les frais de retrait s'élèvent à 0,015 % et seront déduits directement du montant retiré.",crossChainPoolBalance:"Solde du pool inter-blockchains",poolBalance:"Solde du pool",poolBalanceInsufficientTip:"Le montant du retrait dépasse le solde du pool de fonds ; le retrait ne peut pas être traité. Sélectionnez une option disposant d’un solde de pool de fonds suffisant.",connectedWalletTitle:"Retrait vers un wallet connecté",connectedWalletDesc:"Retirez des fonds vers votre wallet crypto connecté, MetaMask, WalletConnect ou un autre fournisseur",externalWalletTitle:"Retrait vers un compte externe",externalWalletDesc:"Retirez des fonds vers Binance ou d’autres plateformes, des chaînes comme Arbitrum, ou d’autres wallets"},account:{title:"Compte",perp:"Compte perpétuel","perpetual-v1":"Compte Perpétuels V1","perpetual-v2":"Compte Perpétuels V2",spot:"Compte spot"}},rb={deposit:{title:"Deposita",chain:"Blockchain",asset:"Asset",amount:"Importo",available:"Disponibile",equity:"Equity",confirmDeposit:"Conferma il deposito",switchNetwork:"Cambia rete",max:"Max",fast:"Rapido",standard:"Standard",arrivalTime:"Orario di arrivo",ethCrossChainDepositInitiated:"Deposito cross-chain di ETH avviato. Il deposito arriverà tra 2-5 minuti.",minDeposit:"Importo minimo del deposito",minDepositParsed:"Deposito min. {{amount}} {{token}}",maxDeposit:"Importo massimo del deposito",depositTipFor25w:"L'importo massimo per deposito è 200.000. Se il tuo deposito supera i 200.000, utilizza la catena Ethereum.",depositAllTip:`I depositi a questo indirizzo supportano solo {{coin}} ({{v}}).
39
39
  Se l'importo del deposito supera i 200.000, l'orario di arrivo potrebbe subire ritardi. Sii paziente.`,maxDepositSplitTip:"L'importo massimo per deposito è 200.000. Se devi depositare più di 200.000, dividi l'importo in più depositi.",spotDepositNotSupportedTip:"I depositi non sono supportati. Prima deposita sul conto perpetuo, quindi effettua il trasferimento.",crossChainDepositFeeTip:`I depositi a questo indirizzo supportano solo {{coin}} ({{v}}).
40
- Per i depositi cross-chain è necessario pagare la gas fee Edge. L'importo accreditato sarà leggermente inferiore all'importo del deposito.`,addressUpdatedNotice:"Avviso: il tuo indirizzo di deposito è stato aggiornato. Utilizza il nuovo indirizzo. L'indirizzo precedente funzionerà solo durante la transizione, quindi verrà disattivato. Se l'hai salvato altrove, aggiornarlo il prima possibile.",enableSystemProWithToken:"Abilita {{token}} su {{network}}",enableTokenDesc:"Devi abilitare {{token}} la prima volta che depositi su {{network}}.",enableWithToken:"Abilita {{token}}",arrivaltimeTooltip1:"I fondi arriveranno entro circa {{v}} minuti (dopo{{v1}} conferme di blocco).",arrivaltimeTooltip2:"Il tempo stimato è calcolato in base ai dati storici ed solo per riferimento. Se la rete è congestionata, potrebbero esserci dei ritardi.",arrivalEstimated:"≈ {{v}} minuti",feeRateTooltip:"Commissione stimata, detrazione effettiva prevalente.",availableDesc:"L'importo massimo che puoi depositare. Se il saldo disponibile è pari a 0 o negativo, non sarà possibile effettuare depositi.",noPrivateKeyWalletWarning:"Non effettuare depositi con wallet senza chiavi. Se effettui un deposito tramite un wallet senza chiave rischi di perdere i tuoi fondi per sempre.",layerZeroDepositTip:"Il sistema completerà il tuo deposito tramite LayerZero in base alle condizioni effettive di deposito.",layerZeroDepositTipExceedPool:"Poiché l'importo del deposito supera il pool, il deposito sarà completato tramite LayerZero.",layerZeroDepositTipGte200k:"Poiché l'importo del deposito è maggiore o uguale a 200.000 USDT, il deposito verrà completato tramite LayerZero.",layerZeroDepositButton:"Deposita con LayerZero",defaultSpotNotice:"I depositi predefiniti vanno sul conto spot.",defaultSpotToPerpNotice:"I depositi a questo indirizzo supportano solo {{coin}} ({{v}}). I depositi predefiniti vanno sul conto spot. Per finanziare il conto futures, effettua un trasferimento dal conto spot al conto futures.",connectedWalletTitle:"Deposita dal wallet collegato",connectedWalletDesc:"Usa MetaMask, WalletConnect o un altro fornitore per depositare fondi dal tuo wallet crypto",externalWalletTitle:"Deposita da account esterno",externalWalletDesc:"Trasferisci fondi da Binance o altri exchange, blockchain come Arbitrum e altri wallet",or:"OR"},withdraw:{noticeDesc:"I prelievi normali avvengono in due fasi. La fase attuale dà il via alla richiesta di prelievo, che verrà elaborata nel Layer 2. Non appena i fondi saranno pronti (possono volerci fino a 4 ore), riceverai una notifica per prelevarli nel tuo portafoglio. A causa della sincronizzazione della blockchain e di altri fattori, l'operazione potrebbe richiedere fino a 48 ore. Sei responsabile di eventuali gas fee per la transazione.",crossChainTips:"I prelievi cross-chain richiedono una verifica sul L2 (tramite prove ZK) e l'elaborazione del prelievo può richiedere fino a 2 ore. Per elaborare i prelievi cross-chain, il pool degli asset della blockchain corrispondente deve disporre di fondi a sufficienza. Inoltre, è necessario pagare delle gas fee. edgeX addebiterà una commissione per coprire tale costo.",commonWithdraw:"Domande frequenti sui prelievi",withdraw:"Preleva",speed:"Velocità",confirmWithdraw:"Conferma prelievo",speedNote:"Tempi di elaborazione:",speedNoteSpeed1:"Circa 8 minuti",speedNoteSpeed2:"Circa 2-4 ore",speedNoteSpeed3:"Circa 4 ore",receiverAddress:"Indirizzo del destinatario",fee:"Commissione",feeRate:"Tariffa",withdrawlAmount:"Importo del prelievo",amountToReceive:"Importo da ricevere",minWithdraw:"Importo minimo di prelievo",minWithdrawParsed:"Prelievo min. {{amount}} {{token}}",invalidReceiverAddress:"L'indirizzo non può essere vuoto",availableDesc:"L'importo massimo che puoi prelevare. Se il saldo disponibile è pari a 0 o negativo, non sarà possibile effettuare prelievi.",feeCalculationTip:"Le commissioni di prelievo vengono calcolate moltiplicando l'importo del prelievo per il tasso di commissione, con un minimo di 1 USDT/USDC. La tariffa può essere modificata in base alle condizioni effettive on-chain.",crossChainPoolBalance:"Equilibrio del pool cross-chain",poolBalance:"Equilibrio della piscina",poolBalanceInsufficientTip:"L'importo del prelievo supera il saldo del fondo e il prelievo non può essere elaborato. Selezionare un'opzione con un saldo di fondi sufficiente.",connectedWalletTitle:"Preleva sul wallet collegato",connectedWalletDesc:"Preleva fondi dal wallet crypto collegato, MetaMask, WalletConnect o un altro fornitore",externalWalletTitle:"Preleva sull'account esterno",externalWalletDesc:"Preleva fondi da Binance o altri exchange, blockchain come Arbitrum e altri wallet"},account:{title:"Account",perp:"Conto perpetuo","perpetual-v1":"Conto perpetuo V1","perpetual-v2":"Conto perpetuo V2",spot:"Conto Spot"}},ob={deposit:{title:"入金",chain:"チェーン",asset:"資産",amount:"数量",available:"利用可能",equity:"総資産",confirmDeposit:"入金確認",switchNetwork:"ネットワークを切り替え",max:"最大",fast:"高速",standard:"標準",arrivalTime:"着金予定時間",ethCrossChainDepositInitiated:"ETH のクロスチェーン入金を開始しました。到着まで約2〜5分です。",minDeposit:"最低入金額",minDepositParsed:"最低入金額 {{amount}} {{token}}",maxDeposit:"最大入金額",depositTipFor25w:"1回の入金上限額は200,000です。200,000を超える場合は、Ethereumチェーンでの入金をご利用ください。",depositAllTip:`このアドレスは{{coin}}({{v}})専用です。他通貨は送金しないでください。
40
+ Per i depositi cross-chain è necessario pagare la gas fee Edge. L'importo accreditato sarà leggermente inferiore all'importo del deposito.`,addressUpdatedNotice:"Avviso: il tuo indirizzo di deposito è stato aggiornato. Utilizza il nuovo indirizzo. L'indirizzo precedente funzionerà solo durante la transizione, quindi verrà disattivato. Se l'hai salvato altrove, aggiornarlo il prima possibile.",enableSystemProWithToken:"Abilita {{token}} su {{network}}",enableTokenDesc:"Devi abilitare {{token}} la prima volta che depositi su {{network}}.",enableWithToken:"Abilita {{token}}",arrivaltimeTooltip1:"I fondi arriveranno entro circa {{v}} minuti (dopo{{v1}} conferme di blocco).",arrivaltimeTooltip2:"Il tempo stimato è calcolato in base ai dati storici ed solo per riferimento. Se la rete è congestionata, potrebbero esserci dei ritardi.",arrivalEstimated:"≈ {{v}} minuti",feeRateTooltip:"Commissione stimata, detrazione effettiva prevalente.",availableDesc:"L'importo massimo che puoi depositare. Se il saldo disponibile è pari a 0 o negativo, non sarà possibile effettuare depositi.",noPrivateKeyWalletWarning:"Non effettuare depositi con wallet senza chiavi. Se effettui un deposito tramite un wallet senza chiave rischi di perdere i tuoi fondi per sempre.",layerZeroDepositTip:"Il sistema completerà il tuo deposito tramite LayerZero in base alle condizioni effettive di deposito.",layerZeroDepositTipExceedPool:"Poiché l'importo del deposito supera il pool, il deposito sarà completato tramite LayerZero.",layerZeroDepositTipGte200k:"Poiché l'importo del deposito è maggiore o uguale a 200.000 USDT, il deposito verrà completato tramite LayerZero.",layerZeroDepositButton:"Deposita con LayerZero",defaultSpotNotice:"I depositi predefiniti vanno sul conto spot.",defaultSpotToPerpNotice:"I depositi a questo indirizzo supportano solo {{coin}} ({{v}}). I depositi predefiniti vanno sul conto spot. Per finanziare il conto futures, effettua un trasferimento dal conto spot al conto futures.",connectedWalletTitle:"Deposita dal wallet collegato",connectedWalletDesc:"Usa MetaMask, WalletConnect o un altro fornitore per depositare fondi dal tuo wallet crypto",externalWalletTitle:"Deposita da account esterno",externalWalletDesc:"Trasferisci fondi da Binance o altri exchange, blockchain come Arbitrum e altri wallet",or:"OR"},withdraw:{noticeDesc:"I prelievi normali avvengono in due fasi. La fase attuale dà il via alla richiesta di prelievo, che verrà elaborata nel Layer 2. Non appena i fondi saranno pronti (possono volerci fino a 4 ore), riceverai una notifica per prelevarli nel tuo portafoglio. A causa della sincronizzazione della blockchain e di altri fattori, l'operazione potrebbe richiedere fino a 48 ore. Sei responsabile di eventuali gas fee per la transazione.",crossChainTips:"I prelievi cross-chain richiedono una verifica sul L2 (tramite prove ZK) e l'elaborazione del prelievo può richiedere fino a 2 ore. Per elaborare i prelievi cross-chain, il pool degli asset della blockchain corrispondente deve disporre di fondi a sufficienza. Inoltre, è necessario pagare delle gas fee. edgeX addebiterà una commissione per coprire tale costo.",commonWithdraw:"Domande frequenti sui prelievi",withdraw:"Preleva",speed:"Velocità",confirmWithdraw:"Conferma prelievo",speedNote:"Tempi di elaborazione:",speedNoteSpeed1:"Circa 8 minuti",speedNoteSpeed2:"Circa 2-4 ore",speedNoteSpeed3:"Circa 4 ore",receiverAddress:"Indirizzo del destinatario",fee:"Commissione",feeRate:"Tariffa",withdrawlAmount:"Importo del prelievo",amountToReceive:"Importo da ricevere",minWithdraw:"Importo minimo di prelievo",minWithdrawParsed:"Prelievo min. {{amount}} {{token}}",invalidReceiverAddress:"L'indirizzo non può essere vuoto",availableDesc:"L'importo massimo che puoi prelevare. Se il saldo disponibile è pari a 0 o negativo, non sarà possibile effettuare prelievi.",feeCalculationTip:"Le commissioni di prelievo vengono calcolate moltiplicando l'importo del prelievo per il tasso di commissione, con un minimo di 1 USDT/USDC. La tariffa può essere modificata in base alle condizioni effettive on-chain.",largeWithdrawFeeTip:"La commissione di prelievo è pari allo 0,015 % e verrà dedotta direttamente dall'importo prelevato.",crossChainPoolBalance:"Equilibrio del pool cross-chain",poolBalance:"Equilibrio della piscina",poolBalanceInsufficientTip:"L'importo del prelievo supera il saldo del fondo e il prelievo non può essere elaborato. Selezionare un'opzione con un saldo di fondi sufficiente.",connectedWalletTitle:"Preleva sul wallet collegato",connectedWalletDesc:"Preleva fondi dal wallet crypto collegato, MetaMask, WalletConnect o un altro fornitore",externalWalletTitle:"Preleva sull'account esterno",externalWalletDesc:"Preleva fondi da Binance o altri exchange, blockchain come Arbitrum e altri wallet"},account:{title:"Account",perp:"Conto perpetuo","perpetual-v1":"Conto perpetuo V1","perpetual-v2":"Conto perpetuo V2",spot:"Conto Spot"}},ob={deposit:{title:"入金",chain:"チェーン",asset:"資産",amount:"数量",available:"利用可能",equity:"総資産",confirmDeposit:"入金確認",switchNetwork:"ネットワークを切り替え",max:"最大",fast:"高速",standard:"標準",arrivalTime:"着金予定時間",ethCrossChainDepositInitiated:"ETH のクロスチェーン入金を開始しました。到着まで約2〜5分です。",minDeposit:"最低入金額",minDepositParsed:"最低入金額 {{amount}} {{token}}",maxDeposit:"最大入金額",depositTipFor25w:"1回の入金上限額は200,000です。200,000を超える場合は、Ethereumチェーンでの入金をご利用ください。",depositAllTip:`このアドレスは{{coin}}({{v}})専用です。他通貨は送金しないでください。
41
41
  入金金額が 200,000 を超える場合、反映までに時間がかかることがあります。しばらくお待ちください。`,maxDepositSplitTip:"1回の入金上限は200,000です。200,000を超える金額を入金する場合は、複数回に分けて行ってください。",spotDepositNotSupportedTip:"入金非対応。先に契約アカウント入金後、振替。",crossChainDepositFeeTip:`このアドレスは{{coin}}({{v}})専用です。他通貨は送金しないでください。
42
- クロスチェーン入金では Edge ネットワーク手数料はお客様負担となります。入金額はご入金額よりわずかに少なくなります。`,addressUpdatedNotice:"注意:入金アドレスが更新されました。新しいアドレスをご利用ください。旧アドレスは移行期間のみ有効で、その後無効になります。他のサービスに保存している場合は早急に更新してください。",enableSystemProWithToken:"{{network}} 上で {{token}} を有効化",enableTokenDesc:"初めて {{network}} に入金する際は、{{token}} の有効化が必要です。",enableWithToken:"{{token}} を有効化",arrivaltimeTooltip1:"資金は約 {{v}} 分以内({{v1}} 回のブロック確認が完了後)に到账します。",arrivaltimeTooltip2:"着金時間は過去データに基づいた目安であり、ネットワーク状況により遅延する場合があります。",arrivalEstimated:"≈ {{v}}分",feeRateTooltip:"手数料の見積もり額で、実際の控除額を基準とします。",availableDesc:"入金可能な最大金額。利用可能残高が0または負の数の場合、入金はできません。",noPrivateKeyWalletWarning:"秘密鍵のないウォレットでの入金は行わないでください。そのような入金は資金を失い、取り戻すことができません。",layerZeroDepositTip:"システムは入金資金の実際の状況に基づき、LayerZeroを通じて入金を完了します。",layerZeroDepositTipExceedPool:"入金額がプールを超えているため、LayerZero を通じて入金が完了します。",layerZeroDepositTipGte200k:"入金額が 200,000 USDT 以上のため、LayerZero を通じて入金が完了します。",layerZeroDepositButton:"LayerZeroで入金",defaultSpotNotice:"デフォルトでは現物口座に入金されます",defaultSpotToPerpNotice:"このアドレスは {{coin}} ({{v}}) 専用です。 デフォルトでは現物口座に入金されます。先物口座に入金する場合は、現物口座から先物口座へ振替してください。",connectedWalletTitle:"接続済みウォレットから入庫",connectedWalletDesc:"MetaMask、WalletConnect、またはその他のプロバイダーを使用し、暗号資産ウォレットから資産を入庫してください。",externalWalletTitle:"外部アカウントから入庫",externalWalletDesc:"バイナンスや他の取引所、Arbitrumなどのネットワーク、またはその他ウォレットから資産を入庫する",or:"OR"},withdraw:{noticeDesc:"通常出金は2ステップで行われます。このステップで出金リクエストを送信し、Layer2で処理されます。資金の準備が完了すると(最大4時間かかる場合があります)、出金の通知が届きます。チェーンの同期などの影響により、所要時間は最長で48時間かかる場合があります。ガス代はユーザー負担です。",crossChainTips:"クロスチェーン出金はL2上(ゼロ知識証明経由)で検証が必要です。出金処理には最大2時間ほどかかる場合があります。対応するチェーンの資産プールに十分な流動性が必要であり、ガス代も発生します。edgeXはそのコストを補うため、一定の手数料を徴収します。",commonWithdraw:"出金ガイド",withdraw:"出金",speed:"出金時間",confirmWithdraw:"出金確認",speedNote:"処理時間:",speedNoteSpeed1:"約8分",speedNoteSpeed2:"約2~4時間",speedNoteSpeed3:"約4時間",receiverAddress:"受取アドレス",fee:"手数料",feeRate:"手数料率",withdrawlAmount:"出金額",amountToReceive:"受け取り金額",minWithdraw:"最低出金額",minWithdrawParsed:"最低出金 {{amount}} {{token}}",invalidReceiverAddress:"ウォレットアドレスは必須です",availableDesc:"引き出し可能な最大金額。利用可能残高が0または負の数の場合、引き出しはできません。",feeCalculationTip:"出金手数料は、出金金額に料率を乗じて計算され、最低1 USDT/USDCとなります。料率は、ブロックチェーンの実際の状況に基づいて調整される場合があります。",crossChainPoolBalance:"クロスチェーンプール残高",poolBalance:"プール残高",poolBalanceInsufficientTip:"出金額が資金プールの残高を上回っているため、出金は処理できません。資金プールの残高が十分にあるオプションを選択してください。",connectedWalletTitle:"接続済みウォレットへ出庫",connectedWalletDesc:"接続済み暗号資産ウォレット、MetaMask、WalletConnect、またはその他のプロバイダーへ資産を出庫する",externalWalletTitle:"外部アカウントへ出庫",externalWalletDesc:"バイナンスや他の取引所、Arbitrumなどのネットワーク、またはその他のウォレットへ資産を出庫する"},account:{title:"アカウント",perp:"パーペチュアルアカウント","perpetual-v1":"先物V1アカウント","perpetual-v2":"先物V2アカウント",spot:"スポットアカウント"}},sb={deposit:{title:"Депозит",chain:"Сеть",asset:"Актив",amount:"Сумма",available:"Доступно",equity:"Капитал",confirmDeposit:"Подтвердить депозит",switchNetwork:"Сменить сеть",max:"Максимум",fast:"Быстрый",standard:"Стандартный",arrivalTime:"Время поступления",ethCrossChainDepositInitiated:"Кроссчейн‑депозит ETH запущен. Ожидаемое зачисление: 2–5 минут.",minDeposit:"Минимальная сумма депозита",minDepositParsed:"Мин. депозит {{amount}} {{token}}",maxDeposit:"Максимальная сумма депозита",depositTipFor25w:"Максимальная сумма одного пополнения — 200 000. Если сумма превышает 200 000, пожалуйста, используйте сеть Ethereum для пополнения.",depositAllTip:`На этот адрес можно внести только {{coin}} ({{v}}).
42
+ クロスチェーン入金では Edge ネットワーク手数料はお客様負担となります。入金額はご入金額よりわずかに少なくなります。`,addressUpdatedNotice:"注意:入金アドレスが更新されました。新しいアドレスをご利用ください。旧アドレスは移行期間のみ有効で、その後無効になります。他のサービスに保存している場合は早急に更新してください。",enableSystemProWithToken:"{{network}} 上で {{token}} を有効化",enableTokenDesc:"初めて {{network}} に入金する際は、{{token}} の有効化が必要です。",enableWithToken:"{{token}} を有効化",arrivaltimeTooltip1:"資金は約 {{v}} 分以内({{v1}} 回のブロック確認が完了後)に到账します。",arrivaltimeTooltip2:"着金時間は過去データに基づいた目安であり、ネットワーク状況により遅延する場合があります。",arrivalEstimated:"≈ {{v}}分",feeRateTooltip:"手数料の見積もり額で、実際の控除額を基準とします。",availableDesc:"入金可能な最大金額。利用可能残高が0または負の数の場合、入金はできません。",noPrivateKeyWalletWarning:"秘密鍵のないウォレットでの入金は行わないでください。そのような入金は資金を失い、取り戻すことができません。",layerZeroDepositTip:"システムは入金資金の実際の状況に基づき、LayerZeroを通じて入金を完了します。",layerZeroDepositTipExceedPool:"入金額がプールを超えているため、LayerZero を通じて入金が完了します。",layerZeroDepositTipGte200k:"入金額が 200,000 USDT 以上のため、LayerZero を通じて入金が完了します。",layerZeroDepositButton:"LayerZeroで入金",defaultSpotNotice:"デフォルトでは現物口座に入金されます",defaultSpotToPerpNotice:"このアドレスは {{coin}} ({{v}}) 専用です。 デフォルトでは現物口座に入金されます。先物口座に入金する場合は、現物口座から先物口座へ振替してください。",connectedWalletTitle:"接続済みウォレットから入庫",connectedWalletDesc:"MetaMask、WalletConnect、またはその他のプロバイダーを使用し、暗号資産ウォレットから資産を入庫してください。",externalWalletTitle:"外部アカウントから入庫",externalWalletDesc:"バイナンスや他の取引所、Arbitrumなどのネットワーク、またはその他ウォレットから資産を入庫する",or:"OR"},withdraw:{noticeDesc:"通常出金は2ステップで行われます。このステップで出金リクエストを送信し、Layer2で処理されます。資金の準備が完了すると(最大4時間かかる場合があります)、出金の通知が届きます。チェーンの同期などの影響により、所要時間は最長で48時間かかる場合があります。ガス代はユーザー負担です。",crossChainTips:"クロスチェーン出金はL2上(ゼロ知識証明経由)で検証が必要です。出金処理には最大2時間ほどかかる場合があります。対応するチェーンの資産プールに十分な流動性が必要であり、ガス代も発生します。edgeXはそのコストを補うため、一定の手数料を徴収します。",commonWithdraw:"出金ガイド",withdraw:"出金",speed:"出金時間",confirmWithdraw:"出金確認",speedNote:"処理時間:",speedNoteSpeed1:"約8分",speedNoteSpeed2:"約2~4時間",speedNoteSpeed3:"約4時間",receiverAddress:"受取アドレス",fee:"手数料",feeRate:"手数料率",withdrawlAmount:"出金額",amountToReceive:"受け取り金額",minWithdraw:"最低出金額",minWithdrawParsed:"最低出金 {{amount}} {{token}}",invalidReceiverAddress:"ウォレットアドレスは必須です",availableDesc:"引き出し可能な最大金額。利用可能残高が0または負の数の場合、引き出しはできません。",feeCalculationTip:"出金手数料は、出金金額に料率を乗じて計算され、最低1 USDT/USDCとなります。料率は、ブロックチェーンの実際の状況に基づいて調整される場合があります。",largeWithdrawFeeTip:"出金手数料は0.015%で、出金額から直接差し引かれます。",crossChainPoolBalance:"クロスチェーンプール残高",poolBalance:"プール残高",poolBalanceInsufficientTip:"出金額が資金プールの残高を上回っているため、出金は処理できません。資金プールの残高が十分にあるオプションを選択してください。",connectedWalletTitle:"接続済みウォレットへ出庫",connectedWalletDesc:"接続済み暗号資産ウォレット、MetaMask、WalletConnect、またはその他のプロバイダーへ資産を出庫する",externalWalletTitle:"外部アカウントへ出庫",externalWalletDesc:"バイナンスや他の取引所、Arbitrumなどのネットワーク、またはその他のウォレットへ資産を出庫する"},account:{title:"アカウント",perp:"パーペチュアルアカウント","perpetual-v1":"先物V1アカウント","perpetual-v2":"先物V2アカウント",spot:"スポットアカウント"}},sb={deposit:{title:"Депозит",chain:"Сеть",asset:"Актив",amount:"Сумма",available:"Доступно",equity:"Капитал",confirmDeposit:"Подтвердить депозит",switchNetwork:"Сменить сеть",max:"Максимум",fast:"Быстрый",standard:"Стандартный",arrivalTime:"Время поступления",ethCrossChainDepositInitiated:"Кроссчейн‑депозит ETH запущен. Ожидаемое зачисление: 2–5 минут.",minDeposit:"Минимальная сумма депозита",minDepositParsed:"Мин. депозит {{amount}} {{token}}",maxDeposit:"Максимальная сумма депозита",depositTipFor25w:"Максимальная сумма одного пополнения — 200 000. Если сумма превышает 200 000, пожалуйста, используйте сеть Ethereum для пополнения.",depositAllTip:`На этот адрес можно внести только {{coin}} ({{v}}).
43
43
  Если сумма депозита превышает 200 000, время поступления может быть увеличено. Пожалуйста, ожидайте.`,maxDepositSplitTip:"Максимальная сумма одного пополнения — 200 000. Если вам нужно пополнить на сумму более 200 000, выполните несколько пополнений.",spotDepositNotSupportedTip:"Пополнение недоступно. Сначала контрактный счёт, затем перевод.",crossChainDepositFeeTip:`На этот адрес можно внести только {{coin}} ({{v}}).
44
44
  За кроссчейн‑депозит вы оплачиваете комиссию сети Edge. Зачисленная сумма будет немного меньше суммы вашего депозита.`,addressUpdatedNotice:"Внимание: ваш адрес пополнения обновлён. Используйте новый адрес. Старый действует только в переходный период и будет отключён. Если он сохранён где‑то ещё, срочно обновите.",enableSystemProWithToken:"Включить {{token}} в сети {{network}}",enableTokenDesc:"При первом депозите в сети {{network}} необходимо включить {{token}}.",enableWithToken:"Включить {{token}}",arrivaltimeTooltip1:"Средства поступят в течение примерно {{v}} минут (после достижения {{v1}} подтверждений блоков).",arrivaltimeTooltip2:"Оценка времени основана на истории и дана только для справки. Задержки сети могут увеличить фактическое время поступления.",arrivalEstimated:"≈ {{v}} минут",feeRateTooltip:"Предварительная комиссия, фактическое списание в качестве окончательного.",availableDesc:"Максимальная сумма, которую вы можете пополнить. Если доступный баланс равен 0 или отрицательный, пополнение невозможно.",noPrivateKeyWalletWarning:`Не используйте кошельки без приватных ключей для пополнения. Пополнение с такого кошелька может привести к безвозвратной потере средств.
45
45
 
46
- Tangem не подключаем, это кошелек без приватного ключа`,layerZeroDepositTip:"Система завершит ваше пополнение через LayerZero в зависимости от фактических условий депозита.",layerZeroDepositTipExceedPool:"Поскольку сумма пополнения превышает пул, ваше пополнение будет выполнено через LayerZero.",layerZeroDepositTipGte200k:"Поскольку сумма пополнения больше либо равна 200,000 USDT, ваше пополнение будет выполнено через LayerZero.",layerZeroDepositButton:"Пополнение через LayerZero",defaultSpotNotice:"По умолчанию — на спотовый счёт",defaultSpotToPerpNotice:"На этот адрес можно внести только {{coin}} ({{v}}). Пополнение по умолчанию зачисляется на спотовый счёт. Чтобы пополнить фьючерсный счёт, переведите средства со спотового на фьючерсный.",connectedWalletTitle:"Депозит с подключенного кошелька",connectedWalletDesc:"Используйте MetaMask, WalletConnect или другой сервис для внесения средств с криптокошелька",externalWalletTitle:"Депозит с внешнего аккаунта",externalWalletDesc:"Переводите средства с Binance или других бирж, блокчейнов, таких как Arbitrum, и других кошельков",or:"OR"},withdraw:{noticeDesc:"Вывод средств происходит в два этапа: сначала подаётся заявка на вывод (обрабатывается на Layer 2), затем - перевод на кошелёк после подготовки средств (до 14 часов). Из-за синхронизации цепочки и других факторов процесс может занять до 48 часов. За gas-комиссии отвечает пользователь.",crossChainTips:"• Кроссчейн выводы требуют проверки на L2 (через ZK доказательства) и могут занять до 2 часов. Для вывода нужны средства в пуле соответствующей цепи. Также взимается комиссия за газ. edgeX взимает плату за обслуживание.",commonWithdraw:"Часто задаваемые вопросы по выводу",withdraw:"Вывод",speed:"Скорость",confirmWithdraw:"Подтвердить вывод",speedNote:"Время обработки:",speedNoteSpeed1:"Прибл. 8 минут",speedNoteSpeed2:"Прибл. 2-4 часа",speedNoteSpeed3:"Прибл. 4 часа",receiverAddress:"Адрес получателя",fee:"Комиссия",feeRate:"Тариф",withdrawlAmount:"Сумма вывода",amountToReceive:"Сумма к получению",minWithdraw:"Минимальная сумма вывода",minWithdrawParsed:"Мин. вывод {{amount}} {{token}}",invalidReceiverAddress:"Укажите адрес кошелька",availableDesc:"Максимальная сумма, которую вы можете вывести. Если доступный баланс равен 0 или отрицательный, вывод средств невозможен.",feeCalculationTip:"Комиссия за вывод средств рассчитывается путем умножения суммы вывода на ставку комиссии, минимальная комиссия составляет 1 USDT/USDC. Ставка комиссии может быть скорректирована в зависимости от фактической ситуации в сети блокчейн.",crossChainPoolBalance:"Баланс кросс-чейн пула",poolBalance:"Баланс пула",poolBalanceInsufficientTip:"Сумма вывода превышает баланс пула средств, и операция не может быть выполнена. Пожалуйста, выберите опцию с достаточным балансом пула средств.",connectedWalletTitle:"Вывод на подключенный кошелек",connectedWalletDesc:"Выведите средства на подключенный криптокошелек: MetaMask, WalletConnect или другой",externalWalletTitle:"Вывод средств на внешний аккаунт",externalWalletDesc:"Выведите средства на Binance или другие биржи, блокчейны, такие как Arbitrum, и другие кошельки"},account:{title:"Аккаунт",perp:"Перпетуальный счет","perpetual-v1":"Перпетуальный счёт V1","perpetual-v2":"Перпетуальный счёт V2",spot:"Спотовый счет"}},ib={deposit:{title:"充值",chain:"链",asset:"资产",amount:"数量",available:"可用",equity:"总资产",confirmDeposit:"充值确认",switchNetwork:"切换网络",max:"最大",fast:"快速",standard:"普通",arrivalTime:"到账时间",ethCrossChainDepositInitiated:"ETH 跨链充值已发起,预计 2–5 分钟到账。",minDeposit:"最小充值金额",minDepositParsed:"最少充值 {{amount}} {{token}}",maxDeposit:"最大充值金额",depositTipFor25w:"单笔充值金额上限为 200,000。若充值金额大于200,000,请使用Ethereum链充值。",depositAllTip:`仅支持发送 {{coin}} ({{v}}) 资产到此地址。
46
+ Tangem не подключаем, это кошелек без приватного ключа`,layerZeroDepositTip:"Система завершит ваше пополнение через LayerZero в зависимости от фактических условий депозита.",layerZeroDepositTipExceedPool:"Поскольку сумма пополнения превышает пул, ваше пополнение будет выполнено через LayerZero.",layerZeroDepositTipGte200k:"Поскольку сумма пополнения больше либо равна 200,000 USDT, ваше пополнение будет выполнено через LayerZero.",layerZeroDepositButton:"Пополнение через LayerZero",defaultSpotNotice:"По умолчанию — на спотовый счёт",defaultSpotToPerpNotice:"На этот адрес можно внести только {{coin}} ({{v}}). Пополнение по умолчанию зачисляется на спотовый счёт. Чтобы пополнить фьючерсный счёт, переведите средства со спотового на фьючерсный.",connectedWalletTitle:"Депозит с подключенного кошелька",connectedWalletDesc:"Используйте MetaMask, WalletConnect или другой сервис для внесения средств с криптокошелька",externalWalletTitle:"Депозит с внешнего аккаунта",externalWalletDesc:"Переводите средства с Binance или других бирж, блокчейнов, таких как Arbitrum, и других кошельков",or:"OR"},withdraw:{noticeDesc:"Вывод средств происходит в два этапа: сначала подаётся заявка на вывод (обрабатывается на Layer 2), затем - перевод на кошелёк после подготовки средств (до 14 часов). Из-за синхронизации цепочки и других факторов процесс может занять до 48 часов. За gas-комиссии отвечает пользователь.",crossChainTips:"• Кроссчейн выводы требуют проверки на L2 (через ZK доказательства) и могут занять до 2 часов. Для вывода нужны средства в пуле соответствующей цепи. Также взимается комиссия за газ. edgeX взимает плату за обслуживание.",commonWithdraw:"Часто задаваемые вопросы по выводу",withdraw:"Вывод",speed:"Скорость",confirmWithdraw:"Подтвердить вывод",speedNote:"Время обработки:",speedNoteSpeed1:"Прибл. 8 минут",speedNoteSpeed2:"Прибл. 2-4 часа",speedNoteSpeed3:"Прибл. 4 часа",receiverAddress:"Адрес получателя",fee:"Комиссия",feeRate:"Тариф",withdrawlAmount:"Сумма вывода",amountToReceive:"Сумма к получению",minWithdraw:"Минимальная сумма вывода",minWithdrawParsed:"Мин. вывод {{amount}} {{token}}",invalidReceiverAddress:"Укажите адрес кошелька",availableDesc:"Максимальная сумма, которую вы можете вывести. Если доступный баланс равен 0 или отрицательный, вывод средств невозможен.",feeCalculationTip:"Комиссия за вывод средств рассчитывается путем умножения суммы вывода на ставку комиссии, минимальная комиссия составляет 1 USDT/USDC. Ставка комиссии может быть скорректирована в зависимости от фактической ситуации в сети блокчейн.",largeWithdrawFeeTip:"Комиссия за вывод составляет 0,015 % и будет вычтена непосредственно из суммы вывода.",crossChainPoolBalance:"Баланс кросс-чейн пула",poolBalance:"Баланс пула",poolBalanceInsufficientTip:"Сумма вывода превышает баланс пула средств, и операция не может быть выполнена. Пожалуйста, выберите опцию с достаточным балансом пула средств.",connectedWalletTitle:"Вывод на подключенный кошелек",connectedWalletDesc:"Выведите средства на подключенный криптокошелек: MetaMask, WalletConnect или другой",externalWalletTitle:"Вывод средств на внешний аккаунт",externalWalletDesc:"Выведите средства на Binance или другие биржи, блокчейны, такие как Arbitrum, и другие кошельки"},account:{title:"Аккаунт",perp:"Перпетуальный счет","perpetual-v1":"Перпетуальный счёт V1","perpetual-v2":"Перпетуальный счёт V2",spot:"Спотовый счет"}},ib={deposit:{title:"充值",chain:"链",asset:"资产",amount:"数量",available:"可用",equity:"总资产",confirmDeposit:"充值确认",switchNetwork:"切换网络",max:"最大",fast:"快速",standard:"普通",arrivalTime:"到账时间",ethCrossChainDepositInitiated:"ETH 跨链充值已发起,预计 2–5 分钟到账。",minDeposit:"最小充值金额",minDepositParsed:"最少充值 {{amount}} {{token}}",maxDeposit:"最大充值金额",depositTipFor25w:"单笔充值金额上限为 200,000。若充值金额大于200,000,请使用Ethereum链充值。",depositAllTip:`仅支持发送 {{coin}} ({{v}}) 资产到此地址。
47
47
  充值金额大于 200,000 时,到账时间存在一定延迟,请耐心等待。`,maxDepositSplitTip:"单笔充值金额上限为200,000。若需要充值金额大于200,000,请分多笔进行操作。",spotDepositNotSupportedTip:"不支持充值,请先充入合约账户再划转。",crossChainDepositFeeTip:`仅支持发送 {{coin}} ({{v}}) 资产到此地址。
48
- 跨链充值需由您承担 Edge 网络手续费。到账金额会略小于您的充值金额。`,addressUpdatedNotice:"注意:充值地址已更新,请改用新地址。原地址仅在过渡期可用,随后停用。若旧地址已存于其他平台,请尽快更新。",enableSystemProWithToken:"在{{network}}上启用{{token}}",enableTokenDesc:"您首次在{{network}}上存款时必须启用{{token}}。",enableWithToken:"启用 {{token}}",arrivaltimeTooltip1:"资金约在 {{v}} 分钟 内 (达到 {{v1}} 个区块确认后) 到账。",arrivaltimeTooltip2:"预计时间是根据历史数据计算所得,仅供参考。网络拥堵可能会导致实际到账时间变长。",arrivalEstimated:"≈ {{v}}分钟",feeRateTooltip:"预估手续费,以实际扣除为准。",availableDesc:"您可以充值的最大金额。当可用为0或负数时,无法进行充值。",noPrivateKeyWalletWarning:"请勿使用无私钥钱包进行充值,无私钥钱包充值会导致资金损失且无法追回。",layerZeroDepositTip:"系统会根据充值资金实际情况,将您的充值通过LayerZero完成。",layerZeroDepositTipExceedPool:"由于充值资金大于资金池,将通过LayerZero完成您的充值。",layerZeroDepositTipGte200k:"由于充值资金大于等于200,000 USDT,将通过LayerZero完成您的充值。",layerZeroDepositButton:"使用LayerZero充值",defaultSpotNotice:"默认充值至现货账户",defaultSpotToPerpNotice:"仅支持发送 {{coin}} ({{v}}) 资产到此地址。默认充值至现货账户。若需充入合约账户,请从现货账户划转至合约账户。",connectedWalletTitle:"从已连接钱包充值",connectedWalletDesc:"使用 MetaMask、WalletConnect 或其他钱包进行充值",externalWalletTitle:"从外部钱包充值",externalWalletDesc:"从 Binance 或其他交易所、Arbitrum 等链或其他钱包转账",or:"或"},withdraw:{noticeDesc:"普通提现是一个两步过程。 此步骤将发起您的提现请求,并将在 Layer2 进行处理。 一旦资金准备就绪(可能需要最多 4 小时),您将收到一条将资金提现到钱包的通知。受链同步等情况影响下,时长可能到 48 小时。您需要自行承担交易 gas 费用。",crossChainTips:"跨链提币需在 L2(通过零知识证明)进行验证。提币过程最多约需2小时。相关链的资产池中需有充足的资金来处理跨链提币,其间还将产生矿工费。 edgeX 将收取一定的手续费作为矿工费。",commonWithdraw:"提现说明",withdraw:"提现",speed:"速度",confirmWithdraw:"提现确认",speedNote:"处理时间:",speedNoteSpeed1:"用时约8分钟",speedNoteSpeed2:"用时约 2-4 小时",speedNoteSpeed3:"用时约4小时",receiverAddress:"接收地址",fee:"手续费",feeRate:"费率",withdrawlAmount:"提现金额",amountToReceive:"到账金额",minWithdraw:"最小提现金额",minWithdrawParsed:"最小提现 {{amount}} {{token}}",invalidReceiverAddress:"接收地址不能为空",availableDesc:"您可以提现的最大金额。当可用为0或负数时,无法进行提现。",feeCalculationTip:"提现手续费按照提现金额乘以费率计算,最低为1 USDT/USDC。费率会根据链上实际情况进行调整。",crossChainPoolBalance:"跨链资金池余额",poolBalance:"资金池余额",poolBalanceInsufficientTip:"提现金额大于资金池余额,无法进行提现。请选择资金池余额充足的选项。",connectedWalletTitle:"提现至已连接钱包",connectedWalletDesc:"将资金提现至您已连接的加密钱包、MetaMask、WalletConnect 或其他提供商",externalWalletTitle:"提现至外部账户",externalWalletDesc:"将资金提现至 Binance 或其他交易所、Arbitrum 等链及其他钱包"},account:{title:"账户",perp:"合约账户","perpetual-v1":"合约V1账户","perpetual-v2":"合约V2账户",spot:"现货账户"}},ab={deposit:{title:"充值",chain:"鏈",asset:"資產",amount:"數量",available:"可用",equity:"總資產",confirmDeposit:"充值確認",switchNetwork:"切換網絡",max:"最大",fast:"快速",standard:"普通",arrivalTime:"到帳時間",ethCrossChainDepositInitiated:"ETH 跨鏈充值已發起 ,預計 2–5 分鐘到賬。",minDeposit:"最小儲值金額",minDepositParsed:"最少充值 {{amount}} {{token}}",maxDeposit:"最大儲值金額",depositTipFor25w:"單筆充值金額上限為 200,000。若充值金額大於 200,000,請使用 Ethereum 鏈充值。",depositAllTip:`僅支援發送 {{coin}} ({{v}}) 資產到此位址。
48
+ 跨链充值需由您承担 Edge 网络手续费。到账金额会略小于您的充值金额。`,addressUpdatedNotice:"注意:充值地址已更新,请改用新地址。原地址仅在过渡期可用,随后停用。若旧地址已存于其他平台,请尽快更新。",enableSystemProWithToken:"在{{network}}上启用{{token}}",enableTokenDesc:"您首次在{{network}}上存款时必须启用{{token}}。",enableWithToken:"启用 {{token}}",arrivaltimeTooltip1:"资金约在 {{v}} 分钟 内 (达到 {{v1}} 个区块确认后) 到账。",arrivaltimeTooltip2:"预计时间是根据历史数据计算所得,仅供参考。网络拥堵可能会导致实际到账时间变长。",arrivalEstimated:"≈ {{v}}分钟",feeRateTooltip:"预估手续费,以实际扣除为准。",availableDesc:"您可以充值的最大金额。当可用为0或负数时,无法进行充值。",noPrivateKeyWalletWarning:"请勿使用无私钥钱包进行充值,无私钥钱包充值会导致资金损失且无法追回。",layerZeroDepositTip:"系统会根据充值资金实际情况,将您的充值通过LayerZero完成。",layerZeroDepositTipExceedPool:"由于充值资金大于资金池,将通过LayerZero完成您的充值。",layerZeroDepositTipGte200k:"由于充值资金大于等于200,000 USDT,将通过LayerZero完成您的充值。",layerZeroDepositButton:"使用LayerZero充值",defaultSpotNotice:"默认充值至现货账户",defaultSpotToPerpNotice:"仅支持发送 {{coin}} ({{v}}) 资产到此地址。默认充值至现货账户。若需充入合约账户,请从现货账户划转至合约账户。",connectedWalletTitle:"从已连接钱包充值",connectedWalletDesc:"使用 MetaMask、WalletConnect 或其他钱包进行充值",externalWalletTitle:"从外部钱包充值",externalWalletDesc:"从 Binance 或其他交易所、Arbitrum 等链或其他钱包转账",or:"或"},withdraw:{noticeDesc:"普通提现是一个两步过程。 此步骤将发起您的提现请求,并将在 Layer2 进行处理。 一旦资金准备就绪(可能需要最多 4 小时),您将收到一条将资金提现到钱包的通知。受链同步等情况影响下,时长可能到 48 小时。您需要自行承担交易 gas 费用。",crossChainTips:"跨链提币需在 L2(通过零知识证明)进行验证。提币过程最多约需2小时。相关链的资产池中需有充足的资金来处理跨链提币,其间还将产生矿工费。 edgeX 将收取一定的手续费作为矿工费。",commonWithdraw:"提现说明",withdraw:"提现",speed:"速度",confirmWithdraw:"提现确认",speedNote:"处理时间:",speedNoteSpeed1:"用时约8分钟",speedNoteSpeed2:"用时约 2-4 小时",speedNoteSpeed3:"用时约4小时",receiverAddress:"接收地址",fee:"手续费",feeRate:"费率",withdrawlAmount:"提现金额",amountToReceive:"到账金额",minWithdraw:"最小提现金额",minWithdrawParsed:"最小提现 {{amount}} {{token}}",invalidReceiverAddress:"接收地址不能为空",availableDesc:"您可以提现的最大金额。当可用为0或负数时,无法进行提现。",feeCalculationTip:"提现手续费按照提现金额乘以费率计算,最低为1 USDT/USDC。费率会根据链上实际情况进行调整。",largeWithdrawFeeTip:"提现手续费为0.015%,将从提现金额中扣除。",crossChainPoolBalance:"跨链资金池余额",poolBalance:"资金池余额",poolBalanceInsufficientTip:"提现金额大于资金池余额,无法进行提现。请选择资金池余额充足的选项。",connectedWalletTitle:"提现至已连接钱包",connectedWalletDesc:"将资金提现至您已连接的加密钱包、MetaMask、WalletConnect 或其他提供商",externalWalletTitle:"提现至外部账户",externalWalletDesc:"将资金提现至 Binance 或其他交易所、Arbitrum 等链及其他钱包"},account:{title:"账户",perp:"合约账户","perpetual-v1":"合约V1账户","perpetual-v2":"合约V2账户",spot:"现货账户"}},ab={deposit:{title:"充值",chain:"鏈",asset:"資產",amount:"數量",available:"可用",equity:"總資產",confirmDeposit:"充值確認",switchNetwork:"切換網絡",max:"最大",fast:"快速",standard:"普通",arrivalTime:"到帳時間",ethCrossChainDepositInitiated:"ETH 跨鏈充值已發起 ,預計 2–5 分鐘到賬。",minDeposit:"最小儲值金額",minDepositParsed:"最少充值 {{amount}} {{token}}",maxDeposit:"最大儲值金額",depositTipFor25w:"單筆充值金額上限為 200,000。若充值金額大於 200,000,請使用 Ethereum 鏈充值。",depositAllTip:`僅支援發送 {{coin}} ({{v}}) 資產到此位址。
49
49
  充值金額大於 200,000 時,到账時間可能會有延遲,請耐心等待。`,maxDepositSplitTip:"單筆充值金額上限為 200,000。若需要充值金額大於 200,000,請分多筆進行操作。",spotDepositNotSupportedTip:"不支援充值,請先充入合約帳戶再劃轉。",crossChainDepositFeeTip:`僅支援發送 {{coin}} ({{v}}) 資產到此位址。
50
- 跨鏈充值需由您承擔 Edge 網路手續費。到帳金額會略小於您的充值金額。`,addressUpdatedNotice:"注意:充值地址已更新,請改用新地址。原地址僅在過渡期內有效,之後將停用。若已在其他平台儲存,請儘速更新。",enableSystemProWithToken:"在{{network}}上啓用{{token}}",enableTokenDesc:"您首次在{{network}}上存款時必須啓用{{token}}。",enableWithToken:"啓用 {{token}}",arrivaltimeTooltip1:"資金約在 {{v}} 分鐘內(達到 {{v1}} 個區塊確認後)到賬。",arrivaltimeTooltip2:"預計時間是根據歷史資料計算所得,僅供參考。網路壅塞可能會導致實際到帳時間變長。",arrivalEstimated:"≈ {{v}}分鐘",feeRateTooltip:"預估手續費,以實際扣除為準。",availableDesc:"您可以充值的最大金額。當可用餘額為0或負數時,無法進行充值。",noPrivateKeyWalletWarning:"請勿使用無私鑰錢包進行充值,無私鑰錢包充值會導致資金損失且無法追回。",layerZeroDepositTip:"系統會根據充值資金的實際情況,通過 LayerZero 完成您的充值。",layerZeroDepositTipExceedPool:"由於充值資金大於資金池,將透過 LayerZero 完成您的充值。",layerZeroDepositTipGte200k:"由於充值資金大於等於 200,000 USDT,將透過 LayerZero 完成您的充值。",layerZeroDepositButton:"使用LayerZero充值",defaultSpotNotice:"預設充值至現貨帳戶",defaultSpotToPerpNotice:"僅支援發送 {{coin}} ({{v}}) 資產到此位址。預設充值至現貨帳戶。若需充入合約帳戶,請自現貨帳戶劃轉至合約帳戶。",connectedWalletTitle:"從已連接錢包充值",connectedWalletDesc:"使用 MetaMask、WalletConnect 或其他錢包進行充值",externalWalletTitle:"從外部錢包充值",externalWalletDesc:"從 Binance 或其他交易所、Arbitrum 等鏈或其他錢包轉帳",or:"或"},withdraw:{noticeDesc:"普通提現是一個兩步過程。此步驟將發起您的提現請求,並將在 Layer2 進行處理。一旦資金準備就緒(可能需要最多 4 小時),您將收到一條將資金提現到錢包的通知。受鏈同步等情況影響下,時長可能需要長達 48 小時。您需要自行承擔交易 gas 費用。",crossChainTips:"跨鏈提幣需在 L2(通過零知識證明)進行驗證。提幣過程最多約需2小時。相關鏈的資產池中需有充足的資金來處理跨鏈提幣,其間還將產生礦工費。 edgeX 將收取一定的手續費作爲礦工費。",commonWithdraw:"提現說明",withdraw:"提現",speed:"速度",confirmWithdraw:"提現確認",speedNote:"處理時間:",speedNoteSpeed1:"用時約8分鐘",speedNoteSpeed2:"用時約 2-4 小時",speedNoteSpeed3:"用時約4小時",receiverAddress:"接收地址",fee:"手續費",feeRate:"費率",withdrawlAmount:"提現金額",amountToReceive:"到账金額",minWithdraw:"最小提現金額",minWithdrawParsed:"最小提現 {{amount}} {{token}}",invalidReceiverAddress:"接收地址不能為空",availableDesc:"您可以提現的最大金額。當可用餘額為0或負數時,無法進行提現。",feeCalculationTip:"提現手續費按照提現金額乘以費率計算,最低為 1 USDT/USDC。費率會根據鏈上實際情況進行調整。",crossChainPoolBalance:"跨鏈資金池餘額",poolBalance:"資金池餘額",poolBalanceInsufficientTip:"提現金額大於資金池餘額,無法進行提現。請選擇資金池餘額充足的選項。",connectedWalletTitle:"提現至已連接錢包",connectedWalletDesc:"將資金提現至您已連接的加密錢包、MetaMask、WalletConnect 或其他提供商",externalWalletTitle:"提現至外部帳戶",externalWalletDesc:"將資金提現至 Binance 或其他交易所、Arbitrum 等鏈及其他錢包"},account:{title:"帳戶",perp:"合約帳戶","perpetual-v1":"合約V1賬戶","perpetual-v2":"合約V2賬戶",spot:"現貨帳戶"}},Ri=["en-US","ja-JP","ru-RU","zh-CN","zh-TW","de-DE","es-LA","fr-FR","it-IT"],Qc={"en-US":eb,"ja-JP":ob,"ru-RU":sb,"zh-CN":ib,"zh-TW":ab,"de-DE":Qm,"es-LA":tb,"fr-FR":nb,"it-IT":rb},ps="en-US",lb={"en-US":"English","zh-CN":"简体中文","zh-TW":"繁體中文","ja-JP":"日本語","ru-RU":"Русский","de-DE":"Deutsch","es-LA":"Español (Latinoamérica)","fr-FR":"Français","it-IT":"Italiano"},cb=e=>Ri.includes(e)?Qc[e]:Qc[ps],ub=e=>Ri.includes(e),eu=g.createContext(null),fb=({config:e,children:t})=>{const n=g.useMemo(()=>{const r=e.locale||ps,o=ub(r)?r:ps,s=cb(o);return{...e,currentLocale:o,translations:s}},[e]);return N.jsx(eu.Provider,{value:n,children:t})},tu=()=>{const e=g.useContext(eu);if(!e)throw new Error("useComponentConfig must be used within ComponentProvider");return e};var db=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,ji=Math.ceil,mt=Math.floor,Ze="[BigNumber Error] ",nu=Ze+"Number primitive has more than 15 significant digits: ",It=1e14,ae=14,zi=9007199254740991,Ui=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],An=1e7,De=1e9;function ru(e){var t,n,r,o=x.prototype={constructor:x,toString:null,valueOf:null},s=new x(1),i=20,l=4,a=-7,c=21,u=-1e7,f=1e7,p=!1,d=1,h=0,b={prefix:"",groupSize:3,secondaryGroupSize:0,groupSeparator:",",decimalSeparator:".",fractionGroupSize:0,fractionGroupSeparator:" ",suffix:""},w="0123456789abcdefghijklmnopqrstuvwxyz",P=!0;function x(m,v){var S,$,I,C,M,y,O,k,T=this;if(!(T instanceof x))return new x(m,v);if(v==null){if(m&&m._isBigNumber===!0){T.s=m.s,!m.c||m.e>f?T.c=T.e=null:m.e<u?T.c=[T.e=0]:(T.e=m.e,T.c=m.c.slice());return}if((y=typeof m=="number")&&m*0==0){if(T.s=1/m<0?(m=-m,-1):1,m===~~m){for(C=0,M=m;M>=10;M/=10,C++);C>f?T.c=T.e=null:(T.e=C,T.c=[m]);return}k=String(m)}else{if(!db.test(k=String(m)))return r(T,k,y);T.s=k.charCodeAt(0)==45?(k=k.slice(1),-1):1}(C=k.indexOf("."))>-1&&(k=k.replace(".","")),(M=k.search(/e/i))>0?(C<0&&(C=M),C+=+k.slice(M+1),k=k.substring(0,M)):C<0&&(C=k.length)}else{if(Pe(v,2,w.length,"Base"),v==10&&P)return T=new x(m),L(T,i+T.e+1,l);if(k=String(m),y=typeof m=="number"){if(m*0!=0)return r(T,k,y,v);if(T.s=1/m<0?(k=k.slice(1),-1):1,x.DEBUG&&k.replace(/^0\.0*|\./,"").length>15)throw Error(nu+m)}else T.s=k.charCodeAt(0)===45?(k=k.slice(1),-1):1;for(S=w.slice(0,v),C=M=0,O=k.length;M<O;M++)if(S.indexOf($=k.charAt(M))<0){if($=="."){if(M>C){C=O;continue}}else if(!I&&(k==k.toUpperCase()&&(k=k.toLowerCase())||k==k.toLowerCase()&&(k=k.toUpperCase()))){I=!0,M=-1,C=0;continue}return r(T,String(m),y,v)}y=!1,k=n(k,v,10,T.s),(C=k.indexOf("."))>-1?k=k.replace(".",""):C=k.length}for(M=0;k.charCodeAt(M)===48;M++);for(O=k.length;k.charCodeAt(--O)===48;);if(k=k.slice(M,++O)){if(O-=M,y&&x.DEBUG&&O>15&&(m>zi||m!==mt(m)))throw Error(nu+T.s*m);if((C=C-M-1)>f)T.c=T.e=null;else if(C<u)T.c=[T.e=0];else{if(T.e=C,T.c=[],M=(C+1)%ae,C<0&&(M+=ae),M<O){for(M&&T.c.push(+k.slice(0,M)),O-=ae;M<O;)T.c.push(+k.slice(M,M+=ae));M=ae-(k=k.slice(M)).length}else M-=O;for(;M--;k+="0");T.c.push(+k)}}else T.c=[T.e=0]}x.clone=ru,x.ROUND_UP=0,x.ROUND_DOWN=1,x.ROUND_CEIL=2,x.ROUND_FLOOR=3,x.ROUND_HALF_UP=4,x.ROUND_HALF_DOWN=5,x.ROUND_HALF_EVEN=6,x.ROUND_HALF_CEIL=7,x.ROUND_HALF_FLOOR=8,x.EUCLID=9,x.config=x.set=function(m){var v,S;if(m!=null)if(typeof m=="object"){if(m.hasOwnProperty(v="DECIMAL_PLACES")&&(S=m[v],Pe(S,0,De,v),i=S),m.hasOwnProperty(v="ROUNDING_MODE")&&(S=m[v],Pe(S,0,8,v),l=S),m.hasOwnProperty(v="EXPONENTIAL_AT")&&(S=m[v],S&&S.pop?(Pe(S[0],-De,0,v),Pe(S[1],0,De,v),a=S[0],c=S[1]):(Pe(S,-De,De,v),a=-(c=S<0?-S:S))),m.hasOwnProperty(v="RANGE"))if(S=m[v],S&&S.pop)Pe(S[0],-De,-1,v),Pe(S[1],1,De,v),u=S[0],f=S[1];else if(Pe(S,-De,De,v),S)u=-(f=S<0?-S:S);else throw Error(Ze+v+" cannot be zero: "+S);if(m.hasOwnProperty(v="CRYPTO"))if(S=m[v],S===!!S)if(S)if(typeof crypto<"u"&&crypto&&(crypto.getRandomValues||crypto.randomBytes))p=S;else throw p=!S,Error(Ze+"crypto unavailable");else p=S;else throw Error(Ze+v+" not true or false: "+S);if(m.hasOwnProperty(v="MODULO_MODE")&&(S=m[v],Pe(S,0,9,v),d=S),m.hasOwnProperty(v="POW_PRECISION")&&(S=m[v],Pe(S,0,De,v),h=S),m.hasOwnProperty(v="FORMAT"))if(S=m[v],typeof S=="object")b=S;else throw Error(Ze+v+" not an object: "+S);if(m.hasOwnProperty(v="ALPHABET"))if(S=m[v],typeof S=="string"&&!/^.?$|[+\-.\s]|(.).*\1/.test(S))P=S.slice(0,10)=="0123456789",w=S;else throw Error(Ze+v+" invalid: "+S)}else throw Error(Ze+"Object expected: "+m);return{DECIMAL_PLACES:i,ROUNDING_MODE:l,EXPONENTIAL_AT:[a,c],RANGE:[u,f],CRYPTO:p,MODULO_MODE:d,POW_PRECISION:h,FORMAT:b,ALPHABET:w}},x.isBigNumber=function(m){if(!m||m._isBigNumber!==!0)return!1;if(!x.DEBUG)return!0;var v,S,$=m.c,I=m.e,C=m.s;e:if({}.toString.call($)=="[object Array]"){if((C===1||C===-1)&&I>=-De&&I<=De&&I===mt(I)){if($[0]===0){if(I===0&&$.length===1)return!0;break e}if(v=(I+1)%ae,v<1&&(v+=ae),String($[0]).length==v){for(v=0;v<$.length;v++)if(S=$[v],S<0||S>=It||S!==mt(S))break e;if(S!==0)return!0}}}else if($===null&&I===null&&(C===null||C===1||C===-1))return!0;throw Error(Ze+"Invalid BigNumber: "+m)},x.maximum=x.max=function(){return A(arguments,-1)},x.minimum=x.min=function(){return A(arguments,1)},x.random=function(){var m=9007199254740992,v=Math.random()*m&2097151?function(){return mt(Math.random()*m)}:function(){return(Math.random()*1073741824|0)*8388608+(Math.random()*8388608|0)};return function(S){var $,I,C,M,y,O=0,k=[],T=new x(s);if(S==null?S=i:Pe(S,0,De),M=ji(S/ae),p)if(crypto.getRandomValues){for($=crypto.getRandomValues(new Uint32Array(M*=2));O<M;)y=$[O]*131072+($[O+1]>>>11),y>=9e15?(I=crypto.getRandomValues(new Uint32Array(2)),$[O]=I[0],$[O+1]=I[1]):(k.push(y%1e14),O+=2);O=M/2}else if(crypto.randomBytes){for($=crypto.randomBytes(M*=7);O<M;)y=($[O]&31)*281474976710656+$[O+1]*1099511627776+$[O+2]*4294967296+$[O+3]*16777216+($[O+4]<<16)+($[O+5]<<8)+$[O+6],y>=9e15?crypto.randomBytes(7).copy($,O):(k.push(y%1e14),O+=7);O=M/7}else throw p=!1,Error(Ze+"crypto unavailable");if(!p)for(;O<M;)y=v(),y<9e15&&(k[O++]=y%1e14);for(M=k[--O],S%=ae,M&&S&&(y=Ui[ae-S],k[O]=mt(M/y)*y);k[O]===0;k.pop(),O--);if(O<0)k=[C=0];else{for(C=-1;k[0]===0;k.splice(0,1),C-=ae);for(O=1,y=k[0];y>=10;y/=10,O++);O<ae&&(C-=ae-O)}return T.e=C,T.c=k,T}}(),x.sum=function(){for(var m=1,v=arguments,S=new x(v[0]);m<v.length;)S=S.plus(v[m++]);return S},n=function(){var m="0123456789";function v(S,$,I,C){for(var M,y=[0],O,k=0,T=S.length;k<T;){for(O=y.length;O--;y[O]*=$);for(y[0]+=C.indexOf(S.charAt(k++)),M=0;M<y.length;M++)y[M]>I-1&&(y[M+1]==null&&(y[M+1]=0),y[M+1]+=y[M]/I|0,y[M]%=I)}return y.reverse()}return function(S,$,I,C,M){var y,O,k,T,B,R,z,_,G=S.indexOf("."),J=i,K=l;for(G>=0&&(T=h,h=0,S=S.replace(".",""),_=new x($),R=_.pow(S.length-G),h=T,_.c=v(on(gt(R.c),R.e,"0"),10,I,m),_.e=_.c.length),z=v(S,$,I,M?(y=w,m):(y=m,w)),k=T=z.length;z[--T]==0;z.pop());if(!z[0])return y.charAt(0);if(G<0?--k:(R.c=z,R.e=k,R.s=C,R=t(R,_,J,K,I),z=R.c,B=R.r,k=R.e),O=k+J+1,G=z[O],T=I/2,B=B||O<0||z[O+1]!=null,B=K<4?(G!=null||B)&&(K==0||K==(R.s<0?3:2)):G>T||G==T&&(K==4||B||K==6&&z[O-1]&1||K==(R.s<0?8:7)),O<1||!z[0])S=B?on(y.charAt(1),-J,y.charAt(0)):y.charAt(0);else{if(z.length=O,B)for(--I;++z[--O]>I;)z[O]=0,O||(++k,z=[1].concat(z));for(T=z.length;!z[--T];);for(G=0,S="";G<=T;S+=y.charAt(z[G++]));S=on(S,k,y.charAt(0))}return S}}(),t=function(){function m($,I,C){var M,y,O,k,T=0,B=$.length,R=I%An,z=I/An|0;for($=$.slice();B--;)O=$[B]%An,k=$[B]/An|0,M=z*O+k*R,y=R*O+M%An*An+T,T=(y/C|0)+(M/An|0)+z*k,$[B]=y%C;return T&&($=[T].concat($)),$}function v($,I,C,M){var y,O;if(C!=M)O=C>M?1:-1;else for(y=O=0;y<C;y++)if($[y]!=I[y]){O=$[y]>I[y]?1:-1;break}return O}function S($,I,C,M){for(var y=0;C--;)$[C]-=y,y=$[C]<I[C]?1:0,$[C]=y*M+$[C]-I[C];for(;!$[0]&&$.length>1;$.splice(0,1));}return function($,I,C,M,y){var O,k,T,B,R,z,_,G,J,K,W,ne,be,fe,xe,ye,Y,H=$.s==I.s?1:-1,ee=$.c,Q=I.c;if(!ee||!ee[0]||!Q||!Q[0])return new x(!$.s||!I.s||(ee?Q&&ee[0]==Q[0]:!Q)?NaN:ee&&ee[0]==0||!Q?H*0:H/0);for(G=new x(H),J=G.c=[],k=$.e-I.e,H=C+k+1,y||(y=It,k=bt($.e/ae)-bt(I.e/ae),H=H/ae|0),T=0;Q[T]==(ee[T]||0);T++);if(Q[T]>(ee[T]||0)&&k--,H<0)J.push(1),B=!0;else{for(fe=ee.length,ye=Q.length,T=0,H+=2,R=mt(y/(Q[0]+1)),R>1&&(Q=m(Q,R,y),ee=m(ee,R,y),ye=Q.length,fe=ee.length),be=ye,K=ee.slice(0,ye),W=K.length;W<ye;K[W++]=0);Y=Q.slice(),Y=[0].concat(Y),xe=Q[0],Q[1]>=y/2&&xe++;do{if(R=0,O=v(Q,K,ye,W),O<0){if(ne=K[0],ye!=W&&(ne=ne*y+(K[1]||0)),R=mt(ne/xe),R>1)for(R>=y&&(R=y-1),z=m(Q,R,y),_=z.length,W=K.length;v(z,K,_,W)==1;)R--,S(z,ye<_?Y:Q,_,y),_=z.length,O=1;else R==0&&(O=R=1),z=Q.slice(),_=z.length;if(_<W&&(z=[0].concat(z)),S(K,z,W,y),W=K.length,O==-1)for(;v(Q,K,ye,W)<1;)R++,S(K,ye<W?Y:Q,W,y),W=K.length}else O===0&&(R++,K=[0]);J[T++]=R,K[0]?K[W++]=ee[be]||0:(K=[ee[be]],W=1)}while((be++<fe||K[0]!=null)&&H--);B=K[0]!=null,J[0]||J.splice(0,1)}if(y==It){for(T=1,H=J[0];H>=10;H/=10,T++);L(G,C+(G.e=T+k*ae-1)+1,M,B)}else G.e=k,G.r=+B;return G}}();function E(m,v,S,$){var I,C,M,y,O;if(S==null?S=l:Pe(S,0,8),!m.c)return m.toString();if(I=m.c[0],M=m.e,v==null)O=gt(m.c),O=$==1||$==2&&(M<=a||M>=c)?ms(O,M):on(O,M,"0");else if(m=L(new x(m),v,S),C=m.e,O=gt(m.c),y=O.length,$==1||$==2&&(v<=C||C<=a)){for(;y<v;O+="0",y++);O=ms(O,C)}else if(v-=M+($===2&&C>M),O=on(O,C,"0"),C+1>y){if(--v>0)for(O+=".";v--;O+="0");}else if(v+=C-y,v>0)for(C+1==y&&(O+=".");v--;O+="0");return m.s<0&&I?"-"+O:O}function A(m,v){for(var S,$,I=1,C=new x(m[0]);I<m.length;I++)$=new x(m[I]),(!$.s||(S=Hn(C,$))===v||S===0&&C.s===v)&&(C=$);return C}function D(m,v,S){for(var $=1,I=v.length;!v[--I];v.pop());for(I=v[0];I>=10;I/=10,$++);return(S=$+S*ae-1)>f?m.c=m.e=null:S<u?m.c=[m.e=0]:(m.e=S,m.c=v),m}r=function(){var m=/^(-?)0([xbo])(?=\w[\w.]*$)/i,v=/^([^.]+)\.$/,S=/^\.([^.]+)$/,$=/^-?(Infinity|NaN)$/,I=/^\s*\+(?=[\w.])|^\s+|\s+$/g;return function(C,M,y,O){var k,T=y?M:M.replace(I,"");if($.test(T))C.s=isNaN(T)?null:T<0?-1:1;else{if(!y&&(T=T.replace(m,function(B,R,z){return k=(z=z.toLowerCase())=="x"?16:z=="b"?2:8,!O||O==k?R:B}),O&&(k=O,T=T.replace(v,"$1").replace(S,"0.$1")),M!=T))return new x(T,k);if(x.DEBUG)throw Error(Ze+"Not a"+(O?" base "+O:"")+" number: "+M);C.s=null}C.c=C.e=null}}();function L(m,v,S,$){var I,C,M,y,O,k,T,B=m.c,R=Ui;if(B){e:{for(I=1,y=B[0];y>=10;y/=10,I++);if(C=v-I,C<0)C+=ae,M=v,O=B[k=0],T=mt(O/R[I-M-1]%10);else if(k=ji((C+1)/ae),k>=B.length)if($){for(;B.length<=k;B.push(0));O=T=0,I=1,C%=ae,M=C-ae+1}else break e;else{for(O=y=B[k],I=1;y>=10;y/=10,I++);C%=ae,M=C-ae+I,T=M<0?0:mt(O/R[I-M-1]%10)}if($=$||v<0||B[k+1]!=null||(M<0?O:O%R[I-M-1]),$=S<4?(T||$)&&(S==0||S==(m.s<0?3:2)):T>5||T==5&&(S==4||$||S==6&&(C>0?M>0?O/R[I-M]:0:B[k-1])%10&1||S==(m.s<0?8:7)),v<1||!B[0])return B.length=0,$?(v-=m.e+1,B[0]=R[(ae-v%ae)%ae],m.e=-v||0):B[0]=m.e=0,m;if(C==0?(B.length=k,y=1,k--):(B.length=k+1,y=R[ae-C],B[k]=M>0?mt(O/R[I-M]%R[M])*y:0),$)for(;;)if(k==0){for(C=1,M=B[0];M>=10;M/=10,C++);for(M=B[0]+=y,y=1;M>=10;M/=10,y++);C!=y&&(m.e++,B[0]==It&&(B[0]=1));break}else{if(B[k]+=y,B[k]!=It)break;B[k--]=0,y=1}for(C=B.length;B[--C]===0;B.pop());}m.e>f?m.c=m.e=null:m.e<u&&(m.c=[m.e=0])}return m}function F(m){var v,S=m.e;return S===null?m.toString():(v=gt(m.c),v=S<=a||S>=c?ms(v,S):on(v,S,"0"),m.s<0?"-"+v:v)}return o.absoluteValue=o.abs=function(){var m=new x(this);return m.s<0&&(m.s=1),m},o.comparedTo=function(m,v){return Hn(this,new x(m,v))},o.decimalPlaces=o.dp=function(m,v){var S,$,I,C=this;if(m!=null)return Pe(m,0,De),v==null?v=l:Pe(v,0,8),L(new x(C),m+C.e+1,v);if(!(S=C.c))return null;if($=((I=S.length-1)-bt(this.e/ae))*ae,I=S[I])for(;I%10==0;I/=10,$--);return $<0&&($=0),$},o.dividedBy=o.div=function(m,v){return t(this,new x(m,v),i,l)},o.dividedToIntegerBy=o.idiv=function(m,v){return t(this,new x(m,v),0,1)},o.exponentiatedBy=o.pow=function(m,v){var S,$,I,C,M,y,O,k,T,B=this;if(m=new x(m),m.c&&!m.isInteger())throw Error(Ze+"Exponent not an integer: "+F(m));if(v!=null&&(v=new x(v)),y=m.e>14,!B.c||!B.c[0]||B.c[0]==1&&!B.e&&B.c.length==1||!m.c||!m.c[0])return T=new x(Math.pow(+F(B),y?m.s*(2-hs(m)):+F(m))),v?T.mod(v):T;if(O=m.s<0,v){if(v.c?!v.c[0]:!v.s)return new x(NaN);$=!O&&B.isInteger()&&v.isInteger(),$&&(B=B.mod(v))}else{if(m.e>9&&(B.e>0||B.e<-1||(B.e==0?B.c[0]>1||y&&B.c[1]>=24e7:B.c[0]<8e13||y&&B.c[0]<=9999975e7)))return C=B.s<0&&hs(m)?-0:0,B.e>-1&&(C=1/C),new x(O?1/C:C);h&&(C=ji(h/ae+2))}for(y?(S=new x(.5),O&&(m.s=1),k=hs(m)):(I=Math.abs(+F(m)),k=I%2),T=new x(s);;){if(k){if(T=T.times(B),!T.c)break;C?T.c.length>C&&(T.c.length=C):$&&(T=T.mod(v))}if(I){if(I=mt(I/2),I===0)break;k=I%2}else if(m=m.times(S),L(m,m.e+1,1),m.e>14)k=hs(m);else{if(I=+F(m),I===0)break;k=I%2}B=B.times(B),C?B.c&&B.c.length>C&&(B.c.length=C):$&&(B=B.mod(v))}return $?T:(O&&(T=s.div(T)),v?T.mod(v):C?L(T,h,l,M):T)},o.integerValue=function(m){var v=new x(this);return m==null?m=l:Pe(m,0,8),L(v,v.e+1,m)},o.isEqualTo=o.eq=function(m,v){return Hn(this,new x(m,v))===0},o.isFinite=function(){return!!this.c},o.isGreaterThan=o.gt=function(m,v){return Hn(this,new x(m,v))>0},o.isGreaterThanOrEqualTo=o.gte=function(m,v){return(v=Hn(this,new x(m,v)))===1||v===0},o.isInteger=function(){return!!this.c&&bt(this.e/ae)>this.c.length-2},o.isLessThan=o.lt=function(m,v){return Hn(this,new x(m,v))<0},o.isLessThanOrEqualTo=o.lte=function(m,v){return(v=Hn(this,new x(m,v)))===-1||v===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(m,v){var S,$,I,C,M=this,y=M.s;if(m=new x(m,v),v=m.s,!y||!v)return new x(NaN);if(y!=v)return m.s=-v,M.plus(m);var O=M.e/ae,k=m.e/ae,T=M.c,B=m.c;if(!O||!k){if(!T||!B)return T?(m.s=-v,m):new x(B?M:NaN);if(!T[0]||!B[0])return B[0]?(m.s=-v,m):new x(T[0]?M:l==3?-0:0)}if(O=bt(O),k=bt(k),T=T.slice(),y=O-k){for((C=y<0)?(y=-y,I=T):(k=O,I=B),I.reverse(),v=y;v--;I.push(0));I.reverse()}else for($=(C=(y=T.length)<(v=B.length))?y:v,y=v=0;v<$;v++)if(T[v]!=B[v]){C=T[v]<B[v];break}if(C&&(I=T,T=B,B=I,m.s=-m.s),v=($=B.length)-(S=T.length),v>0)for(;v--;T[S++]=0);for(v=It-1;$>y;){if(T[--$]<B[$]){for(S=$;S&&!T[--S];T[S]=v);--T[S],T[$]+=It}T[$]-=B[$]}for(;T[0]==0;T.splice(0,1),--k);return T[0]?D(m,T,k):(m.s=l==3?-1:1,m.c=[m.e=0],m)},o.modulo=o.mod=function(m,v){var S,$,I=this;return m=new x(m,v),!I.c||!m.s||m.c&&!m.c[0]?new x(NaN):!m.c||I.c&&!I.c[0]?new x(I):(d==9?($=m.s,m.s=1,S=t(I,m,0,3),m.s=$,S.s*=$):S=t(I,m,0,d),m=I.minus(S.times(m)),!m.c[0]&&d==1&&(m.s=I.s),m)},o.multipliedBy=o.times=function(m,v){var S,$,I,C,M,y,O,k,T,B,R,z,_,G,J,K=this,W=K.c,ne=(m=new x(m,v)).c;if(!W||!ne||!W[0]||!ne[0])return!K.s||!m.s||W&&!W[0]&&!ne||ne&&!ne[0]&&!W?m.c=m.e=m.s=null:(m.s*=K.s,!W||!ne?m.c=m.e=null:(m.c=[0],m.e=0)),m;for($=bt(K.e/ae)+bt(m.e/ae),m.s*=K.s,O=W.length,B=ne.length,O<B&&(_=W,W=ne,ne=_,I=O,O=B,B=I),I=O+B,_=[];I--;_.push(0));for(G=It,J=An,I=B;--I>=0;){for(S=0,R=ne[I]%J,z=ne[I]/J|0,M=O,C=I+M;C>I;)k=W[--M]%J,T=W[M]/J|0,y=z*k+T*R,k=R*k+y%J*J+_[C]+S,S=(k/G|0)+(y/J|0)+z*T,_[C--]=k%G;_[C]=S}return S?++$:_.splice(0,1),D(m,_,$)},o.negated=function(){var m=new x(this);return m.s=-m.s||null,m},o.plus=function(m,v){var S,$=this,I=$.s;if(m=new x(m,v),v=m.s,!I||!v)return new x(NaN);if(I!=v)return m.s=-v,$.minus(m);var C=$.e/ae,M=m.e/ae,y=$.c,O=m.c;if(!C||!M){if(!y||!O)return new x(I/0);if(!y[0]||!O[0])return O[0]?m:new x(y[0]?$:I*0)}if(C=bt(C),M=bt(M),y=y.slice(),I=C-M){for(I>0?(M=C,S=O):(I=-I,S=y),S.reverse();I--;S.push(0));S.reverse()}for(I=y.length,v=O.length,I-v<0&&(S=O,O=y,y=S,v=I),I=0;v;)I=(y[--v]=y[v]+O[v]+I)/It|0,y[v]=It===y[v]?0:y[v]%It;return I&&(y=[I].concat(y),++M),D(m,y,M)},o.precision=o.sd=function(m,v){var S,$,I,C=this;if(m!=null&&m!==!!m)return Pe(m,1,De),v==null?v=l:Pe(v,0,8),L(new x(C),m,v);if(!(S=C.c))return null;if(I=S.length-1,$=I*ae+1,I=S[I]){for(;I%10==0;I/=10,$--);for(I=S[0];I>=10;I/=10,$++);}return m&&C.e+1>$&&($=C.e+1),$},o.shiftedBy=function(m){return Pe(m,-zi,zi),this.times("1e"+m)},o.squareRoot=o.sqrt=function(){var m,v,S,$,I,C=this,M=C.c,y=C.s,O=C.e,k=i+4,T=new x("0.5");if(y!==1||!M||!M[0])return new x(!y||y<0&&(!M||M[0])?NaN:M?C:1/0);if(y=Math.sqrt(+F(C)),y==0||y==1/0?(v=gt(M),(v.length+O)%2==0&&(v+="0"),y=Math.sqrt(+v),O=bt((O+1)/2)-(O<0||O%2),y==1/0?v="5e"+O:(v=y.toExponential(),v=v.slice(0,v.indexOf("e")+1)+O),S=new x(v)):S=new x(y+""),S.c[0]){for(O=S.e,y=O+k,y<3&&(y=0);;)if(I=S,S=T.times(I.plus(t(C,I,k,1))),gt(I.c).slice(0,y)===(v=gt(S.c)).slice(0,y))if(S.e<O&&--y,v=v.slice(y-3,y+1),v=="9999"||!$&&v=="4999"){if(!$&&(L(I,I.e+i+2,0),I.times(I).eq(C))){S=I;break}k+=4,y+=4,$=1}else{(!+v||!+v.slice(1)&&v.charAt(0)=="5")&&(L(S,S.e+i+2,1),m=!S.times(S).eq(C));break}}return L(S,S.e+i+1,l,m)},o.toExponential=function(m,v){return m!=null&&(Pe(m,0,De),m++),E(this,m,v,1)},o.toFixed=function(m,v){return m!=null&&(Pe(m,0,De),m=m+this.e+1),E(this,m,v)},o.toFormat=function(m,v,S){var $,I=this;if(S==null)m!=null&&v&&typeof v=="object"?(S=v,v=null):m&&typeof m=="object"?(S=m,m=v=null):S=b;else if(typeof S!="object")throw Error(Ze+"Argument not an object: "+S);if($=I.toFixed(m,v),I.c){var C,M=$.split("."),y=+S.groupSize,O=+S.secondaryGroupSize,k=S.groupSeparator||"",T=M[0],B=M[1],R=I.s<0,z=R?T.slice(1):T,_=z.length;if(O&&(C=y,y=O,O=C,_-=C),y>0&&_>0){for(C=_%y||y,T=z.substr(0,C);C<_;C+=y)T+=k+z.substr(C,y);O>0&&(T+=k+z.slice(C)),R&&(T="-"+T)}$=B?T+(S.decimalSeparator||"")+((O=+S.fractionGroupSize)?B.replace(new RegExp("\\d{"+O+"}\\B","g"),"$&"+(S.fractionGroupSeparator||"")):B):T}return(S.prefix||"")+$+(S.suffix||"")},o.toFraction=function(m){var v,S,$,I,C,M,y,O,k,T,B,R,z=this,_=z.c;if(m!=null&&(y=new x(m),!y.isInteger()&&(y.c||y.s!==1)||y.lt(s)))throw Error(Ze+"Argument "+(y.isInteger()?"out of range: ":"not an integer: ")+F(y));if(!_)return new x(z);for(v=new x(s),k=S=new x(s),$=O=new x(s),R=gt(_),C=v.e=R.length-z.e-1,v.c[0]=Ui[(M=C%ae)<0?ae+M:M],m=!m||y.comparedTo(v)>0?C>0?v:k:y,M=f,f=1/0,y=new x(R),O.c[0]=0;T=t(y,v,0,1),I=S.plus(T.times($)),I.comparedTo(m)!=1;)S=$,$=I,k=O.plus(T.times(I=k)),O=I,v=y.minus(T.times(I=v)),y=I;return I=t(m.minus(S),$,0,1),O=O.plus(I.times(k)),S=S.plus(I.times($)),O.s=k.s=z.s,C=C*2,B=t(k,$,C,l).minus(z).abs().comparedTo(t(O,S,C,l).minus(z).abs())<1?[k,$]:[O,S],f=M,B},o.toNumber=function(){return+F(this)},o.toPrecision=function(m,v){return m!=null&&Pe(m,1,De),E(this,m,v,2)},o.toString=function(m){var v,S=this,$=S.s,I=S.e;return I===null?$?(v="Infinity",$<0&&(v="-"+v)):v="NaN":(m==null?v=I<=a||I>=c?ms(gt(S.c),I):on(gt(S.c),I,"0"):m===10&&P?(S=L(new x(S),i+I+1,l),v=on(gt(S.c),S.e,"0")):(Pe(m,2,w.length,"Base"),v=n(on(gt(S.c),I,"0"),10,m,$,!0)),$<0&&S.c[0]&&(v="-"+v)),v},o.valueOf=o.toJSON=function(){return F(this)},o._isBigNumber=!0,o[Symbol.toStringTag]="BigNumber",o[Symbol.for("nodejs.util.inspect.custom")]=o.valueOf,e!=null&&x.set(e),x}function bt(e){var t=e|0;return e>0||e===t?t:t-1}function gt(e){for(var t,n,r=1,o=e.length,s=e[0]+"";r<o;){for(t=e[r++]+"",n=ae-t.length;n--;t="0"+t);s+=t}for(o=s.length;s.charCodeAt(--o)===48;);return s.slice(0,o+1||1)}function Hn(e,t){var n,r,o=e.c,s=t.c,i=e.s,l=t.s,a=e.e,c=t.e;if(!i||!l)return null;if(n=o&&!o[0],r=s&&!s[0],n||r)return n?r?0:-l:i;if(i!=l)return i;if(n=i<0,r=a==c,!o||!s)return r?0:!o^n?1:-1;if(!r)return a>c^n?1:-1;for(l=(a=o.length)<(c=s.length)?a:c,i=0;i<l;i++)if(o[i]!=s[i])return o[i]>s[i]^n?1:-1;return a==c?0:a>c^n?1:-1}function Pe(e,t,n,r){if(e<t||e>n||e!==mt(e))throw Error(Ze+(r||"Argument")+(typeof e=="number"?e<t||e>n?" out of range: ":" not an integer: ":" not a primitive number: ")+String(e))}function hs(e){var t=e.c.length-1;return bt(e.e/ae)==t&&e.c[t]%2!=0}function ms(e,t){return(e.length>1?e.charAt(0)+"."+e.slice(1):e)+(t<0?"e":"e+")+t}function on(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 Re=ru();const pb=(e,t=6)=>{try{const n=new Re(e||"0");if(n.isNaN())return"0";const r=n.decimalPlaces(t,Re.ROUND_DOWN),[o,s=""]=r.toString().split("."),i=o.replace(/\B(?=(\d{3})+(?!\d))/g,",");if(t>0){const l=(s||"").padEnd(t,"0");return`${i}.${l}`}return i}catch(n){return console.warn("formatThousands error:",n),"0"}},$t=()=>{const{translations:e,currentLocale:t}=tu();return{t:(s,i)=>{try{const l=s.split(".");let a=e;for(const u of l)if(a&&typeof a=="object"&&u in a)a=a[u];else return s;let c=typeof a=="string"?a:s;return i&&typeof c=="string"&&Object.keys(i).forEach(u=>{const f=`{{${u}}}`;c=c.replace(new RegExp(f,"g"),String(i[u]))}),c}catch(l){return console.warn(`Translation error for key "${s}":`,l),s}},translations:e,locale:t,getTranslationObject:s=>{try{const i=s.split(".");let l=e;for(const a of i)if(l&&typeof l=="object"&&a in l)l=l[a];else return{};return typeof l=="object"?l:{}}catch(i){return console.warn(`Translation object error for key "${s}":`,i),{}}},hasTranslation:s=>{try{const i=s.split(".");let l=e;for(const a of i)if(l&&typeof l=="object"&&a in l)l=l[a];else return!1;return typeof l=="string"}catch{return!1}}}},hb="1.2.3";let Ye=class Kc extends Error{constructor(t,n={}){var i;const r=n.cause instanceof Kc?n.cause.details:(i=n.cause)!=null&&i.message?n.cause.message:n.details,o=n.cause instanceof Kc&&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@${hb}`].join(`
51
- `);super(s),Object.defineProperty(this,"details",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docsPath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"metaMessages",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"shortMessage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiTypeError"}),n.cause&&(this.cause=n.cause),this.details=r,this.docsPath=o,this.metaMessages=n.metaMessages,this.shortMessage=t}};function sn(e,t){const n=e.exec(t);return n==null?void 0:n.groups}const ou=/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/,su=/^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)?$/,iu=/^\(.+?\).*?$/,au=/^tuple(?<array>(\[(\d*)\])*)$/;function _i(e){let t=e.type;if(au.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+=_i(s),o<n-1&&(t+=", ")}const r=sn(au,e.type);return t+=`)${(r==null?void 0:r.array)||""}`,_i({...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+=_i(o),r!==n-1&&(t+=", ")}return t}function bs(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 lu=/^error (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*)\((?<parameters>.*?)\)$/;function mb(e){return lu.test(e)}function bb(e){return sn(lu,e)}const cu=/^event (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*)\((?<parameters>.*?)\)$/;function gb(e){return cu.test(e)}function yb(e){return sn(cu,e)}const uu=/^function (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*)\((?<parameters>.*?)\)(?: (?<scope>external|public{1}))?(?: (?<stateMutability>pure|view|nonpayable|payable{1}))?(?: returns\s?\((?<returns>.*?)\))?$/;function vb(e){return uu.test(e)}function wb(e){return sn(uu,e)}const fu=/^struct (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*) \{(?<properties>.*?)\}$/;function gs(e){return fu.test(e)}function xb(e){return sn(fu,e)}const du=/^constructor\((?<parameters>.*?)\)(?:\s(?<stateMutability>payable{1}))?$/;function Eb(e){return du.test(e)}function Sb(e){return sn(du,e)}const pu=/^fallback\(\) external(?:\s(?<stateMutability>payable{1}))?$/;function Pb(e){return pu.test(e)}function Tb(e){return sn(pu,e)}const Ab=/^receive\(\) external payable$/;function Nb(e){return Ab.test(e)}const hu=new Set(["memory","indexed","storage","calldata"]),Cb=new Set(["indexed"]),Wi=new Set(["calldata","memory","storage"]);class Ob extends Ye{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 Ib extends Ye{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 $b extends Ye{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 kb extends Ye{constructor({params:t}){super("Failed to parse ABI parameters.",{details:`parseAbiParameters(${JSON.stringify(t,null,2)})`,docsPath:"/api/human#parseabiparameters-1"}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidAbiParametersError"})}}class Mb extends Ye{constructor({param:t}){super("Invalid ABI parameter.",{details:t}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidParameterError"})}}class Db extends Ye{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 Bb extends Ye{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 Lb extends Ye{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 Fb extends Ye{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 br extends Ye{constructor({signature:t,type:n}){super(`Invalid ${n} signature.`,{details:t}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidSignatureError"})}}class Rb extends Ye{constructor({signature:t}){super("Unknown signature.",{details:t}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"UnknownSignatureError"})}}class jb extends Ye{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 zb extends Ye{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 Ub extends Ye{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 _b(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}${r}`}const Vi=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 Hi(e,t={}){if(vb(e))return Wb(e,t);if(gb(e))return Vb(e,t);if(mb(e))return Hb(e,t);if(Eb(e))return Gb(e,t);if(Pb(e))return qb(e);if(Nb(e))return{type:"receive",stateMutability:"payable"};throw new Rb({signature:e})}function Wb(e,t={}){const n=wb(e);if(!n)throw new br({signature:e,type:"function"});const r=ut(n.parameters),o=[],s=r.length;for(let l=0;l<s;l++)o.push(an(r[l],{modifiers:Wi,structs:t,type:"function"}));const i=[];if(n.returns){const l=ut(n.returns),a=l.length;for(let c=0;c<a;c++)i.push(an(l[c],{modifiers:Wi,structs:t,type:"function"}))}return{name:n.name,type:"function",stateMutability:n.stateMutability??"nonpayable",inputs:o,outputs:i}}function Vb(e,t={}){const n=yb(e);if(!n)throw new br({signature:e,type:"event"});const r=ut(n.parameters),o=[],s=r.length;for(let i=0;i<s;i++)o.push(an(r[i],{modifiers:Cb,structs:t,type:"event"}));return{name:n.name,type:"event",inputs:o}}function Hb(e,t={}){const n=bb(e);if(!n)throw new br({signature:e,type:"error"});const r=ut(n.parameters),o=[],s=r.length;for(let i=0;i<s;i++)o.push(an(r[i],{structs:t,type:"error"}));return{name:n.name,type:"error",inputs:o}}function Gb(e,t={}){const n=Sb(e);if(!n)throw new br({signature:e,type:"constructor"});const r=ut(n.parameters),o=[],s=r.length;for(let i=0;i<s;i++)o.push(an(r[i],{structs:t,type:"constructor"}));return{type:"constructor",stateMutability:n.stateMutability??"nonpayable",inputs:o}}function qb(e){const t=Tb(e);if(!t)throw new br({signature:e,type:"fallback"});return{type:"fallback",stateMutability:t.stateMutability??"nonpayable"}}const Kb=/^(?<type>[a-zA-Z$_][a-zA-Z0-9$_]*(?:\spayable)?)(?<array>(?:\[\d*?\])+?)?(?:\s(?<modifier>calldata|indexed|memory|storage{1}))?(?:\s(?<name>[a-zA-Z$_][a-zA-Z0-9$_]*))?$/,Zb=/^\((?<type>.+?)\)(?<array>(?:\[\d*?\])+?)?(?:\s(?<modifier>calldata|indexed|memory|storage{1}))?(?:\s(?<name>[a-zA-Z$_][a-zA-Z0-9$_]*))?$/,Yb=/^u?int$/;function an(e,t){var f,p;const n=_b(e,t==null?void 0:t.type,t==null?void 0:t.structs);if(Vi.has(n))return Vi.get(n);const r=iu.test(e),o=sn(r?Zb:Kb,e);if(!o)throw new Mb({param:e});if(o.name&&Jb(o.name))throw new Db({param:e,name:o.name});const s=o.name?{name:o.name}:{},i=o.modifier==="indexed"?{indexed:!0}:{},l=(t==null?void 0:t.structs)??{};let a,c={};if(r){a="tuple";const d=ut(o.type),h=[],b=d.length;for(let w=0;w<b;w++)h.push(an(d[w],{structs:l}));c={components:h}}else if(o.type in l)a="tuple",c={components:l[o.type]};else if(Yb.test(o.type))a=`${o.type}256`;else if(o.type==="address payable")a="address";else if(a=o.type,(t==null?void 0:t.type)!=="struct"&&!mu(a))throw new $b({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 Bb({param:e,type:t==null?void 0:t.type,modifier:o.modifier});if(Wi.has(o.modifier)&&!Qb(a,!!o.array))throw new Lb({param:e,type:t==null?void 0:t.type,modifier:o.modifier})}const u={type:`${a}${o.array??""}`,...s,...i,...c};return Vi.set(n,u),u}function ut(e,t=[],n="",r=0){const o=e.trim().length;for(let s=0;s<o;s++){const i=e[s],l=e.slice(s+1);switch(i){case",":return r===0?ut(l,[...t,n.trim()]):ut(l,t,`${n}${i}`,r);case"(":return ut(l,t,`${n}${i}`,r+1);case")":return ut(l,t,`${n}${i}`,r-1);default:return ut(l,t,`${n}${i}`,r)}}if(n==="")return t;if(r!==0)throw new Ub({current:n,depth:r});return t.push(n.trim()),t}function mu(e){return e==="address"||e==="bool"||e==="function"||e==="string"||ou.test(e)||su.test(e)}const Xb=/^(?: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 Jb(e){return e==="address"||e==="bool"||e==="function"||e==="string"||e==="tuple"||ou.test(e)||su.test(e)||Xb.test(e)}function Qb(e,t){return t||e==="bytes"||e==="string"||e==="tuple"}function Gi(e){const t={},n=e.length;for(let i=0;i<n;i++){const l=e[i];if(!gs(l))continue;const a=xb(l);if(!a)throw new br({signature:l,type:"struct"});const c=a.properties.split(";"),u=[],f=c.length;for(let p=0;p<f;p++){const h=c[p].trim();if(!h)continue;const b=an(h,{type:"struct"});u.push(b)}if(!u.length)throw new jb({signature:l});t[a.name]=u}const r={},o=Object.entries(t),s=o.length;for(let i=0;i<s;i++){const[l,a]=o[i];r[l]=bu(a,t)}return r}const e1=/^(?<type>[a-zA-Z$_][a-zA-Z0-9$_]*)(?<array>(?:\[\d*?\])+?)?$/;function bu(e=[],t={},n=new Set){const r=[],o=e.length;for(let s=0;s<o;s++){const i=e[s];if(iu.test(i.type))r.push(i);else{const a=sn(e1,i.type);if(!(a!=null&&a.type))throw new Fb({abiParameter:i});const{array:c,type:u}=a;if(u in t){if(n.has(u))throw new zb({type:u});r.push({...i,type:`tuple${c??""}`,components:bu(t[u],t,new Set([...n,u]))})}else if(mu(u))r.push(i);else throw new Ib({type:u})}}return r}function gu(e){const t=Gi(e),n=[],r=e.length;for(let o=0;o<r;o++){const s=e[o];gs(s)||n.push(Hi(s,t))}return n}function yu(e){let t;if(typeof e=="string")t=Hi(e);else{const n=Gi(e),r=e.length;for(let o=0;o<r;o++){const s=e[o];if(!gs(s)){t=Hi(s,n);break}}}if(!t)throw new Ob({signature:e});return t}function vu(e){const t=[];if(typeof e=="string"){const n=ut(e),r=n.length;for(let o=0;o<r;o++)t.push(an(n[o],{modifiers:hu}))}else{const n=Gi(e),r=e.length;for(let o=0;o<r;o++){const s=e[o];if(gs(s))continue;const i=ut(s),l=i.length;for(let a=0;a<l;a++)t.push(an(i[a],{modifiers:hu,structs:n}))}}if(t.length===0)throw new kb({params:e});return t}function te(e,t,n){const r=e[t.name];if(typeof r=="function")return r;const o=e[n];return typeof o=="function"?o:s=>t(e,s)}function kt(e,{includeName:t=!1}={}){if(e.type!=="function"&&e.type!=="event"&&e.type!=="error")throw new h1(e.type);return`${e.name}(${ys(e.inputs,{includeName:t})})`}function ys(e,{includeName:t=!1}={}){return e?e.map(n=>t1(n,{includeName:t})).join(t?", ":","):""}function t1(e,{includeName:t}){return e.type.startsWith("tuple")?`(${ys(e.components,{includeName:t})})${e.type.slice(5)}`:e.type+(t&&e.name?` ${e.name}`:"")}function Mt(e,{strict:t=!0}={}){return!e||typeof e!="string"?!1:t?/^0x[0-9a-fA-F]*$/.test(e):e.startsWith("0x")}function Te(e){return Mt(e,{strict:!1})?Math.ceil((e.length-2)/2):e.length}const wu="2.47.2";let to={getDocsUrl:({docsBaseUrl:e,docsPath:t="",docsSlug:n})=>t?`${e??"https://viem.sh"}${t}${n?`#${n}`:""}`:void 0,version:`viem@${wu}`},V=class Zc extends Error{constructor(t,n={}){var l;const r=(()=>{var a;return n.cause instanceof Zc?n.cause.details:(a=n.cause)!=null&&a.message?n.cause.message:n.details})(),o=n.cause instanceof Zc&&n.cause.docsPath||n.docsPath,s=(l=to.getDocsUrl)==null?void 0:l.call(to,{...n,docsPath:o}),i=[t||"An error occurred.","",...n.metaMessages?[...n.metaMessages,""]:[],...s?[`Docs: ${s}`]:[],...r?[`Details: ${r}`]:[],...to.version?[`Version: ${to.version}`]:[]].join(`
50
+ 跨鏈充值需由您承擔 Edge 網路手續費。到帳金額會略小於您的充值金額。`,addressUpdatedNotice:"注意:充值地址已更新,請改用新地址。原地址僅在過渡期內有效,之後將停用。若已在其他平台儲存,請儘速更新。",enableSystemProWithToken:"在{{network}}上啓用{{token}}",enableTokenDesc:"您首次在{{network}}上存款時必須啓用{{token}}。",enableWithToken:"啓用 {{token}}",arrivaltimeTooltip1:"資金約在 {{v}} 分鐘內(達到 {{v1}} 個區塊確認後)到賬。",arrivaltimeTooltip2:"預計時間是根據歷史資料計算所得,僅供參考。網路壅塞可能會導致實際到帳時間變長。",arrivalEstimated:"≈ {{v}}分鐘",feeRateTooltip:"預估手續費,以實際扣除為準。",availableDesc:"您可以充值的最大金額。當可用餘額為0或負數時,無法進行充值。",noPrivateKeyWalletWarning:"請勿使用無私鑰錢包進行充值,無私鑰錢包充值會導致資金損失且無法追回。",layerZeroDepositTip:"系統會根據充值資金的實際情況,通過 LayerZero 完成您的充值。",layerZeroDepositTipExceedPool:"由於充值資金大於資金池,將透過 LayerZero 完成您的充值。",layerZeroDepositTipGte200k:"由於充值資金大於等於 200,000 USDT,將透過 LayerZero 完成您的充值。",layerZeroDepositButton:"使用LayerZero充值",defaultSpotNotice:"預設充值至現貨帳戶",defaultSpotToPerpNotice:"僅支援發送 {{coin}} ({{v}}) 資產到此位址。預設充值至現貨帳戶。若需充入合約帳戶,請自現貨帳戶劃轉至合約帳戶。",connectedWalletTitle:"從已連接錢包充值",connectedWalletDesc:"使用 MetaMask、WalletConnect 或其他錢包進行充值",externalWalletTitle:"從外部錢包充值",externalWalletDesc:"從 Binance 或其他交易所、Arbitrum 等鏈或其他錢包轉帳",or:"或"},withdraw:{noticeDesc:"普通提現是一個兩步過程。此步驟將發起您的提現請求,並將在 Layer2 進行處理。一旦資金準備就緒(可能需要最多 4 小時),您將收到一條將資金提現到錢包的通知。受鏈同步等情況影響下,時長可能需要長達 48 小時。您需要自行承擔交易 gas 費用。",crossChainTips:"跨鏈提幣需在 L2(通過零知識證明)進行驗證。提幣過程最多約需2小時。相關鏈的資產池中需有充足的資金來處理跨鏈提幣,其間還將產生礦工費。 edgeX 將收取一定的手續費作爲礦工費。",commonWithdraw:"提現說明",withdraw:"提現",speed:"速度",confirmWithdraw:"提現確認",speedNote:"處理時間:",speedNoteSpeed1:"用時約8分鐘",speedNoteSpeed2:"用時約 2-4 小時",speedNoteSpeed3:"用時約4小時",receiverAddress:"接收地址",fee:"手續費",feeRate:"費率",withdrawlAmount:"提現金額",amountToReceive:"到账金額",minWithdraw:"最小提現金額",minWithdrawParsed:"最小提現 {{amount}} {{token}}",invalidReceiverAddress:"接收地址不能為空",availableDesc:"您可以提現的最大金額。當可用餘額為0或負數時,無法進行提現。",feeCalculationTip:"提現手續費按照提現金額乘以費率計算,最低為 1 USDT/USDC。費率會根據鏈上實際情況進行調整。",largeWithdrawFeeTip:"提現手續費為0.015%,將從提現金額中扣除。",crossChainPoolBalance:"跨鏈資金池餘額",poolBalance:"資金池餘額",poolBalanceInsufficientTip:"提現金額大於資金池餘額,無法進行提現。請選擇資金池餘額充足的選項。",connectedWalletTitle:"提現至已連接錢包",connectedWalletDesc:"將資金提現至您已連接的加密錢包、MetaMask、WalletConnect 或其他提供商",externalWalletTitle:"提現至外部帳戶",externalWalletDesc:"將資金提現至 Binance 或其他交易所、Arbitrum 等鏈及其他錢包"},account:{title:"帳戶",perp:"合約帳戶","perpetual-v1":"合約V1賬戶","perpetual-v2":"合約V2賬戶",spot:"現貨帳戶"}},Ri=["en-US","ja-JP","ru-RU","zh-CN","zh-TW","de-DE","es-LA","fr-FR","it-IT"],Qc={"en-US":eb,"ja-JP":ob,"ru-RU":sb,"zh-CN":ib,"zh-TW":ab,"de-DE":Qm,"es-LA":tb,"fr-FR":nb,"it-IT":rb},ps="en-US",lb={"en-US":"English","zh-CN":"简体中文","zh-TW":"繁體中文","ja-JP":"日本語","ru-RU":"Русский","de-DE":"Deutsch","es-LA":"Español (Latinoamérica)","fr-FR":"Français","it-IT":"Italiano"},cb=e=>Ri.includes(e)?Qc[e]:Qc[ps],ub=e=>Ri.includes(e),eu=g.createContext(null),fb=({config:e,children:t})=>{const n=g.useMemo(()=>{const r=e.locale||ps,o=ub(r)?r:ps,s=cb(o);return{...e,currentLocale:o,translations:s}},[e]);return C.jsx(eu.Provider,{value:n,children:t})},tu=()=>{const e=g.useContext(eu);if(!e)throw new Error("useComponentConfig must be used within ComponentProvider");return e};var db=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,ji=Math.ceil,mt=Math.floor,Ze="[BigNumber Error] ",nu=Ze+"Number primitive has more than 15 significant digits: ",It=1e14,ae=14,zi=9007199254740991,Ui=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],Tn=1e7,De=1e9;function ru(e){var t,n,r,o=x.prototype={constructor:x,toString:null,valueOf:null},s=new x(1),i=20,l=4,a=-7,c=21,u=-1e7,f=1e7,p=!1,d=1,h=0,b={prefix:"",groupSize:3,secondaryGroupSize:0,groupSeparator:",",decimalSeparator:".",fractionGroupSize:0,fractionGroupSeparator:" ",suffix:""},v="0123456789abcdefghijklmnopqrstuvwxyz",P=!0;function x(m,w){var S,$,I,A,k,y,O,M,T=this;if(!(T instanceof x))return new x(m,w);if(w==null){if(m&&m._isBigNumber===!0){T.s=m.s,!m.c||m.e>f?T.c=T.e=null:m.e<u?T.c=[T.e=0]:(T.e=m.e,T.c=m.c.slice());return}if((y=typeof m=="number")&&m*0==0){if(T.s=1/m<0?(m=-m,-1):1,m===~~m){for(A=0,k=m;k>=10;k/=10,A++);A>f?T.c=T.e=null:(T.e=A,T.c=[m]);return}M=String(m)}else{if(!db.test(M=String(m)))return r(T,M,y);T.s=M.charCodeAt(0)==45?(M=M.slice(1),-1):1}(A=M.indexOf("."))>-1&&(M=M.replace(".","")),(k=M.search(/e/i))>0?(A<0&&(A=k),A+=+M.slice(k+1),M=M.substring(0,k)):A<0&&(A=M.length)}else{if(Pe(w,2,v.length,"Base"),w==10&&P)return T=new x(m),F(T,i+T.e+1,l);if(M=String(m),y=typeof m=="number"){if(m*0!=0)return r(T,M,y,w);if(T.s=1/m<0?(M=M.slice(1),-1):1,x.DEBUG&&M.replace(/^0\.0*|\./,"").length>15)throw Error(nu+m)}else T.s=M.charCodeAt(0)===45?(M=M.slice(1),-1):1;for(S=v.slice(0,w),A=k=0,O=M.length;k<O;k++)if(S.indexOf($=M.charAt(k))<0){if($=="."){if(k>A){A=O;continue}}else if(!I&&(M==M.toUpperCase()&&(M=M.toLowerCase())||M==M.toLowerCase()&&(M=M.toUpperCase()))){I=!0,k=-1,A=0;continue}return r(T,String(m),y,w)}y=!1,M=n(M,w,10,T.s),(A=M.indexOf("."))>-1?M=M.replace(".",""):A=M.length}for(k=0;M.charCodeAt(k)===48;k++);for(O=M.length;M.charCodeAt(--O)===48;);if(M=M.slice(k,++O)){if(O-=k,y&&x.DEBUG&&O>15&&(m>zi||m!==mt(m)))throw Error(nu+T.s*m);if((A=A-k-1)>f)T.c=T.e=null;else if(A<u)T.c=[T.e=0];else{if(T.e=A,T.c=[],k=(A+1)%ae,A<0&&(k+=ae),k<O){for(k&&T.c.push(+M.slice(0,k)),O-=ae;k<O;)T.c.push(+M.slice(k,k+=ae));k=ae-(M=M.slice(k)).length}else k-=O;for(;k--;M+="0");T.c.push(+M)}}else T.c=[T.e=0]}x.clone=ru,x.ROUND_UP=0,x.ROUND_DOWN=1,x.ROUND_CEIL=2,x.ROUND_FLOOR=3,x.ROUND_HALF_UP=4,x.ROUND_HALF_DOWN=5,x.ROUND_HALF_EVEN=6,x.ROUND_HALF_CEIL=7,x.ROUND_HALF_FLOOR=8,x.EUCLID=9,x.config=x.set=function(m){var w,S;if(m!=null)if(typeof m=="object"){if(m.hasOwnProperty(w="DECIMAL_PLACES")&&(S=m[w],Pe(S,0,De,w),i=S),m.hasOwnProperty(w="ROUNDING_MODE")&&(S=m[w],Pe(S,0,8,w),l=S),m.hasOwnProperty(w="EXPONENTIAL_AT")&&(S=m[w],S&&S.pop?(Pe(S[0],-De,0,w),Pe(S[1],0,De,w),a=S[0],c=S[1]):(Pe(S,-De,De,w),a=-(c=S<0?-S:S))),m.hasOwnProperty(w="RANGE"))if(S=m[w],S&&S.pop)Pe(S[0],-De,-1,w),Pe(S[1],1,De,w),u=S[0],f=S[1];else if(Pe(S,-De,De,w),S)u=-(f=S<0?-S:S);else throw Error(Ze+w+" cannot be zero: "+S);if(m.hasOwnProperty(w="CRYPTO"))if(S=m[w],S===!!S)if(S)if(typeof crypto<"u"&&crypto&&(crypto.getRandomValues||crypto.randomBytes))p=S;else throw p=!S,Error(Ze+"crypto unavailable");else p=S;else throw Error(Ze+w+" not true or false: "+S);if(m.hasOwnProperty(w="MODULO_MODE")&&(S=m[w],Pe(S,0,9,w),d=S),m.hasOwnProperty(w="POW_PRECISION")&&(S=m[w],Pe(S,0,De,w),h=S),m.hasOwnProperty(w="FORMAT"))if(S=m[w],typeof S=="object")b=S;else throw Error(Ze+w+" not an object: "+S);if(m.hasOwnProperty(w="ALPHABET"))if(S=m[w],typeof S=="string"&&!/^.?$|[+\-.\s]|(.).*\1/.test(S))P=S.slice(0,10)=="0123456789",v=S;else throw Error(Ze+w+" invalid: "+S)}else throw Error(Ze+"Object expected: "+m);return{DECIMAL_PLACES:i,ROUNDING_MODE:l,EXPONENTIAL_AT:[a,c],RANGE:[u,f],CRYPTO:p,MODULO_MODE:d,POW_PRECISION:h,FORMAT:b,ALPHABET:v}},x.isBigNumber=function(m){if(!m||m._isBigNumber!==!0)return!1;if(!x.DEBUG)return!0;var w,S,$=m.c,I=m.e,A=m.s;e:if({}.toString.call($)=="[object Array]"){if((A===1||A===-1)&&I>=-De&&I<=De&&I===mt(I)){if($[0]===0){if(I===0&&$.length===1)return!0;break e}if(w=(I+1)%ae,w<1&&(w+=ae),String($[0]).length==w){for(w=0;w<$.length;w++)if(S=$[w],S<0||S>=It||S!==mt(S))break e;if(S!==0)return!0}}}else if($===null&&I===null&&(A===null||A===1||A===-1))return!0;throw Error(Ze+"Invalid BigNumber: "+m)},x.maximum=x.max=function(){return N(arguments,-1)},x.minimum=x.min=function(){return N(arguments,1)},x.random=function(){var m=9007199254740992,w=Math.random()*m&2097151?function(){return mt(Math.random()*m)}:function(){return(Math.random()*1073741824|0)*8388608+(Math.random()*8388608|0)};return function(S){var $,I,A,k,y,O=0,M=[],T=new x(s);if(S==null?S=i:Pe(S,0,De),k=ji(S/ae),p)if(crypto.getRandomValues){for($=crypto.getRandomValues(new Uint32Array(k*=2));O<k;)y=$[O]*131072+($[O+1]>>>11),y>=9e15?(I=crypto.getRandomValues(new Uint32Array(2)),$[O]=I[0],$[O+1]=I[1]):(M.push(y%1e14),O+=2);O=k/2}else if(crypto.randomBytes){for($=crypto.randomBytes(k*=7);O<k;)y=($[O]&31)*281474976710656+$[O+1]*1099511627776+$[O+2]*4294967296+$[O+3]*16777216+($[O+4]<<16)+($[O+5]<<8)+$[O+6],y>=9e15?crypto.randomBytes(7).copy($,O):(M.push(y%1e14),O+=7);O=k/7}else throw p=!1,Error(Ze+"crypto unavailable");if(!p)for(;O<k;)y=w(),y<9e15&&(M[O++]=y%1e14);for(k=M[--O],S%=ae,k&&S&&(y=Ui[ae-S],M[O]=mt(k/y)*y);M[O]===0;M.pop(),O--);if(O<0)M=[A=0];else{for(A=-1;M[0]===0;M.splice(0,1),A-=ae);for(O=1,y=M[0];y>=10;y/=10,O++);O<ae&&(A-=ae-O)}return T.e=A,T.c=M,T}}(),x.sum=function(){for(var m=1,w=arguments,S=new x(w[0]);m<w.length;)S=S.plus(w[m++]);return S},n=function(){var m="0123456789";function w(S,$,I,A){for(var k,y=[0],O,M=0,T=S.length;M<T;){for(O=y.length;O--;y[O]*=$);for(y[0]+=A.indexOf(S.charAt(M++)),k=0;k<y.length;k++)y[k]>I-1&&(y[k+1]==null&&(y[k+1]=0),y[k+1]+=y[k]/I|0,y[k]%=I)}return y.reverse()}return function(S,$,I,A,k){var y,O,M,T,B,R,z,W,G=S.indexOf("."),J=i,K=l;for(G>=0&&(T=h,h=0,S=S.replace(".",""),W=new x($),R=W.pow(S.length-G),h=T,W.c=w(on(gt(R.c),R.e,"0"),10,I,m),W.e=W.c.length),z=w(S,$,I,k?(y=v,m):(y=m,v)),M=T=z.length;z[--T]==0;z.pop());if(!z[0])return y.charAt(0);if(G<0?--M:(R.c=z,R.e=M,R.s=A,R=t(R,W,J,K,I),z=R.c,B=R.r,M=R.e),O=M+J+1,G=z[O],T=I/2,B=B||O<0||z[O+1]!=null,B=K<4?(G!=null||B)&&(K==0||K==(R.s<0?3:2)):G>T||G==T&&(K==4||B||K==6&&z[O-1]&1||K==(R.s<0?8:7)),O<1||!z[0])S=B?on(y.charAt(1),-J,y.charAt(0)):y.charAt(0);else{if(z.length=O,B)for(--I;++z[--O]>I;)z[O]=0,O||(++M,z=[1].concat(z));for(T=z.length;!z[--T];);for(G=0,S="";G<=T;S+=y.charAt(z[G++]));S=on(S,M,y.charAt(0))}return S}}(),t=function(){function m($,I,A){var k,y,O,M,T=0,B=$.length,R=I%Tn,z=I/Tn|0;for($=$.slice();B--;)O=$[B]%Tn,M=$[B]/Tn|0,k=z*O+M*R,y=R*O+k%Tn*Tn+T,T=(y/A|0)+(k/Tn|0)+z*M,$[B]=y%A;return T&&($=[T].concat($)),$}function w($,I,A,k){var y,O;if(A!=k)O=A>k?1:-1;else for(y=O=0;y<A;y++)if($[y]!=I[y]){O=$[y]>I[y]?1:-1;break}return O}function S($,I,A,k){for(var y=0;A--;)$[A]-=y,y=$[A]<I[A]?1:0,$[A]=y*k+$[A]-I[A];for(;!$[0]&&$.length>1;$.splice(0,1));}return function($,I,A,k,y){var O,M,T,B,R,z,W,G,J,K,_,ne,be,fe,xe,ye,Y,H=$.s==I.s?1:-1,ee=$.c,Q=I.c;if(!ee||!ee[0]||!Q||!Q[0])return new x(!$.s||!I.s||(ee?Q&&ee[0]==Q[0]:!Q)?NaN:ee&&ee[0]==0||!Q?H*0:H/0);for(G=new x(H),J=G.c=[],M=$.e-I.e,H=A+M+1,y||(y=It,M=bt($.e/ae)-bt(I.e/ae),H=H/ae|0),T=0;Q[T]==(ee[T]||0);T++);if(Q[T]>(ee[T]||0)&&M--,H<0)J.push(1),B=!0;else{for(fe=ee.length,ye=Q.length,T=0,H+=2,R=mt(y/(Q[0]+1)),R>1&&(Q=m(Q,R,y),ee=m(ee,R,y),ye=Q.length,fe=ee.length),be=ye,K=ee.slice(0,ye),_=K.length;_<ye;K[_++]=0);Y=Q.slice(),Y=[0].concat(Y),xe=Q[0],Q[1]>=y/2&&xe++;do{if(R=0,O=w(Q,K,ye,_),O<0){if(ne=K[0],ye!=_&&(ne=ne*y+(K[1]||0)),R=mt(ne/xe),R>1)for(R>=y&&(R=y-1),z=m(Q,R,y),W=z.length,_=K.length;w(z,K,W,_)==1;)R--,S(z,ye<W?Y:Q,W,y),W=z.length,O=1;else R==0&&(O=R=1),z=Q.slice(),W=z.length;if(W<_&&(z=[0].concat(z)),S(K,z,_,y),_=K.length,O==-1)for(;w(Q,K,ye,_)<1;)R++,S(K,ye<_?Y:Q,_,y),_=K.length}else O===0&&(R++,K=[0]);J[T++]=R,K[0]?K[_++]=ee[be]||0:(K=[ee[be]],_=1)}while((be++<fe||K[0]!=null)&&H--);B=K[0]!=null,J[0]||J.splice(0,1)}if(y==It){for(T=1,H=J[0];H>=10;H/=10,T++);F(G,A+(G.e=T+M*ae-1)+1,k,B)}else G.e=M,G.r=+B;return G}}();function E(m,w,S,$){var I,A,k,y,O;if(S==null?S=l:Pe(S,0,8),!m.c)return m.toString();if(I=m.c[0],k=m.e,w==null)O=gt(m.c),O=$==1||$==2&&(k<=a||k>=c)?ms(O,k):on(O,k,"0");else if(m=F(new x(m),w,S),A=m.e,O=gt(m.c),y=O.length,$==1||$==2&&(w<=A||A<=a)){for(;y<w;O+="0",y++);O=ms(O,A)}else if(w-=k+($===2&&A>k),O=on(O,A,"0"),A+1>y){if(--w>0)for(O+=".";w--;O+="0");}else if(w+=A-y,w>0)for(A+1==y&&(O+=".");w--;O+="0");return m.s<0&&I?"-"+O:O}function N(m,w){for(var S,$,I=1,A=new x(m[0]);I<m.length;I++)$=new x(m[I]),(!$.s||(S=Hn(A,$))===w||S===0&&A.s===w)&&(A=$);return A}function D(m,w,S){for(var $=1,I=w.length;!w[--I];w.pop());for(I=w[0];I>=10;I/=10,$++);return(S=$+S*ae-1)>f?m.c=m.e=null:S<u?m.c=[m.e=0]:(m.e=S,m.c=w),m}r=function(){var m=/^(-?)0([xbo])(?=\w[\w.]*$)/i,w=/^([^.]+)\.$/,S=/^\.([^.]+)$/,$=/^-?(Infinity|NaN)$/,I=/^\s*\+(?=[\w.])|^\s+|\s+$/g;return function(A,k,y,O){var M,T=y?k:k.replace(I,"");if($.test(T))A.s=isNaN(T)?null:T<0?-1:1;else{if(!y&&(T=T.replace(m,function(B,R,z){return M=(z=z.toLowerCase())=="x"?16:z=="b"?2:8,!O||O==M?R:B}),O&&(M=O,T=T.replace(w,"$1").replace(S,"0.$1")),k!=T))return new x(T,M);if(x.DEBUG)throw Error(Ze+"Not a"+(O?" base "+O:"")+" number: "+k);A.s=null}A.c=A.e=null}}();function F(m,w,S,$){var I,A,k,y,O,M,T,B=m.c,R=Ui;if(B){e:{for(I=1,y=B[0];y>=10;y/=10,I++);if(A=w-I,A<0)A+=ae,k=w,O=B[M=0],T=mt(O/R[I-k-1]%10);else if(M=ji((A+1)/ae),M>=B.length)if($){for(;B.length<=M;B.push(0));O=T=0,I=1,A%=ae,k=A-ae+1}else break e;else{for(O=y=B[M],I=1;y>=10;y/=10,I++);A%=ae,k=A-ae+I,T=k<0?0:mt(O/R[I-k-1]%10)}if($=$||w<0||B[M+1]!=null||(k<0?O:O%R[I-k-1]),$=S<4?(T||$)&&(S==0||S==(m.s<0?3:2)):T>5||T==5&&(S==4||$||S==6&&(A>0?k>0?O/R[I-k]:0:B[M-1])%10&1||S==(m.s<0?8:7)),w<1||!B[0])return B.length=0,$?(w-=m.e+1,B[0]=R[(ae-w%ae)%ae],m.e=-w||0):B[0]=m.e=0,m;if(A==0?(B.length=M,y=1,M--):(B.length=M+1,y=R[ae-A],B[M]=k>0?mt(O/R[I-k]%R[k])*y:0),$)for(;;)if(M==0){for(A=1,k=B[0];k>=10;k/=10,A++);for(k=B[0]+=y,y=1;k>=10;k/=10,y++);A!=y&&(m.e++,B[0]==It&&(B[0]=1));break}else{if(B[M]+=y,B[M]!=It)break;B[M--]=0,y=1}for(A=B.length;B[--A]===0;B.pop());}m.e>f?m.c=m.e=null:m.e<u&&(m.c=[m.e=0])}return m}function L(m){var w,S=m.e;return S===null?m.toString():(w=gt(m.c),w=S<=a||S>=c?ms(w,S):on(w,S,"0"),m.s<0?"-"+w:w)}return o.absoluteValue=o.abs=function(){var m=new x(this);return m.s<0&&(m.s=1),m},o.comparedTo=function(m,w){return Hn(this,new x(m,w))},o.decimalPlaces=o.dp=function(m,w){var S,$,I,A=this;if(m!=null)return Pe(m,0,De),w==null?w=l:Pe(w,0,8),F(new x(A),m+A.e+1,w);if(!(S=A.c))return null;if($=((I=S.length-1)-bt(this.e/ae))*ae,I=S[I])for(;I%10==0;I/=10,$--);return $<0&&($=0),$},o.dividedBy=o.div=function(m,w){return t(this,new x(m,w),i,l)},o.dividedToIntegerBy=o.idiv=function(m,w){return t(this,new x(m,w),0,1)},o.exponentiatedBy=o.pow=function(m,w){var S,$,I,A,k,y,O,M,T,B=this;if(m=new x(m),m.c&&!m.isInteger())throw Error(Ze+"Exponent not an integer: "+L(m));if(w!=null&&(w=new x(w)),y=m.e>14,!B.c||!B.c[0]||B.c[0]==1&&!B.e&&B.c.length==1||!m.c||!m.c[0])return T=new x(Math.pow(+L(B),y?m.s*(2-hs(m)):+L(m))),w?T.mod(w):T;if(O=m.s<0,w){if(w.c?!w.c[0]:!w.s)return new x(NaN);$=!O&&B.isInteger()&&w.isInteger(),$&&(B=B.mod(w))}else{if(m.e>9&&(B.e>0||B.e<-1||(B.e==0?B.c[0]>1||y&&B.c[1]>=24e7:B.c[0]<8e13||y&&B.c[0]<=9999975e7)))return A=B.s<0&&hs(m)?-0:0,B.e>-1&&(A=1/A),new x(O?1/A:A);h&&(A=ji(h/ae+2))}for(y?(S=new x(.5),O&&(m.s=1),M=hs(m)):(I=Math.abs(+L(m)),M=I%2),T=new x(s);;){if(M){if(T=T.times(B),!T.c)break;A?T.c.length>A&&(T.c.length=A):$&&(T=T.mod(w))}if(I){if(I=mt(I/2),I===0)break;M=I%2}else if(m=m.times(S),F(m,m.e+1,1),m.e>14)M=hs(m);else{if(I=+L(m),I===0)break;M=I%2}B=B.times(B),A?B.c&&B.c.length>A&&(B.c.length=A):$&&(B=B.mod(w))}return $?T:(O&&(T=s.div(T)),w?T.mod(w):A?F(T,h,l,k):T)},o.integerValue=function(m){var w=new x(this);return m==null?m=l:Pe(m,0,8),F(w,w.e+1,m)},o.isEqualTo=o.eq=function(m,w){return Hn(this,new x(m,w))===0},o.isFinite=function(){return!!this.c},o.isGreaterThan=o.gt=function(m,w){return Hn(this,new x(m,w))>0},o.isGreaterThanOrEqualTo=o.gte=function(m,w){return(w=Hn(this,new x(m,w)))===1||w===0},o.isInteger=function(){return!!this.c&&bt(this.e/ae)>this.c.length-2},o.isLessThan=o.lt=function(m,w){return Hn(this,new x(m,w))<0},o.isLessThanOrEqualTo=o.lte=function(m,w){return(w=Hn(this,new x(m,w)))===-1||w===0},o.isNaN=function(){return!this.s},o.isNegative=function(){return this.s<0},o.isPositive=function(){return this.s>0},o.isZero=function(){return!!this.c&&this.c[0]==0},o.minus=function(m,w){var S,$,I,A,k=this,y=k.s;if(m=new x(m,w),w=m.s,!y||!w)return new x(NaN);if(y!=w)return m.s=-w,k.plus(m);var O=k.e/ae,M=m.e/ae,T=k.c,B=m.c;if(!O||!M){if(!T||!B)return T?(m.s=-w,m):new x(B?k:NaN);if(!T[0]||!B[0])return B[0]?(m.s=-w,m):new x(T[0]?k:l==3?-0:0)}if(O=bt(O),M=bt(M),T=T.slice(),y=O-M){for((A=y<0)?(y=-y,I=T):(M=O,I=B),I.reverse(),w=y;w--;I.push(0));I.reverse()}else for($=(A=(y=T.length)<(w=B.length))?y:w,y=w=0;w<$;w++)if(T[w]!=B[w]){A=T[w]<B[w];break}if(A&&(I=T,T=B,B=I,m.s=-m.s),w=($=B.length)-(S=T.length),w>0)for(;w--;T[S++]=0);for(w=It-1;$>y;){if(T[--$]<B[$]){for(S=$;S&&!T[--S];T[S]=w);--T[S],T[$]+=It}T[$]-=B[$]}for(;T[0]==0;T.splice(0,1),--M);return T[0]?D(m,T,M):(m.s=l==3?-1:1,m.c=[m.e=0],m)},o.modulo=o.mod=function(m,w){var S,$,I=this;return m=new x(m,w),!I.c||!m.s||m.c&&!m.c[0]?new x(NaN):!m.c||I.c&&!I.c[0]?new x(I):(d==9?($=m.s,m.s=1,S=t(I,m,0,3),m.s=$,S.s*=$):S=t(I,m,0,d),m=I.minus(S.times(m)),!m.c[0]&&d==1&&(m.s=I.s),m)},o.multipliedBy=o.times=function(m,w){var S,$,I,A,k,y,O,M,T,B,R,z,W,G,J,K=this,_=K.c,ne=(m=new x(m,w)).c;if(!_||!ne||!_[0]||!ne[0])return!K.s||!m.s||_&&!_[0]&&!ne||ne&&!ne[0]&&!_?m.c=m.e=m.s=null:(m.s*=K.s,!_||!ne?m.c=m.e=null:(m.c=[0],m.e=0)),m;for($=bt(K.e/ae)+bt(m.e/ae),m.s*=K.s,O=_.length,B=ne.length,O<B&&(W=_,_=ne,ne=W,I=O,O=B,B=I),I=O+B,W=[];I--;W.push(0));for(G=It,J=Tn,I=B;--I>=0;){for(S=0,R=ne[I]%J,z=ne[I]/J|0,k=O,A=I+k;A>I;)M=_[--k]%J,T=_[k]/J|0,y=z*M+T*R,M=R*M+y%J*J+W[A]+S,S=(M/G|0)+(y/J|0)+z*T,W[A--]=M%G;W[A]=S}return S?++$:W.splice(0,1),D(m,W,$)},o.negated=function(){var m=new x(this);return m.s=-m.s||null,m},o.plus=function(m,w){var S,$=this,I=$.s;if(m=new x(m,w),w=m.s,!I||!w)return new x(NaN);if(I!=w)return m.s=-w,$.minus(m);var A=$.e/ae,k=m.e/ae,y=$.c,O=m.c;if(!A||!k){if(!y||!O)return new x(I/0);if(!y[0]||!O[0])return O[0]?m:new x(y[0]?$:I*0)}if(A=bt(A),k=bt(k),y=y.slice(),I=A-k){for(I>0?(k=A,S=O):(I=-I,S=y),S.reverse();I--;S.push(0));S.reverse()}for(I=y.length,w=O.length,I-w<0&&(S=O,O=y,y=S,w=I),I=0;w;)I=(y[--w]=y[w]+O[w]+I)/It|0,y[w]=It===y[w]?0:y[w]%It;return I&&(y=[I].concat(y),++k),D(m,y,k)},o.precision=o.sd=function(m,w){var S,$,I,A=this;if(m!=null&&m!==!!m)return Pe(m,1,De),w==null?w=l:Pe(w,0,8),F(new x(A),m,w);if(!(S=A.c))return null;if(I=S.length-1,$=I*ae+1,I=S[I]){for(;I%10==0;I/=10,$--);for(I=S[0];I>=10;I/=10,$++);}return m&&A.e+1>$&&($=A.e+1),$},o.shiftedBy=function(m){return Pe(m,-zi,zi),this.times("1e"+m)},o.squareRoot=o.sqrt=function(){var m,w,S,$,I,A=this,k=A.c,y=A.s,O=A.e,M=i+4,T=new x("0.5");if(y!==1||!k||!k[0])return new x(!y||y<0&&(!k||k[0])?NaN:k?A:1/0);if(y=Math.sqrt(+L(A)),y==0||y==1/0?(w=gt(k),(w.length+O)%2==0&&(w+="0"),y=Math.sqrt(+w),O=bt((O+1)/2)-(O<0||O%2),y==1/0?w="5e"+O:(w=y.toExponential(),w=w.slice(0,w.indexOf("e")+1)+O),S=new x(w)):S=new x(y+""),S.c[0]){for(O=S.e,y=O+M,y<3&&(y=0);;)if(I=S,S=T.times(I.plus(t(A,I,M,1))),gt(I.c).slice(0,y)===(w=gt(S.c)).slice(0,y))if(S.e<O&&--y,w=w.slice(y-3,y+1),w=="9999"||!$&&w=="4999"){if(!$&&(F(I,I.e+i+2,0),I.times(I).eq(A))){S=I;break}M+=4,y+=4,$=1}else{(!+w||!+w.slice(1)&&w.charAt(0)=="5")&&(F(S,S.e+i+2,1),m=!S.times(S).eq(A));break}}return F(S,S.e+i+1,l,m)},o.toExponential=function(m,w){return m!=null&&(Pe(m,0,De),m++),E(this,m,w,1)},o.toFixed=function(m,w){return m!=null&&(Pe(m,0,De),m=m+this.e+1),E(this,m,w)},o.toFormat=function(m,w,S){var $,I=this;if(S==null)m!=null&&w&&typeof w=="object"?(S=w,w=null):m&&typeof m=="object"?(S=m,m=w=null):S=b;else if(typeof S!="object")throw Error(Ze+"Argument not an object: "+S);if($=I.toFixed(m,w),I.c){var A,k=$.split("."),y=+S.groupSize,O=+S.secondaryGroupSize,M=S.groupSeparator||"",T=k[0],B=k[1],R=I.s<0,z=R?T.slice(1):T,W=z.length;if(O&&(A=y,y=O,O=A,W-=A),y>0&&W>0){for(A=W%y||y,T=z.substr(0,A);A<W;A+=y)T+=M+z.substr(A,y);O>0&&(T+=M+z.slice(A)),R&&(T="-"+T)}$=B?T+(S.decimalSeparator||"")+((O=+S.fractionGroupSize)?B.replace(new RegExp("\\d{"+O+"}\\B","g"),"$&"+(S.fractionGroupSeparator||"")):B):T}return(S.prefix||"")+$+(S.suffix||"")},o.toFraction=function(m){var w,S,$,I,A,k,y,O,M,T,B,R,z=this,W=z.c;if(m!=null&&(y=new x(m),!y.isInteger()&&(y.c||y.s!==1)||y.lt(s)))throw Error(Ze+"Argument "+(y.isInteger()?"out of range: ":"not an integer: ")+L(y));if(!W)return new x(z);for(w=new x(s),M=S=new x(s),$=O=new x(s),R=gt(W),A=w.e=R.length-z.e-1,w.c[0]=Ui[(k=A%ae)<0?ae+k:k],m=!m||y.comparedTo(w)>0?A>0?w:M:y,k=f,f=1/0,y=new x(R),O.c[0]=0;T=t(y,w,0,1),I=S.plus(T.times($)),I.comparedTo(m)!=1;)S=$,$=I,M=O.plus(T.times(I=M)),O=I,w=y.minus(T.times(I=w)),y=I;return I=t(m.minus(S),$,0,1),O=O.plus(I.times(M)),S=S.plus(I.times($)),O.s=M.s=z.s,A=A*2,B=t(M,$,A,l).minus(z).abs().comparedTo(t(O,S,A,l).minus(z).abs())<1?[M,$]:[O,S],f=k,B},o.toNumber=function(){return+L(this)},o.toPrecision=function(m,w){return m!=null&&Pe(m,1,De),E(this,m,w,2)},o.toString=function(m){var w,S=this,$=S.s,I=S.e;return I===null?$?(w="Infinity",$<0&&(w="-"+w)):w="NaN":(m==null?w=I<=a||I>=c?ms(gt(S.c),I):on(gt(S.c),I,"0"):m===10&&P?(S=F(new x(S),i+I+1,l),w=on(gt(S.c),S.e,"0")):(Pe(m,2,v.length,"Base"),w=n(on(gt(S.c),I,"0"),10,m,$,!0)),$<0&&S.c[0]&&(w="-"+w)),w},o.valueOf=o.toJSON=function(){return L(this)},o._isBigNumber=!0,o[Symbol.toStringTag]="BigNumber",o[Symbol.for("nodejs.util.inspect.custom")]=o.valueOf,e!=null&&x.set(e),x}function bt(e){var t=e|0;return e>0||e===t?t:t-1}function gt(e){for(var t,n,r=1,o=e.length,s=e[0]+"";r<o;){for(t=e[r++]+"",n=ae-t.length;n--;t="0"+t);s+=t}for(o=s.length;s.charCodeAt(--o)===48;);return s.slice(0,o+1||1)}function Hn(e,t){var n,r,o=e.c,s=t.c,i=e.s,l=t.s,a=e.e,c=t.e;if(!i||!l)return null;if(n=o&&!o[0],r=s&&!s[0],n||r)return n?r?0:-l:i;if(i!=l)return i;if(n=i<0,r=a==c,!o||!s)return r?0:!o^n?1:-1;if(!r)return a>c^n?1:-1;for(l=(a=o.length)<(c=s.length)?a:c,i=0;i<l;i++)if(o[i]!=s[i])return o[i]>s[i]^n?1:-1;return a==c?0:a>c^n?1:-1}function Pe(e,t,n,r){if(e<t||e>n||e!==mt(e))throw Error(Ze+(r||"Argument")+(typeof e=="number"?e<t||e>n?" out of range: ":" not an integer: ":" not a primitive number: ")+String(e))}function hs(e){var t=e.c.length-1;return bt(e.e/ae)==t&&e.c[t]%2!=0}function ms(e,t){return(e.length>1?e.charAt(0)+"."+e.slice(1):e)+(t<0?"e":"e+")+t}function on(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 Re=ru();const pb=(e,t=6)=>{try{const n=new Re(e||"0");if(n.isNaN())return"0";const r=n.decimalPlaces(t,Re.ROUND_DOWN),[o,s=""]=r.toString().split("."),i=o.replace(/\B(?=(\d{3})+(?!\d))/g,",");if(t>0){const l=(s||"").padEnd(t,"0");return`${i}.${l}`}return i}catch(n){return console.warn("formatThousands error:",n),"0"}},$t=()=>{const{translations:e,currentLocale:t}=tu();return{t:(s,i)=>{try{const l=s.split(".");let a=e;for(const u of l)if(a&&typeof a=="object"&&u in a)a=a[u];else return s;let c=typeof a=="string"?a:s;return i&&typeof c=="string"&&Object.keys(i).forEach(u=>{const f=`{{${u}}}`;c=c.replace(new RegExp(f,"g"),String(i[u]))}),c}catch(l){return console.warn(`Translation error for key "${s}":`,l),s}},translations:e,locale:t,getTranslationObject:s=>{try{const i=s.split(".");let l=e;for(const a of i)if(l&&typeof l=="object"&&a in l)l=l[a];else return{};return typeof l=="object"?l:{}}catch(i){return console.warn(`Translation object error for key "${s}":`,i),{}}},hasTranslation:s=>{try{const i=s.split(".");let l=e;for(const a of i)if(l&&typeof l=="object"&&a in l)l=l[a];else return!1;return typeof l=="string"}catch{return!1}}}},hb="1.2.3";let Ye=class Kc extends Error{constructor(t,n={}){var i;const r=n.cause instanceof Kc?n.cause.details:(i=n.cause)!=null&&i.message?n.cause.message:n.details,o=n.cause instanceof Kc&&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@${hb}`].join(`
51
+ `);super(s),Object.defineProperty(this,"details",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docsPath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"metaMessages",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"shortMessage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiTypeError"}),n.cause&&(this.cause=n.cause),this.details=r,this.docsPath=o,this.metaMessages=n.metaMessages,this.shortMessage=t}};function sn(e,t){const n=e.exec(t);return n==null?void 0:n.groups}const ou=/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/,su=/^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)?$/,iu=/^\(.+?\).*?$/,au=/^tuple(?<array>(\[(\d*)\])*)$/;function Wi(e){let t=e.type;if(au.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+=Wi(s),o<n-1&&(t+=", ")}const r=sn(au,e.type);return t+=`)${(r==null?void 0:r.array)||""}`,Wi({...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+=Wi(o),r!==n-1&&(t+=", ")}return t}function bs(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 lu=/^error (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*)\((?<parameters>.*?)\)$/;function mb(e){return lu.test(e)}function bb(e){return sn(lu,e)}const cu=/^event (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*)\((?<parameters>.*?)\)$/;function gb(e){return cu.test(e)}function yb(e){return sn(cu,e)}const uu=/^function (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*)\((?<parameters>.*?)\)(?: (?<scope>external|public{1}))?(?: (?<stateMutability>pure|view|nonpayable|payable{1}))?(?: returns\s?\((?<returns>.*?)\))?$/;function vb(e){return uu.test(e)}function wb(e){return sn(uu,e)}const fu=/^struct (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*) \{(?<properties>.*?)\}$/;function gs(e){return fu.test(e)}function xb(e){return sn(fu,e)}const du=/^constructor\((?<parameters>.*?)\)(?:\s(?<stateMutability>payable{1}))?$/;function Eb(e){return du.test(e)}function Sb(e){return sn(du,e)}const pu=/^fallback\(\) external(?:\s(?<stateMutability>payable{1}))?$/;function Pb(e){return pu.test(e)}function Tb(e){return sn(pu,e)}const Ab=/^receive\(\) external payable$/;function Nb(e){return Ab.test(e)}const hu=new Set(["memory","indexed","storage","calldata"]),Cb=new Set(["indexed"]),_i=new Set(["calldata","memory","storage"]);class Ob extends Ye{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 Ib extends Ye{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 $b extends Ye{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 kb extends Ye{constructor({params:t}){super("Failed to parse ABI parameters.",{details:`parseAbiParameters(${JSON.stringify(t,null,2)})`,docsPath:"/api/human#parseabiparameters-1"}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidAbiParametersError"})}}class Mb extends Ye{constructor({param:t}){super("Invalid ABI parameter.",{details:t}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidParameterError"})}}class Db extends Ye{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 Bb extends Ye{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 Lb extends Ye{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 Fb extends Ye{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 br extends Ye{constructor({signature:t,type:n}){super(`Invalid ${n} signature.`,{details:t}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidSignatureError"})}}class Rb extends Ye{constructor({signature:t}){super("Unknown signature.",{details:t}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"UnknownSignatureError"})}}class jb extends Ye{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 zb extends Ye{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 Ub extends Ye{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 Wb(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}${r}`}const Vi=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 Hi(e,t={}){if(vb(e))return _b(e,t);if(gb(e))return Vb(e,t);if(mb(e))return Hb(e,t);if(Eb(e))return Gb(e,t);if(Pb(e))return qb(e);if(Nb(e))return{type:"receive",stateMutability:"payable"};throw new Rb({signature:e})}function _b(e,t={}){const n=wb(e);if(!n)throw new br({signature:e,type:"function"});const r=ut(n.parameters),o=[],s=r.length;for(let l=0;l<s;l++)o.push(an(r[l],{modifiers:_i,structs:t,type:"function"}));const i=[];if(n.returns){const l=ut(n.returns),a=l.length;for(let c=0;c<a;c++)i.push(an(l[c],{modifiers:_i,structs:t,type:"function"}))}return{name:n.name,type:"function",stateMutability:n.stateMutability??"nonpayable",inputs:o,outputs:i}}function Vb(e,t={}){const n=yb(e);if(!n)throw new br({signature:e,type:"event"});const r=ut(n.parameters),o=[],s=r.length;for(let i=0;i<s;i++)o.push(an(r[i],{modifiers:Cb,structs:t,type:"event"}));return{name:n.name,type:"event",inputs:o}}function Hb(e,t={}){const n=bb(e);if(!n)throw new br({signature:e,type:"error"});const r=ut(n.parameters),o=[],s=r.length;for(let i=0;i<s;i++)o.push(an(r[i],{structs:t,type:"error"}));return{name:n.name,type:"error",inputs:o}}function Gb(e,t={}){const n=Sb(e);if(!n)throw new br({signature:e,type:"constructor"});const r=ut(n.parameters),o=[],s=r.length;for(let i=0;i<s;i++)o.push(an(r[i],{structs:t,type:"constructor"}));return{type:"constructor",stateMutability:n.stateMutability??"nonpayable",inputs:o}}function qb(e){const t=Tb(e);if(!t)throw new br({signature:e,type:"fallback"});return{type:"fallback",stateMutability:t.stateMutability??"nonpayable"}}const Kb=/^(?<type>[a-zA-Z$_][a-zA-Z0-9$_]*(?:\spayable)?)(?<array>(?:\[\d*?\])+?)?(?:\s(?<modifier>calldata|indexed|memory|storage{1}))?(?:\s(?<name>[a-zA-Z$_][a-zA-Z0-9$_]*))?$/,Zb=/^\((?<type>.+?)\)(?<array>(?:\[\d*?\])+?)?(?:\s(?<modifier>calldata|indexed|memory|storage{1}))?(?:\s(?<name>[a-zA-Z$_][a-zA-Z0-9$_]*))?$/,Yb=/^u?int$/;function an(e,t){var f,p;const n=Wb(e,t==null?void 0:t.type,t==null?void 0:t.structs);if(Vi.has(n))return Vi.get(n);const r=iu.test(e),o=sn(r?Zb:Kb,e);if(!o)throw new Mb({param:e});if(o.name&&Jb(o.name))throw new Db({param:e,name:o.name});const s=o.name?{name:o.name}:{},i=o.modifier==="indexed"?{indexed:!0}:{},l=(t==null?void 0:t.structs)??{};let a,c={};if(r){a="tuple";const d=ut(o.type),h=[],b=d.length;for(let v=0;v<b;v++)h.push(an(d[v],{structs:l}));c={components:h}}else if(o.type in l)a="tuple",c={components:l[o.type]};else if(Yb.test(o.type))a=`${o.type}256`;else if(o.type==="address payable")a="address";else if(a=o.type,(t==null?void 0:t.type)!=="struct"&&!mu(a))throw new $b({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 Bb({param:e,type:t==null?void 0:t.type,modifier:o.modifier});if(_i.has(o.modifier)&&!Qb(a,!!o.array))throw new Lb({param:e,type:t==null?void 0:t.type,modifier:o.modifier})}const u={type:`${a}${o.array??""}`,...s,...i,...c};return Vi.set(n,u),u}function ut(e,t=[],n="",r=0){const o=e.trim().length;for(let s=0;s<o;s++){const i=e[s],l=e.slice(s+1);switch(i){case",":return r===0?ut(l,[...t,n.trim()]):ut(l,t,`${n}${i}`,r);case"(":return ut(l,t,`${n}${i}`,r+1);case")":return ut(l,t,`${n}${i}`,r-1);default:return ut(l,t,`${n}${i}`,r)}}if(n==="")return t;if(r!==0)throw new Ub({current:n,depth:r});return t.push(n.trim()),t}function mu(e){return e==="address"||e==="bool"||e==="function"||e==="string"||ou.test(e)||su.test(e)}const Xb=/^(?: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 Jb(e){return e==="address"||e==="bool"||e==="function"||e==="string"||e==="tuple"||ou.test(e)||su.test(e)||Xb.test(e)}function Qb(e,t){return t||e==="bytes"||e==="string"||e==="tuple"}function Gi(e){const t={},n=e.length;for(let i=0;i<n;i++){const l=e[i];if(!gs(l))continue;const a=xb(l);if(!a)throw new br({signature:l,type:"struct"});const c=a.properties.split(";"),u=[],f=c.length;for(let p=0;p<f;p++){const h=c[p].trim();if(!h)continue;const b=an(h,{type:"struct"});u.push(b)}if(!u.length)throw new jb({signature:l});t[a.name]=u}const r={},o=Object.entries(t),s=o.length;for(let i=0;i<s;i++){const[l,a]=o[i];r[l]=bu(a,t)}return r}const e1=/^(?<type>[a-zA-Z$_][a-zA-Z0-9$_]*)(?<array>(?:\[\d*?\])+?)?$/;function bu(e=[],t={},n=new Set){const r=[],o=e.length;for(let s=0;s<o;s++){const i=e[s];if(iu.test(i.type))r.push(i);else{const a=sn(e1,i.type);if(!(a!=null&&a.type))throw new Fb({abiParameter:i});const{array:c,type:u}=a;if(u in t){if(n.has(u))throw new zb({type:u});r.push({...i,type:`tuple${c??""}`,components:bu(t[u],t,new Set([...n,u]))})}else if(mu(u))r.push(i);else throw new Ib({type:u})}}return r}function gu(e){const t=Gi(e),n=[],r=e.length;for(let o=0;o<r;o++){const s=e[o];gs(s)||n.push(Hi(s,t))}return n}function yu(e){let t;if(typeof e=="string")t=Hi(e);else{const n=Gi(e),r=e.length;for(let o=0;o<r;o++){const s=e[o];if(!gs(s)){t=Hi(s,n);break}}}if(!t)throw new Ob({signature:e});return t}function vu(e){const t=[];if(typeof e=="string"){const n=ut(e),r=n.length;for(let o=0;o<r;o++)t.push(an(n[o],{modifiers:hu}))}else{const n=Gi(e),r=e.length;for(let o=0;o<r;o++){const s=e[o];if(gs(s))continue;const i=ut(s),l=i.length;for(let a=0;a<l;a++)t.push(an(i[a],{modifiers:hu,structs:n}))}}if(t.length===0)throw new kb({params:e});return t}function te(e,t,n){const r=e[t.name];if(typeof r=="function")return r;const o=e[n];return typeof o=="function"?o:s=>t(e,s)}function kt(e,{includeName:t=!1}={}){if(e.type!=="function"&&e.type!=="event"&&e.type!=="error")throw new h1(e.type);return`${e.name}(${ys(e.inputs,{includeName:t})})`}function ys(e,{includeName:t=!1}={}){return e?e.map(n=>t1(n,{includeName:t})).join(t?", ":","):""}function t1(e,{includeName:t}){return e.type.startsWith("tuple")?`(${ys(e.components,{includeName:t})})${e.type.slice(5)}`:e.type+(t&&e.name?` ${e.name}`:"")}function Mt(e,{strict:t=!0}={}){return!e||typeof e!="string"?!1:t?/^0x[0-9a-fA-F]*$/.test(e):e.startsWith("0x")}function Te(e){return Mt(e,{strict:!1})?Math.ceil((e.length-2)/2):e.length}const wu="2.47.2";let no={getDocsUrl:({docsBaseUrl:e,docsPath:t="",docsSlug:n})=>t?`${e??"https://viem.sh"}${t}${n?`#${n}`:""}`:void 0,version:`viem@${wu}`},V=class Zc extends Error{constructor(t,n={}){var l;const r=(()=>{var a;return n.cause instanceof Zc?n.cause.details:(a=n.cause)!=null&&a.message?n.cause.message:n.details})(),o=n.cause instanceof Zc&&n.cause.docsPath||n.docsPath,s=(l=no.getDocsUrl)==null?void 0:l.call(no,{...n,docsPath:o}),i=[t||"An error occurred.","",...n.metaMessages?[...n.metaMessages,""]:[],...s?[`Docs: ${s}`]:[],...r?[`Details: ${r}`]:[],...no.version?[`Version: ${no.version}`]:[]].join(`
52
52
  `);super(i,n.cause?{cause:n.cause}:void 0),Object.defineProperty(this,"details",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docsPath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"metaMessages",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"shortMessage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"version",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"BaseError"}),this.details=r,this.docsPath=o,this.metaMessages=n.metaMessages,this.name=n.name??this.name,this.shortMessage=t,this.version=wu}walk(t){return xu(this,t)}};function xu(e,t){return t!=null&&t(e)?e:e&&typeof e=="object"&&"cause"in e&&e.cause!==void 0?xu(e.cause,t):t?null:e}class n1 extends V{constructor({docsPath:t}){super(["A constructor was not found on the ABI.","Make sure you are using the correct ABI and that the constructor exists on it."].join(`
53
53
  `),{docsPath:t,name:"AbiConstructorNotFoundError"})}}class Eu extends V{constructor({docsPath:t}){super(["Constructor arguments were provided (`args`), but a constructor parameters (`inputs`) were not found on the ABI.","Make sure you are using the correct ABI, and that the `inputs` attribute on the constructor exists."].join(`
54
54
  `),{docsPath:t,name:"AbiConstructorParamsNotFoundError"})}}class Su extends V{constructor({data:t,params:n,size:r}){super([`Data size of ${r} bytes is too small for given parameters.`].join(`
55
- `),{metaMessages:[`Params: (${ys(n,{includeName:!0})})`,`Data: ${t} (${r} bytes)`],name:"AbiDecodingDataSizeTooSmallError"}),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"params",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"size",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.data=t,this.params=n,this.size=r}}class no extends V{constructor(){super('Cannot decode zero data ("0x") with ABI parameters.',{name:"AbiDecodingZeroDataError"})}}class r1 extends V{constructor({expectedLength:t,givenLength:n,type:r}){super([`ABI encoding array length mismatch for type ${r}.`,`Expected length: ${t}`,`Given length: ${n}`].join(`
55
+ `),{metaMessages:[`Params: (${ys(n,{includeName:!0})})`,`Data: ${t} (${r} bytes)`],name:"AbiDecodingDataSizeTooSmallError"}),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"params",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"size",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.data=t,this.params=n,this.size=r}}class ro extends V{constructor(){super('Cannot decode zero data ("0x") with ABI parameters.',{name:"AbiDecodingZeroDataError"})}}class r1 extends V{constructor({expectedLength:t,givenLength:n,type:r}){super([`ABI encoding array length mismatch for type ${r}.`,`Expected length: ${t}`,`Given length: ${n}`].join(`
56
56
  `),{name:"AbiEncodingArrayLengthMismatchError"})}}class o1 extends V{constructor({expectedSize:t,value:n}){super(`Size of bytes "${n}" (bytes${Te(n)}) does not match expected size (bytes${t}).`,{name:"AbiEncodingBytesSizeMismatchError"})}}class s1 extends V{constructor({expectedLength:t,givenLength:n}){super(["ABI encoding params/values length mismatch.",`Expected length (params): ${t}`,`Given length (values): ${n}`].join(`
57
57
  `),{name:"AbiEncodingLengthMismatchError"})}}class i1 extends V{constructor(t,{docsPath:n}){super([`Arguments (\`args\`) were provided to "${t}", but "${t}" on the ABI does not contain any parameters (\`inputs\`).`,"Cannot encode error result without knowing what the parameter types are.","Make sure you are using the correct ABI and that the inputs exist on it."].join(`
58
58
  `),{docsPath:n,name:"AbiErrorInputsNotFoundError"})}}class Pu extends V{constructor(t,{docsPath:n}={}){super([`Error ${t?`"${t}" `:""}not found on ABI.`,"Make sure you are using the correct ABI and that the error exists on it."].join(`
@@ -68,7 +68,7 @@ React keys must be passed directly to JSX without using spread:
68
68
  `),{docsPath:n,name:"InvalidAbiEncodingType"})}}class p1 extends V{constructor(t,{docsPath:n}){super([`Type "${t}" is not a valid decoding type.`,"Please provide a valid ABI type."].join(`
69
69
  `),{docsPath:n,name:"InvalidAbiDecodingType"})}}let Cu=class extends V{constructor(t){super([`Value "${t}" is not a valid array.`].join(`
70
70
  `),{name:"InvalidArrayError"})}};class h1 extends V{constructor(t){super([`"${t}" is not a valid definition type.`,'Valid types: "function", "event", "error"'].join(`
71
- `),{name:"InvalidDefinitionTypeError"})}}class m1 extends V{constructor(t){super(`Filter type "${t}" is not supported.`,{name:"FilterTypeNotSupportedError"})}}let Ou=class extends V{constructor({offset:t,position:n,size:r}){super(`Slice ${n==="start"?"starting":"ending"} at offset "${t}" is out-of-bounds (size: ${r}).`,{name:"SliceOffsetOutOfBoundsError"})}},Iu=class extends V{constructor({size:t,targetSize:n,type:r}){super(`${r.charAt(0).toUpperCase()}${r.slice(1).toLowerCase()} size (${t}) exceeds padding size (${n}).`,{name:"SizeExceedsPaddingSizeError"})}};class $u extends V{constructor({size:t,targetSize:n,type:r}){super(`${r.charAt(0).toUpperCase()}${r.slice(1).toLowerCase()} is expected to be ${n} ${r} long, but is ${t} ${r} long.`,{name:"InvalidBytesLengthError"})}}function yr(e,{dir:t,size:n=32}={}){return typeof e=="string"?Nn(e,{dir:t,size:n}):b1(e,{dir:t,size:n})}function Nn(e,{dir:t,size:n=32}={}){if(n===null)return e;const r=e.replace("0x","");if(r.length>n*2)throw new Iu({size:Math.ceil(r.length/2),targetSize:n,type:"hex"});return`0x${r[t==="right"?"padEnd":"padStart"](n*2,"0")}`}function b1(e,{dir:t,size:n=32}={}){if(n===null)return e;if(e.length>n)throw new Iu({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 Ki=class extends V{constructor({max:t,min:n,signed:r,size:o,value:s}){super(`Number "${s}" is not in safe ${o?`${o*8}-bit ${r?"signed":"unsigned"} `:""}integer range ${t?`(${n} to ${t})`:`(above ${n})`}`,{name:"IntegerOutOfRangeError"})}},g1=class extends V{constructor(t){super(`Bytes value "${t}" is not a valid boolean. The bytes array must contain a single byte of either a 0 or 1 value.`,{name:"InvalidBytesBooleanError"})}};class y1 extends V{constructor(t){super(`Hex value "${t}" is not a valid boolean. The hex value must be "0x0" (false) or "0x1" (true).`,{name:"InvalidHexBooleanError"})}}let v1=class extends V{constructor({givenSize:t,maxSize:n}){super(`Size cannot exceed ${n} bytes. Given size: ${t} bytes.`,{name:"SizeOverflowError"})}};function Gn(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 Dt(e,{size:t}){if(Te(e)>t)throw new v1({givenSize:Te(e),maxSize:t})}function Gt(e,t={}){const{signed:n}=t;t.size&&Dt(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 w1(e,t={}){let n=e;if(t.size&&(Dt(n,{size:t.size}),n=Gn(n)),Gn(n)==="0x00")return!1;if(Gn(n)==="0x01")return!0;throw new y1(n)}function ln(e,t={}){const n=Gt(e,t),r=Number(n);if(!Number.isSafeInteger(r))throw new Ki({max:`${Number.MAX_SAFE_INTEGER}`,min:`${Number.MIN_SAFE_INTEGER}`,signed:t.signed,size:t.size,value:`${n}n`});return r}const x1=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function Cn(e,t={}){return typeof e=="number"||typeof e=="bigint"?re(e,t):typeof e=="string"?ro(e,t):typeof e=="boolean"?ku(e,t):ke(e,t)}function ku(e,t={}){const n=`0x${Number(e)}`;return typeof t.size=="number"?(Dt(n,{size:t.size}),yr(n,{size:t.size})):n}function ke(e,t={}){let n="";for(let o=0;o<e.length;o++)n+=x1[e[o]];const r=`0x${n}`;return typeof t.size=="number"?(Dt(r,{size:t.size}),yr(r,{dir:"right",size:t.size})):r}function re(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 Ki({max:s?`${s}${a}`:void 0,min:`${i}${a}`,signed:n,size:r,value:`${e}${a}`})}const l=`0x${(n&&o<0?(1n<<BigInt(r*8))+BigInt(o):o).toString(16)}`;return r?yr(l,{size:r}):l}const E1=new TextEncoder;function ro(e,t={}){const n=E1.encode(e);return ke(n,t)}const S1=new TextEncoder;function vr(e,t={}){return typeof e=="number"||typeof e=="bigint"?T1(e,t):typeof e=="boolean"?P1(e,t):Mt(e)?qt(e,t):qn(e,t)}function P1(e,t={}){const n=new Uint8Array(1);return n[0]=Number(e),typeof t.size=="number"?(Dt(n,{size:t.size}),yr(n,{size:t.size})):n}const cn={zero:48,nine:57,A:65,F:70,a:97,f:102};function Mu(e){if(e>=cn.zero&&e<=cn.nine)return e-cn.zero;if(e>=cn.A&&e<=cn.F)return e-(cn.A-10);if(e>=cn.a&&e<=cn.f)return e-(cn.a-10)}function qt(e,t={}){let n=e;t.size&&(Dt(n,{size:t.size}),n=yr(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,l=0;i<o;i++){const a=Mu(r.charCodeAt(l++)),c=Mu(r.charCodeAt(l++));if(a===void 0||c===void 0)throw new V(`Invalid byte sequence ("${r[l-2]}${r[l-1]}" in "${r}").`);s[i]=a*16+c}return s}function T1(e,t){const n=re(e,t);return qt(n)}function qn(e,t={}){const n=S1.encode(e);return typeof t.size=="number"?(Dt(n,{size:t.size}),yr(n,{dir:"right",size:t.size})):n}const ws=BigInt(2**32-1),Du=BigInt(32);function A1(e,t=!1){return t?{h:Number(e&ws),l:Number(e>>Du&ws)}:{h:Number(e>>Du&ws)|0,l:Number(e&ws)|0}}function N1(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}=A1(e[s],t);[r[s],o[s]]=[i,l]}return[r,o]}const C1=(e,t,n)=>e<<n|t>>>32-n,O1=(e,t,n)=>t<<n|e>>>32-n,I1=(e,t,n)=>t<<n-32|e>>>64-n,$1=(e,t,n)=>e<<n-32|t>>>64-n,wr=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0;/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */function k1(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array"}function oo(e){if(!Number.isSafeInteger(e)||e<0)throw new Error("positive integer expected, got "+e)}function Kn(e,...t){if(!k1(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 M1(e){if(typeof e!="function"||typeof e.create!="function")throw new Error("Hash should be wrapped by utils.createHasher");oo(e.outputLen),oo(e.blockLen)}function xr(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 Bu(e,t){Kn(e);const n=t.outputLen;if(e.length<n)throw new Error("digestInto() expects output buffer of length at least "+n)}function D1(e){return new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4))}function Er(...e){for(let t=0;t<e.length;t++)e[t].fill(0)}function Zi(e){return new DataView(e.buffer,e.byteOffset,e.byteLength)}function Kt(e,t){return e<<32-t|e>>>t}const B1=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;function L1(e){return e<<24&4278190080|e<<8&16711680|e>>>8&65280|e>>>24&255}function F1(e){for(let t=0;t<e.length;t++)e[t]=L1(e[t]);return e}const Lu=B1?e=>e:F1;function R1(e){if(typeof e!="string")throw new Error("string expected");return new Uint8Array(new TextEncoder().encode(e))}function xs(e){return typeof e=="string"&&(e=R1(e)),Kn(e),e}function j1(...e){let t=0;for(let r=0;r<e.length;r++){const o=e[r];Kn(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 Yi{}function Fu(e){const t=r=>e().update(xs(r)).digest(),n=e();return t.outputLen=n.outputLen,t.blockLen=n.blockLen,t.create=()=>e(),t}function z1(e=32){if(wr&&typeof wr.getRandomValues=="function")return wr.getRandomValues(new Uint8Array(e));if(wr&&typeof wr.randomBytes=="function")return Uint8Array.from(wr.randomBytes(e));throw new Error("crypto.getRandomValues must be defined")}const U1=BigInt(0),so=BigInt(1),_1=BigInt(2),W1=BigInt(7),V1=BigInt(256),H1=BigInt(113),Ru=[],ju=[],zu=[];for(let e=0,t=so,n=1,r=0;e<24;e++){[n,r]=[r,(2*n+3*r)%5],Ru.push(2*(5*r+n)),ju.push((e+1)*(e+2)/2%64);let o=U1;for(let s=0;s<7;s++)t=(t<<so^(t>>W1)*H1)%V1,t&_1&&(o^=so<<(so<<BigInt(s))-so);zu.push(o)}const Uu=N1(zu,!0),G1=Uu[0],q1=Uu[1],_u=(e,t,n)=>n>32?I1(e,t,n):C1(e,t,n),Wu=(e,t,n)=>n>32?$1(e,t,n):O1(e,t,n);function K1(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 l=(i+8)%10,a=(i+2)%10,c=n[a],u=n[a+1],f=_u(c,u,1)^n[l],p=Wu(c,u,1)^n[l+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 l=ju[i],a=_u(o,s,l),c=Wu(o,s,l),u=Ru[i];o=e[u],s=e[u+1],e[u]=a,e[u+1]=c}for(let i=0;i<50;i+=10){for(let l=0;l<10;l++)n[l]=e[i+l];for(let l=0;l<10;l++)e[i+l]^=~n[(l+2)%10]&n[(l+4)%10]}e[0]^=G1[r],e[1]^=q1[r]}Er(n)}class Xi extends Yi{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,oo(r),!(0<t&&t<200))throw new Error("only keccak-f1600 function is supported");this.state=new Uint8Array(200),this.state32=D1(this.state)}clone(){return this._cloneInto()}keccak(){Lu(this.state32),K1(this.state32,this.rounds),Lu(this.state32),this.posOut=0,this.pos=0}update(t){xr(this),t=xs(t),Kn(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 l=0;l<i;l++)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){xr(this,!1),Kn(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 oo(t),this.xofInto(new Uint8Array(t))}digestInto(t){if(Bu(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,Er(this.state)}_cloneInto(t){const{blockLen:n,suffix:r,outputLen:o,rounds:s,enableXOF:i}=this;return t||(t=new Xi(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 Z1=(e,t,n)=>Fu(()=>new Xi(t,e,n)),Vu=Z1(1,136,256/8);function je(e,t){const n=t||"hex",r=Vu(Mt(e,{strict:!1})?vr(e):e);return n==="bytes"?r:Cn(r)}const Y1=e=>je(vr(e));function X1(e){return Y1(e)}function J1(e){let t=!0,n="",r=0,o="",s=!1;for(let i=0;i<e.length;i++){const l=e[i];if(["(",")",","].includes(l)&&(t=!0),l==="("&&r++,l===")"&&r--,!!t){if(r===0){if(l===" "&&["event","function",""].includes(o))o="";else if(o+=l,l===")"){s=!0;break}continue}if(l===" "){e[i-1]!==","&&n!==","&&n!==",("&&(n="",t=!1);continue}o+=l,n+=l}}if(!s)throw new V("Unable to normalize signature.");return o}const Q1=e=>{const t=typeof e=="string"?e:bs(e);return J1(t)};function Hu(e){return X1(Q1(e))}const Es=Hu;let On=class extends V{constructor({address:t}){super(`Address "${t}" is invalid.`,{metaMessages:["- Address must be a hex value of 20 bytes (40 hex characters).","- Address must match its checksum counterpart."],name:"InvalidAddressError"})}},Ss=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 Ji=new Ss(8192);function Ps(e,t){if(Ji.has(`${e}.${t}`))return Ji.get(`${e}.${t}`);const n=e.substring(2).toLowerCase(),r=je(qn(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 Ji.set(`${e}.${t}`,s),s}function un(e,t){if(!yt(e,{strict:!1}))throw new On({address:e});return Ps(e,t)}const eg=/^0x[a-fA-F0-9]{40}$/,Qi=new Ss(8192);function yt(e,t){const{strict:n=!0}=t??{},r=`${e}.${n}`;if(Qi.has(r))return Qi.get(r);const o=eg.test(e)?e.toLowerCase()===e?!0:n?Ps(e)===e:!0:!1;return Qi.set(r,o),o}function Bt(e){return typeof e[0]=="string"?Sr(e):tg(e)}function tg(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 Sr(e){return`0x${e.reduce((t,n)=>t+n.replace("0x",""),"")}`}function Zn(e,t,n,{strict:r}={}){return Mt(e,{strict:!1})?ng(e,t,n,{strict:r}):Ku(e,t,n,{strict:r})}function Gu(e,t){if(typeof t=="number"&&t>0&&t>Te(e)-1)throw new Ou({offset:t,position:"start",size:Te(e)})}function qu(e,t,n){if(typeof t=="number"&&typeof n=="number"&&Te(e)!==n-t)throw new Ou({offset:n,position:"end",size:Te(e)})}function Ku(e,t,n,{strict:r}={}){Gu(e,t);const o=e.slice(t,n);return r&&qu(o,t,n),o}function ng(e,t,n,{strict:r}={}){Gu(e,t);const o=`0x${e.replace("0x","").slice((t??0)*2,(n??e.length)*2)}`;return r&&qu(o,t,n),o}const rg=/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/,Zu=/^(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 In(e,t){if(e.length!==t.length)throw new s1({expectedLength:e.length,givenLength:t.length});const n=og({params:e,values:t}),r=ta(n);return r.length===0?"0x":r}function og({params:e,values:t}){const n=[];for(let r=0;r<e.length;r++)n.push(ea({param:e[r],value:t[r]}));return n}function ea({param:e,value:t}){const n=na(e.type);if(n){const[r,o]=n;return ig(t,{length:r,param:{...e,type:o}})}if(e.type==="tuple")return fg(t,{param:e});if(e.type==="address")return sg(t);if(e.type==="bool")return lg(t);if(e.type.startsWith("uint")||e.type.startsWith("int")){const r=e.type.startsWith("int"),[,,o="256"]=Zu.exec(e.type)??[];return cg(t,{signed:r,size:Number(o)})}if(e.type.startsWith("bytes"))return ag(t,{param:e});if(e.type==="string")return ug(t);throw new d1(e.type,{docsPath:"/docs/contract/encodeAbiParameters"})}function ta(e){let t=0;for(let s=0;s<e.length;s++){const{dynamic:i,encoded:l}=e[s];i?t+=32:t+=Te(l)}const n=[],r=[];let o=0;for(let s=0;s<e.length;s++){const{dynamic:i,encoded:l}=e[s];i?(n.push(re(t+o,{size:32})),r.push(l),o+=Te(l)):n.push(l)}return Bt([...n,...r])}function sg(e){if(!yt(e))throw new On({address:e});return{dynamic:!1,encoded:Nn(e.toLowerCase())}}function ig(e,{length:t,param:n}){const r=t===null;if(!Array.isArray(e))throw new Cu(e);if(!r&&e.length!==t)throw new r1({expectedLength:t,givenLength:e.length,type:`${n.type}[${t}]`});let o=!1;const s=[];for(let i=0;i<e.length;i++){const l=ea({param:n,value:e[i]});l.dynamic&&(o=!0),s.push(l)}if(r||o){const i=ta(s);if(r){const l=re(s.length,{size:32});return{dynamic:!0,encoded:s.length>0?Bt([l,i]):l}}if(o)return{dynamic:!0,encoded:i}}return{dynamic:!1,encoded:Bt(s.map(({encoded:i})=>i))}}function ag(e,{param:t}){const[,n]=t.type.split("bytes"),r=Te(e);if(!n){let o=e;return r%32!==0&&(o=Nn(o,{dir:"right",size:Math.ceil((e.length-2)/2/32)*32})),{dynamic:!0,encoded:Bt([Nn(re(r,{size:32})),o])}}if(r!==Number.parseInt(n,10))throw new o1({expectedSize:Number.parseInt(n,10),value:e});return{dynamic:!1,encoded:Nn(e,{dir:"right"})}}function lg(e){if(typeof e!="boolean")throw new V(`Invalid boolean value: "${e}" (type: ${typeof e}). Expected: \`true\` or \`false\`.`);return{dynamic:!1,encoded:Nn(ku(e))}}function cg(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 Ki({max:r.toString(),min:o.toString(),signed:t,size:n/8,value:e.toString()})}return{dynamic:!1,encoded:re(e,{size:32,signed:t})}}function ug(e){const t=ro(e),n=Math.ceil(Te(t)/32),r=[];for(let o=0;o<n;o++)r.push(Nn(Zn(t,o*32,(o+1)*32),{dir:"right"}));return{dynamic:!0,encoded:Bt([Nn(re(Te(t),{size:32})),...r])}}function fg(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,l=ea({param:s,value:e[i]});r.push(l),l.dynamic&&(n=!0)}return{dynamic:n,encoded:n?ta(r):Bt(r.map(({encoded:o})=>o))}}function na(e){const t=e.match(/^(.*)\[(\d+)?\]$/);return t?[t[2]?Number(t[2]):null,t[1]]:void 0}const io=e=>Zn(Hu(e),0,4);function Yn(e){const{abi:t,args:n=[],name:r}=e,o=Mt(r,{strict:!1}),s=t.filter(l=>o?l.type==="function"?io(l)===r:l.type==="event"?Es(l)===r:!1:"name"in l&&l.name===r);if(s.length===0)return;if(s.length===1)return s[0];let i;for(const l of s){if(!("inputs"in l))continue;if(!n||n.length===0){if(!l.inputs||l.inputs.length===0)return l;continue}if(!l.inputs||l.inputs.length===0||l.inputs.length!==n.length)continue;if(n.every((c,u)=>{const f="inputs"in l&&l.inputs[u];return f?ra(c,f):!1})){if(i&&"inputs"in i&&i.inputs){const c=Yu(l.inputs,i.inputs,n);if(c)throw new u1({abiItem:l,type:c[0]},{abiItem:i,type:c[1]})}i=l}}return i||s[0]}function ra(e,t){const n=typeof e,r=t.type;switch(r){case"address":return yt(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)=>n==="object"&&ra(Object.values(e)[s],o)):/^u?int(8|16|24|32|40|48|56|64|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256)?$/.test(r)?n==="number"||n==="bigint":/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/.test(r)?n==="string"||e instanceof Uint8Array:/[a-z]+[1-9]{0,3}(\[[0-9]{0,}\])+$/.test(r)?Array.isArray(e)&&e.every(o=>ra(o,{...t,type:r.replace(/(\[[0-9]{0,}\])$/,"")})):!1}}function Yu(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 Yu(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")?yt(n[r],{strict:!1}):i.includes("address")&&i.includes("bytes")?yt(n[r],{strict:!1}):!1)return i}}const Xu="/docs/contract/encodeEventTopics";function ao(e){var a;const{abi:t,eventName:n,args:r}=e;let o=t[0];if(n){const c=Yn({abi:t,name:n});if(!c)throw new Au(n,{docsPath:Xu});o=c}if(o.type!=="event")throw new Au(void 0,{docsPath:Xu});const s=kt(o),i=Es(s);let l=[];if(r&&"inputs"in o){const c=(a=o.inputs)==null?void 0:a.filter(f=>"indexed"in f&&f.indexed),u=Array.isArray(r)?r:Object.values(r).length>0?(c==null?void 0:c.map(f=>r[f.name]))??[]:[];u.length>0&&(l=(c==null?void 0:c.map((f,p)=>Array.isArray(u[p])?u[p].map((d,h)=>Ju({param:f,value:u[p][h]})):typeof u[p]<"u"&&u[p]!==null?Ju({param:f,value:u[p]}):null))??[])}return[i,...l]}function Ju({param:e,value:t}){if(e.type==="string"||e.type==="bytes")return je(vr(t));if(e.type==="tuple"||e.type.match(/^(.*)\[(\d+)?\]$/))throw new m1(e.type);return In([e],[t])}function Ts(e,{method:t}){var r,o;const n={};return e.transport.type==="fallback"&&((o=(r=e.transport).onResponse)==null||o.call(r,({method:s,response:i,status:l,transport:a})=>{l==="success"&&t===s&&(n[i]=a.request)})),s=>n[s]||e.request}async function Qu(e,t){const{address:n,abi:r,args:o,eventName:s,fromBlock:i,strict:l,toBlock:a}=t,c=Ts(e,{method:"eth_newFilter"}),u=s?ao({abi:r,args:o,eventName:s}):void 0,f=await e.request({method:"eth_newFilter",params:[{address:n,fromBlock:typeof i=="bigint"?re(i):i,toBlock:typeof a=="bigint"?re(a):a,topics:u}]});return{abi:r,args:o,eventName:s,id:f,request:c(f),strict:!!l,type:"event"}}function ft(e){return typeof e=="string"?{address:e,type:"json-rpc"}:e}const ef="/docs/contract/encodeFunctionData";function dg(e){const{abi:t,args:n,functionName:r}=e;let o=t[0];if(r){const s=Yn({abi:t,args:n,name:r});if(!s)throw new gr(r,{docsPath:ef});o=s}if(o.type!=="function")throw new gr(void 0,{docsPath:ef});return{abi:[o],functionName:io(kt(o))}}function vt(e){const{args:t}=e,{abi:n,functionName:r}=(()=>{var l;return e.abi.length===1&&((l=e.functionName)!=null&&l.startsWith("0x"))?e:dg(e)})(),o=n[0],s=r,i="inputs"in o&&o.inputs?In(o.inputs,t??[]):void 0;return Sr([s,i??"0x"])}const pg={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."},tf={inputs:[{name:"message",type:"string"}],name:"Error",type:"error"},hg={inputs:[{name:"reason",type:"uint256"}],name:"Panic",type:"error"};let nf=class extends V{constructor({offset:t}){super(`Offset \`${t}\` cannot be negative.`,{name:"NegativeOffsetError"})}},rf=class extends V{constructor({length:t,position:n}){super(`Position \`${n}\` is out of bounds (\`0 < position < ${t}\`).`,{name:"PositionOutOfBoundsError"})}},mg=class extends V{constructor({count:t,limit:n}){super(`Recursive read limit of \`${n}\` exceeded (recursive read count: \`${t}\`).`,{name:"RecursiveReadLimitExceededError"})}};const bg={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 mg({count:this.recursiveReadCount+1,limit:this.recursiveReadLimit})},assertPosition(e){if(e<0||e>this.bytes.length-1)throw new rf({length:this.bytes.length,position:e})},decrementPosition(e){if(e<0)throw new nf({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 nf({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 oa(e,{recursiveReadLimit:t=8192}={}){const n=Object.create(bg);return n.bytes=e,n.dataView=new DataView(e.buffer??e,e.byteOffset,e.byteLength),n.positionReadCount=new Map,n.recursiveReadLimit=t,n}function gg(e,t={}){typeof t.size<"u"&&Dt(e,{size:t.size});const n=ke(e,t);return Gt(n,t)}function yg(e,t={}){let n=e;if(typeof t.size<"u"&&(Dt(n,{size:t.size}),n=Gn(n)),n.length>1||n[0]>1)throw new g1(n);return!!n[0]}function fn(e,t={}){typeof t.size<"u"&&Dt(e,{size:t.size});const n=ke(e,t);return ln(n,t)}function vg(e,t={}){let n=e;return typeof t.size<"u"&&(Dt(n,{size:t.size}),n=Gn(n,{dir:"right"})),new TextDecoder().decode(n)}function lo(e,t){const n=typeof t=="string"?qt(t):t,r=oa(n);if(Te(n)===0&&e.length>0)throw new no;if(Te(t)&&Te(t)<32)throw new Su({data:typeof t=="string"?t:ke(t),params:e,size:Te(t)});let o=0;const s=[];for(let i=0;i<e.length;++i){const l=e[i];r.setPosition(o);const[a,c]=Pr(r,l,{staticPosition:0});o+=c,s.push(a)}return s}function Pr(e,t,{staticPosition:n}){const r=na(t.type);if(r){const[o,s]=r;return xg(e,{...t,type:s},{length:o,staticPosition:n})}if(t.type==="tuple")return Tg(e,t,{staticPosition:n});if(t.type==="address")return wg(e);if(t.type==="bool")return Eg(e);if(t.type.startsWith("bytes"))return Sg(e,t,{staticPosition:n});if(t.type.startsWith("uint")||t.type.startsWith("int"))return Pg(e,t);if(t.type==="string")return Ag(e,{staticPosition:n});throw new p1(t.type,{docsPath:"/docs/contract/decodeAbiParameters"})}const of=32,sa=32;function wg(e){const t=e.readBytes(32);return[Ps(ke(Ku(t,-20))),32]}function xg(e,t,{length:n,staticPosition:r}){if(!n){const i=fn(e.readBytes(sa)),l=r+i,a=l+of;e.setPosition(l);const c=fn(e.readBytes(of)),u=co(t);let f=0;const p=[];for(let d=0;d<c;++d){e.setPosition(a+(u?d*32:f));const[h,b]=Pr(e,t,{staticPosition:a});f+=b,p.push(h)}return e.setPosition(r+32),[p,32]}if(co(t)){const i=fn(e.readBytes(sa)),l=r+i,a=[];for(let c=0;c<n;++c){e.setPosition(l+c*32);const[u]=Pr(e,t,{staticPosition:l});a.push(u)}return e.setPosition(r+32),[a,32]}let o=0;const s=[];for(let i=0;i<n;++i){const[l,a]=Pr(e,t,{staticPosition:r+o});o+=a,s.push(l)}return[s,o]}function Eg(e){return[yg(e.readBytes(32),{size:32}),32]}function Sg(e,t,{staticPosition:n}){const[r,o]=t.type.split("bytes");if(!o){const i=fn(e.readBytes(32));e.setPosition(n+i);const l=fn(e.readBytes(32));if(l===0)return e.setPosition(n+32),["0x",32];const a=e.readBytes(l);return e.setPosition(n+32),[ke(a),32]}return[ke(e.readBytes(Number.parseInt(o,10),32)),32]}function Pg(e,t){const n=t.type.startsWith("int"),r=Number.parseInt(t.type.split("int")[1]||"256",10),o=e.readBytes(32);return[r>48?gg(o,{signed:n}):fn(o,{signed:n}),32]}function Tg(e,t,{staticPosition:n}){const r=t.components.length===0||t.components.some(({name:i})=>!i),o=r?[]:{};let s=0;if(co(t)){const i=fn(e.readBytes(sa)),l=n+i;for(let a=0;a<t.components.length;++a){const c=t.components[a];e.setPosition(l+s);const[u,f]=Pr(e,c,{staticPosition:l});s+=f,o[r?a:c==null?void 0:c.name]=u}return e.setPosition(n+32),[o,32]}for(let i=0;i<t.components.length;++i){const l=t.components[i],[a,c]=Pr(e,l,{staticPosition:n});o[r?i:l==null?void 0:l.name]=a,s+=c}return[o,s]}function Ag(e,{staticPosition:t}){const n=fn(e.readBytes(32)),r=t+n;e.setPosition(r);const o=fn(e.readBytes(32));if(o===0)return e.setPosition(t+32),["",32];const s=e.readBytes(o,32),i=vg(Gn(s));return e.setPosition(t+32),[i,32]}function co(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(co);const n=na(e.type);return!!(n&&co({...e,type:n[1]}))}function sf(e){const{abi:t,data:n}=e,r=Zn(n,0,4);if(r==="0x")throw new no;const s=[...t||[],tf,hg].find(i=>i.type==="error"&&r===io(kt(i)));if(!s)throw new Tu(r,{docsPath:"/docs/contract/decodeErrorResult"});return{abiItem:s,args:"inputs"in s&&s.inputs&&s.inputs.length>0?lo(s.inputs,Zn(n,4)):void 0,errorName:s.name}}const Me=(e,t,n)=>JSON.stringify(e,(r,o)=>typeof o=="bigint"?o.toString():o,n);function af({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"?Me(t[s]):t[s]}`).join(", ")})`}const Ng={gwei:9,wei:18},Cg={ether:-9,wei:9};function ia(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 aa(e,t="wei"){return ia(e,Ng[t])}function Xe(e,t="wei"){return ia(e,Cg[t])}class Og extends V{constructor({address:t}){super(`State for account "${t}" is set multiple times.`,{name:"AccountStateConflictError"})}}class Ig extends V{constructor(){super("state and stateDiff are set on the same account.",{name:"StateAssignmentConflictError"})}}function lf(e){return e.reduce((t,{slot:n,value:r})=>`${t} ${n}: ${r}
71
+ `),{name:"InvalidDefinitionTypeError"})}}class m1 extends V{constructor(t){super(`Filter type "${t}" is not supported.`,{name:"FilterTypeNotSupportedError"})}}let Ou=class extends V{constructor({offset:t,position:n,size:r}){super(`Slice ${n==="start"?"starting":"ending"} at offset "${t}" is out-of-bounds (size: ${r}).`,{name:"SliceOffsetOutOfBoundsError"})}},Iu=class extends V{constructor({size:t,targetSize:n,type:r}){super(`${r.charAt(0).toUpperCase()}${r.slice(1).toLowerCase()} size (${t}) exceeds padding size (${n}).`,{name:"SizeExceedsPaddingSizeError"})}};class $u extends V{constructor({size:t,targetSize:n,type:r}){super(`${r.charAt(0).toUpperCase()}${r.slice(1).toLowerCase()} is expected to be ${n} ${r} long, but is ${t} ${r} long.`,{name:"InvalidBytesLengthError"})}}function yr(e,{dir:t,size:n=32}={}){return typeof e=="string"?An(e,{dir:t,size:n}):b1(e,{dir:t,size:n})}function An(e,{dir:t,size:n=32}={}){if(n===null)return e;const r=e.replace("0x","");if(r.length>n*2)throw new Iu({size:Math.ceil(r.length/2),targetSize:n,type:"hex"});return`0x${r[t==="right"?"padEnd":"padStart"](n*2,"0")}`}function b1(e,{dir:t,size:n=32}={}){if(n===null)return e;if(e.length>n)throw new Iu({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 Ki=class extends V{constructor({max:t,min:n,signed:r,size:o,value:s}){super(`Number "${s}" is not in safe ${o?`${o*8}-bit ${r?"signed":"unsigned"} `:""}integer range ${t?`(${n} to ${t})`:`(above ${n})`}`,{name:"IntegerOutOfRangeError"})}},g1=class extends V{constructor(t){super(`Bytes value "${t}" is not a valid boolean. The bytes array must contain a single byte of either a 0 or 1 value.`,{name:"InvalidBytesBooleanError"})}};class y1 extends V{constructor(t){super(`Hex value "${t}" is not a valid boolean. The hex value must be "0x0" (false) or "0x1" (true).`,{name:"InvalidHexBooleanError"})}}let v1=class extends V{constructor({givenSize:t,maxSize:n}){super(`Size cannot exceed ${n} bytes. Given size: ${t} bytes.`,{name:"SizeOverflowError"})}};function Gn(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 Dt(e,{size:t}){if(Te(e)>t)throw new v1({givenSize:Te(e),maxSize:t})}function Gt(e,t={}){const{signed:n}=t;t.size&&Dt(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 w1(e,t={}){let n=e;if(t.size&&(Dt(n,{size:t.size}),n=Gn(n)),Gn(n)==="0x00")return!1;if(Gn(n)==="0x01")return!0;throw new y1(n)}function ln(e,t={}){const n=Gt(e,t),r=Number(n);if(!Number.isSafeInteger(r))throw new Ki({max:`${Number.MAX_SAFE_INTEGER}`,min:`${Number.MIN_SAFE_INTEGER}`,signed:t.signed,size:t.size,value:`${n}n`});return r}const x1=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function Nn(e,t={}){return typeof e=="number"||typeof e=="bigint"?re(e,t):typeof e=="string"?oo(e,t):typeof e=="boolean"?ku(e,t):ke(e,t)}function ku(e,t={}){const n=`0x${Number(e)}`;return typeof t.size=="number"?(Dt(n,{size:t.size}),yr(n,{size:t.size})):n}function ke(e,t={}){let n="";for(let o=0;o<e.length;o++)n+=x1[e[o]];const r=`0x${n}`;return typeof t.size=="number"?(Dt(r,{size:t.size}),yr(r,{dir:"right",size:t.size})):r}function re(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 Ki({max:s?`${s}${a}`:void 0,min:`${i}${a}`,signed:n,size:r,value:`${e}${a}`})}const l=`0x${(n&&o<0?(1n<<BigInt(r*8))+BigInt(o):o).toString(16)}`;return r?yr(l,{size:r}):l}const E1=new TextEncoder;function oo(e,t={}){const n=E1.encode(e);return ke(n,t)}const S1=new TextEncoder;function vr(e,t={}){return typeof e=="number"||typeof e=="bigint"?T1(e,t):typeof e=="boolean"?P1(e,t):Mt(e)?qt(e,t):qn(e,t)}function P1(e,t={}){const n=new Uint8Array(1);return n[0]=Number(e),typeof t.size=="number"?(Dt(n,{size:t.size}),yr(n,{size:t.size})):n}const cn={zero:48,nine:57,A:65,F:70,a:97,f:102};function Mu(e){if(e>=cn.zero&&e<=cn.nine)return e-cn.zero;if(e>=cn.A&&e<=cn.F)return e-(cn.A-10);if(e>=cn.a&&e<=cn.f)return e-(cn.a-10)}function qt(e,t={}){let n=e;t.size&&(Dt(n,{size:t.size}),n=yr(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,l=0;i<o;i++){const a=Mu(r.charCodeAt(l++)),c=Mu(r.charCodeAt(l++));if(a===void 0||c===void 0)throw new V(`Invalid byte sequence ("${r[l-2]}${r[l-1]}" in "${r}").`);s[i]=a*16+c}return s}function T1(e,t){const n=re(e,t);return qt(n)}function qn(e,t={}){const n=S1.encode(e);return typeof t.size=="number"?(Dt(n,{size:t.size}),yr(n,{dir:"right",size:t.size})):n}const ws=BigInt(2**32-1),Du=BigInt(32);function A1(e,t=!1){return t?{h:Number(e&ws),l:Number(e>>Du&ws)}:{h:Number(e>>Du&ws)|0,l:Number(e&ws)|0}}function N1(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}=A1(e[s],t);[r[s],o[s]]=[i,l]}return[r,o]}const C1=(e,t,n)=>e<<n|t>>>32-n,O1=(e,t,n)=>t<<n|e>>>32-n,I1=(e,t,n)=>t<<n-32|e>>>64-n,$1=(e,t,n)=>e<<n-32|t>>>64-n,wr=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0;/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */function k1(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array"}function so(e){if(!Number.isSafeInteger(e)||e<0)throw new Error("positive integer expected, got "+e)}function Kn(e,...t){if(!k1(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 M1(e){if(typeof e!="function"||typeof e.create!="function")throw new Error("Hash should be wrapped by utils.createHasher");so(e.outputLen),so(e.blockLen)}function xr(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 Bu(e,t){Kn(e);const n=t.outputLen;if(e.length<n)throw new Error("digestInto() expects output buffer of length at least "+n)}function D1(e){return new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4))}function Er(...e){for(let t=0;t<e.length;t++)e[t].fill(0)}function Zi(e){return new DataView(e.buffer,e.byteOffset,e.byteLength)}function Kt(e,t){return e<<32-t|e>>>t}const B1=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;function L1(e){return e<<24&4278190080|e<<8&16711680|e>>>8&65280|e>>>24&255}function F1(e){for(let t=0;t<e.length;t++)e[t]=L1(e[t]);return e}const Lu=B1?e=>e:F1;function R1(e){if(typeof e!="string")throw new Error("string expected");return new Uint8Array(new TextEncoder().encode(e))}function xs(e){return typeof e=="string"&&(e=R1(e)),Kn(e),e}function j1(...e){let t=0;for(let r=0;r<e.length;r++){const o=e[r];Kn(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 Yi{}function Fu(e){const t=r=>e().update(xs(r)).digest(),n=e();return t.outputLen=n.outputLen,t.blockLen=n.blockLen,t.create=()=>e(),t}function z1(e=32){if(wr&&typeof wr.getRandomValues=="function")return wr.getRandomValues(new Uint8Array(e));if(wr&&typeof wr.randomBytes=="function")return Uint8Array.from(wr.randomBytes(e));throw new Error("crypto.getRandomValues must be defined")}const U1=BigInt(0),io=BigInt(1),W1=BigInt(2),_1=BigInt(7),V1=BigInt(256),H1=BigInt(113),Ru=[],ju=[],zu=[];for(let e=0,t=io,n=1,r=0;e<24;e++){[n,r]=[r,(2*n+3*r)%5],Ru.push(2*(5*r+n)),ju.push((e+1)*(e+2)/2%64);let o=U1;for(let s=0;s<7;s++)t=(t<<io^(t>>_1)*H1)%V1,t&W1&&(o^=io<<(io<<BigInt(s))-io);zu.push(o)}const Uu=N1(zu,!0),G1=Uu[0],q1=Uu[1],Wu=(e,t,n)=>n>32?I1(e,t,n):C1(e,t,n),_u=(e,t,n)=>n>32?$1(e,t,n):O1(e,t,n);function K1(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 l=(i+8)%10,a=(i+2)%10,c=n[a],u=n[a+1],f=Wu(c,u,1)^n[l],p=_u(c,u,1)^n[l+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 l=ju[i],a=Wu(o,s,l),c=_u(o,s,l),u=Ru[i];o=e[u],s=e[u+1],e[u]=a,e[u+1]=c}for(let i=0;i<50;i+=10){for(let l=0;l<10;l++)n[l]=e[i+l];for(let l=0;l<10;l++)e[i+l]^=~n[(l+2)%10]&n[(l+4)%10]}e[0]^=G1[r],e[1]^=q1[r]}Er(n)}class Xi extends Yi{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,so(r),!(0<t&&t<200))throw new Error("only keccak-f1600 function is supported");this.state=new Uint8Array(200),this.state32=D1(this.state)}clone(){return this._cloneInto()}keccak(){Lu(this.state32),K1(this.state32,this.rounds),Lu(this.state32),this.posOut=0,this.pos=0}update(t){xr(this),t=xs(t),Kn(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 l=0;l<i;l++)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){xr(this,!1),Kn(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 so(t),this.xofInto(new Uint8Array(t))}digestInto(t){if(Bu(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,Er(this.state)}_cloneInto(t){const{blockLen:n,suffix:r,outputLen:o,rounds:s,enableXOF:i}=this;return t||(t=new Xi(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 Z1=(e,t,n)=>Fu(()=>new Xi(t,e,n)),Vu=Z1(1,136,256/8);function je(e,t){const n=t||"hex",r=Vu(Mt(e,{strict:!1})?vr(e):e);return n==="bytes"?r:Nn(r)}const Y1=e=>je(vr(e));function X1(e){return Y1(e)}function J1(e){let t=!0,n="",r=0,o="",s=!1;for(let i=0;i<e.length;i++){const l=e[i];if(["(",")",","].includes(l)&&(t=!0),l==="("&&r++,l===")"&&r--,!!t){if(r===0){if(l===" "&&["event","function",""].includes(o))o="";else if(o+=l,l===")"){s=!0;break}continue}if(l===" "){e[i-1]!==","&&n!==","&&n!==",("&&(n="",t=!1);continue}o+=l,n+=l}}if(!s)throw new V("Unable to normalize signature.");return o}const Q1=e=>{const t=typeof e=="string"?e:bs(e);return J1(t)};function Hu(e){return X1(Q1(e))}const Es=Hu;let Cn=class extends V{constructor({address:t}){super(`Address "${t}" is invalid.`,{metaMessages:["- Address must be a hex value of 20 bytes (40 hex characters).","- Address must match its checksum counterpart."],name:"InvalidAddressError"})}},Ss=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 Ji=new Ss(8192);function Ps(e,t){if(Ji.has(`${e}.${t}`))return Ji.get(`${e}.${t}`);const n=e.substring(2).toLowerCase(),r=je(qn(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 Ji.set(`${e}.${t}`,s),s}function un(e,t){if(!yt(e,{strict:!1}))throw new Cn({address:e});return Ps(e,t)}const eg=/^0x[a-fA-F0-9]{40}$/,Qi=new Ss(8192);function yt(e,t){const{strict:n=!0}=t??{},r=`${e}.${n}`;if(Qi.has(r))return Qi.get(r);const o=eg.test(e)?e.toLowerCase()===e?!0:n?Ps(e)===e:!0:!1;return Qi.set(r,o),o}function Bt(e){return typeof e[0]=="string"?Sr(e):tg(e)}function tg(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 Sr(e){return`0x${e.reduce((t,n)=>t+n.replace("0x",""),"")}`}function Zn(e,t,n,{strict:r}={}){return Mt(e,{strict:!1})?ng(e,t,n,{strict:r}):Ku(e,t,n,{strict:r})}function Gu(e,t){if(typeof t=="number"&&t>0&&t>Te(e)-1)throw new Ou({offset:t,position:"start",size:Te(e)})}function qu(e,t,n){if(typeof t=="number"&&typeof n=="number"&&Te(e)!==n-t)throw new Ou({offset:n,position:"end",size:Te(e)})}function Ku(e,t,n,{strict:r}={}){Gu(e,t);const o=e.slice(t,n);return r&&qu(o,t,n),o}function ng(e,t,n,{strict:r}={}){Gu(e,t);const o=`0x${e.replace("0x","").slice((t??0)*2,(n??e.length)*2)}`;return r&&qu(o,t,n),o}const rg=/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/,Zu=/^(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 On(e,t){if(e.length!==t.length)throw new s1({expectedLength:e.length,givenLength:t.length});const n=og({params:e,values:t}),r=ta(n);return r.length===0?"0x":r}function og({params:e,values:t}){const n=[];for(let r=0;r<e.length;r++)n.push(ea({param:e[r],value:t[r]}));return n}function ea({param:e,value:t}){const n=na(e.type);if(n){const[r,o]=n;return ig(t,{length:r,param:{...e,type:o}})}if(e.type==="tuple")return fg(t,{param:e});if(e.type==="address")return sg(t);if(e.type==="bool")return lg(t);if(e.type.startsWith("uint")||e.type.startsWith("int")){const r=e.type.startsWith("int"),[,,o="256"]=Zu.exec(e.type)??[];return cg(t,{signed:r,size:Number(o)})}if(e.type.startsWith("bytes"))return ag(t,{param:e});if(e.type==="string")return ug(t);throw new d1(e.type,{docsPath:"/docs/contract/encodeAbiParameters"})}function ta(e){let t=0;for(let s=0;s<e.length;s++){const{dynamic:i,encoded:l}=e[s];i?t+=32:t+=Te(l)}const n=[],r=[];let o=0;for(let s=0;s<e.length;s++){const{dynamic:i,encoded:l}=e[s];i?(n.push(re(t+o,{size:32})),r.push(l),o+=Te(l)):n.push(l)}return Bt([...n,...r])}function sg(e){if(!yt(e))throw new Cn({address:e});return{dynamic:!1,encoded:An(e.toLowerCase())}}function ig(e,{length:t,param:n}){const r=t===null;if(!Array.isArray(e))throw new Cu(e);if(!r&&e.length!==t)throw new r1({expectedLength:t,givenLength:e.length,type:`${n.type}[${t}]`});let o=!1;const s=[];for(let i=0;i<e.length;i++){const l=ea({param:n,value:e[i]});l.dynamic&&(o=!0),s.push(l)}if(r||o){const i=ta(s);if(r){const l=re(s.length,{size:32});return{dynamic:!0,encoded:s.length>0?Bt([l,i]):l}}if(o)return{dynamic:!0,encoded:i}}return{dynamic:!1,encoded:Bt(s.map(({encoded:i})=>i))}}function ag(e,{param:t}){const[,n]=t.type.split("bytes"),r=Te(e);if(!n){let o=e;return r%32!==0&&(o=An(o,{dir:"right",size:Math.ceil((e.length-2)/2/32)*32})),{dynamic:!0,encoded:Bt([An(re(r,{size:32})),o])}}if(r!==Number.parseInt(n,10))throw new o1({expectedSize:Number.parseInt(n,10),value:e});return{dynamic:!1,encoded:An(e,{dir:"right"})}}function lg(e){if(typeof e!="boolean")throw new V(`Invalid boolean value: "${e}" (type: ${typeof e}). Expected: \`true\` or \`false\`.`);return{dynamic:!1,encoded:An(ku(e))}}function cg(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 Ki({max:r.toString(),min:o.toString(),signed:t,size:n/8,value:e.toString()})}return{dynamic:!1,encoded:re(e,{size:32,signed:t})}}function ug(e){const t=oo(e),n=Math.ceil(Te(t)/32),r=[];for(let o=0;o<n;o++)r.push(An(Zn(t,o*32,(o+1)*32),{dir:"right"}));return{dynamic:!0,encoded:Bt([An(re(Te(t),{size:32})),...r])}}function fg(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,l=ea({param:s,value:e[i]});r.push(l),l.dynamic&&(n=!0)}return{dynamic:n,encoded:n?ta(r):Bt(r.map(({encoded:o})=>o))}}function na(e){const t=e.match(/^(.*)\[(\d+)?\]$/);return t?[t[2]?Number(t[2]):null,t[1]]:void 0}const ao=e=>Zn(Hu(e),0,4);function Yn(e){const{abi:t,args:n=[],name:r}=e,o=Mt(r,{strict:!1}),s=t.filter(l=>o?l.type==="function"?ao(l)===r:l.type==="event"?Es(l)===r:!1:"name"in l&&l.name===r);if(s.length===0)return;if(s.length===1)return s[0];let i;for(const l of s){if(!("inputs"in l))continue;if(!n||n.length===0){if(!l.inputs||l.inputs.length===0)return l;continue}if(!l.inputs||l.inputs.length===0||l.inputs.length!==n.length)continue;if(n.every((c,u)=>{const f="inputs"in l&&l.inputs[u];return f?ra(c,f):!1})){if(i&&"inputs"in i&&i.inputs){const c=Yu(l.inputs,i.inputs,n);if(c)throw new u1({abiItem:l,type:c[0]},{abiItem:i,type:c[1]})}i=l}}return i||s[0]}function ra(e,t){const n=typeof e,r=t.type;switch(r){case"address":return yt(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)=>n==="object"&&ra(Object.values(e)[s],o)):/^u?int(8|16|24|32|40|48|56|64|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256)?$/.test(r)?n==="number"||n==="bigint":/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/.test(r)?n==="string"||e instanceof Uint8Array:/[a-z]+[1-9]{0,3}(\[[0-9]{0,}\])+$/.test(r)?Array.isArray(e)&&e.every(o=>ra(o,{...t,type:r.replace(/(\[[0-9]{0,}\])$/,"")})):!1}}function Yu(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 Yu(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")?yt(n[r],{strict:!1}):i.includes("address")&&i.includes("bytes")?yt(n[r],{strict:!1}):!1)return i}}const Xu="/docs/contract/encodeEventTopics";function lo(e){var a;const{abi:t,eventName:n,args:r}=e;let o=t[0];if(n){const c=Yn({abi:t,name:n});if(!c)throw new Au(n,{docsPath:Xu});o=c}if(o.type!=="event")throw new Au(void 0,{docsPath:Xu});const s=kt(o),i=Es(s);let l=[];if(r&&"inputs"in o){const c=(a=o.inputs)==null?void 0:a.filter(f=>"indexed"in f&&f.indexed),u=Array.isArray(r)?r:Object.values(r).length>0?(c==null?void 0:c.map(f=>r[f.name]))??[]:[];u.length>0&&(l=(c==null?void 0:c.map((f,p)=>Array.isArray(u[p])?u[p].map((d,h)=>Ju({param:f,value:u[p][h]})):typeof u[p]<"u"&&u[p]!==null?Ju({param:f,value:u[p]}):null))??[])}return[i,...l]}function Ju({param:e,value:t}){if(e.type==="string"||e.type==="bytes")return je(vr(t));if(e.type==="tuple"||e.type.match(/^(.*)\[(\d+)?\]$/))throw new m1(e.type);return On([e],[t])}function Ts(e,{method:t}){var r,o;const n={};return e.transport.type==="fallback"&&((o=(r=e.transport).onResponse)==null||o.call(r,({method:s,response:i,status:l,transport:a})=>{l==="success"&&t===s&&(n[i]=a.request)})),s=>n[s]||e.request}async function Qu(e,t){const{address:n,abi:r,args:o,eventName:s,fromBlock:i,strict:l,toBlock:a}=t,c=Ts(e,{method:"eth_newFilter"}),u=s?lo({abi:r,args:o,eventName:s}):void 0,f=await e.request({method:"eth_newFilter",params:[{address:n,fromBlock:typeof i=="bigint"?re(i):i,toBlock:typeof a=="bigint"?re(a):a,topics:u}]});return{abi:r,args:o,eventName:s,id:f,request:c(f),strict:!!l,type:"event"}}function ft(e){return typeof e=="string"?{address:e,type:"json-rpc"}:e}const ef="/docs/contract/encodeFunctionData";function dg(e){const{abi:t,args:n,functionName:r}=e;let o=t[0];if(r){const s=Yn({abi:t,args:n,name:r});if(!s)throw new gr(r,{docsPath:ef});o=s}if(o.type!=="function")throw new gr(void 0,{docsPath:ef});return{abi:[o],functionName:ao(kt(o))}}function vt(e){const{args:t}=e,{abi:n,functionName:r}=(()=>{var l;return e.abi.length===1&&((l=e.functionName)!=null&&l.startsWith("0x"))?e:dg(e)})(),o=n[0],s=r,i="inputs"in o&&o.inputs?On(o.inputs,t??[]):void 0;return Sr([s,i??"0x"])}const pg={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."},tf={inputs:[{name:"message",type:"string"}],name:"Error",type:"error"},hg={inputs:[{name:"reason",type:"uint256"}],name:"Panic",type:"error"};let nf=class extends V{constructor({offset:t}){super(`Offset \`${t}\` cannot be negative.`,{name:"NegativeOffsetError"})}},rf=class extends V{constructor({length:t,position:n}){super(`Position \`${n}\` is out of bounds (\`0 < position < ${t}\`).`,{name:"PositionOutOfBoundsError"})}},mg=class extends V{constructor({count:t,limit:n}){super(`Recursive read limit of \`${n}\` exceeded (recursive read count: \`${t}\`).`,{name:"RecursiveReadLimitExceededError"})}};const bg={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 mg({count:this.recursiveReadCount+1,limit:this.recursiveReadLimit})},assertPosition(e){if(e<0||e>this.bytes.length-1)throw new rf({length:this.bytes.length,position:e})},decrementPosition(e){if(e<0)throw new nf({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 nf({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 oa(e,{recursiveReadLimit:t=8192}={}){const n=Object.create(bg);return n.bytes=e,n.dataView=new DataView(e.buffer??e,e.byteOffset,e.byteLength),n.positionReadCount=new Map,n.recursiveReadLimit=t,n}function gg(e,t={}){typeof t.size<"u"&&Dt(e,{size:t.size});const n=ke(e,t);return Gt(n,t)}function yg(e,t={}){let n=e;if(typeof t.size<"u"&&(Dt(n,{size:t.size}),n=Gn(n)),n.length>1||n[0]>1)throw new g1(n);return!!n[0]}function fn(e,t={}){typeof t.size<"u"&&Dt(e,{size:t.size});const n=ke(e,t);return ln(n,t)}function vg(e,t={}){let n=e;return typeof t.size<"u"&&(Dt(n,{size:t.size}),n=Gn(n,{dir:"right"})),new TextDecoder().decode(n)}function co(e,t){const n=typeof t=="string"?qt(t):t,r=oa(n);if(Te(n)===0&&e.length>0)throw new ro;if(Te(t)&&Te(t)<32)throw new Su({data:typeof t=="string"?t:ke(t),params:e,size:Te(t)});let o=0;const s=[];for(let i=0;i<e.length;++i){const l=e[i];r.setPosition(o);const[a,c]=Pr(r,l,{staticPosition:0});o+=c,s.push(a)}return s}function Pr(e,t,{staticPosition:n}){const r=na(t.type);if(r){const[o,s]=r;return xg(e,{...t,type:s},{length:o,staticPosition:n})}if(t.type==="tuple")return Tg(e,t,{staticPosition:n});if(t.type==="address")return wg(e);if(t.type==="bool")return Eg(e);if(t.type.startsWith("bytes"))return Sg(e,t,{staticPosition:n});if(t.type.startsWith("uint")||t.type.startsWith("int"))return Pg(e,t);if(t.type==="string")return Ag(e,{staticPosition:n});throw new p1(t.type,{docsPath:"/docs/contract/decodeAbiParameters"})}const of=32,sa=32;function wg(e){const t=e.readBytes(32);return[Ps(ke(Ku(t,-20))),32]}function xg(e,t,{length:n,staticPosition:r}){if(!n){const i=fn(e.readBytes(sa)),l=r+i,a=l+of;e.setPosition(l);const c=fn(e.readBytes(of)),u=uo(t);let f=0;const p=[];for(let d=0;d<c;++d){e.setPosition(a+(u?d*32:f));const[h,b]=Pr(e,t,{staticPosition:a});f+=b,p.push(h)}return e.setPosition(r+32),[p,32]}if(uo(t)){const i=fn(e.readBytes(sa)),l=r+i,a=[];for(let c=0;c<n;++c){e.setPosition(l+c*32);const[u]=Pr(e,t,{staticPosition:l});a.push(u)}return e.setPosition(r+32),[a,32]}let o=0;const s=[];for(let i=0;i<n;++i){const[l,a]=Pr(e,t,{staticPosition:r+o});o+=a,s.push(l)}return[s,o]}function Eg(e){return[yg(e.readBytes(32),{size:32}),32]}function Sg(e,t,{staticPosition:n}){const[r,o]=t.type.split("bytes");if(!o){const i=fn(e.readBytes(32));e.setPosition(n+i);const l=fn(e.readBytes(32));if(l===0)return e.setPosition(n+32),["0x",32];const a=e.readBytes(l);return e.setPosition(n+32),[ke(a),32]}return[ke(e.readBytes(Number.parseInt(o,10),32)),32]}function Pg(e,t){const n=t.type.startsWith("int"),r=Number.parseInt(t.type.split("int")[1]||"256",10),o=e.readBytes(32);return[r>48?gg(o,{signed:n}):fn(o,{signed:n}),32]}function Tg(e,t,{staticPosition:n}){const r=t.components.length===0||t.components.some(({name:i})=>!i),o=r?[]:{};let s=0;if(uo(t)){const i=fn(e.readBytes(sa)),l=n+i;for(let a=0;a<t.components.length;++a){const c=t.components[a];e.setPosition(l+s);const[u,f]=Pr(e,c,{staticPosition:l});s+=f,o[r?a:c==null?void 0:c.name]=u}return e.setPosition(n+32),[o,32]}for(let i=0;i<t.components.length;++i){const l=t.components[i],[a,c]=Pr(e,l,{staticPosition:n});o[r?i:l==null?void 0:l.name]=a,s+=c}return[o,s]}function Ag(e,{staticPosition:t}){const n=fn(e.readBytes(32)),r=t+n;e.setPosition(r);const o=fn(e.readBytes(32));if(o===0)return e.setPosition(t+32),["",32];const s=e.readBytes(o,32),i=vg(Gn(s));return e.setPosition(t+32),[i,32]}function uo(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(uo);const n=na(e.type);return!!(n&&uo({...e,type:n[1]}))}function sf(e){const{abi:t,data:n}=e,r=Zn(n,0,4);if(r==="0x")throw new ro;const s=[...t||[],tf,hg].find(i=>i.type==="error"&&r===ao(kt(i)));if(!s)throw new Tu(r,{docsPath:"/docs/contract/decodeErrorResult"});return{abiItem:s,args:"inputs"in s&&s.inputs&&s.inputs.length>0?co(s.inputs,Zn(n,4)):void 0,errorName:s.name}}const Me=(e,t,n)=>JSON.stringify(e,(r,o)=>typeof o=="bigint"?o.toString():o,n);function af({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"?Me(t[s]):t[s]}`).join(", ")})`}const Ng={gwei:9,wei:18},Cg={ether:-9,wei:9};function ia(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 aa(e,t="wei"){return ia(e,Ng[t])}function Xe(e,t="wei"){return ia(e,Cg[t])}class Og extends V{constructor({address:t}){super(`State for account "${t}" is set multiple times.`,{name:"AccountStateConflictError"})}}class Ig extends V{constructor(){super("state and stateDiff are set on the same account.",{name:"StateAssignmentConflictError"})}}function lf(e){return e.reduce((t,{slot:n,value:r})=>`${t} ${n}: ${r}
72
72
  `,"")}function $g(e){return e.reduce((t,{address:n,...r})=>{let o=`${t} ${n}:
73
73
  `;return r.nonce&&(o+=` nonce: ${r.nonce}
74
74
  `),r.balance&&(o+=` balance: ${r.balance}
@@ -76,19 +76,19 @@ React keys must be passed directly to JSX without using spread:
76
76
  `),r.state&&(o+=` state:
77
77
  `,o+=lf(r.state)),r.stateDiff&&(o+=` stateDiff:
78
78
  `,o+=lf(r.stateDiff)),o},` State Override:
79
- `).slice(0,-1)}function uo(e){const t=Object.entries(e).map(([r,o])=>o===void 0||o===!1?null:[r,o]).filter(Boolean),n=t.reduce((r,[o])=>Math.max(r,o.length),0);return t.map(([r,o])=>` ${`${r}:`.padEnd(n+1)} ${o}`).join(`
80
- `)}class kg extends V{constructor({transaction:t}){super("Cannot infer a transaction type from provided transaction.",{metaMessages:["Provided Transaction:","{",uo(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 Mg extends V{constructor(t,{account:n,docsPath:r,chain:o,data:s,gas:i,gasPrice:l,maxFeePerGas:a,maxPriorityFeePerGas:c,nonce:u,to:f,value:p}){var h;const d=uo({chain:o&&`${o==null?void 0:o.name} (id: ${o==null?void 0:o.id})`,from:n==null?void 0:n.address,to:f,value:typeof p<"u"&&`${aa(p)} ${((h=o==null?void 0:o.nativeCurrency)==null?void 0:h.symbol)||"ETH"}`,data:s,gas:i,gasPrice:typeof l<"u"&&`${Xe(l)} gwei`,maxFeePerGas:typeof a<"u"&&`${Xe(a)} gwei`,maxPriorityFeePerGas:typeof c<"u"&&`${Xe(c)} gwei`,nonce:u});super(t.shortMessage,{cause:t,docsPath:r,metaMessages:[...t.metaMessages?[...t.metaMessages," "]:[],"Request Arguments:",d].filter(Boolean),name:"TransactionExecutionError"}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.cause=t}}class cf extends V{constructor({blockHash:t,blockNumber:n,blockTag:r,hash:o,index:s}){let i="Transaction";r&&s!==void 0&&(i=`Transaction at block time "${r}" at index "${s}"`),t&&s!==void 0&&(i=`Transaction at block hash "${t}" at index "${s}"`),n&&s!==void 0&&(i=`Transaction at block number "${n}" at index "${s}"`),o&&(i=`Transaction with hash "${o}"`),super(`${i} could not be found.`,{name:"TransactionNotFoundError"})}}class uf extends V{constructor({hash:t}){super(`Transaction receipt with hash "${t}" could not be found. The Transaction may not be processed on a block yet.`,{name:"TransactionReceiptNotFoundError"})}}class Dg extends V{constructor({receipt:t}){super(`Transaction with hash "${t.transactionHash}" reverted.`,{metaMessages:['The receipt marked the transaction as "reverted". This could mean that the function on the contract you are trying to call threw an error.'," ","You can attempt to extract the revert reason by:","- calling the `simulateContract` or `simulateCalls` Action with the `abi` and `functionName` of the contract","- using the `call` Action with raw `data`"],name:"TransactionReceiptRevertedError"}),Object.defineProperty(this,"receipt",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.receipt=t}}class Bg extends V{constructor({hash:t}){super(`Timed out while waiting for transaction with hash "${t}" to be confirmed.`,{name:"WaitForTransactionReceiptTimeoutError"})}}const Lg=e=>e,fo=e=>e;class ff extends V{constructor(t,{account:n,docsPath:r,chain:o,data:s,gas:i,gasPrice:l,maxFeePerGas:a,maxPriorityFeePerGas:c,nonce:u,to:f,value:p,stateOverride:d}){var w;const h=n?ft(n):void 0;let b=uo({from:h==null?void 0:h.address,to:f,value:typeof p<"u"&&`${aa(p)} ${((w=o==null?void 0:o.nativeCurrency)==null?void 0:w.symbol)||"ETH"}`,data:s,gas:i,gasPrice:typeof l<"u"&&`${Xe(l)} gwei`,maxFeePerGas:typeof a<"u"&&`${Xe(a)} gwei`,maxPriorityFeePerGas:typeof c<"u"&&`${Xe(c)} gwei`,nonce:u});d&&(b+=`
81
- ${$g(d)}`),super(t.shortMessage,{cause:t,docsPath:r,metaMessages:[...t.metaMessages?[...t.metaMessages," "]:[],"Raw Call Arguments:",b].filter(Boolean),name:"CallExecutionError"}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.cause=t}}class df extends V{constructor(t,{abi:n,args:r,contractAddress:o,docsPath:s,functionName:i,sender:l}){const a=Yn({abi:n,args:r,name:i}),c=a?af({abiItem:a,args:r,includeFunctionName:!1,includeName:!1}):void 0,u=a?kt(a,{includeName:!0}):void 0,f=uo({address:o&&Lg(o),function:u,args:c&&c!=="()"&&`${[...Array((i==null?void 0:i.length)??0).keys()].map(()=>" ").join("")}${c}`,sender:l});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=l}}class la extends V{constructor({abi:t,data:n,functionName:r,message:o}){let s,i,l,a;if(n&&n!=="0x")try{i=sf({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=pg[d]}else{const d=u?kt(u,{includeName:!0}):void 0,h=u&&p?af({abiItem:u,args:p,includeFunctionName:!1,includeName:!1}):void 0;l=[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 c;s instanceof Tu&&(c=s.signature,l=[`Unable to decode signature "${c}" as it was not found on the provided ABI.`,"Make sure you are using the correct ABI and that the error exists on it.",`You can look up the decoded signature here: https://4byte.sourcify.dev/?q=${c}.`]),super(a&&a!=="execution reverted"||c?[`The contract function "${r}" reverted with the following ${c?"signature":"reason"}:`,a||c].join(`
82
- `):`The contract function "${r}" reverted.`,{cause:s,metaMessages:l,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=c}}class Fg extends V{constructor({functionName:t}){super(`The contract function "${t}" returned no data ("0x").`,{metaMessages:["This could be due to any of the following:",` - The contract does not have the function "${t}",`," - The parameters passed to the contract function may be invalid, or"," - The address is not a contract."],name:"ContractFunctionZeroDataError"})}}class Rg extends V{constructor({factory:t}){super(`Deployment for counterfactual contract call failed${t?` for factory "${t}".`:""}`,{metaMessages:["Please ensure:","- The `factory` is a valid contract deployment factory (ie. Create2 Factory, ERC-4337 Factory, etc).","- The `factoryData` is a valid encoded function call for contract deployment function on the factory."],name:"CounterfactualDeploymentFailedError"})}}class As extends V{constructor({data:t,message:n}){super(n||"",{name:"RawContractError"}),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:3}),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.data=t}}class Xn extends V{constructor({body:t,cause:n,details:r,headers:o,status:s,url:i}){super("HTTP request failed.",{cause:n,details:r,metaMessages:[s&&`Status: ${s}`,`URL: ${fo(i)}`,t&&`Request body: ${Me(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 ca extends V{constructor({body:t,error:n,url:r}){super("RPC Request failed.",{cause:n,details:n.message,metaMessages:[`URL: ${fo(r)}`,`Request body: ${Me(t)}`],name:"RpcRequestError"}),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"url",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.code=n.code,this.data=n.data,this.url=r}}class pf extends V{constructor({body:t,url:n}){super("The request took too long to respond.",{details:"The request timed out.",metaMessages:[`URL: ${fo(n)}`,`Request body: ${Me(t)}`],name:"TimeoutError"}),Object.defineProperty(this,"url",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.url=n}}const jg=-1;class Je extends V{constructor(t,{code:n,docsPath:r,metaMessages:o,name:s,shortMessage:i}){super(i,{cause:t,docsPath:r,metaMessages:o||(t==null?void 0:t.metaMessages),name:s||"RpcError"}),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.name=s||t.name,this.code=t instanceof ca?t.code:n??jg}}class Qe 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 po extends Je{constructor(t){super(t,{code:po.code,name:"ParseRpcError",shortMessage:"Invalid JSON was received by the server. An error occurred on the server while parsing the JSON text."})}}Object.defineProperty(po,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32700});class ho extends Je{constructor(t){super(t,{code:ho.code,name:"InvalidRequestRpcError",shortMessage:"JSON is not a valid request object."})}}Object.defineProperty(ho,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32600});class mo extends Je{constructor(t,{method:n}={}){super(t,{code:mo.code,name:"MethodNotFoundRpcError",shortMessage:`The method${n?` "${n}"`:""} does not exist / is not available.`})}}Object.defineProperty(mo,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32601});class bo extends Je{constructor(t){super(t,{code:bo.code,name:"InvalidParamsRpcError",shortMessage:["Invalid parameters were provided to the RPC method.","Double check you have provided the correct parameters."].join(`
83
- `)})}}Object.defineProperty(bo,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32602});class Jn extends Je{constructor(t){super(t,{code:Jn.code,name:"InternalRpcError",shortMessage:"An internal error was received."})}}Object.defineProperty(Jn,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32603});class $n extends Je{constructor(t){super(t,{code:$n.code,name:"InvalidInputRpcError",shortMessage:["Missing or invalid parameters.","Double check you have provided the correct parameters."].join(`
84
- `)})}}Object.defineProperty($n,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32e3});class go extends Je{constructor(t){super(t,{code:go.code,name:"ResourceNotFoundRpcError",shortMessage:"Requested resource not found."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ResourceNotFoundRpcError"})}}Object.defineProperty(go,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32001});class yo extends Je{constructor(t){super(t,{code:yo.code,name:"ResourceUnavailableRpcError",shortMessage:"Requested resource not available."})}}Object.defineProperty(yo,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32002});class vo extends Je{constructor(t){super(t,{code:vo.code,name:"TransactionRejectedRpcError",shortMessage:"Transaction creation failed."})}}Object.defineProperty(vo,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32003});class Qn extends Je{constructor(t,{method:n}={}){super(t,{code:Qn.code,name:"MethodNotSupportedRpcError",shortMessage:`Method${n?` "${n}"`:""} is not supported.`})}}Object.defineProperty(Qn,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32004});class Tr extends Je{constructor(t){super(t,{code:Tr.code,name:"LimitExceededRpcError",shortMessage:"Request exceeds defined limit."})}}Object.defineProperty(Tr,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32005});class wo extends Je{constructor(t){super(t,{code:wo.code,name:"JsonRpcVersionUnsupportedError",shortMessage:"Version of JSON-RPC protocol is not supported."})}}Object.defineProperty(wo,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32006});class Ar extends Qe{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 xo extends Qe{constructor(t){super(t,{code:xo.code,name:"UnauthorizedProviderError",shortMessage:"The requested method and/or account has not been authorized by the user."})}}Object.defineProperty(xo,"code",{enumerable:!0,configurable:!0,writable:!0,value:4100});class Eo extends Qe{constructor(t,{method:n}={}){super(t,{code:Eo.code,name:"UnsupportedProviderMethodError",shortMessage:`The Provider does not support the requested method${n?` " ${n}"`:""}.`})}}Object.defineProperty(Eo,"code",{enumerable:!0,configurable:!0,writable:!0,value:4200});class So extends Qe{constructor(t){super(t,{code:So.code,name:"ProviderDisconnectedError",shortMessage:"The Provider is disconnected from all chains."})}}Object.defineProperty(So,"code",{enumerable:!0,configurable:!0,writable:!0,value:4900});class Po extends Qe{constructor(t){super(t,{code:Po.code,name:"ChainDisconnectedError",shortMessage:"The Provider is not connected to the requested chain."})}}Object.defineProperty(Po,"code",{enumerable:!0,configurable:!0,writable:!0,value:4901});class To extends Qe{constructor(t){super(t,{code:To.code,name:"SwitchChainError",shortMessage:"An error occurred when attempting to switch chain."})}}Object.defineProperty(To,"code",{enumerable:!0,configurable:!0,writable:!0,value:4902});class Ao extends Qe{constructor(t){super(t,{code:Ao.code,name:"UnsupportedNonOptionalCapabilityError",shortMessage:"This Wallet does not support a capability that was not marked as optional."})}}Object.defineProperty(Ao,"code",{enumerable:!0,configurable:!0,writable:!0,value:5700});class No extends Qe{constructor(t){super(t,{code:No.code,name:"UnsupportedChainIdError",shortMessage:"This Wallet does not support the requested chain ID."})}}Object.defineProperty(No,"code",{enumerable:!0,configurable:!0,writable:!0,value:5710});class Co extends Qe{constructor(t){super(t,{code:Co.code,name:"DuplicateIdError",shortMessage:"There is already a bundle submitted with this ID."})}}Object.defineProperty(Co,"code",{enumerable:!0,configurable:!0,writable:!0,value:5720});class Oo extends Qe{constructor(t){super(t,{code:Oo.code,name:"UnknownBundleIdError",shortMessage:"This bundle id is unknown / has not been submitted"})}}Object.defineProperty(Oo,"code",{enumerable:!0,configurable:!0,writable:!0,value:5730});class Io extends Qe{constructor(t){super(t,{code:Io.code,name:"BundleTooLargeError",shortMessage:"The call bundle is too large for the Wallet to process."})}}Object.defineProperty(Io,"code",{enumerable:!0,configurable:!0,writable:!0,value:5740});class $o extends Qe{constructor(t){super(t,{code:$o.code,name:"AtomicReadyWalletRejectedUpgradeError",shortMessage:"The Wallet can support atomicity after an upgrade, but the user rejected the upgrade."})}}Object.defineProperty($o,"code",{enumerable:!0,configurable:!0,writable:!0,value:5750});class ko extends Qe{constructor(t){super(t,{code:ko.code,name:"AtomicityNotSupportedError",shortMessage:"The wallet does not support atomic execution but the request requires it."})}}Object.defineProperty(ko,"code",{enumerable:!0,configurable:!0,writable:!0,value:5760});class Mo extends Qe{constructor(t){super(t,{code:Mo.code,name:"WalletConnectSessionSettlementError",shortMessage:"WalletConnect session settlement failed."})}}Object.defineProperty(Mo,"code",{enumerable:!0,configurable:!0,writable:!0,value:7e3});class zg extends Je{constructor(t){super(t,{name:"UnknownRpcError",shortMessage:"An unknown RPC error occurred."})}}const Ug=3;function Nr(e,{abi:t,address:n,args:r,docsPath:o,functionName:s,sender:i}){const l=e instanceof As?e:e instanceof V?e.walk(h=>"data"in h)||e.walk():{},{code:a,data:c,details:u,message:f,shortMessage:p}=l,d=e instanceof no?new Fg({functionName:s}):[Ug,Jn.code].includes(a)&&(c||u||f||p)||a===$n.code&&u==="execution reverted"&&c?new la({abi:t,data:typeof c=="object"?c.data:c,functionName:s,message:l instanceof ca?u:p??f}):e;return new df(d,{abi:t,args:r,contractAddress:n,docsPath:o,functionName:s,sender:i})}function _g(e){const t=je(`0x${e.substring(4)}`).substring(26);return Ps(`0x${t}`)}async function Wg({hash:e,signature:t}){const n=Mt(e)?e:Cn(e),{secp256k1:r}=await Promise.resolve().then(()=>P6);return`0x${(()=>{if(typeof t=="object"&&"r"in t&&"s"in t){const{r:c,s:u,v:f,yParity:p}=t,d=Number(p??f),h=hf(d);return new r.Signature(Gt(c),Gt(u)).addRecoveryBit(h)}const i=Mt(t)?t:Cn(t);if(Te(i)!==65)throw new Error("invalid signature length");const l=ln(`0x${i.slice(130)}`),a=hf(l);return r.Signature.fromCompact(i.substring(2,130)).addRecoveryBit(a)})().recoverPublicKey(n.substring(2)).toHex(!1)}`}function hf(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 mf({hash:e,signature:t}){return _g(await Wg({hash:e,signature:t}))}function Vg(e,t="hex"){const n=bf(e),r=oa(new Uint8Array(n.length));return n.encode(r),t==="hex"?ke(r.bytes):r.bytes}function bf(e){return Array.isArray(e)?Hg(e.map(t=>bf(t))):Gg(e)}function Hg(e){const t=e.reduce((o,s)=>o+s.length,0),n=gf(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 Gg(e){const t=typeof e=="string"?qt(e):e,n=gf(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 gf(e){if(e<2**8)return 1;if(e<2**16)return 2;if(e<2**24)return 3;if(e<2**32)return 4;throw new V("Length is too large.")}function qg(e){const{chainId:t,nonce:n,to:r}=e,o=e.contractAddress??e.address,s=je(Sr(["0x05",Vg([t?re(t):"0x",o,n?re(n):"0x"])]));return r==="bytes"?qt(s):s}async function yf(e){const{authorization:t,signature:n}=e;return mf({hash:qg(t),signature:n??t})}class Kg extends V{constructor(t,{account:n,docsPath:r,chain:o,data:s,gas:i,gasPrice:l,maxFeePerGas:a,maxPriorityFeePerGas:c,nonce:u,to:f,value:p}){var h;const d=uo({from:n==null?void 0:n.address,to:f,value:typeof p<"u"&&`${aa(p)} ${((h=o==null?void 0:o.nativeCurrency)==null?void 0:h.symbol)||"ETH"}`,data:s,gas:i,gasPrice:typeof l<"u"&&`${Xe(l)} gwei`,maxFeePerGas:typeof a<"u"&&`${Xe(a)} gwei`,maxPriorityFeePerGas:typeof c<"u"&&`${Xe(c)} 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 Cr extends V{constructor({cause:t,message:n}={}){var o;const r=(o=n==null?void 0:n.replace("execution reverted: ",""))==null?void 0:o.replace("execution reverted","");super(`Execution reverted ${r?`with reason: ${r}`:"for an unknown reason"}.`,{cause:t,name:"ExecutionRevertedError"})}}Object.defineProperty(Cr,"code",{enumerable:!0,configurable:!0,writable:!0,value:3}),Object.defineProperty(Cr,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/execution reverted|gas required exceeds allowance/});class Ns extends V{constructor({cause:t,maxFeePerGas:n}={}){super(`The fee cap (\`maxFeePerGas\`${n?` = ${Xe(n)} gwei`:""}) cannot be higher than the maximum allowed value (2^256-1).`,{cause:t,name:"FeeCapTooHighError"})}}Object.defineProperty(Ns,"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 ua extends V{constructor({cause:t,maxFeePerGas:n}={}){super(`The fee cap (\`maxFeePerGas\`${n?` = ${Xe(n)}`:""} gwei) cannot be lower than the block base fee.`,{cause:t,name:"FeeCapTooLowError"})}}Object.defineProperty(ua,"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 fa extends V{constructor({cause:t,nonce:n}={}){super(`Nonce provided for the transaction ${n?`(${n}) `:""}is higher than the next one expected.`,{cause:t,name:"NonceTooHighError"})}}Object.defineProperty(fa,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/nonce too high/});class da extends V{constructor({cause:t,nonce:n}={}){super([`Nonce provided for the transaction ${n?`(${n}) `:""}is lower than the current nonce of the account.`,"Try increasing the nonce or find the latest nonce with `getTransactionCount`."].join(`
79
+ `).slice(0,-1)}function fo(e){const t=Object.entries(e).map(([r,o])=>o===void 0||o===!1?null:[r,o]).filter(Boolean),n=t.reduce((r,[o])=>Math.max(r,o.length),0);return t.map(([r,o])=>` ${`${r}:`.padEnd(n+1)} ${o}`).join(`
80
+ `)}class kg extends V{constructor({transaction:t}){super("Cannot infer a transaction type from provided transaction.",{metaMessages:["Provided Transaction:","{",fo(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 Mg extends V{constructor(t,{account:n,docsPath:r,chain:o,data:s,gas:i,gasPrice:l,maxFeePerGas:a,maxPriorityFeePerGas:c,nonce:u,to:f,value:p}){var h;const d=fo({chain:o&&`${o==null?void 0:o.name} (id: ${o==null?void 0:o.id})`,from:n==null?void 0:n.address,to:f,value:typeof p<"u"&&`${aa(p)} ${((h=o==null?void 0:o.nativeCurrency)==null?void 0:h.symbol)||"ETH"}`,data:s,gas:i,gasPrice:typeof l<"u"&&`${Xe(l)} gwei`,maxFeePerGas:typeof a<"u"&&`${Xe(a)} gwei`,maxPriorityFeePerGas:typeof c<"u"&&`${Xe(c)} gwei`,nonce:u});super(t.shortMessage,{cause:t,docsPath:r,metaMessages:[...t.metaMessages?[...t.metaMessages," "]:[],"Request Arguments:",d].filter(Boolean),name:"TransactionExecutionError"}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.cause=t}}class cf extends V{constructor({blockHash:t,blockNumber:n,blockTag:r,hash:o,index:s}){let i="Transaction";r&&s!==void 0&&(i=`Transaction at block time "${r}" at index "${s}"`),t&&s!==void 0&&(i=`Transaction at block hash "${t}" at index "${s}"`),n&&s!==void 0&&(i=`Transaction at block number "${n}" at index "${s}"`),o&&(i=`Transaction with hash "${o}"`),super(`${i} could not be found.`,{name:"TransactionNotFoundError"})}}class uf extends V{constructor({hash:t}){super(`Transaction receipt with hash "${t}" could not be found. The Transaction may not be processed on a block yet.`,{name:"TransactionReceiptNotFoundError"})}}class Dg extends V{constructor({receipt:t}){super(`Transaction with hash "${t.transactionHash}" reverted.`,{metaMessages:['The receipt marked the transaction as "reverted". This could mean that the function on the contract you are trying to call threw an error.'," ","You can attempt to extract the revert reason by:","- calling the `simulateContract` or `simulateCalls` Action with the `abi` and `functionName` of the contract","- using the `call` Action with raw `data`"],name:"TransactionReceiptRevertedError"}),Object.defineProperty(this,"receipt",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.receipt=t}}class Bg extends V{constructor({hash:t}){super(`Timed out while waiting for transaction with hash "${t}" to be confirmed.`,{name:"WaitForTransactionReceiptTimeoutError"})}}const Lg=e=>e,po=e=>e;class ff extends V{constructor(t,{account:n,docsPath:r,chain:o,data:s,gas:i,gasPrice:l,maxFeePerGas:a,maxPriorityFeePerGas:c,nonce:u,to:f,value:p,stateOverride:d}){var v;const h=n?ft(n):void 0;let b=fo({from:h==null?void 0:h.address,to:f,value:typeof p<"u"&&`${aa(p)} ${((v=o==null?void 0:o.nativeCurrency)==null?void 0:v.symbol)||"ETH"}`,data:s,gas:i,gasPrice:typeof l<"u"&&`${Xe(l)} gwei`,maxFeePerGas:typeof a<"u"&&`${Xe(a)} gwei`,maxPriorityFeePerGas:typeof c<"u"&&`${Xe(c)} gwei`,nonce:u});d&&(b+=`
81
+ ${$g(d)}`),super(t.shortMessage,{cause:t,docsPath:r,metaMessages:[...t.metaMessages?[...t.metaMessages," "]:[],"Raw Call Arguments:",b].filter(Boolean),name:"CallExecutionError"}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.cause=t}}class df extends V{constructor(t,{abi:n,args:r,contractAddress:o,docsPath:s,functionName:i,sender:l}){const a=Yn({abi:n,args:r,name:i}),c=a?af({abiItem:a,args:r,includeFunctionName:!1,includeName:!1}):void 0,u=a?kt(a,{includeName:!0}):void 0,f=fo({address:o&&Lg(o),function:u,args:c&&c!=="()"&&`${[...Array((i==null?void 0:i.length)??0).keys()].map(()=>" ").join("")}${c}`,sender:l});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=l}}class la extends V{constructor({abi:t,data:n,functionName:r,message:o}){let s,i,l,a;if(n&&n!=="0x")try{i=sf({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=pg[d]}else{const d=u?kt(u,{includeName:!0}):void 0,h=u&&p?af({abiItem:u,args:p,includeFunctionName:!1,includeName:!1}):void 0;l=[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 c;s instanceof Tu&&(c=s.signature,l=[`Unable to decode signature "${c}" as it was not found on the provided ABI.`,"Make sure you are using the correct ABI and that the error exists on it.",`You can look up the decoded signature here: https://4byte.sourcify.dev/?q=${c}.`]),super(a&&a!=="execution reverted"||c?[`The contract function "${r}" reverted with the following ${c?"signature":"reason"}:`,a||c].join(`
82
+ `):`The contract function "${r}" reverted.`,{cause:s,metaMessages:l,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=c}}class Fg extends V{constructor({functionName:t}){super(`The contract function "${t}" returned no data ("0x").`,{metaMessages:["This could be due to any of the following:",` - The contract does not have the function "${t}",`," - The parameters passed to the contract function may be invalid, or"," - The address is not a contract."],name:"ContractFunctionZeroDataError"})}}class Rg extends V{constructor({factory:t}){super(`Deployment for counterfactual contract call failed${t?` for factory "${t}".`:""}`,{metaMessages:["Please ensure:","- The `factory` is a valid contract deployment factory (ie. Create2 Factory, ERC-4337 Factory, etc).","- The `factoryData` is a valid encoded function call for contract deployment function on the factory."],name:"CounterfactualDeploymentFailedError"})}}class As extends V{constructor({data:t,message:n}){super(n||"",{name:"RawContractError"}),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:3}),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.data=t}}class Xn extends V{constructor({body:t,cause:n,details:r,headers:o,status:s,url:i}){super("HTTP request failed.",{cause:n,details:r,metaMessages:[s&&`Status: ${s}`,`URL: ${po(i)}`,t&&`Request body: ${Me(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 ca extends V{constructor({body:t,error:n,url:r}){super("RPC Request failed.",{cause:n,details:n.message,metaMessages:[`URL: ${po(r)}`,`Request body: ${Me(t)}`],name:"RpcRequestError"}),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"url",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.code=n.code,this.data=n.data,this.url=r}}class pf extends V{constructor({body:t,url:n}){super("The request took too long to respond.",{details:"The request timed out.",metaMessages:[`URL: ${po(n)}`,`Request body: ${Me(t)}`],name:"TimeoutError"}),Object.defineProperty(this,"url",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.url=n}}const jg=-1;class Je extends V{constructor(t,{code:n,docsPath:r,metaMessages:o,name:s,shortMessage:i}){super(i,{cause:t,docsPath:r,metaMessages:o||(t==null?void 0:t.metaMessages),name:s||"RpcError"}),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.name=s||t.name,this.code=t instanceof ca?t.code:n??jg}}class Qe 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 ho extends Je{constructor(t){super(t,{code:ho.code,name:"ParseRpcError",shortMessage:"Invalid JSON was received by the server. An error occurred on the server while parsing the JSON text."})}}Object.defineProperty(ho,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32700});class mo extends Je{constructor(t){super(t,{code:mo.code,name:"InvalidRequestRpcError",shortMessage:"JSON is not a valid request object."})}}Object.defineProperty(mo,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32600});class bo extends Je{constructor(t,{method:n}={}){super(t,{code:bo.code,name:"MethodNotFoundRpcError",shortMessage:`The method${n?` "${n}"`:""} does not exist / is not available.`})}}Object.defineProperty(bo,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32601});class go extends Je{constructor(t){super(t,{code:go.code,name:"InvalidParamsRpcError",shortMessage:["Invalid parameters were provided to the RPC method.","Double check you have provided the correct parameters."].join(`
83
+ `)})}}Object.defineProperty(go,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32602});class Jn extends Je{constructor(t){super(t,{code:Jn.code,name:"InternalRpcError",shortMessage:"An internal error was received."})}}Object.defineProperty(Jn,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32603});class In extends Je{constructor(t){super(t,{code:In.code,name:"InvalidInputRpcError",shortMessage:["Missing or invalid parameters.","Double check you have provided the correct parameters."].join(`
84
+ `)})}}Object.defineProperty(In,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32e3});class yo extends Je{constructor(t){super(t,{code:yo.code,name:"ResourceNotFoundRpcError",shortMessage:"Requested resource not found."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ResourceNotFoundRpcError"})}}Object.defineProperty(yo,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32001});class vo extends Je{constructor(t){super(t,{code:vo.code,name:"ResourceUnavailableRpcError",shortMessage:"Requested resource not available."})}}Object.defineProperty(vo,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32002});class wo extends Je{constructor(t){super(t,{code:wo.code,name:"TransactionRejectedRpcError",shortMessage:"Transaction creation failed."})}}Object.defineProperty(wo,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32003});class Qn extends Je{constructor(t,{method:n}={}){super(t,{code:Qn.code,name:"MethodNotSupportedRpcError",shortMessage:`Method${n?` "${n}"`:""} is not supported.`})}}Object.defineProperty(Qn,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32004});class Tr extends Je{constructor(t){super(t,{code:Tr.code,name:"LimitExceededRpcError",shortMessage:"Request exceeds defined limit."})}}Object.defineProperty(Tr,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32005});class xo extends Je{constructor(t){super(t,{code:xo.code,name:"JsonRpcVersionUnsupportedError",shortMessage:"Version of JSON-RPC protocol is not supported."})}}Object.defineProperty(xo,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32006});class Ar extends Qe{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 Eo extends Qe{constructor(t){super(t,{code:Eo.code,name:"UnauthorizedProviderError",shortMessage:"The requested method and/or account has not been authorized by the user."})}}Object.defineProperty(Eo,"code",{enumerable:!0,configurable:!0,writable:!0,value:4100});class So extends Qe{constructor(t,{method:n}={}){super(t,{code:So.code,name:"UnsupportedProviderMethodError",shortMessage:`The Provider does not support the requested method${n?` " ${n}"`:""}.`})}}Object.defineProperty(So,"code",{enumerable:!0,configurable:!0,writable:!0,value:4200});class Po extends Qe{constructor(t){super(t,{code:Po.code,name:"ProviderDisconnectedError",shortMessage:"The Provider is disconnected from all chains."})}}Object.defineProperty(Po,"code",{enumerable:!0,configurable:!0,writable:!0,value:4900});class To extends Qe{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 Ao extends Qe{constructor(t){super(t,{code:Ao.code,name:"SwitchChainError",shortMessage:"An error occurred when attempting to switch chain."})}}Object.defineProperty(Ao,"code",{enumerable:!0,configurable:!0,writable:!0,value:4902});class No extends Qe{constructor(t){super(t,{code:No.code,name:"UnsupportedNonOptionalCapabilityError",shortMessage:"This Wallet does not support a capability that was not marked as optional."})}}Object.defineProperty(No,"code",{enumerable:!0,configurable:!0,writable:!0,value:5700});class Co extends Qe{constructor(t){super(t,{code:Co.code,name:"UnsupportedChainIdError",shortMessage:"This Wallet does not support the requested chain ID."})}}Object.defineProperty(Co,"code",{enumerable:!0,configurable:!0,writable:!0,value:5710});class Oo extends Qe{constructor(t){super(t,{code:Oo.code,name:"DuplicateIdError",shortMessage:"There is already a bundle submitted with this ID."})}}Object.defineProperty(Oo,"code",{enumerable:!0,configurable:!0,writable:!0,value:5720});class Io extends Qe{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 $o extends Qe{constructor(t){super(t,{code:$o.code,name:"BundleTooLargeError",shortMessage:"The call bundle is too large for the Wallet to process."})}}Object.defineProperty($o,"code",{enumerable:!0,configurable:!0,writable:!0,value:5740});class ko extends Qe{constructor(t){super(t,{code:ko.code,name:"AtomicReadyWalletRejectedUpgradeError",shortMessage:"The Wallet can support atomicity after an upgrade, but the user rejected the upgrade."})}}Object.defineProperty(ko,"code",{enumerable:!0,configurable:!0,writable:!0,value:5750});class Mo extends Qe{constructor(t){super(t,{code:Mo.code,name:"AtomicityNotSupportedError",shortMessage:"The wallet does not support atomic execution but the request requires it."})}}Object.defineProperty(Mo,"code",{enumerable:!0,configurable:!0,writable:!0,value:5760});class Do extends Qe{constructor(t){super(t,{code:Do.code,name:"WalletConnectSessionSettlementError",shortMessage:"WalletConnect session settlement failed."})}}Object.defineProperty(Do,"code",{enumerable:!0,configurable:!0,writable:!0,value:7e3});class zg extends Je{constructor(t){super(t,{name:"UnknownRpcError",shortMessage:"An unknown RPC error occurred."})}}const Ug=3;function Nr(e,{abi:t,address:n,args:r,docsPath:o,functionName:s,sender:i}){const l=e instanceof As?e:e instanceof V?e.walk(h=>"data"in h)||e.walk():{},{code:a,data:c,details:u,message:f,shortMessage:p}=l,d=e instanceof ro?new Fg({functionName:s}):[Ug,Jn.code].includes(a)&&(c||u||f||p)||a===In.code&&u==="execution reverted"&&c?new la({abi:t,data:typeof c=="object"?c.data:c,functionName:s,message:l instanceof ca?u:p??f}):e;return new df(d,{abi:t,args:r,contractAddress:n,docsPath:o,functionName:s,sender:i})}function Wg(e){const t=je(`0x${e.substring(4)}`).substring(26);return Ps(`0x${t}`)}async function _g({hash:e,signature:t}){const n=Mt(e)?e:Nn(e),{secp256k1:r}=await Promise.resolve().then(()=>P6);return`0x${(()=>{if(typeof t=="object"&&"r"in t&&"s"in t){const{r:c,s:u,v:f,yParity:p}=t,d=Number(p??f),h=hf(d);return new r.Signature(Gt(c),Gt(u)).addRecoveryBit(h)}const i=Mt(t)?t:Nn(t);if(Te(i)!==65)throw new Error("invalid signature length");const l=ln(`0x${i.slice(130)}`),a=hf(l);return r.Signature.fromCompact(i.substring(2,130)).addRecoveryBit(a)})().recoverPublicKey(n.substring(2)).toHex(!1)}`}function hf(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 mf({hash:e,signature:t}){return Wg(await _g({hash:e,signature:t}))}function Vg(e,t="hex"){const n=bf(e),r=oa(new Uint8Array(n.length));return n.encode(r),t==="hex"?ke(r.bytes):r.bytes}function bf(e){return Array.isArray(e)?Hg(e.map(t=>bf(t))):Gg(e)}function Hg(e){const t=e.reduce((o,s)=>o+s.length,0),n=gf(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 Gg(e){const t=typeof e=="string"?qt(e):e,n=gf(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 gf(e){if(e<2**8)return 1;if(e<2**16)return 2;if(e<2**24)return 3;if(e<2**32)return 4;throw new V("Length is too large.")}function qg(e){const{chainId:t,nonce:n,to:r}=e,o=e.contractAddress??e.address,s=je(Sr(["0x05",Vg([t?re(t):"0x",o,n?re(n):"0x"])]));return r==="bytes"?qt(s):s}async function yf(e){const{authorization:t,signature:n}=e;return mf({hash:qg(t),signature:n??t})}class Kg extends V{constructor(t,{account:n,docsPath:r,chain:o,data:s,gas:i,gasPrice:l,maxFeePerGas:a,maxPriorityFeePerGas:c,nonce:u,to:f,value:p}){var h;const d=fo({from:n==null?void 0:n.address,to:f,value:typeof p<"u"&&`${aa(p)} ${((h=o==null?void 0:o.nativeCurrency)==null?void 0:h.symbol)||"ETH"}`,data:s,gas:i,gasPrice:typeof l<"u"&&`${Xe(l)} gwei`,maxFeePerGas:typeof a<"u"&&`${Xe(a)} gwei`,maxPriorityFeePerGas:typeof c<"u"&&`${Xe(c)} 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 Cr extends V{constructor({cause:t,message:n}={}){var o;const r=(o=n==null?void 0:n.replace("execution reverted: ",""))==null?void 0:o.replace("execution reverted","");super(`Execution reverted ${r?`with reason: ${r}`:"for an unknown reason"}.`,{cause:t,name:"ExecutionRevertedError"})}}Object.defineProperty(Cr,"code",{enumerable:!0,configurable:!0,writable:!0,value:3}),Object.defineProperty(Cr,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/execution reverted|gas required exceeds allowance/});class Ns extends V{constructor({cause:t,maxFeePerGas:n}={}){super(`The fee cap (\`maxFeePerGas\`${n?` = ${Xe(n)} gwei`:""}) cannot be higher than the maximum allowed value (2^256-1).`,{cause:t,name:"FeeCapTooHighError"})}}Object.defineProperty(Ns,"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 ua extends V{constructor({cause:t,maxFeePerGas:n}={}){super(`The fee cap (\`maxFeePerGas\`${n?` = ${Xe(n)}`:""} gwei) cannot be lower than the block base fee.`,{cause:t,name:"FeeCapTooLowError"})}}Object.defineProperty(ua,"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 fa extends V{constructor({cause:t,nonce:n}={}){super(`Nonce provided for the transaction ${n?`(${n}) `:""}is higher than the next one expected.`,{cause:t,name:"NonceTooHighError"})}}Object.defineProperty(fa,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/nonce too high/});class da extends V{constructor({cause:t,nonce:n}={}){super([`Nonce provided for the transaction ${n?`(${n}) `:""}is lower than the current nonce of the account.`,"Try increasing the nonce or find the latest nonce with `getTransactionCount`."].join(`
85
85
  `),{cause:t,name:"NonceTooLowError"})}}Object.defineProperty(da,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/nonce too low|transaction already imported|already known/});class pa extends V{constructor({cause:t,nonce:n}={}){super(`Nonce provided for the transaction ${n?`(${n}) `:""}exceeds the maximum allowed nonce.`,{cause:t,name:"NonceMaxValueError"})}}Object.defineProperty(pa,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/nonce has max value/});class ha extends V{constructor({cause:t}={}){super(["The total cost (gas * gas fee + value) of executing this transaction exceeds the balance of the account."].join(`
86
86
  `),{cause:t,metaMessages:["This error could arise when the account does not have enough funds to:"," - pay for the total gas fee,"," - pay for the value to send."," ","The cost of the transaction is calculated as `gas * gas fee + value`, where:"," - `gas` is the amount of gas needed for transaction to execute,"," - `gas fee` is the gas fee,"," - `value` is the amount of ether to send to the recipient."],name:"InsufficientFundsError"})}}Object.defineProperty(ha,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/insufficient funds|exceeds transaction sender account balance/});class ma extends V{constructor({cause:t,gas:n}={}){super(`The amount of gas ${n?`(${n}) `:""}provided for the transaction exceeds the limit allowed for the block.`,{cause:t,name:"IntrinsicGasTooHighError"})}}Object.defineProperty(ma,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/intrinsic gas too high|gas limit reached/});class ba extends V{constructor({cause:t,gas:n}={}){super(`The amount of gas ${n?`(${n}) `:""}provided for the transaction is too low.`,{cause:t,name:"IntrinsicGasTooLowError"})}}Object.defineProperty(ba,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/intrinsic gas too low/});class ga extends V{constructor({cause:t}){super("The transaction type is not supported for this chain.",{cause:t,name:"TransactionTypeNotSupportedError"})}}Object.defineProperty(ga,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/transaction type not valid/});class Cs extends V{constructor({cause:t,maxPriorityFeePerGas:n,maxFeePerGas:r}={}){super([`The provided tip (\`maxPriorityFeePerGas\`${n?` = ${Xe(n)} gwei`:""}) cannot be higher than the fee cap (\`maxFeePerGas\`${r?` = ${Xe(r)} gwei`:""}).`].join(`
87
- `),{cause:t,name:"TipAboveFeeCapError"})}}Object.defineProperty(Cs,"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 Do extends V{constructor({cause:t}){super(`An error occurred while executing: ${t==null?void 0:t.shortMessage}`,{cause:t,name:"UnknownNodeError"})}}function Os(e,t){const n=(e.details||"").toLowerCase(),r=e instanceof V?e.walk(o=>(o==null?void 0:o.code)===Cr.code):e;return r instanceof V?new Cr({cause:e,message:r.details}):Cr.nodeMessage.test(n)?new Cr({cause:e,message:e.details}):Ns.nodeMessage.test(n)?new Ns({cause:e,maxFeePerGas:t==null?void 0:t.maxFeePerGas}):ua.nodeMessage.test(n)?new ua({cause:e,maxFeePerGas:t==null?void 0:t.maxFeePerGas}):fa.nodeMessage.test(n)?new fa({cause:e,nonce:t==null?void 0:t.nonce}):da.nodeMessage.test(n)?new da({cause:e,nonce:t==null?void 0:t.nonce}):pa.nodeMessage.test(n)?new pa({cause:e,nonce:t==null?void 0:t.nonce}):ha.nodeMessage.test(n)?new ha({cause:e}):ma.nodeMessage.test(n)?new ma({cause:e,gas:t==null?void 0:t.gas}):ba.nodeMessage.test(n)?new ba({cause:e,gas:t==null?void 0:t.gas}):ga.nodeMessage.test(n)?new ga({cause:e}):Cs.nodeMessage.test(n)?new Cs({cause:e,maxFeePerGas:t==null?void 0:t.maxFeePerGas,maxPriorityFeePerGas:t==null?void 0:t.maxPriorityFeePerGas}):new Do({cause:e})}function Zg(e,{docsPath:t,...n}){const r=(()=>{const o=Os(e,n);return o instanceof Do?e:o})();return new Kg(r,{docsPath:t,...n})}function Is(e,{format:t}){if(!t)return{};const n={};function r(s){const i=Object.keys(s);for(const l of i)l in e&&(n[l]=e[l]),s[l]&&typeof s[l]=="object"&&!Array.isArray(s[l])&&r(s[l])}const o=t(e||{});return r(o),n}const Yg={legacy:"0x0",eip2930:"0x1",eip1559:"0x2",eip4844:"0x3",eip7702:"0x4"};function Bo(e,t){const n={};return typeof e.authorizationList<"u"&&(n.authorizationList=Xg(e.authorizationList)),typeof e.accessList<"u"&&(n.accessList=e.accessList),typeof e.blobVersionedHashes<"u"&&(n.blobVersionedHashes=e.blobVersionedHashes),typeof e.blobs<"u"&&(typeof e.blobs[0]!="string"?n.blobs=e.blobs.map(r=>ke(r)):n.blobs=e.blobs),typeof e.data<"u"&&(n.data=e.data),e.account&&(n.from=e.account.address),typeof e.from<"u"&&(n.from=e.from),typeof e.gas<"u"&&(n.gas=re(e.gas)),typeof e.gasPrice<"u"&&(n.gasPrice=re(e.gasPrice)),typeof e.maxFeePerBlobGas<"u"&&(n.maxFeePerBlobGas=re(e.maxFeePerBlobGas)),typeof e.maxFeePerGas<"u"&&(n.maxFeePerGas=re(e.maxFeePerGas)),typeof e.maxPriorityFeePerGas<"u"&&(n.maxPriorityFeePerGas=re(e.maxPriorityFeePerGas)),typeof e.nonce<"u"&&(n.nonce=re(e.nonce)),typeof e.to<"u"&&(n.to=e.to),typeof e.type<"u"&&(n.type=Yg[e.type]),typeof e.value<"u"&&(n.value=re(e.value)),n}function Xg(e){return e.map(t=>({address:t.address,r:t.r?re(BigInt(t.r)):t.r,s:t.s?re(BigInt(t.s)):t.s,chainId:re(t.chainId),nonce:re(t.nonce),...typeof t.yParity<"u"?{yParity:re(t.yParity)}:{},...typeof t.v<"u"&&typeof t.yParity>"u"?{v:re(t.v)}:{}}))}function vf(e){if(!(!e||e.length===0))return e.reduce((t,{slot:n,value:r})=>{if(n.length!==66)throw new $u({size:n.length,targetSize:66,type:"hex"});if(r.length!==66)throw new $u({size:r.length,targetSize:66,type:"hex"});return t[n]=r,t},{})}function Jg(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=re(t)),n!==void 0&&(i.nonce=re(n)),r!==void 0&&(i.state=vf(r)),o!==void 0){if(i.state)throw new Ig;i.stateDiff=vf(o)}return i}function ya(e){if(!e)return;const t={};for(const{address:n,...r}of e){if(!yt(n,{strict:!1}))throw new On({address:n});if(t[n])throw new Og({address:n});t[n]=Jg(r)}return t}const wf=2n**256n-1n;function Or(e){const{account:t,maxFeePerGas:n,maxPriorityFeePerGas:r,to:o}=e,s=t?ft(t):void 0;if(s&&!yt(s.address))throw new On({address:s.address});if(o&&!yt(o))throw new On({address:o});if(n&&n>wf)throw new Ns({maxFeePerGas:n});if(r&&n&&r>n)throw new Cs({maxFeePerGas:n,maxPriorityFeePerGas:r})}class xf extends V{constructor(){super("`baseFeeMultiplier` must be greater than 1.",{name:"BaseFeeScalarError"})}}class va extends V{constructor(){super("Chain does not support EIP-1559 fees.",{name:"Eip1559FeesNotSupportedError"})}}class Qg extends V{constructor({maxPriorityFeePerGas:t}){super(`\`maxFeePerGas\` cannot be less than the \`maxPriorityFeePerGas\` (${Xe(t)} gwei).`,{name:"MaxFeePerGasTooLowError"})}}class Ef extends V{constructor({blockHash:t,blockNumber:n}){let r="Block";t&&(r=`Block at hash "${t}"`),n&&(r=`Block at number "${n}"`),super(`${r} could not be found.`,{name:"BlockNotFoundError"})}}const Sf={"0x0":"legacy","0x1":"eip2930","0x2":"eip1559","0x3":"eip4844","0x4":"eip7702"};function wa(e,t){const n={...e,blockHash:e.blockHash?e.blockHash:null,blockNumber:e.blockNumber?BigInt(e.blockNumber):null,chainId:e.chainId?ln(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?ln(e.nonce):void 0,to:e.to?e.to:null,transactionIndex:e.transactionIndex?Number(e.transactionIndex):null,type:e.type?Sf[e.type]:void 0,typeHex:e.type?e.type:void 0,value:e.value?BigInt(e.value):void 0,v:e.v?BigInt(e.v):void 0};return e.authorizationList&&(n.authorizationList=ey(e.authorizationList)),n.yParity=(()=>{if(e.yParity)return Number(e.yParity);if(typeof n.v=="bigint"){if(n.v===0n||n.v===27n)return 0;if(n.v===1n||n.v===28n)return 1;if(n.v>=35n)return n.v%2n===0n?1:0}})(),n.type==="legacy"&&(delete n.accessList,delete n.maxFeePerBlobGas,delete n.maxFeePerGas,delete n.maxPriorityFeePerGas,delete n.yParity),n.type==="eip2930"&&(delete n.maxFeePerBlobGas,delete n.maxFeePerGas,delete n.maxPriorityFeePerGas),n.type==="eip1559"&&delete n.maxFeePerBlobGas,n}function ey(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 Pf(e,t){const n=(e.transactions??[]).map(r=>typeof r=="string"?r:wa(r));return{...e,baseFeePerGas:e.baseFeePerGas?BigInt(e.baseFeePerGas):null,blobGasUsed:e.blobGasUsed?BigInt(e.blobGasUsed):void 0,difficulty:e.difficulty?BigInt(e.difficulty):void 0,excessBlobGas:e.excessBlobGas?BigInt(e.excessBlobGas):void 0,gasLimit:e.gasLimit?BigInt(e.gasLimit):void 0,gasUsed:e.gasUsed?BigInt(e.gasUsed):void 0,hash:e.hash?e.hash:null,logsBloom:e.logsBloom?e.logsBloom:null,nonce:e.nonce?e.nonce:null,number:e.number?BigInt(e.number):null,size:e.size?BigInt(e.size):void 0,timestamp:e.timestamp?BigInt(e.timestamp):void 0,transactions:n,totalDifficulty:e.totalDifficulty?BigInt(e.totalDifficulty):null}}async function Lt(e,{blockHash:t,blockNumber:n,blockTag:r=e.experimental_blockTag??"latest",includeTransactions:o}={}){var c,u,f;const s=o??!1,i=n!==void 0?re(n):void 0;let l=null;if(t?l=await e.request({method:"eth_getBlockByHash",params:[t,s]},{dedupe:!0}):l=await e.request({method:"eth_getBlockByNumber",params:[i||r,s]},{dedupe:!!i}),!l)throw new Ef({blockHash:t,blockNumber:n});return(((f=(u=(c=e.chain)==null?void 0:c.formatters)==null?void 0:u.block)==null?void 0:f.format)||Pf)(l,"getBlock")}async function xa(e){const t=await e.request({method:"eth_gasPrice"});return BigInt(t)}async function ty(e,t){return Tf(e,t)}async function Tf(e,t){var s,i;const{block:n,chain:r=e.chain,request:o}=t||{};try{const l=((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 l=="function"){const c=n||await te(e,Lt,"getBlock")({}),u=await l({block:c,client:e,request:o});if(u===null)throw new Error;return u}if(typeof l<"u")return l;const a=await e.request({method:"eth_maxPriorityFeePerGas"});return Gt(a)}catch{const[l,a]=await Promise.all([n?Promise.resolve(n):te(e,Lt,"getBlock")({}),te(e,xa,"getGasPrice")({})]);if(typeof l.baseFeePerGas!="bigint")throw new va;const c=a-l.baseFeePerGas;return c<0n?0n:c}}async function ny(e,t){return Ea(e,t)}async function Ea(e,t){var p,d;const{block:n,chain:r=e.chain,request:o,type:s="eip1559"}=t||{},i=await(async()=>{var h,b;return typeof((h=r==null?void 0:r.fees)==null?void 0:h.baseFeeMultiplier)=="function"?r.fees.baseFeeMultiplier({block:n,client:e,request:o}):((b=r==null?void 0:r.fees)==null?void 0:b.baseFeeMultiplier)??1.2})();if(i<1)throw new xf;const a=10**(((p=i.toString().split(".")[1])==null?void 0:p.length)??0),c=h=>h*BigInt(Math.ceil(i*a))/BigInt(a),u=n||await te(e,Lt,"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:c,request:o,type:s});if(h!==null)return h}if(s==="eip1559"){if(typeof u.baseFeePerGas!="bigint")throw new va;const h=typeof(o==null?void 0:o.maxPriorityFeePerGas)=="bigint"?o.maxPriorityFeePerGas:await Tf(e,{block:u,chain:r,request:o}),b=c(u.baseFeePerGas);return{maxFeePerGas:(o==null?void 0:o.maxFeePerGas)??b+h,maxPriorityFeePerGas:h}}return{gasPrice:(o==null?void 0:o.gasPrice)??c(await te(e,xa,"getGasPrice")({}))}}async function Af(e,{address:t,blockTag:n="latest",blockNumber:r}){const o=await e.request({method:"eth_getTransactionCount",params:[t,typeof r=="bigint"?re(r):n]},{dedupe:!!r});return ln(o)}function Nf(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=>qt(s)):e.blobs,o=[];for(const s of r)o.push(Uint8Array.from(t.blobToKzgCommitment(s)));return n==="bytes"?o:o.map(s=>ke(s))}function Cf(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=>qt(i)):e.blobs,o=typeof e.commitments[0]=="string"?e.commitments.map(i=>qt(i)):e.commitments,s=[];for(let i=0;i<r.length;i++){const l=r[i],a=o[i];s.push(Uint8Array.from(t.computeBlobKzgProof(l,a)))}return n==="bytes"?s:s.map(i=>ke(i))}function ry(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),l=Number(n&s),a=r?4:0,c=r?0:4;e.setUint32(t+a,i,r),e.setUint32(t+c,l,r)}function oy(e,t,n){return e&t^~e&n}function sy(e,t,n){return e&t^e&n^t&n}class iy extends Yi{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=Zi(this.buffer)}update(t){xr(this),t=xs(t),Kn(t);const{view:n,buffer:r,blockLen:o}=this,s=t.length;for(let i=0;i<s;){const l=Math.min(o-this.pos,s-i);if(l===o){const a=Zi(t);for(;o<=s-i;i+=o)this.process(a,i);continue}r.set(t.subarray(i,i+l),this.pos),this.pos+=l,i+=l,this.pos===o&&(this.process(n,0),this.pos=0)}return this.length+=t.length,this.roundClean(),this}digestInto(t){xr(this),Bu(t,this),this.finished=!0;const{buffer:n,view:r,blockLen:o,isLE:s}=this;let{pos:i}=this;n[i++]=128,Er(this.buffer.subarray(i)),this.padOffset>o-i&&(this.process(r,0),i=0);for(let f=i;f<o;f++)n[f]=0;ry(r,o-8,BigInt(this.length*8),s),this.process(r,0);const l=Zi(t),a=this.outputLen;if(a%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const c=a/4,u=this.get();if(c>u.length)throw new Error("_sha2: outputLen bigger than state");for(let f=0;f<c;f++)l.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:l}=this;return t.destroyed=i,t.finished=s,t.length=o,t.pos=l,o%n&&t.buffer.set(r),t}clone(){return this._cloneInto()}}const kn=Uint32Array.from([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),ay=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 ly extends iy{constructor(t=32){super(64,t,8,!1),this.A=kn[0]|0,this.B=kn[1]|0,this.C=kn[2]|0,this.D=kn[3]|0,this.E=kn[4]|0,this.F=kn[5]|0,this.G=kn[6]|0,this.H=kn[7]|0}get(){const{A:t,B:n,C:r,D:o,E:s,F:i,G:l,H:a}=this;return[t,n,r,o,s,i,l,a]}set(t,n,r,o,s,i,l,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=l|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=Kt(p,7)^Kt(p,18)^p>>>3,b=Kt(d,17)^Kt(d,19)^d>>>10;Mn[f]=b+Mn[f-7]+h+Mn[f-16]|0}let{A:r,B:o,C:s,D:i,E:l,F:a,G:c,H:u}=this;for(let f=0;f<64;f++){const p=Kt(l,6)^Kt(l,11)^Kt(l,25),d=u+p+oy(l,a,c)+ay[f]+Mn[f]|0,b=(Kt(r,2)^Kt(r,13)^Kt(r,22))+sy(r,o,s)|0;u=c,c=a,a=l,l=i+d|0,i=s,s=o,o=r,r=d+b|0}r=r+this.A|0,o=o+this.B|0,s=s+this.C|0,i=i+this.D|0,l=l+this.E|0,a=a+this.F|0,c=c+this.G|0,u=u+this.H|0,this.set(r,o,s,i,l,a,c,u)}roundClean(){Er(Mn)}destroy(){this.set(0,0,0,0,0,0,0,0),Er(this.buffer)}}const Of=Fu(()=>new ly),cy=Of;function uy(e,t){return cy(Mt(e,{strict:!1})?vr(e):e)}function fy(e){const{commitment:t,version:n=1}=e,r=e.to??(typeof t=="string"?"hex":"bytes"),o=uy(t);return o.set([n],0),r==="bytes"?o:ke(o)}function dy(e){const{commitments:t,version:n}=e,r=e.to,o=[];for(const s of t)o.push(fy({commitment:s,to:r,version:n}));return o}const If=6,$f=32,Sa=4096,kf=$f*Sa,Mf=kf*If-1-1*Sa*If;class py extends V{constructor({maxSize:t,size:n}){super("Blob size is too large.",{metaMessages:[`Max: ${t} bytes`,`Given: ${n} bytes`],name:"BlobSizeTooLargeError"})}}class hy extends V{constructor(){super("Blob data must not be empty.",{name:"EmptyBlobError"})}}function my(e){const t=typeof e.data=="string"?qt(e.data):e.data,n=Te(t);if(!n)throw new hy;if(n>Mf)throw new py({maxSize:Mf,size:n});const r=[];let o=!0,s=0;for(;o;){const i=oa(new Uint8Array(kf));let l=0;for(;l<Sa;){const a=t.slice(s,s+($f-1));if(i.pushByte(0),i.pushBytes(a),a.length<31){i.pushByte(128),o=!1;break}l++,s+=31}r.push(i)}return r.map(i=>ke(i.bytes))}function by(e){const{data:t,kzg:n,to:r}=e,o=e.blobs??my({data:t}),s=e.commitments??Nf({blobs:o,kzg:n,to:r}),i=e.proofs??Cf({blobs:o,commitments:s,kzg:n,to:r}),l=[];for(let a=0;a<o.length;a++)l.push({blob:o[a],commitment:s[a],proof:i[a]});return l}function gy(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 kg({transaction:e})}function yy(e,{docsPath:t,...n}){const r=(()=>{const o=Os(e,n);return o instanceof Do?e:o})();return new Mg(r,{docsPath:t,...n})}async function Pa(e){const t=await e.request({method:"eth_chainId"},{dedupe:!0});return ln(t)}async function Df(e,t){var m,v,S,$,I;const{account:n=e.account,accessList:r,authorizationList:o,chain:s=e.chain,blobVersionedHashes:i,blobs:l,data:a,gas:c,gasPrice:u,maxFeePerBlobGas:f,maxFeePerGas:p,maxPriorityFeePerGas:d,nonce:h,nonceManager:b,to:w,type:P,value:x,...E}=t,A=await(async()=>{if(!n||!b||typeof h<"u")return h;const C=ft(n),M=s?s.id:await te(e,Pa,"getChainId")({});return await b.consume({address:C.address,chainId:M,client:e})})();Or(t);const D=(v=(m=s==null?void 0:s.formatters)==null?void 0:m.transactionRequest)==null?void 0:v.format,F=(D||Bo)({...Is(E,{format:D}),account:n?ft(n):void 0,accessList:r,authorizationList:o,blobs:l,blobVersionedHashes:i,data:a,gas:c,gasPrice:u,maxFeePerBlobGas:f,maxFeePerGas:p,maxPriorityFeePerGas:d,nonce:A,to:w,type:P,value:x},"fillTransaction");try{const C=await e.request({method:"eth_fillTransaction",params:[F]}),y=((($=(S=s==null?void 0:s.formatters)==null?void 0:S.transaction)==null?void 0:$.format)||wa)(C.tx);delete y.blockHash,delete y.blockNumber,delete y.r,delete y.s,delete y.transactionIndex,delete y.v,delete y.yParity,y.data=y.input,y.gas&&(y.gas=t.gas??y.gas),y.gasPrice&&(y.gasPrice=t.gasPrice??y.gasPrice),y.maxFeePerBlobGas&&(y.maxFeePerBlobGas=t.maxFeePerBlobGas??y.maxFeePerBlobGas),y.maxFeePerGas&&(y.maxFeePerGas=t.maxFeePerGas??y.maxFeePerGas),y.maxPriorityFeePerGas&&(y.maxPriorityFeePerGas=t.maxPriorityFeePerGas??y.maxPriorityFeePerGas),y.nonce&&(y.nonce=t.nonce??y.nonce);const O=await(async()=>{var R,z;if(typeof((R=s==null?void 0:s.fees)==null?void 0:R.baseFeeMultiplier)=="function"){const _=await te(e,Lt,"getBlock")({});return s.fees.baseFeeMultiplier({block:_,client:e,request:t})}return((z=s==null?void 0:s.fees)==null?void 0:z.baseFeeMultiplier)??1.2})();if(O<1)throw new xf;const T=10**(((I=O.toString().split(".")[1])==null?void 0:I.length)??0),B=R=>R*BigInt(Math.ceil(O*T))/BigInt(T);return y.maxFeePerGas&&!t.maxFeePerGas&&(y.maxFeePerGas=B(y.maxFeePerGas)),y.gasPrice&&!t.gasPrice&&(y.gasPrice=B(y.gasPrice)),{raw:C.raw,transaction:{from:F.from,...y}}}catch(C){throw yy(C,{...t,chain:e.chain})}}const vy=["blobVersionedHashes","chainId","fees","gas","nonce","type"],Bf=new Map,Ta=new Ss(128);async function Lf(e,t){var A,D,L;let n=t;n.account??(n.account=e.account),n.parameters??(n.parameters=vy);const{account:r,chain:o=e.chain,nonceManager:s,parameters:i}=n,l=(()=>{if(typeof(o==null?void 0:o.prepareTransactionRequest)=="function")return{fn:o.prepareTransactionRequest,runAt:["beforeFillTransaction"]};if(Array.isArray(o==null?void 0:o.prepareTransactionRequest))return{fn:o.prepareTransactionRequest[0],runAt:o.prepareTransactionRequest[1].runAt}})();let a;async function c(){return a||(typeof n.chainId<"u"?n.chainId:o?o.id:(a=await te(e,Pa,"getChainId")({}),a))}const u=r&&ft(r);let f=n.nonce;if(i.includes("nonce")&&typeof f>"u"&&u&&s){const F=await c();f=await s.consume({address:u.address,chainId:F,client:e})}l!=null&&l.fn&&((A=l.runAt)!=null&&A.includes("beforeFillTransaction"))&&(n=await l.fn({...n,chain:o},{phase:"beforeFillTransaction"}),f??(f=n.nonce));const d=((i.includes("blobVersionedHashes")||i.includes("sidecars"))&&n.kzg&&n.blobs||Ta.get(e.uid)===!1||!["fees","gas"].some(m=>i.includes(m))?!1:!!(i.includes("chainId")&&typeof n.chainId!="number"||i.includes("nonce")&&typeof f!="number"||i.includes("fees")&&typeof n.gasPrice!="bigint"&&(typeof n.maxFeePerGas!="bigint"||typeof n.maxPriorityFeePerGas!="bigint")||i.includes("gas")&&typeof n.gas!="bigint"))?await te(e,Df,"fillTransaction")({...n,nonce:f}).then(F=>{const{chainId:m,from:v,gas:S,gasPrice:$,nonce:I,maxFeePerBlobGas:C,maxFeePerGas:M,maxPriorityFeePerGas:y,type:O,...k}=F.transaction;return Ta.set(e.uid,!0),{...n,...v?{from:v}:{},...O&&!n.type?{type:O}:{},...typeof m<"u"?{chainId:m}:{},...typeof S<"u"?{gas:S}:{},...typeof $<"u"?{gasPrice:$}:{},...typeof I<"u"?{nonce:I}:{},...typeof C<"u"&&n.type!=="legacy"&&n.type!=="eip2930"?{maxFeePerBlobGas:C}:{},...typeof M<"u"&&n.type!=="legacy"&&n.type!=="eip2930"?{maxFeePerGas:M}:{},...typeof y<"u"&&n.type!=="legacy"&&n.type!=="eip2930"?{maxPriorityFeePerGas:y}:{},..."nonceKey"in k&&typeof k.nonceKey<"u"?{nonceKey:k.nonceKey}:{}}}).catch(F=>{var S;const m=F;return m.name!=="TransactionExecutionError"||((S=m.walk)==null?void 0:S.call(m,$=>{const I=$;return I.name==="MethodNotFoundRpcError"||I.name==="MethodNotSupportedRpcError"}))&&Ta.set(e.uid,!1),n}):n;f??(f=d.nonce),n={...d,...u?{from:u==null?void 0:u.address}:{},...f?{nonce:f}:{}};const{blobs:h,gas:b,kzg:w,type:P}=n;l!=null&&l.fn&&((D=l.runAt)!=null&&D.includes("beforeFillParameters"))&&(n=await l.fn({...n,chain:o},{phase:"beforeFillParameters"}));let x;async function E(){return x||(x=await te(e,Lt,"getBlock")({blockTag:"latest"}),x)}if(i.includes("nonce")&&typeof f>"u"&&u&&!s&&(n.nonce=await te(e,Af,"getTransactionCount")({address:u.address,blockTag:"pending"})),(i.includes("blobVersionedHashes")||i.includes("sidecars"))&&h&&w){const F=Nf({blobs:h,kzg:w});if(i.includes("blobVersionedHashes")){const m=dy({commitments:F,to:"hex"});n.blobVersionedHashes=m}if(i.includes("sidecars")){const m=Cf({blobs:h,commitments:F,kzg:w}),v=by({blobs:h,commitments:F,proofs:m,to:"hex"});n.sidecars=v}}if(i.includes("chainId")&&(n.chainId=await c()),(i.includes("fees")||i.includes("type"))&&typeof P>"u")try{n.type=gy(n)}catch{let F=Bf.get(e.uid);if(typeof F>"u"){const m=await E();F=typeof(m==null?void 0:m.baseFeePerGas)=="bigint",Bf.set(e.uid,F)}n.type=F?"eip1559":"legacy"}if(i.includes("fees"))if(n.type!=="legacy"&&n.type!=="eip2930"){if(typeof n.maxFeePerGas>"u"||typeof n.maxPriorityFeePerGas>"u"){const F=await E(),{maxFeePerGas:m,maxPriorityFeePerGas:v}=await Ea(e,{block:F,chain:o,request:n});if(typeof n.maxPriorityFeePerGas>"u"&&n.maxFeePerGas&&n.maxFeePerGas<v)throw new Qg({maxPriorityFeePerGas:v});n.maxPriorityFeePerGas=v,n.maxFeePerGas=m}}else{if(typeof n.maxFeePerGas<"u"||typeof n.maxPriorityFeePerGas<"u")throw new va;if(typeof n.gasPrice>"u"){const F=await E(),{gasPrice:m}=await Ea(e,{block:F,chain:o,request:n,type:"legacy"});n.gasPrice=m}}return i.includes("gas")&&typeof b>"u"&&(n.gas=await te(e,Aa,"estimateGas")({...n,account:u,prepare:(u==null?void 0:u.type)==="local"?[]:["blobVersionedHashes"]})),l!=null&&l.fn&&((L=l.runAt)!=null&&L.includes("afterFillParameters"))&&(n=await l.fn({...n,chain:o},{phase:"afterFillParameters"})),Or(n),delete n.parameters,n}async function Aa(e,t){var i,l,a;const{account:n=e.account,prepare:r=!0}=t,o=n?ft(n):void 0,s=(()=>{if(Array.isArray(r))return r;if((o==null?void 0:o.type)!=="local")return["blobVersionedHashes"]})();try{const c=await(async()=>{if(t.to)return t.to;if(t.authorizationList&&t.authorizationList.length>0)return await yf({authorization:t.authorizationList[0]}).catch(()=>{throw new V("`to` is required. Could not infer from `authorizationList`")})})(),{accessList:u,authorizationList:f,blobs:p,blobVersionedHashes:d,blockNumber:h,blockTag:b,data:w,gas:P,gasPrice:x,maxFeePerBlobGas:E,maxFeePerGas:A,maxPriorityFeePerGas:D,nonce:L,value:F,stateOverride:m,...v}=r?await Lf(e,{...t,parameters:s,to:c}):t;if(P&&t.gas!==P)return P;const $=(typeof h=="bigint"?re(h):void 0)||b,I=ya(m);Or(t);const C=(a=(l=(i=e.chain)==null?void 0:i.formatters)==null?void 0:l.transactionRequest)==null?void 0:a.format,y=(C||Bo)({...Is(v,{format:C}),account:o,accessList:u,authorizationList:f,blobs:p,blobVersionedHashes:d,data:w,gasPrice:x,maxFeePerBlobGas:E,maxFeePerGas:A,maxPriorityFeePerGas:D,nonce:L,to:c,value:F},"estimateGas");return BigInt(await e.request({method:"eth_estimateGas",params:I?[y,$??e.experimental_blockTag??"latest",I]:$?[y,$]:[y]}))}catch(c){throw Zg(c,{...t,account:o,chain:e.chain})}}async function wy(e,t){var c;const{abi:n,address:r,args:o,functionName:s,dataSuffix:i=typeof e.dataSuffix=="string"?e.dataSuffix:(c=e.dataSuffix)==null?void 0:c.value,...l}=t,a=vt({abi:n,args:o,functionName:s});try{return await te(e,Aa,"estimateGas")({data:`${a}${i?i.replace("0x",""):""}`,to:r,...l})}catch(u){const f=l.account?ft(l.account):void 0;throw Nr(u,{abi:n,address:r,args:o,docsPath:"/docs/contract/estimateContractGas",functionName:s,sender:f==null?void 0:f.address})}}function Lo(e,t){if(!yt(e,{strict:!1}))throw new On({address:e});if(!yt(t,{strict:!1}))throw new On({address:t});return e.toLowerCase()===t.toLowerCase()}function Zt(e,{args:t,eventName:n}={}){return{...e,blockHash:e.blockHash?e.blockHash:null,blockNumber:e.blockNumber?BigInt(e.blockNumber):null,blockTimestamp:e.blockTimestamp?BigInt(e.blockTimestamp):e.blockTimestamp===null?null:void 0,logIndex:e.logIndex?Number(e.logIndex):null,transactionHash:e.transactionHash?e.transactionHash:null,transactionIndex:e.transactionIndex?Number(e.transactionIndex):null,...n?{args:t,eventName:n}:{}}}const Ff="/docs/contract/decodeEventLog";function $s(e){const{abi:t,data:n,strict:r,topics:o}=e,s=r??!0,[i,...l]=o;if(!i)throw new a1({docsPath:Ff});const a=t.find(P=>P.type==="event"&&i===Es(kt(P)));if(!(a&&"name"in a)||a.type!=="event")throw new l1(i,{docsPath:Ff});const{name:c,inputs:u}=a,f=u==null?void 0:u.some(P=>!("name"in P&&P.name)),p=f?[]:{},d=u.map((P,x)=>[P,x]).filter(([P])=>"indexed"in P&&P.indexed),h=[];for(let P=0;P<d.length;P++){const[x,E]=d[P],A=l[P];if(!A){if(s)throw new qi({abiItem:a,param:x});h.push([x,E]);continue}p[f?E:x.name||E]=xy({param:x,value:A})}const b=u.filter(P=>!("indexed"in P&&P.indexed)),w=s?b:[...h.map(([P])=>P),...b];if(w.length>0){if(n&&n!=="0x")try{const P=lo(w,n);if(P){let x=0;if(!s)for(const[E,A]of h)p[f?A:E.name||A]=P[x++];if(f)for(let E=0;E<u.length;E++)p[E]===void 0&&x<P.length&&(p[E]=P[x++]);else for(let E=0;E<b.length;E++)p[b[E].name]=P[x++]}}catch(P){if(s)throw P instanceof Su||P instanceof rf?new vs({abiItem:a,data:n,params:w,size:Te(n)}):P}else if(s)throw new vs({abiItem:a,data:"0x",params:w,size:0})}return{eventName:c,args:Object.values(p).length>0?p:void 0}}function xy({param:e,value:t}){return e.type==="string"||e.type==="bytes"||e.type==="tuple"||e.type.match(/^(.*)\[(\d+)?\]$/)?t:(lo([e],t)||[])[0]}function Na(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]})(),i=t.filter(l=>l.type==="event").map(l=>({abi:l,selector:Es(l)}));return r.map(l=>{var p;const a=typeof l.blockNumber=="string"?Zt(l):l,c=i.filter(d=>a.topics[0]===d.selector);if(c.length===0)return null;let u,f;for(const d of c)try{u=$s({...a,abi:[d.abi],strict:!0}),f=d;break}catch{}if(!u&&!o){f=c[0];try{u=$s({data:a.data,topics:a.topics,abi:[f.abi],strict:!1})}catch{const d=(p=f.abi.inputs)==null?void 0:p.some(h=>!("name"in h&&h.name));return{...a,args:d?[]:{},eventName:f.abi.name}}}return!u||!f||s&&!s.includes(u.eventName)||!Ey({args:u.args,inputs:f.abi.inputs,matchArgs:n})?null:{...u,...a}}).filter(Boolean)}function Ey(e){const{args:t,inputs:n,matchArgs:r}=e;if(!r)return!0;if(!t)return!1;function o(s,i,l){try{return s.type==="address"?Lo(i,l):s.type==="string"||s.type==="bytes"?je(vr(i))===l:i===l}catch{return!1}}return Array.isArray(t)&&Array.isArray(r)?r.every((s,i)=>{if(s==null)return!0;const l=n[i];return l?(Array.isArray(s)?s:[s]).some(c=>o(l,c,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 l=n.find(c=>c.name===s);return l?(Array.isArray(i)?i:[i]).some(c=>o(l,c,t[s])):!1}):!1}async function Ca(e,{address:t,blockHash:n,fromBlock:r,toBlock:o,event:s,events:i,args:l,strict:a}={}){const c=a??!1,u=i??(s?[s]:void 0);let f=[];u&&(f=[u.flatMap(b=>ao({abi:[b],eventName:b.name,args:i?void 0:l}))],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"?re(r):r,toBlock:typeof o=="bigint"?re(o):o}]});const d=p.map(h=>Zt(h));return u?Na({abi:u,args:l,logs:d,strict:c}):d}async function Rf(e,t){const{abi:n,address:r,args:o,blockHash:s,eventName:i,fromBlock:l,toBlock:a,strict:c}=t,u=i?Yn({abi:n,name:i}):void 0,f=u?void 0:n.filter(p=>p.type==="event");return te(e,Ca,"getLogs")({address:r,args:o,blockHash:s,event:u,events:f,fromBlock:l,toBlock:a,strict:c})}const Oa="/docs/contract/decodeFunctionResult";function Dn(e){const{abi:t,args:n,functionName:r,data:o}=e;let s=t[0];if(r){const l=Yn({abi:t,args:n,name:r});if(!l)throw new gr(r,{docsPath:Oa});s=l}if(s.type!=="function")throw new gr(void 0,{docsPath:Oa});if(!s.outputs)throw new Nu(s.name,{docsPath:Oa});const i=lo(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 Ia=BigInt(0),$a=BigInt(1);function Fo(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array"}function ka(e){if(!Fo(e))throw new Error("Uint8Array expected")}function Ro(e,t){if(typeof t!="boolean")throw new Error(e+" boolean expected, got "+t)}function ks(e){const t=e.toString(16);return t.length&1?"0"+t:t}function jf(e){if(typeof e!="string")throw new Error("hex string expected, got "+typeof e);return e===""?Ia:BigInt("0x"+e)}const zf=typeof Uint8Array.from([]).toHex=="function"&&typeof Uint8Array.fromHex=="function",Sy=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function jo(e){if(ka(e),zf)return e.toHex();let t="";for(let n=0;n<e.length;n++)t+=Sy[e[n]];return t}const dn={_0:48,_9:57,A:65,F:70,a:97,f:102};function Uf(e){if(e>=dn._0&&e<=dn._9)return e-dn._0;if(e>=dn.A&&e<=dn.F)return e-(dn.A-10);if(e>=dn.a&&e<=dn.f)return e-(dn.a-10)}function Ms(e){if(typeof e!="string")throw new Error("hex string expected, got "+typeof e);if(zf)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=Uf(e.charCodeAt(s)),l=Uf(e.charCodeAt(s+1));if(i===void 0||l===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+l}return r}function er(e){return jf(jo(e))}function _f(e){return ka(e),jf(jo(Uint8Array.from(e).reverse()))}function zo(e,t){return Ms(e.toString(16).padStart(t*2,"0"))}function Wf(e,t){return zo(e,t).reverse()}function wt(e,t,n){let r;if(typeof t=="string")try{r=Ms(t)}catch(s){throw new Error(e+" must be hex string or Uint8Array, cause: "+s)}else if(Fo(t))r=Uint8Array.from(t);else throw new Error(e+" must be hex string or Uint8Array");const o=r.length;if(typeof n=="number"&&o!==n)throw new Error(e+" of length "+n+" expected, got "+o);return r}function Ds(...e){let t=0;for(let r=0;r<e.length;r++){const o=e[r];ka(o),t+=o.length}const n=new Uint8Array(t);for(let r=0,o=0;r<e.length;r++){const s=e[r];n.set(s,o),o+=s.length}return n}const Ma=e=>typeof e=="bigint"&&Ia<=e;function Da(e,t,n){return Ma(e)&&Ma(t)&&Ma(n)&&t<=e&&e<n}function Ir(e,t,n,r){if(!Da(t,n,r))throw new Error("expected valid "+e+": "+n+" <= n < "+r+", got "+t)}function Py(e){let t;for(t=0;e>Ia;e>>=$a,t+=1);return t}const Bs=e=>($a<<BigInt(e))-$a,Ba=e=>new Uint8Array(e),Vf=e=>Uint8Array.from(e);function Ty(e,t,n){if(typeof e!="number"||e<2)throw new Error("hashLen must be a number");if(typeof t!="number"||t<2)throw new Error("qByteLen must be a number");if(typeof n!="function")throw new Error("hmacFn must be a function");let r=Ba(e),o=Ba(e),s=0;const i=()=>{r.fill(1),o.fill(0),s=0},l=(...f)=>n(o,r,...f),a=(f=Ba(0))=>{o=l(Vf([0]),f),r=l(),f.length!==0&&(o=l(Vf([1]),f),r=l())},c=()=>{if(s++>=1e3)throw new Error("drbg: tried 1000 values");let f=0;const p=[];for(;f<t;){r=l();const d=r.slice();p.push(d),f+=r.length}return Ds(...p)};return(f,p)=>{i(),a(f);let d;for(;!(d=p(c()));)a();return i(),d}}const Ay={bigint:e=>typeof e=="bigint",function:e=>typeof e=="function",boolean:e=>typeof e=="boolean",string:e=>typeof e=="string",stringOrUint8Array:e=>typeof e=="string"||Fo(e),isSafeInteger:e=>Number.isSafeInteger(e),array:e=>Array.isArray(e),field:(e,t)=>t.Fp.isValid(e),hash:e=>typeof e=="function"&&Number.isSafeInteger(e.outputLen)};function Ls(e,t,n={}){const r=(o,s,i)=>{const l=Ay[s];if(typeof l!="function")throw new Error("invalid validator function");const a=e[o];if(!(i&&a===void 0)&&!l(a,e))throw new Error("param "+String(o)+" is invalid. Expected "+s+", got "+a)};for(const[o,s]of Object.entries(t))r(o,s,!1);for(const[o,s]of Object.entries(n))r(o,s,!0);return e}function Hf(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 Ny="0.1.1";function Cy(){return Ny}class oe extends Error{static setStaticOptions(t){oe.prototype.docsOrigin=t.docsOrigin,oe.prototype.showVersion=t.showVersion,oe.prototype.version=t.version}constructor(t,n={}){const r=(()=>{var u;if(n.cause instanceof oe){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:(u=n.cause)!=null&&u.message?n.cause.message:n.details})(),o=n.cause instanceof oe&&n.cause.docsPath||n.docsPath,s=n.docsOrigin??oe.prototype.docsOrigin,i=`${s}${o??""}`,l=!!(n.version??oe.prototype.showVersion),a=n.version??oe.prototype.version,c=[t||"An error occurred.",...n.metaMessages?["",...n.metaMessages]:[],...r||o||l?["",r?`Details: ${r}`:void 0,o?`See: ${i}`:void 0,l?`Version: ${a}`:void 0]:[]].filter(u=>typeof u=="string").join(`
88
- `);super(c,n.cause?{cause:n.cause}:void 0),Object.defineProperty(this,"details",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docs",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docsOrigin",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docsPath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"shortMessage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"showVersion",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"version",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"BaseError"}),this.cause=n.cause,this.details=r,this.docs=i,this.docsOrigin=s,this.docsPath=o,this.shortMessage=t,this.showVersion=l,this.version=a}walk(t){return Gf(this,t)}}Object.defineProperty(oe,"defaultStaticOptions",{enumerable:!0,configurable:!0,writable:!0,value:{docsOrigin:"https://oxlib.sh",showVersion:!1,version:`ox@${Cy()}`}}),oe.setStaticOptions(oe.defaultStaticOptions);function Gf(e,t){return t!=null&&t(e)?e:e&&typeof e=="object"&&"cause"in e&&e.cause?Gf(e.cause,t):t?null:e}function Uo(e,t){if($r(e)>t)throw new Hy({givenSize:$r(e),maxSize:t})}const pn={zero:48,nine:57,A:65,F:70,a:97,f:102};function qf(e){if(e>=pn.zero&&e<=pn.nine)return e-pn.zero;if(e>=pn.A&&e<=pn.F)return e-(pn.A-10);if(e>=pn.a&&e<=pn.f)return e-(pn.a-10)}function Oy(e,t={}){const{dir:n,size:r=32}=t;if(r===0)return e;if(e.length>r)throw new Gy({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 Kf(e,t={}){const{dir:n="left"}=t;let r=e,o=0;for(let s=0;s<r.length-1&&r[n==="left"?s:r.length-s-1].toString()==="0";s++)o++;return r=n==="left"?r.slice(o):r.slice(0,r.length-o),r}function Fs(e,t){if(dt(e)>t)throw new Jy({givenSize:dt(e),maxSize:t})}function Iy(e,t){if(typeof t=="number"&&t>0&&t>dt(e)-1)throw new sd({offset:t,position:"start",size:dt(e)})}function $y(e,t,n){if(typeof t=="number"&&typeof n=="number"&&dt(e)!==n-t)throw new sd({offset:n,position:"end",size:dt(e)})}function Zf(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 Qy({size:Math.ceil(o.length/2),targetSize:r,type:"Hex"});return`0x${o[n==="right"?"padEnd":"padStart"](r*2,"0")}`}const ky="#__bigint";function Yf(e,t,n){return JSON.stringify(e,(r,o)=>typeof o=="bigint"?o.toString()+ky:o,n)}const My=new TextDecoder,Dy=new TextEncoder;function By(e){return e instanceof Uint8Array?e:typeof e=="string"?Xf(e):Ly(e)}function Ly(e){return e instanceof Uint8Array?e:new Uint8Array(e)}function Xf(e,t={}){const{size:n}=t;let r=e;n&&(Fs(e,n),r=nr(e,n));let o=r.slice(2);o.length%2&&(o=`0${o}`);const s=o.length/2,i=new Uint8Array(s);for(let l=0,a=0;l<s;l++){const c=qf(o.charCodeAt(a++)),u=qf(o.charCodeAt(a++));if(c===void 0||u===void 0)throw new oe(`Invalid byte sequence ("${o[a-2]}${o[a-1]}" in "${o}").`);i[l]=c<<4|u}return i}function Fy(e,t={}){const{size:n}=t,r=Dy.encode(e);return typeof n=="number"?(Uo(r,n),Ry(r,n)):r}function Ry(e,t){return Oy(e,{dir:"right",size:t})}function $r(e){return e.length}function jy(e,t,n,r={}){const{strict:o}=r;return e.slice(t,n)}function zy(e,t={}){const{size:n}=t;typeof n<"u"&&Uo(e,n);const r=Rt(e,t);return ed(r,t)}function Uy(e,t={}){const{size:n}=t;let r=e;if(typeof n<"u"&&(Uo(r,n),r=Jf(r)),r.length>1||r[0]>1)throw new Vy(r);return!!r[0]}function hn(e,t={}){const{size:n}=t;typeof n<"u"&&Uo(e,n);const r=Rt(e,t);return td(r,t)}function _y(e,t={}){const{size:n}=t;let r=e;return typeof n<"u"&&(Uo(r,n),r=Wy(r)),My.decode(r)}function Jf(e){return Kf(e,{dir:"left"})}function Wy(e){return Kf(e,{dir:"right"})}class Vy extends oe{constructor(t){super(`Bytes value \`${t}\` is not a valid boolean.`,{metaMessages:["The bytes array must contain a single byte of either a `0` or `1` value."]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Bytes.InvalidBytesBooleanError"})}}let Hy=class extends oe{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"})}},Gy=class extends oe{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 qy=new TextEncoder,Ky=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function Zy(e,t={}){const{strict:n=!1}=t;if(!e)throw new rd(e);if(typeof e!="string")throw new rd(e);if(n&&!/^0x[0-9a-fA-F]*$/.test(e))throw new od(e);if(!e.startsWith("0x"))throw new od(e)}function Ft(...e){return`0x${e.reduce((t,n)=>t+n.replace("0x",""),"")}`}function Yy(e){return e instanceof Uint8Array?Rt(e):Array.isArray(e)?Rt(new Uint8Array(e)):e}function Qf(e,t={}){const n=`0x${Number(e)}`;return typeof t.size=="number"?(Fs(n,t.size),tr(n,t.size)):n}function Rt(e,t={}){let n="";for(let o=0;o<e.length;o++)n+=Ky[e[o]];const r=`0x${n}`;return typeof t.size=="number"?(Fs(r,t.size),nr(r,t.size)):r}function Ve(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 c=typeof e=="bigint"?"n":"";throw new nd({max:s?`${s}${c}`:void 0,min:`${i}${c}`,signed:n,size:r,value:`${e}${c}`})}const a=`0x${(n&&o<0?BigInt.asUintN(r*8,BigInt(o)):o).toString(16)}`;return r?tr(a,r):a}function La(e,t={}){return Rt(qy.encode(e),t)}function tr(e,t){return Zf(e,{dir:"left",size:t})}function nr(e,t){return Zf(e,{dir:"right",size:t})}function Yt(e,t,n,r={}){const{strict:o}=r;Iy(e,t);const s=`0x${e.replace("0x","").slice((t??0)*2,(n??e.length)*2)}`;return o&&$y(s,t,n),s}function dt(e){return Math.ceil((e.length-2)/2)}function ed(e,t={}){const{signed:n}=t;t.size&&Fs(e,t.size);const r=BigInt(e);if(!n)return r;const o=(e.length-2)/2,s=(1n<<BigInt(o)*8n)-1n,i=s>>1n;return r<=i?r:r-s-1n}function td(e,t={}){const{signed:n,size:r}=t;return Number(!n&&!r?e:ed(e,t))}function Xy(e,t={}){const{strict:n=!1}=t;try{return Zy(e,{strict:n}),!0}catch{return!1}}class nd extends oe{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 rd extends oe{constructor(t){super(`Value \`${typeof t=="object"?Yf(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 od extends oe{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 Jy extends oe{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 sd extends oe{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 Qy extends oe{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 ev(e){return{address:e.address,amount:Ve(e.amount),index:Ve(e.index),validatorIndex:Ve(e.validatorIndex)}}function id(e){return{...typeof e.baseFeePerGas=="bigint"&&{baseFeePerGas:Ve(e.baseFeePerGas)},...typeof e.blobBaseFee=="bigint"&&{blobBaseFee:Ve(e.blobBaseFee)},...typeof e.feeRecipient=="string"&&{feeRecipient:e.feeRecipient},...typeof e.gasLimit=="bigint"&&{gasLimit:Ve(e.gasLimit)},...typeof e.number=="bigint"&&{number:Ve(e.number)},...typeof e.prevRandao=="bigint"&&{prevRandao:Ve(e.prevRandao)},...typeof e.time=="bigint"&&{time:Ve(e.time)},...e.withdrawals&&{withdrawals:e.withdrawals.map(ev)}}}const kr=[{inputs:[{components:[{name:"target",type:"address"},{name:"allowFailure",type:"bool"},{name:"callData",type:"bytes"}],name:"calls",type:"tuple[]"}],name:"aggregate3",outputs:[{components:[{name:"success",type:"bool"},{name:"returnData",type:"bytes"}],name:"returnData",type:"tuple[]"}],stateMutability:"view",type:"function"},{inputs:[{name:"addr",type:"address"}],name:"getEthBalance",outputs:[{name:"balance",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"getCurrentBlockTimestamp",outputs:[{internalType:"uint256",name:"timestamp",type:"uint256"}],stateMutability:"view",type:"function"}],Fa=[{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"}]}],ad=[{inputs:[{name:"dns",type:"bytes"}],name:"DNSDecodingFailed",type:"error"},{inputs:[{name:"ens",type:"string"}],name:"DNSEncodingFailed",type:"error"},{inputs:[],name:"EmptyAddress",type:"error"},{inputs:[{name:"status",type:"uint16"},{name:"message",type:"string"}],name:"HttpError",type:"error"},{inputs:[],name:"InvalidBatchGatewayResponse",type:"error"},{inputs:[{name:"errorData",type:"bytes"}],name:"ResolverError",type:"error"},{inputs:[{name:"name",type:"bytes"},{name:"resolver",type:"address"}],name:"ResolverNotContract",type:"error"},{inputs:[{name:"name",type:"bytes"}],name:"ResolverNotFound",type:"error"},{inputs:[{name:"primary",type:"string"},{name:"primaryAddress",type:"bytes"}],name:"ReverseAddressMismatch",type:"error"},{inputs:[{internalType:"bytes4",name:"selector",type:"bytes4"}],name:"UnsupportedResolverProfile",type:"error"}],ld=[...ad,{name:"resolveWithGateways",type:"function",stateMutability:"view",inputs:[{name:"name",type:"bytes"},{name:"data",type:"bytes"},{name:"gateways",type:"string[]"}],outputs:[{name:"",type:"bytes"},{name:"address",type:"address"}]}],tv=[...ad,{name:"reverseWithGateways",type:"function",stateMutability:"view",inputs:[{type:"bytes",name:"reverseName"},{type:"uint256",name:"coinType"},{type:"string[]",name:"gateways"}],outputs:[{type:"string",name:"resolvedName"},{type:"address",name:"resolver"},{type:"address",name:"reverseResolver"}]}],cd=[{name:"text",type:"function",stateMutability:"view",inputs:[{name:"name",type:"bytes32"},{name:"key",type:"string"}],outputs:[{name:"",type:"string"}]}],ud=[{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"}]}],fd=[{name:"isValidSignature",type:"function",stateMutability:"view",inputs:[{name:"hash",type:"bytes32"},{name:"signature",type:"bytes"}],outputs:[{name:"",type:"bytes4"}]}],dd=[{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"}],Mr=[{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"}]}],nv="0x82ad56cb",pd="0x608060405234801561001057600080fd5b5060405161018e38038061018e83398101604081905261002f91610124565b6000808351602085016000f59050803b61004857600080fd5b6000808351602085016000855af16040513d6000823e81610067573d81fd5b3d81f35b634e487b7160e01b600052604160045260246000fd5b600082601f83011261009257600080fd5b81516001600160401b038111156100ab576100ab61006b565b604051601f8201601f19908116603f011681016001600160401b03811182821017156100d9576100d961006b565b6040528181528382016020018510156100f157600080fd5b60005b82811015610110576020818601810151838301820152016100f4565b506000918101602001919091529392505050565b6000806040838503121561013757600080fd5b82516001600160401b0381111561014d57600080fd5b61015985828601610081565b602085015190935090506001600160401b0381111561017757600080fd5b61018385828601610081565b915050925092905056fe",rv="0x608060405234801561001057600080fd5b506040516102c03803806102c083398101604081905261002f916101e6565b836001600160a01b03163b6000036100e457600080836001600160a01b03168360405161005c9190610270565b6000604051808303816000865af19150503d8060008114610099576040519150601f19603f3d011682016040523d82523d6000602084013e61009e565b606091505b50915091508115806100b857506001600160a01b0386163b155b156100e1578060405163101bb98d60e01b81526004016100d8919061028c565b60405180910390fd5b50505b6000808451602086016000885af16040513d6000823e81610103573d81fd5b3d81f35b80516001600160a01b038116811461011e57600080fd5b919050565b634e487b7160e01b600052604160045260246000fd5b60005b8381101561015457818101518382015260200161013c565b50506000910152565b600082601f83011261016e57600080fd5b81516001600160401b0381111561018757610187610123565b604051601f8201601f19908116603f011681016001600160401b03811182821017156101b5576101b5610123565b6040528181528382016020018510156101cd57600080fd5b6101de826020830160208701610139565b949350505050565b600080600080608085870312156101fc57600080fd5b61020585610107565b60208601519094506001600160401b0381111561022157600080fd5b61022d8782880161015d565b93505061023c60408601610107565b60608601519092506001600160401b0381111561025857600080fd5b6102648782880161015d565b91505092959194509250565b60008251610282818460208701610139565b9190910192915050565b60208152600082518060208401526102ab816040850160208701610139565b601f01601f1916919091016040019291505056fe",ov="0x608060405234801561001057600080fd5b5060405161069438038061069483398101604081905261002f9161051e565b600061003c848484610048565b9050806000526001601ff35b60007f64926492649264926492649264926492649264926492649264926492649264926100748361040c565b036101e7576000606080848060200190518101906100929190610577565b60405192955090935091506000906001600160a01b038516906100b69085906105dd565b6000604051808303816000865af19150503d80600081146100f3576040519150601f19603f3d011682016040523d82523d6000602084013e6100f8565b606091505b50509050876001600160a01b03163b60000361016057806101605760405162461bcd60e51b815260206004820152601e60248201527f5369676e617475726556616c696461746f723a206465706c6f796d656e74000060448201526064015b60405180910390fd5b604051630b135d3f60e11b808252906001600160a01b038a1690631626ba7e90610190908b9087906004016105f9565b602060405180830381865afa1580156101ad573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101d19190610633565b6001600160e01b03191614945050505050610405565b6001600160a01b0384163b1561027a57604051630b135d3f60e11b808252906001600160a01b03861690631626ba7e9061022790879087906004016105f9565b602060405180830381865afa158015610244573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102689190610633565b6001600160e01b031916149050610405565b81516041146102df5760405162461bcd60e51b815260206004820152603a602482015260008051602061067483398151915260448201527f3a20696e76616c6964207369676e6174757265206c656e6774680000000000006064820152608401610157565b6102e7610425565b5060208201516040808401518451859392600091859190811061030c5761030c61065d565b016020015160f81c9050601b811480159061032b57508060ff16601c14155b1561038c5760405162461bcd60e51b815260206004820152603b602482015260008051602061067483398151915260448201527f3a20696e76616c6964207369676e617475726520762076616c756500000000006064820152608401610157565b60408051600081526020810180835289905260ff83169181019190915260608101849052608081018390526001600160a01b0389169060019060a0016020604051602081039080840390855afa1580156103ea573d6000803e3d6000fd5b505050602060405103516001600160a01b0316149450505050505b9392505050565b600060208251101561041d57600080fd5b508051015190565b60405180606001604052806003906020820280368337509192915050565b6001600160a01b038116811461045857600080fd5b50565b634e487b7160e01b600052604160045260246000fd5b60005b8381101561048c578181015183820152602001610474565b50506000910152565b600082601f8301126104a657600080fd5b81516001600160401b038111156104bf576104bf61045b565b604051601f8201601f19908116603f011681016001600160401b03811182821017156104ed576104ed61045b565b60405281815283820160200185101561050557600080fd5b610516826020830160208701610471565b949350505050565b60008060006060848603121561053357600080fd5b835161053e81610443565b6020850151604086015191945092506001600160401b0381111561056157600080fd5b61056d86828701610495565b9150509250925092565b60008060006060848603121561058c57600080fd5b835161059781610443565b60208501519093506001600160401b038111156105b357600080fd5b6105bf86828701610495565b604086015190935090506001600160401b0381111561056157600080fd5b600082516105ef818460208701610471565b9190910192915050565b828152604060208201526000825180604084015261061e816060850160208701610471565b601f01601f1916919091016060019392505050565b60006020828403121561064557600080fd5b81516001600160e01b03198116811461040557600080fd5b634e487b7160e01b600052603260045260246000fdfe5369676e617475726556616c696461746f72237265636f7665725369676e6572",Ra="0x608060405234801561001057600080fd5b506115b9806100206000396000f3fe6080604052600436106100f35760003560e01c80634d2301cc1161008a578063a8b0574e11610059578063a8b0574e14610325578063bce38bd714610350578063c3077fa914610380578063ee82ac5e146103b2576100f3565b80634d2301cc1461026257806372425d9d1461029f57806382ad56cb146102ca57806386d516e8146102fa576100f3565b80633408e470116100c65780633408e470146101af578063399542e9146101da5780633e64a6961461020c57806342cbb15c14610237576100f3565b80630f28c97d146100f8578063174dea7114610123578063252dba421461015357806327e86d6e14610184575b600080fd5b34801561010457600080fd5b5061010d6103ef565b60405161011a9190610c0a565b60405180910390f35b61013d60048036038101906101389190610c94565b6103f7565b60405161014a9190610e94565b60405180910390f35b61016d60048036038101906101689190610f0c565b610615565b60405161017b92919061101b565b60405180910390f35b34801561019057600080fd5b506101996107ab565b6040516101a69190611064565b60405180910390f35b3480156101bb57600080fd5b506101c46107b7565b6040516101d19190610c0a565b60405180910390f35b6101f460048036038101906101ef91906110ab565b6107bf565b6040516102039392919061110b565b60405180910390f35b34801561021857600080fd5b506102216107e1565b60405161022e9190610c0a565b60405180910390f35b34801561024357600080fd5b5061024c6107e9565b6040516102599190610c0a565b60405180910390f35b34801561026e57600080fd5b50610289600480360381019061028491906111a7565b6107f1565b6040516102969190610c0a565b60405180910390f35b3480156102ab57600080fd5b506102b4610812565b6040516102c19190610c0a565b60405180910390f35b6102e460048036038101906102df919061122a565b61081a565b6040516102f19190610e94565b60405180910390f35b34801561030657600080fd5b5061030f6109e4565b60405161031c9190610c0a565b60405180910390f35b34801561033157600080fd5b5061033a6109ec565b6040516103479190611286565b60405180910390f35b61036a600480360381019061036591906110ab565b6109f4565b6040516103779190610e94565b60405180910390f35b61039a60048036038101906103959190610f0c565b610ba6565b6040516103a99392919061110b565b60405180910390f35b3480156103be57600080fd5b506103d960048036038101906103d491906112cd565b610bca565b6040516103e69190611064565b60405180910390f35b600042905090565b60606000808484905090508067ffffffffffffffff81111561041c5761041b6112fa565b5b60405190808252806020026020018201604052801561045557816020015b610442610bd5565b81526020019060019003908161043a5790505b5092503660005b828110156105c957600085828151811061047957610478611329565b5b6020026020010151905087878381811061049657610495611329565b5b90506020028101906104a89190611367565b925060008360400135905080860195508360000160208101906104cb91906111a7565b73ffffffffffffffffffffffffffffffffffffffff16818580606001906104f2919061138f565b604051610500929190611431565b60006040518083038185875af1925050503d806000811461053d576040519150601f19603f3d011682016040523d82523d6000602084013e610542565b606091505b5083600001846020018290528215151515815250505081516020850135176105bc577f08c379a000000000000000000000000000000000000000000000000000000000600052602060045260176024527f4d756c746963616c6c333a2063616c6c206661696c656400000000000000000060445260846000fd5b826001019250505061045c565b5082341461060c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610603906114a7565b60405180910390fd5b50505092915050565b6000606043915060008484905090508067ffffffffffffffff81111561063e5761063d6112fa565b5b60405190808252806020026020018201604052801561067157816020015b606081526020019060019003908161065c5790505b5091503660005b828110156107a157600087878381811061069557610694611329565b5b90506020028101906106a791906114c7565b92508260000160208101906106bc91906111a7565b73ffffffffffffffffffffffffffffffffffffffff168380602001906106e2919061138f565b6040516106f0929190611431565b6000604051808303816000865af19150503d806000811461072d576040519150601f19603f3d011682016040523d82523d6000602084013e610732565b606091505b5086848151811061074657610745611329565b5b60200260200101819052819250505080610795576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161078c9061153b565b60405180910390fd5b81600101915050610678565b5050509250929050565b60006001430340905090565b600046905090565b6000806060439250434091506107d68686866109f4565b905093509350939050565b600048905090565b600043905090565b60008173ffffffffffffffffffffffffffffffffffffffff16319050919050565b600044905090565b606060008383905090508067ffffffffffffffff81111561083e5761083d6112fa565b5b60405190808252806020026020018201604052801561087757816020015b610864610bd5565b81526020019060019003908161085c5790505b5091503660005b828110156109db57600084828151811061089b5761089a611329565b5b602002602001015190508686838181106108b8576108b7611329565b5b90506020028101906108ca919061155b565b92508260000160208101906108df91906111a7565b73ffffffffffffffffffffffffffffffffffffffff16838060400190610905919061138f565b604051610913929190611431565b6000604051808303816000865af19150503d8060008114610950576040519150601f19603f3d011682016040523d82523d6000602084013e610955565b606091505b5082600001836020018290528215151515815250505080516020840135176109cf577f08c379a000000000000000000000000000000000000000000000000000000000600052602060045260176024527f4d756c746963616c6c333a2063616c6c206661696c656400000000000000000060445260646000fd5b8160010191505061087e565b50505092915050565b600045905090565b600041905090565b606060008383905090508067ffffffffffffffff811115610a1857610a176112fa565b5b604051908082528060200260200182016040528015610a5157816020015b610a3e610bd5565b815260200190600190039081610a365790505b5091503660005b82811015610b9c576000848281518110610a7557610a74611329565b5b60200260200101519050868683818110610a9257610a91611329565b5b9050602002810190610aa491906114c7565b9250826000016020810190610ab991906111a7565b73ffffffffffffffffffffffffffffffffffffffff16838060200190610adf919061138f565b604051610aed929190611431565b6000604051808303816000865af19150503d8060008114610b2a576040519150601f19603f3d011682016040523d82523d6000602084013e610b2f565b606091505b508260000183602001829052821515151581525050508715610b90578060000151610b8f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b869061153b565b60405180910390fd5b5b81600101915050610a58565b5050509392505050565b6000806060610bb7600186866107bf565b8093508194508295505050509250925092565b600081409050919050565b6040518060400160405280600015158152602001606081525090565b6000819050919050565b610c0481610bf1565b82525050565b6000602082019050610c1f6000830184610bfb565b92915050565b600080fd5b600080fd5b600080fd5b600080fd5b600080fd5b60008083601f840112610c5457610c53610c2f565b5b8235905067ffffffffffffffff811115610c7157610c70610c34565b5b602083019150836020820283011115610c8d57610c8c610c39565b5b9250929050565b60008060208385031215610cab57610caa610c25565b5b600083013567ffffffffffffffff811115610cc957610cc8610c2a565b5b610cd585828601610c3e565b92509250509250929050565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b60008115159050919050565b610d2281610d0d565b82525050565b600081519050919050565b600082825260208201905092915050565b60005b83811015610d62578082015181840152602081019050610d47565b83811115610d71576000848401525b50505050565b6000601f19601f8301169050919050565b6000610d9382610d28565b610d9d8185610d33565b9350610dad818560208601610d44565b610db681610d77565b840191505092915050565b6000604083016000830151610dd96000860182610d19565b5060208301518482036020860152610df18282610d88565b9150508091505092915050565b6000610e0a8383610dc1565b905092915050565b6000602082019050919050565b6000610e2a82610ce1565b610e348185610cec565b935083602082028501610e4685610cfd565b8060005b85811015610e825784840389528151610e638582610dfe565b9450610e6e83610e12565b925060208a01995050600181019050610e4a565b50829750879550505050505092915050565b60006020820190508181036000830152610eae8184610e1f565b905092915050565b60008083601f840112610ecc57610ecb610c2f565b5b8235905067ffffffffffffffff811115610ee957610ee8610c34565b5b602083019150836020820283011115610f0557610f04610c39565b5b9250929050565b60008060208385031215610f2357610f22610c25565b5b600083013567ffffffffffffffff811115610f4157610f40610c2a565b5b610f4d85828601610eb6565b92509250509250929050565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b6000610f918383610d88565b905092915050565b6000602082019050919050565b6000610fb182610f59565b610fbb8185610f64565b935083602082028501610fcd85610f75565b8060005b858110156110095784840389528151610fea8582610f85565b9450610ff583610f99565b925060208a01995050600181019050610fd1565b50829750879550505050505092915050565b60006040820190506110306000830185610bfb565b81810360208301526110428184610fa6565b90509392505050565b6000819050919050565b61105e8161104b565b82525050565b60006020820190506110796000830184611055565b92915050565b61108881610d0d565b811461109357600080fd5b50565b6000813590506110a58161107f565b92915050565b6000806000604084860312156110c4576110c3610c25565b5b60006110d286828701611096565b935050602084013567ffffffffffffffff8111156110f3576110f2610c2a565b5b6110ff86828701610eb6565b92509250509250925092565b60006060820190506111206000830186610bfb565b61112d6020830185611055565b818103604083015261113f8184610e1f565b9050949350505050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b600061117482611149565b9050919050565b61118481611169565b811461118f57600080fd5b50565b6000813590506111a18161117b565b92915050565b6000602082840312156111bd576111bc610c25565b5b60006111cb84828501611192565b91505092915050565b60008083601f8401126111ea576111e9610c2f565b5b8235905067ffffffffffffffff81111561120757611206610c34565b5b60208301915083602082028301111561122357611222610c39565b5b9250929050565b6000806020838503121561124157611240610c25565b5b600083013567ffffffffffffffff81111561125f5761125e610c2a565b5b61126b858286016111d4565b92509250509250929050565b61128081611169565b82525050565b600060208201905061129b6000830184611277565b92915050565b6112aa81610bf1565b81146112b557600080fd5b50565b6000813590506112c7816112a1565b92915050565b6000602082840312156112e3576112e2610c25565b5b60006112f1848285016112b8565b91505092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b600080fd5b600080fd5b600080fd5b60008235600160800383360303811261138357611382611358565b5b80830191505092915050565b600080833560016020038436030381126113ac576113ab611358565b5b80840192508235915067ffffffffffffffff8211156113ce576113cd61135d565b5b6020830192506001820236038313156113ea576113e9611362565b5b509250929050565b600081905092915050565b82818337600083830152505050565b600061141883856113f2565b93506114258385846113fd565b82840190509392505050565b600061143e82848661140c565b91508190509392505050565b600082825260208201905092915050565b7f4d756c746963616c6c333a2076616c7565206d69736d61746368000000000000600082015250565b6000611491601a8361144a565b915061149c8261145b565b602082019050919050565b600060208201905081810360008301526114c081611484565b9050919050565b6000823560016040038336030381126114e3576114e2611358565b5b80830191505092915050565b7f4d756c746963616c6c333a2063616c6c206661696c6564000000000000000000600082015250565b600061152560178361144a565b9150611530826114ef565b602082019050919050565b6000602082019050818103600083015261155481611518565b9050919050565b60008235600160600383360303811261157757611576611358565b5b8083019150509291505056fea264697066735822122020c1bc9aacf8e4a6507193432a895a8e77094f45a1395583f07b24e860ef06cd64736f6c634300080c0033";class ja extends V{constructor({blockNumber:t,chain:n,contract:r}){super(`Chain "${n.name}" does not support contract "${r.name}".`,{metaMessages:["This could be due to any of the following:",...t&&r.blockCreated&&r.blockCreated>t?[`- The contract "${r.name}" was not deployed until block ${r.blockCreated} (current block ${t}).`]:[`- The chain does not have the contract "${r.name}" configured.`]],name:"ChainDoesNotSupportContract"})}}class hd extends V{constructor(){super("No chain was provided to the Client.",{name:"ClientChainNotConfiguredError"})}}const za="/docs/contract/encodeDeployData";function Ua(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 n1({docsPath:za});if(!("inputs"in o))throw new Eu({docsPath:za});if(!o.inputs||o.inputs.length===0)throw new Eu({docsPath:za});const s=In(o.inputs,n);return Sr([r,s])}function Dr({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 ja({chain:t,contract:{name:n}});if(e&&r.blockCreated&&r.blockCreated>e)throw new ja({blockNumber:e,chain:t,contract:{name:n,blockCreated:r.blockCreated}});return r.address}function md(e,{docsPath:t,...n}){const r=(()=>{const o=Os(e,n);return o instanceof Do?e:o})();return new ff(r,{docsPath:t,...n})}function bd(){let e=()=>{},t=()=>{};return{promise:new Promise((r,o)=>{e=r,t=o}),resolve:e,reject:t}}const _a=new Map;function gd({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=()=>_a.delete(t),l=()=>a().map(({args:u})=>u),a=()=>_a.get(t)||[],c=u=>_a.set(t,[...a(),u]);return{flush:i,async schedule(u){const{promise:f,resolve:p,reject:d}=bd();return(n==null?void 0:n([...l(),u]))&&s(),a().length>0?(c({args:u,resolve:p,reject:d}),f):(c({args:u,resolve:p,reject:d}),setTimeout(s,r),f)}}}async function Br(e,t){var C,M,y,O;const{account:n=e.account,authorizationList:r,batch:o=!!((C=e.batch)!=null&&C.multicall),blockNumber:s,blockTag:i=e.experimental_blockTag??"latest",accessList:l,blobs:a,blockOverrides:c,code:u,data:f,factory:p,factoryData:d,gas:h,gasPrice:b,maxFeePerBlobGas:w,maxFeePerGas:P,maxPriorityFeePerGas:x,nonce:E,to:A,value:D,stateOverride:L,...F}=t,m=n?ft(n):void 0;if(u&&(p||d))throw new V("Cannot provide both `code` & `factory`/`factoryData` as parameters.");if(u&&A)throw new V("Cannot provide both `code` & `to` as parameters.");const v=u&&f,S=p&&d&&A&&f,$=v||S,I=v?yd({code:u,data:f}):S?av({data:f,factory:p,factoryData:d,to:A}):f;try{Or(t);const T=(typeof s=="bigint"?re(s):void 0)||i,B=c?id(c):void 0,R=ya(L),z=(O=(y=(M=e.chain)==null?void 0:M.formatters)==null?void 0:y.transactionRequest)==null?void 0:O.format,G=(z||Bo)({...Is(F,{format:z}),accessList:l,account:m,authorizationList:r,blobs:a,data:I,gas:h,gasPrice:b,maxFeePerBlobGas:w,maxFeePerGas:P,maxPriorityFeePerGas:x,nonce:E,to:$?void 0:A,value:D},"call");if(o&&sv({request:G})&&!R&&!B)try{return await iv(e,{...G,blockNumber:s,blockTag:i})}catch(W){if(!(W instanceof hd)&&!(W instanceof ja))throw W}const J=(()=>{const W=[G,T];return R&&B?[...W,R,B]:R?[...W,R]:B?[...W,{},B]:W})(),K=await e.request({method:"eth_call",params:J});return K==="0x"?{data:void 0}:{data:K}}catch(k){const T=lv(k),{offchainLookup:B,offchainLookupSignature:R}=await Promise.resolve().then(()=>aw);if(e.ccipRead!==!1&&(T==null?void 0:T.slice(0,10))===R&&A)return{data:await B(e,{data:T,to:A})};throw $&&(T==null?void 0:T.slice(0,10))==="0x101bb98d"?new Rg({factory:p}):md(k,{...t,account:m,chain:e.chain})}}function sv({request:e}){const{data:t,to:n,...r}=e;return!(!t||t.startsWith(nv)||!n||Object.values(r).filter(o=>typeof o<"u").length>0)}async function iv(e,t){var b;const{batchSize:n=1024,deployless:r=!1,wait:o=0}=typeof((b=e.batch)==null?void 0:b.multicall)=="object"?e.batch.multicall:{},{blockNumber:s,blockTag:i=e.experimental_blockTag??"latest",data:l,to:a}=t,c=(()=>{if(r)return null;if(t.multicallAddress)return t.multicallAddress;if(e.chain)return Dr({blockNumber:s,chain:e.chain,contract:"multicall3"});throw new hd})(),f=(typeof s=="bigint"?re(s):void 0)||i,{schedule:p}=gd({id:`${e.uid}.${f}`,wait:o,shouldSplitBatch(w){return w.reduce((x,{data:E})=>x+(E.length-2),0)>n*2},fn:async w=>{const P=w.map(A=>({allowFailure:!0,callData:A.data,target:A.to})),x=vt({abi:kr,args:[P],functionName:"aggregate3"}),E=await e.request({method:"eth_call",params:[{...c===null?{data:yd({code:Ra,data:x})}:{to:c,data:x}},f]});return Dn({abi:kr,args:[P],functionName:"aggregate3",data:E||"0x"})}}),[{returnData:d,success:h}]=await p({data:l,to:a});if(!h)throw new As({data:d});return d==="0x"?{data:void 0}:{data:d}}function yd(e){const{code:t,data:n}=e;return Ua({abi:gu(["constructor(bytes, bytes)"]),bytecode:pd,args:[t,n]})}function av(e){const{data:t,factory:n,factoryData:r,to:o}=e;return Ua({abi:gu(["constructor(address, bytes, address, bytes)"]),bytecode:rv,args:[o,t,n,r]})}function lv(e){var n;if(!(e instanceof V))return;const t=e.walk();return typeof(t==null?void 0:t.data)=="object"?(n=t.data)==null?void 0:n.data:t.data}async function jt(e,t){const{abi:n,address:r,args:o,functionName:s,...i}=t,l=vt({abi:n,args:o,functionName:s});try{const{data:a}=await te(e,Br,"call")({...i,data:l,to:r});return Dn({abi:n,args:o,functionName:s,data:a||"0x"})}catch(a){throw Nr(a,{abi:n,address:r,args:o,docsPath:"/docs/contract/readContract",functionName:s})}}async function cv(e,t){var u;const{abi:n,address:r,args:o,functionName:s,dataSuffix:i=typeof e.dataSuffix=="string"?e.dataSuffix:(u=e.dataSuffix)==null?void 0:u.value,...l}=t,a=l.account?ft(l.account):e.account,c=vt({abi:n,args:o,functionName:s});try{const{data:f}=await te(e,Br,"call")({batch:!1,data:`${c}${i?i.replace("0x",""):""}`,to:r,...l,account:a}),p=Dn({abi:n,args:o,functionName:s,data:f||"0x"}),d=n.filter(h=>"name"in h&&h.name===t.functionName);return{result:p,request:{abi:d,address:r,args:o,dataSuffix:i,functionName:s,...l,account:a}}}catch(f){throw Nr(f,{abi:n,address:r,args:o,docsPath:"/docs/contract/simulateContract",functionName:s,sender:a==null?void 0:a.address})}}const Wa=new Map,vd=new Map;let uv=0;function Bn(e,t,n){const r=++uv,o=()=>Wa.get(e)||[],s=()=>{const u=o();Wa.set(e,u.filter(f=>f.id!==r))},i=()=>{const u=o();if(!u.some(p=>p.id===r))return;const f=vd.get(e);if(u.length===1&&f){const p=f();p instanceof Promise&&p.catch(()=>{})}s()},l=o();if(Wa.set(e,[...l,{id:r,fns:t}]),l&&l.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 b of p)(h=(d=b.fns)[u])==null||h.call(d,...f)};const c=n(a);return typeof c=="function"&&vd.set(e,c),i}async function Va(e){return new Promise(t=>setTimeout(t,e))}function _o(e,{emitOnBegin:t,initialWaitTime:n,interval:r}){let o=!0;const s=()=>o=!1;return(async()=>{let l;t&&(l=await e({unpoll:s}));const a=await(n==null?void 0:n(l))??r;await Va(a);const c=async()=>{o&&(await e({unpoll:s}),await Va(r),c())};c()})(),s}const fv=new Map,dv=new Map;function pv(e){const t=(o,s)=>({clear:()=>s.delete(o),get:()=>s.get(o),set:i=>s.set(o,i)}),n=t(e,fv),r=t(e,dv);return{clear:()=>{n.clear(),r.clear()},promise:n,response:r}}async function hv(e,{cacheKey:t,cacheTime:n=Number.POSITIVE_INFINITY}){const r=pv(t),o=r.response.get();if(o&&n>0&&Date.now()-o.created.getTime()<n)return o.data;let s=r.promise.get();s||(s=e(),r.promise.set(s));try{const i=await s;return r.response.set({created:new Date,data:i}),i}finally{r.promise.clear()}}const mv=e=>`blockNumber.${e}`;async function Wo(e,{cacheTime:t=e.cacheTime}={}){const n=await hv(()=>e.request({method:"eth_blockNumber"}),{cacheKey:mv(e.uid),cacheTime:t});return BigInt(n)}async function Rs(e,{filter:t}){const n="strict"in t&&t.strict,r=await t.request({method:"eth_getFilterChanges",params:[t.id]});if(typeof r[0]=="string")return r;const o=r.map(s=>Zt(s));return!("abi"in t)||!t.abi?o:Na({abi:t.abi,logs:o,strict:n})}async function js(e,{filter:t}){return t.request({method:"eth_uninstallFilter",params:[t.id]})}function bv(e,t){const{abi:n,address:r,args:o,batch:s=!0,eventName:i,fromBlock:l,onError:a,onLogs:c,poll:u,pollingInterval:f=e.pollingInterval,strict:p}=t;return(typeof u<"u"?u:typeof l=="bigint"?!0:!(e.transport.type==="webSocket"||e.transport.type==="ipc"||e.transport.type==="fallback"&&(e.transport.transports[0].config.type==="webSocket"||e.transport.transports[0].config.type==="ipc")))?(()=>{const w=p??!1,P=Me(["watchContractEvent",r,o,s,e.uid,i,f,w,l]);return Bn(P,{onLogs:c,onError:a},x=>{let E;l!==void 0&&(E=l-1n);let A,D=!1;const L=_o(async()=>{var F;if(!D){try{A=await te(e,Qu,"createContractEventFilter")({abi:n,address:r,args:o,eventName:i,strict:w,fromBlock:l})}catch{}D=!0;return}try{let m;if(A)m=await te(e,Rs,"getFilterChanges")({filter:A});else{const v=await te(e,Wo,"getBlockNumber")({});E&&E<v?m=await te(e,Rf,"getContractEvents")({abi:n,address:r,args:o,eventName:i,fromBlock:E+1n,toBlock:v,strict:w}):m=[],E=v}if(m.length===0)return;if(s)x.onLogs(m);else for(const v of m)x.onLogs([v])}catch(m){A&&m instanceof $n&&(D=!1),(F=x.onError)==null||F.call(x,m)}},{emitOnBegin:!0,interval:f});return async()=>{A&&await te(e,js,"uninstallFilter")({filter:A}),L()}})})():(()=>{const w=p??!1,P=Me(["watchContractEvent",r,o,s,e.uid,i,f,w]);let x=!0,E=()=>x=!1;return Bn(P,{onLogs:c,onError:a},A=>((async()=>{try{const D=(()=>{if(e.transport.type==="fallback"){const m=e.transport.transports.find(v=>v.config.type==="webSocket"||v.config.type==="ipc");return m?m.value:e.transport}return e.transport})(),L=i?ao({abi:n,eventName:i,args:o}):[],{unsubscribe:F}=await D.subscribe({params:["logs",{address:r,topics:L}],onData(m){var S;if(!x)return;const v=m.result;try{const{eventName:$,args:I}=$s({abi:n,data:v.data,topics:v.topics,strict:p}),C=Zt(v,{args:I,eventName:$});A.onLogs([C])}catch($){let I,C;if($ instanceof vs||$ instanceof qi){if(p)return;I=$.abiItem.name,C=(S=$.abiItem.inputs)==null?void 0:S.some(y=>!("name"in y&&y.name))}const M=Zt(v,{args:C?[]:{},eventName:I});A.onLogs([M])}},onError(m){var v;(v=A.onError)==null||v.call(A,m)}});E=F,x||E()}catch(D){a==null||a(D)}})(),()=>E()))})()}async function gv(e,{serializedTransaction:t}){return e.request({method:"eth_sendRawTransaction",params:[t]},{retryCount:0})}function Ha(e,{delay:t=100,retryCount:n=2,shouldRetry:r=()=>!0}={}){return new Promise((o,s)=>{const i=async({count:l=0}={})=>{const a=async({error:c})=>{const u=typeof t=="function"?t({count:l,error:c}):t;u&&await Va(u),i({count:l+1})};try{const c=await e();o(c)}catch(c){if(l<n&&await r({count:l,error:c}))return a({error:c});s(c)}};i()})}const yv={"0x0":"reverted","0x1":"success"};function wd(e,t){const n={...e,blockNumber:e.blockNumber?BigInt(e.blockNumber):null,contractAddress:e.contractAddress?e.contractAddress:null,cumulativeGasUsed:e.cumulativeGasUsed?BigInt(e.cumulativeGasUsed):null,effectiveGasPrice:e.effectiveGasPrice?BigInt(e.effectiveGasPrice):null,gasUsed:e.gasUsed?BigInt(e.gasUsed):null,logs:e.logs?e.logs.map(r=>Zt(r)):null,to:e.to?e.to:null,transactionIndex:e.transactionIndex?ln(e.transactionIndex):null,status:e.status?yv[e.status]:null,type:e.type?Sf[e.type]||e.type:null};return e.blobGasPrice&&(n.blobGasPrice=BigInt(e.blobGasPrice)),e.blobGasUsed&&(n.blobGasUsed=BigInt(e.blobGasUsed)),n}const Ga=256;let zs=Ga,Us;function xd(e=11){if(!Us||zs+e>Ga*2){Us="",zs=0;for(let t=0;t<Ga;t++)Us+=(256+Math.random()*256|0).toString(16).substring(1)}return Us.substring(zs,zs+++e)}function vv(e){const{batch:t,chain:n,ccipRead:r,dataSuffix:o,key:s="base",name:i="Base Client",type:l="base"}=e,a=e.experimental_blockTag??(typeof(n==null?void 0:n.experimental_preconfirmationTime)=="number"?"pending":void 0),c=(n==null?void 0:n.blockTime)??12e3,u=Math.min(Math.max(Math.floor(c/2),500),4e3),f=e.pollingInterval??u,p=e.cacheTime??f,d=e.account?ft(e.account):void 0,{config:h,request:b,value:w}=e.transport({account:d,chain:n,pollingInterval:f}),P={...h,...w},x={account:d,batch:t,cacheTime:p,ccipRead:r,chain:n,dataSuffix:o,key:s,name:i,pollingInterval:f,request:b,transport:P,type:l,uid:xd(),...a?{experimental_blockTag:a}:{}};function E(A){return D=>{const L=D(A);for(const m in x)delete L[m];const F={...A,...L};return Object.assign(F,{extend:E(F)})}}return Object.assign(x,{extend:E(x)})}function qa(e){var n,r,o,s,i,l;if(!(e instanceof V))return!1;const t=e.walk(a=>a instanceof la);return t instanceof la?((n=t.data)==null?void 0:n.errorName)==="HttpError"||((r=t.data)==null?void 0:r.errorName)==="ResolverError"||((o=t.data)==null?void 0:o.errorName)==="ResolverNotContract"||((s=t.data)==null?void 0:s.errorName)==="ResolverNotFound"||((i=t.data)==null?void 0:i.errorName)==="ReverseAddressMismatch"||((l=t.data)==null?void 0:l.errorName)==="UnsupportedResolverProfile":!1}function wv(e){const{abi:t,data:n}=e,r=Zn(n,0,4),o=t.find(s=>s.type==="function"&&r===io(kt(s)));if(!o)throw new c1(r,{docsPath:"/docs/contract/decodeFunctionData"});return{functionName:o.name,args:"inputs"in o&&o.inputs&&o.inputs.length>0?lo(o.inputs,Zn(n,4)):void 0}}const Ka="/docs/contract/encodeErrorResult";function Ed(e){const{abi:t,errorName:n,args:r}=e;let o=t[0];if(n){const a=Yn({abi:t,args:r,name:n});if(!a)throw new Pu(n,{docsPath:Ka});o=a}if(o.type!=="error")throw new Pu(void 0,{docsPath:Ka});const s=kt(o),i=io(s);let l="0x";if(r&&r.length>0){if(!o.inputs)throw new i1(o.name,{docsPath:Ka});l=In(o.inputs,r)}return Sr([i,l])}const Za="/docs/contract/encodeFunctionResult";function xv(e){const{abi:t,functionName:n,result:r}=e;let o=t[0];if(n){const i=Yn({abi:t,name:n});if(!i)throw new gr(n,{docsPath:Za});o=i}if(o.type!=="function")throw new gr(void 0,{docsPath:Za});if(!o.outputs)throw new Nu(o.name,{docsPath:Za});const s=(()=>{if(o.outputs.length===0)return[];if(o.outputs.length===1)return[r];if(Array.isArray(r))return r;throw new Cu(r)})();return In(o.outputs,s)}const Vo="x-batch-gateway:true";async function Sd(e){const{data:t,ccipRequest:n}=e,{args:[r]}=wv({abi:Fa,data:t}),o=[],s=[];return await Promise.all(r.map(async(i,l)=>{try{s[l]=i.urls.includes(Vo)?await Sd({data:i.data,ccipRequest:n}):await n(i),o[l]=!1}catch(a){o[l]=!0,s[l]=Ev(a)}})),xv({abi:Fa,functionName:"query",result:[o,s]})}function Ev(e){return e.name==="HttpRequestError"&&e.status?Ed({abi:Fa,errorName:"HttpError",args:[e.status,e.shortMessage]}):Ed({abi:[tf],errorName:"Error",args:["shortMessage"in e?e.shortMessage:e.message]})}function Pd(e){if(e.length!==66||e.indexOf("[")!==0||e.indexOf("]")!==65)return null;const t=`0x${e.slice(1,65)}`;return Mt(t)?t:null}function Ya(e){let t=new Uint8Array(32).fill(0);if(!e)return ke(t);const n=e.split(".");for(let r=n.length-1;r>=0;r-=1){const o=Pd(n[r]),s=o?vr(o):je(qn(n[r]),"bytes");t=je(Bt([t,s]),"bytes")}return ke(t)}function Sv(e){return`[${e.slice(2)}]`}function Pv(e){const t=new Uint8Array(32).fill(0);return e?Pd(e)||je(qn(e)):ke(t)}function Xa(e){const t=e.replace(/^\.|\.$/gm,"");if(t.length===0)return new Uint8Array(1);const n=new Uint8Array(qn(t).byteLength+2);let r=0;const o=t.split(".");for(let s=0;s<o.length;s++){let i=qn(o[s]);i.byteLength>255&&(i=qn(Sv(Pv(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 Tv(e,t){const{blockNumber:n,blockTag:r,coinType:o,name:s,gatewayUrls:i,strict:l}=t,{chain:a}=e,c=(()=>{if(t.universalResolverAddress)return t.universalResolverAddress;if(!a)throw new Error("client chain not configured. universalResolverAddress is required.");return Dr({blockNumber:n,chain:a,contract:"ensUniversalResolver"})})(),u=a==null?void 0:a.ensTlds;if(u&&!u.some(p=>s.endsWith(p)))return null;const f=o!=null?[Ya(s),BigInt(o)]:[Ya(s)];try{const p=vt({abi:ud,functionName:"addr",args:f}),d={address:c,abi:ld,functionName:"resolveWithGateways",args:[Cn(Xa(s)),p,i??[Vo]],blockNumber:n,blockTag:r},b=await te(e,jt,"readContract")(d);if(b[0]==="0x")return null;const w=Dn({abi:ud,args:f,functionName:"addr",data:b[0]});return w==="0x"||Gn(w)==="0x00"?null:w}catch(p){if(l)throw p;if(qa(p))return null;throw p}}class Av extends V{constructor({data:t}){super("Unable to extract image from metadata. The metadata may be malformed or invalid.",{metaMessages:["- Metadata must be a JSON object with at least an `image`, `image_url` or `image_data` property.","",`Provided data: ${JSON.stringify(t)}`],name:"EnsAvatarInvalidMetadataError"})}}class Ho extends V{constructor({reason:t}){super(`ENS NFT avatar URI is invalid. ${t}`,{name:"EnsAvatarInvalidNftUriError"})}}class Ja extends V{constructor({uri:t}){super(`Unable to resolve ENS avatar URI "${t}". The URI may be malformed, invalid, or does not respond with a valid image.`,{name:"EnsAvatarUriResolutionError"})}}class Nv extends V{constructor({namespace:t}){super(`ENS NFT avatar namespace "${t}" is not supported. Must be "erc721" or "erc1155".`,{name:"EnsAvatarUnsupportedNamespaceError"})}}const Cv=/(?<protocol>https?:\/\/[^/]*|ipfs:\/|ipns:\/|ar:\/)?(?<root>\/)?(?<subpath>ipfs\/|ipns\/)?(?<target>[\w\-.]+)(?<subtarget>\/.*)?/,Ov=/^(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>\/.*)?$/,Iv=/^data:([a-zA-Z\-/+]*);base64,([^"].*)/,$v=/^data:([a-zA-Z\-/+]*)?(;[a-zA-Z0-9].*?)?(,)/;async function kv(e){try{const t=await fetch(e,{method:"HEAD"});if(t.status===200){const n=t.headers.get("content-type");return n==null?void 0:n.startsWith("image/")}return!1}catch(t){return typeof t=="object"&&typeof t.response<"u"||!Object.hasOwn(globalThis,"Image")?!1:new Promise(n=>{const r=new Image;r.onload=()=>{n(!0)},r.onerror=()=>{n(!1)},r.src=e})}}function Td(e,t){return e?e.endsWith("/")?e.slice(0,-1):e:t}function Ad({uri:e,gatewayUrls:t}){const n=Iv.test(e);if(n)return{uri:e,isOnChain:!0,isEncoded:n};const r=Td(t==null?void 0:t.ipfs,"https://ipfs.io"),o=Td(t==null?void 0:t.arweave,"https://arweave.net"),s=e.match(Cv),{protocol:i,subpath:l,target:a,subtarget:c=""}=(s==null?void 0:s.groups)||{},u=i==="ipns:/"||l==="ipns/",f=i==="ipfs:/"||l==="ipfs/"||Ov.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}${c}`,isOnChain:!1,isEncoded:!1};if(i==="ar:/"&&a)return{uri:`${o}/${a}${c||""}`,isOnChain:!1,isEncoded:!1};let p=e.replace($v,"");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 Ja({uri:e})}function Nd(e){if(typeof e!="object"||!("image"in e)&&!("image_url"in e)&&!("image_data"in e))throw new Av({data:e});return e.image||e.image_url||e.image_data}async function Mv({gatewayUrls:e,uri:t}){try{const n=await fetch(t).then(o=>o.json());return await Qa({gatewayUrls:e,uri:Nd(n)})}catch{throw new Ja({uri:t})}}async function Qa({gatewayUrls:e,uri:t}){const{uri:n,isOnChain:r}=Ad({uri:t,gatewayUrls:e});if(r||await kv(n))return n;throw new Ja({uri:t})}function Dv(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(":"),[l,a]=r.split(":");if(!s||s.toLowerCase()!=="eip155")throw new Ho({reason:"Only EIP-155 supported"});if(!i)throw new Ho({reason:"Chain ID not found"});if(!a)throw new Ho({reason:"Contract address not found"});if(!o)throw new Ho({reason:"Token ID not found"});if(!l)throw new Ho({reason:"ERC namespace not found"});return{chainID:Number.parseInt(i,10),namespace:l.toLowerCase(),contractAddress:a,tokenID:o}}async function Bv(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 Nv({namespace:t.namespace})}async function Lv(e,{gatewayUrls:t,record:n}){return/eip155:/i.test(n)?Fv(e,{gatewayUrls:t,record:n}):Qa({uri:n,gatewayUrls:t})}async function Fv(e,{gatewayUrls:t,record:n}){const r=Dv(n),o=await Bv(e,{nft:r}),{uri:s,isOnChain:i,isEncoded:l}=Ad({uri:o,gatewayUrls:t});if(i&&(s.includes("data:application/json;base64,")||s.startsWith("{"))){const c=l?atob(s.replace("data:application/json;base64,","")):s,u=JSON.parse(c);return Qa({uri:Nd(u),gatewayUrls:t})}let a=r.tokenID;return r.namespace==="erc1155"&&(a=a.replace("0x","").padStart(64,"0")),Mv({gatewayUrls:t,uri:s.replace(/(?:0x)?{id}/,a)})}async function Cd(e,t){const{blockNumber:n,blockTag:r,key:o,name:s,gatewayUrls:i,strict:l}=t,{chain:a}=e,c=(()=>{if(t.universalResolverAddress)return t.universalResolverAddress;if(!a)throw new Error("client chain not configured. universalResolverAddress is required.");return Dr({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:c,abi:ld,args:[Cn(Xa(s)),vt({abi:cd,functionName:"text",args:[Ya(s),o]}),i??[Vo]],functionName:"resolveWithGateways",blockNumber:n,blockTag:r},d=await te(e,jt,"readContract")(f);if(d[0]==="0x")return null;const h=Dn({abi:cd,functionName:"text",data:d[0]});return h===""?null:h}catch(f){if(l)throw f;if(qa(f))return null;throw f}}async function Rv(e,{blockNumber:t,blockTag:n,assetGatewayUrls:r,name:o,gatewayUrls:s,strict:i,universalResolverAddress:l}){const a=await te(e,Cd,"getEnsText")({blockNumber:t,blockTag:n,key:"avatar",name:o,universalResolverAddress:l,gatewayUrls:s,strict:i});if(!a)return null;try{return await Lv(e,{record:a,gatewayUrls:r})}catch{return null}}async function jv(e,t){const{address:n,blockNumber:r,blockTag:o,coinType:s=60n,gatewayUrls:i,strict:l}=t,{chain:a}=e,c=(()=>{if(t.universalResolverAddress)return t.universalResolverAddress;if(!a)throw new Error("client chain not configured. universalResolverAddress is required.");return Dr({blockNumber:r,chain:a,contract:"ensUniversalResolver"})})();try{const u={address:c,abi:tv,args:[n,s,i??[Vo]],functionName:"reverseWithGateways",blockNumber:r,blockTag:o},f=te(e,jt,"readContract"),[p]=await f(u);return p||null}catch(u){if(l)throw u;if(qa(u))return null;throw u}}async function zv(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 Dr({blockNumber:n,chain:s,contract:"ensUniversalResolver"})})(),l=s==null?void 0:s.ensTlds;if(l&&!l.some(c=>o.endsWith(c)))throw new Error(`${o} is not a valid ENS TLD (${l==null?void 0:l.join(", ")}) for chain "${s.name}" (id: ${s.id}).`);const[a]=await te(e,jt,"readContract")({address:i,abi:[{inputs:[{type:"bytes"}],name:"findResolver",outputs:[{type:"address"},{type:"bytes32"},{type:"uint256"}],stateMutability:"view",type:"function"}],functionName:"findResolver",args:[Cn(Xa(o))],blockNumber:n,blockTag:r});return a}async function Od(e,t){var w,P,x;const{account:n=e.account,blockNumber:r,blockTag:o="latest",blobs:s,data:i,gas:l,gasPrice:a,maxFeePerBlobGas:c,maxFeePerGas:u,maxPriorityFeePerGas:f,to:p,value:d,...h}=t,b=n?ft(n):void 0;try{Or(t);const A=(typeof r=="bigint"?re(r):void 0)||o,D=(x=(P=(w=e.chain)==null?void 0:w.formatters)==null?void 0:P.transactionRequest)==null?void 0:x.format,F=(D||Bo)({...Is(h,{format:D}),account:b,blobs:s,data:i,gas:l,gasPrice:a,maxFeePerBlobGas:c,maxFeePerGas:u,maxPriorityFeePerGas:f,to:p,value:d},"createAccessList"),m=await e.request({method:"eth_createAccessList",params:[F,A]});return{accessList:m.accessList,gasUsed:BigInt(m.gasUsed)}}catch(E){throw md(E,{...t,account:b,chain:e.chain})}}async function Uv(e){const t=Ts(e,{method:"eth_newBlockFilter"}),n=await e.request({method:"eth_newBlockFilter"});return{id:n,request:t(n),type:"block"}}async function Id(e,{address:t,args:n,event:r,events:o,fromBlock:s,strict:i,toBlock:l}={}){const a=o??(r?[r]:void 0),c=Ts(e,{method:"eth_newFilter"});let u=[];a&&(u=[a.flatMap(d=>ao({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"?re(s):s,toBlock:typeof l=="bigint"?re(l):l,...u.length?{topics:u}:{}}]});return{abi:a,args:n,eventName:r?r.name:void 0,fromBlock:s,id:f,request:c(f),strict:!!i,toBlock:l,type:"event"}}async function $d(e){const t=Ts(e,{method:"eth_newPendingTransactionFilter"}),n=await e.request({method:"eth_newPendingTransactionFilter"});return{id:n,request:t(n),type:"transaction"}}async function _v(e,{address:t,blockNumber:n,blockTag:r=e.experimental_blockTag??"latest"}){var i,l,a;if((i=e.batch)!=null&&i.multicall&&((a=(l=e.chain)==null?void 0:l.contracts)!=null&&a.multicall3)){const c=e.chain.contracts.multicall3.address,u=vt({abi:kr,functionName:"getEthBalance",args:[t]}),{data:f}=await te(e,Br,"call")({to:c,data:u,blockNumber:n,blockTag:r});return Dn({abi:kr,functionName:"getEthBalance",args:[t],data:f||"0x"})}const o=typeof n=="bigint"?re(n):void 0,s=await e.request({method:"eth_getBalance",params:[t,o||r]});return BigInt(s)}async function Wv(e){const t=await e.request({method:"eth_blobBaseFee"});return BigInt(t)}async function Vv(e,{blockHash:t,blockNumber:n,blockTag:r="latest"}={}){const o=n!==void 0?re(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}),ln(s)}async function _s(e,{address:t,blockNumber:n,blockTag:r="latest"}){const o=n!==void 0?re(n):void 0,s=await e.request({method:"eth_getCode",params:[t,o||r]},{dedupe:!!o});if(s!=="0x")return s}async function Hv(e,{address:t,blockNumber:n,blockTag:r="latest"}){const o=await _s(e,{address:t,...n!==void 0?{blockNumber:n}:{blockTag:r}});if(o&&Te(o)===23&&o.startsWith("0xef0100"))return un(Zn(o,3,23))}class Gv extends V{constructor({address:t}){super(`No EIP-712 domain found on contract "${t}".`,{metaMessages:["Ensure that:",`- The contract is deployed at the address "${t}".`,"- `eip712Domain()` function exists on the contract.","- `eip712Domain()` function matches signature to ERC-5267 specification."],name:"Eip712DomainNotFoundError"})}}async function qv(e,t){const{address:n,factory:r,factoryData:o}=t;try{const[s,i,l,a,c,u,f]=await te(e,jt,"readContract")({abi:Kv,address:n,functionName:"eip712Domain",factory:r,factoryData:o});return{domain:{name:i,version:l,chainId:Number(a),verifyingContract:c,salt:u},extensions:f,fields:s}}catch(s){const i=s;throw i.name==="ContractFunctionExecutionError"&&i.cause.name==="ContractFunctionZeroDataError"?new Gv({address:n}):i}}const Kv=[{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 Zv(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 Yv(e,{blockCount:t,blockNumber:n,blockTag:r="latest",rewardPercentiles:o}){const s=typeof n=="bigint"?re(n):void 0,i=await e.request({method:"eth_feeHistory",params:[re(t),s||r,o]},{dedupe:!!s});return Zv(i)}async function Xv(e,{filter:t}){const n=t.strict??!1,o=(await t.request({method:"eth_getFilterLogs",params:[t.id]})).map(s=>Zt(s));return t.abi?Na({abi:t.abi,logs:o,strict:n}):o}async function Jv({address:e,authorization:t,signature:n}){return Lo(un(e),await yf({authorization:t,signature:n}))}const Ws=new Ss(8192);function Qv(e,{enabled:t=!0,id:n}){if(!t||!n)return e();if(Ws.get(n))return Ws.get(n);const r=e().finally(()=>Ws.delete(n));return Ws.set(n,r),r}function ew(e,t={}){return async(n,r={})=>{var f;const{dedupe:o=!1,methods:s,retryDelay:i=150,retryCount:l=3,uid:a}={...t,...r},{method:c}=n;if((f=s==null?void 0:s.exclude)!=null&&f.includes(c))throw new Qn(new Error("method not supported"),{method:c});if(s!=null&&s.include&&!s.include.includes(c))throw new Qn(new Error("method not supported"),{method:c});const u=o?ro(`${a}.${Me(n)}`):void 0;return Qv(()=>Ha(async()=>{try{return await e(n)}catch(p){const d=p;switch(d.code){case po.code:throw new po(d);case ho.code:throw new ho(d);case mo.code:throw new mo(d,{method:n.method});case bo.code:throw new bo(d);case Jn.code:throw new Jn(d);case $n.code:throw new $n(d);case go.code:throw new go(d);case yo.code:throw new yo(d);case vo.code:throw new vo(d);case Qn.code:throw new Qn(d,{method:n.method});case Tr.code:throw new Tr(d);case wo.code:throw new wo(d);case Ar.code:throw new Ar(d);case xo.code:throw new xo(d);case Eo.code:throw new Eo(d);case So.code:throw new So(d);case Po.code:throw new Po(d);case To.code:throw new To(d);case Ao.code:throw new Ao(d);case No.code:throw new No(d);case Co.code:throw new Co(d);case Oo.code:throw new Oo(d);case Io.code:throw new Io(d);case $o.code:throw new $o(d);case ko.code:throw new ko(d);case 5e3:throw new Ar(d);case Mo.code:throw new Mo(d);default:throw p instanceof V?p:new zg(d)}}},{delay:({count:p,error:d})=>{var h;if(d&&d instanceof Xn){const b=(h=d==null?void 0:d.headers)==null?void 0:h.get("Retry-After");if(b!=null&&b.match(/\d/))return Number.parseInt(b,10)*1e3}return~~(1<<p)*i},retryCount:l,shouldRetry:({error:p})=>tw(p)}),{enabled:o,id:u})}}function tw(e){return"code"in e&&typeof e.code=="number"?e.code===-1||e.code===Tr.code||e.code===Jn.code:e instanceof Xn&&e.status?e.status===403||e.status===408||e.status===413||e.status===429||e.status===500||e.status===502||e.status===503||e.status===504:!0}class nw extends V{constructor({callbackSelector:t,cause:n,data:r,extraData:o,sender:s,urls:i}){var l;super(n.shortMessage||"An error occurred while fetching for an offchain result.",{cause:n,metaMessages:[...n.metaMessages||[],(l=n.metaMessages)!=null&&l.length?"":[],"Offchain Gateway Call:",i&&[" Gateway URL(s):",...i.map(a=>` ${fo(a)}`)],` Sender: ${s}`,` Data: ${r}`,` Callback selector: ${t}`,` Extra data: ${o}`].flat(),name:"OffchainLookupError"})}}class rw extends V{constructor({result:t,url:n}){super("Offchain gateway response is malformed. Response data must be a hex value.",{metaMessages:[`Gateway URL: ${fo(n)}`,`Response: ${Me(t)}`],name:"OffchainLookupResponseMalformedError"})}}class ow extends V{constructor({sender:t,to:n}){super("Reverted sender address does not match target contract address (`to`).",{metaMessages:[`Contract address: ${n}`,`OffchainLookup sender address: ${t}`],name:"OffchainLookupSenderMismatchError"})}}const sw="0x556f1830",kd={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 iw(e,{blockNumber:t,blockTag:n,data:r,to:o}){const{args:s}=sf({data:r,abi:[kd]}),[i,l,a,c,u]=s,{ccipRead:f}=e,p=f&&typeof(f==null?void 0:f.request)=="function"?f.request:Md;try{if(!Lo(o,i))throw new ow({sender:i,to:o});const d=l.includes(Vo)?await Sd({data:a,ccipRequest:p}):await p({data:a,sender:i,urls:l}),{data:h}=await Br(e,{blockNumber:t,blockTag:n,data:Bt([c,In([{type:"bytes"},{type:"bytes"}],[d,u])]),to:o});return h}catch(d){throw new nw({callbackSelector:c,cause:d,data:r,extraData:u,sender:i,urls:l})}}async function Md({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],l=i.includes("{data}")?"GET":"POST",a=l==="POST"?{data:e,sender:t}:void 0,c=l==="POST"?{"Content-Type":"application/json"}:{};try{const u=await fetch(i.replace("{sender}",t.toLowerCase()).replace("{data}",e),{body:JSON.stringify(a),headers:c,method:l});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 Xn({body:a,details:f!=null&&f.error?Me(f.error):u.statusText,headers:u.headers,status:u.status,url:i});continue}if(!Mt(f)){r=new rw({result:f,url:i});continue}return f}catch(u){r=new Xn({body:a,details:u.message,url:i})}}throw r}const aw=Object.freeze(Object.defineProperty({__proto__:null,ccipRequest:Md,offchainLookup:iw,offchainLookupAbiItem:kd,offchainLookupSignature:sw},Symbol.toStringTag,{value:"Module"}));function lw(e){const t={formatters:void 0,fees:void 0,serializers:void 0,...e};function n(r){return o=>{const s=typeof o=="function"?o(r):o,i={...r,...s};return Object.assign(i,{extend:n(i)})}}return Object.assign(t,{extend:n(t)})}function cw(e,{errorInstance:t=new Error("timed out"),timeout:n,signal:r}){return new Promise((o,s)=>{(async()=>{let i;try{const l=new AbortController;n>0&&(i=setTimeout(()=>{r&&l.abort()},n)),o(await e({signal:(l==null?void 0:l.signal)||null}))}catch(l){(l==null?void 0:l.name)==="AbortError"&&s(t),s(l)}finally{clearTimeout(i)}})()})}function uw(){return{current:0,take(){return this.current++},reset(){this.current=0}}}const Dd=uw();function fw(e,t={}){const{url:n,headers:r}=dw(e);return{async request(o){var h;const{body:s,fetchFn:i=t.fetchFn??fetch,onRequest:l=t.onRequest,onResponse:a=t.onResponse,timeout:c=t.timeout??1e4}=o,u={...t.fetchOptions??{},...o.fetchOptions??{}},{headers:f,method:p,signal:d}=u;try{const b=await cw(async({signal:P})=>{const x={...u,body:Array.isArray(s)?Me(s.map(L=>({jsonrpc:"2.0",id:L.id??Dd.take(),...L}))):Me({jsonrpc:"2.0",id:s.id??Dd.take(),...s}),headers:{...r,"Content-Type":"application/json",...f},method:p||"POST",signal:d||(c>0?P:null)},E=new Request(n,x),A=await(l==null?void 0:l(E,x))??{...x,url:n};return await i(A.url??n,A)},{errorInstance:new pf({body:s,url:n}),timeout:c,signal:!0});a&&await a(b);let w;if((h=b.headers.get("Content-Type"))!=null&&h.startsWith("application/json"))w=await b.json();else{w=await b.text();try{w=JSON.parse(w||"{}")}catch(P){if(b.ok)throw P;w={error:w}}}if(!b.ok)throw new Xn({body:s,details:Me(w.error)||b.statusText,headers:b.headers,status:b.status,url:n});return w}catch(b){throw b instanceof Xn||b instanceof pf?b:new Xn({body:s,cause:b,url:n})}}}}function dw(e){try{const t=new URL(e),n=(()=>{if(t.username){const r=`${decodeURIComponent(t.username)}:${decodeURIComponent(t.password)}`;return t.username="",t.password="",{url:t.toString(),headers:{Authorization:`Basic ${btoa(r)}`}}}})();return{url:t.toString(),...n}}catch{return{url:e}}}const pw=`Ethereum Signed Message:
89
- `;function hw(e){const t=typeof e=="string"?ro(e):typeof e.raw=="string"?e.raw:ke(e.raw),n=ro(`${pw}${Te(t)}`);return Bt([n,t])}function Bd(e,t){return je(hw(e),t)}class mw extends V{constructor({domain:t}){super(`Invalid domain "${Me(t)}".`,{metaMessages:["Must be a valid EIP-712 domain."]})}}class bw extends V{constructor({primaryType:t,types:n}){super(`Invalid primary type \`${t}\` must be one of \`${JSON.stringify(Object.keys(n))}\`.`,{docsPath:"/api/glossary/Errors#typeddatainvalidprimarytypeerror",metaMessages:["Check that the primary type is a key in `types`."]})}}class gw extends V{constructor({type:t}){super(`Struct type "${t}" is invalid.`,{metaMessages:["Struct type must not be a Solidity type."],name:"InvalidStructTypeError"})}}function yw(e){const{domain:t,message:n,primaryType:r,types:o}=e,s=(i,l)=>{for(const a of i){const{name:c,type:u}=a,f=l[c],p=u.match(Zu);if(p&&(typeof f=="number"||typeof f=="bigint")){const[b,w,P]=p;re(f,{signed:w==="int",size:Number.parseInt(P,10)/8})}if(u==="address"&&typeof f=="string"&&!yt(f))throw new On({address:f});const d=u.match(rg);if(d){const[b,w]=d;if(w&&Te(f)!==Number.parseInt(w,10))throw new f1({expectedSize:Number.parseInt(w,10),givenSize:Te(f)})}const h=o[u];h&&(ww(u),s(h,f))}};if(o.EIP712Domain&&t){if(typeof t!="object")throw new mw({domain:t});s(o.EIP712Domain,t)}if(r!=="EIP712Domain")if(o[r])s(o[r],n);else throw new bw({primaryType:r,types:o})}function vw({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 ww(e){if(e==="address"||e==="bool"||e==="string"||e.startsWith("bytes")||e.startsWith("uint")||e.startsWith("int"))throw new gw({type:e})}function xw(e){const{domain:t={},message:n,primaryType:r}=e,o={EIP712Domain:vw({domain:t}),...e.types};yw({domain:t,message:n,primaryType:r,types:o});const s=["0x1901"];return t&&s.push(Ew({domain:t,types:o})),r!=="EIP712Domain"&&s.push(Ld({data:n,primaryType:r,types:o})),je(Bt(s))}function Ew({domain:e,types:t}){return Ld({data:e,primaryType:"EIP712Domain",types:t})}function Ld({data:e,primaryType:t,types:n}){const r=Fd({data:e,primaryType:t,types:n});return je(r)}function Fd({data:e,primaryType:t,types:n}){const r=[{type:"bytes32"}],o=[Sw({primaryType:t,types:n})];for(const s of n[t]){const[i,l]=jd({types:n,name:s.name,type:s.type,value:e[s.name]});r.push(i),o.push(l)}return In(r,o)}function Sw({primaryType:e,types:t}){const n=Cn(Pw({primaryType:e,types:t}));return je(n)}function Pw({primaryType:e,types:t}){let n="";const r=Rd({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:l})=>`${l} ${i}`).join(",")})`;return n}function Rd({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])Rd({primaryType:s.type,types:t},n);return n}function jd({types:e,name:t,type:n,value:r}){if(e[n]!==void 0)return[{type:"bytes32"},je(Fd({data:r,primaryType:n,types:e}))];if(n==="bytes")return[{type:"bytes32"},je(r)];if(n==="string")return[{type:"bytes32"},je(Cn(r))];if(n.lastIndexOf("]")===n.length-1){const o=n.slice(0,n.lastIndexOf("[")),s=r.map(i=>jd({name:t,type:o,types:e,value:i}));return[{type:"bytes32"},je(In(s.map(([i])=>i),s.map(([,i])=>i)))]}return[{type:n},r]}class Tw 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 el={checksum:new Tw(8192)}.checksum;class zd extends Yi{constructor(t,n){super(),this.finished=!1,this.destroyed=!1,M1(t);const r=xs(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),Er(s)}update(t){return xr(this),this.iHash.update(t),this}digestInto(t){xr(this),Kn(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:l}=this;return t=t,t.finished=o,t.destroyed=s,t.blockLen=i,t.outputLen=l,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 Ud=(e,t,n)=>new zd(e,t).update(n).digest();Ud.create=(e,t)=>new zd(e,t);function _d(e,t={}){const{as:n=typeof e=="string"?"Hex":"Bytes"}=t,r=Vu(By(e));return n==="Bytes"?r:Rt(r)}const Aw=/^0x[a-fA-F0-9]{40}$/;function Vs(e,t={}){const{strict:n=!0}=t;if(!Aw.test(e))throw new Vd({address:e,cause:new Nw});if(n){if(e.toLowerCase()===e)return;if(Wd(e)!==e)throw new Vd({address:e,cause:new Cw})}}function Wd(e){if(el.has(e))return el.get(e);Vs(e,{strict:!1});const t=e.substring(2).toLowerCase(),n=_d(Fy(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 el.set(e,o),o}function tl(e,t={}){const{strict:n=!0}=t??{};try{return Vs(e,{strict:n}),!0}catch{return!1}}class Vd extends oe{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 Nw extends oe{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 Cw extends oe{constructor(){super("Address does not match its checksum counterpart."),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Address.InvalidChecksumError"})}}const Ow=/^(.*)\[([0-9]*)\]$/,Iw=/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/,Hd=/^(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)?$/,Gd=2n**256n-1n;function Lr(e,t,n){const{checksumAddress:r,staticPosition:o}=n,s=sl(t.type);if(s){const[i,l]=s;return kw(e,{...t,type:l},{checksumAddress:r,length:i,staticPosition:o})}if(t.type==="tuple")return Lw(e,t,{checksumAddress:r,staticPosition:o});if(t.type==="address")return $w(e,{checksum:r});if(t.type==="bool")return Mw(e);if(t.type.startsWith("bytes"))return Dw(e,t,{staticPosition:o});if(t.type.startsWith("uint")||t.type.startsWith("int"))return Bw(e,t);if(t.type==="string")return Fw(e,{staticPosition:o});throw new ll(t.type)}const qd=32,nl=32;function $w(e,t={}){const{checksum:n=!1}=t,r=e.readBytes(32);return[(s=>n?Wd(s):s)(Rt(jy(r,-20))),32]}function kw(e,t,n){const{checksumAddress:r,length:o,staticPosition:s}=n;if(!o){const a=hn(e.readBytes(nl)),c=s+a,u=c+qd;e.setPosition(c);const f=hn(e.readBytes(qd)),p=Go(t);let d=0;const h=[];for(let b=0;b<f;++b){e.setPosition(u+(p?b*32:d));const[w,P]=Lr(e,t,{checksumAddress:r,staticPosition:u});d+=P,h.push(w)}return e.setPosition(s+32),[h,32]}if(Go(t)){const a=hn(e.readBytes(nl)),c=s+a,u=[];for(let f=0;f<o;++f){e.setPosition(c+f*32);const[p]=Lr(e,t,{checksumAddress:r,staticPosition:c});u.push(p)}return e.setPosition(s+32),[u,32]}let i=0;const l=[];for(let a=0;a<o;++a){const[c,u]=Lr(e,t,{checksumAddress:r,staticPosition:s+i});i+=u,l.push(c)}return[l,i]}function Mw(e){return[Uy(e.readBytes(32),{size:32}),32]}function Dw(e,t,{staticPosition:n}){const[r,o]=t.type.split("bytes");if(!o){const i=hn(e.readBytes(32));e.setPosition(n+i);const l=hn(e.readBytes(32));if(l===0)return e.setPosition(n+32),["0x",32];const a=e.readBytes(l);return e.setPosition(n+32),[Rt(a),32]}return[Rt(e.readBytes(Number.parseInt(o,10),32)),32]}function Bw(e,t){const n=t.type.startsWith("int"),r=Number.parseInt(t.type.split("int")[1]||"256",10),o=e.readBytes(32);return[r>48?zy(o,{signed:n}):hn(o,{signed:n}),32]}function Lw(e,t,n){const{checksumAddress:r,staticPosition:o}=n,s=t.components.length===0||t.components.some(({name:a})=>!a),i=s?[]:{};let l=0;if(Go(t)){const a=hn(e.readBytes(nl)),c=o+a;for(let u=0;u<t.components.length;++u){const f=t.components[u];e.setPosition(c+l);const[p,d]=Lr(e,f,{checksumAddress:r,staticPosition:c});l+=d,i[s?u:f==null?void 0:f.name]=p}return e.setPosition(o+32),[i,32]}for(let a=0;a<t.components.length;++a){const c=t.components[a],[u,f]=Lr(e,c,{checksumAddress:r,staticPosition:o});i[s?a:c==null?void 0:c.name]=u,l+=f}return[i,l]}function Fw(e,{staticPosition:t}){const n=hn(e.readBytes(32)),r=t+n;e.setPosition(r);const o=hn(e.readBytes(32));if(o===0)return e.setPosition(t+32),["",32];const s=e.readBytes(o,32),i=_y(Jf(s));return e.setPosition(t+32),[i,32]}function Rw({checksumAddress:e,parameters:t,values:n}){const r=[];for(let o=0;o<t.length;o++)r.push(rl({checksumAddress:e,parameter:t[o],value:n[o]}));return r}function rl({checksumAddress:e=!1,parameter:t,value:n}){const r=t,o=sl(r.type);if(o){const[s,i]=o;return zw(n,{checksumAddress:e,length:s,parameter:{...r,type:i}})}if(r.type==="tuple")return Hw(n,{checksumAddress:e,parameter:r});if(r.type==="address")return jw(n,{checksum:e});if(r.type==="bool")return _w(n);if(r.type.startsWith("uint")||r.type.startsWith("int")){const s=r.type.startsWith("int"),[,,i="256"]=Hd.exec(r.type)??[];return Ww(n,{signed:s,size:Number(i)})}if(r.type.startsWith("bytes"))return Uw(n,{type:r.type});if(r.type==="string")return Vw(n);throw new ll(r.type)}function ol(e){let t=0;for(let s=0;s<e.length;s++){const{dynamic:i,encoded:l}=e[s];i?t+=32:t+=dt(l)}const n=[],r=[];let o=0;for(let s=0;s<e.length;s++){const{dynamic:i,encoded:l}=e[s];i?(n.push(Ve(t+o,{size:32})),r.push(l),o+=dt(l)):n.push(l)}return Ft(...n,...r)}function jw(e,t){const{checksum:n=!1}=t;return Vs(e,{strict:n}),{dynamic:!1,encoded:tr(e.toLowerCase())}}function zw(e,t){const{checksumAddress:n,length:r,parameter:o}=t,s=r===null;if(!Array.isArray(e))throw new e6(e);if(!s&&e.length!==r)throw new Qw({expectedLength:r,givenLength:e.length,type:`${o.type}[${r}]`});let i=!1;const l=[];for(let a=0;a<e.length;a++){const c=rl({checksumAddress:n,parameter:o,value:e[a]});c.dynamic&&(i=!0),l.push(c)}if(s||i){const a=ol(l);if(s){const c=Ve(l.length,{size:32});return{dynamic:!0,encoded:l.length>0?Ft(c,a):c}}if(i)return{dynamic:!0,encoded:a}}return{dynamic:!1,encoded:Ft(...l.map(({encoded:a})=>a))}}function Uw(e,{type:t}){const[,n]=t.split("bytes"),r=dt(e);if(!n){let o=e;return r%32!==0&&(o=nr(o,Math.ceil((e.length-2)/2/32)*32)),{dynamic:!0,encoded:Ft(tr(Ve(r,{size:32})),o)}}if(r!==Number.parseInt(n,10))throw new Yd({expectedSize:Number.parseInt(n,10),value:e});return{dynamic:!1,encoded:nr(e)}}function _w(e){if(typeof e!="boolean")throw new oe(`Invalid boolean value: "${e}" (type: ${typeof e}). Expected: \`true\` or \`false\`.`);return{dynamic:!1,encoded:tr(Qf(e))}}function Ww(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 nd({max:r.toString(),min:o.toString(),signed:t,size:n/8,value:e.toString()})}return{dynamic:!1,encoded:Ve(e,{size:32,signed:t})}}function Vw(e){const t=La(e),n=Math.ceil(dt(t)/32),r=[];for(let o=0;o<n;o++)r.push(nr(Yt(t,o*32,(o+1)*32)));return{dynamic:!0,encoded:Ft(nr(Ve(dt(t),{size:32})),...r)}}function Hw(e,t){const{checksumAddress:n,parameter:r}=t;let o=!1;const s=[];for(let i=0;i<r.components.length;i++){const l=r.components[i],a=Array.isArray(e)?i:l.name,c=rl({checksumAddress:n,parameter:l,value:e[a]});s.push(c),c.dynamic&&(o=!0)}return{dynamic:o,encoded:o?ol(s):Ft(...s.map(({encoded:i})=>i))}}function sl(e){const t=e.match(/^(.*)\[(\d+)?\]$/);return t?[t[2]?Number(t[2]):null,t[1]]:void 0}function Go(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(Go);const n=sl(e.type);return!!(n&&Go({...e,type:n[1]}))}const Gw={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 Zw({count:this.recursiveReadCount+1,limit:this.recursiveReadLimit})},assertPosition(e){if(e<0||e>this.bytes.length-1)throw new Kw({length:this.bytes.length,position:e})},decrementPosition(e){if(e<0)throw new Kd({offset:e});const t=this.position-e;this.assertPosition(t),this.position=t},getReadCount(e){return this.positionReadCount.get(e||this.position)||0},incrementPosition(e){if(e<0)throw new Kd({offset:e});const t=this.position+e;this.assertPosition(t),this.position=t},inspectByte(e){const t=e??this.position;return this.assertPosition(t),this.bytes[t]},inspectBytes(e,t){const n=t??this.position;return this.assertPosition(n+e-1),this.bytes.subarray(n,n+e)},inspectUint8(e){const t=e??this.position;return this.assertPosition(t),this.bytes[t]},inspectUint16(e){const t=e??this.position;return this.assertPosition(t+1),this.dataView.getUint16(t)},inspectUint24(e){const t=e??this.position;return this.assertPosition(t+2),(this.dataView.getUint16(t)<<8)+this.dataView.getUint8(t+2)},inspectUint32(e){const t=e??this.position;return this.assertPosition(t+3),this.dataView.getUint32(t)},pushByte(e){this.assertPosition(this.position),this.bytes[this.position]=e,this.position++},pushBytes(e){this.assertPosition(this.position+e.length-1),this.bytes.set(e,this.position),this.position+=e.length},pushUint8(e){this.assertPosition(this.position),this.bytes[this.position]=e,this.position++},pushUint16(e){this.assertPosition(this.position+1),this.dataView.setUint16(this.position,e),this.position+=2},pushUint24(e){this.assertPosition(this.position+2),this.dataView.setUint16(this.position,e>>8),this.dataView.setUint8(this.position+2,e&255),this.position+=3},pushUint32(e){this.assertPosition(this.position+3),this.dataView.setUint32(this.position,e),this.position+=4},readByte(){this.assertReadLimit(),this._touch();const e=this.inspectByte();return this.position++,e},readBytes(e,t){this.assertReadLimit(),this._touch();const n=this.inspectBytes(e);return this.position+=t??e,n},readUint8(){this.assertReadLimit(),this._touch();const e=this.inspectUint8();return this.position+=1,e},readUint16(){this.assertReadLimit(),this._touch();const e=this.inspectUint16();return this.position+=2,e},readUint24(){this.assertReadLimit(),this._touch();const e=this.inspectUint24();return this.position+=3,e},readUint32(){this.assertReadLimit(),this._touch();const e=this.inspectUint32();return this.position+=4,e},get remaining(){return this.bytes.length-this.position},setPosition(e){const t=this.position;return this.assertPosition(e),this.position=e,()=>this.position=t},_touch(){if(this.recursiveReadLimit===Number.POSITIVE_INFINITY)return;const e=this.getReadCount();this.positionReadCount.set(this.position,e+1),e>0&&this.recursiveReadCount++}};function qw(e,{recursiveReadLimit:t=8192}={}){const n=Object.create(Gw);return n.bytes=e,n.dataView=new DataView(e.buffer,e.byteOffset,e.byteLength),n.positionReadCount=new Map,n.recursiveReadLimit=t,n}class Kd extends oe{constructor({offset:t}){super(`Offset \`${t}\` cannot be negative.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Cursor.NegativeOffsetError"})}}class Kw extends oe{constructor({length:t,position:n}){super(`Position \`${n}\` is out of bounds (\`0 < position < ${t}\`).`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Cursor.PositionOutOfBoundsError"})}}class Zw extends oe{constructor({count:t,limit:n}){super(`Recursive read limit of \`${n}\` exceeded (recursive read count: \`${t}\`).`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Cursor.RecursiveReadLimitExceededError"})}}function Yw(e,t,n={}){const{as:r="Array",checksumAddress:o=!1}=n,s=typeof t=="string"?Xf(t):t,i=qw(s);if($r(s)===0&&e.length>0)throw new Jw;if($r(s)&&$r(s)<32)throw new Xw({data:typeof t=="string"?t:Rt(t),parameters:e,size:$r(s)});let l=0;const a=r==="Array"?[]:{};for(let c=0;c<e.length;++c){const u=e[c];i.setPosition(l);const[f,p]=Lr(i,u,{checksumAddress:o,staticPosition:0});l+=p,r==="Array"?a.push(f):a[u.name??c]=f}return a}function il(e,t,n){const{checksumAddress:r=!1}={};if(e.length!==t.length)throw new Xd({expectedLength:e.length,givenLength:t.length});const o=Rw({checksumAddress:r,parameters:e,values:t}),s=ol(o);return s.length===0?"0x":s}function al(e,t){if(e.length!==t.length)throw new Xd({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(al.encode(o,s))}return Ft(...n)}(function(e){function t(n,r,o=!1){if(n==="address"){const a=r;return Vs(a),tr(a.toLowerCase(),o?32:0)}if(n==="string")return La(r);if(n==="bytes")return r;if(n==="bool")return tr(Qf(r),o?32:1);const s=n.match(Hd);if(s){const[a,c,u="256"]=s,f=Number.parseInt(u,10)/8;return Ve(r,{size:o?32:f,signed:c==="int"})}const i=n.match(Iw);if(i){const[a,c]=i;if(Number.parseInt(c,10)!==(r.length-2)/2)throw new Yd({expectedSize:Number.parseInt(c,10),value:r});return nr(r,o?32:0)}const l=n.match(Ow);if(l&&Array.isArray(r)){const[a,c]=l,u=[];for(let f=0;f<r.length;f++)u.push(t(c,r[f],!0));return u.length===0?"0x":Ft(...u)}throw new ll(n)}e.encode=t})(al||(al={}));function Zd(e){return Array.isArray(e)&&typeof e[0]=="string"||typeof e=="string"?vu(e):e}class Xw extends oe{constructor({data:t,parameters:n,size:r}){super(`Data size of ${r} bytes is too small for given parameters.`,{metaMessages:[`Params: (${mr(n)})`,`Data: ${t} (${r} bytes)`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiParameters.DataSizeTooSmallError"})}}class Jw extends oe{constructor(){super('Cannot decode zero data ("0x") with ABI parameters.'),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiParameters.ZeroDataError"})}}class Qw extends oe{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 Yd extends oe{constructor({expectedSize:t,value:n}){super(`Size of bytes "${n}" (bytes${dt(n)}) does not match expected size (bytes${t}).`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiParameters.BytesSizeMismatchError"})}}class Xd extends oe{constructor({expectedLength:t,givenLength:n}){super(["ABI encoding parameters/values length mismatch.",`Expected length (parameters): ${t}`,`Given length (values): ${n}`].join(`
90
- `)),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiParameters.LengthMismatchError"})}}class e6 extends oe{constructor(t){super(`Value \`${t}\` is not a valid array.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiParameters.InvalidArrayError"})}}class ll extends oe{constructor(t){super(`Type \`${t}\` is not a valid ABI Type.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiParameters.InvalidTypeError"})}}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const et=BigInt(0),He=BigInt(1),rr=BigInt(2),t6=BigInt(3),Jd=BigInt(4),Qd=BigInt(5),e0=BigInt(8);function tt(e,t){const n=e%t;return n>=et?n:t+n}function xt(e,t,n){let r=e;for(;t-- >et;)r*=r,r%=n;return r}function cl(e,t){if(e===et)throw new Error("invert: expected non-zero number");if(t<=et)throw new Error("invert: expected positive modulus, got "+t);let n=tt(e,t),r=t,o=et,s=He;for(;n!==et;){const l=r/n,a=r%n,c=o-s*l;r=n,n=a,o=s,s=c}if(r!==He)throw new Error("invert: does not exist");return tt(o,t)}function t0(e,t){const n=(e.ORDER+He)/Jd,r=e.pow(t,n);if(!e.eql(e.sqr(r),t))throw new Error("Cannot find square root");return r}function n6(e,t){const n=(e.ORDER-Qd)/e0,r=e.mul(t,rr),o=e.pow(r,n),s=e.mul(t,o),i=e.mul(e.mul(s,rr),o),l=e.mul(s,e.sub(i,e.ONE));if(!e.eql(e.sqr(l),t))throw new Error("Cannot find square root");return l}function r6(e){if(e<BigInt(3))throw new Error("sqrt is not defined for small field");let t=e-He,n=0;for(;t%rr===et;)t/=rr,n++;let r=rr;const o=ul(e);for(;r0(o,r)===1;)if(r++>1e3)throw new Error("Cannot find square root: probably non-prime P");if(n===1)return t0;let s=o.pow(r,t);const i=(t+He)/rr;return function(a,c){if(a.is0(c))return c;if(r0(a,c)!==1)throw new Error("Cannot find square root");let u=n,f=a.mul(a.ONE,s),p=a.pow(c,t),d=a.pow(c,i);for(;!a.eql(p,a.ONE);){if(a.is0(p))return a.ZERO;let h=1,b=a.sqr(p);for(;!a.eql(b,a.ONE);)if(h++,b=a.sqr(b),h===u)throw new Error("Cannot find square root");const w=He<<BigInt(u-h-1),P=a.pow(f,w);u=h,f=a.sqr(P),p=a.mul(p,f),d=a.mul(d,P)}return d}}function o6(e){return e%Jd===t6?t0:e%e0===Qd?n6:r6(e)}const s6=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function i6(e){const t={ORDER:"bigint",MASK:"bigint",BYTES:"isSafeInteger",BITS:"isSafeInteger"},n=s6.reduce((r,o)=>(r[o]="function",r),t);return Ls(e,n)}function a6(e,t,n){if(n<et)throw new Error("invalid exponent, negatives unsupported");if(n===et)return e.ONE;if(n===He)return t;let r=e.ONE,o=t;for(;n>et;)n&He&&(r=e.mul(r,o)),o=e.sqr(o),n>>=He;return r}function n0(e,t,n=!1){const r=new Array(t.length).fill(n?e.ZERO:void 0),o=t.reduce((i,l,a)=>e.is0(l)?i:(r[a]=i,e.mul(i,l)),e.ONE),s=e.inv(o);return t.reduceRight((i,l,a)=>e.is0(l)?i:(r[a]=e.mul(i,r[a]),e.mul(i,l)),s),r}function r0(e,t){const n=(e.ORDER-He)/rr,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 o0(e,t){t!==void 0&&oo(t);const n=t!==void 0?t:e.toString(2).length,r=Math.ceil(n/8);return{nBitLength:n,nByteLength:r}}function ul(e,t,n=!1,r={}){if(e<=et)throw new Error("invalid field: expected ORDER > 0, got "+e);const{nBitLength:o,nByteLength:s}=o0(e,t);if(s>2048)throw new Error("invalid field: expected ORDER of <= 2048 bytes");let i;const l=Object.freeze({ORDER:e,isLE:n,BITS:o,BYTES:s,MASK:Bs(o),ZERO:et,ONE:He,create:a=>tt(a,e),isValid:a=>{if(typeof a!="bigint")throw new Error("invalid field element: expected bigint, got "+typeof a);return et<=a&&a<e},is0:a=>a===et,isOdd:a=>(a&He)===He,neg:a=>tt(-a,e),eql:(a,c)=>a===c,sqr:a=>tt(a*a,e),add:(a,c)=>tt(a+c,e),sub:(a,c)=>tt(a-c,e),mul:(a,c)=>tt(a*c,e),pow:(a,c)=>a6(l,a,c),div:(a,c)=>tt(a*cl(c,e),e),sqrN:a=>a*a,addN:(a,c)=>a+c,subN:(a,c)=>a-c,mulN:(a,c)=>a*c,inv:a=>cl(a,e),sqrt:r.sqrt||(a=>(i||(i=o6(e)),i(l,a))),toBytes:a=>n?Wf(a,s):zo(a,s),fromBytes:a=>{if(a.length!==s)throw new Error("Field.fromBytes: expected "+s+" bytes, got "+a.length);return n?_f(a):er(a)},invertBatch:a=>n0(l,a),cmov:(a,c,u)=>u?c:a});return Object.freeze(l)}function s0(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 i0(e){const t=s0(e);return t+Math.ceil(t/2)}function l6(e,t,n=!1){const r=e.length,o=s0(t),s=i0(t);if(r<16||r<s||r>1024)throw new Error("expected "+s+"-1024 bytes of input, got "+r);const i=n?_f(e):er(e),l=tt(i,t-He)+He;return n?Wf(l,o):zo(l,o)}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const a0=BigInt(0),fl=BigInt(1);function dl(e,t){const n=t.negate();return e?n:t}function l0(e,t){if(!Number.isSafeInteger(e)||e<=0||e>t)throw new Error("invalid window size, expected [1.."+t+"], got W="+e)}function pl(e,t){l0(e,t);const n=Math.ceil(t/e)+1,r=2**(e-1),o=2**e,s=Bs(e),i=BigInt(e);return{windows:n,windowSize:r,mask:s,maxNumber:o,shiftBy:i}}function c0(e,t,n){const{windowSize:r,mask:o,maxNumber:s,shiftBy:i}=n;let l=Number(e&o),a=e>>i;l>r&&(l-=s,a+=fl);const c=t*r,u=c+Math.abs(l)-1,f=l===0,p=l<0,d=t%2!==0;return{nextN:a,offset:u,isZero:f,isNeg:p,isNegF:d,offsetF:c}}function c6(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 u6(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 hl=new WeakMap,u0=new WeakMap;function ml(e){return u0.get(e)||1}function f6(e,t){return{constTimeNegate:dl,hasPrecomputes(n){return ml(n)!==1},unsafeLadder(n,r,o=e.ZERO){let s=n;for(;r>a0;)r&fl&&(o=o.add(s)),s=s.double(),r>>=fl;return o},precomputeWindow(n,r){const{windows:o,windowSize:s}=pl(r,t),i=[];let l=n,a=l;for(let c=0;c<o;c++){a=l,i.push(a);for(let u=1;u<s;u++)a=a.add(l),i.push(a);l=a.double()}return i},wNAF(n,r,o){let s=e.ZERO,i=e.BASE;const l=pl(n,t);for(let a=0;a<l.windows;a++){const{nextN:c,offset:u,isZero:f,isNeg:p,isNegF:d,offsetF:h}=c0(o,a,l);o=c,f?i=i.add(dl(d,r[h])):s=s.add(dl(p,r[u]))}return{p:s,f:i}},wNAFUnsafe(n,r,o,s=e.ZERO){const i=pl(n,t);for(let l=0;l<i.windows&&o!==a0;l++){const{nextN:a,offset:c,isZero:u,isNeg:f}=c0(o,l,i);if(o=a,!u){const p=r[c];s=s.add(f?p.negate():p)}}return s},getPrecomputes(n,r,o){let s=hl.get(r);return s||(s=this.precomputeWindow(r,n),n!==1&&hl.set(r,o(s))),s},wNAFCached(n,r,o){const s=ml(n);return this.wNAF(s,this.getPrecomputes(s,n,o),r)},wNAFCachedUnsafe(n,r,o,s){const i=ml(n);return i===1?this.unsafeLadder(n,r,s):this.wNAFUnsafe(i,this.getPrecomputes(i,n,o),r,s)},setWindowSize(n,r){l0(r,t),u0.set(n,r),hl.delete(n)}}}function d6(e,t,n,r){c6(n,e),u6(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,l=Py(BigInt(o));let a=1;l>12?a=l-3:l>4?a=l-2:l>0&&(a=2);const c=Bs(a),u=new Array(Number(c)+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 b=0;b<s;b++){const w=r[b],P=Number(w>>BigInt(d)&c);u[P]=u[P].add(n[b])}let h=i;for(let b=u.length-1,w=i;b>0;b--)w=w.add(u[b]),h=h.add(w);if(p=p.add(h),d!==0)for(let b=0;b<a;b++)p=p.double()}return p}function f0(e){return i6(e.Fp),Ls(e,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze({...o0(e.n,e.nBitLength),...e,p:e.Fp.ORDER})}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */function d0(e){e.lowS!==void 0&&Ro("lowS",e.lowS),e.prehash!==void 0&&Ro("prehash",e.prehash)}function p6(e){const t=f0(e);Ls(t,{a:"field",b:"field"},{allowInfinityPoint:"boolean",allowedPrivateKeyLengths:"array",clearCofactor:"function",fromBytes:"function",isTorsionFree:"function",toBytes:"function",wrapPrivateKey:"boolean"});const{endo:n,Fp:r,a:o}=t;if(n){if(!r.eql(o,r.ZERO))throw new Error("invalid endo: CURVE.a must be 0");if(typeof n!="object"||typeof n.beta!="bigint"||typeof n.splitScalar!="function")throw new Error('invalid endo: expected "beta": bigint and "splitScalar": function')}return Object.freeze({...t})}class h6 extends Error{constructor(t=""){super(t)}}const mn={Err:h6,_tlv:{encode:(e,t)=>{const{Err:n}=mn;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=ks(r);if(o.length/2&128)throw new n("tlv.encode: long form length too big");const s=r>127?ks(o.length/2|128):"";return ks(e)+s+o+t},decode(e,t){const{Err:n}=mn;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 c=t.subarray(r,r+a);if(c.length!==a)throw new n("tlv.decode: length bytes not complete");if(c[0]===0)throw new n("tlv.decode(long): zero leftmost byte");for(const u of c)i=i<<8|u;if(r+=a,i<128)throw new n("tlv.decode(long): not minimal encoding")}const l=t.subarray(r,r+i);if(l.length!==i)throw new n("tlv.decode: wrong value length");return{v:l,l:t.subarray(r+i)}}},_int:{encode(e){const{Err:t}=mn;if(e<bn)throw new t("integer: negative integers are not allowed");let n=ks(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}=mn;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 er(e)}},toSig(e){const{Err:t,_int:n,_tlv:r}=mn,o=wt("signature",e),{v:s,l:i}=r.decode(48,o);if(i.length)throw new t("invalid signature: left bytes after parsing");const{v:l,l:a}=r.decode(2,s),{v:c,l:u}=r.decode(2,a);if(u.length)throw new t("invalid signature: left bytes after parsing");return{r:n.decode(l),s:n.decode(c)}},hexFromSig(e){const{_tlv:t,_int:n}=mn,r=t.encode(2,n.encode(e.r)),o=t.encode(2,n.encode(e.s)),s=r+o;return t.encode(48,s)}};function bl(e,t){return jo(zo(e,t))}const bn=BigInt(0),Be=BigInt(1);BigInt(2);const gl=BigInt(3),m6=BigInt(4);function b6(e){const t=p6(e),{Fp:n}=t,r=ul(t.n,t.nBitLength),o=t.toBytes||((E,A,D)=>{const L=A.toAffine();return Ds(Uint8Array.from([4]),n.toBytes(L.x),n.toBytes(L.y))}),s=t.fromBytes||(E=>{const A=E.subarray(1),D=n.fromBytes(A.subarray(0,n.BYTES)),L=n.fromBytes(A.subarray(n.BYTES,2*n.BYTES));return{x:D,y:L}});function i(E){const{a:A,b:D}=t,L=n.sqr(E),F=n.mul(L,E);return n.add(n.add(F,n.mul(E,A)),D)}function l(E,A){const D=n.sqr(A),L=i(E);return n.eql(D,L)}if(!l(t.Gx,t.Gy))throw new Error("bad curve params: generator point");const a=n.mul(n.pow(t.a,gl),m6),c=n.mul(n.sqr(t.b),BigInt(27));if(n.is0(n.add(a,c)))throw new Error("bad curve params: a or b");function u(E){return Da(E,Be,t.n)}function f(E){const{allowedPrivateKeyLengths:A,nByteLength:D,wrapPrivateKey:L,n:F}=t;if(A&&typeof E!="bigint"){if(Fo(E)&&(E=jo(E)),typeof E!="string"||!A.includes(E.length))throw new Error("invalid private key");E=E.padStart(D*2,"0")}let m;try{m=typeof E=="bigint"?E:er(wt("private key",E,D))}catch{throw new Error("invalid private key, expected hex or "+D+" bytes, got "+typeof E)}return L&&(m=tt(m,F)),Ir("private key",m,Be,F),m}function p(E){if(!(E instanceof b))throw new Error("ProjectivePoint expected")}const d=Hf((E,A)=>{const{px:D,py:L,pz:F}=E;if(n.eql(F,n.ONE))return{x:D,y:L};const m=E.is0();A==null&&(A=m?n.ONE:n.inv(F));const v=n.mul(D,A),S=n.mul(L,A),$=n.mul(F,A);if(m)return{x:n.ZERO,y:n.ZERO};if(!n.eql($,n.ONE))throw new Error("invZ was invalid");return{x:v,y:S}}),h=Hf(E=>{if(E.is0()){if(t.allowInfinityPoint&&!n.is0(E.py))return;throw new Error("bad point: ZERO")}const{x:A,y:D}=E.toAffine();if(!n.isValid(A)||!n.isValid(D))throw new Error("bad point: x or y not FE");if(!l(A,D))throw new Error("bad point: equation left != right");if(!E.isTorsionFree())throw new Error("bad point: not in prime-order subgroup");return!0});class b{constructor(A,D,L){if(A==null||!n.isValid(A))throw new Error("x required");if(D==null||!n.isValid(D)||n.is0(D))throw new Error("y required");if(L==null||!n.isValid(L))throw new Error("z required");this.px=A,this.py=D,this.pz=L,Object.freeze(this)}static fromAffine(A){const{x:D,y:L}=A||{};if(!A||!n.isValid(D)||!n.isValid(L))throw new Error("invalid affine point");if(A instanceof b)throw new Error("projective point not allowed");const F=m=>n.eql(m,n.ZERO);return F(D)&&F(L)?b.ZERO:new b(D,L,n.ONE)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static normalizeZ(A){const D=n0(n,A.map(L=>L.pz));return A.map((L,F)=>L.toAffine(D[F])).map(b.fromAffine)}static fromHex(A){const D=b.fromAffine(s(wt("pointHex",A)));return D.assertValidity(),D}static fromPrivateKey(A){return b.BASE.multiply(f(A))}static msm(A,D){return d6(b,r,A,D)}_setWindowSize(A){x.setWindowSize(this,A)}assertValidity(){h(this)}hasEvenY(){const{y:A}=this.toAffine();if(n.isOdd)return!n.isOdd(A);throw new Error("Field doesn't support isOdd")}equals(A){p(A);const{px:D,py:L,pz:F}=this,{px:m,py:v,pz:S}=A,$=n.eql(n.mul(D,S),n.mul(m,F)),I=n.eql(n.mul(L,S),n.mul(v,F));return $&&I}negate(){return new b(this.px,n.neg(this.py),this.pz)}double(){const{a:A,b:D}=t,L=n.mul(D,gl),{px:F,py:m,pz:v}=this;let S=n.ZERO,$=n.ZERO,I=n.ZERO,C=n.mul(F,F),M=n.mul(m,m),y=n.mul(v,v),O=n.mul(F,m);return O=n.add(O,O),I=n.mul(F,v),I=n.add(I,I),S=n.mul(A,I),$=n.mul(L,y),$=n.add(S,$),S=n.sub(M,$),$=n.add(M,$),$=n.mul(S,$),S=n.mul(O,S),I=n.mul(L,I),y=n.mul(A,y),O=n.sub(C,y),O=n.mul(A,O),O=n.add(O,I),I=n.add(C,C),C=n.add(I,C),C=n.add(C,y),C=n.mul(C,O),$=n.add($,C),y=n.mul(m,v),y=n.add(y,y),C=n.mul(y,O),S=n.sub(S,C),I=n.mul(y,M),I=n.add(I,I),I=n.add(I,I),new b(S,$,I)}add(A){p(A);const{px:D,py:L,pz:F}=this,{px:m,py:v,pz:S}=A;let $=n.ZERO,I=n.ZERO,C=n.ZERO;const M=t.a,y=n.mul(t.b,gl);let O=n.mul(D,m),k=n.mul(L,v),T=n.mul(F,S),B=n.add(D,L),R=n.add(m,v);B=n.mul(B,R),R=n.add(O,k),B=n.sub(B,R),R=n.add(D,F);let z=n.add(m,S);return R=n.mul(R,z),z=n.add(O,T),R=n.sub(R,z),z=n.add(L,F),$=n.add(v,S),z=n.mul(z,$),$=n.add(k,T),z=n.sub(z,$),C=n.mul(M,R),$=n.mul(y,T),C=n.add($,C),$=n.sub(k,C),C=n.add(k,C),I=n.mul($,C),k=n.add(O,O),k=n.add(k,O),T=n.mul(M,T),R=n.mul(y,R),k=n.add(k,T),T=n.sub(O,T),T=n.mul(M,T),R=n.add(R,T),O=n.mul(k,R),I=n.add(I,O),O=n.mul(z,R),$=n.mul(B,$),$=n.sub($,O),O=n.mul(B,k),C=n.mul(z,C),C=n.add(C,O),new b($,I,C)}subtract(A){return this.add(A.negate())}is0(){return this.equals(b.ZERO)}wNAF(A){return x.wNAFCached(this,A,b.normalizeZ)}multiplyUnsafe(A){const{endo:D,n:L}=t;Ir("scalar",A,bn,L);const F=b.ZERO;if(A===bn)return F;if(this.is0()||A===Be)return this;if(!D||x.hasPrecomputes(this))return x.wNAFCachedUnsafe(this,A,b.normalizeZ);let{k1neg:m,k1:v,k2neg:S,k2:$}=D.splitScalar(A),I=F,C=F,M=this;for(;v>bn||$>bn;)v&Be&&(I=I.add(M)),$&Be&&(C=C.add(M)),M=M.double(),v>>=Be,$>>=Be;return m&&(I=I.negate()),S&&(C=C.negate()),C=new b(n.mul(C.px,D.beta),C.py,C.pz),I.add(C)}multiply(A){const{endo:D,n:L}=t;Ir("scalar",A,Be,L);let F,m;if(D){const{k1neg:v,k1:S,k2neg:$,k2:I}=D.splitScalar(A);let{p:C,f:M}=this.wNAF(S),{p:y,f:O}=this.wNAF(I);C=x.constTimeNegate(v,C),y=x.constTimeNegate($,y),y=new b(n.mul(y.px,D.beta),y.py,y.pz),F=C.add(y),m=M.add(O)}else{const{p:v,f:S}=this.wNAF(A);F=v,m=S}return b.normalizeZ([F,m])[0]}multiplyAndAddUnsafe(A,D,L){const F=b.BASE,m=(S,$)=>$===bn||$===Be||!S.equals(F)?S.multiplyUnsafe($):S.multiply($),v=m(this,D).add(m(A,L));return v.is0()?void 0:v}toAffine(A){return d(this,A)}isTorsionFree(){const{h:A,isTorsionFree:D}=t;if(A===Be)return!0;if(D)return D(b,this);throw new Error("isTorsionFree() has not been declared for the elliptic curve")}clearCofactor(){const{h:A,clearCofactor:D}=t;return A===Be?this:D?D(b,this):this.multiplyUnsafe(t.h)}toRawBytes(A=!0){return Ro("isCompressed",A),this.assertValidity(),o(b,this,A)}toHex(A=!0){return Ro("isCompressed",A),jo(this.toRawBytes(A))}}b.BASE=new b(t.Gx,t.Gy,n.ONE),b.ZERO=new b(n.ZERO,n.ONE,n.ZERO);const{endo:w,nBitLength:P}=t,x=f6(b,w?Math.ceil(P/2):P);return{CURVE:t,ProjectivePoint:b,normPrivateKeyToScalar:f,weierstrassEquation:i,isWithinCurveOrder:u}}function g6(e){const t=f0(e);return Ls(t,{hash:"hash",hmac:"function",randomBytes:"function"},{bits2int:"function",bits2int_modN:"function",lowS:"boolean"}),Object.freeze({lowS:!0,...t})}function y6(e){const t=g6(e),{Fp:n,n:r,nByteLength:o,nBitLength:s}=t,i=n.BYTES+1,l=2*n.BYTES+1;function a(y){return tt(y,r)}function c(y){return cl(y,r)}const{ProjectivePoint:u,normPrivateKeyToScalar:f,weierstrassEquation:p,isWithinCurveOrder:d}=b6({...t,toBytes(y,O,k){const T=O.toAffine(),B=n.toBytes(T.x),R=Ds;return Ro("isCompressed",k),k?R(Uint8Array.from([O.hasEvenY()?2:3]),B):R(Uint8Array.from([4]),B,n.toBytes(T.y))},fromBytes(y){const O=y.length,k=y[0],T=y.subarray(1);if(O===i&&(k===2||k===3)){const B=er(T);if(!Da(B,Be,n.ORDER))throw new Error("Point is not on curve");const R=p(B);let z;try{z=n.sqrt(R)}catch(J){const K=J instanceof Error?": "+J.message:"";throw new Error("Point is not on curve"+K)}const _=(z&Be)===Be;return(k&1)===1!==_&&(z=n.neg(z)),{x:B,y:z}}else if(O===l&&k===4){const B=n.fromBytes(T.subarray(0,n.BYTES)),R=n.fromBytes(T.subarray(n.BYTES,2*n.BYTES));return{x:B,y:R}}else{const B=i,R=l;throw new Error("invalid Point, expected length of "+B+", or uncompressed "+R+", got "+O)}}});function h(y){const O=r>>Be;return y>O}function b(y){return h(y)?a(-y):y}const w=(y,O,k)=>er(y.slice(O,k));class P{constructor(O,k,T){Ir("r",O,Be,r),Ir("s",k,Be,r),this.r=O,this.s=k,T!=null&&(this.recovery=T),Object.freeze(this)}static fromCompact(O){const k=o;return O=wt("compactSignature",O,k*2),new P(w(O,0,k),w(O,k,2*k))}static fromDER(O){const{r:k,s:T}=mn.toSig(wt("DER",O));return new P(k,T)}assertValidity(){}addRecoveryBit(O){return new P(this.r,this.s,O)}recoverPublicKey(O){const{r:k,s:T,recovery:B}=this,R=F(wt("msgHash",O));if(B==null||![0,1,2,3].includes(B))throw new Error("recovery id invalid");const z=B===2||B===3?k+t.n:k;if(z>=n.ORDER)throw new Error("recovery id 2 or 3 invalid");const _=B&1?"03":"02",G=u.fromHex(_+bl(z,n.BYTES)),J=c(z),K=a(-R*J),W=a(T*J),ne=u.BASE.multiplyAndAddUnsafe(G,K,W);if(!ne)throw new Error("point at infinify");return ne.assertValidity(),ne}hasHighS(){return h(this.s)}normalizeS(){return this.hasHighS()?new P(this.r,a(-this.s),this.recovery):this}toDERRawBytes(){return Ms(this.toDERHex())}toDERHex(){return mn.hexFromSig(this)}toCompactRawBytes(){return Ms(this.toCompactHex())}toCompactHex(){const O=o;return bl(this.r,O)+bl(this.s,O)}}const x={isValidPrivateKey(y){try{return f(y),!0}catch{return!1}},normPrivateKeyToScalar:f,randomPrivateKey:()=>{const y=i0(t.n);return l6(t.randomBytes(y),t.n)},precompute(y=8,O=u.BASE){return O._setWindowSize(y),O.multiply(BigInt(3)),O}};function E(y,O=!0){return u.fromPrivateKey(y).toRawBytes(O)}function A(y){if(typeof y=="bigint")return!1;if(y instanceof u)return!0;const k=wt("key",y).length,T=n.BYTES,B=T+1,R=2*T+1;if(!(t.allowedPrivateKeyLengths||o===B))return k===B||k===R}function D(y,O,k=!0){if(A(y)===!0)throw new Error("first arg must be private key");if(A(O)===!1)throw new Error("second arg must be public key");return u.fromHex(O).multiply(f(y)).toRawBytes(k)}const L=t.bits2int||function(y){if(y.length>8192)throw new Error("input is too large");const O=er(y),k=y.length*8-s;return k>0?O>>BigInt(k):O},F=t.bits2int_modN||function(y){return a(L(y))},m=Bs(s);function v(y){return Ir("num < 2^"+s,y,bn,m),zo(y,o)}function S(y,O,k=$){if(["recovered","canonical"].some(fe=>fe in k))throw new Error("sign() legacy options not supported");const{hash:T,randomBytes:B}=t;let{lowS:R,prehash:z,extraEntropy:_}=k;R==null&&(R=!0),y=wt("msgHash",y),d0(k),z&&(y=wt("prehashed msgHash",T(y)));const G=F(y),J=f(O),K=[v(J),v(G)];if(_!=null&&_!==!1){const fe=_===!0?B(n.BYTES):_;K.push(wt("extraEntropy",fe))}const W=Ds(...K),ne=G;function be(fe){const xe=L(fe);if(!d(xe))return;const ye=c(xe),Y=u.BASE.multiply(xe).toAffine(),H=a(Y.x);if(H===bn)return;const ee=a(ye*a(ne+H*J));if(ee===bn)return;let Q=(Y.x===H?0:2)|Number(Y.y&Be),ve=ee;return R&&h(ee)&&(ve=b(ee),Q^=1),new P(H,ve,Q)}return{seed:W,k2sig:be}}const $={lowS:t.lowS,prehash:!1},I={lowS:t.lowS,prehash:!1};function C(y,O,k=$){const{seed:T,k2sig:B}=S(y,O,k),R=t;return Ty(R.hash.outputLen,R.nByteLength,R.hmac)(T,B)}u.BASE._setWindowSize(8);function M(y,O,k,T=I){var Q;const B=y;O=wt("msgHash",O),k=wt("publicKey",k);const{lowS:R,prehash:z,format:_}=T;if(d0(T),"strict"in T)throw new Error("options.strict was renamed to lowS");if(_!==void 0&&_!=="compact"&&_!=="der")throw new Error("format must be compact or der");const G=typeof B=="string"||Fo(B),J=!G&&!_&&typeof B=="object"&&B!==null&&typeof B.r=="bigint"&&typeof B.s=="bigint";if(!G&&!J)throw new Error("invalid signature, expected Uint8Array, hex string or Signature instance");let K,W;try{if(J&&(K=new P(B.r,B.s)),G){try{_!=="compact"&&(K=P.fromDER(B))}catch(ve){if(!(ve instanceof mn.Err))throw ve}!K&&_!=="der"&&(K=P.fromCompact(B))}W=u.fromHex(k)}catch{return!1}if(!K||R&&K.hasHighS())return!1;z&&(O=t.hash(O));const{r:ne,s:be}=K,fe=F(O),xe=c(be),ye=a(fe*xe),Y=a(ne*xe),H=(Q=u.BASE.multiplyAndAddUnsafe(W,ye,Y))==null?void 0:Q.toAffine();return H?a(H.x)===ne:!1}return{CURVE:t,getPublicKey:E,getSharedSecret:D,sign:C,verify:M,ProjectivePoint:u,Signature:P,utils:x}}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */function v6(e){return{hash:e,hmac:(t,...n)=>Ud(e,t,j1(...n)),randomBytes:z1}}function w6(e,t){const n=r=>y6({...e,...v6(r)});return{...n(t),create:n}}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const p0=BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),h0=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),x6=BigInt(0),E6=BigInt(1),yl=BigInt(2),m0=(e,t)=>(e+t/yl)/t;function S6(e){const t=p0,n=BigInt(3),r=BigInt(6),o=BigInt(11),s=BigInt(22),i=BigInt(23),l=BigInt(44),a=BigInt(88),c=e*e*e%t,u=c*c*e%t,f=xt(u,n,t)*u%t,p=xt(f,n,t)*u%t,d=xt(p,yl,t)*c%t,h=xt(d,o,t)*d%t,b=xt(h,s,t)*h%t,w=xt(b,l,t)*b%t,P=xt(w,a,t)*w%t,x=xt(P,l,t)*b%t,E=xt(x,n,t)*u%t,A=xt(E,i,t)*h%t,D=xt(A,r,t)*c%t,L=xt(D,yl,t);if(!vl.eql(vl.sqr(L),e))throw new Error("Cannot find square root");return L}const vl=ul(p0,void 0,void 0,{sqrt:S6}),b0=w6({a:x6,b:BigInt(7),Fp:vl,n:h0,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),h:BigInt(1),lowS:!0,endo:{beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar:e=>{const t=h0,n=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),r=-E6*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),o=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),s=n,i=BigInt("0x100000000000000000000000000000000"),l=m0(s*e,t),a=m0(-r*e,t);let c=tt(e-l*n-a*o,t),u=tt(-l*r-a*s,t);const f=c>i,p=u>i;if(f&&(c=t-c),p&&(u=t-u),c>i||u>i)throw new Error("splitScalar: Endomorphism failed, k="+e);return{k1neg:f,k1:c,k2neg:p,k2:u}}}},Of),P6=Object.freeze(Object.defineProperty({__proto__:null,secp256k1:b0},Symbol.toStringTag,{value:"Module"}));function g0(e,t={}){const{recovered:n}=t;if(typeof e.r>"u")throw new xl({signature:e});if(typeof e.s>"u")throw new xl({signature:e});if(n&&typeof e.yParity>"u")throw new xl({signature:e});if(e.r<0n||e.r>Gd)throw new $6({value:e.r});if(e.s<0n||e.s>Gd)throw new k6({value:e.s});if(typeof e.yParity=="number"&&e.yParity!==0&&e.yParity!==1)throw new El({value:e.yParity})}function T6(e){return y0(Rt(e))}function y0(e){if(e.length!==130&&e.length!==132)throw new I6({signature:e});const t=BigInt(Yt(e,0,32)),n=BigInt(Yt(e,32,64)),r=(()=>{const o=+`0x${e.slice(130)}`;if(!Number.isNaN(o))try{return wl(o)}catch{throw new El({value:o})}})();return typeof r>"u"?{r:t,s:n}:{r:t,s:n,yParity:r}}function A6(e){if(!(typeof e.r>"u")&&!(typeof e.s>"u"))return N6(e)}function N6(e){const t=typeof e=="string"?y0(e):e instanceof Uint8Array?T6(e):typeof e.r=="string"?O6(e):e.v?C6(e):{r:e.r,s:e.s,...typeof e.yParity<"u"?{yParity:e.yParity}:{}};return g0(t),t}function C6(e){return{r:e.r,s:e.s,yParity:wl(e.v)}}function O6(e){const t=(()=>{const n=e.v?Number(e.v):void 0;let r=e.yParity?Number(e.yParity):void 0;if(typeof n=="number"&&typeof r!="number"&&(r=wl(n)),typeof r!="number")throw new El({value:e.yParity});return r})();return{r:BigInt(e.r),s:BigInt(e.s),yParity:t}}function wl(e){if(e===0||e===27)return 0;if(e===1||e===28)return 1;if(e>=35)return e%2===0?1:0;throw new M6({value:e})}class I6 extends oe{constructor({signature:t}){super(`Value \`${t}\` is an invalid signature size.`,{metaMessages:["Expected: 64 bytes or 65 bytes.",`Received ${dt(Yy(t))} bytes.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Signature.InvalidSerializedSizeError"})}}class xl extends oe{constructor({signature:t}){super(`Signature \`${Yf(t)}\` is missing either an \`r\`, \`s\`, or \`yParity\` property.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Signature.MissingPropertiesError"})}}class $6 extends oe{constructor({value:t}){super(`Value \`${t}\` is an invalid r value. r must be a positive integer less than 2^256.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Signature.InvalidRError"})}}class k6 extends oe{constructor({value:t}){super(`Value \`${t}\` is an invalid s value. s must be a positive integer less than 2^256.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Signature.InvalidSError"})}}class El extends oe{constructor({value:t}){super(`Value \`${t}\` is an invalid y-parity value. Y-parity must be 0 or 1.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Signature.InvalidYParityError"})}}class M6 extends oe{constructor({value:t}){super(`Value \`${t}\` is an invalid v value. v must be 27, 28 or >=35.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Signature.InvalidVError"})}}function D6(e,t={}){return typeof e.chainId=="string"?B6(e):{...e,...t.signature}}function B6(e){const{address:t,chainId:n,nonce:r}=e,o=A6(e);return{address:t,chainId:Number(n),nonce:BigInt(r),...o}}const L6="0x8010801080108010801080108010801080108010801080108010801080108010",F6=Zd("(uint256 chainId, address delegation, uint256 nonce, uint8 yParity, uint256 r, uint256 s), address to, bytes data");function v0(e){if(typeof e=="string"){if(Yt(e,-32)!==L6)throw new z6(e)}else g0(e.authorization)}function R6(e){v0(e);const t=td(Yt(e,-64,-32)),n=Yt(e,-t-64,-64),r=Yt(e,0,-t-64),[o,s,i]=Yw(F6,n);return{authorization:D6({address:o.delegation,chainId:Number(o.chainId),nonce:o.nonce,yParity:o.yParity,r:o.r,s:o.s}),signature:r,...i&&i!=="0x"?{data:i,to:s}:{}}}function j6(e){try{return v0(e),!0}catch{return!1}}let z6=class extends oe{constructor(t){super(`Value \`${t}\` is an invalid ERC-8010 wrapped signature.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"SignatureErc8010.InvalidWrappedSignatureError"})}};class U6 extends V{constructor({value:t}){super(`Number \`${t}\` is not a valid decimal number.`,{name:"InvalidDecimalNumberError"})}}function _6(e,t){if(!/^(-?)([0-9]*)\.?([0-9]*)$/.test(e))throw new U6({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,l]=[r.slice(0,t-1),r.slice(t-1,t),r.slice(t)],a=Math.round(+`${i}.${l}`);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 W6(e){return e.map(t=>({...t,value:BigInt(t.value)}))}function V6(e){return{...e,balance:e.balance?BigInt(e.balance):void 0,nonce:e.nonce?ln(e.nonce):void 0,storageProof:e.storageProof?W6(e.storageProof):void 0}}async function H6(e,{address:t,blockNumber:n,blockTag:r,storageKeys:o}){const s=r??"latest",i=n!==void 0?re(n):void 0,l=await e.request({method:"eth_getProof",params:[t,o,i||s]});return V6(l)}async function G6(e,{address:t,blockNumber:n,blockTag:r="latest",slot:o}){const s=n!==void 0?re(n):void 0;return await e.request({method:"eth_getStorageAt",params:[t,o,s||r]})}async function Sl(e,{blockHash:t,blockNumber:n,blockTag:r,hash:o,index:s,sender:i,nonce:l}){var p,d,h;const a=r||"latest",c=n!==void 0?re(n):void 0;let u=null;if(o?u=await e.request({method:"eth_getTransactionByHash",params:[o]},{dedupe:!0}):t?u=await e.request({method:"eth_getTransactionByBlockHashAndIndex",params:[t,re(s)]},{dedupe:!0}):typeof s=="number"?u=await e.request({method:"eth_getTransactionByBlockNumberAndIndex",params:[c||a,re(s)]},{dedupe:!!c}):i&&typeof l=="number"&&(u=await e.request({method:"eth_getTransactionBySenderAndNonce",params:[i,re(l)]},{dedupe:!0})),!u)throw new cf({blockHash:t,blockNumber:n,blockTag:a,hash:o,index:s});return(((h=(d=(p=e.chain)==null?void 0:p.formatters)==null?void 0:d.transaction)==null?void 0:h.format)||wa)(u,"getTransaction")}async function q6(e,{hash:t,transactionReceipt:n}){const[r,o]=await Promise.all([te(e,Wo,"getBlockNumber")({}),t?te(e,Sl,"getTransaction")({hash:t}):void 0]),s=(n==null?void 0:n.blockNumber)||(o==null?void 0:o.blockNumber);return s?r-s+1n:0n}async function Hs(e,{hash:t}){var o,s,i;const n=await e.request({method:"eth_getTransactionReceipt",params:[t]},{dedupe:!0});if(!n)throw new uf({hash:t});return(((i=(s=(o=e.chain)==null?void 0:o.formatters)==null?void 0:s.transactionReceipt)==null?void 0:i.format)||wd)(n,"getTransactionReceipt")}async function K6(e,t){var x;const{account:n,authorizationList:r,allowFailure:o=!0,blockNumber:s,blockOverrides:i,blockTag:l,stateOverride:a}=t,c=t.contracts,{batchSize:u=t.batchSize??1024,deployless:f=t.deployless??!1}=typeof((x=e.batch)==null?void 0:x.multicall)=="object"?e.batch.multicall:{},p=(()=>{if(t.multicallAddress)return t.multicallAddress;if(f)return null;if(e.chain)return Dr({blockNumber:s,chain:e.chain,contract:"multicall3"});throw new Error("client chain not configured. multicallAddress is required.")})(),d=[[]];let h=0,b=0;for(let E=0;E<c.length;E++){const{abi:A,address:D,args:L,functionName:F}=c[E];try{const m=vt({abi:A,args:L,functionName:F});b+=(m.length-2)/2,u>0&&b>u&&d[h].length>0&&(h++,b=(m.length-2)/2,d[h]=[]),d[h]=[...d[h],{allowFailure:!0,callData:m,target:D}]}catch(m){const v=Nr(m,{abi:A,address:D,args:L,docsPath:"/docs/contract/multicall",functionName:F,sender:n});if(!o)throw v;d[h]=[...d[h],{allowFailure:!0,callData:"0x",target:D}]}}const w=await Promise.allSettled(d.map(E=>te(e,jt,"readContract")({...p===null?{code:Ra}:{address:p},abi:kr,account:n,args:[E],authorizationList:r,blockNumber:s,blockOverrides:i,blockTag:l,functionName:"aggregate3",stateOverride:a}))),P=[];for(let E=0;E<w.length;E++){const A=w[E];if(A.status==="rejected"){if(!o)throw A.reason;for(let L=0;L<d[E].length;L++)P.push({status:"failure",error:A.reason,result:void 0});continue}const D=A.value;for(let L=0;L<D.length;L++){const{returnData:F,success:m}=D[L],{callData:v}=d[E][L],{abi:S,address:$,functionName:I,args:C}=c[P.length];try{if(v==="0x")throw new no;if(!m)throw new As({data:F});const M=Dn({abi:S,args:C,data:F,functionName:I});P.push(o?{result:M,status:"success"}:M)}catch(M){const y=Nr(M,{abi:S,address:$,args:C,docsPath:"/docs/contract/multicall",functionName:I});if(!o)throw y;P.push({error:y,result:void 0,status:"failure"})}}}if(P.length!==c.length)throw new V("multicall results mismatch");return P}async function Pl(e,t){const{blockNumber:n,blockTag:r=e.experimental_blockTag??"latest",blocks:o,returnFullTransactions:s,traceTransfers:i,validation:l}=t;try{const a=[];for(const p of o){const d=p.blockOverrides?id(p.blockOverrides):void 0,h=p.calls.map(w=>{const P=w,x=P.account?ft(P.account):void 0,E=P.abi?vt(P):P.data,A={...P,account:x,data:P.dataSuffix?Bt([E||"0x",P.dataSuffix]):E,from:P.from??(x==null?void 0:x.address)};return Or(A),Bo(A)}),b=p.stateOverrides?ya(p.stateOverrides):void 0;a.push({blockOverrides:d,calls:h,stateOverrides:b})}const u=(typeof n=="bigint"?re(n):void 0)||r;return(await e.request({method:"eth_simulateV1",params:[{blockStateCalls:a,returnFullTransactions:s,traceTransfers:i,validation:l},u]})).map((p,d)=>({...Pf(p),calls:p.calls.map((h,b)=>{var S,$;const{abi:w,args:P,functionName:x,to:E}=o[d].calls[b],A=((S=h.error)==null?void 0:S.data)??h.returnData,D=BigInt(h.gasUsed),L=($=h.logs)==null?void 0:$.map(I=>Zt(I)),F=h.status==="0x1"?"success":"failure",m=w&&F==="success"&&A!=="0x"?Dn({abi:w,data:A,functionName:x}):null,v=(()=>{if(F==="success")return;let I;if(A==="0x"?I=new no:A&&(I=new As({data:A})),!!I)return Nr(I,{abi:w??[],address:E??"0x",args:P,functionName:x??"<unknown>"})})();return{data:A,gasUsed:D,logs:L,status:F,...F==="success"?{result:m}:{error:v}}})}))}catch(a){const c=a,u=Os(c,{});throw u instanceof Do?c:u}}function Tl(e){let t=!0,n="",r=0,o="",s=!1;for(let i=0;i<e.length;i++){const l=e[i];if(["(",")",","].includes(l)&&(t=!0),l==="("&&r++,l===")"&&r--,!!t){if(r===0){if(l===" "&&["event","function","error",""].includes(o))o="";else if(o+=l,l===")"){s=!0;break}continue}if(l===" "){e[i-1]!==","&&n!==","&&n!==",("&&(n="",t=!1);continue}o+=l,n+=l}}if(!s)throw new oe("Unable to normalize signature.");return o}function Al(e,t){const n=typeof e,r=t.type;switch(r){case"address":return tl(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)=>Al(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=>Al(o,{...t,type:r.replace(/(\[[0-9]{0,}\])$/,"")})):!1}}function w0(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 w0(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")?tl(n[r],{strict:!1}):i.includes("address")&&i.includes("bytes")?tl(n[r],{strict:!1}):!1)return i}}function x0(e,t={}){const{prepare:n=!0}=t,r=Array.isArray(e)||typeof e=="string"?yu(e):e;return{...r,...n?{hash:Fr(r)}:{}}}function Gs(e,t,n){const{args:r=[],prepare:o=!0}=n??{},s=Xy(t,{strict:!1}),i=e.filter(c=>s?c.type==="function"||c.type==="error"?E0(c)===Yt(t,0,4):c.type==="event"?Fr(c)===t:!1:"name"in c&&c.name===t);if(i.length===0)throw new qs({name:t});if(i.length===1)return{...i[0],...o?{hash:Fr(i[0])}:{}};let l;for(const c of i){if(!("inputs"in c))continue;if(!r||r.length===0){if(!c.inputs||c.inputs.length===0)return{...c,...o?{hash:Fr(c)}:{}};continue}if(!c.inputs||c.inputs.length===0||c.inputs.length!==r.length)continue;if(r.every((f,p)=>{const d="inputs"in c&&c.inputs[p];return d?Al(f,d):!1})){if(l&&"inputs"in l&&l.inputs){const f=w0(c.inputs,l.inputs,r);if(f)throw new Y6({abiItem:c,type:f[0]},{abiItem:l,type:f[1]})}l=c}}const a=(()=>{if(l)return l;const[c,...u]=i;return{...c,overloads:u}})();if(!a)throw new qs({name:t});return{...a,...o?{hash:Fr(a)}:{}}}function E0(...e){const t=(()=>{if(Array.isArray(e[0])){const[n,r]=e;return Gs(n,r)}return e[0]})();return Yt(Fr(t),0,4)}function Z6(...e){const t=(()=>{if(Array.isArray(e[0])){const[r,o]=e;return Gs(r,o)}return e[0]})(),n=typeof t=="string"?t:bs(t);return Tl(n)}function Fr(...e){const t=(()=>{if(Array.isArray(e[0])){const[n,r]=e;return Gs(n,r)}return e[0]})();return typeof t!="string"&&"hash"in t&&t.hash?t.hash:_d(La(Z6(t)))}class Y6 extends oe{constructor(t,n){super("Found ambiguous types in overloaded ABI Items.",{metaMessages:[`\`${t.type}\` in \`${Tl(bs(t.abiItem))}\`, and`,`\`${n.type}\` in \`${Tl(bs(n.abiItem))}\``,"","These types encode differently and cannot be distinguished at runtime.","Remove one of the ambiguous items in the ABI."]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiItem.AmbiguityError"})}}class qs extends oe{constructor({name:t,data:n,type:r="item"}){const o=t?` with name "${t}"`:n?` with data "${n}"`:"";super(`ABI ${r}${o} not found.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiItem.NotFoundError"})}}function X6(...e){var s;const[t,n]=(()=>{if(Array.isArray(e[0])){const[i,l]=e;return[Q6(i),l]}return e})(),{bytecode:r,args:o}=n;return Ft(r,(s=t.inputs)!=null&&s.length&&(o!=null&&o.length)?il(t.inputs,o):"0x")}function J6(e){return x0(e)}function Q6(e){const t=e.find(n=>n.type==="constructor");if(!t)throw new qs({name:"constructor"});return t}function e5(...e){const[t,n=[]]=(()=>{if(Array.isArray(e[0])){const[c,u,f]=e;return[S0(c,u,{args:f}),f]}const[l,a]=e;return[l,a]})(),{overloads:r}=t,o=r?S0([t,...r],t.name,{args:n}):t,s=t5(o),i=n.length>0?il(o.inputs,n):void 0;return i?Ft(s,i):s}function Rr(e,t={}){return x0(e,t)}function S0(e,t,n){const r=Gs(e,t,n);if(r.type!=="function")throw new qs({name:t,type:"function"});return r}function t5(e){return E0(e)}const n5="0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",zt="0x0000000000000000000000000000000000000000",r5="0x6080604052348015600e575f80fd5b5061016d8061001c5f395ff3fe608060405234801561000f575f80fd5b5060043610610029575f3560e01c8063f8b2cb4f1461002d575b5f80fd5b610047600480360381019061004291906100db565b61005d565b604051610054919061011e565b60405180910390f35b5f8173ffffffffffffffffffffffffffffffffffffffff16319050919050565b5f80fd5b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f6100aa82610081565b9050919050565b6100ba816100a0565b81146100c4575f80fd5b50565b5f813590506100d5816100b1565b92915050565b5f602082840312156100f0576100ef61007d565b5b5f6100fd848285016100c7565b91505092915050565b5f819050919050565b61011881610106565b82525050565b5f6020820190506101315f83018461010f565b9291505056fea26469706673582212203b9fe929fe995c7cf9887f0bdba8a36dd78e8b73f149b17d2d9ad7cd09d2dc6264736f6c634300081a0033";async function o5(e,t){const{blockNumber:n,blockTag:r,calls:o,stateOverrides:s,traceAssetChanges:i,traceTransfers:l,validation:a}=t,c=t.account?ft(t.account):void 0;if(i&&!c)throw new V("`account` is required when `traceAssetChanges` is true");const u=c?X6(J6("constructor(bytes, bytes)"),{bytecode:pd,args:[r5,e5(Rr("function getBalance(address)"),[c.address])]}):void 0,f=i?await Promise.all(t.calls.map(async T=>{if(!T.data&&!T.abi)return;const{accessList:B}=await Od(e,{account:c.address,...T,data:T.abi?vt(T):T.data});return B.map(({address:R,storageKeys:z})=>z.length>0?R:null)})).then(T=>T.flat().filter(Boolean)):[],p=await Pl(e,{blockNumber:n,blockTag:r,blocks:[...i?[{calls:[{data:u}],stateOverrides:s},{calls:f.map((T,B)=>({abi:[Rr("function balanceOf(address) returns (uint256)")],functionName:"balanceOf",args:[c.address],to:T,from:zt,nonce:B})),stateOverrides:[{address:zt,nonce:0}]}]:[],{calls:[...o,{to:zt}].map(T=>({...T,from:c==null?void 0:c.address})),stateOverrides:s},...i?[{calls:[{data:u}]},{calls:f.map((T,B)=>({abi:[Rr("function balanceOf(address) returns (uint256)")],functionName:"balanceOf",args:[c.address],to:T,from:zt,nonce:B})),stateOverrides:[{address:zt,nonce:0}]},{calls:f.map((T,B)=>({to:T,abi:[Rr("function decimals() returns (uint256)")],functionName:"decimals",from:zt,nonce:B})),stateOverrides:[{address:zt,nonce:0}]},{calls:f.map((T,B)=>({to:T,abi:[Rr("function tokenURI(uint256) returns (string)")],functionName:"tokenURI",args:[0n],from:zt,nonce:B})),stateOverrides:[{address:zt,nonce:0}]},{calls:f.map((T,B)=>({to:T,abi:[Rr("function symbol() returns (string)")],functionName:"symbol",from:zt,nonce:B})),stateOverrides:[{address:zt,nonce:0}]}]:[]],traceTransfers:l,validation:a}),d=i?p[2]:p[0],[h,b,,w,P,x,E,A]=i?p:[],{calls:D,...L}=d,F=D.slice(0,-1)??[],m=(h==null?void 0:h.calls)??[],v=(b==null?void 0:b.calls)??[],S=[...m,...v].map(T=>T.status==="success"?Gt(T.data):null),$=(w==null?void 0:w.calls)??[],I=(P==null?void 0:P.calls)??[],C=[...$,...I].map(T=>T.status==="success"?Gt(T.data):null),M=((x==null?void 0:x.calls)??[]).map(T=>T.status==="success"?T.result:null),y=((A==null?void 0:A.calls)??[]).map(T=>T.status==="success"?T.result:null),O=((E==null?void 0:E.calls)??[]).map(T=>T.status==="success"?T.result:null),k=[];for(const[T,B]of C.entries()){const R=S[T];if(typeof B!="bigint"||typeof R!="bigint")continue;const z=M[T-1],_=y[T-1],G=O[T-1],J=T===0?{address:n5,decimals:18,symbol:"ETH"}:{address:f[T-1],decimals:G||z?Number(z??1):void 0,symbol:_??void 0};k.some(K=>K.token.address===J.address)||k.push({token:J,value:{pre:R,post:B,diff:B-R}})}return{assetChanges:k,block:L,results:F}}const P0="0x6492649264926492649264926492649264926492649264926492649264926492";function s5(e){if(Yt(e,-32)!==P0)throw new l5(e)}function i5(e){const{data:t,signature:n,to:r}=e;return Ft(il(Zd("address, bytes, bytes"),[r,t,n]),P0)}function a5(e){try{return s5(e),!0}catch{return!1}}class l5 extends oe{constructor(t){super(`Value \`${t}\` is an invalid ERC-6492 wrapped signature.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"SignatureErc6492.InvalidWrappedSignatureError"})}}function c5({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 b0.Signature(Gt(e),Gt(t)).toCompactHex()}${s===0?"1b":"1c"}`;return n==="hex"?i:qt(i)}async function Ks(e,t){var a,c,u,f;const{address:n,chain:r=e.chain,hash:o,erc6492VerifierAddress:s=t.universalSignatureVerifierAddress??((c=(a=r==null?void 0:r.contracts)==null?void 0:a.erc6492Verifier)==null?void 0:c.address),multicallAddress:i=t.multicallAddress??((f=(u=r==null?void 0:r.contracts)==null?void 0:u.multicall3)==null?void 0:f.address)}=t;if(r!=null&&r.verifyHash)return await r.verifyHash(e,t);const l=(()=>{const p=t.signature;return Mt(p)?p:typeof p=="object"&&"r"in p&&"s"in p?c5(p):ke(p)})();try{return j6(l)?await u5(e,{...t,multicallAddress:i,signature:l}):await f5(e,{...t,verifierAddress:s,signature:l})}catch(p){try{if(Lo(un(n),await mf({hash:o,signature:l})))return!0}catch{}if(p instanceof or)return!1;throw p}}async function u5(e,t){var w;const{address:n,blockNumber:r,blockTag:o,hash:s,multicallAddress:i}=t,{authorization:l,data:a,signature:c,to:u}=R6(t.signature);if(await _s(e,{address:n,blockNumber:r,blockTag:o})===Sr(["0xef0100",l.address]))return await d5(e,{address:n,blockNumber:r,blockTag:o,hash:s,signature:c});const p={address:l.address,chainId:Number(l.chainId),nonce:Number(l.nonce),r:re(l.r,{size:32}),s:re(l.s,{size:32}),yParity:l.yParity};if(!await Jv({address:n,authorization:p}))throw new or;const h=await te(e,jt,"readContract")({...i?{address:i}:{code:Ra},authorizationList:[p],abi:kr,blockNumber:r,blockTag:"pending",functionName:"aggregate3",args:[[...a?[{allowFailure:!0,target:u??n,callData:a}]:[],{allowFailure:!0,target:n,callData:vt({abi:fd,functionName:"isValidSignature",args:[s,c]})}]]}),b=(w=h[h.length-1])==null?void 0:w.returnData;if(b!=null&&b.startsWith("0x1626ba7e"))return!0;throw new or}async function f5(e,t){const{address:n,factory:r,factoryData:o,hash:s,signature:i,verifierAddress:l,...a}=t,c=await(async()=>!r&&!o||a5(i)?i:i5({data:o,signature:i,to:r}))(),u=l?{to:l,data:vt({abi:dd,functionName:"isValidSig",args:[n,s,c]}),...a}:{data:Ua({abi:dd,args:[n,s,c],bytecode:ov}),...a},{data:f}=await te(e,Br,"call")(u).catch(p=>{throw p instanceof ff?new or:p});if(w1(f??"0x0"))return!0;throw new or}async function d5(e,t){const{address:n,blockNumber:r,blockTag:o,hash:s,signature:i}=t;if((await te(e,jt,"readContract")({address:n,abi:fd,args:[s,i],blockNumber:r,blockTag:o,functionName:"isValidSignature"}).catch(a=>{throw a instanceof df?new or:a})).startsWith("0x1626ba7e"))return!0;throw new or}class or extends Error{}async function p5(e,{address:t,message:n,factory:r,factoryData:o,signature:s,...i}){const l=Bd(n);return te(e,Ks,"verifyHash")({address:t,factory:r,factoryData:o,hash:l,signature:s,...i})}async function h5(e,t){const{address:n,factory:r,factoryData:o,signature:s,message:i,primaryType:l,types:a,domain:c,...u}=t,f=xw({message:i,primaryType:l,types:a,domain:c});return te(e,Ks,"verifyHash")({address:n,factory:r,factoryData:o,hash:f,signature:s,...u})}function T0(e,{emitOnBegin:t=!1,emitMissed:n=!1,onBlockNumber:r,onError:o,poll:s,pollingInterval:i=e.pollingInterval}){const l=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 l?(()=>{const f=Me(["watchBlockNumber",e.uid,t,n,i]);return Bn(f,{onBlockNumber:r,onError:o},p=>_o(async()=>{var d;try{const h=await te(e,Wo,"getBlockNumber")({cacheTime:0});if(a!==void 0){if(h===a)return;if(h-a>1&&n)for(let b=a+1n;b<h;b++)p.onBlockNumber(b,a),a=b}(a===void 0||h>a)&&(p.onBlockNumber(h,a),a=h)}catch(h){(d=p.onError)==null||d.call(p,h)}},{emitOnBegin:t,interval:i}))})():(()=>{const f=Me(["watchBlockNumber",e.uid,t,n]);return Bn(f,{onBlockNumber:r,onError:o},p=>{let d=!0,h=()=>d=!1;return(async()=>{try{const b=(()=>{if(e.transport.type==="fallback"){const P=e.transport.transports.find(x=>x.config.type==="webSocket"||x.config.type==="ipc");return P?P.value:e.transport}return e.transport})(),{unsubscribe:w}=await b.subscribe({params:["newHeads"],onData(P){var E;if(!d)return;const x=Gt((E=P.result)==null?void 0:E.number);p.onBlockNumber(x,a),a=x},onError(P){var x;(x=p.onError)==null||x.call(p,P)}});h=w,d||h()}catch(b){o==null||o(b)}})(),()=>h()})})()}async function m5(e,t){const{checkReplacement:n=!0,confirmations:r=1,hash:o,onReplaced:s,retryCount:i=6,retryDelay:l=({count:D})=>~~(1<<D)*200,timeout:a=18e4}=t,c=Me(["waitForTransactionReceipt",e.uid,o]),u=(()=>{var D;return t.pollingInterval?t.pollingInterval:(D=e.chain)!=null&&D.experimental_preconfirmationTime?e.chain.experimental_preconfirmationTime:e.pollingInterval})();let f,p,d,h=!1,b,w;const{promise:P,resolve:x,reject:E}=bd(),A=a?setTimeout(()=>{w==null||w(),b==null||b(),E(new Bg({hash:o}))},a):void 0;return b=Bn(c,{onReplaced:s,resolve:x,reject:E},async D=>{if(d=await te(e,Hs,"getTransactionReceipt")({hash:o}).catch(()=>{}),d&&r<=1){clearTimeout(A),D.resolve(d),b==null||b();return}w=te(e,T0,"watchBlockNumber")({emitMissed:!0,emitOnBegin:!0,poll:!0,pollingInterval:u,async onBlockNumber(L){const F=v=>{clearTimeout(A),w==null||w(),v(),b==null||b()};let m=L;if(!h)try{if(d){if(r>1&&(!d.blockNumber||m-d.blockNumber+1n<r))return;F(()=>D.resolve(d));return}if(n&&!f&&(h=!0,await Ha(async()=>{f=await te(e,Sl,"getTransaction")({hash:o}),f.blockNumber&&(m=f.blockNumber)},{delay:l,retryCount:i}),h=!1),d=await te(e,Hs,"getTransactionReceipt")({hash:o}),r>1&&(!d.blockNumber||m-d.blockNumber+1n<r))return;F(()=>D.resolve(d))}catch(v){if(v instanceof cf||v instanceof uf){if(!f){h=!1;return}try{p=f,h=!0;const S=await Ha(()=>te(e,Lt,"getBlock")({blockNumber:m,includeTransactions:!0}),{delay:l,retryCount:i,shouldRetry:({error:C})=>C instanceof Ef});h=!1;const $=S.transactions.find(({from:C,nonce:M})=>C===p.from&&M===p.nonce);if(!$||(d=await te(e,Hs,"getTransactionReceipt")({hash:$.hash}),r>1&&(!d.blockNumber||m-d.blockNumber+1n<r)))return;let I="replaced";$.to===p.to&&$.value===p.value&&$.input===p.input?I="repriced":$.from===$.to&&$.value===0n&&(I="cancelled"),F(()=>{var C;(C=D.onReplaced)==null||C.call(D,{reason:I,replacedTransaction:p,transaction:$,transactionReceipt:d}),D.resolve(d)})}catch(S){F(()=>D.reject(S))}}else F(()=>D.reject(v))}}})}),P}function b5(e,{blockTag:t=e.experimental_blockTag??"latest",emitMissed:n=!1,emitOnBegin:r=!1,onBlock:o,onError:s,includeTransactions:i,poll:l,pollingInterval:a=e.pollingInterval}){const c=typeof l<"u"?l:!(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 c?(()=>{const h=Me(["watchBlocks",e.uid,t,n,r,u,a]);return Bn(h,{onBlock:o,onError:s},b=>_o(async()=>{var w;try{const P=await te(e,Lt,"getBlock")({blockTag:t,includeTransactions:u});if(P.number!==null&&(f==null?void 0:f.number)!=null){if(P.number===f.number)return;if(P.number-f.number>1&&n)for(let x=(f==null?void 0:f.number)+1n;x<P.number;x++){const E=await te(e,Lt,"getBlock")({blockNumber:x,includeTransactions:u});b.onBlock(E,f),f=E}}((f==null?void 0:f.number)==null||t==="pending"&&(P==null?void 0:P.number)==null||P.number!==null&&P.number>f.number)&&(b.onBlock(P,f),f=P)}catch(P){(w=b.onError)==null||w.call(b,P)}},{emitOnBegin:r,interval:a}))})():(()=>{let h=!0,b=!0,w=()=>h=!1;return(async()=>{try{r&&te(e,Lt,"getBlock")({blockTag:t,includeTransactions:u}).then(E=>{h&&b&&(o(E,void 0),b=!1)}).catch(s);const P=(()=>{if(e.transport.type==="fallback"){const E=e.transport.transports.find(A=>A.config.type==="webSocket"||A.config.type==="ipc");return E?E.value:e.transport}return e.transport})(),{unsubscribe:x}=await P.subscribe({params:["newHeads"],async onData(E){var D;if(!h)return;const A=await te(e,Lt,"getBlock")({blockNumber:(D=E.result)==null?void 0:D.number,includeTransactions:u}).catch(()=>{});h&&(o(A,f),b=!1,f=A)},onError(E){s==null||s(E)}});w=x,h||w()}catch(P){s==null||s(P)}})(),()=>w()})()}function g5(e,{address:t,args:n,batch:r=!0,event:o,events:s,fromBlock:i,onError:l,onLogs:a,poll:c,pollingInterval:u=e.pollingInterval,strict:f}){const p=typeof c<"u"?c: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 w=Me(["watchEvent",t,n,r,e.uid,o,u,i]);return Bn(w,{onLogs:a,onError:l},P=>{let x;i!==void 0&&(x=i-1n);let E,A=!1;const D=_o(async()=>{var L;if(!A){try{E=await te(e,Id,"createEventFilter")({address:t,args:n,event:o,events:s,strict:d,fromBlock:i})}catch{}A=!0;return}try{let F;if(E)F=await te(e,Rs,"getFilterChanges")({filter:E});else{const m=await te(e,Wo,"getBlockNumber")({});x&&x!==m?F=await te(e,Ca,"getLogs")({address:t,args:n,event:o,events:s,fromBlock:x+1n,toBlock:m}):F=[],x=m}if(F.length===0)return;if(r)P.onLogs(F);else for(const m of F)P.onLogs([m])}catch(F){E&&F instanceof $n&&(A=!1),(L=P.onError)==null||L.call(P,F)}},{emitOnBegin:!0,interval:u});return async()=>{E&&await te(e,js,"uninstallFilter")({filter:E}),D()}})})():(()=>{let w=!0,P=()=>w=!1;return(async()=>{try{const x=(()=>{if(e.transport.type==="fallback"){const L=e.transport.transports.find(F=>F.config.type==="webSocket"||F.config.type==="ipc");return L?L.value:e.transport}return e.transport})(),E=s??(o?[o]:void 0);let A=[];E&&(A=[E.flatMap(F=>ao({abi:[F],eventName:F.name,args:n}))],o&&(A=A[0]));const{unsubscribe:D}=await x.subscribe({params:["logs",{address:t,topics:A}],onData(L){var m;if(!w)return;const F=L.result;try{const{eventName:v,args:S}=$s({abi:E??[],data:F.data,topics:F.topics,strict:d}),$=Zt(F,{args:S,eventName:v});a([$])}catch(v){let S,$;if(v instanceof vs||v instanceof qi){if(f)return;S=v.abiItem.name,$=(m=v.abiItem.inputs)==null?void 0:m.some(C=>!("name"in C&&C.name))}const I=Zt(F,{args:$?[]:{},eventName:S});a([I])}},onError(L){l==null||l(L)}});P=D,w||P()}catch(x){l==null||l(x)}})(),()=>P()})()}function y5(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 c=Me(["watchPendingTransactions",e.uid,t,s]);return Bn(c,{onTransactions:r,onError:n},u=>{let f;const p=_o(async()=>{var d;try{if(!f)try{f=await te(e,$d,"createPendingTransactionFilter")({});return}catch(b){throw p(),b}const h=await te(e,Rs,"getFilterChanges")({filter:f});if(h.length===0)return;if(t)u.onTransactions(h);else for(const b of h)u.onTransactions([b])}catch(h){(d=u.onError)==null||d.call(u,h)}},{emitOnBegin:!0,interval:s});return async()=>{f&&await te(e,js,"uninstallFilter")({filter:f}),p()}})})():(()=>{let c=!0,u=()=>c=!1;return(async()=>{try{const{unsubscribe:f}=await e.transport.subscribe({params:["newPendingTransactions"],onData(p){if(!c)return;const d=p.result;r([d])},onError(p){n==null||n(p)}});u=f,c||u()}catch(f){n==null||n(f)}})(),()=>u()})()}function v5(e){var f,p,d;const{scheme:t,statement:n,...r}=((f=e.match(w5))==null?void 0:f.groups)??{},{chainId:o,expirationTime:s,issuedAt:i,notBefore:l,requestId:a,...c}=((p=e.match(x5))==null?void 0:p.groups)??{},u=(d=e.split("Resources:")[1])==null?void 0:d.split(`
91
- - `).slice(1);return{...r,...c,...o?{chainId:Number(o)}:{},...s?{expirationTime:new Date(s)}:{},...i?{issuedAt:new Date(i)}:{},...l?{notBefore:new Date(l)}:{},...a?{requestId:a}:{},...u?{resources:u}:{},...t?{scheme:t}:{},...n?{statement:n}:{}}}const w5=/^(?:(?<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)?/,x5=/(?: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 E5(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||!yt(r.address,{strict:!1})||t&&!Lo(r.address,t))return!1}catch{return!1}return!0}async function S5(e,t){const{address:n,domain:r,message:o,nonce:s,scheme:i,signature:l,time:a=new Date,...c}=t,u=v5(o);if(!u.address||!E5({address:n,domain:r,message:u,nonce:s,scheme:i,time:a}))return!1;const p=Bd(o);return Ks(e,{address:u.address,hash:p,signature:l,...c})}async function P5(e,{serializedTransaction:t,throwOnReceiptRevert:n,timeout:r}){var l,a,c;const o=await e.request({method:"eth_sendRawTransactionSync",params:r?[t,r]:[t]},{retryCount:0}),i=(((c=(a=(l=e.chain)==null?void 0:l.formatters)==null?void 0:a.transactionReceipt)==null?void 0:c.format)||wd)(o);if(i.status==="reverted"&&n)throw new Dg({receipt:i});return i}function T5(e){return{call:t=>Br(e,t),createAccessList:t=>Od(e,t),createBlockFilter:()=>Uv(e),createContractEventFilter:t=>Qu(e,t),createEventFilter:t=>Id(e,t),createPendingTransactionFilter:()=>$d(e),estimateContractGas:t=>wy(e,t),estimateGas:t=>Aa(e,t),getBalance:t=>_v(e,t),getBlobBaseFee:()=>Wv(e),getBlock:t=>Lt(e,t),getBlockNumber:t=>Wo(e,t),getBlockTransactionCount:t=>Vv(e,t),getBytecode:t=>_s(e,t),getChainId:()=>Pa(e),getCode:t=>_s(e,t),getContractEvents:t=>Rf(e,t),getDelegation:t=>Hv(e,t),getEip712Domain:t=>qv(e,t),getEnsAddress:t=>Tv(e,t),getEnsAvatar:t=>Rv(e,t),getEnsName:t=>jv(e,t),getEnsResolver:t=>zv(e,t),getEnsText:t=>Cd(e,t),getFeeHistory:t=>Yv(e,t),estimateFeesPerGas:t=>ny(e,t),getFilterChanges:t=>Rs(e,t),getFilterLogs:t=>Xv(e,t),getGasPrice:()=>xa(e),getLogs:t=>Ca(e,t),getProof:t=>H6(e,t),estimateMaxPriorityFeePerGas:t=>ty(e,t),fillTransaction:t=>Df(e,t),getStorageAt:t=>G6(e,t),getTransaction:t=>Sl(e,t),getTransactionConfirmations:t=>q6(e,t),getTransactionCount:t=>Af(e,t),getTransactionReceipt:t=>Hs(e,t),multicall:t=>K6(e,t),prepareTransactionRequest:t=>Lf(e,t),readContract:t=>jt(e,t),sendRawTransaction:t=>gv(e,t),sendRawTransactionSync:t=>P5(e,t),simulate:t=>Pl(e,t),simulateBlocks:t=>Pl(e,t),simulateCalls:t=>o5(e,t),simulateContract:t=>cv(e,t),verifyHash:t=>Ks(e,t),verifyMessage:t=>p5(e,t),verifySiweMessage:t=>S5(e,t),verifyTypedData:t=>h5(e,t),uninstallFilter:t=>js(e,t),waitForTransactionReceipt:t=>m5(e,t),watchBlocks:t=>b5(e,t),watchBlockNumber:t=>T0(e,t),watchContractEvent:t=>bv(e,t),watchEvent:t=>g5(e,t),watchPendingTransactions:t=>y5(e,t)}}function A5(e){const{key:t="public",name:n="Public Client"}=e;return vv({...e,key:t,name:n,type:"publicClient"}).extend(T5)}function N5({key:e,methods:t,name:n,request:r,retryCount:o=3,retryDelay:s=150,timeout:i,type:l},a){const c=xd();return{config:{key:e,methods:t,name:n,request:r,retryCount:o,retryDelay:s,timeout:i,type:l},request:ew(r,{methods:t,retryCount:o,retryDelay:s,uid:c}),value:a}}class C5 extends V{constructor(){super("No URL was provided to the Transport. Please provide a valid RPC URL to the Transport.",{docsPath:"/docs/clients/intro",name:"UrlRequiredError"})}}function O5(e,t={}){const{batch:n,fetchFn:r,fetchOptions:o,key:s="http",methods:i,name:l="HTTP JSON-RPC",onFetchRequest:a,onFetchResponse:c,retryDelay:u,raw:f}=t;return({chain:p,retryCount:d,timeout:h})=>{const{batchSize:b=1e3,wait:w=0}=typeof n=="object"?n:{},P=t.retryCount??d,x=h??t.timeout??1e4,E=e||(p==null?void 0:p.rpcUrls.default.http[0]);if(!E)throw new C5;const A=fw(E,{fetchFn:r,fetchOptions:o,onRequest:a,onResponse:c,timeout:x});return N5({key:s,methods:i,name:l,async request({method:D,params:L}){const F={method:D,params:L},{schedule:m}=gd({id:E,wait:w,shouldSplitBatch(I){return I.length>b},fn:I=>A.request({body:I}),sort:(I,C)=>I.id-C.id}),v=async I=>n?m(I):[await A.request({body:I})],[{error:S,result:$}]=await v(F);if(f)return{error:S,result:$};if(S)throw new ca({body:F,error:S,url:E});return $},retryCount:P,retryDelay:u,timeout:x,type:"http"},{fetchOptions:o,url:E})}}const I5=lw({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 $5({client:e,tokenAddress:t,holder:n,decimals:r,fallbackFormatted:o="0",pollingInterval:s=12e3}){const[i,l]=g.useState(null),[a,c]=g.useState(o);return g.useEffect(()=>{let u,f;const p=async()=>{try{const d=await e.readContract({address:t,abi:Mr,functionName:"balanceOf",args:[n]});l(d),c(ia(d,r))}catch{c(o)}};p();try{u=e.watchContractEvent({address:t,abi:Mr,eventName:"Transfer",args:{to:n},onLogs:()=>{p()},poll:!0,pollingInterval:s}),f=e.watchContractEvent({address:t,abi:Mr,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 k5=()=>({openDeposit:g.useCallback(t=>{},[])}),M5=()=>({openWithdraw:g.useCallback(t=>{},[])}),gn="MPC",Zs="EVM";var ze=(e=>(e.SPOT="spot",e.PERPETUAL="perpetual",e.PERPETUALV2="perpetual_v2",e))(ze||{});const D5="spot",B5="perpetual";/**
87
+ `),{cause:t,name:"TipAboveFeeCapError"})}}Object.defineProperty(Cs,"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 Bo extends V{constructor({cause:t}){super(`An error occurred while executing: ${t==null?void 0:t.shortMessage}`,{cause:t,name:"UnknownNodeError"})}}function Os(e,t){const n=(e.details||"").toLowerCase(),r=e instanceof V?e.walk(o=>(o==null?void 0:o.code)===Cr.code):e;return r instanceof V?new Cr({cause:e,message:r.details}):Cr.nodeMessage.test(n)?new Cr({cause:e,message:e.details}):Ns.nodeMessage.test(n)?new Ns({cause:e,maxFeePerGas:t==null?void 0:t.maxFeePerGas}):ua.nodeMessage.test(n)?new ua({cause:e,maxFeePerGas:t==null?void 0:t.maxFeePerGas}):fa.nodeMessage.test(n)?new fa({cause:e,nonce:t==null?void 0:t.nonce}):da.nodeMessage.test(n)?new da({cause:e,nonce:t==null?void 0:t.nonce}):pa.nodeMessage.test(n)?new pa({cause:e,nonce:t==null?void 0:t.nonce}):ha.nodeMessage.test(n)?new ha({cause:e}):ma.nodeMessage.test(n)?new ma({cause:e,gas:t==null?void 0:t.gas}):ba.nodeMessage.test(n)?new ba({cause:e,gas:t==null?void 0:t.gas}):ga.nodeMessage.test(n)?new ga({cause:e}):Cs.nodeMessage.test(n)?new Cs({cause:e,maxFeePerGas:t==null?void 0:t.maxFeePerGas,maxPriorityFeePerGas:t==null?void 0:t.maxPriorityFeePerGas}):new Bo({cause:e})}function Zg(e,{docsPath:t,...n}){const r=(()=>{const o=Os(e,n);return o instanceof Bo?e:o})();return new Kg(r,{docsPath:t,...n})}function Is(e,{format:t}){if(!t)return{};const n={};function r(s){const i=Object.keys(s);for(const l of i)l in e&&(n[l]=e[l]),s[l]&&typeof s[l]=="object"&&!Array.isArray(s[l])&&r(s[l])}const o=t(e||{});return r(o),n}const Yg={legacy:"0x0",eip2930:"0x1",eip1559:"0x2",eip4844:"0x3",eip7702:"0x4"};function Lo(e,t){const n={};return typeof e.authorizationList<"u"&&(n.authorizationList=Xg(e.authorizationList)),typeof e.accessList<"u"&&(n.accessList=e.accessList),typeof e.blobVersionedHashes<"u"&&(n.blobVersionedHashes=e.blobVersionedHashes),typeof e.blobs<"u"&&(typeof e.blobs[0]!="string"?n.blobs=e.blobs.map(r=>ke(r)):n.blobs=e.blobs),typeof e.data<"u"&&(n.data=e.data),e.account&&(n.from=e.account.address),typeof e.from<"u"&&(n.from=e.from),typeof e.gas<"u"&&(n.gas=re(e.gas)),typeof e.gasPrice<"u"&&(n.gasPrice=re(e.gasPrice)),typeof e.maxFeePerBlobGas<"u"&&(n.maxFeePerBlobGas=re(e.maxFeePerBlobGas)),typeof e.maxFeePerGas<"u"&&(n.maxFeePerGas=re(e.maxFeePerGas)),typeof e.maxPriorityFeePerGas<"u"&&(n.maxPriorityFeePerGas=re(e.maxPriorityFeePerGas)),typeof e.nonce<"u"&&(n.nonce=re(e.nonce)),typeof e.to<"u"&&(n.to=e.to),typeof e.type<"u"&&(n.type=Yg[e.type]),typeof e.value<"u"&&(n.value=re(e.value)),n}function Xg(e){return e.map(t=>({address:t.address,r:t.r?re(BigInt(t.r)):t.r,s:t.s?re(BigInt(t.s)):t.s,chainId:re(t.chainId),nonce:re(t.nonce),...typeof t.yParity<"u"?{yParity:re(t.yParity)}:{},...typeof t.v<"u"&&typeof t.yParity>"u"?{v:re(t.v)}:{}}))}function vf(e){if(!(!e||e.length===0))return e.reduce((t,{slot:n,value:r})=>{if(n.length!==66)throw new $u({size:n.length,targetSize:66,type:"hex"});if(r.length!==66)throw new $u({size:r.length,targetSize:66,type:"hex"});return t[n]=r,t},{})}function Jg(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=re(t)),n!==void 0&&(i.nonce=re(n)),r!==void 0&&(i.state=vf(r)),o!==void 0){if(i.state)throw new Ig;i.stateDiff=vf(o)}return i}function ya(e){if(!e)return;const t={};for(const{address:n,...r}of e){if(!yt(n,{strict:!1}))throw new Cn({address:n});if(t[n])throw new Og({address:n});t[n]=Jg(r)}return t}const wf=2n**256n-1n;function Or(e){const{account:t,maxFeePerGas:n,maxPriorityFeePerGas:r,to:o}=e,s=t?ft(t):void 0;if(s&&!yt(s.address))throw new Cn({address:s.address});if(o&&!yt(o))throw new Cn({address:o});if(n&&n>wf)throw new Ns({maxFeePerGas:n});if(r&&n&&r>n)throw new Cs({maxFeePerGas:n,maxPriorityFeePerGas:r})}class xf extends V{constructor(){super("`baseFeeMultiplier` must be greater than 1.",{name:"BaseFeeScalarError"})}}class va extends V{constructor(){super("Chain does not support EIP-1559 fees.",{name:"Eip1559FeesNotSupportedError"})}}class Qg extends V{constructor({maxPriorityFeePerGas:t}){super(`\`maxFeePerGas\` cannot be less than the \`maxPriorityFeePerGas\` (${Xe(t)} gwei).`,{name:"MaxFeePerGasTooLowError"})}}class Ef extends V{constructor({blockHash:t,blockNumber:n}){let r="Block";t&&(r=`Block at hash "${t}"`),n&&(r=`Block at number "${n}"`),super(`${r} could not be found.`,{name:"BlockNotFoundError"})}}const Sf={"0x0":"legacy","0x1":"eip2930","0x2":"eip1559","0x3":"eip4844","0x4":"eip7702"};function wa(e,t){const n={...e,blockHash:e.blockHash?e.blockHash:null,blockNumber:e.blockNumber?BigInt(e.blockNumber):null,chainId:e.chainId?ln(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?ln(e.nonce):void 0,to:e.to?e.to:null,transactionIndex:e.transactionIndex?Number(e.transactionIndex):null,type:e.type?Sf[e.type]:void 0,typeHex:e.type?e.type:void 0,value:e.value?BigInt(e.value):void 0,v:e.v?BigInt(e.v):void 0};return e.authorizationList&&(n.authorizationList=ey(e.authorizationList)),n.yParity=(()=>{if(e.yParity)return Number(e.yParity);if(typeof n.v=="bigint"){if(n.v===0n||n.v===27n)return 0;if(n.v===1n||n.v===28n)return 1;if(n.v>=35n)return n.v%2n===0n?1:0}})(),n.type==="legacy"&&(delete n.accessList,delete n.maxFeePerBlobGas,delete n.maxFeePerGas,delete n.maxPriorityFeePerGas,delete n.yParity),n.type==="eip2930"&&(delete n.maxFeePerBlobGas,delete n.maxFeePerGas,delete n.maxPriorityFeePerGas),n.type==="eip1559"&&delete n.maxFeePerBlobGas,n}function ey(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 Pf(e,t){const n=(e.transactions??[]).map(r=>typeof r=="string"?r:wa(r));return{...e,baseFeePerGas:e.baseFeePerGas?BigInt(e.baseFeePerGas):null,blobGasUsed:e.blobGasUsed?BigInt(e.blobGasUsed):void 0,difficulty:e.difficulty?BigInt(e.difficulty):void 0,excessBlobGas:e.excessBlobGas?BigInt(e.excessBlobGas):void 0,gasLimit:e.gasLimit?BigInt(e.gasLimit):void 0,gasUsed:e.gasUsed?BigInt(e.gasUsed):void 0,hash:e.hash?e.hash:null,logsBloom:e.logsBloom?e.logsBloom:null,nonce:e.nonce?e.nonce:null,number:e.number?BigInt(e.number):null,size:e.size?BigInt(e.size):void 0,timestamp:e.timestamp?BigInt(e.timestamp):void 0,transactions:n,totalDifficulty:e.totalDifficulty?BigInt(e.totalDifficulty):null}}async function Lt(e,{blockHash:t,blockNumber:n,blockTag:r=e.experimental_blockTag??"latest",includeTransactions:o}={}){var c,u,f;const s=o??!1,i=n!==void 0?re(n):void 0;let l=null;if(t?l=await e.request({method:"eth_getBlockByHash",params:[t,s]},{dedupe:!0}):l=await e.request({method:"eth_getBlockByNumber",params:[i||r,s]},{dedupe:!!i}),!l)throw new Ef({blockHash:t,blockNumber:n});return(((f=(u=(c=e.chain)==null?void 0:c.formatters)==null?void 0:u.block)==null?void 0:f.format)||Pf)(l,"getBlock")}async function xa(e){const t=await e.request({method:"eth_gasPrice"});return BigInt(t)}async function ty(e,t){return Tf(e,t)}async function Tf(e,t){var s,i;const{block:n,chain:r=e.chain,request:o}=t||{};try{const l=((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 l=="function"){const c=n||await te(e,Lt,"getBlock")({}),u=await l({block:c,client:e,request:o});if(u===null)throw new Error;return u}if(typeof l<"u")return l;const a=await e.request({method:"eth_maxPriorityFeePerGas"});return Gt(a)}catch{const[l,a]=await Promise.all([n?Promise.resolve(n):te(e,Lt,"getBlock")({}),te(e,xa,"getGasPrice")({})]);if(typeof l.baseFeePerGas!="bigint")throw new va;const c=a-l.baseFeePerGas;return c<0n?0n:c}}async function ny(e,t){return Ea(e,t)}async function Ea(e,t){var p,d;const{block:n,chain:r=e.chain,request:o,type:s="eip1559"}=t||{},i=await(async()=>{var h,b;return typeof((h=r==null?void 0:r.fees)==null?void 0:h.baseFeeMultiplier)=="function"?r.fees.baseFeeMultiplier({block:n,client:e,request:o}):((b=r==null?void 0:r.fees)==null?void 0:b.baseFeeMultiplier)??1.2})();if(i<1)throw new xf;const a=10**(((p=i.toString().split(".")[1])==null?void 0:p.length)??0),c=h=>h*BigInt(Math.ceil(i*a))/BigInt(a),u=n||await te(e,Lt,"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:c,request:o,type:s});if(h!==null)return h}if(s==="eip1559"){if(typeof u.baseFeePerGas!="bigint")throw new va;const h=typeof(o==null?void 0:o.maxPriorityFeePerGas)=="bigint"?o.maxPriorityFeePerGas:await Tf(e,{block:u,chain:r,request:o}),b=c(u.baseFeePerGas);return{maxFeePerGas:(o==null?void 0:o.maxFeePerGas)??b+h,maxPriorityFeePerGas:h}}return{gasPrice:(o==null?void 0:o.gasPrice)??c(await te(e,xa,"getGasPrice")({}))}}async function Af(e,{address:t,blockTag:n="latest",blockNumber:r}){const o=await e.request({method:"eth_getTransactionCount",params:[t,typeof r=="bigint"?re(r):n]},{dedupe:!!r});return ln(o)}function Nf(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=>qt(s)):e.blobs,o=[];for(const s of r)o.push(Uint8Array.from(t.blobToKzgCommitment(s)));return n==="bytes"?o:o.map(s=>ke(s))}function Cf(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=>qt(i)):e.blobs,o=typeof e.commitments[0]=="string"?e.commitments.map(i=>qt(i)):e.commitments,s=[];for(let i=0;i<r.length;i++){const l=r[i],a=o[i];s.push(Uint8Array.from(t.computeBlobKzgProof(l,a)))}return n==="bytes"?s:s.map(i=>ke(i))}function ry(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),l=Number(n&s),a=r?4:0,c=r?0:4;e.setUint32(t+a,i,r),e.setUint32(t+c,l,r)}function oy(e,t,n){return e&t^~e&n}function sy(e,t,n){return e&t^e&n^t&n}class iy extends Yi{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=Zi(this.buffer)}update(t){xr(this),t=xs(t),Kn(t);const{view:n,buffer:r,blockLen:o}=this,s=t.length;for(let i=0;i<s;){const l=Math.min(o-this.pos,s-i);if(l===o){const a=Zi(t);for(;o<=s-i;i+=o)this.process(a,i);continue}r.set(t.subarray(i,i+l),this.pos),this.pos+=l,i+=l,this.pos===o&&(this.process(n,0),this.pos=0)}return this.length+=t.length,this.roundClean(),this}digestInto(t){xr(this),Bu(t,this),this.finished=!0;const{buffer:n,view:r,blockLen:o,isLE:s}=this;let{pos:i}=this;n[i++]=128,Er(this.buffer.subarray(i)),this.padOffset>o-i&&(this.process(r,0),i=0);for(let f=i;f<o;f++)n[f]=0;ry(r,o-8,BigInt(this.length*8),s),this.process(r,0);const l=Zi(t),a=this.outputLen;if(a%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const c=a/4,u=this.get();if(c>u.length)throw new Error("_sha2: outputLen bigger than state");for(let f=0;f<c;f++)l.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:l}=this;return t.destroyed=i,t.finished=s,t.length=o,t.pos=l,o%n&&t.buffer.set(r),t}clone(){return this._cloneInto()}}const $n=Uint32Array.from([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),ay=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]),kn=new Uint32Array(64);class ly extends iy{constructor(t=32){super(64,t,8,!1),this.A=$n[0]|0,this.B=$n[1]|0,this.C=$n[2]|0,this.D=$n[3]|0,this.E=$n[4]|0,this.F=$n[5]|0,this.G=$n[6]|0,this.H=$n[7]|0}get(){const{A:t,B:n,C:r,D:o,E:s,F:i,G:l,H:a}=this;return[t,n,r,o,s,i,l,a]}set(t,n,r,o,s,i,l,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=l|0,this.H=a|0}process(t,n){for(let f=0;f<16;f++,n+=4)kn[f]=t.getUint32(n,!1);for(let f=16;f<64;f++){const p=kn[f-15],d=kn[f-2],h=Kt(p,7)^Kt(p,18)^p>>>3,b=Kt(d,17)^Kt(d,19)^d>>>10;kn[f]=b+kn[f-7]+h+kn[f-16]|0}let{A:r,B:o,C:s,D:i,E:l,F:a,G:c,H:u}=this;for(let f=0;f<64;f++){const p=Kt(l,6)^Kt(l,11)^Kt(l,25),d=u+p+oy(l,a,c)+ay[f]+kn[f]|0,b=(Kt(r,2)^Kt(r,13)^Kt(r,22))+sy(r,o,s)|0;u=c,c=a,a=l,l=i+d|0,i=s,s=o,o=r,r=d+b|0}r=r+this.A|0,o=o+this.B|0,s=s+this.C|0,i=i+this.D|0,l=l+this.E|0,a=a+this.F|0,c=c+this.G|0,u=u+this.H|0,this.set(r,o,s,i,l,a,c,u)}roundClean(){Er(kn)}destroy(){this.set(0,0,0,0,0,0,0,0),Er(this.buffer)}}const Of=Fu(()=>new ly),cy=Of;function uy(e,t){return cy(Mt(e,{strict:!1})?vr(e):e)}function fy(e){const{commitment:t,version:n=1}=e,r=e.to??(typeof t=="string"?"hex":"bytes"),o=uy(t);return o.set([n],0),r==="bytes"?o:ke(o)}function dy(e){const{commitments:t,version:n}=e,r=e.to,o=[];for(const s of t)o.push(fy({commitment:s,to:r,version:n}));return o}const If=6,$f=32,Sa=4096,kf=$f*Sa,Mf=kf*If-1-1*Sa*If;class py extends V{constructor({maxSize:t,size:n}){super("Blob size is too large.",{metaMessages:[`Max: ${t} bytes`,`Given: ${n} bytes`],name:"BlobSizeTooLargeError"})}}class hy extends V{constructor(){super("Blob data must not be empty.",{name:"EmptyBlobError"})}}function my(e){const t=typeof e.data=="string"?qt(e.data):e.data,n=Te(t);if(!n)throw new hy;if(n>Mf)throw new py({maxSize:Mf,size:n});const r=[];let o=!0,s=0;for(;o;){const i=oa(new Uint8Array(kf));let l=0;for(;l<Sa;){const a=t.slice(s,s+($f-1));if(i.pushByte(0),i.pushBytes(a),a.length<31){i.pushByte(128),o=!1;break}l++,s+=31}r.push(i)}return r.map(i=>ke(i.bytes))}function by(e){const{data:t,kzg:n,to:r}=e,o=e.blobs??my({data:t}),s=e.commitments??Nf({blobs:o,kzg:n,to:r}),i=e.proofs??Cf({blobs:o,commitments:s,kzg:n,to:r}),l=[];for(let a=0;a<o.length;a++)l.push({blob:o[a],commitment:s[a],proof:i[a]});return l}function gy(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 kg({transaction:e})}function yy(e,{docsPath:t,...n}){const r=(()=>{const o=Os(e,n);return o instanceof Bo?e:o})();return new Mg(r,{docsPath:t,...n})}async function Pa(e){const t=await e.request({method:"eth_chainId"},{dedupe:!0});return ln(t)}async function Df(e,t){var m,w,S,$,I;const{account:n=e.account,accessList:r,authorizationList:o,chain:s=e.chain,blobVersionedHashes:i,blobs:l,data:a,gas:c,gasPrice:u,maxFeePerBlobGas:f,maxFeePerGas:p,maxPriorityFeePerGas:d,nonce:h,nonceManager:b,to:v,type:P,value:x,...E}=t,N=await(async()=>{if(!n||!b||typeof h<"u")return h;const A=ft(n),k=s?s.id:await te(e,Pa,"getChainId")({});return await b.consume({address:A.address,chainId:k,client:e})})();Or(t);const D=(w=(m=s==null?void 0:s.formatters)==null?void 0:m.transactionRequest)==null?void 0:w.format,L=(D||Lo)({...Is(E,{format:D}),account:n?ft(n):void 0,accessList:r,authorizationList:o,blobs:l,blobVersionedHashes:i,data:a,gas:c,gasPrice:u,maxFeePerBlobGas:f,maxFeePerGas:p,maxPriorityFeePerGas:d,nonce:N,to:v,type:P,value:x},"fillTransaction");try{const A=await e.request({method:"eth_fillTransaction",params:[L]}),y=((($=(S=s==null?void 0:s.formatters)==null?void 0:S.transaction)==null?void 0:$.format)||wa)(A.tx);delete y.blockHash,delete y.blockNumber,delete y.r,delete y.s,delete y.transactionIndex,delete y.v,delete y.yParity,y.data=y.input,y.gas&&(y.gas=t.gas??y.gas),y.gasPrice&&(y.gasPrice=t.gasPrice??y.gasPrice),y.maxFeePerBlobGas&&(y.maxFeePerBlobGas=t.maxFeePerBlobGas??y.maxFeePerBlobGas),y.maxFeePerGas&&(y.maxFeePerGas=t.maxFeePerGas??y.maxFeePerGas),y.maxPriorityFeePerGas&&(y.maxPriorityFeePerGas=t.maxPriorityFeePerGas??y.maxPriorityFeePerGas),y.nonce&&(y.nonce=t.nonce??y.nonce);const O=await(async()=>{var R,z;if(typeof((R=s==null?void 0:s.fees)==null?void 0:R.baseFeeMultiplier)=="function"){const W=await te(e,Lt,"getBlock")({});return s.fees.baseFeeMultiplier({block:W,client:e,request:t})}return((z=s==null?void 0:s.fees)==null?void 0:z.baseFeeMultiplier)??1.2})();if(O<1)throw new xf;const T=10**(((I=O.toString().split(".")[1])==null?void 0:I.length)??0),B=R=>R*BigInt(Math.ceil(O*T))/BigInt(T);return y.maxFeePerGas&&!t.maxFeePerGas&&(y.maxFeePerGas=B(y.maxFeePerGas)),y.gasPrice&&!t.gasPrice&&(y.gasPrice=B(y.gasPrice)),{raw:A.raw,transaction:{from:L.from,...y}}}catch(A){throw yy(A,{...t,chain:e.chain})}}const vy=["blobVersionedHashes","chainId","fees","gas","nonce","type"],Bf=new Map,Ta=new Ss(128);async function Lf(e,t){var N,D,F;let n=t;n.account??(n.account=e.account),n.parameters??(n.parameters=vy);const{account:r,chain:o=e.chain,nonceManager:s,parameters:i}=n,l=(()=>{if(typeof(o==null?void 0:o.prepareTransactionRequest)=="function")return{fn:o.prepareTransactionRequest,runAt:["beforeFillTransaction"]};if(Array.isArray(o==null?void 0:o.prepareTransactionRequest))return{fn:o.prepareTransactionRequest[0],runAt:o.prepareTransactionRequest[1].runAt}})();let a;async function c(){return a||(typeof n.chainId<"u"?n.chainId:o?o.id:(a=await te(e,Pa,"getChainId")({}),a))}const u=r&&ft(r);let f=n.nonce;if(i.includes("nonce")&&typeof f>"u"&&u&&s){const L=await c();f=await s.consume({address:u.address,chainId:L,client:e})}l!=null&&l.fn&&((N=l.runAt)!=null&&N.includes("beforeFillTransaction"))&&(n=await l.fn({...n,chain:o},{phase:"beforeFillTransaction"}),f??(f=n.nonce));const d=((i.includes("blobVersionedHashes")||i.includes("sidecars"))&&n.kzg&&n.blobs||Ta.get(e.uid)===!1||!["fees","gas"].some(m=>i.includes(m))?!1:!!(i.includes("chainId")&&typeof n.chainId!="number"||i.includes("nonce")&&typeof f!="number"||i.includes("fees")&&typeof n.gasPrice!="bigint"&&(typeof n.maxFeePerGas!="bigint"||typeof n.maxPriorityFeePerGas!="bigint")||i.includes("gas")&&typeof n.gas!="bigint"))?await te(e,Df,"fillTransaction")({...n,nonce:f}).then(L=>{const{chainId:m,from:w,gas:S,gasPrice:$,nonce:I,maxFeePerBlobGas:A,maxFeePerGas:k,maxPriorityFeePerGas:y,type:O,...M}=L.transaction;return Ta.set(e.uid,!0),{...n,...w?{from:w}:{},...O&&!n.type?{type:O}:{},...typeof m<"u"?{chainId:m}:{},...typeof S<"u"?{gas:S}:{},...typeof $<"u"?{gasPrice:$}:{},...typeof I<"u"?{nonce:I}:{},...typeof A<"u"&&n.type!=="legacy"&&n.type!=="eip2930"?{maxFeePerBlobGas:A}:{},...typeof k<"u"&&n.type!=="legacy"&&n.type!=="eip2930"?{maxFeePerGas:k}:{},...typeof y<"u"&&n.type!=="legacy"&&n.type!=="eip2930"?{maxPriorityFeePerGas:y}:{},..."nonceKey"in M&&typeof M.nonceKey<"u"?{nonceKey:M.nonceKey}:{}}}).catch(L=>{var S;const m=L;return m.name!=="TransactionExecutionError"||((S=m.walk)==null?void 0:S.call(m,$=>{const I=$;return I.name==="MethodNotFoundRpcError"||I.name==="MethodNotSupportedRpcError"}))&&Ta.set(e.uid,!1),n}):n;f??(f=d.nonce),n={...d,...u?{from:u==null?void 0:u.address}:{},...f?{nonce:f}:{}};const{blobs:h,gas:b,kzg:v,type:P}=n;l!=null&&l.fn&&((D=l.runAt)!=null&&D.includes("beforeFillParameters"))&&(n=await l.fn({...n,chain:o},{phase:"beforeFillParameters"}));let x;async function E(){return x||(x=await te(e,Lt,"getBlock")({blockTag:"latest"}),x)}if(i.includes("nonce")&&typeof f>"u"&&u&&!s&&(n.nonce=await te(e,Af,"getTransactionCount")({address:u.address,blockTag:"pending"})),(i.includes("blobVersionedHashes")||i.includes("sidecars"))&&h&&v){const L=Nf({blobs:h,kzg:v});if(i.includes("blobVersionedHashes")){const m=dy({commitments:L,to:"hex"});n.blobVersionedHashes=m}if(i.includes("sidecars")){const m=Cf({blobs:h,commitments:L,kzg:v}),w=by({blobs:h,commitments:L,proofs:m,to:"hex"});n.sidecars=w}}if(i.includes("chainId")&&(n.chainId=await c()),(i.includes("fees")||i.includes("type"))&&typeof P>"u")try{n.type=gy(n)}catch{let L=Bf.get(e.uid);if(typeof L>"u"){const m=await E();L=typeof(m==null?void 0:m.baseFeePerGas)=="bigint",Bf.set(e.uid,L)}n.type=L?"eip1559":"legacy"}if(i.includes("fees"))if(n.type!=="legacy"&&n.type!=="eip2930"){if(typeof n.maxFeePerGas>"u"||typeof n.maxPriorityFeePerGas>"u"){const L=await E(),{maxFeePerGas:m,maxPriorityFeePerGas:w}=await Ea(e,{block:L,chain:o,request:n});if(typeof n.maxPriorityFeePerGas>"u"&&n.maxFeePerGas&&n.maxFeePerGas<w)throw new Qg({maxPriorityFeePerGas:w});n.maxPriorityFeePerGas=w,n.maxFeePerGas=m}}else{if(typeof n.maxFeePerGas<"u"||typeof n.maxPriorityFeePerGas<"u")throw new va;if(typeof n.gasPrice>"u"){const L=await E(),{gasPrice:m}=await Ea(e,{block:L,chain:o,request:n,type:"legacy"});n.gasPrice=m}}return i.includes("gas")&&typeof b>"u"&&(n.gas=await te(e,Aa,"estimateGas")({...n,account:u,prepare:(u==null?void 0:u.type)==="local"?[]:["blobVersionedHashes"]})),l!=null&&l.fn&&((F=l.runAt)!=null&&F.includes("afterFillParameters"))&&(n=await l.fn({...n,chain:o},{phase:"afterFillParameters"})),Or(n),delete n.parameters,n}async function Aa(e,t){var i,l,a;const{account:n=e.account,prepare:r=!0}=t,o=n?ft(n):void 0,s=(()=>{if(Array.isArray(r))return r;if((o==null?void 0:o.type)!=="local")return["blobVersionedHashes"]})();try{const c=await(async()=>{if(t.to)return t.to;if(t.authorizationList&&t.authorizationList.length>0)return await yf({authorization:t.authorizationList[0]}).catch(()=>{throw new V("`to` is required. Could not infer from `authorizationList`")})})(),{accessList:u,authorizationList:f,blobs:p,blobVersionedHashes:d,blockNumber:h,blockTag:b,data:v,gas:P,gasPrice:x,maxFeePerBlobGas:E,maxFeePerGas:N,maxPriorityFeePerGas:D,nonce:F,value:L,stateOverride:m,...w}=r?await Lf(e,{...t,parameters:s,to:c}):t;if(P&&t.gas!==P)return P;const $=(typeof h=="bigint"?re(h):void 0)||b,I=ya(m);Or(t);const A=(a=(l=(i=e.chain)==null?void 0:i.formatters)==null?void 0:l.transactionRequest)==null?void 0:a.format,y=(A||Lo)({...Is(w,{format:A}),account:o,accessList:u,authorizationList:f,blobs:p,blobVersionedHashes:d,data:v,gasPrice:x,maxFeePerBlobGas:E,maxFeePerGas:N,maxPriorityFeePerGas:D,nonce:F,to:c,value:L},"estimateGas");return BigInt(await e.request({method:"eth_estimateGas",params:I?[y,$??e.experimental_blockTag??"latest",I]:$?[y,$]:[y]}))}catch(c){throw Zg(c,{...t,account:o,chain:e.chain})}}async function wy(e,t){var c;const{abi:n,address:r,args:o,functionName:s,dataSuffix:i=typeof e.dataSuffix=="string"?e.dataSuffix:(c=e.dataSuffix)==null?void 0:c.value,...l}=t,a=vt({abi:n,args:o,functionName:s});try{return await te(e,Aa,"estimateGas")({data:`${a}${i?i.replace("0x",""):""}`,to:r,...l})}catch(u){const f=l.account?ft(l.account):void 0;throw Nr(u,{abi:n,address:r,args:o,docsPath:"/docs/contract/estimateContractGas",functionName:s,sender:f==null?void 0:f.address})}}function Fo(e,t){if(!yt(e,{strict:!1}))throw new Cn({address:e});if(!yt(t,{strict:!1}))throw new Cn({address:t});return e.toLowerCase()===t.toLowerCase()}function Zt(e,{args:t,eventName:n}={}){return{...e,blockHash:e.blockHash?e.blockHash:null,blockNumber:e.blockNumber?BigInt(e.blockNumber):null,blockTimestamp:e.blockTimestamp?BigInt(e.blockTimestamp):e.blockTimestamp===null?null:void 0,logIndex:e.logIndex?Number(e.logIndex):null,transactionHash:e.transactionHash?e.transactionHash:null,transactionIndex:e.transactionIndex?Number(e.transactionIndex):null,...n?{args:t,eventName:n}:{}}}const Ff="/docs/contract/decodeEventLog";function $s(e){const{abi:t,data:n,strict:r,topics:o}=e,s=r??!0,[i,...l]=o;if(!i)throw new a1({docsPath:Ff});const a=t.find(P=>P.type==="event"&&i===Es(kt(P)));if(!(a&&"name"in a)||a.type!=="event")throw new l1(i,{docsPath:Ff});const{name:c,inputs:u}=a,f=u==null?void 0:u.some(P=>!("name"in P&&P.name)),p=f?[]:{},d=u.map((P,x)=>[P,x]).filter(([P])=>"indexed"in P&&P.indexed),h=[];for(let P=0;P<d.length;P++){const[x,E]=d[P],N=l[P];if(!N){if(s)throw new qi({abiItem:a,param:x});h.push([x,E]);continue}p[f?E:x.name||E]=xy({param:x,value:N})}const b=u.filter(P=>!("indexed"in P&&P.indexed)),v=s?b:[...h.map(([P])=>P),...b];if(v.length>0){if(n&&n!=="0x")try{const P=co(v,n);if(P){let x=0;if(!s)for(const[E,N]of h)p[f?N:E.name||N]=P[x++];if(f)for(let E=0;E<u.length;E++)p[E]===void 0&&x<P.length&&(p[E]=P[x++]);else for(let E=0;E<b.length;E++)p[b[E].name]=P[x++]}}catch(P){if(s)throw P instanceof Su||P instanceof rf?new vs({abiItem:a,data:n,params:v,size:Te(n)}):P}else if(s)throw new vs({abiItem:a,data:"0x",params:v,size:0})}return{eventName:c,args:Object.values(p).length>0?p:void 0}}function xy({param:e,value:t}){return e.type==="string"||e.type==="bytes"||e.type==="tuple"||e.type.match(/^(.*)\[(\d+)?\]$/)?t:(co([e],t)||[])[0]}function Na(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]})(),i=t.filter(l=>l.type==="event").map(l=>({abi:l,selector:Es(l)}));return r.map(l=>{var p;const a=typeof l.blockNumber=="string"?Zt(l):l,c=i.filter(d=>a.topics[0]===d.selector);if(c.length===0)return null;let u,f;for(const d of c)try{u=$s({...a,abi:[d.abi],strict:!0}),f=d;break}catch{}if(!u&&!o){f=c[0];try{u=$s({data:a.data,topics:a.topics,abi:[f.abi],strict:!1})}catch{const d=(p=f.abi.inputs)==null?void 0:p.some(h=>!("name"in h&&h.name));return{...a,args:d?[]:{},eventName:f.abi.name}}}return!u||!f||s&&!s.includes(u.eventName)||!Ey({args:u.args,inputs:f.abi.inputs,matchArgs:n})?null:{...u,...a}}).filter(Boolean)}function Ey(e){const{args:t,inputs:n,matchArgs:r}=e;if(!r)return!0;if(!t)return!1;function o(s,i,l){try{return s.type==="address"?Fo(i,l):s.type==="string"||s.type==="bytes"?je(vr(i))===l:i===l}catch{return!1}}return Array.isArray(t)&&Array.isArray(r)?r.every((s,i)=>{if(s==null)return!0;const l=n[i];return l?(Array.isArray(s)?s:[s]).some(c=>o(l,c,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 l=n.find(c=>c.name===s);return l?(Array.isArray(i)?i:[i]).some(c=>o(l,c,t[s])):!1}):!1}async function Ca(e,{address:t,blockHash:n,fromBlock:r,toBlock:o,event:s,events:i,args:l,strict:a}={}){const c=a??!1,u=i??(s?[s]:void 0);let f=[];u&&(f=[u.flatMap(b=>lo({abi:[b],eventName:b.name,args:i?void 0:l}))],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"?re(r):r,toBlock:typeof o=="bigint"?re(o):o}]});const d=p.map(h=>Zt(h));return u?Na({abi:u,args:l,logs:d,strict:c}):d}async function Rf(e,t){const{abi:n,address:r,args:o,blockHash:s,eventName:i,fromBlock:l,toBlock:a,strict:c}=t,u=i?Yn({abi:n,name:i}):void 0,f=u?void 0:n.filter(p=>p.type==="event");return te(e,Ca,"getLogs")({address:r,args:o,blockHash:s,event:u,events:f,fromBlock:l,toBlock:a,strict:c})}const Oa="/docs/contract/decodeFunctionResult";function Mn(e){const{abi:t,args:n,functionName:r,data:o}=e;let s=t[0];if(r){const l=Yn({abi:t,args:n,name:r});if(!l)throw new gr(r,{docsPath:Oa});s=l}if(s.type!=="function")throw new gr(void 0,{docsPath:Oa});if(!s.outputs)throw new Nu(s.name,{docsPath:Oa});const i=co(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 Ia=BigInt(0),$a=BigInt(1);function Ro(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array"}function ka(e){if(!Ro(e))throw new Error("Uint8Array expected")}function jo(e,t){if(typeof t!="boolean")throw new Error(e+" boolean expected, got "+t)}function ks(e){const t=e.toString(16);return t.length&1?"0"+t:t}function jf(e){if(typeof e!="string")throw new Error("hex string expected, got "+typeof e);return e===""?Ia:BigInt("0x"+e)}const zf=typeof Uint8Array.from([]).toHex=="function"&&typeof Uint8Array.fromHex=="function",Sy=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function zo(e){if(ka(e),zf)return e.toHex();let t="";for(let n=0;n<e.length;n++)t+=Sy[e[n]];return t}const dn={_0:48,_9:57,A:65,F:70,a:97,f:102};function Uf(e){if(e>=dn._0&&e<=dn._9)return e-dn._0;if(e>=dn.A&&e<=dn.F)return e-(dn.A-10);if(e>=dn.a&&e<=dn.f)return e-(dn.a-10)}function Ms(e){if(typeof e!="string")throw new Error("hex string expected, got "+typeof e);if(zf)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=Uf(e.charCodeAt(s)),l=Uf(e.charCodeAt(s+1));if(i===void 0||l===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+l}return r}function er(e){return jf(zo(e))}function Wf(e){return ka(e),jf(zo(Uint8Array.from(e).reverse()))}function Uo(e,t){return Ms(e.toString(16).padStart(t*2,"0"))}function _f(e,t){return Uo(e,t).reverse()}function wt(e,t,n){let r;if(typeof t=="string")try{r=Ms(t)}catch(s){throw new Error(e+" must be hex string or Uint8Array, cause: "+s)}else if(Ro(t))r=Uint8Array.from(t);else throw new Error(e+" must be hex string or Uint8Array");const o=r.length;if(typeof n=="number"&&o!==n)throw new Error(e+" of length "+n+" expected, got "+o);return r}function Ds(...e){let t=0;for(let r=0;r<e.length;r++){const o=e[r];ka(o),t+=o.length}const n=new Uint8Array(t);for(let r=0,o=0;r<e.length;r++){const s=e[r];n.set(s,o),o+=s.length}return n}const Ma=e=>typeof e=="bigint"&&Ia<=e;function Da(e,t,n){return Ma(e)&&Ma(t)&&Ma(n)&&t<=e&&e<n}function Ir(e,t,n,r){if(!Da(t,n,r))throw new Error("expected valid "+e+": "+n+" <= n < "+r+", got "+t)}function Py(e){let t;for(t=0;e>Ia;e>>=$a,t+=1);return t}const Bs=e=>($a<<BigInt(e))-$a,Ba=e=>new Uint8Array(e),Vf=e=>Uint8Array.from(e);function Ty(e,t,n){if(typeof e!="number"||e<2)throw new Error("hashLen must be a number");if(typeof t!="number"||t<2)throw new Error("qByteLen must be a number");if(typeof n!="function")throw new Error("hmacFn must be a function");let r=Ba(e),o=Ba(e),s=0;const i=()=>{r.fill(1),o.fill(0),s=0},l=(...f)=>n(o,r,...f),a=(f=Ba(0))=>{o=l(Vf([0]),f),r=l(),f.length!==0&&(o=l(Vf([1]),f),r=l())},c=()=>{if(s++>=1e3)throw new Error("drbg: tried 1000 values");let f=0;const p=[];for(;f<t;){r=l();const d=r.slice();p.push(d),f+=r.length}return Ds(...p)};return(f,p)=>{i(),a(f);let d;for(;!(d=p(c()));)a();return i(),d}}const Ay={bigint:e=>typeof e=="bigint",function:e=>typeof e=="function",boolean:e=>typeof e=="boolean",string:e=>typeof e=="string",stringOrUint8Array:e=>typeof e=="string"||Ro(e),isSafeInteger:e=>Number.isSafeInteger(e),array:e=>Array.isArray(e),field:(e,t)=>t.Fp.isValid(e),hash:e=>typeof e=="function"&&Number.isSafeInteger(e.outputLen)};function Ls(e,t,n={}){const r=(o,s,i)=>{const l=Ay[s];if(typeof l!="function")throw new Error("invalid validator function");const a=e[o];if(!(i&&a===void 0)&&!l(a,e))throw new Error("param "+String(o)+" is invalid. Expected "+s+", got "+a)};for(const[o,s]of Object.entries(t))r(o,s,!1);for(const[o,s]of Object.entries(n))r(o,s,!0);return e}function Hf(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 Ny="0.1.1";function Cy(){return Ny}class oe extends Error{static setStaticOptions(t){oe.prototype.docsOrigin=t.docsOrigin,oe.prototype.showVersion=t.showVersion,oe.prototype.version=t.version}constructor(t,n={}){const r=(()=>{var u;if(n.cause instanceof oe){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:(u=n.cause)!=null&&u.message?n.cause.message:n.details})(),o=n.cause instanceof oe&&n.cause.docsPath||n.docsPath,s=n.docsOrigin??oe.prototype.docsOrigin,i=`${s}${o??""}`,l=!!(n.version??oe.prototype.showVersion),a=n.version??oe.prototype.version,c=[t||"An error occurred.",...n.metaMessages?["",...n.metaMessages]:[],...r||o||l?["",r?`Details: ${r}`:void 0,o?`See: ${i}`:void 0,l?`Version: ${a}`:void 0]:[]].filter(u=>typeof u=="string").join(`
88
+ `);super(c,n.cause?{cause:n.cause}:void 0),Object.defineProperty(this,"details",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docs",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docsOrigin",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docsPath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"shortMessage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"showVersion",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"version",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"BaseError"}),this.cause=n.cause,this.details=r,this.docs=i,this.docsOrigin=s,this.docsPath=o,this.shortMessage=t,this.showVersion=l,this.version=a}walk(t){return Gf(this,t)}}Object.defineProperty(oe,"defaultStaticOptions",{enumerable:!0,configurable:!0,writable:!0,value:{docsOrigin:"https://oxlib.sh",showVersion:!1,version:`ox@${Cy()}`}}),oe.setStaticOptions(oe.defaultStaticOptions);function Gf(e,t){return t!=null&&t(e)?e:e&&typeof e=="object"&&"cause"in e&&e.cause?Gf(e.cause,t):t?null:e}function Wo(e,t){if($r(e)>t)throw new Hy({givenSize:$r(e),maxSize:t})}const pn={zero:48,nine:57,A:65,F:70,a:97,f:102};function qf(e){if(e>=pn.zero&&e<=pn.nine)return e-pn.zero;if(e>=pn.A&&e<=pn.F)return e-(pn.A-10);if(e>=pn.a&&e<=pn.f)return e-(pn.a-10)}function Oy(e,t={}){const{dir:n,size:r=32}=t;if(r===0)return e;if(e.length>r)throw new Gy({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 Kf(e,t={}){const{dir:n="left"}=t;let r=e,o=0;for(let s=0;s<r.length-1&&r[n==="left"?s:r.length-s-1].toString()==="0";s++)o++;return r=n==="left"?r.slice(o):r.slice(0,r.length-o),r}function Fs(e,t){if(dt(e)>t)throw new Jy({givenSize:dt(e),maxSize:t})}function Iy(e,t){if(typeof t=="number"&&t>0&&t>dt(e)-1)throw new sd({offset:t,position:"start",size:dt(e)})}function $y(e,t,n){if(typeof t=="number"&&typeof n=="number"&&dt(e)!==n-t)throw new sd({offset:n,position:"end",size:dt(e)})}function Zf(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 Qy({size:Math.ceil(o.length/2),targetSize:r,type:"Hex"});return`0x${o[n==="right"?"padEnd":"padStart"](r*2,"0")}`}const ky="#__bigint";function Yf(e,t,n){return JSON.stringify(e,(r,o)=>typeof o=="bigint"?o.toString()+ky:o,n)}const My=new TextDecoder,Dy=new TextEncoder;function By(e){return e instanceof Uint8Array?e:typeof e=="string"?Xf(e):Ly(e)}function Ly(e){return e instanceof Uint8Array?e:new Uint8Array(e)}function Xf(e,t={}){const{size:n}=t;let r=e;n&&(Fs(e,n),r=nr(e,n));let o=r.slice(2);o.length%2&&(o=`0${o}`);const s=o.length/2,i=new Uint8Array(s);for(let l=0,a=0;l<s;l++){const c=qf(o.charCodeAt(a++)),u=qf(o.charCodeAt(a++));if(c===void 0||u===void 0)throw new oe(`Invalid byte sequence ("${o[a-2]}${o[a-1]}" in "${o}").`);i[l]=c<<4|u}return i}function Fy(e,t={}){const{size:n}=t,r=Dy.encode(e);return typeof n=="number"?(Wo(r,n),Ry(r,n)):r}function Ry(e,t){return Oy(e,{dir:"right",size:t})}function $r(e){return e.length}function jy(e,t,n,r={}){const{strict:o}=r;return e.slice(t,n)}function zy(e,t={}){const{size:n}=t;typeof n<"u"&&Wo(e,n);const r=Rt(e,t);return ed(r,t)}function Uy(e,t={}){const{size:n}=t;let r=e;if(typeof n<"u"&&(Wo(r,n),r=Jf(r)),r.length>1||r[0]>1)throw new Vy(r);return!!r[0]}function hn(e,t={}){const{size:n}=t;typeof n<"u"&&Wo(e,n);const r=Rt(e,t);return td(r,t)}function Wy(e,t={}){const{size:n}=t;let r=e;return typeof n<"u"&&(Wo(r,n),r=_y(r)),My.decode(r)}function Jf(e){return Kf(e,{dir:"left"})}function _y(e){return Kf(e,{dir:"right"})}class Vy extends oe{constructor(t){super(`Bytes value \`${t}\` is not a valid boolean.`,{metaMessages:["The bytes array must contain a single byte of either a `0` or `1` value."]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Bytes.InvalidBytesBooleanError"})}}let Hy=class extends oe{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"})}},Gy=class extends oe{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 qy=new TextEncoder,Ky=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function Zy(e,t={}){const{strict:n=!1}=t;if(!e)throw new rd(e);if(typeof e!="string")throw new rd(e);if(n&&!/^0x[0-9a-fA-F]*$/.test(e))throw new od(e);if(!e.startsWith("0x"))throw new od(e)}function Ft(...e){return`0x${e.reduce((t,n)=>t+n.replace("0x",""),"")}`}function Yy(e){return e instanceof Uint8Array?Rt(e):Array.isArray(e)?Rt(new Uint8Array(e)):e}function Qf(e,t={}){const n=`0x${Number(e)}`;return typeof t.size=="number"?(Fs(n,t.size),tr(n,t.size)):n}function Rt(e,t={}){let n="";for(let o=0;o<e.length;o++)n+=Ky[e[o]];const r=`0x${n}`;return typeof t.size=="number"?(Fs(r,t.size),nr(r,t.size)):r}function Ve(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 c=typeof e=="bigint"?"n":"";throw new nd({max:s?`${s}${c}`:void 0,min:`${i}${c}`,signed:n,size:r,value:`${e}${c}`})}const a=`0x${(n&&o<0?BigInt.asUintN(r*8,BigInt(o)):o).toString(16)}`;return r?tr(a,r):a}function La(e,t={}){return Rt(qy.encode(e),t)}function tr(e,t){return Zf(e,{dir:"left",size:t})}function nr(e,t){return Zf(e,{dir:"right",size:t})}function Yt(e,t,n,r={}){const{strict:o}=r;Iy(e,t);const s=`0x${e.replace("0x","").slice((t??0)*2,(n??e.length)*2)}`;return o&&$y(s,t,n),s}function dt(e){return Math.ceil((e.length-2)/2)}function ed(e,t={}){const{signed:n}=t;t.size&&Fs(e,t.size);const r=BigInt(e);if(!n)return r;const o=(e.length-2)/2,s=(1n<<BigInt(o)*8n)-1n,i=s>>1n;return r<=i?r:r-s-1n}function td(e,t={}){const{signed:n,size:r}=t;return Number(!n&&!r?e:ed(e,t))}function Xy(e,t={}){const{strict:n=!1}=t;try{return Zy(e,{strict:n}),!0}catch{return!1}}class nd extends oe{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 rd extends oe{constructor(t){super(`Value \`${typeof t=="object"?Yf(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 od extends oe{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 Jy extends oe{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 sd extends oe{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 Qy extends oe{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 ev(e){return{address:e.address,amount:Ve(e.amount),index:Ve(e.index),validatorIndex:Ve(e.validatorIndex)}}function id(e){return{...typeof e.baseFeePerGas=="bigint"&&{baseFeePerGas:Ve(e.baseFeePerGas)},...typeof e.blobBaseFee=="bigint"&&{blobBaseFee:Ve(e.blobBaseFee)},...typeof e.feeRecipient=="string"&&{feeRecipient:e.feeRecipient},...typeof e.gasLimit=="bigint"&&{gasLimit:Ve(e.gasLimit)},...typeof e.number=="bigint"&&{number:Ve(e.number)},...typeof e.prevRandao=="bigint"&&{prevRandao:Ve(e.prevRandao)},...typeof e.time=="bigint"&&{time:Ve(e.time)},...e.withdrawals&&{withdrawals:e.withdrawals.map(ev)}}}const kr=[{inputs:[{components:[{name:"target",type:"address"},{name:"allowFailure",type:"bool"},{name:"callData",type:"bytes"}],name:"calls",type:"tuple[]"}],name:"aggregate3",outputs:[{components:[{name:"success",type:"bool"},{name:"returnData",type:"bytes"}],name:"returnData",type:"tuple[]"}],stateMutability:"view",type:"function"},{inputs:[{name:"addr",type:"address"}],name:"getEthBalance",outputs:[{name:"balance",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"getCurrentBlockTimestamp",outputs:[{internalType:"uint256",name:"timestamp",type:"uint256"}],stateMutability:"view",type:"function"}],Fa=[{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"}]}],ad=[{inputs:[{name:"dns",type:"bytes"}],name:"DNSDecodingFailed",type:"error"},{inputs:[{name:"ens",type:"string"}],name:"DNSEncodingFailed",type:"error"},{inputs:[],name:"EmptyAddress",type:"error"},{inputs:[{name:"status",type:"uint16"},{name:"message",type:"string"}],name:"HttpError",type:"error"},{inputs:[],name:"InvalidBatchGatewayResponse",type:"error"},{inputs:[{name:"errorData",type:"bytes"}],name:"ResolverError",type:"error"},{inputs:[{name:"name",type:"bytes"},{name:"resolver",type:"address"}],name:"ResolverNotContract",type:"error"},{inputs:[{name:"name",type:"bytes"}],name:"ResolverNotFound",type:"error"},{inputs:[{name:"primary",type:"string"},{name:"primaryAddress",type:"bytes"}],name:"ReverseAddressMismatch",type:"error"},{inputs:[{internalType:"bytes4",name:"selector",type:"bytes4"}],name:"UnsupportedResolverProfile",type:"error"}],ld=[...ad,{name:"resolveWithGateways",type:"function",stateMutability:"view",inputs:[{name:"name",type:"bytes"},{name:"data",type:"bytes"},{name:"gateways",type:"string[]"}],outputs:[{name:"",type:"bytes"},{name:"address",type:"address"}]}],tv=[...ad,{name:"reverseWithGateways",type:"function",stateMutability:"view",inputs:[{type:"bytes",name:"reverseName"},{type:"uint256",name:"coinType"},{type:"string[]",name:"gateways"}],outputs:[{type:"string",name:"resolvedName"},{type:"address",name:"resolver"},{type:"address",name:"reverseResolver"}]}],cd=[{name:"text",type:"function",stateMutability:"view",inputs:[{name:"name",type:"bytes32"},{name:"key",type:"string"}],outputs:[{name:"",type:"string"}]}],ud=[{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"}]}],fd=[{name:"isValidSignature",type:"function",stateMutability:"view",inputs:[{name:"hash",type:"bytes32"},{name:"signature",type:"bytes"}],outputs:[{name:"",type:"bytes4"}]}],dd=[{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"}],Mr=[{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"}]}],nv="0x82ad56cb",pd="0x608060405234801561001057600080fd5b5060405161018e38038061018e83398101604081905261002f91610124565b6000808351602085016000f59050803b61004857600080fd5b6000808351602085016000855af16040513d6000823e81610067573d81fd5b3d81f35b634e487b7160e01b600052604160045260246000fd5b600082601f83011261009257600080fd5b81516001600160401b038111156100ab576100ab61006b565b604051601f8201601f19908116603f011681016001600160401b03811182821017156100d9576100d961006b565b6040528181528382016020018510156100f157600080fd5b60005b82811015610110576020818601810151838301820152016100f4565b506000918101602001919091529392505050565b6000806040838503121561013757600080fd5b82516001600160401b0381111561014d57600080fd5b61015985828601610081565b602085015190935090506001600160401b0381111561017757600080fd5b61018385828601610081565b915050925092905056fe",rv="0x608060405234801561001057600080fd5b506040516102c03803806102c083398101604081905261002f916101e6565b836001600160a01b03163b6000036100e457600080836001600160a01b03168360405161005c9190610270565b6000604051808303816000865af19150503d8060008114610099576040519150601f19603f3d011682016040523d82523d6000602084013e61009e565b606091505b50915091508115806100b857506001600160a01b0386163b155b156100e1578060405163101bb98d60e01b81526004016100d8919061028c565b60405180910390fd5b50505b6000808451602086016000885af16040513d6000823e81610103573d81fd5b3d81f35b80516001600160a01b038116811461011e57600080fd5b919050565b634e487b7160e01b600052604160045260246000fd5b60005b8381101561015457818101518382015260200161013c565b50506000910152565b600082601f83011261016e57600080fd5b81516001600160401b0381111561018757610187610123565b604051601f8201601f19908116603f011681016001600160401b03811182821017156101b5576101b5610123565b6040528181528382016020018510156101cd57600080fd5b6101de826020830160208701610139565b949350505050565b600080600080608085870312156101fc57600080fd5b61020585610107565b60208601519094506001600160401b0381111561022157600080fd5b61022d8782880161015d565b93505061023c60408601610107565b60608601519092506001600160401b0381111561025857600080fd5b6102648782880161015d565b91505092959194509250565b60008251610282818460208701610139565b9190910192915050565b60208152600082518060208401526102ab816040850160208701610139565b601f01601f1916919091016040019291505056fe",ov="0x608060405234801561001057600080fd5b5060405161069438038061069483398101604081905261002f9161051e565b600061003c848484610048565b9050806000526001601ff35b60007f64926492649264926492649264926492649264926492649264926492649264926100748361040c565b036101e7576000606080848060200190518101906100929190610577565b60405192955090935091506000906001600160a01b038516906100b69085906105dd565b6000604051808303816000865af19150503d80600081146100f3576040519150601f19603f3d011682016040523d82523d6000602084013e6100f8565b606091505b50509050876001600160a01b03163b60000361016057806101605760405162461bcd60e51b815260206004820152601e60248201527f5369676e617475726556616c696461746f723a206465706c6f796d656e74000060448201526064015b60405180910390fd5b604051630b135d3f60e11b808252906001600160a01b038a1690631626ba7e90610190908b9087906004016105f9565b602060405180830381865afa1580156101ad573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101d19190610633565b6001600160e01b03191614945050505050610405565b6001600160a01b0384163b1561027a57604051630b135d3f60e11b808252906001600160a01b03861690631626ba7e9061022790879087906004016105f9565b602060405180830381865afa158015610244573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102689190610633565b6001600160e01b031916149050610405565b81516041146102df5760405162461bcd60e51b815260206004820152603a602482015260008051602061067483398151915260448201527f3a20696e76616c6964207369676e6174757265206c656e6774680000000000006064820152608401610157565b6102e7610425565b5060208201516040808401518451859392600091859190811061030c5761030c61065d565b016020015160f81c9050601b811480159061032b57508060ff16601c14155b1561038c5760405162461bcd60e51b815260206004820152603b602482015260008051602061067483398151915260448201527f3a20696e76616c6964207369676e617475726520762076616c756500000000006064820152608401610157565b60408051600081526020810180835289905260ff83169181019190915260608101849052608081018390526001600160a01b0389169060019060a0016020604051602081039080840390855afa1580156103ea573d6000803e3d6000fd5b505050602060405103516001600160a01b0316149450505050505b9392505050565b600060208251101561041d57600080fd5b508051015190565b60405180606001604052806003906020820280368337509192915050565b6001600160a01b038116811461045857600080fd5b50565b634e487b7160e01b600052604160045260246000fd5b60005b8381101561048c578181015183820152602001610474565b50506000910152565b600082601f8301126104a657600080fd5b81516001600160401b038111156104bf576104bf61045b565b604051601f8201601f19908116603f011681016001600160401b03811182821017156104ed576104ed61045b565b60405281815283820160200185101561050557600080fd5b610516826020830160208701610471565b949350505050565b60008060006060848603121561053357600080fd5b835161053e81610443565b6020850151604086015191945092506001600160401b0381111561056157600080fd5b61056d86828701610495565b9150509250925092565b60008060006060848603121561058c57600080fd5b835161059781610443565b60208501519093506001600160401b038111156105b357600080fd5b6105bf86828701610495565b604086015190935090506001600160401b0381111561056157600080fd5b600082516105ef818460208701610471565b9190910192915050565b828152604060208201526000825180604084015261061e816060850160208701610471565b601f01601f1916919091016060019392505050565b60006020828403121561064557600080fd5b81516001600160e01b03198116811461040557600080fd5b634e487b7160e01b600052603260045260246000fdfe5369676e617475726556616c696461746f72237265636f7665725369676e6572",Ra="0x608060405234801561001057600080fd5b506115b9806100206000396000f3fe6080604052600436106100f35760003560e01c80634d2301cc1161008a578063a8b0574e11610059578063a8b0574e14610325578063bce38bd714610350578063c3077fa914610380578063ee82ac5e146103b2576100f3565b80634d2301cc1461026257806372425d9d1461029f57806382ad56cb146102ca57806386d516e8146102fa576100f3565b80633408e470116100c65780633408e470146101af578063399542e9146101da5780633e64a6961461020c57806342cbb15c14610237576100f3565b80630f28c97d146100f8578063174dea7114610123578063252dba421461015357806327e86d6e14610184575b600080fd5b34801561010457600080fd5b5061010d6103ef565b60405161011a9190610c0a565b60405180910390f35b61013d60048036038101906101389190610c94565b6103f7565b60405161014a9190610e94565b60405180910390f35b61016d60048036038101906101689190610f0c565b610615565b60405161017b92919061101b565b60405180910390f35b34801561019057600080fd5b506101996107ab565b6040516101a69190611064565b60405180910390f35b3480156101bb57600080fd5b506101c46107b7565b6040516101d19190610c0a565b60405180910390f35b6101f460048036038101906101ef91906110ab565b6107bf565b6040516102039392919061110b565b60405180910390f35b34801561021857600080fd5b506102216107e1565b60405161022e9190610c0a565b60405180910390f35b34801561024357600080fd5b5061024c6107e9565b6040516102599190610c0a565b60405180910390f35b34801561026e57600080fd5b50610289600480360381019061028491906111a7565b6107f1565b6040516102969190610c0a565b60405180910390f35b3480156102ab57600080fd5b506102b4610812565b6040516102c19190610c0a565b60405180910390f35b6102e460048036038101906102df919061122a565b61081a565b6040516102f19190610e94565b60405180910390f35b34801561030657600080fd5b5061030f6109e4565b60405161031c9190610c0a565b60405180910390f35b34801561033157600080fd5b5061033a6109ec565b6040516103479190611286565b60405180910390f35b61036a600480360381019061036591906110ab565b6109f4565b6040516103779190610e94565b60405180910390f35b61039a60048036038101906103959190610f0c565b610ba6565b6040516103a99392919061110b565b60405180910390f35b3480156103be57600080fd5b506103d960048036038101906103d491906112cd565b610bca565b6040516103e69190611064565b60405180910390f35b600042905090565b60606000808484905090508067ffffffffffffffff81111561041c5761041b6112fa565b5b60405190808252806020026020018201604052801561045557816020015b610442610bd5565b81526020019060019003908161043a5790505b5092503660005b828110156105c957600085828151811061047957610478611329565b5b6020026020010151905087878381811061049657610495611329565b5b90506020028101906104a89190611367565b925060008360400135905080860195508360000160208101906104cb91906111a7565b73ffffffffffffffffffffffffffffffffffffffff16818580606001906104f2919061138f565b604051610500929190611431565b60006040518083038185875af1925050503d806000811461053d576040519150601f19603f3d011682016040523d82523d6000602084013e610542565b606091505b5083600001846020018290528215151515815250505081516020850135176105bc577f08c379a000000000000000000000000000000000000000000000000000000000600052602060045260176024527f4d756c746963616c6c333a2063616c6c206661696c656400000000000000000060445260846000fd5b826001019250505061045c565b5082341461060c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610603906114a7565b60405180910390fd5b50505092915050565b6000606043915060008484905090508067ffffffffffffffff81111561063e5761063d6112fa565b5b60405190808252806020026020018201604052801561067157816020015b606081526020019060019003908161065c5790505b5091503660005b828110156107a157600087878381811061069557610694611329565b5b90506020028101906106a791906114c7565b92508260000160208101906106bc91906111a7565b73ffffffffffffffffffffffffffffffffffffffff168380602001906106e2919061138f565b6040516106f0929190611431565b6000604051808303816000865af19150503d806000811461072d576040519150601f19603f3d011682016040523d82523d6000602084013e610732565b606091505b5086848151811061074657610745611329565b5b60200260200101819052819250505080610795576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161078c9061153b565b60405180910390fd5b81600101915050610678565b5050509250929050565b60006001430340905090565b600046905090565b6000806060439250434091506107d68686866109f4565b905093509350939050565b600048905090565b600043905090565b60008173ffffffffffffffffffffffffffffffffffffffff16319050919050565b600044905090565b606060008383905090508067ffffffffffffffff81111561083e5761083d6112fa565b5b60405190808252806020026020018201604052801561087757816020015b610864610bd5565b81526020019060019003908161085c5790505b5091503660005b828110156109db57600084828151811061089b5761089a611329565b5b602002602001015190508686838181106108b8576108b7611329565b5b90506020028101906108ca919061155b565b92508260000160208101906108df91906111a7565b73ffffffffffffffffffffffffffffffffffffffff16838060400190610905919061138f565b604051610913929190611431565b6000604051808303816000865af19150503d8060008114610950576040519150601f19603f3d011682016040523d82523d6000602084013e610955565b606091505b5082600001836020018290528215151515815250505080516020840135176109cf577f08c379a000000000000000000000000000000000000000000000000000000000600052602060045260176024527f4d756c746963616c6c333a2063616c6c206661696c656400000000000000000060445260646000fd5b8160010191505061087e565b50505092915050565b600045905090565b600041905090565b606060008383905090508067ffffffffffffffff811115610a1857610a176112fa565b5b604051908082528060200260200182016040528015610a5157816020015b610a3e610bd5565b815260200190600190039081610a365790505b5091503660005b82811015610b9c576000848281518110610a7557610a74611329565b5b60200260200101519050868683818110610a9257610a91611329565b5b9050602002810190610aa491906114c7565b9250826000016020810190610ab991906111a7565b73ffffffffffffffffffffffffffffffffffffffff16838060200190610adf919061138f565b604051610aed929190611431565b6000604051808303816000865af19150503d8060008114610b2a576040519150601f19603f3d011682016040523d82523d6000602084013e610b2f565b606091505b508260000183602001829052821515151581525050508715610b90578060000151610b8f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b869061153b565b60405180910390fd5b5b81600101915050610a58565b5050509392505050565b6000806060610bb7600186866107bf565b8093508194508295505050509250925092565b600081409050919050565b6040518060400160405280600015158152602001606081525090565b6000819050919050565b610c0481610bf1565b82525050565b6000602082019050610c1f6000830184610bfb565b92915050565b600080fd5b600080fd5b600080fd5b600080fd5b600080fd5b60008083601f840112610c5457610c53610c2f565b5b8235905067ffffffffffffffff811115610c7157610c70610c34565b5b602083019150836020820283011115610c8d57610c8c610c39565b5b9250929050565b60008060208385031215610cab57610caa610c25565b5b600083013567ffffffffffffffff811115610cc957610cc8610c2a565b5b610cd585828601610c3e565b92509250509250929050565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b60008115159050919050565b610d2281610d0d565b82525050565b600081519050919050565b600082825260208201905092915050565b60005b83811015610d62578082015181840152602081019050610d47565b83811115610d71576000848401525b50505050565b6000601f19601f8301169050919050565b6000610d9382610d28565b610d9d8185610d33565b9350610dad818560208601610d44565b610db681610d77565b840191505092915050565b6000604083016000830151610dd96000860182610d19565b5060208301518482036020860152610df18282610d88565b9150508091505092915050565b6000610e0a8383610dc1565b905092915050565b6000602082019050919050565b6000610e2a82610ce1565b610e348185610cec565b935083602082028501610e4685610cfd565b8060005b85811015610e825784840389528151610e638582610dfe565b9450610e6e83610e12565b925060208a01995050600181019050610e4a565b50829750879550505050505092915050565b60006020820190508181036000830152610eae8184610e1f565b905092915050565b60008083601f840112610ecc57610ecb610c2f565b5b8235905067ffffffffffffffff811115610ee957610ee8610c34565b5b602083019150836020820283011115610f0557610f04610c39565b5b9250929050565b60008060208385031215610f2357610f22610c25565b5b600083013567ffffffffffffffff811115610f4157610f40610c2a565b5b610f4d85828601610eb6565b92509250509250929050565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b6000610f918383610d88565b905092915050565b6000602082019050919050565b6000610fb182610f59565b610fbb8185610f64565b935083602082028501610fcd85610f75565b8060005b858110156110095784840389528151610fea8582610f85565b9450610ff583610f99565b925060208a01995050600181019050610fd1565b50829750879550505050505092915050565b60006040820190506110306000830185610bfb565b81810360208301526110428184610fa6565b90509392505050565b6000819050919050565b61105e8161104b565b82525050565b60006020820190506110796000830184611055565b92915050565b61108881610d0d565b811461109357600080fd5b50565b6000813590506110a58161107f565b92915050565b6000806000604084860312156110c4576110c3610c25565b5b60006110d286828701611096565b935050602084013567ffffffffffffffff8111156110f3576110f2610c2a565b5b6110ff86828701610eb6565b92509250509250925092565b60006060820190506111206000830186610bfb565b61112d6020830185611055565b818103604083015261113f8184610e1f565b9050949350505050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b600061117482611149565b9050919050565b61118481611169565b811461118f57600080fd5b50565b6000813590506111a18161117b565b92915050565b6000602082840312156111bd576111bc610c25565b5b60006111cb84828501611192565b91505092915050565b60008083601f8401126111ea576111e9610c2f565b5b8235905067ffffffffffffffff81111561120757611206610c34565b5b60208301915083602082028301111561122357611222610c39565b5b9250929050565b6000806020838503121561124157611240610c25565b5b600083013567ffffffffffffffff81111561125f5761125e610c2a565b5b61126b858286016111d4565b92509250509250929050565b61128081611169565b82525050565b600060208201905061129b6000830184611277565b92915050565b6112aa81610bf1565b81146112b557600080fd5b50565b6000813590506112c7816112a1565b92915050565b6000602082840312156112e3576112e2610c25565b5b60006112f1848285016112b8565b91505092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b600080fd5b600080fd5b600080fd5b60008235600160800383360303811261138357611382611358565b5b80830191505092915050565b600080833560016020038436030381126113ac576113ab611358565b5b80840192508235915067ffffffffffffffff8211156113ce576113cd61135d565b5b6020830192506001820236038313156113ea576113e9611362565b5b509250929050565b600081905092915050565b82818337600083830152505050565b600061141883856113f2565b93506114258385846113fd565b82840190509392505050565b600061143e82848661140c565b91508190509392505050565b600082825260208201905092915050565b7f4d756c746963616c6c333a2076616c7565206d69736d61746368000000000000600082015250565b6000611491601a8361144a565b915061149c8261145b565b602082019050919050565b600060208201905081810360008301526114c081611484565b9050919050565b6000823560016040038336030381126114e3576114e2611358565b5b80830191505092915050565b7f4d756c746963616c6c333a2063616c6c206661696c6564000000000000000000600082015250565b600061152560178361144a565b9150611530826114ef565b602082019050919050565b6000602082019050818103600083015261155481611518565b9050919050565b60008235600160600383360303811261157757611576611358565b5b8083019150509291505056fea264697066735822122020c1bc9aacf8e4a6507193432a895a8e77094f45a1395583f07b24e860ef06cd64736f6c634300080c0033";class ja extends V{constructor({blockNumber:t,chain:n,contract:r}){super(`Chain "${n.name}" does not support contract "${r.name}".`,{metaMessages:["This could be due to any of the following:",...t&&r.blockCreated&&r.blockCreated>t?[`- The contract "${r.name}" was not deployed until block ${r.blockCreated} (current block ${t}).`]:[`- The chain does not have the contract "${r.name}" configured.`]],name:"ChainDoesNotSupportContract"})}}class hd extends V{constructor(){super("No chain was provided to the Client.",{name:"ClientChainNotConfiguredError"})}}const za="/docs/contract/encodeDeployData";function Ua(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 n1({docsPath:za});if(!("inputs"in o))throw new Eu({docsPath:za});if(!o.inputs||o.inputs.length===0)throw new Eu({docsPath:za});const s=On(o.inputs,n);return Sr([r,s])}function Dr({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 ja({chain:t,contract:{name:n}});if(e&&r.blockCreated&&r.blockCreated>e)throw new ja({blockNumber:e,chain:t,contract:{name:n,blockCreated:r.blockCreated}});return r.address}function md(e,{docsPath:t,...n}){const r=(()=>{const o=Os(e,n);return o instanceof Bo?e:o})();return new ff(r,{docsPath:t,...n})}function bd(){let e=()=>{},t=()=>{};return{promise:new Promise((r,o)=>{e=r,t=o}),resolve:e,reject:t}}const Wa=new Map;function gd({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=()=>Wa.delete(t),l=()=>a().map(({args:u})=>u),a=()=>Wa.get(t)||[],c=u=>Wa.set(t,[...a(),u]);return{flush:i,async schedule(u){const{promise:f,resolve:p,reject:d}=bd();return(n==null?void 0:n([...l(),u]))&&s(),a().length>0?(c({args:u,resolve:p,reject:d}),f):(c({args:u,resolve:p,reject:d}),setTimeout(s,r),f)}}}async function Br(e,t){var A,k,y,O;const{account:n=e.account,authorizationList:r,batch:o=!!((A=e.batch)!=null&&A.multicall),blockNumber:s,blockTag:i=e.experimental_blockTag??"latest",accessList:l,blobs:a,blockOverrides:c,code:u,data:f,factory:p,factoryData:d,gas:h,gasPrice:b,maxFeePerBlobGas:v,maxFeePerGas:P,maxPriorityFeePerGas:x,nonce:E,to:N,value:D,stateOverride:F,...L}=t,m=n?ft(n):void 0;if(u&&(p||d))throw new V("Cannot provide both `code` & `factory`/`factoryData` as parameters.");if(u&&N)throw new V("Cannot provide both `code` & `to` as parameters.");const w=u&&f,S=p&&d&&N&&f,$=w||S,I=w?yd({code:u,data:f}):S?av({data:f,factory:p,factoryData:d,to:N}):f;try{Or(t);const T=(typeof s=="bigint"?re(s):void 0)||i,B=c?id(c):void 0,R=ya(F),z=(O=(y=(k=e.chain)==null?void 0:k.formatters)==null?void 0:y.transactionRequest)==null?void 0:O.format,G=(z||Lo)({...Is(L,{format:z}),accessList:l,account:m,authorizationList:r,blobs:a,data:I,gas:h,gasPrice:b,maxFeePerBlobGas:v,maxFeePerGas:P,maxPriorityFeePerGas:x,nonce:E,to:$?void 0:N,value:D},"call");if(o&&sv({request:G})&&!R&&!B)try{return await iv(e,{...G,blockNumber:s,blockTag:i})}catch(_){if(!(_ instanceof hd)&&!(_ instanceof ja))throw _}const J=(()=>{const _=[G,T];return R&&B?[..._,R,B]:R?[..._,R]:B?[..._,{},B]:_})(),K=await e.request({method:"eth_call",params:J});return K==="0x"?{data:void 0}:{data:K}}catch(M){const T=lv(M),{offchainLookup:B,offchainLookupSignature:R}=await Promise.resolve().then(()=>aw);if(e.ccipRead!==!1&&(T==null?void 0:T.slice(0,10))===R&&N)return{data:await B(e,{data:T,to:N})};throw $&&(T==null?void 0:T.slice(0,10))==="0x101bb98d"?new Rg({factory:p}):md(M,{...t,account:m,chain:e.chain})}}function sv({request:e}){const{data:t,to:n,...r}=e;return!(!t||t.startsWith(nv)||!n||Object.values(r).filter(o=>typeof o<"u").length>0)}async function iv(e,t){var b;const{batchSize:n=1024,deployless:r=!1,wait:o=0}=typeof((b=e.batch)==null?void 0:b.multicall)=="object"?e.batch.multicall:{},{blockNumber:s,blockTag:i=e.experimental_blockTag??"latest",data:l,to:a}=t,c=(()=>{if(r)return null;if(t.multicallAddress)return t.multicallAddress;if(e.chain)return Dr({blockNumber:s,chain:e.chain,contract:"multicall3"});throw new hd})(),f=(typeof s=="bigint"?re(s):void 0)||i,{schedule:p}=gd({id:`${e.uid}.${f}`,wait:o,shouldSplitBatch(v){return v.reduce((x,{data:E})=>x+(E.length-2),0)>n*2},fn:async v=>{const P=v.map(N=>({allowFailure:!0,callData:N.data,target:N.to})),x=vt({abi:kr,args:[P],functionName:"aggregate3"}),E=await e.request({method:"eth_call",params:[{...c===null?{data:yd({code:Ra,data:x})}:{to:c,data:x}},f]});return Mn({abi:kr,args:[P],functionName:"aggregate3",data:E||"0x"})}}),[{returnData:d,success:h}]=await p({data:l,to:a});if(!h)throw new As({data:d});return d==="0x"?{data:void 0}:{data:d}}function yd(e){const{code:t,data:n}=e;return Ua({abi:gu(["constructor(bytes, bytes)"]),bytecode:pd,args:[t,n]})}function av(e){const{data:t,factory:n,factoryData:r,to:o}=e;return Ua({abi:gu(["constructor(address, bytes, address, bytes)"]),bytecode:rv,args:[o,t,n,r]})}function lv(e){var n;if(!(e instanceof V))return;const t=e.walk();return typeof(t==null?void 0:t.data)=="object"?(n=t.data)==null?void 0:n.data:t.data}async function jt(e,t){const{abi:n,address:r,args:o,functionName:s,...i}=t,l=vt({abi:n,args:o,functionName:s});try{const{data:a}=await te(e,Br,"call")({...i,data:l,to:r});return Mn({abi:n,args:o,functionName:s,data:a||"0x"})}catch(a){throw Nr(a,{abi:n,address:r,args:o,docsPath:"/docs/contract/readContract",functionName:s})}}async function cv(e,t){var u;const{abi:n,address:r,args:o,functionName:s,dataSuffix:i=typeof e.dataSuffix=="string"?e.dataSuffix:(u=e.dataSuffix)==null?void 0:u.value,...l}=t,a=l.account?ft(l.account):e.account,c=vt({abi:n,args:o,functionName:s});try{const{data:f}=await te(e,Br,"call")({batch:!1,data:`${c}${i?i.replace("0x",""):""}`,to:r,...l,account:a}),p=Mn({abi:n,args:o,functionName:s,data:f||"0x"}),d=n.filter(h=>"name"in h&&h.name===t.functionName);return{result:p,request:{abi:d,address:r,args:o,dataSuffix:i,functionName:s,...l,account:a}}}catch(f){throw Nr(f,{abi:n,address:r,args:o,docsPath:"/docs/contract/simulateContract",functionName:s,sender:a==null?void 0:a.address})}}const _a=new Map,vd=new Map;let uv=0;function Dn(e,t,n){const r=++uv,o=()=>_a.get(e)||[],s=()=>{const u=o();_a.set(e,u.filter(f=>f.id!==r))},i=()=>{const u=o();if(!u.some(p=>p.id===r))return;const f=vd.get(e);if(u.length===1&&f){const p=f();p instanceof Promise&&p.catch(()=>{})}s()},l=o();if(_a.set(e,[...l,{id:r,fns:t}]),l&&l.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 b of p)(h=(d=b.fns)[u])==null||h.call(d,...f)};const c=n(a);return typeof c=="function"&&vd.set(e,c),i}async function Va(e){return new Promise(t=>setTimeout(t,e))}function _o(e,{emitOnBegin:t,initialWaitTime:n,interval:r}){let o=!0;const s=()=>o=!1;return(async()=>{let l;t&&(l=await e({unpoll:s}));const a=await(n==null?void 0:n(l))??r;await Va(a);const c=async()=>{o&&(await e({unpoll:s}),await Va(r),c())};c()})(),s}const fv=new Map,dv=new Map;function pv(e){const t=(o,s)=>({clear:()=>s.delete(o),get:()=>s.get(o),set:i=>s.set(o,i)}),n=t(e,fv),r=t(e,dv);return{clear:()=>{n.clear(),r.clear()},promise:n,response:r}}async function hv(e,{cacheKey:t,cacheTime:n=Number.POSITIVE_INFINITY}){const r=pv(t),o=r.response.get();if(o&&n>0&&Date.now()-o.created.getTime()<n)return o.data;let s=r.promise.get();s||(s=e(),r.promise.set(s));try{const i=await s;return r.response.set({created:new Date,data:i}),i}finally{r.promise.clear()}}const mv=e=>`blockNumber.${e}`;async function Vo(e,{cacheTime:t=e.cacheTime}={}){const n=await hv(()=>e.request({method:"eth_blockNumber"}),{cacheKey:mv(e.uid),cacheTime:t});return BigInt(n)}async function Rs(e,{filter:t}){const n="strict"in t&&t.strict,r=await t.request({method:"eth_getFilterChanges",params:[t.id]});if(typeof r[0]=="string")return r;const o=r.map(s=>Zt(s));return!("abi"in t)||!t.abi?o:Na({abi:t.abi,logs:o,strict:n})}async function js(e,{filter:t}){return t.request({method:"eth_uninstallFilter",params:[t.id]})}function bv(e,t){const{abi:n,address:r,args:o,batch:s=!0,eventName:i,fromBlock:l,onError:a,onLogs:c,poll:u,pollingInterval:f=e.pollingInterval,strict:p}=t;return(typeof u<"u"?u:typeof l=="bigint"?!0:!(e.transport.type==="webSocket"||e.transport.type==="ipc"||e.transport.type==="fallback"&&(e.transport.transports[0].config.type==="webSocket"||e.transport.transports[0].config.type==="ipc")))?(()=>{const v=p??!1,P=Me(["watchContractEvent",r,o,s,e.uid,i,f,v,l]);return Dn(P,{onLogs:c,onError:a},x=>{let E;l!==void 0&&(E=l-1n);let N,D=!1;const F=_o(async()=>{var L;if(!D){try{N=await te(e,Qu,"createContractEventFilter")({abi:n,address:r,args:o,eventName:i,strict:v,fromBlock:l})}catch{}D=!0;return}try{let m;if(N)m=await te(e,Rs,"getFilterChanges")({filter:N});else{const w=await te(e,Vo,"getBlockNumber")({});E&&E<w?m=await te(e,Rf,"getContractEvents")({abi:n,address:r,args:o,eventName:i,fromBlock:E+1n,toBlock:w,strict:v}):m=[],E=w}if(m.length===0)return;if(s)x.onLogs(m);else for(const w of m)x.onLogs([w])}catch(m){N&&m instanceof In&&(D=!1),(L=x.onError)==null||L.call(x,m)}},{emitOnBegin:!0,interval:f});return async()=>{N&&await te(e,js,"uninstallFilter")({filter:N}),F()}})})():(()=>{const v=p??!1,P=Me(["watchContractEvent",r,o,s,e.uid,i,f,v]);let x=!0,E=()=>x=!1;return Dn(P,{onLogs:c,onError:a},N=>((async()=>{try{const D=(()=>{if(e.transport.type==="fallback"){const m=e.transport.transports.find(w=>w.config.type==="webSocket"||w.config.type==="ipc");return m?m.value:e.transport}return e.transport})(),F=i?lo({abi:n,eventName:i,args:o}):[],{unsubscribe:L}=await D.subscribe({params:["logs",{address:r,topics:F}],onData(m){var S;if(!x)return;const w=m.result;try{const{eventName:$,args:I}=$s({abi:n,data:w.data,topics:w.topics,strict:p}),A=Zt(w,{args:I,eventName:$});N.onLogs([A])}catch($){let I,A;if($ instanceof vs||$ instanceof qi){if(p)return;I=$.abiItem.name,A=(S=$.abiItem.inputs)==null?void 0:S.some(y=>!("name"in y&&y.name))}const k=Zt(w,{args:A?[]:{},eventName:I});N.onLogs([k])}},onError(m){var w;(w=N.onError)==null||w.call(N,m)}});E=L,x||E()}catch(D){a==null||a(D)}})(),()=>E()))})()}async function gv(e,{serializedTransaction:t}){return e.request({method:"eth_sendRawTransaction",params:[t]},{retryCount:0})}function Ha(e,{delay:t=100,retryCount:n=2,shouldRetry:r=()=>!0}={}){return new Promise((o,s)=>{const i=async({count:l=0}={})=>{const a=async({error:c})=>{const u=typeof t=="function"?t({count:l,error:c}):t;u&&await Va(u),i({count:l+1})};try{const c=await e();o(c)}catch(c){if(l<n&&await r({count:l,error:c}))return a({error:c});s(c)}};i()})}const yv={"0x0":"reverted","0x1":"success"};function wd(e,t){const n={...e,blockNumber:e.blockNumber?BigInt(e.blockNumber):null,contractAddress:e.contractAddress?e.contractAddress:null,cumulativeGasUsed:e.cumulativeGasUsed?BigInt(e.cumulativeGasUsed):null,effectiveGasPrice:e.effectiveGasPrice?BigInt(e.effectiveGasPrice):null,gasUsed:e.gasUsed?BigInt(e.gasUsed):null,logs:e.logs?e.logs.map(r=>Zt(r)):null,to:e.to?e.to:null,transactionIndex:e.transactionIndex?ln(e.transactionIndex):null,status:e.status?yv[e.status]:null,type:e.type?Sf[e.type]||e.type:null};return e.blobGasPrice&&(n.blobGasPrice=BigInt(e.blobGasPrice)),e.blobGasUsed&&(n.blobGasUsed=BigInt(e.blobGasUsed)),n}const Ga=256;let zs=Ga,Us;function xd(e=11){if(!Us||zs+e>Ga*2){Us="",zs=0;for(let t=0;t<Ga;t++)Us+=(256+Math.random()*256|0).toString(16).substring(1)}return Us.substring(zs,zs+++e)}function vv(e){const{batch:t,chain:n,ccipRead:r,dataSuffix:o,key:s="base",name:i="Base Client",type:l="base"}=e,a=e.experimental_blockTag??(typeof(n==null?void 0:n.experimental_preconfirmationTime)=="number"?"pending":void 0),c=(n==null?void 0:n.blockTime)??12e3,u=Math.min(Math.max(Math.floor(c/2),500),4e3),f=e.pollingInterval??u,p=e.cacheTime??f,d=e.account?ft(e.account):void 0,{config:h,request:b,value:v}=e.transport({account:d,chain:n,pollingInterval:f}),P={...h,...v},x={account:d,batch:t,cacheTime:p,ccipRead:r,chain:n,dataSuffix:o,key:s,name:i,pollingInterval:f,request:b,transport:P,type:l,uid:xd(),...a?{experimental_blockTag:a}:{}};function E(N){return D=>{const F=D(N);for(const m in x)delete F[m];const L={...N,...F};return Object.assign(L,{extend:E(L)})}}return Object.assign(x,{extend:E(x)})}function qa(e){var n,r,o,s,i,l;if(!(e instanceof V))return!1;const t=e.walk(a=>a instanceof la);return t instanceof la?((n=t.data)==null?void 0:n.errorName)==="HttpError"||((r=t.data)==null?void 0:r.errorName)==="ResolverError"||((o=t.data)==null?void 0:o.errorName)==="ResolverNotContract"||((s=t.data)==null?void 0:s.errorName)==="ResolverNotFound"||((i=t.data)==null?void 0:i.errorName)==="ReverseAddressMismatch"||((l=t.data)==null?void 0:l.errorName)==="UnsupportedResolverProfile":!1}function wv(e){const{abi:t,data:n}=e,r=Zn(n,0,4),o=t.find(s=>s.type==="function"&&r===ao(kt(s)));if(!o)throw new c1(r,{docsPath:"/docs/contract/decodeFunctionData"});return{functionName:o.name,args:"inputs"in o&&o.inputs&&o.inputs.length>0?co(o.inputs,Zn(n,4)):void 0}}const Ka="/docs/contract/encodeErrorResult";function Ed(e){const{abi:t,errorName:n,args:r}=e;let o=t[0];if(n){const a=Yn({abi:t,args:r,name:n});if(!a)throw new Pu(n,{docsPath:Ka});o=a}if(o.type!=="error")throw new Pu(void 0,{docsPath:Ka});const s=kt(o),i=ao(s);let l="0x";if(r&&r.length>0){if(!o.inputs)throw new i1(o.name,{docsPath:Ka});l=On(o.inputs,r)}return Sr([i,l])}const Za="/docs/contract/encodeFunctionResult";function xv(e){const{abi:t,functionName:n,result:r}=e;let o=t[0];if(n){const i=Yn({abi:t,name:n});if(!i)throw new gr(n,{docsPath:Za});o=i}if(o.type!=="function")throw new gr(void 0,{docsPath:Za});if(!o.outputs)throw new Nu(o.name,{docsPath:Za});const s=(()=>{if(o.outputs.length===0)return[];if(o.outputs.length===1)return[r];if(Array.isArray(r))return r;throw new Cu(r)})();return On(o.outputs,s)}const Ho="x-batch-gateway:true";async function Sd(e){const{data:t,ccipRequest:n}=e,{args:[r]}=wv({abi:Fa,data:t}),o=[],s=[];return await Promise.all(r.map(async(i,l)=>{try{s[l]=i.urls.includes(Ho)?await Sd({data:i.data,ccipRequest:n}):await n(i),o[l]=!1}catch(a){o[l]=!0,s[l]=Ev(a)}})),xv({abi:Fa,functionName:"query",result:[o,s]})}function Ev(e){return e.name==="HttpRequestError"&&e.status?Ed({abi:Fa,errorName:"HttpError",args:[e.status,e.shortMessage]}):Ed({abi:[tf],errorName:"Error",args:["shortMessage"in e?e.shortMessage:e.message]})}function Pd(e){if(e.length!==66||e.indexOf("[")!==0||e.indexOf("]")!==65)return null;const t=`0x${e.slice(1,65)}`;return Mt(t)?t:null}function Ya(e){let t=new Uint8Array(32).fill(0);if(!e)return ke(t);const n=e.split(".");for(let r=n.length-1;r>=0;r-=1){const o=Pd(n[r]),s=o?vr(o):je(qn(n[r]),"bytes");t=je(Bt([t,s]),"bytes")}return ke(t)}function Sv(e){return`[${e.slice(2)}]`}function Pv(e){const t=new Uint8Array(32).fill(0);return e?Pd(e)||je(qn(e)):ke(t)}function Xa(e){const t=e.replace(/^\.|\.$/gm,"");if(t.length===0)return new Uint8Array(1);const n=new Uint8Array(qn(t).byteLength+2);let r=0;const o=t.split(".");for(let s=0;s<o.length;s++){let i=qn(o[s]);i.byteLength>255&&(i=qn(Sv(Pv(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 Tv(e,t){const{blockNumber:n,blockTag:r,coinType:o,name:s,gatewayUrls:i,strict:l}=t,{chain:a}=e,c=(()=>{if(t.universalResolverAddress)return t.universalResolverAddress;if(!a)throw new Error("client chain not configured. universalResolverAddress is required.");return Dr({blockNumber:n,chain:a,contract:"ensUniversalResolver"})})(),u=a==null?void 0:a.ensTlds;if(u&&!u.some(p=>s.endsWith(p)))return null;const f=o!=null?[Ya(s),BigInt(o)]:[Ya(s)];try{const p=vt({abi:ud,functionName:"addr",args:f}),d={address:c,abi:ld,functionName:"resolveWithGateways",args:[Nn(Xa(s)),p,i??[Ho]],blockNumber:n,blockTag:r},b=await te(e,jt,"readContract")(d);if(b[0]==="0x")return null;const v=Mn({abi:ud,args:f,functionName:"addr",data:b[0]});return v==="0x"||Gn(v)==="0x00"?null:v}catch(p){if(l)throw p;if(qa(p))return null;throw p}}class Av extends V{constructor({data:t}){super("Unable to extract image from metadata. The metadata may be malformed or invalid.",{metaMessages:["- Metadata must be a JSON object with at least an `image`, `image_url` or `image_data` property.","",`Provided data: ${JSON.stringify(t)}`],name:"EnsAvatarInvalidMetadataError"})}}class Go extends V{constructor({reason:t}){super(`ENS NFT avatar URI is invalid. ${t}`,{name:"EnsAvatarInvalidNftUriError"})}}class Ja extends V{constructor({uri:t}){super(`Unable to resolve ENS avatar URI "${t}". The URI may be malformed, invalid, or does not respond with a valid image.`,{name:"EnsAvatarUriResolutionError"})}}class Nv extends V{constructor({namespace:t}){super(`ENS NFT avatar namespace "${t}" is not supported. Must be "erc721" or "erc1155".`,{name:"EnsAvatarUnsupportedNamespaceError"})}}const Cv=/(?<protocol>https?:\/\/[^/]*|ipfs:\/|ipns:\/|ar:\/)?(?<root>\/)?(?<subpath>ipfs\/|ipns\/)?(?<target>[\w\-.]+)(?<subtarget>\/.*)?/,Ov=/^(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>\/.*)?$/,Iv=/^data:([a-zA-Z\-/+]*);base64,([^"].*)/,$v=/^data:([a-zA-Z\-/+]*)?(;[a-zA-Z0-9].*?)?(,)/;async function kv(e){try{const t=await fetch(e,{method:"HEAD"});if(t.status===200){const n=t.headers.get("content-type");return n==null?void 0:n.startsWith("image/")}return!1}catch(t){return typeof t=="object"&&typeof t.response<"u"||!Object.hasOwn(globalThis,"Image")?!1:new Promise(n=>{const r=new Image;r.onload=()=>{n(!0)},r.onerror=()=>{n(!1)},r.src=e})}}function Td(e,t){return e?e.endsWith("/")?e.slice(0,-1):e:t}function Ad({uri:e,gatewayUrls:t}){const n=Iv.test(e);if(n)return{uri:e,isOnChain:!0,isEncoded:n};const r=Td(t==null?void 0:t.ipfs,"https://ipfs.io"),o=Td(t==null?void 0:t.arweave,"https://arweave.net"),s=e.match(Cv),{protocol:i,subpath:l,target:a,subtarget:c=""}=(s==null?void 0:s.groups)||{},u=i==="ipns:/"||l==="ipns/",f=i==="ipfs:/"||l==="ipfs/"||Ov.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}${c}`,isOnChain:!1,isEncoded:!1};if(i==="ar:/"&&a)return{uri:`${o}/${a}${c||""}`,isOnChain:!1,isEncoded:!1};let p=e.replace($v,"");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 Ja({uri:e})}function Nd(e){if(typeof e!="object"||!("image"in e)&&!("image_url"in e)&&!("image_data"in e))throw new Av({data:e});return e.image||e.image_url||e.image_data}async function Mv({gatewayUrls:e,uri:t}){try{const n=await fetch(t).then(o=>o.json());return await Qa({gatewayUrls:e,uri:Nd(n)})}catch{throw new Ja({uri:t})}}async function Qa({gatewayUrls:e,uri:t}){const{uri:n,isOnChain:r}=Ad({uri:t,gatewayUrls:e});if(r||await kv(n))return n;throw new Ja({uri:t})}function Dv(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(":"),[l,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(!l)throw new Go({reason:"ERC namespace not found"});return{chainID:Number.parseInt(i,10),namespace:l.toLowerCase(),contractAddress:a,tokenID:o}}async function Bv(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 Nv({namespace:t.namespace})}async function Lv(e,{gatewayUrls:t,record:n}){return/eip155:/i.test(n)?Fv(e,{gatewayUrls:t,record:n}):Qa({uri:n,gatewayUrls:t})}async function Fv(e,{gatewayUrls:t,record:n}){const r=Dv(n),o=await Bv(e,{nft:r}),{uri:s,isOnChain:i,isEncoded:l}=Ad({uri:o,gatewayUrls:t});if(i&&(s.includes("data:application/json;base64,")||s.startsWith("{"))){const c=l?atob(s.replace("data:application/json;base64,","")):s,u=JSON.parse(c);return Qa({uri:Nd(u),gatewayUrls:t})}let a=r.tokenID;return r.namespace==="erc1155"&&(a=a.replace("0x","").padStart(64,"0")),Mv({gatewayUrls:t,uri:s.replace(/(?:0x)?{id}/,a)})}async function Cd(e,t){const{blockNumber:n,blockTag:r,key:o,name:s,gatewayUrls:i,strict:l}=t,{chain:a}=e,c=(()=>{if(t.universalResolverAddress)return t.universalResolverAddress;if(!a)throw new Error("client chain not configured. universalResolverAddress is required.");return Dr({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:c,abi:ld,args:[Nn(Xa(s)),vt({abi:cd,functionName:"text",args:[Ya(s),o]}),i??[Ho]],functionName:"resolveWithGateways",blockNumber:n,blockTag:r},d=await te(e,jt,"readContract")(f);if(d[0]==="0x")return null;const h=Mn({abi:cd,functionName:"text",data:d[0]});return h===""?null:h}catch(f){if(l)throw f;if(qa(f))return null;throw f}}async function Rv(e,{blockNumber:t,blockTag:n,assetGatewayUrls:r,name:o,gatewayUrls:s,strict:i,universalResolverAddress:l}){const a=await te(e,Cd,"getEnsText")({blockNumber:t,blockTag:n,key:"avatar",name:o,universalResolverAddress:l,gatewayUrls:s,strict:i});if(!a)return null;try{return await Lv(e,{record:a,gatewayUrls:r})}catch{return null}}async function jv(e,t){const{address:n,blockNumber:r,blockTag:o,coinType:s=60n,gatewayUrls:i,strict:l}=t,{chain:a}=e,c=(()=>{if(t.universalResolverAddress)return t.universalResolverAddress;if(!a)throw new Error("client chain not configured. universalResolverAddress is required.");return Dr({blockNumber:r,chain:a,contract:"ensUniversalResolver"})})();try{const u={address:c,abi:tv,args:[n,s,i??[Ho]],functionName:"reverseWithGateways",blockNumber:r,blockTag:o},f=te(e,jt,"readContract"),[p]=await f(u);return p||null}catch(u){if(l)throw u;if(qa(u))return null;throw u}}async function zv(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 Dr({blockNumber:n,chain:s,contract:"ensUniversalResolver"})})(),l=s==null?void 0:s.ensTlds;if(l&&!l.some(c=>o.endsWith(c)))throw new Error(`${o} is not a valid ENS TLD (${l==null?void 0:l.join(", ")}) for chain "${s.name}" (id: ${s.id}).`);const[a]=await te(e,jt,"readContract")({address:i,abi:[{inputs:[{type:"bytes"}],name:"findResolver",outputs:[{type:"address"},{type:"bytes32"},{type:"uint256"}],stateMutability:"view",type:"function"}],functionName:"findResolver",args:[Nn(Xa(o))],blockNumber:n,blockTag:r});return a}async function Od(e,t){var v,P,x;const{account:n=e.account,blockNumber:r,blockTag:o="latest",blobs:s,data:i,gas:l,gasPrice:a,maxFeePerBlobGas:c,maxFeePerGas:u,maxPriorityFeePerGas:f,to:p,value:d,...h}=t,b=n?ft(n):void 0;try{Or(t);const N=(typeof r=="bigint"?re(r):void 0)||o,D=(x=(P=(v=e.chain)==null?void 0:v.formatters)==null?void 0:P.transactionRequest)==null?void 0:x.format,L=(D||Lo)({...Is(h,{format:D}),account:b,blobs:s,data:i,gas:l,gasPrice:a,maxFeePerBlobGas:c,maxFeePerGas:u,maxPriorityFeePerGas:f,to:p,value:d},"createAccessList"),m=await e.request({method:"eth_createAccessList",params:[L,N]});return{accessList:m.accessList,gasUsed:BigInt(m.gasUsed)}}catch(E){throw md(E,{...t,account:b,chain:e.chain})}}async function Uv(e){const t=Ts(e,{method:"eth_newBlockFilter"}),n=await e.request({method:"eth_newBlockFilter"});return{id:n,request:t(n),type:"block"}}async function Id(e,{address:t,args:n,event:r,events:o,fromBlock:s,strict:i,toBlock:l}={}){const a=o??(r?[r]:void 0),c=Ts(e,{method:"eth_newFilter"});let u=[];a&&(u=[a.flatMap(d=>lo({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"?re(s):s,toBlock:typeof l=="bigint"?re(l):l,...u.length?{topics:u}:{}}]});return{abi:a,args:n,eventName:r?r.name:void 0,fromBlock:s,id:f,request:c(f),strict:!!i,toBlock:l,type:"event"}}async function $d(e){const t=Ts(e,{method:"eth_newPendingTransactionFilter"}),n=await e.request({method:"eth_newPendingTransactionFilter"});return{id:n,request:t(n),type:"transaction"}}async function Wv(e,{address:t,blockNumber:n,blockTag:r=e.experimental_blockTag??"latest"}){var i,l,a;if((i=e.batch)!=null&&i.multicall&&((a=(l=e.chain)==null?void 0:l.contracts)!=null&&a.multicall3)){const c=e.chain.contracts.multicall3.address,u=vt({abi:kr,functionName:"getEthBalance",args:[t]}),{data:f}=await te(e,Br,"call")({to:c,data:u,blockNumber:n,blockTag:r});return Mn({abi:kr,functionName:"getEthBalance",args:[t],data:f||"0x"})}const o=typeof n=="bigint"?re(n):void 0,s=await e.request({method:"eth_getBalance",params:[t,o||r]});return BigInt(s)}async function _v(e){const t=await e.request({method:"eth_blobBaseFee"});return BigInt(t)}async function Vv(e,{blockHash:t,blockNumber:n,blockTag:r="latest"}={}){const o=n!==void 0?re(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}),ln(s)}async function Ws(e,{address:t,blockNumber:n,blockTag:r="latest"}){const o=n!==void 0?re(n):void 0,s=await e.request({method:"eth_getCode",params:[t,o||r]},{dedupe:!!o});if(s!=="0x")return s}async function Hv(e,{address:t,blockNumber:n,blockTag:r="latest"}){const o=await Ws(e,{address:t,...n!==void 0?{blockNumber:n}:{blockTag:r}});if(o&&Te(o)===23&&o.startsWith("0xef0100"))return un(Zn(o,3,23))}class Gv extends V{constructor({address:t}){super(`No EIP-712 domain found on contract "${t}".`,{metaMessages:["Ensure that:",`- The contract is deployed at the address "${t}".`,"- `eip712Domain()` function exists on the contract.","- `eip712Domain()` function matches signature to ERC-5267 specification."],name:"Eip712DomainNotFoundError"})}}async function qv(e,t){const{address:n,factory:r,factoryData:o}=t;try{const[s,i,l,a,c,u,f]=await te(e,jt,"readContract")({abi:Kv,address:n,functionName:"eip712Domain",factory:r,factoryData:o});return{domain:{name:i,version:l,chainId:Number(a),verifyingContract:c,salt:u},extensions:f,fields:s}}catch(s){const i=s;throw i.name==="ContractFunctionExecutionError"&&i.cause.name==="ContractFunctionZeroDataError"?new Gv({address:n}):i}}const Kv=[{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 Zv(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 Yv(e,{blockCount:t,blockNumber:n,blockTag:r="latest",rewardPercentiles:o}){const s=typeof n=="bigint"?re(n):void 0,i=await e.request({method:"eth_feeHistory",params:[re(t),s||r,o]},{dedupe:!!s});return Zv(i)}async function Xv(e,{filter:t}){const n=t.strict??!1,o=(await t.request({method:"eth_getFilterLogs",params:[t.id]})).map(s=>Zt(s));return t.abi?Na({abi:t.abi,logs:o,strict:n}):o}async function Jv({address:e,authorization:t,signature:n}){return Fo(un(e),await yf({authorization:t,signature:n}))}const _s=new Ss(8192);function Qv(e,{enabled:t=!0,id:n}){if(!t||!n)return e();if(_s.get(n))return _s.get(n);const r=e().finally(()=>_s.delete(n));return _s.set(n,r),r}function ew(e,t={}){return async(n,r={})=>{var f;const{dedupe:o=!1,methods:s,retryDelay:i=150,retryCount:l=3,uid:a}={...t,...r},{method:c}=n;if((f=s==null?void 0:s.exclude)!=null&&f.includes(c))throw new Qn(new Error("method not supported"),{method:c});if(s!=null&&s.include&&!s.include.includes(c))throw new Qn(new Error("method not supported"),{method:c});const u=o?oo(`${a}.${Me(n)}`):void 0;return Qv(()=>Ha(async()=>{try{return await e(n)}catch(p){const d=p;switch(d.code){case ho.code:throw new ho(d);case mo.code:throw new mo(d);case bo.code:throw new bo(d,{method:n.method});case go.code:throw new go(d);case Jn.code:throw new Jn(d);case In.code:throw new In(d);case yo.code:throw new yo(d);case vo.code:throw new vo(d);case wo.code:throw new wo(d);case Qn.code:throw new Qn(d,{method:n.method});case Tr.code:throw new Tr(d);case xo.code:throw new xo(d);case Ar.code:throw new Ar(d);case Eo.code:throw new Eo(d);case So.code:throw new So(d);case Po.code:throw new Po(d);case To.code:throw new To(d);case Ao.code:throw new Ao(d);case No.code:throw new No(d);case Co.code:throw new Co(d);case Oo.code:throw new Oo(d);case Io.code:throw new Io(d);case $o.code:throw new $o(d);case ko.code:throw new ko(d);case Mo.code:throw new Mo(d);case 5e3:throw new Ar(d);case Do.code:throw new Do(d);default:throw p instanceof V?p:new zg(d)}}},{delay:({count:p,error:d})=>{var h;if(d&&d instanceof Xn){const b=(h=d==null?void 0:d.headers)==null?void 0:h.get("Retry-After");if(b!=null&&b.match(/\d/))return Number.parseInt(b,10)*1e3}return~~(1<<p)*i},retryCount:l,shouldRetry:({error:p})=>tw(p)}),{enabled:o,id:u})}}function tw(e){return"code"in e&&typeof e.code=="number"?e.code===-1||e.code===Tr.code||e.code===Jn.code:e instanceof Xn&&e.status?e.status===403||e.status===408||e.status===413||e.status===429||e.status===500||e.status===502||e.status===503||e.status===504:!0}class nw extends V{constructor({callbackSelector:t,cause:n,data:r,extraData:o,sender:s,urls:i}){var l;super(n.shortMessage||"An error occurred while fetching for an offchain result.",{cause:n,metaMessages:[...n.metaMessages||[],(l=n.metaMessages)!=null&&l.length?"":[],"Offchain Gateway Call:",i&&[" Gateway URL(s):",...i.map(a=>` ${po(a)}`)],` Sender: ${s}`,` Data: ${r}`,` Callback selector: ${t}`,` Extra data: ${o}`].flat(),name:"OffchainLookupError"})}}class rw extends V{constructor({result:t,url:n}){super("Offchain gateway response is malformed. Response data must be a hex value.",{metaMessages:[`Gateway URL: ${po(n)}`,`Response: ${Me(t)}`],name:"OffchainLookupResponseMalformedError"})}}class ow extends V{constructor({sender:t,to:n}){super("Reverted sender address does not match target contract address (`to`).",{metaMessages:[`Contract address: ${n}`,`OffchainLookup sender address: ${t}`],name:"OffchainLookupSenderMismatchError"})}}const sw="0x556f1830",kd={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 iw(e,{blockNumber:t,blockTag:n,data:r,to:o}){const{args:s}=sf({data:r,abi:[kd]}),[i,l,a,c,u]=s,{ccipRead:f}=e,p=f&&typeof(f==null?void 0:f.request)=="function"?f.request:Md;try{if(!Fo(o,i))throw new ow({sender:i,to:o});const d=l.includes(Ho)?await Sd({data:a,ccipRequest:p}):await p({data:a,sender:i,urls:l}),{data:h}=await Br(e,{blockNumber:t,blockTag:n,data:Bt([c,On([{type:"bytes"},{type:"bytes"}],[d,u])]),to:o});return h}catch(d){throw new nw({callbackSelector:c,cause:d,data:r,extraData:u,sender:i,urls:l})}}async function Md({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],l=i.includes("{data}")?"GET":"POST",a=l==="POST"?{data:e,sender:t}:void 0,c=l==="POST"?{"Content-Type":"application/json"}:{};try{const u=await fetch(i.replace("{sender}",t.toLowerCase()).replace("{data}",e),{body:JSON.stringify(a),headers:c,method:l});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 Xn({body:a,details:f!=null&&f.error?Me(f.error):u.statusText,headers:u.headers,status:u.status,url:i});continue}if(!Mt(f)){r=new rw({result:f,url:i});continue}return f}catch(u){r=new Xn({body:a,details:u.message,url:i})}}throw r}const aw=Object.freeze(Object.defineProperty({__proto__:null,ccipRequest:Md,offchainLookup:iw,offchainLookupAbiItem:kd,offchainLookupSignature:sw},Symbol.toStringTag,{value:"Module"}));function lw(e){const t={formatters:void 0,fees:void 0,serializers:void 0,...e};function n(r){return o=>{const s=typeof o=="function"?o(r):o,i={...r,...s};return Object.assign(i,{extend:n(i)})}}return Object.assign(t,{extend:n(t)})}function cw(e,{errorInstance:t=new Error("timed out"),timeout:n,signal:r}){return new Promise((o,s)=>{(async()=>{let i;try{const l=new AbortController;n>0&&(i=setTimeout(()=>{r&&l.abort()},n)),o(await e({signal:(l==null?void 0:l.signal)||null}))}catch(l){(l==null?void 0:l.name)==="AbortError"&&s(t),s(l)}finally{clearTimeout(i)}})()})}function uw(){return{current:0,take(){return this.current++},reset(){this.current=0}}}const Dd=uw();function fw(e,t={}){const{url:n,headers:r}=dw(e);return{async request(o){var h;const{body:s,fetchFn:i=t.fetchFn??fetch,onRequest:l=t.onRequest,onResponse:a=t.onResponse,timeout:c=t.timeout??1e4}=o,u={...t.fetchOptions??{},...o.fetchOptions??{}},{headers:f,method:p,signal:d}=u;try{const b=await cw(async({signal:P})=>{const x={...u,body:Array.isArray(s)?Me(s.map(F=>({jsonrpc:"2.0",id:F.id??Dd.take(),...F}))):Me({jsonrpc:"2.0",id:s.id??Dd.take(),...s}),headers:{...r,"Content-Type":"application/json",...f},method:p||"POST",signal:d||(c>0?P:null)},E=new Request(n,x),N=await(l==null?void 0:l(E,x))??{...x,url:n};return await i(N.url??n,N)},{errorInstance:new pf({body:s,url:n}),timeout:c,signal:!0});a&&await a(b);let v;if((h=b.headers.get("Content-Type"))!=null&&h.startsWith("application/json"))v=await b.json();else{v=await b.text();try{v=JSON.parse(v||"{}")}catch(P){if(b.ok)throw P;v={error:v}}}if(!b.ok)throw new Xn({body:s,details:Me(v.error)||b.statusText,headers:b.headers,status:b.status,url:n});return v}catch(b){throw b instanceof Xn||b instanceof pf?b:new Xn({body:s,cause:b,url:n})}}}}function dw(e){try{const t=new URL(e),n=(()=>{if(t.username){const r=`${decodeURIComponent(t.username)}:${decodeURIComponent(t.password)}`;return t.username="",t.password="",{url:t.toString(),headers:{Authorization:`Basic ${btoa(r)}`}}}})();return{url:t.toString(),...n}}catch{return{url:e}}}const pw=`Ethereum Signed Message:
89
+ `;function hw(e){const t=typeof e=="string"?oo(e):typeof e.raw=="string"?e.raw:ke(e.raw),n=oo(`${pw}${Te(t)}`);return Bt([n,t])}function Bd(e,t){return je(hw(e),t)}class mw extends V{constructor({domain:t}){super(`Invalid domain "${Me(t)}".`,{metaMessages:["Must be a valid EIP-712 domain."]})}}class bw extends V{constructor({primaryType:t,types:n}){super(`Invalid primary type \`${t}\` must be one of \`${JSON.stringify(Object.keys(n))}\`.`,{docsPath:"/api/glossary/Errors#typeddatainvalidprimarytypeerror",metaMessages:["Check that the primary type is a key in `types`."]})}}class gw extends V{constructor({type:t}){super(`Struct type "${t}" is invalid.`,{metaMessages:["Struct type must not be a Solidity type."],name:"InvalidStructTypeError"})}}function yw(e){const{domain:t,message:n,primaryType:r,types:o}=e,s=(i,l)=>{for(const a of i){const{name:c,type:u}=a,f=l[c],p=u.match(Zu);if(p&&(typeof f=="number"||typeof f=="bigint")){const[b,v,P]=p;re(f,{signed:v==="int",size:Number.parseInt(P,10)/8})}if(u==="address"&&typeof f=="string"&&!yt(f))throw new Cn({address:f});const d=u.match(rg);if(d){const[b,v]=d;if(v&&Te(f)!==Number.parseInt(v,10))throw new f1({expectedSize:Number.parseInt(v,10),givenSize:Te(f)})}const h=o[u];h&&(ww(u),s(h,f))}};if(o.EIP712Domain&&t){if(typeof t!="object")throw new mw({domain:t});s(o.EIP712Domain,t)}if(r!=="EIP712Domain")if(o[r])s(o[r],n);else throw new bw({primaryType:r,types:o})}function vw({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 ww(e){if(e==="address"||e==="bool"||e==="string"||e.startsWith("bytes")||e.startsWith("uint")||e.startsWith("int"))throw new gw({type:e})}function xw(e){const{domain:t={},message:n,primaryType:r}=e,o={EIP712Domain:vw({domain:t}),...e.types};yw({domain:t,message:n,primaryType:r,types:o});const s=["0x1901"];return t&&s.push(Ew({domain:t,types:o})),r!=="EIP712Domain"&&s.push(Ld({data:n,primaryType:r,types:o})),je(Bt(s))}function Ew({domain:e,types:t}){return Ld({data:e,primaryType:"EIP712Domain",types:t})}function Ld({data:e,primaryType:t,types:n}){const r=Fd({data:e,primaryType:t,types:n});return je(r)}function Fd({data:e,primaryType:t,types:n}){const r=[{type:"bytes32"}],o=[Sw({primaryType:t,types:n})];for(const s of n[t]){const[i,l]=jd({types:n,name:s.name,type:s.type,value:e[s.name]});r.push(i),o.push(l)}return On(r,o)}function Sw({primaryType:e,types:t}){const n=Nn(Pw({primaryType:e,types:t}));return je(n)}function Pw({primaryType:e,types:t}){let n="";const r=Rd({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:l})=>`${l} ${i}`).join(",")})`;return n}function Rd({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])Rd({primaryType:s.type,types:t},n);return n}function jd({types:e,name:t,type:n,value:r}){if(e[n]!==void 0)return[{type:"bytes32"},je(Fd({data:r,primaryType:n,types:e}))];if(n==="bytes")return[{type:"bytes32"},je(r)];if(n==="string")return[{type:"bytes32"},je(Nn(r))];if(n.lastIndexOf("]")===n.length-1){const o=n.slice(0,n.lastIndexOf("[")),s=r.map(i=>jd({name:t,type:o,types:e,value:i}));return[{type:"bytes32"},je(On(s.map(([i])=>i),s.map(([,i])=>i)))]}return[{type:n},r]}class Tw 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 el={checksum:new Tw(8192)}.checksum;class zd extends Yi{constructor(t,n){super(),this.finished=!1,this.destroyed=!1,M1(t);const r=xs(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),Er(s)}update(t){return xr(this),this.iHash.update(t),this}digestInto(t){xr(this),Kn(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:l}=this;return t=t,t.finished=o,t.destroyed=s,t.blockLen=i,t.outputLen=l,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 Ud=(e,t,n)=>new zd(e,t).update(n).digest();Ud.create=(e,t)=>new zd(e,t);function Wd(e,t={}){const{as:n=typeof e=="string"?"Hex":"Bytes"}=t,r=Vu(By(e));return n==="Bytes"?r:Rt(r)}const Aw=/^0x[a-fA-F0-9]{40}$/;function Vs(e,t={}){const{strict:n=!0}=t;if(!Aw.test(e))throw new Vd({address:e,cause:new Nw});if(n){if(e.toLowerCase()===e)return;if(_d(e)!==e)throw new Vd({address:e,cause:new Cw})}}function _d(e){if(el.has(e))return el.get(e);Vs(e,{strict:!1});const t=e.substring(2).toLowerCase(),n=Wd(Fy(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 el.set(e,o),o}function tl(e,t={}){const{strict:n=!0}=t??{};try{return Vs(e,{strict:n}),!0}catch{return!1}}class Vd extends oe{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 Nw extends oe{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 Cw extends oe{constructor(){super("Address does not match its checksum counterpart."),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Address.InvalidChecksumError"})}}const Ow=/^(.*)\[([0-9]*)\]$/,Iw=/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/,Hd=/^(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)?$/,Gd=2n**256n-1n;function Lr(e,t,n){const{checksumAddress:r,staticPosition:o}=n,s=sl(t.type);if(s){const[i,l]=s;return kw(e,{...t,type:l},{checksumAddress:r,length:i,staticPosition:o})}if(t.type==="tuple")return Lw(e,t,{checksumAddress:r,staticPosition:o});if(t.type==="address")return $w(e,{checksum:r});if(t.type==="bool")return Mw(e);if(t.type.startsWith("bytes"))return Dw(e,t,{staticPosition:o});if(t.type.startsWith("uint")||t.type.startsWith("int"))return Bw(e,t);if(t.type==="string")return Fw(e,{staticPosition:o});throw new ll(t.type)}const qd=32,nl=32;function $w(e,t={}){const{checksum:n=!1}=t,r=e.readBytes(32);return[(s=>n?_d(s):s)(Rt(jy(r,-20))),32]}function kw(e,t,n){const{checksumAddress:r,length:o,staticPosition:s}=n;if(!o){const a=hn(e.readBytes(nl)),c=s+a,u=c+qd;e.setPosition(c);const f=hn(e.readBytes(qd)),p=qo(t);let d=0;const h=[];for(let b=0;b<f;++b){e.setPosition(u+(p?b*32:d));const[v,P]=Lr(e,t,{checksumAddress:r,staticPosition:u});d+=P,h.push(v)}return e.setPosition(s+32),[h,32]}if(qo(t)){const a=hn(e.readBytes(nl)),c=s+a,u=[];for(let f=0;f<o;++f){e.setPosition(c+f*32);const[p]=Lr(e,t,{checksumAddress:r,staticPosition:c});u.push(p)}return e.setPosition(s+32),[u,32]}let i=0;const l=[];for(let a=0;a<o;++a){const[c,u]=Lr(e,t,{checksumAddress:r,staticPosition:s+i});i+=u,l.push(c)}return[l,i]}function Mw(e){return[Uy(e.readBytes(32),{size:32}),32]}function Dw(e,t,{staticPosition:n}){const[r,o]=t.type.split("bytes");if(!o){const i=hn(e.readBytes(32));e.setPosition(n+i);const l=hn(e.readBytes(32));if(l===0)return e.setPosition(n+32),["0x",32];const a=e.readBytes(l);return e.setPosition(n+32),[Rt(a),32]}return[Rt(e.readBytes(Number.parseInt(o,10),32)),32]}function Bw(e,t){const n=t.type.startsWith("int"),r=Number.parseInt(t.type.split("int")[1]||"256",10),o=e.readBytes(32);return[r>48?zy(o,{signed:n}):hn(o,{signed:n}),32]}function Lw(e,t,n){const{checksumAddress:r,staticPosition:o}=n,s=t.components.length===0||t.components.some(({name:a})=>!a),i=s?[]:{};let l=0;if(qo(t)){const a=hn(e.readBytes(nl)),c=o+a;for(let u=0;u<t.components.length;++u){const f=t.components[u];e.setPosition(c+l);const[p,d]=Lr(e,f,{checksumAddress:r,staticPosition:c});l+=d,i[s?u:f==null?void 0:f.name]=p}return e.setPosition(o+32),[i,32]}for(let a=0;a<t.components.length;++a){const c=t.components[a],[u,f]=Lr(e,c,{checksumAddress:r,staticPosition:o});i[s?a:c==null?void 0:c.name]=u,l+=f}return[i,l]}function Fw(e,{staticPosition:t}){const n=hn(e.readBytes(32)),r=t+n;e.setPosition(r);const o=hn(e.readBytes(32));if(o===0)return e.setPosition(t+32),["",32];const s=e.readBytes(o,32),i=Wy(Jf(s));return e.setPosition(t+32),[i,32]}function Rw({checksumAddress:e,parameters:t,values:n}){const r=[];for(let o=0;o<t.length;o++)r.push(rl({checksumAddress:e,parameter:t[o],value:n[o]}));return r}function rl({checksumAddress:e=!1,parameter:t,value:n}){const r=t,o=sl(r.type);if(o){const[s,i]=o;return zw(n,{checksumAddress:e,length:s,parameter:{...r,type:i}})}if(r.type==="tuple")return Hw(n,{checksumAddress:e,parameter:r});if(r.type==="address")return jw(n,{checksum:e});if(r.type==="bool")return Ww(n);if(r.type.startsWith("uint")||r.type.startsWith("int")){const s=r.type.startsWith("int"),[,,i="256"]=Hd.exec(r.type)??[];return _w(n,{signed:s,size:Number(i)})}if(r.type.startsWith("bytes"))return Uw(n,{type:r.type});if(r.type==="string")return Vw(n);throw new ll(r.type)}function ol(e){let t=0;for(let s=0;s<e.length;s++){const{dynamic:i,encoded:l}=e[s];i?t+=32:t+=dt(l)}const n=[],r=[];let o=0;for(let s=0;s<e.length;s++){const{dynamic:i,encoded:l}=e[s];i?(n.push(Ve(t+o,{size:32})),r.push(l),o+=dt(l)):n.push(l)}return Ft(...n,...r)}function jw(e,t){const{checksum:n=!1}=t;return Vs(e,{strict:n}),{dynamic:!1,encoded:tr(e.toLowerCase())}}function zw(e,t){const{checksumAddress:n,length:r,parameter:o}=t,s=r===null;if(!Array.isArray(e))throw new e6(e);if(!s&&e.length!==r)throw new Qw({expectedLength:r,givenLength:e.length,type:`${o.type}[${r}]`});let i=!1;const l=[];for(let a=0;a<e.length;a++){const c=rl({checksumAddress:n,parameter:o,value:e[a]});c.dynamic&&(i=!0),l.push(c)}if(s||i){const a=ol(l);if(s){const c=Ve(l.length,{size:32});return{dynamic:!0,encoded:l.length>0?Ft(c,a):c}}if(i)return{dynamic:!0,encoded:a}}return{dynamic:!1,encoded:Ft(...l.map(({encoded:a})=>a))}}function Uw(e,{type:t}){const[,n]=t.split("bytes"),r=dt(e);if(!n){let o=e;return r%32!==0&&(o=nr(o,Math.ceil((e.length-2)/2/32)*32)),{dynamic:!0,encoded:Ft(tr(Ve(r,{size:32})),o)}}if(r!==Number.parseInt(n,10))throw new Yd({expectedSize:Number.parseInt(n,10),value:e});return{dynamic:!1,encoded:nr(e)}}function Ww(e){if(typeof e!="boolean")throw new oe(`Invalid boolean value: "${e}" (type: ${typeof e}). Expected: \`true\` or \`false\`.`);return{dynamic:!1,encoded:tr(Qf(e))}}function _w(e,{signed:t,size:n}){if(typeof n=="number"){const r=2n**(BigInt(n)-(t?1n:0n))-1n,o=t?-r-1n:0n;if(e>r||e<o)throw new nd({max:r.toString(),min:o.toString(),signed:t,size:n/8,value:e.toString()})}return{dynamic:!1,encoded:Ve(e,{size:32,signed:t})}}function Vw(e){const t=La(e),n=Math.ceil(dt(t)/32),r=[];for(let o=0;o<n;o++)r.push(nr(Yt(t,o*32,(o+1)*32)));return{dynamic:!0,encoded:Ft(nr(Ve(dt(t),{size:32})),...r)}}function Hw(e,t){const{checksumAddress:n,parameter:r}=t;let o=!1;const s=[];for(let i=0;i<r.components.length;i++){const l=r.components[i],a=Array.isArray(e)?i:l.name,c=rl({checksumAddress:n,parameter:l,value:e[a]});s.push(c),c.dynamic&&(o=!0)}return{dynamic:o,encoded:o?ol(s):Ft(...s.map(({encoded:i})=>i))}}function sl(e){const t=e.match(/^(.*)\[(\d+)?\]$/);return t?[t[2]?Number(t[2]):null,t[1]]:void 0}function qo(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(qo);const n=sl(e.type);return!!(n&&qo({...e,type:n[1]}))}const Gw={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 Zw({count:this.recursiveReadCount+1,limit:this.recursiveReadLimit})},assertPosition(e){if(e<0||e>this.bytes.length-1)throw new Kw({length:this.bytes.length,position:e})},decrementPosition(e){if(e<0)throw new Kd({offset:e});const t=this.position-e;this.assertPosition(t),this.position=t},getReadCount(e){return this.positionReadCount.get(e||this.position)||0},incrementPosition(e){if(e<0)throw new Kd({offset:e});const t=this.position+e;this.assertPosition(t),this.position=t},inspectByte(e){const t=e??this.position;return this.assertPosition(t),this.bytes[t]},inspectBytes(e,t){const n=t??this.position;return this.assertPosition(n+e-1),this.bytes.subarray(n,n+e)},inspectUint8(e){const t=e??this.position;return this.assertPosition(t),this.bytes[t]},inspectUint16(e){const t=e??this.position;return this.assertPosition(t+1),this.dataView.getUint16(t)},inspectUint24(e){const t=e??this.position;return this.assertPosition(t+2),(this.dataView.getUint16(t)<<8)+this.dataView.getUint8(t+2)},inspectUint32(e){const t=e??this.position;return this.assertPosition(t+3),this.dataView.getUint32(t)},pushByte(e){this.assertPosition(this.position),this.bytes[this.position]=e,this.position++},pushBytes(e){this.assertPosition(this.position+e.length-1),this.bytes.set(e,this.position),this.position+=e.length},pushUint8(e){this.assertPosition(this.position),this.bytes[this.position]=e,this.position++},pushUint16(e){this.assertPosition(this.position+1),this.dataView.setUint16(this.position,e),this.position+=2},pushUint24(e){this.assertPosition(this.position+2),this.dataView.setUint16(this.position,e>>8),this.dataView.setUint8(this.position+2,e&255),this.position+=3},pushUint32(e){this.assertPosition(this.position+3),this.dataView.setUint32(this.position,e),this.position+=4},readByte(){this.assertReadLimit(),this._touch();const e=this.inspectByte();return this.position++,e},readBytes(e,t){this.assertReadLimit(),this._touch();const n=this.inspectBytes(e);return this.position+=t??e,n},readUint8(){this.assertReadLimit(),this._touch();const e=this.inspectUint8();return this.position+=1,e},readUint16(){this.assertReadLimit(),this._touch();const e=this.inspectUint16();return this.position+=2,e},readUint24(){this.assertReadLimit(),this._touch();const e=this.inspectUint24();return this.position+=3,e},readUint32(){this.assertReadLimit(),this._touch();const e=this.inspectUint32();return this.position+=4,e},get remaining(){return this.bytes.length-this.position},setPosition(e){const t=this.position;return this.assertPosition(e),this.position=e,()=>this.position=t},_touch(){if(this.recursiveReadLimit===Number.POSITIVE_INFINITY)return;const e=this.getReadCount();this.positionReadCount.set(this.position,e+1),e>0&&this.recursiveReadCount++}};function qw(e,{recursiveReadLimit:t=8192}={}){const n=Object.create(Gw);return n.bytes=e,n.dataView=new DataView(e.buffer,e.byteOffset,e.byteLength),n.positionReadCount=new Map,n.recursiveReadLimit=t,n}class Kd extends oe{constructor({offset:t}){super(`Offset \`${t}\` cannot be negative.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Cursor.NegativeOffsetError"})}}class Kw extends oe{constructor({length:t,position:n}){super(`Position \`${n}\` is out of bounds (\`0 < position < ${t}\`).`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Cursor.PositionOutOfBoundsError"})}}class Zw extends oe{constructor({count:t,limit:n}){super(`Recursive read limit of \`${n}\` exceeded (recursive read count: \`${t}\`).`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Cursor.RecursiveReadLimitExceededError"})}}function Yw(e,t,n={}){const{as:r="Array",checksumAddress:o=!1}=n,s=typeof t=="string"?Xf(t):t,i=qw(s);if($r(s)===0&&e.length>0)throw new Jw;if($r(s)&&$r(s)<32)throw new Xw({data:typeof t=="string"?t:Rt(t),parameters:e,size:$r(s)});let l=0;const a=r==="Array"?[]:{};for(let c=0;c<e.length;++c){const u=e[c];i.setPosition(l);const[f,p]=Lr(i,u,{checksumAddress:o,staticPosition:0});l+=p,r==="Array"?a.push(f):a[u.name??c]=f}return a}function il(e,t,n){const{checksumAddress:r=!1}={};if(e.length!==t.length)throw new Xd({expectedLength:e.length,givenLength:t.length});const o=Rw({checksumAddress:r,parameters:e,values:t}),s=ol(o);return s.length===0?"0x":s}function al(e,t){if(e.length!==t.length)throw new Xd({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(al.encode(o,s))}return Ft(...n)}(function(e){function t(n,r,o=!1){if(n==="address"){const a=r;return Vs(a),tr(a.toLowerCase(),o?32:0)}if(n==="string")return La(r);if(n==="bytes")return r;if(n==="bool")return tr(Qf(r),o?32:1);const s=n.match(Hd);if(s){const[a,c,u="256"]=s,f=Number.parseInt(u,10)/8;return Ve(r,{size:o?32:f,signed:c==="int"})}const i=n.match(Iw);if(i){const[a,c]=i;if(Number.parseInt(c,10)!==(r.length-2)/2)throw new Yd({expectedSize:Number.parseInt(c,10),value:r});return nr(r,o?32:0)}const l=n.match(Ow);if(l&&Array.isArray(r)){const[a,c]=l,u=[];for(let f=0;f<r.length;f++)u.push(t(c,r[f],!0));return u.length===0?"0x":Ft(...u)}throw new ll(n)}e.encode=t})(al||(al={}));function Zd(e){return Array.isArray(e)&&typeof e[0]=="string"||typeof e=="string"?vu(e):e}class Xw extends oe{constructor({data:t,parameters:n,size:r}){super(`Data size of ${r} bytes is too small for given parameters.`,{metaMessages:[`Params: (${mr(n)})`,`Data: ${t} (${r} bytes)`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiParameters.DataSizeTooSmallError"})}}class Jw extends oe{constructor(){super('Cannot decode zero data ("0x") with ABI parameters.'),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiParameters.ZeroDataError"})}}class Qw extends oe{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 Yd extends oe{constructor({expectedSize:t,value:n}){super(`Size of bytes "${n}" (bytes${dt(n)}) does not match expected size (bytes${t}).`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiParameters.BytesSizeMismatchError"})}}class Xd extends oe{constructor({expectedLength:t,givenLength:n}){super(["ABI encoding parameters/values length mismatch.",`Expected length (parameters): ${t}`,`Given length (values): ${n}`].join(`
90
+ `)),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiParameters.LengthMismatchError"})}}class e6 extends oe{constructor(t){super(`Value \`${t}\` is not a valid array.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiParameters.InvalidArrayError"})}}class ll extends oe{constructor(t){super(`Type \`${t}\` is not a valid ABI Type.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiParameters.InvalidTypeError"})}}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const et=BigInt(0),He=BigInt(1),rr=BigInt(2),t6=BigInt(3),Jd=BigInt(4),Qd=BigInt(5),e0=BigInt(8);function tt(e,t){const n=e%t;return n>=et?n:t+n}function xt(e,t,n){let r=e;for(;t-- >et;)r*=r,r%=n;return r}function cl(e,t){if(e===et)throw new Error("invert: expected non-zero number");if(t<=et)throw new Error("invert: expected positive modulus, got "+t);let n=tt(e,t),r=t,o=et,s=He;for(;n!==et;){const l=r/n,a=r%n,c=o-s*l;r=n,n=a,o=s,s=c}if(r!==He)throw new Error("invert: does not exist");return tt(o,t)}function t0(e,t){const n=(e.ORDER+He)/Jd,r=e.pow(t,n);if(!e.eql(e.sqr(r),t))throw new Error("Cannot find square root");return r}function n6(e,t){const n=(e.ORDER-Qd)/e0,r=e.mul(t,rr),o=e.pow(r,n),s=e.mul(t,o),i=e.mul(e.mul(s,rr),o),l=e.mul(s,e.sub(i,e.ONE));if(!e.eql(e.sqr(l),t))throw new Error("Cannot find square root");return l}function r6(e){if(e<BigInt(3))throw new Error("sqrt is not defined for small field");let t=e-He,n=0;for(;t%rr===et;)t/=rr,n++;let r=rr;const o=ul(e);for(;r0(o,r)===1;)if(r++>1e3)throw new Error("Cannot find square root: probably non-prime P");if(n===1)return t0;let s=o.pow(r,t);const i=(t+He)/rr;return function(a,c){if(a.is0(c))return c;if(r0(a,c)!==1)throw new Error("Cannot find square root");let u=n,f=a.mul(a.ONE,s),p=a.pow(c,t),d=a.pow(c,i);for(;!a.eql(p,a.ONE);){if(a.is0(p))return a.ZERO;let h=1,b=a.sqr(p);for(;!a.eql(b,a.ONE);)if(h++,b=a.sqr(b),h===u)throw new Error("Cannot find square root");const v=He<<BigInt(u-h-1),P=a.pow(f,v);u=h,f=a.sqr(P),p=a.mul(p,f),d=a.mul(d,P)}return d}}function o6(e){return e%Jd===t6?t0:e%e0===Qd?n6:r6(e)}const s6=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function i6(e){const t={ORDER:"bigint",MASK:"bigint",BYTES:"isSafeInteger",BITS:"isSafeInteger"},n=s6.reduce((r,o)=>(r[o]="function",r),t);return Ls(e,n)}function a6(e,t,n){if(n<et)throw new Error("invalid exponent, negatives unsupported");if(n===et)return e.ONE;if(n===He)return t;let r=e.ONE,o=t;for(;n>et;)n&He&&(r=e.mul(r,o)),o=e.sqr(o),n>>=He;return r}function n0(e,t,n=!1){const r=new Array(t.length).fill(n?e.ZERO:void 0),o=t.reduce((i,l,a)=>e.is0(l)?i:(r[a]=i,e.mul(i,l)),e.ONE),s=e.inv(o);return t.reduceRight((i,l,a)=>e.is0(l)?i:(r[a]=e.mul(i,r[a]),e.mul(i,l)),s),r}function r0(e,t){const n=(e.ORDER-He)/rr,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 o0(e,t){t!==void 0&&so(t);const n=t!==void 0?t:e.toString(2).length,r=Math.ceil(n/8);return{nBitLength:n,nByteLength:r}}function ul(e,t,n=!1,r={}){if(e<=et)throw new Error("invalid field: expected ORDER > 0, got "+e);const{nBitLength:o,nByteLength:s}=o0(e,t);if(s>2048)throw new Error("invalid field: expected ORDER of <= 2048 bytes");let i;const l=Object.freeze({ORDER:e,isLE:n,BITS:o,BYTES:s,MASK:Bs(o),ZERO:et,ONE:He,create:a=>tt(a,e),isValid:a=>{if(typeof a!="bigint")throw new Error("invalid field element: expected bigint, got "+typeof a);return et<=a&&a<e},is0:a=>a===et,isOdd:a=>(a&He)===He,neg:a=>tt(-a,e),eql:(a,c)=>a===c,sqr:a=>tt(a*a,e),add:(a,c)=>tt(a+c,e),sub:(a,c)=>tt(a-c,e),mul:(a,c)=>tt(a*c,e),pow:(a,c)=>a6(l,a,c),div:(a,c)=>tt(a*cl(c,e),e),sqrN:a=>a*a,addN:(a,c)=>a+c,subN:(a,c)=>a-c,mulN:(a,c)=>a*c,inv:a=>cl(a,e),sqrt:r.sqrt||(a=>(i||(i=o6(e)),i(l,a))),toBytes:a=>n?_f(a,s):Uo(a,s),fromBytes:a=>{if(a.length!==s)throw new Error("Field.fromBytes: expected "+s+" bytes, got "+a.length);return n?Wf(a):er(a)},invertBatch:a=>n0(l,a),cmov:(a,c,u)=>u?c:a});return Object.freeze(l)}function s0(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 i0(e){const t=s0(e);return t+Math.ceil(t/2)}function l6(e,t,n=!1){const r=e.length,o=s0(t),s=i0(t);if(r<16||r<s||r>1024)throw new Error("expected "+s+"-1024 bytes of input, got "+r);const i=n?Wf(e):er(e),l=tt(i,t-He)+He;return n?_f(l,o):Uo(l,o)}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const a0=BigInt(0),fl=BigInt(1);function dl(e,t){const n=t.negate();return e?n:t}function l0(e,t){if(!Number.isSafeInteger(e)||e<=0||e>t)throw new Error("invalid window size, expected [1.."+t+"], got W="+e)}function pl(e,t){l0(e,t);const n=Math.ceil(t/e)+1,r=2**(e-1),o=2**e,s=Bs(e),i=BigInt(e);return{windows:n,windowSize:r,mask:s,maxNumber:o,shiftBy:i}}function c0(e,t,n){const{windowSize:r,mask:o,maxNumber:s,shiftBy:i}=n;let l=Number(e&o),a=e>>i;l>r&&(l-=s,a+=fl);const c=t*r,u=c+Math.abs(l)-1,f=l===0,p=l<0,d=t%2!==0;return{nextN:a,offset:u,isZero:f,isNeg:p,isNegF:d,offsetF:c}}function c6(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 u6(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 hl=new WeakMap,u0=new WeakMap;function ml(e){return u0.get(e)||1}function f6(e,t){return{constTimeNegate:dl,hasPrecomputes(n){return ml(n)!==1},unsafeLadder(n,r,o=e.ZERO){let s=n;for(;r>a0;)r&fl&&(o=o.add(s)),s=s.double(),r>>=fl;return o},precomputeWindow(n,r){const{windows:o,windowSize:s}=pl(r,t),i=[];let l=n,a=l;for(let c=0;c<o;c++){a=l,i.push(a);for(let u=1;u<s;u++)a=a.add(l),i.push(a);l=a.double()}return i},wNAF(n,r,o){let s=e.ZERO,i=e.BASE;const l=pl(n,t);for(let a=0;a<l.windows;a++){const{nextN:c,offset:u,isZero:f,isNeg:p,isNegF:d,offsetF:h}=c0(o,a,l);o=c,f?i=i.add(dl(d,r[h])):s=s.add(dl(p,r[u]))}return{p:s,f:i}},wNAFUnsafe(n,r,o,s=e.ZERO){const i=pl(n,t);for(let l=0;l<i.windows&&o!==a0;l++){const{nextN:a,offset:c,isZero:u,isNeg:f}=c0(o,l,i);if(o=a,!u){const p=r[c];s=s.add(f?p.negate():p)}}return s},getPrecomputes(n,r,o){let s=hl.get(r);return s||(s=this.precomputeWindow(r,n),n!==1&&hl.set(r,o(s))),s},wNAFCached(n,r,o){const s=ml(n);return this.wNAF(s,this.getPrecomputes(s,n,o),r)},wNAFCachedUnsafe(n,r,o,s){const i=ml(n);return i===1?this.unsafeLadder(n,r,s):this.wNAFUnsafe(i,this.getPrecomputes(i,n,o),r,s)},setWindowSize(n,r){l0(r,t),u0.set(n,r),hl.delete(n)}}}function d6(e,t,n,r){c6(n,e),u6(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,l=Py(BigInt(o));let a=1;l>12?a=l-3:l>4?a=l-2:l>0&&(a=2);const c=Bs(a),u=new Array(Number(c)+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 b=0;b<s;b++){const v=r[b],P=Number(v>>BigInt(d)&c);u[P]=u[P].add(n[b])}let h=i;for(let b=u.length-1,v=i;b>0;b--)v=v.add(u[b]),h=h.add(v);if(p=p.add(h),d!==0)for(let b=0;b<a;b++)p=p.double()}return p}function f0(e){return i6(e.Fp),Ls(e,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze({...o0(e.n,e.nBitLength),...e,p:e.Fp.ORDER})}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */function d0(e){e.lowS!==void 0&&jo("lowS",e.lowS),e.prehash!==void 0&&jo("prehash",e.prehash)}function p6(e){const t=f0(e);Ls(t,{a:"field",b:"field"},{allowInfinityPoint:"boolean",allowedPrivateKeyLengths:"array",clearCofactor:"function",fromBytes:"function",isTorsionFree:"function",toBytes:"function",wrapPrivateKey:"boolean"});const{endo:n,Fp:r,a:o}=t;if(n){if(!r.eql(o,r.ZERO))throw new Error("invalid endo: CURVE.a must be 0");if(typeof n!="object"||typeof n.beta!="bigint"||typeof n.splitScalar!="function")throw new Error('invalid endo: expected "beta": bigint and "splitScalar": function')}return Object.freeze({...t})}class h6 extends Error{constructor(t=""){super(t)}}const mn={Err:h6,_tlv:{encode:(e,t)=>{const{Err:n}=mn;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=ks(r);if(o.length/2&128)throw new n("tlv.encode: long form length too big");const s=r>127?ks(o.length/2|128):"";return ks(e)+s+o+t},decode(e,t){const{Err:n}=mn;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 c=t.subarray(r,r+a);if(c.length!==a)throw new n("tlv.decode: length bytes not complete");if(c[0]===0)throw new n("tlv.decode(long): zero leftmost byte");for(const u of c)i=i<<8|u;if(r+=a,i<128)throw new n("tlv.decode(long): not minimal encoding")}const l=t.subarray(r,r+i);if(l.length!==i)throw new n("tlv.decode: wrong value length");return{v:l,l:t.subarray(r+i)}}},_int:{encode(e){const{Err:t}=mn;if(e<bn)throw new t("integer: negative integers are not allowed");let n=ks(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}=mn;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 er(e)}},toSig(e){const{Err:t,_int:n,_tlv:r}=mn,o=wt("signature",e),{v:s,l:i}=r.decode(48,o);if(i.length)throw new t("invalid signature: left bytes after parsing");const{v:l,l:a}=r.decode(2,s),{v:c,l:u}=r.decode(2,a);if(u.length)throw new t("invalid signature: left bytes after parsing");return{r:n.decode(l),s:n.decode(c)}},hexFromSig(e){const{_tlv:t,_int:n}=mn,r=t.encode(2,n.encode(e.r)),o=t.encode(2,n.encode(e.s)),s=r+o;return t.encode(48,s)}};function bl(e,t){return zo(Uo(e,t))}const bn=BigInt(0),Be=BigInt(1);BigInt(2);const gl=BigInt(3),m6=BigInt(4);function b6(e){const t=p6(e),{Fp:n}=t,r=ul(t.n,t.nBitLength),o=t.toBytes||((E,N,D)=>{const F=N.toAffine();return Ds(Uint8Array.from([4]),n.toBytes(F.x),n.toBytes(F.y))}),s=t.fromBytes||(E=>{const N=E.subarray(1),D=n.fromBytes(N.subarray(0,n.BYTES)),F=n.fromBytes(N.subarray(n.BYTES,2*n.BYTES));return{x:D,y:F}});function i(E){const{a:N,b:D}=t,F=n.sqr(E),L=n.mul(F,E);return n.add(n.add(L,n.mul(E,N)),D)}function l(E,N){const D=n.sqr(N),F=i(E);return n.eql(D,F)}if(!l(t.Gx,t.Gy))throw new Error("bad curve params: generator point");const a=n.mul(n.pow(t.a,gl),m6),c=n.mul(n.sqr(t.b),BigInt(27));if(n.is0(n.add(a,c)))throw new Error("bad curve params: a or b");function u(E){return Da(E,Be,t.n)}function f(E){const{allowedPrivateKeyLengths:N,nByteLength:D,wrapPrivateKey:F,n:L}=t;if(N&&typeof E!="bigint"){if(Ro(E)&&(E=zo(E)),typeof E!="string"||!N.includes(E.length))throw new Error("invalid private key");E=E.padStart(D*2,"0")}let m;try{m=typeof E=="bigint"?E:er(wt("private key",E,D))}catch{throw new Error("invalid private key, expected hex or "+D+" bytes, got "+typeof E)}return F&&(m=tt(m,L)),Ir("private key",m,Be,L),m}function p(E){if(!(E instanceof b))throw new Error("ProjectivePoint expected")}const d=Hf((E,N)=>{const{px:D,py:F,pz:L}=E;if(n.eql(L,n.ONE))return{x:D,y:F};const m=E.is0();N==null&&(N=m?n.ONE:n.inv(L));const w=n.mul(D,N),S=n.mul(F,N),$=n.mul(L,N);if(m)return{x:n.ZERO,y:n.ZERO};if(!n.eql($,n.ONE))throw new Error("invZ was invalid");return{x:w,y:S}}),h=Hf(E=>{if(E.is0()){if(t.allowInfinityPoint&&!n.is0(E.py))return;throw new Error("bad point: ZERO")}const{x:N,y:D}=E.toAffine();if(!n.isValid(N)||!n.isValid(D))throw new Error("bad point: x or y not FE");if(!l(N,D))throw new Error("bad point: equation left != right");if(!E.isTorsionFree())throw new Error("bad point: not in prime-order subgroup");return!0});class b{constructor(N,D,F){if(N==null||!n.isValid(N))throw new Error("x required");if(D==null||!n.isValid(D)||n.is0(D))throw new Error("y required");if(F==null||!n.isValid(F))throw new Error("z required");this.px=N,this.py=D,this.pz=F,Object.freeze(this)}static fromAffine(N){const{x:D,y:F}=N||{};if(!N||!n.isValid(D)||!n.isValid(F))throw new Error("invalid affine point");if(N instanceof b)throw new Error("projective point not allowed");const L=m=>n.eql(m,n.ZERO);return L(D)&&L(F)?b.ZERO:new b(D,F,n.ONE)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static normalizeZ(N){const D=n0(n,N.map(F=>F.pz));return N.map((F,L)=>F.toAffine(D[L])).map(b.fromAffine)}static fromHex(N){const D=b.fromAffine(s(wt("pointHex",N)));return D.assertValidity(),D}static fromPrivateKey(N){return b.BASE.multiply(f(N))}static msm(N,D){return d6(b,r,N,D)}_setWindowSize(N){x.setWindowSize(this,N)}assertValidity(){h(this)}hasEvenY(){const{y:N}=this.toAffine();if(n.isOdd)return!n.isOdd(N);throw new Error("Field doesn't support isOdd")}equals(N){p(N);const{px:D,py:F,pz:L}=this,{px:m,py:w,pz:S}=N,$=n.eql(n.mul(D,S),n.mul(m,L)),I=n.eql(n.mul(F,S),n.mul(w,L));return $&&I}negate(){return new b(this.px,n.neg(this.py),this.pz)}double(){const{a:N,b:D}=t,F=n.mul(D,gl),{px:L,py:m,pz:w}=this;let S=n.ZERO,$=n.ZERO,I=n.ZERO,A=n.mul(L,L),k=n.mul(m,m),y=n.mul(w,w),O=n.mul(L,m);return O=n.add(O,O),I=n.mul(L,w),I=n.add(I,I),S=n.mul(N,I),$=n.mul(F,y),$=n.add(S,$),S=n.sub(k,$),$=n.add(k,$),$=n.mul(S,$),S=n.mul(O,S),I=n.mul(F,I),y=n.mul(N,y),O=n.sub(A,y),O=n.mul(N,O),O=n.add(O,I),I=n.add(A,A),A=n.add(I,A),A=n.add(A,y),A=n.mul(A,O),$=n.add($,A),y=n.mul(m,w),y=n.add(y,y),A=n.mul(y,O),S=n.sub(S,A),I=n.mul(y,k),I=n.add(I,I),I=n.add(I,I),new b(S,$,I)}add(N){p(N);const{px:D,py:F,pz:L}=this,{px:m,py:w,pz:S}=N;let $=n.ZERO,I=n.ZERO,A=n.ZERO;const k=t.a,y=n.mul(t.b,gl);let O=n.mul(D,m),M=n.mul(F,w),T=n.mul(L,S),B=n.add(D,F),R=n.add(m,w);B=n.mul(B,R),R=n.add(O,M),B=n.sub(B,R),R=n.add(D,L);let z=n.add(m,S);return R=n.mul(R,z),z=n.add(O,T),R=n.sub(R,z),z=n.add(F,L),$=n.add(w,S),z=n.mul(z,$),$=n.add(M,T),z=n.sub(z,$),A=n.mul(k,R),$=n.mul(y,T),A=n.add($,A),$=n.sub(M,A),A=n.add(M,A),I=n.mul($,A),M=n.add(O,O),M=n.add(M,O),T=n.mul(k,T),R=n.mul(y,R),M=n.add(M,T),T=n.sub(O,T),T=n.mul(k,T),R=n.add(R,T),O=n.mul(M,R),I=n.add(I,O),O=n.mul(z,R),$=n.mul(B,$),$=n.sub($,O),O=n.mul(B,M),A=n.mul(z,A),A=n.add(A,O),new b($,I,A)}subtract(N){return this.add(N.negate())}is0(){return this.equals(b.ZERO)}wNAF(N){return x.wNAFCached(this,N,b.normalizeZ)}multiplyUnsafe(N){const{endo:D,n:F}=t;Ir("scalar",N,bn,F);const L=b.ZERO;if(N===bn)return L;if(this.is0()||N===Be)return this;if(!D||x.hasPrecomputes(this))return x.wNAFCachedUnsafe(this,N,b.normalizeZ);let{k1neg:m,k1:w,k2neg:S,k2:$}=D.splitScalar(N),I=L,A=L,k=this;for(;w>bn||$>bn;)w&Be&&(I=I.add(k)),$&Be&&(A=A.add(k)),k=k.double(),w>>=Be,$>>=Be;return m&&(I=I.negate()),S&&(A=A.negate()),A=new b(n.mul(A.px,D.beta),A.py,A.pz),I.add(A)}multiply(N){const{endo:D,n:F}=t;Ir("scalar",N,Be,F);let L,m;if(D){const{k1neg:w,k1:S,k2neg:$,k2:I}=D.splitScalar(N);let{p:A,f:k}=this.wNAF(S),{p:y,f:O}=this.wNAF(I);A=x.constTimeNegate(w,A),y=x.constTimeNegate($,y),y=new b(n.mul(y.px,D.beta),y.py,y.pz),L=A.add(y),m=k.add(O)}else{const{p:w,f:S}=this.wNAF(N);L=w,m=S}return b.normalizeZ([L,m])[0]}multiplyAndAddUnsafe(N,D,F){const L=b.BASE,m=(S,$)=>$===bn||$===Be||!S.equals(L)?S.multiplyUnsafe($):S.multiply($),w=m(this,D).add(m(N,F));return w.is0()?void 0:w}toAffine(N){return d(this,N)}isTorsionFree(){const{h:N,isTorsionFree:D}=t;if(N===Be)return!0;if(D)return D(b,this);throw new Error("isTorsionFree() has not been declared for the elliptic curve")}clearCofactor(){const{h:N,clearCofactor:D}=t;return N===Be?this:D?D(b,this):this.multiplyUnsafe(t.h)}toRawBytes(N=!0){return jo("isCompressed",N),this.assertValidity(),o(b,this,N)}toHex(N=!0){return jo("isCompressed",N),zo(this.toRawBytes(N))}}b.BASE=new b(t.Gx,t.Gy,n.ONE),b.ZERO=new b(n.ZERO,n.ONE,n.ZERO);const{endo:v,nBitLength:P}=t,x=f6(b,v?Math.ceil(P/2):P);return{CURVE:t,ProjectivePoint:b,normPrivateKeyToScalar:f,weierstrassEquation:i,isWithinCurveOrder:u}}function g6(e){const t=f0(e);return Ls(t,{hash:"hash",hmac:"function",randomBytes:"function"},{bits2int:"function",bits2int_modN:"function",lowS:"boolean"}),Object.freeze({lowS:!0,...t})}function y6(e){const t=g6(e),{Fp:n,n:r,nByteLength:o,nBitLength:s}=t,i=n.BYTES+1,l=2*n.BYTES+1;function a(y){return tt(y,r)}function c(y){return cl(y,r)}const{ProjectivePoint:u,normPrivateKeyToScalar:f,weierstrassEquation:p,isWithinCurveOrder:d}=b6({...t,toBytes(y,O,M){const T=O.toAffine(),B=n.toBytes(T.x),R=Ds;return jo("isCompressed",M),M?R(Uint8Array.from([O.hasEvenY()?2:3]),B):R(Uint8Array.from([4]),B,n.toBytes(T.y))},fromBytes(y){const O=y.length,M=y[0],T=y.subarray(1);if(O===i&&(M===2||M===3)){const B=er(T);if(!Da(B,Be,n.ORDER))throw new Error("Point is not on curve");const R=p(B);let z;try{z=n.sqrt(R)}catch(J){const K=J instanceof Error?": "+J.message:"";throw new Error("Point is not on curve"+K)}const W=(z&Be)===Be;return(M&1)===1!==W&&(z=n.neg(z)),{x:B,y:z}}else if(O===l&&M===4){const B=n.fromBytes(T.subarray(0,n.BYTES)),R=n.fromBytes(T.subarray(n.BYTES,2*n.BYTES));return{x:B,y:R}}else{const B=i,R=l;throw new Error("invalid Point, expected length of "+B+", or uncompressed "+R+", got "+O)}}});function h(y){const O=r>>Be;return y>O}function b(y){return h(y)?a(-y):y}const v=(y,O,M)=>er(y.slice(O,M));class P{constructor(O,M,T){Ir("r",O,Be,r),Ir("s",M,Be,r),this.r=O,this.s=M,T!=null&&(this.recovery=T),Object.freeze(this)}static fromCompact(O){const M=o;return O=wt("compactSignature",O,M*2),new P(v(O,0,M),v(O,M,2*M))}static fromDER(O){const{r:M,s:T}=mn.toSig(wt("DER",O));return new P(M,T)}assertValidity(){}addRecoveryBit(O){return new P(this.r,this.s,O)}recoverPublicKey(O){const{r:M,s:T,recovery:B}=this,R=L(wt("msgHash",O));if(B==null||![0,1,2,3].includes(B))throw new Error("recovery id invalid");const z=B===2||B===3?M+t.n:M;if(z>=n.ORDER)throw new Error("recovery id 2 or 3 invalid");const W=B&1?"03":"02",G=u.fromHex(W+bl(z,n.BYTES)),J=c(z),K=a(-R*J),_=a(T*J),ne=u.BASE.multiplyAndAddUnsafe(G,K,_);if(!ne)throw new Error("point at infinify");return ne.assertValidity(),ne}hasHighS(){return h(this.s)}normalizeS(){return this.hasHighS()?new P(this.r,a(-this.s),this.recovery):this}toDERRawBytes(){return Ms(this.toDERHex())}toDERHex(){return mn.hexFromSig(this)}toCompactRawBytes(){return Ms(this.toCompactHex())}toCompactHex(){const O=o;return bl(this.r,O)+bl(this.s,O)}}const x={isValidPrivateKey(y){try{return f(y),!0}catch{return!1}},normPrivateKeyToScalar:f,randomPrivateKey:()=>{const y=i0(t.n);return l6(t.randomBytes(y),t.n)},precompute(y=8,O=u.BASE){return O._setWindowSize(y),O.multiply(BigInt(3)),O}};function E(y,O=!0){return u.fromPrivateKey(y).toRawBytes(O)}function N(y){if(typeof y=="bigint")return!1;if(y instanceof u)return!0;const M=wt("key",y).length,T=n.BYTES,B=T+1,R=2*T+1;if(!(t.allowedPrivateKeyLengths||o===B))return M===B||M===R}function D(y,O,M=!0){if(N(y)===!0)throw new Error("first arg must be private key");if(N(O)===!1)throw new Error("second arg must be public key");return u.fromHex(O).multiply(f(y)).toRawBytes(M)}const F=t.bits2int||function(y){if(y.length>8192)throw new Error("input is too large");const O=er(y),M=y.length*8-s;return M>0?O>>BigInt(M):O},L=t.bits2int_modN||function(y){return a(F(y))},m=Bs(s);function w(y){return Ir("num < 2^"+s,y,bn,m),Uo(y,o)}function S(y,O,M=$){if(["recovered","canonical"].some(fe=>fe in M))throw new Error("sign() legacy options not supported");const{hash:T,randomBytes:B}=t;let{lowS:R,prehash:z,extraEntropy:W}=M;R==null&&(R=!0),y=wt("msgHash",y),d0(M),z&&(y=wt("prehashed msgHash",T(y)));const G=L(y),J=f(O),K=[w(J),w(G)];if(W!=null&&W!==!1){const fe=W===!0?B(n.BYTES):W;K.push(wt("extraEntropy",fe))}const _=Ds(...K),ne=G;function be(fe){const xe=F(fe);if(!d(xe))return;const ye=c(xe),Y=u.BASE.multiply(xe).toAffine(),H=a(Y.x);if(H===bn)return;const ee=a(ye*a(ne+H*J));if(ee===bn)return;let Q=(Y.x===H?0:2)|Number(Y.y&Be),ve=ee;return R&&h(ee)&&(ve=b(ee),Q^=1),new P(H,ve,Q)}return{seed:_,k2sig:be}}const $={lowS:t.lowS,prehash:!1},I={lowS:t.lowS,prehash:!1};function A(y,O,M=$){const{seed:T,k2sig:B}=S(y,O,M),R=t;return Ty(R.hash.outputLen,R.nByteLength,R.hmac)(T,B)}u.BASE._setWindowSize(8);function k(y,O,M,T=I){var Q;const B=y;O=wt("msgHash",O),M=wt("publicKey",M);const{lowS:R,prehash:z,format:W}=T;if(d0(T),"strict"in T)throw new Error("options.strict was renamed to lowS");if(W!==void 0&&W!=="compact"&&W!=="der")throw new Error("format must be compact or der");const G=typeof B=="string"||Ro(B),J=!G&&!W&&typeof B=="object"&&B!==null&&typeof B.r=="bigint"&&typeof B.s=="bigint";if(!G&&!J)throw new Error("invalid signature, expected Uint8Array, hex string or Signature instance");let K,_;try{if(J&&(K=new P(B.r,B.s)),G){try{W!=="compact"&&(K=P.fromDER(B))}catch(ve){if(!(ve instanceof mn.Err))throw ve}!K&&W!=="der"&&(K=P.fromCompact(B))}_=u.fromHex(M)}catch{return!1}if(!K||R&&K.hasHighS())return!1;z&&(O=t.hash(O));const{r:ne,s:be}=K,fe=L(O),xe=c(be),ye=a(fe*xe),Y=a(ne*xe),H=(Q=u.BASE.multiplyAndAddUnsafe(_,ye,Y))==null?void 0:Q.toAffine();return H?a(H.x)===ne:!1}return{CURVE:t,getPublicKey:E,getSharedSecret:D,sign:A,verify:k,ProjectivePoint:u,Signature:P,utils:x}}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */function v6(e){return{hash:e,hmac:(t,...n)=>Ud(e,t,j1(...n)),randomBytes:z1}}function w6(e,t){const n=r=>y6({...e,...v6(r)});return{...n(t),create:n}}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const p0=BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),h0=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),x6=BigInt(0),E6=BigInt(1),yl=BigInt(2),m0=(e,t)=>(e+t/yl)/t;function S6(e){const t=p0,n=BigInt(3),r=BigInt(6),o=BigInt(11),s=BigInt(22),i=BigInt(23),l=BigInt(44),a=BigInt(88),c=e*e*e%t,u=c*c*e%t,f=xt(u,n,t)*u%t,p=xt(f,n,t)*u%t,d=xt(p,yl,t)*c%t,h=xt(d,o,t)*d%t,b=xt(h,s,t)*h%t,v=xt(b,l,t)*b%t,P=xt(v,a,t)*v%t,x=xt(P,l,t)*b%t,E=xt(x,n,t)*u%t,N=xt(E,i,t)*h%t,D=xt(N,r,t)*c%t,F=xt(D,yl,t);if(!vl.eql(vl.sqr(F),e))throw new Error("Cannot find square root");return F}const vl=ul(p0,void 0,void 0,{sqrt:S6}),b0=w6({a:x6,b:BigInt(7),Fp:vl,n:h0,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),h:BigInt(1),lowS:!0,endo:{beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar:e=>{const t=h0,n=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),r=-E6*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),o=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),s=n,i=BigInt("0x100000000000000000000000000000000"),l=m0(s*e,t),a=m0(-r*e,t);let c=tt(e-l*n-a*o,t),u=tt(-l*r-a*s,t);const f=c>i,p=u>i;if(f&&(c=t-c),p&&(u=t-u),c>i||u>i)throw new Error("splitScalar: Endomorphism failed, k="+e);return{k1neg:f,k1:c,k2neg:p,k2:u}}}},Of),P6=Object.freeze(Object.defineProperty({__proto__:null,secp256k1:b0},Symbol.toStringTag,{value:"Module"}));function g0(e,t={}){const{recovered:n}=t;if(typeof e.r>"u")throw new xl({signature:e});if(typeof e.s>"u")throw new xl({signature:e});if(n&&typeof e.yParity>"u")throw new xl({signature:e});if(e.r<0n||e.r>Gd)throw new $6({value:e.r});if(e.s<0n||e.s>Gd)throw new k6({value:e.s});if(typeof e.yParity=="number"&&e.yParity!==0&&e.yParity!==1)throw new El({value:e.yParity})}function T6(e){return y0(Rt(e))}function y0(e){if(e.length!==130&&e.length!==132)throw new I6({signature:e});const t=BigInt(Yt(e,0,32)),n=BigInt(Yt(e,32,64)),r=(()=>{const o=+`0x${e.slice(130)}`;if(!Number.isNaN(o))try{return wl(o)}catch{throw new El({value:o})}})();return typeof r>"u"?{r:t,s:n}:{r:t,s:n,yParity:r}}function A6(e){if(!(typeof e.r>"u")&&!(typeof e.s>"u"))return N6(e)}function N6(e){const t=typeof e=="string"?y0(e):e instanceof Uint8Array?T6(e):typeof e.r=="string"?O6(e):e.v?C6(e):{r:e.r,s:e.s,...typeof e.yParity<"u"?{yParity:e.yParity}:{}};return g0(t),t}function C6(e){return{r:e.r,s:e.s,yParity:wl(e.v)}}function O6(e){const t=(()=>{const n=e.v?Number(e.v):void 0;let r=e.yParity?Number(e.yParity):void 0;if(typeof n=="number"&&typeof r!="number"&&(r=wl(n)),typeof r!="number")throw new El({value:e.yParity});return r})();return{r:BigInt(e.r),s:BigInt(e.s),yParity:t}}function wl(e){if(e===0||e===27)return 0;if(e===1||e===28)return 1;if(e>=35)return e%2===0?1:0;throw new M6({value:e})}class I6 extends oe{constructor({signature:t}){super(`Value \`${t}\` is an invalid signature size.`,{metaMessages:["Expected: 64 bytes or 65 bytes.",`Received ${dt(Yy(t))} bytes.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Signature.InvalidSerializedSizeError"})}}class xl extends oe{constructor({signature:t}){super(`Signature \`${Yf(t)}\` is missing either an \`r\`, \`s\`, or \`yParity\` property.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Signature.MissingPropertiesError"})}}class $6 extends oe{constructor({value:t}){super(`Value \`${t}\` is an invalid r value. r must be a positive integer less than 2^256.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Signature.InvalidRError"})}}class k6 extends oe{constructor({value:t}){super(`Value \`${t}\` is an invalid s value. s must be a positive integer less than 2^256.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Signature.InvalidSError"})}}class El extends oe{constructor({value:t}){super(`Value \`${t}\` is an invalid y-parity value. Y-parity must be 0 or 1.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Signature.InvalidYParityError"})}}class M6 extends oe{constructor({value:t}){super(`Value \`${t}\` is an invalid v value. v must be 27, 28 or >=35.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Signature.InvalidVError"})}}function D6(e,t={}){return typeof e.chainId=="string"?B6(e):{...e,...t.signature}}function B6(e){const{address:t,chainId:n,nonce:r}=e,o=A6(e);return{address:t,chainId:Number(n),nonce:BigInt(r),...o}}const L6="0x8010801080108010801080108010801080108010801080108010801080108010",F6=Zd("(uint256 chainId, address delegation, uint256 nonce, uint8 yParity, uint256 r, uint256 s), address to, bytes data");function v0(e){if(typeof e=="string"){if(Yt(e,-32)!==L6)throw new z6(e)}else g0(e.authorization)}function R6(e){v0(e);const t=td(Yt(e,-64,-32)),n=Yt(e,-t-64,-64),r=Yt(e,0,-t-64),[o,s,i]=Yw(F6,n);return{authorization:D6({address:o.delegation,chainId:Number(o.chainId),nonce:o.nonce,yParity:o.yParity,r:o.r,s:o.s}),signature:r,...i&&i!=="0x"?{data:i,to:s}:{}}}function j6(e){try{return v0(e),!0}catch{return!1}}let z6=class extends oe{constructor(t){super(`Value \`${t}\` is an invalid ERC-8010 wrapped signature.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"SignatureErc8010.InvalidWrappedSignatureError"})}};class U6 extends V{constructor({value:t}){super(`Number \`${t}\` is not a valid decimal number.`,{name:"InvalidDecimalNumberError"})}}function W6(e,t){if(!/^(-?)([0-9]*)\.?([0-9]*)$/.test(e))throw new U6({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,l]=[r.slice(0,t-1),r.slice(t-1,t),r.slice(t)],a=Math.round(+`${i}.${l}`);a>9?r=`${BigInt(s)+BigInt(1)}0`.padStart(s.length+1,"0"):r=`${s}${a}`,r.length>t&&(r=r.slice(1),n=`${BigInt(n)+1n}`),r=r.slice(0,t)}else r=r.padEnd(t,"0");return BigInt(`${o?"-":""}${n}${r}`)}function _6(e){return e.map(t=>({...t,value:BigInt(t.value)}))}function V6(e){return{...e,balance:e.balance?BigInt(e.balance):void 0,nonce:e.nonce?ln(e.nonce):void 0,storageProof:e.storageProof?_6(e.storageProof):void 0}}async function H6(e,{address:t,blockNumber:n,blockTag:r,storageKeys:o}){const s=r??"latest",i=n!==void 0?re(n):void 0,l=await e.request({method:"eth_getProof",params:[t,o,i||s]});return V6(l)}async function G6(e,{address:t,blockNumber:n,blockTag:r="latest",slot:o}){const s=n!==void 0?re(n):void 0;return await e.request({method:"eth_getStorageAt",params:[t,o,s||r]})}async function Sl(e,{blockHash:t,blockNumber:n,blockTag:r,hash:o,index:s,sender:i,nonce:l}){var p,d,h;const a=r||"latest",c=n!==void 0?re(n):void 0;let u=null;if(o?u=await e.request({method:"eth_getTransactionByHash",params:[o]},{dedupe:!0}):t?u=await e.request({method:"eth_getTransactionByBlockHashAndIndex",params:[t,re(s)]},{dedupe:!0}):typeof s=="number"?u=await e.request({method:"eth_getTransactionByBlockNumberAndIndex",params:[c||a,re(s)]},{dedupe:!!c}):i&&typeof l=="number"&&(u=await e.request({method:"eth_getTransactionBySenderAndNonce",params:[i,re(l)]},{dedupe:!0})),!u)throw new cf({blockHash:t,blockNumber:n,blockTag:a,hash:o,index:s});return(((h=(d=(p=e.chain)==null?void 0:p.formatters)==null?void 0:d.transaction)==null?void 0:h.format)||wa)(u,"getTransaction")}async function q6(e,{hash:t,transactionReceipt:n}){const[r,o]=await Promise.all([te(e,Vo,"getBlockNumber")({}),t?te(e,Sl,"getTransaction")({hash:t}):void 0]),s=(n==null?void 0:n.blockNumber)||(o==null?void 0:o.blockNumber);return s?r-s+1n:0n}async function Hs(e,{hash:t}){var o,s,i;const n=await e.request({method:"eth_getTransactionReceipt",params:[t]},{dedupe:!0});if(!n)throw new uf({hash:t});return(((i=(s=(o=e.chain)==null?void 0:o.formatters)==null?void 0:s.transactionReceipt)==null?void 0:i.format)||wd)(n,"getTransactionReceipt")}async function K6(e,t){var x;const{account:n,authorizationList:r,allowFailure:o=!0,blockNumber:s,blockOverrides:i,blockTag:l,stateOverride:a}=t,c=t.contracts,{batchSize:u=t.batchSize??1024,deployless:f=t.deployless??!1}=typeof((x=e.batch)==null?void 0:x.multicall)=="object"?e.batch.multicall:{},p=(()=>{if(t.multicallAddress)return t.multicallAddress;if(f)return null;if(e.chain)return Dr({blockNumber:s,chain:e.chain,contract:"multicall3"});throw new Error("client chain not configured. multicallAddress is required.")})(),d=[[]];let h=0,b=0;for(let E=0;E<c.length;E++){const{abi:N,address:D,args:F,functionName:L}=c[E];try{const m=vt({abi:N,args:F,functionName:L});b+=(m.length-2)/2,u>0&&b>u&&d[h].length>0&&(h++,b=(m.length-2)/2,d[h]=[]),d[h]=[...d[h],{allowFailure:!0,callData:m,target:D}]}catch(m){const w=Nr(m,{abi:N,address:D,args:F,docsPath:"/docs/contract/multicall",functionName:L,sender:n});if(!o)throw w;d[h]=[...d[h],{allowFailure:!0,callData:"0x",target:D}]}}const v=await Promise.allSettled(d.map(E=>te(e,jt,"readContract")({...p===null?{code:Ra}:{address:p},abi:kr,account:n,args:[E],authorizationList:r,blockNumber:s,blockOverrides:i,blockTag:l,functionName:"aggregate3",stateOverride:a}))),P=[];for(let E=0;E<v.length;E++){const N=v[E];if(N.status==="rejected"){if(!o)throw N.reason;for(let F=0;F<d[E].length;F++)P.push({status:"failure",error:N.reason,result:void 0});continue}const D=N.value;for(let F=0;F<D.length;F++){const{returnData:L,success:m}=D[F],{callData:w}=d[E][F],{abi:S,address:$,functionName:I,args:A}=c[P.length];try{if(w==="0x")throw new ro;if(!m)throw new As({data:L});const k=Mn({abi:S,args:A,data:L,functionName:I});P.push(o?{result:k,status:"success"}:k)}catch(k){const y=Nr(k,{abi:S,address:$,args:A,docsPath:"/docs/contract/multicall",functionName:I});if(!o)throw y;P.push({error:y,result:void 0,status:"failure"})}}}if(P.length!==c.length)throw new V("multicall results mismatch");return P}async function Pl(e,t){const{blockNumber:n,blockTag:r=e.experimental_blockTag??"latest",blocks:o,returnFullTransactions:s,traceTransfers:i,validation:l}=t;try{const a=[];for(const p of o){const d=p.blockOverrides?id(p.blockOverrides):void 0,h=p.calls.map(v=>{const P=v,x=P.account?ft(P.account):void 0,E=P.abi?vt(P):P.data,N={...P,account:x,data:P.dataSuffix?Bt([E||"0x",P.dataSuffix]):E,from:P.from??(x==null?void 0:x.address)};return Or(N),Lo(N)}),b=p.stateOverrides?ya(p.stateOverrides):void 0;a.push({blockOverrides:d,calls:h,stateOverrides:b})}const u=(typeof n=="bigint"?re(n):void 0)||r;return(await e.request({method:"eth_simulateV1",params:[{blockStateCalls:a,returnFullTransactions:s,traceTransfers:i,validation:l},u]})).map((p,d)=>({...Pf(p),calls:p.calls.map((h,b)=>{var S,$;const{abi:v,args:P,functionName:x,to:E}=o[d].calls[b],N=((S=h.error)==null?void 0:S.data)??h.returnData,D=BigInt(h.gasUsed),F=($=h.logs)==null?void 0:$.map(I=>Zt(I)),L=h.status==="0x1"?"success":"failure",m=v&&L==="success"&&N!=="0x"?Mn({abi:v,data:N,functionName:x}):null,w=(()=>{if(L==="success")return;let I;if(N==="0x"?I=new ro:N&&(I=new As({data:N})),!!I)return Nr(I,{abi:v??[],address:E??"0x",args:P,functionName:x??"<unknown>"})})();return{data:N,gasUsed:D,logs:F,status:L,...L==="success"?{result:m}:{error:w}}})}))}catch(a){const c=a,u=Os(c,{});throw u instanceof Bo?c:u}}function Tl(e){let t=!0,n="",r=0,o="",s=!1;for(let i=0;i<e.length;i++){const l=e[i];if(["(",")",","].includes(l)&&(t=!0),l==="("&&r++,l===")"&&r--,!!t){if(r===0){if(l===" "&&["event","function","error",""].includes(o))o="";else if(o+=l,l===")"){s=!0;break}continue}if(l===" "){e[i-1]!==","&&n!==","&&n!==",("&&(n="",t=!1);continue}o+=l,n+=l}}if(!s)throw new oe("Unable to normalize signature.");return o}function Al(e,t){const n=typeof e,r=t.type;switch(r){case"address":return tl(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)=>Al(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=>Al(o,{...t,type:r.replace(/(\[[0-9]{0,}\])$/,"")})):!1}}function w0(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 w0(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")?tl(n[r],{strict:!1}):i.includes("address")&&i.includes("bytes")?tl(n[r],{strict:!1}):!1)return i}}function x0(e,t={}){const{prepare:n=!0}=t,r=Array.isArray(e)||typeof e=="string"?yu(e):e;return{...r,...n?{hash:Fr(r)}:{}}}function Gs(e,t,n){const{args:r=[],prepare:o=!0}=n??{},s=Xy(t,{strict:!1}),i=e.filter(c=>s?c.type==="function"||c.type==="error"?E0(c)===Yt(t,0,4):c.type==="event"?Fr(c)===t:!1:"name"in c&&c.name===t);if(i.length===0)throw new qs({name:t});if(i.length===1)return{...i[0],...o?{hash:Fr(i[0])}:{}};let l;for(const c of i){if(!("inputs"in c))continue;if(!r||r.length===0){if(!c.inputs||c.inputs.length===0)return{...c,...o?{hash:Fr(c)}:{}};continue}if(!c.inputs||c.inputs.length===0||c.inputs.length!==r.length)continue;if(r.every((f,p)=>{const d="inputs"in c&&c.inputs[p];return d?Al(f,d):!1})){if(l&&"inputs"in l&&l.inputs){const f=w0(c.inputs,l.inputs,r);if(f)throw new Y6({abiItem:c,type:f[0]},{abiItem:l,type:f[1]})}l=c}}const a=(()=>{if(l)return l;const[c,...u]=i;return{...c,overloads:u}})();if(!a)throw new qs({name:t});return{...a,...o?{hash:Fr(a)}:{}}}function E0(...e){const t=(()=>{if(Array.isArray(e[0])){const[n,r]=e;return Gs(n,r)}return e[0]})();return Yt(Fr(t),0,4)}function Z6(...e){const t=(()=>{if(Array.isArray(e[0])){const[r,o]=e;return Gs(r,o)}return e[0]})(),n=typeof t=="string"?t:bs(t);return Tl(n)}function Fr(...e){const t=(()=>{if(Array.isArray(e[0])){const[n,r]=e;return Gs(n,r)}return e[0]})();return typeof t!="string"&&"hash"in t&&t.hash?t.hash:Wd(La(Z6(t)))}class Y6 extends oe{constructor(t,n){super("Found ambiguous types in overloaded ABI Items.",{metaMessages:[`\`${t.type}\` in \`${Tl(bs(t.abiItem))}\`, and`,`\`${n.type}\` in \`${Tl(bs(n.abiItem))}\``,"","These types encode differently and cannot be distinguished at runtime.","Remove one of the ambiguous items in the ABI."]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiItem.AmbiguityError"})}}class qs extends oe{constructor({name:t,data:n,type:r="item"}){const o=t?` with name "${t}"`:n?` with data "${n}"`:"";super(`ABI ${r}${o} not found.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiItem.NotFoundError"})}}function X6(...e){var s;const[t,n]=(()=>{if(Array.isArray(e[0])){const[i,l]=e;return[Q6(i),l]}return e})(),{bytecode:r,args:o}=n;return Ft(r,(s=t.inputs)!=null&&s.length&&(o!=null&&o.length)?il(t.inputs,o):"0x")}function J6(e){return x0(e)}function Q6(e){const t=e.find(n=>n.type==="constructor");if(!t)throw new qs({name:"constructor"});return t}function e5(...e){const[t,n=[]]=(()=>{if(Array.isArray(e[0])){const[c,u,f]=e;return[S0(c,u,{args:f}),f]}const[l,a]=e;return[l,a]})(),{overloads:r}=t,o=r?S0([t,...r],t.name,{args:n}):t,s=t5(o),i=n.length>0?il(o.inputs,n):void 0;return i?Ft(s,i):s}function Rr(e,t={}){return x0(e,t)}function S0(e,t,n){const r=Gs(e,t,n);if(r.type!=="function")throw new qs({name:t,type:"function"});return r}function t5(e){return E0(e)}const n5="0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",zt="0x0000000000000000000000000000000000000000",r5="0x6080604052348015600e575f80fd5b5061016d8061001c5f395ff3fe608060405234801561000f575f80fd5b5060043610610029575f3560e01c8063f8b2cb4f1461002d575b5f80fd5b610047600480360381019061004291906100db565b61005d565b604051610054919061011e565b60405180910390f35b5f8173ffffffffffffffffffffffffffffffffffffffff16319050919050565b5f80fd5b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f6100aa82610081565b9050919050565b6100ba816100a0565b81146100c4575f80fd5b50565b5f813590506100d5816100b1565b92915050565b5f602082840312156100f0576100ef61007d565b5b5f6100fd848285016100c7565b91505092915050565b5f819050919050565b61011881610106565b82525050565b5f6020820190506101315f83018461010f565b9291505056fea26469706673582212203b9fe929fe995c7cf9887f0bdba8a36dd78e8b73f149b17d2d9ad7cd09d2dc6264736f6c634300081a0033";async function o5(e,t){const{blockNumber:n,blockTag:r,calls:o,stateOverrides:s,traceAssetChanges:i,traceTransfers:l,validation:a}=t,c=t.account?ft(t.account):void 0;if(i&&!c)throw new V("`account` is required when `traceAssetChanges` is true");const u=c?X6(J6("constructor(bytes, bytes)"),{bytecode:pd,args:[r5,e5(Rr("function getBalance(address)"),[c.address])]}):void 0,f=i?await Promise.all(t.calls.map(async T=>{if(!T.data&&!T.abi)return;const{accessList:B}=await Od(e,{account:c.address,...T,data:T.abi?vt(T):T.data});return B.map(({address:R,storageKeys:z})=>z.length>0?R:null)})).then(T=>T.flat().filter(Boolean)):[],p=await Pl(e,{blockNumber:n,blockTag:r,blocks:[...i?[{calls:[{data:u}],stateOverrides:s},{calls:f.map((T,B)=>({abi:[Rr("function balanceOf(address) returns (uint256)")],functionName:"balanceOf",args:[c.address],to:T,from:zt,nonce:B})),stateOverrides:[{address:zt,nonce:0}]}]:[],{calls:[...o,{to:zt}].map(T=>({...T,from:c==null?void 0:c.address})),stateOverrides:s},...i?[{calls:[{data:u}]},{calls:f.map((T,B)=>({abi:[Rr("function balanceOf(address) returns (uint256)")],functionName:"balanceOf",args:[c.address],to:T,from:zt,nonce:B})),stateOverrides:[{address:zt,nonce:0}]},{calls:f.map((T,B)=>({to:T,abi:[Rr("function decimals() returns (uint256)")],functionName:"decimals",from:zt,nonce:B})),stateOverrides:[{address:zt,nonce:0}]},{calls:f.map((T,B)=>({to:T,abi:[Rr("function tokenURI(uint256) returns (string)")],functionName:"tokenURI",args:[0n],from:zt,nonce:B})),stateOverrides:[{address:zt,nonce:0}]},{calls:f.map((T,B)=>({to:T,abi:[Rr("function symbol() returns (string)")],functionName:"symbol",from:zt,nonce:B})),stateOverrides:[{address:zt,nonce:0}]}]:[]],traceTransfers:l,validation:a}),d=i?p[2]:p[0],[h,b,,v,P,x,E,N]=i?p:[],{calls:D,...F}=d,L=D.slice(0,-1)??[],m=(h==null?void 0:h.calls)??[],w=(b==null?void 0:b.calls)??[],S=[...m,...w].map(T=>T.status==="success"?Gt(T.data):null),$=(v==null?void 0:v.calls)??[],I=(P==null?void 0:P.calls)??[],A=[...$,...I].map(T=>T.status==="success"?Gt(T.data):null),k=((x==null?void 0:x.calls)??[]).map(T=>T.status==="success"?T.result:null),y=((N==null?void 0:N.calls)??[]).map(T=>T.status==="success"?T.result:null),O=((E==null?void 0:E.calls)??[]).map(T=>T.status==="success"?T.result:null),M=[];for(const[T,B]of A.entries()){const R=S[T];if(typeof B!="bigint"||typeof R!="bigint")continue;const z=k[T-1],W=y[T-1],G=O[T-1],J=T===0?{address:n5,decimals:18,symbol:"ETH"}:{address:f[T-1],decimals:G||z?Number(z??1):void 0,symbol:W??void 0};M.some(K=>K.token.address===J.address)||M.push({token:J,value:{pre:R,post:B,diff:B-R}})}return{assetChanges:M,block:F,results:L}}const P0="0x6492649264926492649264926492649264926492649264926492649264926492";function s5(e){if(Yt(e,-32)!==P0)throw new l5(e)}function i5(e){const{data:t,signature:n,to:r}=e;return Ft(il(Zd("address, bytes, bytes"),[r,t,n]),P0)}function a5(e){try{return s5(e),!0}catch{return!1}}class l5 extends oe{constructor(t){super(`Value \`${t}\` is an invalid ERC-6492 wrapped signature.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"SignatureErc6492.InvalidWrappedSignatureError"})}}function c5({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 b0.Signature(Gt(e),Gt(t)).toCompactHex()}${s===0?"1b":"1c"}`;return n==="hex"?i:qt(i)}async function Ks(e,t){var a,c,u,f;const{address:n,chain:r=e.chain,hash:o,erc6492VerifierAddress:s=t.universalSignatureVerifierAddress??((c=(a=r==null?void 0:r.contracts)==null?void 0:a.erc6492Verifier)==null?void 0:c.address),multicallAddress:i=t.multicallAddress??((f=(u=r==null?void 0:r.contracts)==null?void 0:u.multicall3)==null?void 0:f.address)}=t;if(r!=null&&r.verifyHash)return await r.verifyHash(e,t);const l=(()=>{const p=t.signature;return Mt(p)?p:typeof p=="object"&&"r"in p&&"s"in p?c5(p):ke(p)})();try{return j6(l)?await u5(e,{...t,multicallAddress:i,signature:l}):await f5(e,{...t,verifierAddress:s,signature:l})}catch(p){try{if(Fo(un(n),await mf({hash:o,signature:l})))return!0}catch{}if(p instanceof or)return!1;throw p}}async function u5(e,t){var v;const{address:n,blockNumber:r,blockTag:o,hash:s,multicallAddress:i}=t,{authorization:l,data:a,signature:c,to:u}=R6(t.signature);if(await Ws(e,{address:n,blockNumber:r,blockTag:o})===Sr(["0xef0100",l.address]))return await d5(e,{address:n,blockNumber:r,blockTag:o,hash:s,signature:c});const p={address:l.address,chainId:Number(l.chainId),nonce:Number(l.nonce),r:re(l.r,{size:32}),s:re(l.s,{size:32}),yParity:l.yParity};if(!await Jv({address:n,authorization:p}))throw new or;const h=await te(e,jt,"readContract")({...i?{address:i}:{code:Ra},authorizationList:[p],abi:kr,blockNumber:r,blockTag:"pending",functionName:"aggregate3",args:[[...a?[{allowFailure:!0,target:u??n,callData:a}]:[],{allowFailure:!0,target:n,callData:vt({abi:fd,functionName:"isValidSignature",args:[s,c]})}]]}),b=(v=h[h.length-1])==null?void 0:v.returnData;if(b!=null&&b.startsWith("0x1626ba7e"))return!0;throw new or}async function f5(e,t){const{address:n,factory:r,factoryData:o,hash:s,signature:i,verifierAddress:l,...a}=t,c=await(async()=>!r&&!o||a5(i)?i:i5({data:o,signature:i,to:r}))(),u=l?{to:l,data:vt({abi:dd,functionName:"isValidSig",args:[n,s,c]}),...a}:{data:Ua({abi:dd,args:[n,s,c],bytecode:ov}),...a},{data:f}=await te(e,Br,"call")(u).catch(p=>{throw p instanceof ff?new or:p});if(w1(f??"0x0"))return!0;throw new or}async function d5(e,t){const{address:n,blockNumber:r,blockTag:o,hash:s,signature:i}=t;if((await te(e,jt,"readContract")({address:n,abi:fd,args:[s,i],blockNumber:r,blockTag:o,functionName:"isValidSignature"}).catch(a=>{throw a instanceof df?new or:a})).startsWith("0x1626ba7e"))return!0;throw new or}class or extends Error{}async function p5(e,{address:t,message:n,factory:r,factoryData:o,signature:s,...i}){const l=Bd(n);return te(e,Ks,"verifyHash")({address:t,factory:r,factoryData:o,hash:l,signature:s,...i})}async function h5(e,t){const{address:n,factory:r,factoryData:o,signature:s,message:i,primaryType:l,types:a,domain:c,...u}=t,f=xw({message:i,primaryType:l,types:a,domain:c});return te(e,Ks,"verifyHash")({address:n,factory:r,factoryData:o,hash:f,signature:s,...u})}function T0(e,{emitOnBegin:t=!1,emitMissed:n=!1,onBlockNumber:r,onError:o,poll:s,pollingInterval:i=e.pollingInterval}){const l=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 l?(()=>{const f=Me(["watchBlockNumber",e.uid,t,n,i]);return Dn(f,{onBlockNumber:r,onError:o},p=>_o(async()=>{var d;try{const h=await te(e,Vo,"getBlockNumber")({cacheTime:0});if(a!==void 0){if(h===a)return;if(h-a>1&&n)for(let b=a+1n;b<h;b++)p.onBlockNumber(b,a),a=b}(a===void 0||h>a)&&(p.onBlockNumber(h,a),a=h)}catch(h){(d=p.onError)==null||d.call(p,h)}},{emitOnBegin:t,interval:i}))})():(()=>{const f=Me(["watchBlockNumber",e.uid,t,n]);return Dn(f,{onBlockNumber:r,onError:o},p=>{let d=!0,h=()=>d=!1;return(async()=>{try{const b=(()=>{if(e.transport.type==="fallback"){const P=e.transport.transports.find(x=>x.config.type==="webSocket"||x.config.type==="ipc");return P?P.value:e.transport}return e.transport})(),{unsubscribe:v}=await b.subscribe({params:["newHeads"],onData(P){var E;if(!d)return;const x=Gt((E=P.result)==null?void 0:E.number);p.onBlockNumber(x,a),a=x},onError(P){var x;(x=p.onError)==null||x.call(p,P)}});h=v,d||h()}catch(b){o==null||o(b)}})(),()=>h()})})()}async function m5(e,t){const{checkReplacement:n=!0,confirmations:r=1,hash:o,onReplaced:s,retryCount:i=6,retryDelay:l=({count:D})=>~~(1<<D)*200,timeout:a=18e4}=t,c=Me(["waitForTransactionReceipt",e.uid,o]),u=(()=>{var D;return t.pollingInterval?t.pollingInterval:(D=e.chain)!=null&&D.experimental_preconfirmationTime?e.chain.experimental_preconfirmationTime:e.pollingInterval})();let f,p,d,h=!1,b,v;const{promise:P,resolve:x,reject:E}=bd(),N=a?setTimeout(()=>{v==null||v(),b==null||b(),E(new Bg({hash:o}))},a):void 0;return b=Dn(c,{onReplaced:s,resolve:x,reject:E},async D=>{if(d=await te(e,Hs,"getTransactionReceipt")({hash:o}).catch(()=>{}),d&&r<=1){clearTimeout(N),D.resolve(d),b==null||b();return}v=te(e,T0,"watchBlockNumber")({emitMissed:!0,emitOnBegin:!0,poll:!0,pollingInterval:u,async onBlockNumber(F){const L=w=>{clearTimeout(N),v==null||v(),w(),b==null||b()};let m=F;if(!h)try{if(d){if(r>1&&(!d.blockNumber||m-d.blockNumber+1n<r))return;L(()=>D.resolve(d));return}if(n&&!f&&(h=!0,await Ha(async()=>{f=await te(e,Sl,"getTransaction")({hash:o}),f.blockNumber&&(m=f.blockNumber)},{delay:l,retryCount:i}),h=!1),d=await te(e,Hs,"getTransactionReceipt")({hash:o}),r>1&&(!d.blockNumber||m-d.blockNumber+1n<r))return;L(()=>D.resolve(d))}catch(w){if(w instanceof cf||w instanceof uf){if(!f){h=!1;return}try{p=f,h=!0;const S=await Ha(()=>te(e,Lt,"getBlock")({blockNumber:m,includeTransactions:!0}),{delay:l,retryCount:i,shouldRetry:({error:A})=>A instanceof Ef});h=!1;const $=S.transactions.find(({from:A,nonce:k})=>A===p.from&&k===p.nonce);if(!$||(d=await te(e,Hs,"getTransactionReceipt")({hash:$.hash}),r>1&&(!d.blockNumber||m-d.blockNumber+1n<r)))return;let I="replaced";$.to===p.to&&$.value===p.value&&$.input===p.input?I="repriced":$.from===$.to&&$.value===0n&&(I="cancelled"),L(()=>{var A;(A=D.onReplaced)==null||A.call(D,{reason:I,replacedTransaction:p,transaction:$,transactionReceipt:d}),D.resolve(d)})}catch(S){L(()=>D.reject(S))}}else L(()=>D.reject(w))}}})}),P}function b5(e,{blockTag:t=e.experimental_blockTag??"latest",emitMissed:n=!1,emitOnBegin:r=!1,onBlock:o,onError:s,includeTransactions:i,poll:l,pollingInterval:a=e.pollingInterval}){const c=typeof l<"u"?l:!(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 c?(()=>{const h=Me(["watchBlocks",e.uid,t,n,r,u,a]);return Dn(h,{onBlock:o,onError:s},b=>_o(async()=>{var v;try{const P=await te(e,Lt,"getBlock")({blockTag:t,includeTransactions:u});if(P.number!==null&&(f==null?void 0:f.number)!=null){if(P.number===f.number)return;if(P.number-f.number>1&&n)for(let x=(f==null?void 0:f.number)+1n;x<P.number;x++){const E=await te(e,Lt,"getBlock")({blockNumber:x,includeTransactions:u});b.onBlock(E,f),f=E}}((f==null?void 0:f.number)==null||t==="pending"&&(P==null?void 0:P.number)==null||P.number!==null&&P.number>f.number)&&(b.onBlock(P,f),f=P)}catch(P){(v=b.onError)==null||v.call(b,P)}},{emitOnBegin:r,interval:a}))})():(()=>{let h=!0,b=!0,v=()=>h=!1;return(async()=>{try{r&&te(e,Lt,"getBlock")({blockTag:t,includeTransactions:u}).then(E=>{h&&b&&(o(E,void 0),b=!1)}).catch(s);const P=(()=>{if(e.transport.type==="fallback"){const E=e.transport.transports.find(N=>N.config.type==="webSocket"||N.config.type==="ipc");return E?E.value:e.transport}return e.transport})(),{unsubscribe:x}=await P.subscribe({params:["newHeads"],async onData(E){var D;if(!h)return;const N=await te(e,Lt,"getBlock")({blockNumber:(D=E.result)==null?void 0:D.number,includeTransactions:u}).catch(()=>{});h&&(o(N,f),b=!1,f=N)},onError(E){s==null||s(E)}});v=x,h||v()}catch(P){s==null||s(P)}})(),()=>v()})()}function g5(e,{address:t,args:n,batch:r=!0,event:o,events:s,fromBlock:i,onError:l,onLogs:a,poll:c,pollingInterval:u=e.pollingInterval,strict:f}){const p=typeof c<"u"?c:typeof i=="bigint"?!0:!(e.transport.type==="webSocket"||e.transport.type==="ipc"||e.transport.type==="fallback"&&(e.transport.transports[0].config.type==="webSocket"||e.transport.transports[0].config.type==="ipc")),d=f??!1;return p?(()=>{const v=Me(["watchEvent",t,n,r,e.uid,o,u,i]);return Dn(v,{onLogs:a,onError:l},P=>{let x;i!==void 0&&(x=i-1n);let E,N=!1;const D=_o(async()=>{var F;if(!N){try{E=await te(e,Id,"createEventFilter")({address:t,args:n,event:o,events:s,strict:d,fromBlock:i})}catch{}N=!0;return}try{let L;if(E)L=await te(e,Rs,"getFilterChanges")({filter:E});else{const m=await te(e,Vo,"getBlockNumber")({});x&&x!==m?L=await te(e,Ca,"getLogs")({address:t,args:n,event:o,events:s,fromBlock:x+1n,toBlock:m}):L=[],x=m}if(L.length===0)return;if(r)P.onLogs(L);else for(const m of L)P.onLogs([m])}catch(L){E&&L instanceof In&&(N=!1),(F=P.onError)==null||F.call(P,L)}},{emitOnBegin:!0,interval:u});return async()=>{E&&await te(e,js,"uninstallFilter")({filter:E}),D()}})})():(()=>{let v=!0,P=()=>v=!1;return(async()=>{try{const x=(()=>{if(e.transport.type==="fallback"){const F=e.transport.transports.find(L=>L.config.type==="webSocket"||L.config.type==="ipc");return F?F.value:e.transport}return e.transport})(),E=s??(o?[o]:void 0);let N=[];E&&(N=[E.flatMap(L=>lo({abi:[L],eventName:L.name,args:n}))],o&&(N=N[0]));const{unsubscribe:D}=await x.subscribe({params:["logs",{address:t,topics:N}],onData(F){var m;if(!v)return;const L=F.result;try{const{eventName:w,args:S}=$s({abi:E??[],data:L.data,topics:L.topics,strict:d}),$=Zt(L,{args:S,eventName:w});a([$])}catch(w){let S,$;if(w instanceof vs||w instanceof qi){if(f)return;S=w.abiItem.name,$=(m=w.abiItem.inputs)==null?void 0:m.some(A=>!("name"in A&&A.name))}const I=Zt(L,{args:$?[]:{},eventName:S});a([I])}},onError(F){l==null||l(F)}});P=D,v||P()}catch(x){l==null||l(x)}})(),()=>P()})()}function y5(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 c=Me(["watchPendingTransactions",e.uid,t,s]);return Dn(c,{onTransactions:r,onError:n},u=>{let f;const p=_o(async()=>{var d;try{if(!f)try{f=await te(e,$d,"createPendingTransactionFilter")({});return}catch(b){throw p(),b}const h=await te(e,Rs,"getFilterChanges")({filter:f});if(h.length===0)return;if(t)u.onTransactions(h);else for(const b of h)u.onTransactions([b])}catch(h){(d=u.onError)==null||d.call(u,h)}},{emitOnBegin:!0,interval:s});return async()=>{f&&await te(e,js,"uninstallFilter")({filter:f}),p()}})})():(()=>{let c=!0,u=()=>c=!1;return(async()=>{try{const{unsubscribe:f}=await e.transport.subscribe({params:["newPendingTransactions"],onData(p){if(!c)return;const d=p.result;r([d])},onError(p){n==null||n(p)}});u=f,c||u()}catch(f){n==null||n(f)}})(),()=>u()})()}function v5(e){var f,p,d;const{scheme:t,statement:n,...r}=((f=e.match(w5))==null?void 0:f.groups)??{},{chainId:o,expirationTime:s,issuedAt:i,notBefore:l,requestId:a,...c}=((p=e.match(x5))==null?void 0:p.groups)??{},u=(d=e.split("Resources:")[1])==null?void 0:d.split(`
91
+ - `).slice(1);return{...r,...c,...o?{chainId:Number(o)}:{},...s?{expirationTime:new Date(s)}:{},...i?{issuedAt:new Date(i)}:{},...l?{notBefore:new Date(l)}:{},...a?{requestId:a}:{},...u?{resources:u}:{},...t?{scheme:t}:{},...n?{statement:n}:{}}}const w5=/^(?:(?<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)?/,x5=/(?: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 E5(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||!yt(r.address,{strict:!1})||t&&!Fo(r.address,t))return!1}catch{return!1}return!0}async function S5(e,t){const{address:n,domain:r,message:o,nonce:s,scheme:i,signature:l,time:a=new Date,...c}=t,u=v5(o);if(!u.address||!E5({address:n,domain:r,message:u,nonce:s,scheme:i,time:a}))return!1;const p=Bd(o);return Ks(e,{address:u.address,hash:p,signature:l,...c})}async function P5(e,{serializedTransaction:t,throwOnReceiptRevert:n,timeout:r}){var l,a,c;const o=await e.request({method:"eth_sendRawTransactionSync",params:r?[t,r]:[t]},{retryCount:0}),i=(((c=(a=(l=e.chain)==null?void 0:l.formatters)==null?void 0:a.transactionReceipt)==null?void 0:c.format)||wd)(o);if(i.status==="reverted"&&n)throw new Dg({receipt:i});return i}function T5(e){return{call:t=>Br(e,t),createAccessList:t=>Od(e,t),createBlockFilter:()=>Uv(e),createContractEventFilter:t=>Qu(e,t),createEventFilter:t=>Id(e,t),createPendingTransactionFilter:()=>$d(e),estimateContractGas:t=>wy(e,t),estimateGas:t=>Aa(e,t),getBalance:t=>Wv(e,t),getBlobBaseFee:()=>_v(e),getBlock:t=>Lt(e,t),getBlockNumber:t=>Vo(e,t),getBlockTransactionCount:t=>Vv(e,t),getBytecode:t=>Ws(e,t),getChainId:()=>Pa(e),getCode:t=>Ws(e,t),getContractEvents:t=>Rf(e,t),getDelegation:t=>Hv(e,t),getEip712Domain:t=>qv(e,t),getEnsAddress:t=>Tv(e,t),getEnsAvatar:t=>Rv(e,t),getEnsName:t=>jv(e,t),getEnsResolver:t=>zv(e,t),getEnsText:t=>Cd(e,t),getFeeHistory:t=>Yv(e,t),estimateFeesPerGas:t=>ny(e,t),getFilterChanges:t=>Rs(e,t),getFilterLogs:t=>Xv(e,t),getGasPrice:()=>xa(e),getLogs:t=>Ca(e,t),getProof:t=>H6(e,t),estimateMaxPriorityFeePerGas:t=>ty(e,t),fillTransaction:t=>Df(e,t),getStorageAt:t=>G6(e,t),getTransaction:t=>Sl(e,t),getTransactionConfirmations:t=>q6(e,t),getTransactionCount:t=>Af(e,t),getTransactionReceipt:t=>Hs(e,t),multicall:t=>K6(e,t),prepareTransactionRequest:t=>Lf(e,t),readContract:t=>jt(e,t),sendRawTransaction:t=>gv(e,t),sendRawTransactionSync:t=>P5(e,t),simulate:t=>Pl(e,t),simulateBlocks:t=>Pl(e,t),simulateCalls:t=>o5(e,t),simulateContract:t=>cv(e,t),verifyHash:t=>Ks(e,t),verifyMessage:t=>p5(e,t),verifySiweMessage:t=>S5(e,t),verifyTypedData:t=>h5(e,t),uninstallFilter:t=>js(e,t),waitForTransactionReceipt:t=>m5(e,t),watchBlocks:t=>b5(e,t),watchBlockNumber:t=>T0(e,t),watchContractEvent:t=>bv(e,t),watchEvent:t=>g5(e,t),watchPendingTransactions:t=>y5(e,t)}}function A5(e){const{key:t="public",name:n="Public Client"}=e;return vv({...e,key:t,name:n,type:"publicClient"}).extend(T5)}function N5({key:e,methods:t,name:n,request:r,retryCount:o=3,retryDelay:s=150,timeout:i,type:l},a){const c=xd();return{config:{key:e,methods:t,name:n,request:r,retryCount:o,retryDelay:s,timeout:i,type:l},request:ew(r,{methods:t,retryCount:o,retryDelay:s,uid:c}),value:a}}class C5 extends V{constructor(){super("No URL was provided to the Transport. Please provide a valid RPC URL to the Transport.",{docsPath:"/docs/clients/intro",name:"UrlRequiredError"})}}function O5(e,t={}){const{batch:n,fetchFn:r,fetchOptions:o,key:s="http",methods:i,name:l="HTTP JSON-RPC",onFetchRequest:a,onFetchResponse:c,retryDelay:u,raw:f}=t;return({chain:p,retryCount:d,timeout:h})=>{const{batchSize:b=1e3,wait:v=0}=typeof n=="object"?n:{},P=t.retryCount??d,x=h??t.timeout??1e4,E=e||(p==null?void 0:p.rpcUrls.default.http[0]);if(!E)throw new C5;const N=fw(E,{fetchFn:r,fetchOptions:o,onRequest:a,onResponse:c,timeout:x});return N5({key:s,methods:i,name:l,async request({method:D,params:F}){const L={method:D,params:F},{schedule:m}=gd({id:E,wait:v,shouldSplitBatch(I){return I.length>b},fn:I=>N.request({body:I}),sort:(I,A)=>I.id-A.id}),w=async I=>n?m(I):[await N.request({body:I})],[{error:S,result:$}]=await w(L);if(f)return{error:S,result:$};if(S)throw new ca({body:L,error:S,url:E});return $},retryCount:P,retryDelay:u,timeout:x,type:"http"},{fetchOptions:o,url:E})}}const I5=lw({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 $5({client:e,tokenAddress:t,holder:n,decimals:r,fallbackFormatted:o="0",pollingInterval:s=12e3}){const[i,l]=g.useState(null),[a,c]=g.useState(o);return g.useEffect(()=>{let u,f;const p=async()=>{try{const d=await e.readContract({address:t,abi:Mr,functionName:"balanceOf",args:[n]});l(d),c(ia(d,r))}catch{c(o)}};p();try{u=e.watchContractEvent({address:t,abi:Mr,eventName:"Transfer",args:{to:n},onLogs:()=>{p()},poll:!0,pollingInterval:s}),f=e.watchContractEvent({address:t,abi:Mr,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 k5=()=>({openDeposit:g.useCallback(t=>{},[])}),M5=()=>({openWithdraw:g.useCallback(t=>{},[])}),gn="MPC",Zs="EVM";var ze=(e=>(e.SPOT="spot",e.PERPETUAL="perpetual",e.PERPETUALV2="perpetual_v2",e))(ze||{});const D5="spot",B5="perpetual";/**
92
92
  * @license lucide-react v0.540.0 - ISC
93
93
  *
94
94
  * This source code is licensed under the ISC license.
@@ -113,10 +113,10 @@ ${$g(d)}`),super(t.shortMessage,{cause:t,docsPath:r,metaMessages:[...t.metaMessa
113
113
  *
114
114
  * This source code is licensed under the ISC license.
115
115
  * See the LICENSE file in the root directory of this source tree.
116
- */const C0=U5("x",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]),_5=typeof document<"u"?g.useLayoutEffect:()=>{},Ln=e=>{var t;return(t=e==null?void 0:e.ownerDocument)!==null&&t!==void 0?t:document},sr=e=>e&&"window"in e&&e.window===e?e:Ln(e).defaultView||window;function W5(e){return e!==null&&typeof e=="object"&&"nodeType"in e&&typeof e.nodeType=="number"}function V5(e){return W5(e)&&e.nodeType===Node.DOCUMENT_FRAGMENT_NODE&&"host"in e}let H5=!1;function Nl(){return H5}function Fn(e,t){if(!Nl())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:V5(n)?n=n.host:n=n.parentNode}return!1}const jr=(e=document)=>{var t;if(!Nl())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 Ue(e){if(Nl()&&e.target instanceof Element&&e.target.shadowRoot){var t,n;if("composedPath"in e)return(t=e.composedPath()[0])!==null&&t!==void 0?t:null;if("composedPath"in e.nativeEvent)return(n=e.nativeEvent.composedPath()[0])!==null&&n!==void 0?n:null}return e.target}function G5(e){if(q5())e.focus({preventScroll:!0});else{let t=K5(e);e.focus(),Z5(t)}}let Ys=null;function q5(){if(Ys==null){Ys=!1;try{document.createElement("div").focus({get preventScroll(){return Ys=!0,!0}})}catch{}}return Ys}function K5(e){let t=e.parentNode,n=[],r=document.scrollingElement||document.documentElement;for(;t instanceof HTMLElement&&t!==r;)(t.offsetHeight<t.scrollHeight||t.offsetWidth<t.scrollWidth)&&n.push({element:t,scrollTop:t.scrollTop,scrollLeft:t.scrollLeft}),t=t.parentNode;return r instanceof HTMLElement&&n.push({element:r,scrollTop:r.scrollTop,scrollLeft:r.scrollLeft}),n}function Z5(e){for(let{element:t,scrollTop:n,scrollLeft:r}of e)t.scrollTop=n,t.scrollLeft=r}function Xs(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 Cl(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 yn(e){if(process.env.NODE_ENV==="test")return e;let t=null;return()=>(t==null&&(t=e()),t)}const qo=yn(function(){return Cl(/^Mac/i)}),Y5=yn(function(){return Cl(/^iPhone/i)}),O0=yn(function(){return Cl(/^iPad/i)||qo()&&navigator.maxTouchPoints>1}),X5=yn(function(){return Y5()||O0()});yn(function(){return qo()||X5()});const J5=yn(function(){return Xs(/AppleWebKit/i)&&!Q5()}),Q5=yn(function(){return Xs(/Chrome/i)}),ex=yn(function(){return Xs(/Android/i)}),tx=yn(function(){return Xs(/Firefox/i)});function Ko(e,t,n=!0){var r,o;let{metaKey:s,ctrlKey:i,altKey:l,shiftKey:a}=t;tx()&&(!((o=window.event)===null||o===void 0||(r=o.type)===null||r===void 0)&&r.startsWith("key"))&&e.target==="_blank"&&(qo()?s=!0:i=!0);let c=J5()&&qo()&&!O0()&&process.env.NODE_ENV!=="test"?new KeyboardEvent("keydown",{keyIdentifier:"Enter",metaKey:s,ctrlKey:i,altKey:l,shiftKey:a}):new MouseEvent("click",{metaKey:s,ctrlKey:i,altKey:l,shiftKey:a,detail:1,bubbles:!0,cancelable:!0});Ko.isOpening=n,G5(e),e.dispatchEvent(c),Ko.isOpening=!1}Ko.isOpening=!1;function I0(){let e=g.useRef(new Map),t=g.useCallback((o,s,i,l)=>{let a=l!=null&&l.once?(...c)=>{e.current.delete(i),i(...c)}:i;e.current.set(i,{type:s,eventTarget:o,fn:a,options:l}),o.addEventListener(s,a,l)},[]),n=g.useCallback((o,s,i,l)=>{var a;let c=((a=e.current.get(i))===null||a===void 0?void 0:a.fn)||i;o.removeEventListener(s,c,l),e.current.delete(i)},[]),r=g.useCallback(()=>{e.current.forEach((o,s)=>{n(o.eventTarget,o.type,s,o.options)})},[n]);return g.useEffect(()=>r,[r]),{addGlobalListener:t,removeGlobalListener:n,removeAllGlobalListeners:r}}function nx(e){return e.pointerType===""&&e.isTrusted?!0:ex()&&e.pointerType?e.type==="click"&&e.buttons===1:e.detail===0&&!e.pointerType}function $0(e){let t=e;return t.nativeEvent=e,t.isDefaultPrevented=()=>t.defaultPrevented,t.isPropagationStopped=()=>t.cancelBubble,t.persist=()=>{},t}function rx(e,t){Object.defineProperty(e,"target",{value:t}),Object.defineProperty(e,"currentTarget",{value:t})}function k0(e){let t=g.useRef({isFocused:!1,observer:null});return _5(()=>{const n=t.current;return()=>{n.observer&&(n.observer.disconnect(),n.observer=null)}},[]),g.useCallback(n=>{let r=Ue(n);if(r instanceof HTMLButtonElement||r instanceof HTMLInputElement||r instanceof HTMLTextAreaElement||r instanceof HTMLSelectElement){t.current.isFocused=!0;let o=r,s=i=>{if(t.current.isFocused=!1,o.disabled){let l=$0(i);e==null||e(l)}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 l=o===jr()?null:jr();o.dispatchEvent(new FocusEvent("blur",{relatedTarget:l})),o.dispatchEvent(new FocusEvent("focusout",{bubbles:!0,relatedTarget:l}))}}),t.current.observer.observe(o,{attributes:!0,attributeFilter:["disabled"]})}},[e])}let ox=!1,Zo=null;const Ol=new Set;let Yo=new Map,ir=!1,Il=!1;const sx={Tab:!0,Escape:!0};function $l(e,t){for(let n of Ol)n(e,t)}function ix(e){return!(e.metaKey||!qo()&&e.altKey||e.ctrlKey||e.key==="Control"||e.key==="Shift"||e.key==="Meta")}function Js(e){ir=!0,!Ko.isOpening&&ix(e)&&(Zo="keyboard",$l("keyboard",e))}function Et(e){Zo="pointer","pointerType"in e&&e.pointerType,(e.type==="mousedown"||e.type==="pointerdown")&&(ir=!0,$l("pointer",e))}function M0(e){!Ko.isOpening&&nx(e)&&(ir=!0,Zo="virtual")}function D0(e){Ue(e)===window||Ue(e)===document||ox||!e.isTrusted||(!ir&&!Il&&(Zo="virtual",$l("virtual",e)),ir=!1,Il=!1)}function B0(){ir=!1,Il=!0}function kl(e){if(typeof window>"u"||typeof document>"u"||Yo.get(sr(e)))return;const t=sr(e),n=Ln(e);let r=t.HTMLElement.prototype.focus;t.HTMLElement.prototype.focus=function(){ir=!0,r.apply(this,arguments)},n.addEventListener("keydown",Js,!0),n.addEventListener("keyup",Js,!0),n.addEventListener("click",M0,!0),t.addEventListener("focus",D0,!0),t.addEventListener("blur",B0,!1),typeof PointerEvent<"u"?(n.addEventListener("pointerdown",Et,!0),n.addEventListener("pointermove",Et,!0),n.addEventListener("pointerup",Et,!0)):process.env.NODE_ENV==="test"&&(n.addEventListener("mousedown",Et,!0),n.addEventListener("mousemove",Et,!0),n.addEventListener("mouseup",Et,!0)),t.addEventListener("beforeunload",()=>{L0(e)},{once:!0}),Yo.set(t,{focus:r})}const L0=(e,t)=>{const n=sr(e),r=Ln(e);t&&r.removeEventListener("DOMContentLoaded",t),Yo.has(n)&&(n.HTMLElement.prototype.focus=Yo.get(n).focus,r.removeEventListener("keydown",Js,!0),r.removeEventListener("keyup",Js,!0),r.removeEventListener("click",M0,!0),n.removeEventListener("focus",D0,!0),n.removeEventListener("blur",B0,!1),typeof PointerEvent<"u"?(r.removeEventListener("pointerdown",Et,!0),r.removeEventListener("pointermove",Et,!0),r.removeEventListener("pointerup",Et,!0)):process.env.NODE_ENV==="test"&&(r.removeEventListener("mousedown",Et,!0),r.removeEventListener("mousemove",Et,!0),r.removeEventListener("mouseup",Et,!0)),Yo.delete(n))};function ax(e){const t=Ln(e);let n;return t.readyState!=="loading"?kl(e):(n=()=>{kl(e)},t.addEventListener("DOMContentLoaded",n)),()=>L0(e,n)}typeof document<"u"&&ax();function Ml(){return Zo!=="pointer"}const lx=new Set(["checkbox","radio","range","color","file","image","button","submit","reset"]);function cx(e,t,n){let r=Ln(n?Ue(n):void 0),o=n?Ue(n):void 0;const s=typeof window<"u"?sr(o).HTMLInputElement:HTMLInputElement,i=typeof window<"u"?sr(o).HTMLTextAreaElement:HTMLTextAreaElement,l=typeof window<"u"?sr(o).HTMLElement:HTMLElement,a=typeof window<"u"?sr(o).KeyboardEvent:KeyboardEvent;let c=jr(r);return e=e||c instanceof s&&!lx.has(c.type)||c instanceof i||c instanceof l&&c.isContentEditable,!(e&&t==="keyboard"&&n instanceof a&&!sx[n.key])}function ux(e,t,n){kl(),g.useEffect(()=>{if((n==null?void 0:n.enabled)===!1)return;let r=(o,s)=>{cx(!!(n!=null&&n.isTextInput),o,s)&&e(Ml())};return Ol.add(r),()=>{Ol.delete(r)}},t)}function fx(e){let{isDisabled:t,onFocus:n,onBlur:r,onFocusChange:o}=e;const s=g.useCallback(a=>{if(Ue(a)===a.currentTarget)return r&&r(a),o&&o(!1),!0},[r,o]),i=k0(s),l=g.useCallback(a=>{let c=Ue(a);const u=Ln(c),f=u?jr(u):jr();c===a.currentTarget&&c===f&&(n&&n(a),o&&o(!0),i(a))},[o,n,i]);return{focusProps:{onFocus:!t&&(n||o||r)?l:void 0,onBlur:!t&&(r||o)?s:void 0}}}function dx(e){let{isDisabled:t,onBlurWithin:n,onFocusWithin:r,onFocusWithinChange:o}=e,s=g.useRef({isFocusWithin:!1}),{addGlobalListener:i,removeAllGlobalListeners:l}=I0(),a=g.useCallback(f=>{Fn(f.currentTarget,Ue(f))&&s.current.isFocusWithin&&!Fn(f.currentTarget,f.relatedTarget)&&(s.current.isFocusWithin=!1,l(),n&&n(f),o&&o(!1))},[n,o,s,l]),c=k0(a),u=g.useCallback(f=>{if(!Fn(f.currentTarget,Ue(f)))return;let p=Ue(f);const d=Ln(p),h=jr(d);if(!s.current.isFocusWithin&&h===p){r&&r(f),o&&o(!0),s.current.isFocusWithin=!0,c(f);let b=f.currentTarget;i(d,"focus",w=>{let P=Ue(w);if(s.current.isFocusWithin&&!Fn(b,P)){let x=new d.defaultView.FocusEvent("blur",{relatedTarget:P});rx(x,b);let E=$0(x);a(E)}},{capture:!0})}},[r,o,c,i,a]);return t?{focusWithinProps:{onFocus:void 0,onBlur:void 0}}:{focusWithinProps:{onFocus:u,onBlur:a}}}let Qs=!1,ei=0;function Dl(){Qs=!0,setTimeout(()=>{Qs=!1},50)}function F0(e){e.pointerType==="touch"&&Dl()}function px(){if(!(typeof document>"u"))return ei===0&&(typeof PointerEvent<"u"?document.addEventListener("pointerup",F0):process.env.NODE_ENV==="test"&&document.addEventListener("touchend",Dl)),ei++,()=>{ei--,!(ei>0)&&(typeof PointerEvent<"u"?document.removeEventListener("pointerup",F0):process.env.NODE_ENV==="test"&&document.removeEventListener("touchend",Dl))}}function hx(e){let{onHoverStart:t,onHoverChange:n,onHoverEnd:r,isDisabled:o}=e,[s,i]=g.useState(!1),l=g.useRef({isHovered:!1,ignoreEmulatedMouseEvents:!1,pointerType:"",target:null}).current;g.useEffect(px,[]);let{addGlobalListener:a,removeAllGlobalListeners:c}=I0(),{hoverProps:u,triggerHoverEnd:f}=g.useMemo(()=>{let p=(b,w)=>{if(l.pointerType=w,o||w==="touch"||l.isHovered||!Fn(b.currentTarget,Ue(b)))return;l.isHovered=!0;let P=b.currentTarget;l.target=P,a(Ln(Ue(b)),"pointerover",x=>{l.isHovered&&l.target&&!Fn(l.target,Ue(x))&&d(x,x.pointerType)},{capture:!0}),t&&t({type:"hoverstart",target:P,pointerType:w}),n&&n(!0),i(!0)},d=(b,w)=>{let P=l.target;l.pointerType="",l.target=null,!(w==="touch"||!l.isHovered||!P)&&(l.isHovered=!1,c(),r&&r({type:"hoverend",target:P,pointerType:w}),n&&n(!1),i(!1))},h={};return typeof PointerEvent<"u"?(h.onPointerEnter=b=>{Qs&&b.pointerType==="mouse"||p(b,b.pointerType)},h.onPointerLeave=b=>{!o&&Fn(b.currentTarget,Ue(b))&&d(b,b.pointerType)}):process.env.NODE_ENV==="test"&&(h.onTouchStart=()=>{l.ignoreEmulatedMouseEvents=!0},h.onMouseEnter=b=>{!l.ignoreEmulatedMouseEvents&&!Qs&&p(b,"mouse"),l.ignoreEmulatedMouseEvents=!1},h.onMouseLeave=b=>{!o&&Fn(b.currentTarget,Ue(b))&&d(b,"mouse")}),{hoverProps:h,triggerHoverEnd:d}},[t,n,r,o,l,a,c]);return g.useEffect(()=>{o&&f({currentTarget:l.target},l.pointerType)},[o]),{hoverProps:u,isHovered:s}}function mx(e={}){let{autoFocus:t=!1,isTextInput:n,within:r}=e,o=g.useRef({isFocused:!1,isFocusVisible:t||Ml()}),[s,i]=g.useState(!1),[l,a]=g.useState(()=>o.current.isFocused&&o.current.isFocusVisible),c=g.useCallback(()=>a(o.current.isFocused&&o.current.isFocusVisible),[]),u=g.useCallback(d=>{o.current.isFocused=d,o.current.isFocusVisible=Ml(),i(d),c()},[c]);ux(d=>{o.current.isFocusVisible=d,c()},[n,s],{enabled:s,isTextInput:n});let{focusProps:f}=fx({isDisabled:r,onFocusChange:u}),{focusWithinProps:p}=dx({isDisabled:!r,onFocusWithinChange:u});return{isFocused:s,isFocusVisible:l,focusProps:r?p:f}}var bx=Object.defineProperty,gx=(e,t,n)=>t in e?bx(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Bl=(e,t,n)=>(gx(e,typeof t!="symbol"?t+"":t,n),n);let yx=class{constructor(){Bl(this,"current",this.detect()),Bl(this,"handoffState","pending"),Bl(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"}},Xt=new yx;function ti(e){var t;return Xt.isServer?null:e==null?document:(t=e==null?void 0:e.ownerDocument)!=null?t:document}function ni(e){var t,n;return Xt.isServer?null:e==null?document:(n=(t=e==null?void 0:e.getRootNode)==null?void 0:t.call(e))!=null?n:document}function R0(e){var t,n;return(n=(t=ni(e))==null?void 0:t.activeElement)!=null?n:null}function vx(e){return R0(e)===e}function j0(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 j0(()=>{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 ar(){let[e]=g.useState(pt);return g.useEffect(()=>()=>e.dispose(),[e]),e}let Oe=(e,t)=>{Xt.isServer?g.useEffect(e,t):g.useLayoutEffect(e,t)};function lr(e){let t=g.useRef(e);return Oe(()=>{t.current=e},[e]),t}let pe=function(e){let t=lr(e);return g.useCallback((...n)=>t.current(...n),[t])};function wx(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 xx(e,t){return!(!e||!t||e.right<t.left||e.left>t.right||e.bottom<t.top||e.top>t.bottom)}function Ex({disabled:e=!1}={}){let t=g.useRef(null),[n,r]=g.useState(!1),o=ar(),s=pe(()=>{t.current=null,r(!1),o.dispose()}),i=pe(l=>{if(o.dispose(),t.current===null){t.current=l.currentTarget,r(!0);{let a=ti(l.currentTarget);o.addEventListener(a,"pointerup",s,!1),o.addEventListener(a,"pointermove",c=>{if(t.current){let u=wx(c);r(xx(u,t.current.getBoundingClientRect()))}},!1),o.addEventListener(a,"pointercancel",s,!1)}}});return{pressed:n,pressProps:e?{}:{onPointerDown:i,onPointerUp:s,onClick:s}}}function Rn(e){return g.useMemo(()=>e,Object.values(e))}let Sx=g.createContext(void 0);function Ll(){return g.useContext(Sx)}function Fl(...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 ri=(e=>(e[e.None=0]="None",e[e.RenderStrategy=1]="RenderStrategy",e[e.Static=2]="Static",e))(ri||{}),jn=(e=>(e[e.Unmount=0]="Unmount",e[e.Hidden=1]="Hidden",e))(jn||{});function ht(){let e=Tx();return g.useCallback(t=>Px({mergeRefs:e,...t}),[e])}function Px({ourProps:e,theirProps:t,slot:n,defaultTag:r,features:o,visible:s=!0,name:i,mergeRefs:l}){l=l??Ax;let a=z0(t,e);if(s)return oi(a,n,r,i,l);let c=o??0;if(c&2){let{static:u=!1,...f}=a;if(u)return oi(f,n,r,i,l)}if(c&1){let{unmount:u=!0,...f}=a;return St(u?0:1,{0(){return null},1(){return oi({...f,hidden:!0,style:{display:"none"}},n,r,i,l)}})}return oi(a,n,r,i,l)}function oi(e,t={},n,r,o){let{as:s=n,children:i,refName:l="ref",...a}=Rl(e,["unmount","static"]),c=e.ref!==void 0?{[l]: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,b]of Object.entries(t))typeof b=="boolean"&&(p=!0),b===!0&&d.push(h.replace(/([A-Z])/g,w=>`-${w.toLowerCase()}`));if(p){f["data-headlessui-state"]=d.join(" ");for(let h of d)f[`data-${h}`]=""}}if(Xo(s)&&(Object.keys(zn(a)).length>0||Object.keys(zn(f)).length>0))if(!g.isValidElement(u)||Array.isArray(u)&&u.length>1||Cx(u)){if(Object.keys(zn(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(zn(a)).concat(Object.keys(zn(f))).map(p=>` - ${p}`).join(`
116
+ */const C0=U5("x",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]),W5=typeof document<"u"?g.useLayoutEffect:()=>{},Bn=e=>{var t;return(t=e==null?void 0:e.ownerDocument)!==null&&t!==void 0?t:document},sr=e=>e&&"window"in e&&e.window===e?e:Bn(e).defaultView||window;function _5(e){return e!==null&&typeof e=="object"&&"nodeType"in e&&typeof e.nodeType=="number"}function V5(e){return _5(e)&&e.nodeType===Node.DOCUMENT_FRAGMENT_NODE&&"host"in e}let H5=!1;function Nl(){return H5}function Ln(e,t){if(!Nl())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:V5(n)?n=n.host:n=n.parentNode}return!1}const jr=(e=document)=>{var t;if(!Nl())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 Ue(e){if(Nl()&&e.target instanceof Element&&e.target.shadowRoot){var t,n;if("composedPath"in e)return(t=e.composedPath()[0])!==null&&t!==void 0?t:null;if("composedPath"in e.nativeEvent)return(n=e.nativeEvent.composedPath()[0])!==null&&n!==void 0?n:null}return e.target}function G5(e){if(q5())e.focus({preventScroll:!0});else{let t=K5(e);e.focus(),Z5(t)}}let Ys=null;function q5(){if(Ys==null){Ys=!1;try{document.createElement("div").focus({get preventScroll(){return Ys=!0,!0}})}catch{}}return Ys}function K5(e){let t=e.parentNode,n=[],r=document.scrollingElement||document.documentElement;for(;t instanceof HTMLElement&&t!==r;)(t.offsetHeight<t.scrollHeight||t.offsetWidth<t.scrollWidth)&&n.push({element:t,scrollTop:t.scrollTop,scrollLeft:t.scrollLeft}),t=t.parentNode;return r instanceof HTMLElement&&n.push({element:r,scrollTop:r.scrollTop,scrollLeft:r.scrollLeft}),n}function Z5(e){for(let{element:t,scrollTop:n,scrollLeft:r}of e)t.scrollTop=n,t.scrollLeft=r}function Xs(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 Cl(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 yn(e){if(process.env.NODE_ENV==="test")return e;let t=null;return()=>(t==null&&(t=e()),t)}const Ko=yn(function(){return Cl(/^Mac/i)}),Y5=yn(function(){return Cl(/^iPhone/i)}),O0=yn(function(){return Cl(/^iPad/i)||Ko()&&navigator.maxTouchPoints>1}),X5=yn(function(){return Y5()||O0()});yn(function(){return Ko()||X5()});const J5=yn(function(){return Xs(/AppleWebKit/i)&&!Q5()}),Q5=yn(function(){return Xs(/Chrome/i)}),ex=yn(function(){return Xs(/Android/i)}),tx=yn(function(){return Xs(/Firefox/i)});function Zo(e,t,n=!0){var r,o;let{metaKey:s,ctrlKey:i,altKey:l,shiftKey:a}=t;tx()&&(!((o=window.event)===null||o===void 0||(r=o.type)===null||r===void 0)&&r.startsWith("key"))&&e.target==="_blank"&&(Ko()?s=!0:i=!0);let c=J5()&&Ko()&&!O0()&&process.env.NODE_ENV!=="test"?new KeyboardEvent("keydown",{keyIdentifier:"Enter",metaKey:s,ctrlKey:i,altKey:l,shiftKey:a}):new MouseEvent("click",{metaKey:s,ctrlKey:i,altKey:l,shiftKey:a,detail:1,bubbles:!0,cancelable:!0});Zo.isOpening=n,G5(e),e.dispatchEvent(c),Zo.isOpening=!1}Zo.isOpening=!1;function I0(){let e=g.useRef(new Map),t=g.useCallback((o,s,i,l)=>{let a=l!=null&&l.once?(...c)=>{e.current.delete(i),i(...c)}:i;e.current.set(i,{type:s,eventTarget:o,fn:a,options:l}),o.addEventListener(s,a,l)},[]),n=g.useCallback((o,s,i,l)=>{var a;let c=((a=e.current.get(i))===null||a===void 0?void 0:a.fn)||i;o.removeEventListener(s,c,l),e.current.delete(i)},[]),r=g.useCallback(()=>{e.current.forEach((o,s)=>{n(o.eventTarget,o.type,s,o.options)})},[n]);return g.useEffect(()=>r,[r]),{addGlobalListener:t,removeGlobalListener:n,removeAllGlobalListeners:r}}function nx(e){return e.pointerType===""&&e.isTrusted?!0:ex()&&e.pointerType?e.type==="click"&&e.buttons===1:e.detail===0&&!e.pointerType}function $0(e){let t=e;return t.nativeEvent=e,t.isDefaultPrevented=()=>t.defaultPrevented,t.isPropagationStopped=()=>t.cancelBubble,t.persist=()=>{},t}function rx(e,t){Object.defineProperty(e,"target",{value:t}),Object.defineProperty(e,"currentTarget",{value:t})}function k0(e){let t=g.useRef({isFocused:!1,observer:null});return W5(()=>{const n=t.current;return()=>{n.observer&&(n.observer.disconnect(),n.observer=null)}},[]),g.useCallback(n=>{let r=Ue(n);if(r instanceof HTMLButtonElement||r instanceof HTMLInputElement||r instanceof HTMLTextAreaElement||r instanceof HTMLSelectElement){t.current.isFocused=!0;let o=r,s=i=>{if(t.current.isFocused=!1,o.disabled){let l=$0(i);e==null||e(l)}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 l=o===jr()?null:jr();o.dispatchEvent(new FocusEvent("blur",{relatedTarget:l})),o.dispatchEvent(new FocusEvent("focusout",{bubbles:!0,relatedTarget:l}))}}),t.current.observer.observe(o,{attributes:!0,attributeFilter:["disabled"]})}},[e])}let ox=!1,Yo=null;const Ol=new Set;let Xo=new Map,ir=!1,Il=!1;const sx={Tab:!0,Escape:!0};function $l(e,t){for(let n of Ol)n(e,t)}function ix(e){return!(e.metaKey||!Ko()&&e.altKey||e.ctrlKey||e.key==="Control"||e.key==="Shift"||e.key==="Meta")}function Js(e){ir=!0,!Zo.isOpening&&ix(e)&&(Yo="keyboard",$l("keyboard",e))}function Et(e){Yo="pointer","pointerType"in e&&e.pointerType,(e.type==="mousedown"||e.type==="pointerdown")&&(ir=!0,$l("pointer",e))}function M0(e){!Zo.isOpening&&nx(e)&&(ir=!0,Yo="virtual")}function D0(e){Ue(e)===window||Ue(e)===document||ox||!e.isTrusted||(!ir&&!Il&&(Yo="virtual",$l("virtual",e)),ir=!1,Il=!1)}function B0(){ir=!1,Il=!0}function kl(e){if(typeof window>"u"||typeof document>"u"||Xo.get(sr(e)))return;const t=sr(e),n=Bn(e);let r=t.HTMLElement.prototype.focus;t.HTMLElement.prototype.focus=function(){ir=!0,r.apply(this,arguments)},n.addEventListener("keydown",Js,!0),n.addEventListener("keyup",Js,!0),n.addEventListener("click",M0,!0),t.addEventListener("focus",D0,!0),t.addEventListener("blur",B0,!1),typeof PointerEvent<"u"?(n.addEventListener("pointerdown",Et,!0),n.addEventListener("pointermove",Et,!0),n.addEventListener("pointerup",Et,!0)):process.env.NODE_ENV==="test"&&(n.addEventListener("mousedown",Et,!0),n.addEventListener("mousemove",Et,!0),n.addEventListener("mouseup",Et,!0)),t.addEventListener("beforeunload",()=>{L0(e)},{once:!0}),Xo.set(t,{focus:r})}const L0=(e,t)=>{const n=sr(e),r=Bn(e);t&&r.removeEventListener("DOMContentLoaded",t),Xo.has(n)&&(n.HTMLElement.prototype.focus=Xo.get(n).focus,r.removeEventListener("keydown",Js,!0),r.removeEventListener("keyup",Js,!0),r.removeEventListener("click",M0,!0),n.removeEventListener("focus",D0,!0),n.removeEventListener("blur",B0,!1),typeof PointerEvent<"u"?(r.removeEventListener("pointerdown",Et,!0),r.removeEventListener("pointermove",Et,!0),r.removeEventListener("pointerup",Et,!0)):process.env.NODE_ENV==="test"&&(r.removeEventListener("mousedown",Et,!0),r.removeEventListener("mousemove",Et,!0),r.removeEventListener("mouseup",Et,!0)),Xo.delete(n))};function ax(e){const t=Bn(e);let n;return t.readyState!=="loading"?kl(e):(n=()=>{kl(e)},t.addEventListener("DOMContentLoaded",n)),()=>L0(e,n)}typeof document<"u"&&ax();function Ml(){return Yo!=="pointer"}const lx=new Set(["checkbox","radio","range","color","file","image","button","submit","reset"]);function cx(e,t,n){let r=Bn(n?Ue(n):void 0),o=n?Ue(n):void 0;const s=typeof window<"u"?sr(o).HTMLInputElement:HTMLInputElement,i=typeof window<"u"?sr(o).HTMLTextAreaElement:HTMLTextAreaElement,l=typeof window<"u"?sr(o).HTMLElement:HTMLElement,a=typeof window<"u"?sr(o).KeyboardEvent:KeyboardEvent;let c=jr(r);return e=e||c instanceof s&&!lx.has(c.type)||c instanceof i||c instanceof l&&c.isContentEditable,!(e&&t==="keyboard"&&n instanceof a&&!sx[n.key])}function ux(e,t,n){kl(),g.useEffect(()=>{if((n==null?void 0:n.enabled)===!1)return;let r=(o,s)=>{cx(!!(n!=null&&n.isTextInput),o,s)&&e(Ml())};return Ol.add(r),()=>{Ol.delete(r)}},t)}function fx(e){let{isDisabled:t,onFocus:n,onBlur:r,onFocusChange:o}=e;const s=g.useCallback(a=>{if(Ue(a)===a.currentTarget)return r&&r(a),o&&o(!1),!0},[r,o]),i=k0(s),l=g.useCallback(a=>{let c=Ue(a);const u=Bn(c),f=u?jr(u):jr();c===a.currentTarget&&c===f&&(n&&n(a),o&&o(!0),i(a))},[o,n,i]);return{focusProps:{onFocus:!t&&(n||o||r)?l:void 0,onBlur:!t&&(r||o)?s:void 0}}}function dx(e){let{isDisabled:t,onBlurWithin:n,onFocusWithin:r,onFocusWithinChange:o}=e,s=g.useRef({isFocusWithin:!1}),{addGlobalListener:i,removeAllGlobalListeners:l}=I0(),a=g.useCallback(f=>{Ln(f.currentTarget,Ue(f))&&s.current.isFocusWithin&&!Ln(f.currentTarget,f.relatedTarget)&&(s.current.isFocusWithin=!1,l(),n&&n(f),o&&o(!1))},[n,o,s,l]),c=k0(a),u=g.useCallback(f=>{if(!Ln(f.currentTarget,Ue(f)))return;let p=Ue(f);const d=Bn(p),h=jr(d);if(!s.current.isFocusWithin&&h===p){r&&r(f),o&&o(!0),s.current.isFocusWithin=!0,c(f);let b=f.currentTarget;i(d,"focus",v=>{let P=Ue(v);if(s.current.isFocusWithin&&!Ln(b,P)){let x=new d.defaultView.FocusEvent("blur",{relatedTarget:P});rx(x,b);let E=$0(x);a(E)}},{capture:!0})}},[r,o,c,i,a]);return t?{focusWithinProps:{onFocus:void 0,onBlur:void 0}}:{focusWithinProps:{onFocus:u,onBlur:a}}}let Qs=!1,ei=0;function Dl(){Qs=!0,setTimeout(()=>{Qs=!1},50)}function F0(e){e.pointerType==="touch"&&Dl()}function px(){if(!(typeof document>"u"))return ei===0&&(typeof PointerEvent<"u"?document.addEventListener("pointerup",F0):process.env.NODE_ENV==="test"&&document.addEventListener("touchend",Dl)),ei++,()=>{ei--,!(ei>0)&&(typeof PointerEvent<"u"?document.removeEventListener("pointerup",F0):process.env.NODE_ENV==="test"&&document.removeEventListener("touchend",Dl))}}function hx(e){let{onHoverStart:t,onHoverChange:n,onHoverEnd:r,isDisabled:o}=e,[s,i]=g.useState(!1),l=g.useRef({isHovered:!1,ignoreEmulatedMouseEvents:!1,pointerType:"",target:null}).current;g.useEffect(px,[]);let{addGlobalListener:a,removeAllGlobalListeners:c}=I0(),{hoverProps:u,triggerHoverEnd:f}=g.useMemo(()=>{let p=(b,v)=>{if(l.pointerType=v,o||v==="touch"||l.isHovered||!Ln(b.currentTarget,Ue(b)))return;l.isHovered=!0;let P=b.currentTarget;l.target=P,a(Bn(Ue(b)),"pointerover",x=>{l.isHovered&&l.target&&!Ln(l.target,Ue(x))&&d(x,x.pointerType)},{capture:!0}),t&&t({type:"hoverstart",target:P,pointerType:v}),n&&n(!0),i(!0)},d=(b,v)=>{let P=l.target;l.pointerType="",l.target=null,!(v==="touch"||!l.isHovered||!P)&&(l.isHovered=!1,c(),r&&r({type:"hoverend",target:P,pointerType:v}),n&&n(!1),i(!1))},h={};return typeof PointerEvent<"u"?(h.onPointerEnter=b=>{Qs&&b.pointerType==="mouse"||p(b,b.pointerType)},h.onPointerLeave=b=>{!o&&Ln(b.currentTarget,Ue(b))&&d(b,b.pointerType)}):process.env.NODE_ENV==="test"&&(h.onTouchStart=()=>{l.ignoreEmulatedMouseEvents=!0},h.onMouseEnter=b=>{!l.ignoreEmulatedMouseEvents&&!Qs&&p(b,"mouse"),l.ignoreEmulatedMouseEvents=!1},h.onMouseLeave=b=>{!o&&Ln(b.currentTarget,Ue(b))&&d(b,"mouse")}),{hoverProps:h,triggerHoverEnd:d}},[t,n,r,o,l,a,c]);return g.useEffect(()=>{o&&f({currentTarget:l.target},l.pointerType)},[o]),{hoverProps:u,isHovered:s}}function mx(e={}){let{autoFocus:t=!1,isTextInput:n,within:r}=e,o=g.useRef({isFocused:!1,isFocusVisible:t||Ml()}),[s,i]=g.useState(!1),[l,a]=g.useState(()=>o.current.isFocused&&o.current.isFocusVisible),c=g.useCallback(()=>a(o.current.isFocused&&o.current.isFocusVisible),[]),u=g.useCallback(d=>{o.current.isFocused=d,o.current.isFocusVisible=Ml(),i(d),c()},[c]);ux(d=>{o.current.isFocusVisible=d,c()},[n,s],{enabled:s,isTextInput:n});let{focusProps:f}=fx({isDisabled:r,onFocusChange:u}),{focusWithinProps:p}=dx({isDisabled:!r,onFocusWithinChange:u});return{isFocused:s,isFocusVisible:l,focusProps:r?p:f}}var bx=Object.defineProperty,gx=(e,t,n)=>t in e?bx(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Bl=(e,t,n)=>(gx(e,typeof t!="symbol"?t+"":t,n),n);let yx=class{constructor(){Bl(this,"current",this.detect()),Bl(this,"handoffState","pending"),Bl(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"}},Xt=new yx;function ti(e){var t;return Xt.isServer?null:e==null?document:(t=e==null?void 0:e.ownerDocument)!=null?t:document}function ni(e){var t,n;return Xt.isServer?null:e==null?document:(n=(t=e==null?void 0:e.getRootNode)==null?void 0:t.call(e))!=null?n:document}function R0(e){var t,n;return(n=(t=ni(e))==null?void 0:t.activeElement)!=null?n:null}function vx(e){return R0(e)===e}function j0(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 j0(()=>{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 ar(){let[e]=g.useState(pt);return g.useEffect(()=>()=>e.dispose(),[e]),e}let Oe=(e,t)=>{Xt.isServer?g.useEffect(e,t):g.useLayoutEffect(e,t)};function lr(e){let t=g.useRef(e);return Oe(()=>{t.current=e},[e]),t}let pe=function(e){let t=lr(e);return g.useCallback((...n)=>t.current(...n),[t])};function wx(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 xx(e,t){return!(!e||!t||e.right<t.left||e.left>t.right||e.bottom<t.top||e.top>t.bottom)}function Ex({disabled:e=!1}={}){let t=g.useRef(null),[n,r]=g.useState(!1),o=ar(),s=pe(()=>{t.current=null,r(!1),o.dispose()}),i=pe(l=>{if(o.dispose(),t.current===null){t.current=l.currentTarget,r(!0);{let a=ti(l.currentTarget);o.addEventListener(a,"pointerup",s,!1),o.addEventListener(a,"pointermove",c=>{if(t.current){let u=wx(c);r(xx(u,t.current.getBoundingClientRect()))}},!1),o.addEventListener(a,"pointercancel",s,!1)}}});return{pressed:n,pressProps:e?{}:{onPointerDown:i,onPointerUp:s,onClick:s}}}function Fn(e){return g.useMemo(()=>e,Object.values(e))}let Sx=g.createContext(void 0);function Ll(){return g.useContext(Sx)}function Fl(...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 ri=(e=>(e[e.None=0]="None",e[e.RenderStrategy=1]="RenderStrategy",e[e.Static=2]="Static",e))(ri||{}),Rn=(e=>(e[e.Unmount=0]="Unmount",e[e.Hidden=1]="Hidden",e))(Rn||{});function ht(){let e=Tx();return g.useCallback(t=>Px({mergeRefs:e,...t}),[e])}function Px({ourProps:e,theirProps:t,slot:n,defaultTag:r,features:o,visible:s=!0,name:i,mergeRefs:l}){l=l??Ax;let a=z0(t,e);if(s)return oi(a,n,r,i,l);let c=o??0;if(c&2){let{static:u=!1,...f}=a;if(u)return oi(f,n,r,i,l)}if(c&1){let{unmount:u=!0,...f}=a;return St(u?0:1,{0(){return null},1(){return oi({...f,hidden:!0,style:{display:"none"}},n,r,i,l)}})}return oi(a,n,r,i,l)}function oi(e,t={},n,r,o){let{as:s=n,children:i,refName:l="ref",...a}=Rl(e,["unmount","static"]),c=e.ref!==void 0?{[l]: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,b]of Object.entries(t))typeof b=="boolean"&&(p=!0),b===!0&&d.push(h.replace(/([A-Z])/g,v=>`-${v.toLowerCase()}`));if(p){f["data-headlessui-state"]=d.join(" ");for(let h of d)f[`data-${h}`]=""}}if(Jo(s)&&(Object.keys(jn(a)).length>0||Object.keys(jn(f)).length>0))if(!g.isValidElement(u)||Array.isArray(u)&&u.length>1||Cx(u)){if(Object.keys(jn(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(jn(a)).concat(Object.keys(jn(f))).map(p=>` - ${p}`).join(`
117
117
  `),"","You can apply a few solutions:",['Add an `as="..."` prop, to ensure that we render an actual element instead of a "Fragment".',"Render a single element as the child so that we can forward the props onto that element."].map(p=>` - ${p}`).join(`
118
118
  `)].join(`
119
- `))}else{let p=u.props,d=p==null?void 0:p.className,h=typeof d=="function"?(...P)=>Fl(d(...P),a.className):Fl(d,a.className),b=h?{className:h}:{},w=z0(u.props,zn(Rl(a,["ref"])));for(let P in f)P in w&&delete f[P];return g.cloneElement(u,Object.assign({},w,f,c,{ref:o(Nx(u),c.ref)},b))}return g.createElement(s,Object.assign({},Rl(a,["ref"]),!Xo(s)&&c,!Xo(s)&&f),u)}function Tx(){let e=g.useRef([]),t=g.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 Ax(...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 z0(...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 l of i){if((o instanceof Event||(o==null?void 0:o.nativeEvent)instanceof Event)&&o.defaultPrevented)return;l(o,...s)}}});return t}function U0(...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 nt(e){var t;return Object.assign(g.forwardRef(e),{displayName:(t=e.displayName)!=null?t:e.name})}function zn(e){let t=Object.assign({},e);for(let n in t)t[n]===void 0&&delete t[n];return t}function Rl(e,t=[]){let n=Object.assign({},e);for(let r of t)r in n&&delete n[r];return n}function Nx(e){return g.version.split(".")[0]>="19"?e.props.ref:e.ref}function Xo(e){return e===g.Fragment||e===Symbol.for("react.fragment")}function Cx(e){return Xo(e.type)}function Ox(e,t,n){let[r,o]=g.useState(n),s=e!==void 0,i=g.useRef(s),l=g.useRef(!1),a=g.useRef(!1);return s&&!i.current&&!l.current?(l.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,pe(c=>(s||Ke.flushSync(()=>o(c)),t==null?void 0:t(c)))]}function Ix(e){let[t]=g.useState(e);return t}function _0(e={},t=null,n=[]){for(let[r,o]of Object.entries(e))V0(n,W0(t,r),o);return n}function W0(e,t){return e?e+"["+t+"]":t}function V0(e,t,n){if(Array.isArray(n))for(let[r,o]of n.entries())V0(e,W0(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,""]):kx(n)&&!g.isValidElement(n)&&_0(n,t,e)}function $x(e){var t,n;let r=(t=e==null?void 0:e.form)!=null?t:e.closest("form");if(r){for(let o of r.elements)if(o!==e&&(o.tagName==="INPUT"&&o.type==="submit"||o.tagName==="BUTTON"&&o.type==="submit"||o.nodeName==="INPUT"&&o.type==="image")){o.click();return}(n=r.requestSubmit)==null||n.call(r)}}function kx(e){if(Object.prototype.toString.call(e)!=="[object Object]")return!1;let t=Object.getPrototypeOf(e);return t===null||Object.getPrototypeOf(t)===null}let Mx="span";var jl=(e=>(e[e.None=1]="None",e[e.Focusable=2]="Focusable",e[e.Hidden=4]="Hidden",e))(jl||{});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 ht()({ourProps:s,theirProps:o,slot:{},defaultTag:Mx,name:"Hidden"})}let H0=nt(Dx),Bx=g.createContext(null);function Lx({children:e}){let t=g.useContext(Bx);if(!t)return g.createElement(g.Fragment,null,e);let{target:n}=t;return n?Ke.createPortal(g.createElement(g.Fragment,null,e),n):null}function Fx({data:e,form:t,disabled:n,onReset:r,overrides:o}){let[s,i]=g.useState(null),l=ar();return g.useEffect(()=>{if(r&&s)return l.addEventListener(s,"reset",r)},[s,t,r]),g.createElement(Lx,null,g.createElement(Rx,{setForm:i,formId:t}),_0(e).map(([a,c])=>g.createElement(H0,{features:jl.Hidden,...zn({key:a,as:"input",type:"hidden",hidden:!0,readOnly:!0,form:t,disabled:n,name:a,value:c,...o})})))}function Rx({setForm:e,formId:t}){return g.useEffect(()=>{if(t){let n=document.getElementById(t);n&&e(n)}},[e,t]),t?null:g.createElement(H0,{features:jl.Hidden,as:"input",type:"hidden",hidden:!0,readOnly:!0,ref:n=>{if(!n)return;let r=n.closest("form");r&&e(r)}})}let jx=g.createContext(void 0);function G0(){return g.useContext(jx)}function q0(e){return typeof e!="object"||e===null?!1:"nodeType"in e}function si(e){return q0(e)&&"tagName"in e}function vn(e){return si(e)&&"accessKey"in e}function zr(e){return si(e)&&"tabIndex"in e}function zx(e){return si(e)&&"style"in e}function Ux(e){return vn(e)&&e.nodeName==="IFRAME"}function K0(e){return vn(e)&&e.nodeName==="INPUT"}function Z0(e){return vn(e)&&e.nodeName==="LABEL"}function _x(e){return vn(e)&&e.nodeName==="FIELDSET"}function Y0(e){return vn(e)&&e.nodeName==="LEGEND"}function Wx(e){return si(e)?e.matches('a[href],audio[controls],button,details,embed,iframe,img[usemap],input:not([type="hidden"]),label,select,textarea,video[controls]'):!1}function X0(e){let t=e.parentElement,n=null;for(;t&&!_x(t);)Y0(t)&&(n=t),t=t.parentElement;let r=(t==null?void 0:t.getAttribute("disabled"))==="";return r&&Vx(n)?!1:r}function Vx(e){if(!e)return!1;let t=e.previousElementSibling;for(;t!==null;){if(Y0(t))return!1;t=t.previousElementSibling}return!0}let J0=Symbol();function Hx(e,t=!0){return Object.assign(e,{[J0]:t})}function Pt(...e){let t=g.useRef(e);g.useEffect(()=>{t.current=e},[e]);let n=pe(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[J0]))?void 0:n}let zl=g.createContext(null);zl.displayName="DescriptionContext";function Q0(){let e=g.useContext(zl);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,Q0),t}return e}function Gx(){var e,t;return(t=(e=g.useContext(zl))==null?void 0:e.value)!=null?t:void 0}let qx="p";function Kx(e,t){let n=g.useId(),r=Ll(),{id:o=`headlessui-description-${n}`,...s}=e,i=Q0(),l=Pt(t);Oe(()=>i.register(o),[o,i.register]);let a=Rn({...i.slot,disabled:r||!1}),c={ref:l,...i.props,id:o};return ht()({ourProps:c,theirProps:s,slot:a,defaultTag:qx,name:i.name||"Description"})}let Zx=nt(Kx);Object.assign(Zx,{});var Le=(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))(Le||{});let ii=g.createContext(null);ii.displayName="LabelContext";function ep(){let e=g.useContext(ii);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,ep),t}return e}function tp(e){var t,n,r;let o=(n=(t=g.useContext(ii))==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 Yx({inherit:e=!1}={}){let t=tp(),[n,r]=g.useState([]),o=e?[t,...n].filter(Boolean):n;return[o.length>0?o.join(" "):void 0,g.useMemo(()=>function(s){let i=pe(a=>(r(c=>[...c,a]),()=>r(c=>{let u=c.slice(),f=u.indexOf(a);return f!==-1&&u.splice(f,1),u}))),l=g.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 g.createElement(ii.Provider,{value:l},s.children)},[r])]}let Xx="label";function Jx(e,t){var n;let r=g.useId(),o=ep(),s=G0(),i=Ll(),{id:l=`headlessui-label-${r}`,htmlFor:a=s??((n=o.props)==null?void 0:n.htmlFor),passive:c=!1,...u}=e,f=Pt(t);Oe(()=>o.register(l),[l,o.register]);let p=pe(b=>{let w=b.currentTarget;if(!(b.target!==b.currentTarget&&Wx(b.target))&&(Z0(w)&&b.preventDefault(),o.props&&"onClick"in o.props&&typeof o.props.onClick=="function"&&o.props.onClick(b),Z0(w))){let P=document.getElementById(w.htmlFor);if(P){let x=P.getAttribute("disabled");if(x==="true"||x==="")return;let E=P.getAttribute("aria-disabled");if(E==="true"||E==="")return;(K0(P)&&(P.type==="file"||P.type==="radio"||P.type==="checkbox")||P.role==="radio"||P.role==="checkbox"||P.role==="switch")&&P.click(),P.focus({preventScroll:!0})}}}),d=Rn({...o.slot,disabled:i||!1}),h={ref:f,...o.props,id:l,htmlFor:a,onClick:p};return c&&("onClick"in h&&(delete h.htmlFor,delete h.onClick),"onClick"in u&&delete u.onClick),ht()({ourProps:h,theirProps:u,slot:d,defaultTag:a?Xx:"div",name:o.name||"Label"})}let Qx=nt(Jx),e2=Object.assign(Qx,{});function t2(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 n2(e=t2){return g.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 np(e){if(e===null)return{width:0,height:0};let{width:t,height:n}=e.getBoundingClientRect();return{width:t,height:n}}function r2(e,t,n=!1){let[r,o]=g.useState(()=>np(t));return Oe(()=>{if(!t||!e)return;let s=pt();return s.requestAnimationFrame(function i(){s.requestAnimationFrame(i),o(l=>{let a=np(t);return a.width===l.width&&a.height===l.height?l:a})}),()=>{s.dispose()}},[t,e]),n?{width:`${r.width}px`,height:`${r.height}px`}:r}var rp=(e=>(e[e.Left=0]="Left",e[e.Right=2]="Right",e))(rp||{});function o2(e){let t=g.useRef(null),n=pe(o=>{t.current=o.pointerType,!X0(o.currentTarget)&&o.pointerType==="mouse"&&o.button===rp.Left&&(o.preventDefault(),e(o))}),r=pe(o=>{t.current!=="mouse"&&(X0(o.currentTarget)||e(o))});return{onPointerDown:n,onClick:r}}let op=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 s2=Object.defineProperty,i2=(e,t,n)=>t in e?s2(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,a2=(e,t,n)=>(i2(e,t+"",n),n),sp=(e,t,n)=>{if(!t.has(e))throw TypeError("Cannot "+n)},Tt=(e,t,n)=>(sp(e,t,"read from private field"),n?n.call(e):t.get(e)),Ul=(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)},ip=(e,t,n,r)=>(sp(e,t,"write to private field"),t.set(e,n),n),Jt,Jo,Qo;let ap=class{constructor(t){Ul(this,Jt,{}),Ul(this,Jo,new op(()=>new Set)),Ul(this,Qo,new Set),a2(this,"disposables",pt()),ip(this,Jt,t),Xt.isServer&&this.disposables.microTask(()=>{this.dispose()})}dispose(){this.disposables.dispose()}get state(){return Tt(this,Jt)}subscribe(t,n){if(Xt.isServer)return()=>{};let r={selector:t,callback:n,current:t(Tt(this,Jt))};return Tt(this,Qo).add(r),this.disposables.add(()=>{Tt(this,Qo).delete(r)})}on(t,n){return Xt.isServer?()=>{}:(Tt(this,Jo).get(t).add(n),this.disposables.add(()=>{Tt(this,Jo).get(t).delete(n)}))}send(t){let n=this.reduce(Tt(this,Jt),t);if(n!==Tt(this,Jt)){ip(this,Jt,n);for(let r of Tt(this,Qo)){let o=r.selector(Tt(this,Jt));lp(r.current,o)||(r.current=o,r.callback(o))}for(let r of Tt(this,Jo).get(t.type))r(Tt(this,Jt),t)}}};Jt=new WeakMap,Jo=new WeakMap,Qo=new WeakMap;function lp(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:_l(e[Symbol.iterator](),t[Symbol.iterator]()):e instanceof Map&&t instanceof Map||e instanceof Set&&t instanceof Set?e.size!==t.size?!1:_l(e.entries(),t.entries()):cp(e)&&cp(t)?_l(Object.entries(e)[Symbol.iterator](),Object.entries(t)[Symbol.iterator]()):!1}function _l(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 cp(e){if(Object.prototype.toString.call(e)!=="[object Object]")return!1;let t=Object.getPrototypeOf(e);return t===null||Object.getPrototypeOf(t)===null}function Wl(e){let[t,n]=e(),r=pt();return(...o)=>{t(...o),r.dispose(),r.microTask(n)}}var l2=Object.defineProperty,c2=(e,t,n)=>t in e?l2(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,up=(e,t,n)=>(c2(e,typeof t!="symbol"?t+"":t,n),n),fp=(e=>(e[e.Push=0]="Push",e[e.Pop=1]="Pop",e))(fp||{});let u2={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}}},f2=class Zm extends ap{constructor(){super(...arguments),up(this,"actions",{push:t=>this.send({type:0,id:t}),pop:t=>this.send({type:1,id:t})}),up(this,"selectors",{isTop:(t,n)=>t.stack[t.stack.length-1]===n,inStack:(t,n)=>t.stack.includes(n)})}static new(){return new Zm({stack:[]})}reduce(t,n){return St(n.type,u2,t,n)}};const Vl=new op(()=>f2.new());var Hl={exports:{}},Gl={};/**
119
+ `))}else{let p=u.props,d=p==null?void 0:p.className,h=typeof d=="function"?(...P)=>Fl(d(...P),a.className):Fl(d,a.className),b=h?{className:h}:{},v=z0(u.props,jn(Rl(a,["ref"])));for(let P in f)P in v&&delete f[P];return g.cloneElement(u,Object.assign({},v,f,c,{ref:o(Nx(u),c.ref)},b))}return g.createElement(s,Object.assign({},Rl(a,["ref"]),!Jo(s)&&c,!Jo(s)&&f),u)}function Tx(){let e=g.useRef([]),t=g.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 Ax(...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 z0(...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 l of i){if((o instanceof Event||(o==null?void 0:o.nativeEvent)instanceof Event)&&o.defaultPrevented)return;l(o,...s)}}});return t}function U0(...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 nt(e){var t;return Object.assign(g.forwardRef(e),{displayName:(t=e.displayName)!=null?t:e.name})}function jn(e){let t=Object.assign({},e);for(let n in t)t[n]===void 0&&delete t[n];return t}function Rl(e,t=[]){let n=Object.assign({},e);for(let r of t)r in n&&delete n[r];return n}function Nx(e){return g.version.split(".")[0]>="19"?e.props.ref:e.ref}function Jo(e){return e===g.Fragment||e===Symbol.for("react.fragment")}function Cx(e){return Jo(e.type)}function Ox(e,t,n){let[r,o]=g.useState(n),s=e!==void 0,i=g.useRef(s),l=g.useRef(!1),a=g.useRef(!1);return s&&!i.current&&!l.current?(l.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,pe(c=>(s||Ke.flushSync(()=>o(c)),t==null?void 0:t(c)))]}function Ix(e){let[t]=g.useState(e);return t}function W0(e={},t=null,n=[]){for(let[r,o]of Object.entries(e))V0(n,_0(t,r),o);return n}function _0(e,t){return e?e+"["+t+"]":t}function V0(e,t,n){if(Array.isArray(n))for(let[r,o]of n.entries())V0(e,_0(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,""]):kx(n)&&!g.isValidElement(n)&&W0(n,t,e)}function $x(e){var t,n;let r=(t=e==null?void 0:e.form)!=null?t:e.closest("form");if(r){for(let o of r.elements)if(o!==e&&(o.tagName==="INPUT"&&o.type==="submit"||o.tagName==="BUTTON"&&o.type==="submit"||o.nodeName==="INPUT"&&o.type==="image")){o.click();return}(n=r.requestSubmit)==null||n.call(r)}}function kx(e){if(Object.prototype.toString.call(e)!=="[object Object]")return!1;let t=Object.getPrototypeOf(e);return t===null||Object.getPrototypeOf(t)===null}let Mx="span";var jl=(e=>(e[e.None=1]="None",e[e.Focusable=2]="Focusable",e[e.Hidden=4]="Hidden",e))(jl||{});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 ht()({ourProps:s,theirProps:o,slot:{},defaultTag:Mx,name:"Hidden"})}let H0=nt(Dx),Bx=g.createContext(null);function Lx({children:e}){let t=g.useContext(Bx);if(!t)return g.createElement(g.Fragment,null,e);let{target:n}=t;return n?Ke.createPortal(g.createElement(g.Fragment,null,e),n):null}function Fx({data:e,form:t,disabled:n,onReset:r,overrides:o}){let[s,i]=g.useState(null),l=ar();return g.useEffect(()=>{if(r&&s)return l.addEventListener(s,"reset",r)},[s,t,r]),g.createElement(Lx,null,g.createElement(Rx,{setForm:i,formId:t}),W0(e).map(([a,c])=>g.createElement(H0,{features:jl.Hidden,...jn({key:a,as:"input",type:"hidden",hidden:!0,readOnly:!0,form:t,disabled:n,name:a,value:c,...o})})))}function Rx({setForm:e,formId:t}){return g.useEffect(()=>{if(t){let n=document.getElementById(t);n&&e(n)}},[e,t]),t?null:g.createElement(H0,{features:jl.Hidden,as:"input",type:"hidden",hidden:!0,readOnly:!0,ref:n=>{if(!n)return;let r=n.closest("form");r&&e(r)}})}let jx=g.createContext(void 0);function G0(){return g.useContext(jx)}function q0(e){return typeof e!="object"||e===null?!1:"nodeType"in e}function si(e){return q0(e)&&"tagName"in e}function vn(e){return si(e)&&"accessKey"in e}function zr(e){return si(e)&&"tabIndex"in e}function zx(e){return si(e)&&"style"in e}function Ux(e){return vn(e)&&e.nodeName==="IFRAME"}function K0(e){return vn(e)&&e.nodeName==="INPUT"}function Z0(e){return vn(e)&&e.nodeName==="LABEL"}function Wx(e){return vn(e)&&e.nodeName==="FIELDSET"}function Y0(e){return vn(e)&&e.nodeName==="LEGEND"}function _x(e){return si(e)?e.matches('a[href],audio[controls],button,details,embed,iframe,img[usemap],input:not([type="hidden"]),label,select,textarea,video[controls]'):!1}function X0(e){let t=e.parentElement,n=null;for(;t&&!Wx(t);)Y0(t)&&(n=t),t=t.parentElement;let r=(t==null?void 0:t.getAttribute("disabled"))==="";return r&&Vx(n)?!1:r}function Vx(e){if(!e)return!1;let t=e.previousElementSibling;for(;t!==null;){if(Y0(t))return!1;t=t.previousElementSibling}return!0}let J0=Symbol();function Hx(e,t=!0){return Object.assign(e,{[J0]:t})}function Pt(...e){let t=g.useRef(e);g.useEffect(()=>{t.current=e},[e]);let n=pe(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[J0]))?void 0:n}let zl=g.createContext(null);zl.displayName="DescriptionContext";function Q0(){let e=g.useContext(zl);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,Q0),t}return e}function Gx(){var e,t;return(t=(e=g.useContext(zl))==null?void 0:e.value)!=null?t:void 0}let qx="p";function Kx(e,t){let n=g.useId(),r=Ll(),{id:o=`headlessui-description-${n}`,...s}=e,i=Q0(),l=Pt(t);Oe(()=>i.register(o),[o,i.register]);let a=Fn({...i.slot,disabled:r||!1}),c={ref:l,...i.props,id:o};return ht()({ourProps:c,theirProps:s,slot:a,defaultTag:qx,name:i.name||"Description"})}let Zx=nt(Kx);Object.assign(Zx,{});var Le=(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))(Le||{});let ii=g.createContext(null);ii.displayName="LabelContext";function ep(){let e=g.useContext(ii);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,ep),t}return e}function tp(e){var t,n,r;let o=(n=(t=g.useContext(ii))==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 Yx({inherit:e=!1}={}){let t=tp(),[n,r]=g.useState([]),o=e?[t,...n].filter(Boolean):n;return[o.length>0?o.join(" "):void 0,g.useMemo(()=>function(s){let i=pe(a=>(r(c=>[...c,a]),()=>r(c=>{let u=c.slice(),f=u.indexOf(a);return f!==-1&&u.splice(f,1),u}))),l=g.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 g.createElement(ii.Provider,{value:l},s.children)},[r])]}let Xx="label";function Jx(e,t){var n;let r=g.useId(),o=ep(),s=G0(),i=Ll(),{id:l=`headlessui-label-${r}`,htmlFor:a=s??((n=o.props)==null?void 0:n.htmlFor),passive:c=!1,...u}=e,f=Pt(t);Oe(()=>o.register(l),[l,o.register]);let p=pe(b=>{let v=b.currentTarget;if(!(b.target!==b.currentTarget&&_x(b.target))&&(Z0(v)&&b.preventDefault(),o.props&&"onClick"in o.props&&typeof o.props.onClick=="function"&&o.props.onClick(b),Z0(v))){let P=document.getElementById(v.htmlFor);if(P){let x=P.getAttribute("disabled");if(x==="true"||x==="")return;let E=P.getAttribute("aria-disabled");if(E==="true"||E==="")return;(K0(P)&&(P.type==="file"||P.type==="radio"||P.type==="checkbox")||P.role==="radio"||P.role==="checkbox"||P.role==="switch")&&P.click(),P.focus({preventScroll:!0})}}}),d=Fn({...o.slot,disabled:i||!1}),h={ref:f,...o.props,id:l,htmlFor:a,onClick:p};return c&&("onClick"in h&&(delete h.htmlFor,delete h.onClick),"onClick"in u&&delete u.onClick),ht()({ourProps:h,theirProps:u,slot:d,defaultTag:a?Xx:"div",name:o.name||"Label"})}let Qx=nt(Jx),e2=Object.assign(Qx,{});function t2(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 n2(e=t2){return g.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 np(e){if(e===null)return{width:0,height:0};let{width:t,height:n}=e.getBoundingClientRect();return{width:t,height:n}}function r2(e,t,n=!1){let[r,o]=g.useState(()=>np(t));return Oe(()=>{if(!t||!e)return;let s=pt();return s.requestAnimationFrame(function i(){s.requestAnimationFrame(i),o(l=>{let a=np(t);return a.width===l.width&&a.height===l.height?l:a})}),()=>{s.dispose()}},[t,e]),n?{width:`${r.width}px`,height:`${r.height}px`}:r}var rp=(e=>(e[e.Left=0]="Left",e[e.Right=2]="Right",e))(rp||{});function o2(e){let t=g.useRef(null),n=pe(o=>{t.current=o.pointerType,!X0(o.currentTarget)&&o.pointerType==="mouse"&&o.button===rp.Left&&(o.preventDefault(),e(o))}),r=pe(o=>{t.current!=="mouse"&&(X0(o.currentTarget)||e(o))});return{onPointerDown:n,onClick:r}}let op=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 s2=Object.defineProperty,i2=(e,t,n)=>t in e?s2(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,a2=(e,t,n)=>(i2(e,t+"",n),n),sp=(e,t,n)=>{if(!t.has(e))throw TypeError("Cannot "+n)},Tt=(e,t,n)=>(sp(e,t,"read from private field"),n?n.call(e):t.get(e)),Ul=(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)},ip=(e,t,n,r)=>(sp(e,t,"write to private field"),t.set(e,n),n),Jt,Qo,es;let ap=class{constructor(t){Ul(this,Jt,{}),Ul(this,Qo,new op(()=>new Set)),Ul(this,es,new Set),a2(this,"disposables",pt()),ip(this,Jt,t),Xt.isServer&&this.disposables.microTask(()=>{this.dispose()})}dispose(){this.disposables.dispose()}get state(){return Tt(this,Jt)}subscribe(t,n){if(Xt.isServer)return()=>{};let r={selector:t,callback:n,current:t(Tt(this,Jt))};return Tt(this,es).add(r),this.disposables.add(()=>{Tt(this,es).delete(r)})}on(t,n){return Xt.isServer?()=>{}:(Tt(this,Qo).get(t).add(n),this.disposables.add(()=>{Tt(this,Qo).get(t).delete(n)}))}send(t){let n=this.reduce(Tt(this,Jt),t);if(n!==Tt(this,Jt)){ip(this,Jt,n);for(let r of Tt(this,es)){let o=r.selector(Tt(this,Jt));lp(r.current,o)||(r.current=o,r.callback(o))}for(let r of Tt(this,Qo).get(t.type))r(Tt(this,Jt),t)}}};Jt=new WeakMap,Qo=new WeakMap,es=new WeakMap;function lp(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:Wl(e[Symbol.iterator](),t[Symbol.iterator]()):e instanceof Map&&t instanceof Map||e instanceof Set&&t instanceof Set?e.size!==t.size?!1:Wl(e.entries(),t.entries()):cp(e)&&cp(t)?Wl(Object.entries(e)[Symbol.iterator](),Object.entries(t)[Symbol.iterator]()):!1}function Wl(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 cp(e){if(Object.prototype.toString.call(e)!=="[object Object]")return!1;let t=Object.getPrototypeOf(e);return t===null||Object.getPrototypeOf(t)===null}function _l(e){let[t,n]=e(),r=pt();return(...o)=>{t(...o),r.dispose(),r.microTask(n)}}var l2=Object.defineProperty,c2=(e,t,n)=>t in e?l2(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,up=(e,t,n)=>(c2(e,typeof t!="symbol"?t+"":t,n),n),fp=(e=>(e[e.Push=0]="Push",e[e.Pop=1]="Pop",e))(fp||{});let u2={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}}},f2=class Zm extends ap{constructor(){super(...arguments),up(this,"actions",{push:t=>this.send({type:0,id:t}),pop:t=>this.send({type:1,id:t})}),up(this,"selectors",{isTop:(t,n)=>t.stack[t.stack.length-1]===n,inStack:(t,n)=>t.stack.includes(n)})}static new(){return new Zm({stack:[]})}reduce(t,n){return St(n.type,u2,t,n)}};const Vl=new op(()=>f2.new());var Hl={exports:{}},Gl={};/**
120
120
  * @license React
121
121
  * use-sync-external-store-with-selector.production.js
122
122
  *
@@ -124,7 +124,7 @@ ${$g(d)}`),super(t.shortMessage,{cause:t,docsPath:r,metaMessages:[...t.metaMessa
124
124
  *
125
125
  * This source code is licensed under the MIT license found in the
126
126
  * LICENSE file in the root directory of this source tree.
127
- */var dp;function d2(){if(dp)return Gl;dp=1;var e=g;function t(a,c){return a===c&&(a!==0||1/a===1/c)||a!==a&&c!==c}var n=typeof Object.is=="function"?Object.is:t,r=e.useSyncExternalStore,o=e.useRef,s=e.useEffect,i=e.useMemo,l=e.useDebugValue;return Gl.useSyncExternalStoreWithSelector=function(a,c,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 w(D){if(!P){if(P=!0,x=D,D=f(D),p!==void 0&&h.hasValue){var L=h.value;if(p(L,D))return E=L}return E=D}if(L=E,n(x,D))return L;var F=f(D);return p!==void 0&&p(L,F)?(x=D,L):(x=D,E=F)}var P=!1,x,E,A=u===void 0?null:u;return[function(){return w(c())},A===null?void 0:function(){return w(A())}]},[c,u,f,p]);var b=r(a,d[0],d[1]);return s(function(){h.hasValue=!0,h.value=b},[b]),l(b),b},Gl}var ql={};/**
127
+ */var dp;function d2(){if(dp)return Gl;dp=1;var e=g;function t(a,c){return a===c&&(a!==0||1/a===1/c)||a!==a&&c!==c}var n=typeof Object.is=="function"?Object.is:t,r=e.useSyncExternalStore,o=e.useRef,s=e.useEffect,i=e.useMemo,l=e.useDebugValue;return Gl.useSyncExternalStoreWithSelector=function(a,c,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 v(D){if(!P){if(P=!0,x=D,D=f(D),p!==void 0&&h.hasValue){var F=h.value;if(p(F,D))return E=F}return E=D}if(F=E,n(x,D))return F;var L=f(D);return p!==void 0&&p(F,L)?(x=D,F):(x=D,E=L)}var P=!1,x,E,N=u===void 0?null:u;return[function(){return v(c())},N===null?void 0:function(){return v(N())}]},[c,u,f,p]);var b=r(a,d[0],d[1]);return s(function(){h.hasValue=!0,h.value=b},[b]),l(b),b},Gl}var ql={};/**
128
128
  * @license React
129
129
  * use-sync-external-store-with-selector.development.js
130
130
  *
@@ -132,49 +132,49 @@ ${$g(d)}`),super(t.shortMessage,{cause:t,docsPath:r,metaMessages:[...t.metaMessa
132
132
  *
133
133
  * This source code is licensed under the MIT license found in the
134
134
  * LICENSE file in the root directory of this source tree.
135
- */var pp;function p2(){return pp||(pp=1,process.env.NODE_ENV!=="production"&&function(){function e(a,c){return a===c&&(a!==0||1/a===1/c)||a!==a&&c!==c}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var t=g,n=typeof Object.is=="function"?Object.is:e,r=t.useSyncExternalStore,o=t.useRef,s=t.useEffect,i=t.useMemo,l=t.useDebugValue;ql.useSyncExternalStoreWithSelector=function(a,c,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 w(D){if(!P){if(P=!0,x=D,D=f(D),p!==void 0&&h.hasValue){var L=h.value;if(p(L,D))return E=L}return E=D}if(L=E,n(x,D))return L;var F=f(D);return p!==void 0&&p(L,F)?(x=D,L):(x=D,E=F)}var P=!1,x,E,A=u===void 0?null:u;return[function(){return w(c())},A===null?void 0:function(){return w(A())}]},[c,u,f,p]);var b=r(a,d[0],d[1]);return s(function(){h.hasValue=!0,h.value=b},[b]),l(b),b},typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())}()),ql}process.env.NODE_ENV==="production"?Hl.exports=d2():Hl.exports=p2();var h2=Hl.exports;function rt(e,t,n=lp){return h2.useSyncExternalStoreWithSelector(pe(r=>e.subscribe(m2,r)),pe(()=>e.state),pe(()=>e.state),pe(t),n)}function m2(e){return e}function hp(e,t){let n=g.useId(),r=Vl.get(t),[o,s]=rt(r,g.useCallback(i=>[r.selectors.isTop(i,n),r.selectors.inStack(i,n)],[r,n]));return Oe(()=>{if(e)return r.actions.push(n),()=>r.actions.pop(n)},[r,e,n]),e?s?o:!0:!1}let Kl=new Map,es=new Map;function mp(e){var t;let n=(t=es.get(e))!=null?t:0;return es.set(e,n+1),n!==0?()=>bp(e):(Kl.set(e,{"aria-hidden":e.getAttribute("aria-hidden"),inert:e.inert}),e.setAttribute("aria-hidden","true"),e.inert=!0,()=>bp(e))}function bp(e){var t;let n=(t=es.get(e))!=null?t:1;if(n===1?es.delete(e):es.set(e,n-1),n!==1)return;let r=Kl.get(e);r&&(r["aria-hidden"]===null?e.removeAttribute("aria-hidden"):e.setAttribute("aria-hidden",r["aria-hidden"]),e.inert=r.inert,Kl.delete(e))}function b2(e,{allowed:t,disallowed:n}={}){let r=hp(e,"inert-others");Oe(()=>{var o,s;if(!r)return;let i=pt();for(let a of(o=n==null?void 0:n())!=null?o:[])a&&i.add(mp(a));let l=(s=t==null?void 0:t())!=null?s:[];for(let a of l){if(!a)continue;let c=ti(a);if(!c)continue;let u=a.parentElement;for(;u&&u!==c.body;){for(let f of u.children)l.some(p=>f.contains(p))||i.add(mp(f));u=u.parentElement}}return i.dispose},[r,t,n])}function g2(e,t,n){let r=lr(o=>{let s=o.getBoundingClientRect();s.x===0&&s.y===0&&s.width===0&&s.height===0&&n()});g.useEffect(()=>{if(!e)return;let o=t===null?null:vn(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 Zl=["[contentEditable=true]","[tabindex]","a[href]","area[href]","button:not([disabled])","iframe","input:not([disabled])","select:not([disabled])","details>summary","textarea:not([disabled])"].map(e=>`${e}:not([tabindex='-1'])`).join(","),y2=["[data-autofocus]"].map(e=>`${e}:not([tabindex='-1'])`).join(",");var Yl=(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))(Yl||{}),v2=(e=>(e[e.Error=0]="Error",e[e.Overflow=1]="Overflow",e[e.Success=2]="Success",e[e.Underflow=3]="Underflow",e))(v2||{}),w2=(e=>(e[e.Previous=-1]="Previous",e[e.Next=1]="Next",e))(w2||{});function gp(e=document.body){return e==null?[]:Array.from(e.querySelectorAll(Zl)).sort((t,n)=>Math.sign((t.tabIndex||Number.MAX_SAFE_INTEGER)-(n.tabIndex||Number.MAX_SAFE_INTEGER)))}function x2(e=document.body){return e==null?[]:Array.from(e.querySelectorAll(y2)).sort((t,n)=>Math.sign((t.tabIndex||Number.MAX_SAFE_INTEGER)-(n.tabIndex||Number.MAX_SAFE_INTEGER)))}var Xl=(e=>(e[e.Strict=0]="Strict",e[e.Loose=1]="Loose",e))(Xl||{});function yp(e,t=0){var n;return e===((n=ti(e))==null?void 0:n.body)?!1:St(t,{0(){return e.matches(Zl)},1(){let r=e;for(;r!==null;){if(r.matches(Zl))return!0;r=r.parentElement}return!1}})}var E2=(e=>(e[e.Keyboard=0]="Keyboard",e[e.Mouse=1]="Mouse",e))(E2||{});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 S2=["textarea","input"].join(",");function P2(e){var t,n;return(n=(t=e==null?void 0:e.matches)==null?void 0:t.call(e,S2))!=null?n:!1}function vp(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 T2(e,t,n=e===null?document.body:ni(e)){return A2(gp(n),t,{relativeTo:e})}function A2(e,t,{sorted:n=!0,relativeTo:r=null,skipElements:o=[]}={}){let s=Array.isArray(e)?e.length>0?ni(e[0]):document:ni(e),i=Array.isArray(e)?n?vp(e):e:t&64?x2(e):gp(e);o.length>0&&i.length>1&&(i=i.filter(d=>!o.some(h=>h!=null&&"current"in h?(h==null?void 0:h.current)===d:h===d))),r=r??(s==null?void 0:s.activeElement);let l=(()=>{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")})(),c=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(c),u+=l}while(p!==R0(p));return t&6&&P2(p)&&p.select(),2}function wp(){return/iPhone/gi.test(window.navigator.platform)||/Mac/gi.test(window.navigator.platform)&&window.navigator.maxTouchPoints>0}function N2(){return/Android/gi.test(window.navigator.userAgent)}function xp(){return wp()||N2()}function Ur(e,t,n,r){let o=lr(n);g.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 C2(e,t,n,r){let o=lr(n);g.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 Ep=30;function O2(e,t,n){let r=lr(n),o=g.useCallback(function(l,a){if(l.defaultPrevented)return;let c=a(l);if(c===null||!c.getRootNode().contains(c)||!c.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(c)||l.composed&&l.composedPath().includes(f)))return;return!yp(c,Xl.Loose)&&c.tabIndex!==-1&&l.preventDefault(),r.current(l,c)},[r,t]),s=g.useRef(null);Ur(e,"pointerdown",l=>{var a,c;xp()||(s.current=((c=(a=l.composedPath)==null?void 0:a.call(l))==null?void 0:c[0])||l.target)},!0),Ur(e,"pointerup",l=>{if(xp()||!s.current)return;let a=s.current;return s.current=null,o(l,()=>a)},!0);let i=g.useRef({x:0,y:0});Ur(e,"touchstart",l=>{i.current.x=l.touches[0].clientX,i.current.y=l.touches[0].clientY},!0),Ur(e,"touchend",l=>{let a={x:l.changedTouches[0].clientX,y:l.changedTouches[0].clientY};if(!(Math.abs(a.x-i.current.x)>=Ep||Math.abs(a.y-i.current.y)>=Ep))return o(l,()=>zr(l.target)?l.target:null)},!0),C2(e,"blur",l=>o(l,()=>Ux(window.document.activeElement)?window.document.activeElement:null),!0)}function Jl(...e){return g.useMemo(()=>ti(...e),[...e])}var I2=(e=>(e[e.Ignore=0]="Ignore",e[e.Select=1]="Select",e[e.Close=2]="Close",e))(I2||{});const ai={Ignore:{kind:0},Select:e=>({kind:1,target:e}),Close:{kind:2}},$2=200,Sp=5;function k2(e,{trigger:t,action:n,close:r,select:o}){let s=g.useRef(null),i=g.useRef(null),l=g.useRef(null);Ur(e&&t!==null,"pointerdown",a=>{q0(a==null?void 0:a.target)&&t!=null&&t.contains(a.target)&&(i.current=a.x,l.current=a.y,s.current=a.timeStamp)}),Ur(e&&t!==null,"pointerup",a=>{var c,u;let f=s.current;if(f===null||(s.current=null,!zr(a.target))||Math.abs(a.x-((c=i.current)!=null?c:a.x))<Sp&&Math.abs(a.y-((u=l.current)!=null?u:a.y))<Sp)return;let p=n(a);switch(p.kind){case 0:return;case 1:{a.timeStamp-f>$2&&(o(p.target),r());break}case 2:{r();break}}},{capture:!0})}function M2(e,t){return g.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 D2(e){return g.useSyncExternalStore(e.subscribe,e.getSnapshot,e.getSnapshot)}function B2(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(l=>l()))}}}function L2(){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 F2(){return wp()?{before({doc:e,d:t,meta:n}){function r(o){for(let s of n().containers)for(let i of s())if(i.contains(o))return!0;return!1}t.microTask(()=>{var o;if(window.getComputedStyle(e.documentElement).scrollBehavior!=="auto"){let l=pt();l.style(e.documentElement,"scrollBehavior","auto"),t.add(()=>t.microTask(()=>l.dispose()))}let s=(o=window.scrollY)!=null?o:window.pageYOffset,i=null;t.addEventListener(e,"click",l=>{if(zr(l.target))try{let a=l.target.closest("a");if(!a)return;let{hash:c}=new URL(a.href),u=e.querySelector(c);zr(u)&&!r(u)&&(i=u)}catch{}},!0),t.group(l=>{t.addEventListener(e,"touchstart",a=>{if(l.dispose(),zr(a.target)&&zx(a.target))if(r(a.target)){let c=a.target;for(;c.parentElement&&r(c.parentElement);)c=c.parentElement;l.style(c,"overscrollBehavior","contain")}else l.style(a.target,"touchAction","none")})}),t.addEventListener(e,"touchmove",l=>{if(zr(l.target)){if(K0(l.target))return;if(r(l.target)){let a=l.target;for(;a.parentElement&&a.dataset.headlessuiPortal!==""&&!(a.scrollHeight>a.clientHeight||a.scrollWidth>a.clientWidth);)a=a.parentElement;a.dataset.headlessuiPortal===""&&l.preventDefault()}else l.preventDefault()}},{passive:!1}),t.add(()=>{var l;let a=(l=window.scrollY)!=null?l:window.pageYOffset;s!==a&&window.scrollTo(0,s),i&&i.isConnected&&(i.scrollIntoView({block:"nearest"}),i=null)})})}}:{}}function R2(){return{before({doc:e,d:t}){t.style(e.documentElement,"overflow","hidden")}}}function Pp(e){let t={};for(let n of e)Object.assign(t,n(t));return t}let cr=B2(()=>new Map,{PUSH(e,t){var n;let r=(n=this.get(e))!=null?n:{doc:e,count:0,d:pt(),meta:new Set,computedMeta:{}};return r.count++,r.meta.add(t),r.computedMeta=Pp(r.meta),this.set(e,r),this},POP(e,t){let n=this.get(e);return n&&(n.count--,n.meta.delete(t),n.computedMeta=Pp(n.meta)),this},SCROLL_PREVENT(e){let t={doc:e.doc,d:e.d,meta(){return e.computedMeta}},n=[F2(),L2(),R2()];n.forEach(({before:r})=>r==null?void 0:r(t)),n.forEach(({after:r})=>r==null?void 0:r(t))},SCROLL_ALLOW({d:e}){e.dispose()},TEARDOWN({doc:e}){this.delete(e)}});cr.subscribe(()=>{let e=cr.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)&&cr.dispatch(n.count>0?"SCROLL_PREVENT":"SCROLL_ALLOW",n),n.count===0&&cr.dispatch("TEARDOWN",n)}});function j2(e,t,n=()=>({containers:[]})){let r=D2(cr),o=t?r.get(t):void 0,s=o?o.count>0:!1;return Oe(()=>{if(!(!t||!e))return cr.dispatch("PUSH",t,n),()=>cr.dispatch("POP",t,n)},[e,t]),s}function z2(e,t,n=()=>[document.body]){let r=hp(e,"scroll-lock");j2(r,t,o=>{var s;return{containers:[...(s=o.containers)!=null?s:[],n]}})}function Tp(e){return[e.screenX,e.screenY]}function U2(){let e=g.useRef([-1,-1]);return{wasMoved(t){let n=Tp(t);return e.current[0]===n[0]&&e.current[1]===n[1]?!1:(e.current=n,!0)},update(t){e.current=Tp(t)}}}function _2(e=0){let[t,n]=g.useState(e),r=g.useCallback(a=>n(a),[]),o=g.useCallback(a=>n(c=>c|a),[]),s=g.useCallback(a=>(t&a)===a,[t]),i=g.useCallback(a=>n(c=>c&~a),[]),l=g.useCallback(a=>n(c=>c^a),[]);return{flags:t,setFlag:r,addFlag:o,hasFlag:s,removeFlag:i,toggleFlag:l}}var Ap,Np;typeof process<"u"&&typeof globalThis<"u"&&typeof Element<"u"&&((Ap=process==null?void 0:process.env)==null?void 0:Ap.NODE_ENV)==="test"&&typeof((Np=Element==null?void 0:Element.prototype)==null?void 0:Np.getAnimations)>"u"&&(Element.prototype.getAnimations=function(){return console.warn(["Headless UI has polyfilled `Element.prototype.getAnimations` for your tests.","Please install a proper polyfill e.g. `jsdom-testing-mocks`, to silence these warnings.","","Example usage:","```js","import { mockAnimationsApi } from 'jsdom-testing-mocks'","mockAnimationsApi()","```"].join(`
136
- `)),[]});var W2=(e=>(e[e.None=0]="None",e[e.Closed=1]="Closed",e[e.Enter=2]="Enter",e[e.Leave=4]="Leave",e))(W2||{});function Cp(e){let t={};for(let n in e)e[n]===!0&&(t[`data-${n}`]="");return t}function Op(e,t,n,r){let[o,s]=g.useState(n),{hasFlag:i,addFlag:l,removeFlag:a}=_2(e&&o?3:0),c=g.useRef(!1),u=g.useRef(!1),f=ar();return Oe(()=>{var p;if(e){if(n&&s(!0),!t){n&&l(3);return}return(p=r==null?void 0:r.start)==null||p.call(r,n),V2(t,{inFlight:c,prepare(){u.current?u.current=!1:u.current=c.current,c.current=!0,!u.current&&(n?(l(3),a(4)):(l(4),a(2)))},run(){u.current?n?(a(3),l(4)):(a(4),l(3)):n?a(1):l(1)},done(){var d;u.current&&q2(t)||(c.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 V2(e,{prepare:t,run:n,done:r,inFlight:o}){let s=pt();return G2(e,{prepare:t,inFlight:o}),s.nextFrame(()=>{n(),s.requestAnimationFrame(()=>{s.add(H2(e,r))})}),s.dispose}function H2(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(l=>l instanceof CSSTransition))!=null?r:[];return i.length===0?(t(),o.dispose):(Promise.allSettled(i.map(l=>l.finished)).then(()=>{s||t()}),o.dispose)}function G2(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 q2(e){var t,n;return((n=(t=e.getAnimations)==null?void 0:t.call(e))!=null?n:[]).some(r=>r instanceof CSSTransition&&r.playState!=="finished")}function li(){return typeof window<"u"}function _r(e){return Ql(e)?(e.nodeName||"").toLowerCase():"#document"}function ot(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Qt(e){var t;return(t=(Ql(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function Ql(e){return li()?e instanceof Node||e instanceof ot(e).Node:!1}function me(e){return li()?e instanceof Element||e instanceof ot(e).Element:!1}function st(e){return li()?e instanceof HTMLElement||e instanceof ot(e).HTMLElement:!1}function ec(e){return!li()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof ot(e).ShadowRoot}function ts(e){const{overflow:t,overflowX:n,overflowY:r,display:o}=At(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&o!=="inline"&&o!=="contents"}function K2(e){return/^(table|td|th)$/.test(_r(e))}function ci(e){try{if(e.matches(":popover-open"))return!0}catch{}try{return e.matches(":modal")}catch{return!1}}const Z2=/transform|translate|scale|rotate|perspective|filter/,Y2=/paint|layout|strict|content/,ur=e=>!!e&&e!=="none";let tc;function nc(e){const t=me(e)?At(e):e;return ur(t.transform)||ur(t.translate)||ur(t.scale)||ur(t.rotate)||ur(t.perspective)||!ui()&&(ur(t.backdropFilter)||ur(t.filter))||Z2.test(t.willChange||"")||Y2.test(t.contain||"")}function X2(e){let t=xn(e);for(;st(t)&&!wn(t);){if(nc(t))return t;if(ci(t))return null;t=xn(t)}return null}function ui(){return tc==null&&(tc=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),tc}function wn(e){return/^(html|body|#document)$/.test(_r(e))}function At(e){return ot(e).getComputedStyle(e)}function fi(e){return me(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function xn(e){if(_r(e)==="html")return e;const t=e.assignedSlot||e.parentNode||ec(e)&&e.host||Qt(e);return ec(t)?t.host:t}function Ip(e){const t=xn(e);return wn(t)?e.ownerDocument?e.ownerDocument.body:e.body:st(t)&&ts(t)?t:Ip(t)}function Un(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const o=Ip(e),s=o===((r=e.ownerDocument)==null?void 0:r.body),i=ot(o);if(s){const l=rc(i);return t.concat(i,i.visualViewport||[],ts(o)?o:[],l&&n?Un(l):[])}else return t.concat(o,Un(o,[],n))}function rc(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function J2(){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 En=Math.min,_e=Math.max,ns=Math.round,di=Math.floor,en=e=>({x:e,y:e}),Q2={left:"right",right:"left",bottom:"top",top:"bottom"};function oc(e,t,n){return _e(e,En(t,n))}function fr(e,t){return typeof e=="function"?e(t):e}function _n(e){return e.split("-")[0]}function Wr(e){return e.split("-")[1]}function $p(e){return e==="x"?"y":"x"}function sc(e){return e==="y"?"height":"width"}function Sn(e){const t=e[0];return t==="t"||t==="b"?"y":"x"}function ic(e){return $p(Sn(e))}function eE(e,t,n){n===void 0&&(n=!1);const r=Wr(e),o=ic(e),s=sc(o);let i=o==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[s]>t.floating[s]&&(i=pi(i)),[i,pi(i)]}function tE(e){const t=pi(e);return[ac(e),t,ac(t)]}function ac(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const kp=["left","right"],Mp=["right","left"],nE=["top","bottom"],rE=["bottom","top"];function oE(e,t,n){switch(e){case"top":case"bottom":return n?t?Mp:kp:t?kp:Mp;case"left":case"right":return t?nE:rE;default:return[]}}function sE(e,t,n,r){const o=Wr(e);let s=oE(_n(e),n==="start",r);return o&&(s=s.map(i=>i+"-"+o),t&&(s=s.concat(s.map(ac)))),s}function pi(e){const t=_n(e);return Q2[t]+e.slice(t.length)}function iE(e){return{top:0,right:0,bottom:0,left:0,...e}}function Dp(e){return typeof e!="number"?iE(e):{top:e,right:e,bottom:e,left:e}}function hi(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}}/*!
135
+ */var pp;function p2(){return pp||(pp=1,process.env.NODE_ENV!=="production"&&function(){function e(a,c){return a===c&&(a!==0||1/a===1/c)||a!==a&&c!==c}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var t=g,n=typeof Object.is=="function"?Object.is:e,r=t.useSyncExternalStore,o=t.useRef,s=t.useEffect,i=t.useMemo,l=t.useDebugValue;ql.useSyncExternalStoreWithSelector=function(a,c,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 v(D){if(!P){if(P=!0,x=D,D=f(D),p!==void 0&&h.hasValue){var F=h.value;if(p(F,D))return E=F}return E=D}if(F=E,n(x,D))return F;var L=f(D);return p!==void 0&&p(F,L)?(x=D,F):(x=D,E=L)}var P=!1,x,E,N=u===void 0?null:u;return[function(){return v(c())},N===null?void 0:function(){return v(N())}]},[c,u,f,p]);var b=r(a,d[0],d[1]);return s(function(){h.hasValue=!0,h.value=b},[b]),l(b),b},typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())}()),ql}process.env.NODE_ENV==="production"?Hl.exports=d2():Hl.exports=p2();var h2=Hl.exports;function rt(e,t,n=lp){return h2.useSyncExternalStoreWithSelector(pe(r=>e.subscribe(m2,r)),pe(()=>e.state),pe(()=>e.state),pe(t),n)}function m2(e){return e}function hp(e,t){let n=g.useId(),r=Vl.get(t),[o,s]=rt(r,g.useCallback(i=>[r.selectors.isTop(i,n),r.selectors.inStack(i,n)],[r,n]));return Oe(()=>{if(e)return r.actions.push(n),()=>r.actions.pop(n)},[r,e,n]),e?s?o:!0:!1}let Kl=new Map,ts=new Map;function mp(e){var t;let n=(t=ts.get(e))!=null?t:0;return ts.set(e,n+1),n!==0?()=>bp(e):(Kl.set(e,{"aria-hidden":e.getAttribute("aria-hidden"),inert:e.inert}),e.setAttribute("aria-hidden","true"),e.inert=!0,()=>bp(e))}function bp(e){var t;let n=(t=ts.get(e))!=null?t:1;if(n===1?ts.delete(e):ts.set(e,n-1),n!==1)return;let r=Kl.get(e);r&&(r["aria-hidden"]===null?e.removeAttribute("aria-hidden"):e.setAttribute("aria-hidden",r["aria-hidden"]),e.inert=r.inert,Kl.delete(e))}function b2(e,{allowed:t,disallowed:n}={}){let r=hp(e,"inert-others");Oe(()=>{var o,s;if(!r)return;let i=pt();for(let a of(o=n==null?void 0:n())!=null?o:[])a&&i.add(mp(a));let l=(s=t==null?void 0:t())!=null?s:[];for(let a of l){if(!a)continue;let c=ti(a);if(!c)continue;let u=a.parentElement;for(;u&&u!==c.body;){for(let f of u.children)l.some(p=>f.contains(p))||i.add(mp(f));u=u.parentElement}}return i.dispose},[r,t,n])}function g2(e,t,n){let r=lr(o=>{let s=o.getBoundingClientRect();s.x===0&&s.y===0&&s.width===0&&s.height===0&&n()});g.useEffect(()=>{if(!e)return;let o=t===null?null:vn(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 Zl=["[contentEditable=true]","[tabindex]","a[href]","area[href]","button:not([disabled])","iframe","input:not([disabled])","select:not([disabled])","details>summary","textarea:not([disabled])"].map(e=>`${e}:not([tabindex='-1'])`).join(","),y2=["[data-autofocus]"].map(e=>`${e}:not([tabindex='-1'])`).join(",");var Yl=(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))(Yl||{}),v2=(e=>(e[e.Error=0]="Error",e[e.Overflow=1]="Overflow",e[e.Success=2]="Success",e[e.Underflow=3]="Underflow",e))(v2||{}),w2=(e=>(e[e.Previous=-1]="Previous",e[e.Next=1]="Next",e))(w2||{});function gp(e=document.body){return e==null?[]:Array.from(e.querySelectorAll(Zl)).sort((t,n)=>Math.sign((t.tabIndex||Number.MAX_SAFE_INTEGER)-(n.tabIndex||Number.MAX_SAFE_INTEGER)))}function x2(e=document.body){return e==null?[]:Array.from(e.querySelectorAll(y2)).sort((t,n)=>Math.sign((t.tabIndex||Number.MAX_SAFE_INTEGER)-(n.tabIndex||Number.MAX_SAFE_INTEGER)))}var Xl=(e=>(e[e.Strict=0]="Strict",e[e.Loose=1]="Loose",e))(Xl||{});function yp(e,t=0){var n;return e===((n=ti(e))==null?void 0:n.body)?!1:St(t,{0(){return e.matches(Zl)},1(){let r=e;for(;r!==null;){if(r.matches(Zl))return!0;r=r.parentElement}return!1}})}var E2=(e=>(e[e.Keyboard=0]="Keyboard",e[e.Mouse=1]="Mouse",e))(E2||{});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 S2=["textarea","input"].join(",");function P2(e){var t,n;return(n=(t=e==null?void 0:e.matches)==null?void 0:t.call(e,S2))!=null?n:!1}function vp(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 T2(e,t,n=e===null?document.body:ni(e)){return A2(gp(n),t,{relativeTo:e})}function A2(e,t,{sorted:n=!0,relativeTo:r=null,skipElements:o=[]}={}){let s=Array.isArray(e)?e.length>0?ni(e[0]):document:ni(e),i=Array.isArray(e)?n?vp(e):e:t&64?x2(e):gp(e);o.length>0&&i.length>1&&(i=i.filter(d=>!o.some(h=>h!=null&&"current"in h?(h==null?void 0:h.current)===d:h===d))),r=r??(s==null?void 0:s.activeElement);let l=(()=>{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")})(),c=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(c),u+=l}while(p!==R0(p));return t&6&&P2(p)&&p.select(),2}function wp(){return/iPhone/gi.test(window.navigator.platform)||/Mac/gi.test(window.navigator.platform)&&window.navigator.maxTouchPoints>0}function N2(){return/Android/gi.test(window.navigator.userAgent)}function xp(){return wp()||N2()}function Ur(e,t,n,r){let o=lr(n);g.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 C2(e,t,n,r){let o=lr(n);g.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 Ep=30;function O2(e,t,n){let r=lr(n),o=g.useCallback(function(l,a){if(l.defaultPrevented)return;let c=a(l);if(c===null||!c.getRootNode().contains(c)||!c.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(c)||l.composed&&l.composedPath().includes(f)))return;return!yp(c,Xl.Loose)&&c.tabIndex!==-1&&l.preventDefault(),r.current(l,c)},[r,t]),s=g.useRef(null);Ur(e,"pointerdown",l=>{var a,c;xp()||(s.current=((c=(a=l.composedPath)==null?void 0:a.call(l))==null?void 0:c[0])||l.target)},!0),Ur(e,"pointerup",l=>{if(xp()||!s.current)return;let a=s.current;return s.current=null,o(l,()=>a)},!0);let i=g.useRef({x:0,y:0});Ur(e,"touchstart",l=>{i.current.x=l.touches[0].clientX,i.current.y=l.touches[0].clientY},!0),Ur(e,"touchend",l=>{let a={x:l.changedTouches[0].clientX,y:l.changedTouches[0].clientY};if(!(Math.abs(a.x-i.current.x)>=Ep||Math.abs(a.y-i.current.y)>=Ep))return o(l,()=>zr(l.target)?l.target:null)},!0),C2(e,"blur",l=>o(l,()=>Ux(window.document.activeElement)?window.document.activeElement:null),!0)}function Jl(...e){return g.useMemo(()=>ti(...e),[...e])}var I2=(e=>(e[e.Ignore=0]="Ignore",e[e.Select=1]="Select",e[e.Close=2]="Close",e))(I2||{});const ai={Ignore:{kind:0},Select:e=>({kind:1,target:e}),Close:{kind:2}},$2=200,Sp=5;function k2(e,{trigger:t,action:n,close:r,select:o}){let s=g.useRef(null),i=g.useRef(null),l=g.useRef(null);Ur(e&&t!==null,"pointerdown",a=>{q0(a==null?void 0:a.target)&&t!=null&&t.contains(a.target)&&(i.current=a.x,l.current=a.y,s.current=a.timeStamp)}),Ur(e&&t!==null,"pointerup",a=>{var c,u;let f=s.current;if(f===null||(s.current=null,!zr(a.target))||Math.abs(a.x-((c=i.current)!=null?c:a.x))<Sp&&Math.abs(a.y-((u=l.current)!=null?u:a.y))<Sp)return;let p=n(a);switch(p.kind){case 0:return;case 1:{a.timeStamp-f>$2&&(o(p.target),r());break}case 2:{r();break}}},{capture:!0})}function M2(e,t){return g.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 D2(e){return g.useSyncExternalStore(e.subscribe,e.getSnapshot,e.getSnapshot)}function B2(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(l=>l()))}}}function L2(){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 F2(){return wp()?{before({doc:e,d:t,meta:n}){function r(o){for(let s of n().containers)for(let i of s())if(i.contains(o))return!0;return!1}t.microTask(()=>{var o;if(window.getComputedStyle(e.documentElement).scrollBehavior!=="auto"){let l=pt();l.style(e.documentElement,"scrollBehavior","auto"),t.add(()=>t.microTask(()=>l.dispose()))}let s=(o=window.scrollY)!=null?o:window.pageYOffset,i=null;t.addEventListener(e,"click",l=>{if(zr(l.target))try{let a=l.target.closest("a");if(!a)return;let{hash:c}=new URL(a.href),u=e.querySelector(c);zr(u)&&!r(u)&&(i=u)}catch{}},!0),t.group(l=>{t.addEventListener(e,"touchstart",a=>{if(l.dispose(),zr(a.target)&&zx(a.target))if(r(a.target)){let c=a.target;for(;c.parentElement&&r(c.parentElement);)c=c.parentElement;l.style(c,"overscrollBehavior","contain")}else l.style(a.target,"touchAction","none")})}),t.addEventListener(e,"touchmove",l=>{if(zr(l.target)){if(K0(l.target))return;if(r(l.target)){let a=l.target;for(;a.parentElement&&a.dataset.headlessuiPortal!==""&&!(a.scrollHeight>a.clientHeight||a.scrollWidth>a.clientWidth);)a=a.parentElement;a.dataset.headlessuiPortal===""&&l.preventDefault()}else l.preventDefault()}},{passive:!1}),t.add(()=>{var l;let a=(l=window.scrollY)!=null?l:window.pageYOffset;s!==a&&window.scrollTo(0,s),i&&i.isConnected&&(i.scrollIntoView({block:"nearest"}),i=null)})})}}:{}}function R2(){return{before({doc:e,d:t}){t.style(e.documentElement,"overflow","hidden")}}}function Pp(e){let t={};for(let n of e)Object.assign(t,n(t));return t}let cr=B2(()=>new Map,{PUSH(e,t){var n;let r=(n=this.get(e))!=null?n:{doc:e,count:0,d:pt(),meta:new Set,computedMeta:{}};return r.count++,r.meta.add(t),r.computedMeta=Pp(r.meta),this.set(e,r),this},POP(e,t){let n=this.get(e);return n&&(n.count--,n.meta.delete(t),n.computedMeta=Pp(n.meta)),this},SCROLL_PREVENT(e){let t={doc:e.doc,d:e.d,meta(){return e.computedMeta}},n=[F2(),L2(),R2()];n.forEach(({before:r})=>r==null?void 0:r(t)),n.forEach(({after:r})=>r==null?void 0:r(t))},SCROLL_ALLOW({d:e}){e.dispose()},TEARDOWN({doc:e}){this.delete(e)}});cr.subscribe(()=>{let e=cr.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)&&cr.dispatch(n.count>0?"SCROLL_PREVENT":"SCROLL_ALLOW",n),n.count===0&&cr.dispatch("TEARDOWN",n)}});function j2(e,t,n=()=>({containers:[]})){let r=D2(cr),o=t?r.get(t):void 0,s=o?o.count>0:!1;return Oe(()=>{if(!(!t||!e))return cr.dispatch("PUSH",t,n),()=>cr.dispatch("POP",t,n)},[e,t]),s}function z2(e,t,n=()=>[document.body]){let r=hp(e,"scroll-lock");j2(r,t,o=>{var s;return{containers:[...(s=o.containers)!=null?s:[],n]}})}function Tp(e){return[e.screenX,e.screenY]}function U2(){let e=g.useRef([-1,-1]);return{wasMoved(t){let n=Tp(t);return e.current[0]===n[0]&&e.current[1]===n[1]?!1:(e.current=n,!0)},update(t){e.current=Tp(t)}}}function W2(e=0){let[t,n]=g.useState(e),r=g.useCallback(a=>n(a),[]),o=g.useCallback(a=>n(c=>c|a),[]),s=g.useCallback(a=>(t&a)===a,[t]),i=g.useCallback(a=>n(c=>c&~a),[]),l=g.useCallback(a=>n(c=>c^a),[]);return{flags:t,setFlag:r,addFlag:o,hasFlag:s,removeFlag:i,toggleFlag:l}}var Ap,Np;typeof process<"u"&&typeof globalThis<"u"&&typeof Element<"u"&&((Ap=process==null?void 0:process.env)==null?void 0:Ap.NODE_ENV)==="test"&&typeof((Np=Element==null?void 0:Element.prototype)==null?void 0:Np.getAnimations)>"u"&&(Element.prototype.getAnimations=function(){return console.warn(["Headless UI has polyfilled `Element.prototype.getAnimations` for your tests.","Please install a proper polyfill e.g. `jsdom-testing-mocks`, to silence these warnings.","","Example usage:","```js","import { mockAnimationsApi } from 'jsdom-testing-mocks'","mockAnimationsApi()","```"].join(`
136
+ `)),[]});var _2=(e=>(e[e.None=0]="None",e[e.Closed=1]="Closed",e[e.Enter=2]="Enter",e[e.Leave=4]="Leave",e))(_2||{});function Cp(e){let t={};for(let n in e)e[n]===!0&&(t[`data-${n}`]="");return t}function Op(e,t,n,r){let[o,s]=g.useState(n),{hasFlag:i,addFlag:l,removeFlag:a}=W2(e&&o?3:0),c=g.useRef(!1),u=g.useRef(!1),f=ar();return Oe(()=>{var p;if(e){if(n&&s(!0),!t){n&&l(3);return}return(p=r==null?void 0:r.start)==null||p.call(r,n),V2(t,{inFlight:c,prepare(){u.current?u.current=!1:u.current=c.current,c.current=!0,!u.current&&(n?(l(3),a(4)):(l(4),a(2)))},run(){u.current?n?(a(3),l(4)):(a(4),l(3)):n?a(1):l(1)},done(){var d;u.current&&q2(t)||(c.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 V2(e,{prepare:t,run:n,done:r,inFlight:o}){let s=pt();return G2(e,{prepare:t,inFlight:o}),s.nextFrame(()=>{n(),s.requestAnimationFrame(()=>{s.add(H2(e,r))})}),s.dispose}function H2(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(l=>l instanceof CSSTransition))!=null?r:[];return i.length===0?(t(),o.dispose):(Promise.allSettled(i.map(l=>l.finished)).then(()=>{s||t()}),o.dispose)}function G2(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 q2(e){var t,n;return((n=(t=e.getAnimations)==null?void 0:t.call(e))!=null?n:[]).some(r=>r instanceof CSSTransition&&r.playState!=="finished")}function li(){return typeof window<"u"}function Wr(e){return Ql(e)?(e.nodeName||"").toLowerCase():"#document"}function ot(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Qt(e){var t;return(t=(Ql(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function Ql(e){return li()?e instanceof Node||e instanceof ot(e).Node:!1}function me(e){return li()?e instanceof Element||e instanceof ot(e).Element:!1}function st(e){return li()?e instanceof HTMLElement||e instanceof ot(e).HTMLElement:!1}function ec(e){return!li()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof ot(e).ShadowRoot}function ns(e){const{overflow:t,overflowX:n,overflowY:r,display:o}=At(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&o!=="inline"&&o!=="contents"}function K2(e){return/^(table|td|th)$/.test(Wr(e))}function ci(e){try{if(e.matches(":popover-open"))return!0}catch{}try{return e.matches(":modal")}catch{return!1}}const Z2=/transform|translate|scale|rotate|perspective|filter/,Y2=/paint|layout|strict|content/,ur=e=>!!e&&e!=="none";let tc;function nc(e){const t=me(e)?At(e):e;return ur(t.transform)||ur(t.translate)||ur(t.scale)||ur(t.rotate)||ur(t.perspective)||!ui()&&(ur(t.backdropFilter)||ur(t.filter))||Z2.test(t.willChange||"")||Y2.test(t.contain||"")}function X2(e){let t=xn(e);for(;st(t)&&!wn(t);){if(nc(t))return t;if(ci(t))return null;t=xn(t)}return null}function ui(){return tc==null&&(tc=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),tc}function wn(e){return/^(html|body|#document)$/.test(Wr(e))}function At(e){return ot(e).getComputedStyle(e)}function fi(e){return me(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function xn(e){if(Wr(e)==="html")return e;const t=e.assignedSlot||e.parentNode||ec(e)&&e.host||Qt(e);return ec(t)?t.host:t}function Ip(e){const t=xn(e);return wn(t)?e.ownerDocument?e.ownerDocument.body:e.body:st(t)&&ns(t)?t:Ip(t)}function zn(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const o=Ip(e),s=o===((r=e.ownerDocument)==null?void 0:r.body),i=ot(o);if(s){const l=rc(i);return t.concat(i,i.visualViewport||[],ns(o)?o:[],l&&n?zn(l):[])}else return t.concat(o,zn(o,[],n))}function rc(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function J2(){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 En=Math.min,We=Math.max,rs=Math.round,di=Math.floor,en=e=>({x:e,y:e}),Q2={left:"right",right:"left",bottom:"top",top:"bottom"};function oc(e,t,n){return We(e,En(t,n))}function fr(e,t){return typeof e=="function"?e(t):e}function Un(e){return e.split("-")[0]}function _r(e){return e.split("-")[1]}function $p(e){return e==="x"?"y":"x"}function sc(e){return e==="y"?"height":"width"}function Sn(e){const t=e[0];return t==="t"||t==="b"?"y":"x"}function ic(e){return $p(Sn(e))}function eE(e,t,n){n===void 0&&(n=!1);const r=_r(e),o=ic(e),s=sc(o);let i=o==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[s]>t.floating[s]&&(i=pi(i)),[i,pi(i)]}function tE(e){const t=pi(e);return[ac(e),t,ac(t)]}function ac(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const kp=["left","right"],Mp=["right","left"],nE=["top","bottom"],rE=["bottom","top"];function oE(e,t,n){switch(e){case"top":case"bottom":return n?t?Mp:kp:t?kp:Mp;case"left":case"right":return t?nE:rE;default:return[]}}function sE(e,t,n,r){const o=_r(e);let s=oE(Un(e),n==="start",r);return o&&(s=s.map(i=>i+"-"+o),t&&(s=s.concat(s.map(ac)))),s}function pi(e){const t=Un(e);return Q2[t]+e.slice(t.length)}function iE(e){return{top:0,right:0,bottom:0,left:0,...e}}function Dp(e){return typeof e!="number"?iE(e):{top:e,right:e,bottom:e,left:e}}function hi(e){const{x:t,y:n,width:r,height:o}=e;return{width:r,height:o,top:n,left:t,right:t+r,bottom:n+o,x:t,y:n}}/*!
137
137
  * tabbable 6.4.0
138
138
  * @license MIT, https://github.com/focus-trap/tabbable/blob/master/LICENSE
139
- */var aE=["input:not([inert]):not([inert] *)","select:not([inert]):not([inert] *)","textarea:not([inert]):not([inert] *)","a[href]:not([inert]):not([inert] *)","button:not([inert]):not([inert] *)","[tabindex]:not(slot):not([inert]):not([inert] *)","audio[controls]:not([inert]):not([inert] *)","video[controls]:not([inert]):not([inert] *)",'[contenteditable]:not([contenteditable="false"]):not([inert]):not([inert] *)',"details>summary:first-of-type:not([inert]):not([inert] *)","details:not([inert]):not([inert] *)"],lc=aE.join(","),Bp=typeof Element>"u",rs=Bp?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,mi=!Bp&&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},bi=function(t,n){var r;n===void 0&&(n=!0);var o=t==null||(r=t.getAttribute)===null||r===void 0?void 0:r.call(t,"inert"),s=o===""||o==="true",i=s||n&&t&&(typeof t.closest=="function"?t.closest("[inert]"):bi(t.parentNode));return i},lE=function(t){var n,r=t==null||(n=t.getAttribute)===null||n===void 0?void 0:n.call(t,"contenteditable");return r===""||r==="true"},cE=function(t,n,r){if(bi(t))return[];var o=Array.prototype.slice.apply(t.querySelectorAll(lc));return n&&rs.call(t,lc)&&o.unshift(t),o=o.filter(r),o},cc=function(t,n,r){for(var o=[],s=Array.from(t);s.length;){var i=s.shift();if(!bi(i,!1))if(i.tagName==="SLOT"){var l=i.assignedElements(),a=l.length?l:i.children,c=cc(a,!0,r);r.flatten?o.push.apply(o,c):o.push({scopeParent:i,candidates:c})}else{var u=rs.call(i,lc);u&&r.filter(i)&&(n||!t.includes(i))&&o.push(i);var f=i.shadowRoot||typeof r.getShadowRoot=="function"&&r.getShadowRoot(i),p=!bi(f,!1)&&(!r.shadowRootFilter||r.shadowRootFilter(i));if(f&&p){var d=cc(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},Lp=function(t){return!isNaN(parseInt(t.getAttribute("tabindex"),10))},Fp=function(t){if(!t)throw new Error("No node provided");return t.tabIndex<0&&(/^(AUDIO|VIDEO|DETAILS)$/.test(t.tagName)||lE(t))&&!Lp(t)?0:t.tabIndex},uE=function(t,n){var r=Fp(t);return r<0&&n&&!Lp(t)?0:r},fE=function(t,n){return t.tabIndex===n.tabIndex?t.documentOrder-n.documentOrder:t.tabIndex-n.tabIndex},Rp=function(t){return t.tagName==="INPUT"},dE=function(t){return Rp(t)&&t.type==="hidden"},pE=function(t){var n=t.tagName==="DETAILS"&&Array.prototype.slice.apply(t.children).some(function(r){return r.tagName==="SUMMARY"});return n},hE=function(t,n){for(var r=0;r<t.length;r++)if(t[r].checked&&t[r].form===n)return t[r]},mE=function(t){if(!t.name)return!0;var n=t.form||mi(t),r=function(l){return n.querySelectorAll('input[type="radio"][name="'+l+'"]')},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=hE(o,t.form);return!s||s===t},bE=function(t){return Rp(t)&&t.type==="radio"},gE=function(t){return bE(t)&&!mE(t)},yE=function(t){var n,r=t&&mi(t),o=(n=r)===null||n===void 0?void 0:n.host,s=!1;if(r&&r!==t){var i,l,a;for(s=!!((i=o)!==null&&i!==void 0&&(l=i.ownerDocument)!==null&&l!==void 0&&l.contains(o)||t!=null&&(a=t.ownerDocument)!==null&&a!==void 0&&a.contains(t));!s&&o;){var c,u,f;r=mi(o),o=(c=r)===null||c===void 0?void 0:c.host,s=!!((u=o)!==null&&u!==void 0&&(f=u.ownerDocument)!==null&&f!==void 0&&f.contains(o))}}return s},jp=function(t){var n=t.getBoundingClientRect(),r=n.width,o=n.height;return r===0&&o===0},vE=function(t,n){var r=n.displayCheck,o=n.getShadowRoot;if(r==="full-native"&&"checkVisibility"in t){var s=t.checkVisibility({checkOpacity:!1,opacityProperty:!1,contentVisibilityAuto:!0,visibilityProperty:!0,checkVisibilityCSS:!0});return!s}if(getComputedStyle(t).visibility==="hidden")return!0;var i=rs.call(t,"details>summary:first-of-type"),l=i?t.parentElement:t;if(rs.call(l,"details:not([open]) *"))return!0;if(!r||r==="full"||r==="full-native"||r==="legacy-full"){if(typeof o=="function"){for(var a=t;t;){var c=t.parentElement,u=mi(t);if(c&&!c.shadowRoot&&o(c)===!0)return jp(t);t.assignedSlot?t=t.assignedSlot:!c&&u!==t.ownerDocument?t=u.host:t=c}t=a}if(yE(t))return!t.getClientRects().length;if(r!=="legacy-full")return!0}else if(r==="non-zero-area")return jp(t);return!1},wE=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 rs.call(n,"fieldset[disabled] *")?!0:!o.contains(t)}return!0}n=n.parentElement}return!1},xE=function(t,n){return!(n.disabled||dE(n)||vE(n,t)||pE(n)||wE(n))},zp=function(t,n){return!(gE(n)||Fp(n)<0||!xE(t,n))},EE=function(t){var n=parseInt(t.getAttribute("tabindex"),10);return!!(isNaN(n)||n>=0)},Up=function(t){var n=[],r=[];return t.forEach(function(o,s){var i=!!o.scopeParent,l=i?o.scopeParent:o,a=uE(l,i),c=i?Up(o.candidates):l;a===0?i?n.push.apply(n,c):n.push(l):r.push({documentOrder:s,tabIndex:a,item:o,isScope:i,content:c})}),r.sort(fE).reduce(function(o,s){return s.isScope?o.push.apply(o,s.content):o.push(s.content),o},[]).concat(n)},_p=function(t,n){n=n||{};var r;return n.getShadowRoot?r=cc([t],n.includeContainer,{filter:zp.bind(null,n),flatten:!1,getShadowRoot:n.getShadowRoot,shadowRootFilter:EE}):r=cE(t,n.includeContainer,zp.bind(null,n)),Up(r)};function Wp(e,t,n){let{reference:r,floating:o}=e;const s=Sn(t),i=ic(t),l=sc(i),a=_n(t),c=s==="y",u=r.x+r.width/2-o.width/2,f=r.y+r.height/2-o.height/2,p=r[l]/2-o[l]/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(Wr(t)){case"start":d[i]-=p*(n&&c?-1:1);break;case"end":d[i]+=p*(n&&c?-1:1);break}return d}async function Vp(e,t){var n;t===void 0&&(t={});const{x:r,y:o,platform:s,rects:i,elements:l,strategy:a}=e,{boundary:c="clippingAncestors",rootBoundary:u="viewport",elementContext:f="floating",altBoundary:p=!1,padding:d=0}=fr(t,e),h=Dp(d),w=l[p?f==="floating"?"reference":"floating":f],P=hi(await s.getClippingRect({element:(n=await(s.isElement==null?void 0:s.isElement(w)))==null||n?w:w.contextElement||await(s.getDocumentElement==null?void 0:s.getDocumentElement(l.floating)),boundary:c,rootBoundary:u,strategy:a})),x=f==="floating"?{x:r,y:o,width:i.floating.width,height:i.floating.height}:i.reference,E=await(s.getOffsetParent==null?void 0:s.getOffsetParent(l.floating)),A=await(s.isElement==null?void 0:s.isElement(E))?await(s.getScale==null?void 0:s.getScale(E))||{x:1,y:1}:{x:1,y:1},D=hi(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:l,rect:x,offsetParent:E,strategy:a}):x);return{top:(P.top-D.top+h.top)/A.y,bottom:(D.bottom-P.bottom+h.bottom)/A.y,left:(P.left-D.left+h.left)/A.x,right:(D.right-P.right+h.right)/A.x}}const SE=50,PE=async(e,t,n)=>{const{placement:r="bottom",strategy:o="absolute",middleware:s=[],platform:i}=n,l=i.detectOverflow?i:{...i,detectOverflow:Vp},a=await(i.isRTL==null?void 0:i.isRTL(t));let c=await i.getElementRects({reference:e,floating:t,strategy:o}),{x:u,y:f}=Wp(c,r,a),p=r,d=0;const h={};for(let b=0;b<s.length;b++){const w=s[b];if(!w)continue;const{name:P,fn:x}=w,{x:E,y:A,data:D,reset:L}=await x({x:u,y:f,initialPlacement:r,placement:p,strategy:o,middlewareData:h,rects:c,platform:l,elements:{reference:e,floating:t}});u=E??u,f=A??f,h[P]={...h[P],...D},L&&d<SE&&(d++,typeof L=="object"&&(L.placement&&(p=L.placement),L.rects&&(c=L.rects===!0?await i.getElementRects({reference:e,floating:t,strategy:o}):L.rects),{x:u,y:f}=Wp(c,p,a)),b=-1)}return{x:u,y:f,placement:p,strategy:o,middlewareData:h}},TE=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:o,rects:s,platform:i,elements:l,middlewareData:a}=t,{element:c,padding:u=0}=fr(e,t)||{};if(c==null)return{};const f=Dp(u),p={x:n,y:r},d=ic(o),h=sc(d),b=await i.getDimensions(c),w=d==="y",P=w?"top":"left",x=w?"bottom":"right",E=w?"clientHeight":"clientWidth",A=s.reference[h]+s.reference[d]-p[d]-s.floating[h],D=p[d]-s.reference[d],L=await(i.getOffsetParent==null?void 0:i.getOffsetParent(c));let F=L?L[E]:0;(!F||!await(i.isElement==null?void 0:i.isElement(L)))&&(F=l.floating[E]||s.floating[h]);const m=A/2-D/2,v=F/2-b[h]/2-1,S=En(f[P],v),$=En(f[x],v),I=S,C=F-b[h]-$,M=F/2-b[h]/2+m,y=oc(I,M,C),O=!a.arrow&&Wr(o)!=null&&M!==y&&s.reference[h]/2-(M<I?S:$)-b[h]/2<0,k=O?M<I?M-I:M-C:0;return{[d]:p[d]+k,data:{[d]:y,centerOffset:M-y-k,...O&&{alignmentOffset:k}},reset:O}}}),AE=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:l,platform:a,elements:c}=t,{mainAxis:u=!0,crossAxis:f=!0,fallbackPlacements:p,fallbackStrategy:d="bestFit",fallbackAxisSideDirection:h="none",flipAlignment:b=!0,...w}=fr(e,t);if((n=s.arrow)!=null&&n.alignmentOffset)return{};const P=_n(o),x=Sn(l),E=_n(l)===l,A=await(a.isRTL==null?void 0:a.isRTL(c.floating)),D=p||(E||!b?[pi(l)]:tE(l)),L=h!=="none";!p&&L&&D.push(...sE(l,b,h,A));const F=[l,...D],m=await a.detectOverflow(t,w),v=[];let S=((r=s.flip)==null?void 0:r.overflows)||[];if(u&&v.push(m[P]),f){const M=eE(o,i,A);v.push(m[M[0]],m[M[1]])}if(S=[...S,{placement:o,overflows:v}],!v.every(M=>M<=0)){var $,I;const M=((($=s.flip)==null?void 0:$.index)||0)+1,y=F[M];if(y&&(!(f==="alignment"?x!==Sn(y):!1)||S.every(T=>Sn(T.placement)===x?T.overflows[0]>0:!0)))return{data:{index:M,overflows:S},reset:{placement:y}};let O=(I=S.filter(k=>k.overflows[0]<=0).sort((k,T)=>k.overflows[1]-T.overflows[1])[0])==null?void 0:I.placement;if(!O)switch(d){case"bestFit":{var C;const k=(C=S.filter(T=>{if(L){const B=Sn(T.placement);return B===x||B==="y"}return!0}).map(T=>[T.placement,T.overflows.filter(B=>B>0).reduce((B,R)=>B+R,0)]).sort((T,B)=>T[1]-B[1])[0])==null?void 0:C[0];k&&(O=k);break}case"initialPlacement":O=l;break}if(o!==O)return{reset:{placement:O}}}return{}}}},NE=new Set(["left","top"]);async function CE(e,t){const{placement:n,platform:r,elements:o}=e,s=await(r.isRTL==null?void 0:r.isRTL(o.floating)),i=_n(n),l=Wr(n),a=Sn(n)==="y",c=NE.has(i)?-1:1,u=s&&a?-1:1,f=fr(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 l&&typeof h=="number"&&(d=l==="end"?h*-1:h),a?{x:d*u,y:p*c}:{x:p*c,y:d*u}}const OE=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:l}=t,a=await CE(t,e);return i===((n=l.offset)==null?void 0:n.placement)&&(r=l.arrow)!=null&&r.alignmentOffset?{}:{x:o+a.x,y:s+a.y,data:{...a,placement:i}}}}},IE=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:o,platform:s}=t,{mainAxis:i=!0,crossAxis:l=!1,limiter:a={fn:P=>{let{x,y:E}=P;return{x,y:E}}},...c}=fr(e,t),u={x:n,y:r},f=await s.detectOverflow(t,c),p=Sn(_n(o)),d=$p(p);let h=u[d],b=u[p];if(i){const P=d==="y"?"top":"left",x=d==="y"?"bottom":"right",E=h+f[P],A=h-f[x];h=oc(E,h,A)}if(l){const P=p==="y"?"top":"left",x=p==="y"?"bottom":"right",E=b+f[P],A=b-f[x];b=oc(E,b,A)}const w=a.fn({...t,[d]:h,[p]:b});return{...w,data:{x:w.x-n,y:w.y-r,enabled:{[d]:i,[p]:l}}}}}},$E=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:l}=t,{apply:a=()=>{},...c}=fr(e,t),u=await i.detectOverflow(t,c),f=_n(o),p=Wr(o),d=Sn(o)==="y",{width:h,height:b}=s.floating;let w,P;f==="top"||f==="bottom"?(w=f,P=p===(await(i.isRTL==null?void 0:i.isRTL(l.floating))?"start":"end")?"left":"right"):(P=f,w=p==="end"?"top":"bottom");const x=b-u.top-u.bottom,E=h-u.left-u.right,A=En(b-u[w],x),D=En(h-u[P],E),L=!t.middlewareData.shift;let F=A,m=D;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(m=E),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(F=x),L&&!p){const S=_e(u.left,0),$=_e(u.right,0),I=_e(u.top,0),C=_e(u.bottom,0);d?m=h-2*(S!==0||$!==0?S+$:_e(u.left,u.right)):F=b-2*(I!==0||C!==0?I+C:_e(u.top,u.bottom))}await a({...t,availableWidth:m,availableHeight:F});const v=await i.getDimensions(l.floating);return h!==v.width||b!==v.height?{reset:{rects:!0}}:{}}}};function Hp(e){const t=At(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const o=st(e),s=o?e.offsetWidth:n,i=o?e.offsetHeight:r,l=ns(n)!==s||ns(r)!==i;return l&&(n=s,r=i),{width:n,height:r,$:l}}function uc(e){return me(e)?e:e.contextElement}function Vr(e){const t=uc(e);if(!st(t))return en(1);const n=t.getBoundingClientRect(),{width:r,height:o,$:s}=Hp(t);let i=(s?ns(n.width):n.width)/r,l=(s?ns(n.height):n.height)/o;return(!i||!Number.isFinite(i))&&(i=1),(!l||!Number.isFinite(l))&&(l=1),{x:i,y:l}}const kE=en(0);function Gp(e){const t=ot(e);return!ui()||!t.visualViewport?kE:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function ME(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==ot(e)?!1:t}function dr(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const o=e.getBoundingClientRect(),s=uc(e);let i=en(1);t&&(r?me(r)&&(i=Vr(r)):i=Vr(e));const l=ME(s,n,r)?Gp(s):en(0);let a=(o.left+l.x)/i.x,c=(o.top+l.y)/i.y,u=o.width/i.x,f=o.height/i.y;if(s){const p=ot(s),d=r&&me(r)?ot(r):r;let h=p,b=rc(h);for(;b&&r&&d!==h;){const w=Vr(b),P=b.getBoundingClientRect(),x=At(b),E=P.left+(b.clientLeft+parseFloat(x.paddingLeft))*w.x,A=P.top+(b.clientTop+parseFloat(x.paddingTop))*w.y;a*=w.x,c*=w.y,u*=w.x,f*=w.y,a+=E,c+=A,h=ot(b),b=rc(h)}}return hi({width:u,height:f,x:a,y:c})}function gi(e,t){const n=fi(e).scrollLeft;return t?t.left+n:dr(Qt(e)).left+n}function qp(e,t){const n=e.getBoundingClientRect(),r=n.left+t.scrollLeft-gi(e,n),o=n.top+t.scrollTop;return{x:r,y:o}}function DE(e){let{elements:t,rect:n,offsetParent:r,strategy:o}=e;const s=o==="fixed",i=Qt(r),l=t?ci(t.floating):!1;if(r===i||l&&s)return n;let a={scrollLeft:0,scrollTop:0},c=en(1);const u=en(0),f=st(r);if((f||!f&&!s)&&((_r(r)!=="body"||ts(i))&&(a=fi(r)),f)){const d=dr(r);c=Vr(r),u.x=d.x+r.clientLeft,u.y=d.y+r.clientTop}const p=i&&!f&&!s?qp(i,a):en(0);return{width:n.width*c.x,height:n.height*c.y,x:n.x*c.x-a.scrollLeft*c.x+u.x+p.x,y:n.y*c.y-a.scrollTop*c.y+u.y+p.y}}function BE(e){return Array.from(e.getClientRects())}function LE(e){const t=Qt(e),n=fi(e),r=e.ownerDocument.body,o=_e(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),s=_e(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let i=-n.scrollLeft+gi(e);const l=-n.scrollTop;return At(r).direction==="rtl"&&(i+=_e(t.clientWidth,r.clientWidth)-o),{width:o,height:s,x:i,y:l}}const Kp=25;function FE(e,t){const n=ot(e),r=Qt(e),o=n.visualViewport;let s=r.clientWidth,i=r.clientHeight,l=0,a=0;if(o){s=o.width,i=o.height;const u=ui();(!u||u&&t==="fixed")&&(l=o.offsetLeft,a=o.offsetTop)}const c=gi(r);if(c<=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<=Kp&&(s-=h)}else c<=Kp&&(s+=c);return{width:s,height:i,x:l,y:a}}function RE(e,t){const n=dr(e,!0,t==="fixed"),r=n.top+e.clientTop,o=n.left+e.clientLeft,s=st(e)?Vr(e):en(1),i=e.clientWidth*s.x,l=e.clientHeight*s.y,a=o*s.x,c=r*s.y;return{width:i,height:l,x:a,y:c}}function Zp(e,t,n){let r;if(t==="viewport")r=FE(e,n);else if(t==="document")r=LE(Qt(e));else if(me(t))r=RE(t,n);else{const o=Gp(e);r={x:t.x-o.x,y:t.y-o.y,width:t.width,height:t.height}}return hi(r)}function Yp(e,t){const n=xn(e);return n===t||!me(n)||wn(n)?!1:At(n).position==="fixed"||Yp(n,t)}function jE(e,t){const n=t.get(e);if(n)return n;let r=Un(e,[],!1).filter(l=>me(l)&&_r(l)!=="body"),o=null;const s=At(e).position==="fixed";let i=s?xn(e):e;for(;me(i)&&!wn(i);){const l=At(i),a=nc(i);!a&&l.position==="fixed"&&(o=null),(s?!a&&!o:!a&&l.position==="static"&&!!o&&(o.position==="absolute"||o.position==="fixed")||ts(i)&&!a&&Yp(e,i))?r=r.filter(u=>u!==i):o=l,i=xn(i)}return t.set(e,r),r}function zE(e){let{element:t,boundary:n,rootBoundary:r,strategy:o}=e;const i=[...n==="clippingAncestors"?ci(t)?[]:jE(t,this._c):[].concat(n),r],l=Zp(t,i[0],o);let a=l.top,c=l.right,u=l.bottom,f=l.left;for(let p=1;p<i.length;p++){const d=Zp(t,i[p],o);a=_e(d.top,a),c=En(d.right,c),u=En(d.bottom,u),f=_e(d.left,f)}return{width:c-f,height:u-a,x:f,y:a}}function UE(e){const{width:t,height:n}=Hp(e);return{width:t,height:n}}function _E(e,t,n){const r=st(t),o=Qt(t),s=n==="fixed",i=dr(e,!0,s,t);let l={scrollLeft:0,scrollTop:0};const a=en(0);function c(){a.x=gi(o)}if(r||!r&&!s)if((_r(t)!=="body"||ts(o))&&(l=fi(t)),r){const d=dr(t,!0,s,t);a.x=d.x+t.clientLeft,a.y=d.y+t.clientTop}else o&&c();s&&!r&&o&&c();const u=o&&!r&&!s?qp(o,l):en(0),f=i.left+l.scrollLeft-a.x-u.x,p=i.top+l.scrollTop-a.y-u.y;return{x:f,y:p,width:i.width,height:i.height}}function fc(e){return At(e).position==="static"}function Xp(e,t){if(!st(e)||At(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return Qt(e)===n&&(n=n.ownerDocument.body),n}function Jp(e,t){const n=ot(e);if(ci(e))return n;if(!st(e)){let o=xn(e);for(;o&&!wn(o);){if(me(o)&&!fc(o))return o;o=xn(o)}return n}let r=Xp(e,t);for(;r&&K2(r)&&fc(r);)r=Xp(r,t);return r&&wn(r)&&fc(r)&&!nc(r)?n:r||X2(e)||n}const WE=async function(e){const t=this.getOffsetParent||Jp,n=this.getDimensions,r=await n(e.floating);return{reference:_E(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function VE(e){return At(e).direction==="rtl"}const HE={convertOffsetParentRelativeRectToViewportRelativeRect:DE,getDocumentElement:Qt,getClippingRect:zE,getOffsetParent:Jp,getElementRects:WE,getClientRects:BE,getDimensions:UE,getScale:Vr,isElement:me,isRTL:VE};function Qp(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function GE(e,t){let n=null,r;const o=Qt(e);function s(){var l;clearTimeout(r),(l=n)==null||l.disconnect(),n=null}function i(l,a){l===void 0&&(l=!1),a===void 0&&(a=1),s();const c=e.getBoundingClientRect(),{left:u,top:f,width:p,height:d}=c;if(l||t(),!p||!d)return;const h=di(f),b=di(o.clientWidth-(u+p)),w=di(o.clientHeight-(f+d)),P=di(u),E={rootMargin:-h+"px "+-b+"px "+-w+"px "+-P+"px",threshold:_e(0,En(1,a))||1};let A=!0;function D(L){const F=L[0].intersectionRatio;if(F!==a){if(!A)return i();F?i(!1,F):r=setTimeout(()=>{i(!1,1e-7)},1e3)}F===1&&!Qp(c,e.getBoundingClientRect())&&i(),A=!1}try{n=new IntersectionObserver(D,{...E,root:o.ownerDocument})}catch{n=new IntersectionObserver(D,E)}n.observe(e)}return i(!0),s}function eh(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:o=!0,ancestorResize:s=!0,elementResize:i=typeof ResizeObserver=="function",layoutShift:l=typeof IntersectionObserver=="function",animationFrame:a=!1}=r,c=uc(e),u=o||s?[...c?Un(c):[],...t?Un(t):[]]:[];u.forEach(P=>{o&&P.addEventListener("scroll",n,{passive:!0}),s&&P.addEventListener("resize",n)});const f=c&&l?GE(c,n):null;let p=-1,d=null;i&&(d=new ResizeObserver(P=>{let[x]=P;x&&x.target===c&&d&&t&&(d.unobserve(t),cancelAnimationFrame(p),p=requestAnimationFrame(()=>{var E;(E=d)==null||E.observe(t)})),n()}),c&&!a&&d.observe(c),t&&d.observe(t));let h,b=a?dr(e):null;a&&w();function w(){const P=dr(e);b&&!Qp(b,P)&&n(),b=P,h=requestAnimationFrame(w)}return n(),()=>{var P;u.forEach(x=>{o&&x.removeEventListener("scroll",n),s&&x.removeEventListener("resize",n)}),f==null||f(),(P=d)==null||P.disconnect(),d=null,a&&cancelAnimationFrame(h)}}const dc=Vp,qE=OE,KE=IE,ZE=AE,YE=$E,th=TE,XE=(e,t,n)=>{const r=new Map,o={platform:HE,...n},s={...o.platform,_c:r};return PE(e,t,{...o,platform:s})};var JE=typeof document<"u",QE=function(){},yi=JE?g.useLayoutEffect:QE;function vi(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(!vi(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)&&!vi(e[s],t[s]))return!1}return!0}return e!==e&&t!==t}function nh(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function rh(e,t){const n=nh(e);return Math.round(t*n)/n}function pc(e){const t=U.useRef(e);return yi(()=>{t.current=e}),t}function oh(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:o,elements:{reference:s,floating:i}={},transform:l=!0,whileElementsMounted:a,open:c}=e,[u,f]=U.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[p,d]=U.useState(r);vi(p,r)||d(r);const[h,b]=U.useState(null),[w,P]=U.useState(null),x=U.useCallback(T=>{T!==L.current&&(L.current=T,b(T))},[]),E=U.useCallback(T=>{T!==F.current&&(F.current=T,P(T))},[]),A=s||h,D=i||w,L=U.useRef(null),F=U.useRef(null),m=U.useRef(u),v=a!=null,S=pc(a),$=pc(o),I=pc(c),C=U.useCallback(()=>{if(!L.current||!F.current)return;const T={placement:t,strategy:n,middleware:p};$.current&&(T.platform=$.current),XE(L.current,F.current,T).then(B=>{const R={...B,isPositioned:I.current!==!1};M.current&&!vi(m.current,R)&&(m.current=R,Jr.flushSync(()=>{f(R)}))})},[p,t,n,$,I]);yi(()=>{c===!1&&m.current.isPositioned&&(m.current.isPositioned=!1,f(T=>({...T,isPositioned:!1})))},[c]);const M=U.useRef(!1);yi(()=>(M.current=!0,()=>{M.current=!1}),[]),yi(()=>{if(A&&(L.current=A),D&&(F.current=D),A&&D){if(S.current)return S.current(A,D,C);C()}},[A,D,C,S,v]);const y=U.useMemo(()=>({reference:L,floating:F,setReference:x,setFloating:E}),[x,E]),O=U.useMemo(()=>({reference:A,floating:D}),[A,D]),k=U.useMemo(()=>{const T={position:n,left:0,top:0};if(!O.floating)return T;const B=rh(O.floating,u.x),R=rh(O.floating,u.y);return l?{...T,transform:"translate("+B+"px, "+R+"px)",...nh(O.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:B,top:R}},[n,l,O.floating,u.x,u.y]);return U.useMemo(()=>({...u,update:C,refs:y,elements:O,floatingStyles:k}),[u,C,y,O,k])}const e8=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?th({element:r.current,padding:o}).fn(n):{}:r?th({element:r,padding:o}).fn(n):{}}}},hc=(e,t)=>{const n=qE(e);return{name:n.name,fn:n.fn,options:[e,t]}},sh=(e,t)=>{const n=KE(e);return{name:n.name,fn:n.fn,options:[e,t]}},ih=(e,t)=>{const n=ZE(e);return{name:n.name,fn:n.fn,options:[e,t]}},t8=(e,t)=>{const n=YE(e);return{name:n.name,fn:n.fn,options:[e,t]}},n8=(e,t)=>{const n=e8(e);return{name:n.name,fn:n.fn,options:[e,t]}},ah={...U},r8=ah.useInsertionEffect||(e=>e());function lh(e){const t=U.useRef(()=>{if(process.env.NODE_ENV!=="production")throw new Error("Cannot call an event handler while rendering.")});return r8(()=>{t.current=e}),U.useCallback(function(){for(var n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return t.current==null?void 0:t.current(...r)},[])}var mc=typeof document<"u"?g.useLayoutEffect:g.useEffect;let ch=!1,o8=0;const uh=()=>"floating-ui-"+Math.random().toString(36).slice(2,6)+o8++;function s8(){const[e,t]=U.useState(()=>ch?uh():void 0);return mc(()=>{e==null&&t(uh())},[]),U.useEffect(()=>{ch=!0},[]),e}const i8=ah.useId||s8;let os;process.env.NODE_ENV!=="production"&&(os=new Set);function a8(){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=os)!=null&&e.has(o))){var s;(s=os)==null||s.add(o),console.warn(o)}}function l8(){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=os)!=null&&e.has(o))){var s;(s=os)==null||s.add(o),console.error(o)}}function c8(){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 u8=U.createContext(null),f8=U.createContext(null),d8=()=>{var e;return((e=U.useContext(u8))==null?void 0:e.id)||null},p8=()=>U.useContext(f8),h8="data-floating-ui-focusable";function m8(e){const{open:t=!1,onOpenChange:n,elements:r}=e,o=i8(),s=U.useRef({}),[i]=U.useState(()=>c8()),l=d8()!=null;if(process.env.NODE_ENV!=="production"){const d=r.reference;d&&!me(d)&&l8("Cannot pass a virtual element to the `elements.reference` option,","as it must be a real DOM element. Use `refs.setPositionReference()`","instead.")}const[a,c]=U.useState(r.reference),u=lh((d,h,b)=>{s.current.openEvent=d?h:void 0,i.emit("openchange",{open:d,event:h,reason:b,nested:l}),n==null||n(d,h,b)}),f=U.useMemo(()=>({setPositionReference:c}),[]),p=U.useMemo(()=>({reference:a||r.reference||null,floating:r.floating||null,domReference:r.reference}),[a,r.reference,r.floating]);return U.useMemo(()=>({dataRef:s,open:t,onOpenChange:u,elements:p,events:i,floatingId:o,refs:f}),[t,u,p,i,o,f])}function b8(e){e===void 0&&(e={});const{nodeId:t}=e,n=m8({...e,elements:{reference:null,floating:null,...e.elements}}),r=e.rootContext||n,o=r.elements,[s,i]=U.useState(null),[l,a]=U.useState(null),u=(o==null?void 0:o.domReference)||s,f=U.useRef(null),p=p8();mc(()=>{u&&(f.current=u)},[u]);const d=oh({...e,elements:{...o,...l&&{reference:l}}}),h=U.useCallback(E=>{const A=me(E)?{getBoundingClientRect:()=>E.getBoundingClientRect(),contextElement:E}:E;a(A),d.refs.setReference(A)},[d.refs]),b=U.useCallback(E=>{(me(E)||E===null)&&(f.current=E,i(E)),(me(d.refs.reference.current)||d.refs.reference.current===null||E!==null&&!me(E))&&d.refs.setReference(E)},[d.refs]),w=U.useMemo(()=>({...d.refs,setReference:b,setPositionReference:h,domReference:f}),[d.refs,b,h]),P=U.useMemo(()=>({...d.elements,domReference:u}),[d.elements,u]),x=U.useMemo(()=>({...d,...r,refs:w,elements:P,nodeId:t}),[d,w,P,t,r]);return mc(()=>{r.dataRef.current.floatingContext=x;const E=p==null?void 0:p.nodesRef.current.find(A=>A.id===t);E&&(E.context=x)}),U.useMemo(()=>({...d,context:x,refs:w,elements:P}),[d,w,P,x])}const fh="active",dh="selected";function bc(e,t,n){const r=new Map,o=n==="item";let s=e;if(o&&e){const{[fh]:i,[dh]:l,...a}=e;s=a}return{...n==="floating"&&{tabIndex:-1,[h8]:""},...s,...t.map(i=>{const l=i?i[n]:null;return typeof l=="function"?e?l(e):null:l}).concat(e).reduce((i,l)=>(l&&Object.entries(l).forEach(a=>{let[c,u]=a;if(!(o&&[fh,dh].includes(c)))if(c.indexOf("on")===0){if(r.has(c)||r.set(c,[]),typeof u=="function"){var f;(f=r.get(c))==null||f.push(u),i[c]=function(){for(var p,d=arguments.length,h=new Array(d),b=0;b<d;b++)h[b]=arguments[b];return(p=r.get(c))==null?void 0:p.map(w=>w(...h)).find(w=>w!==void 0)}}}else i[c]=u}),i),{})}}function g8(e){e===void 0&&(e=[]);const t=e.map(l=>l==null?void 0:l.reference),n=e.map(l=>l==null?void 0:l.floating),r=e.map(l=>l==null?void 0:l.item),o=U.useCallback(l=>bc(l,e,"reference"),t),s=U.useCallback(l=>bc(l,e,"floating"),n),i=U.useCallback(l=>bc(l,e,"item"),r);return U.useMemo(()=>({getReferenceProps:o,getFloatingProps:s,getItemProps:i}),[o,s,i])}function ph(e,t){return{...e,rects:{...e.rects,floating:{...e.rects.floating,height:t}}}}const y8=e=>({name:"inner",options:e,async fn(t){const{listRef:n,overflowRef:r,onFallbackChange:o,offset:s=0,index:i=0,minItemsVisible:l=4,referenceOverflowThreshold:a=0,scrollRef:c,...u}=fr(e,t),{rects:f,elements:{floating:p}}=t,d=n.current[i],h=(c==null?void 0:c.current)||p,b=p.clientTop||h.clientTop,w=p.clientTop!==0,P=h.clientTop!==0,x=p===h;if(process.env.NODE_ENV!=="production"&&(t.placement.startsWith("bottom")||a8('`placement` side must be "bottom" when using the `inner`',"middleware.")),!d)return{};const E={...t,...await hc(-d.offsetTop-p.clientTop-f.reference.height/2-d.offsetHeight/2-s).fn(t)},A=await dc(ph(E,h.scrollHeight+b+p.clientTop),u),D=await dc(E,{...u,elementContext:"reference"}),L=_e(0,A.top),F=E.y+L,S=(h.scrollHeight>h.clientHeight?$=>$:ns)(_e(0,h.scrollHeight+(w&&x||P?b*2:0)-L-_e(0,A.bottom)));if(h.style.maxHeight=S+"px",h.scrollTop=L,o){const $=h.offsetHeight<d.offsetHeight*En(l,n.current.length)-1||D.top>=-a||D.bottom>=-a;Jr.flushSync(()=>o($))}return r&&(r.current=await dc(ph({...E,y:F},h.offsetHeight+b+p.clientTop),u)),{y:F}}});function v8(e,t){const{open:n,elements:r}=e,{enabled:o=!0,overflowRef:s,scrollRef:i,onChange:l}=t,a=lh(l),c=U.useRef(!1),u=U.useRef(null),f=U.useRef(null);U.useEffect(()=>{if(!o)return;function d(b){if(b.ctrlKey||!h||s.current==null)return;const w=b.deltaY,P=s.current.top>=-.5,x=s.current.bottom>=-.5,E=h.scrollHeight-h.clientHeight,A=w<0?-1:1,D=w<0?"max":"min";h.scrollHeight<=h.clientHeight||(!P&&w>0||!x&&w<0?(b.preventDefault(),Jr.flushSync(()=>{a(L=>L+Math[D](w,E*A))})):/firefox/i.test(J2())&&(h.scrollTop+=w))}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=U.useMemo(()=>({onKeyDown(){c.current=!0},onWheel(){c.current=!1},onPointerMove(){c.current=!1},onScroll(){const d=(i==null?void 0:i.current)||r.floating;if(!(!s.current||!d||!c.current)){if(u.current!==null){const h=d.scrollTop-u.current;(s.current.bottom<-.5&&h<-1||s.current.top<-.5&&h>1)&&Jr.flushSync(()=>a(b=>b+h))}requestAnimationFrame(()=>{u.current=d.scrollTop})}}}),[r.floating,a,s,i]);return U.useMemo(()=>o?{floating:p}:{},[o,p])}let Hr=g.createContext({styles:void 0,setReference:()=>{},setFloating:()=>{},getReferenceProps:()=>({}),getFloatingProps:()=>({}),slot:{}});Hr.displayName="FloatingContext";let gc=g.createContext(null);gc.displayName="PlacementContext";function w8(e){return g.useMemo(()=>e?typeof e=="string"?{to:e}:e:null,[e])}function x8(){return g.useContext(Hr).setReference}function E8(){return g.useContext(Hr).getReferenceProps}function S8(){let{getFloatingProps:e,slot:t}=g.useContext(Hr);return g.useCallback((...n)=>Object.assign({},e(...n),{"data-anchor":t.anchor}),[e,t])}function P8(e=null){e===!1&&(e=null),typeof e=="string"&&(e={to:e});let t=g.useContext(gc),n=g.useMemo(()=>e,[JSON.stringify(e,(o,s)=>{var i;return(i=s==null?void 0:s.outerHTML)!=null?i:s})]);Oe(()=>{t==null||t(n??null)},[t,n]);let r=g.useContext(Hr);return g.useMemo(()=>[r.setFloating,e?r.styles:{}],[r.setFloating,e,r.styles])}let hh=4;function T8({children:e,enabled:t=!0}){let[n,r]=g.useState(null),[o,s]=g.useState(0),i=g.useRef(null),[l,a]=g.useState(null);A8(l);let c=t&&n!==null&&l!==null,{to:u="bottom",gap:f=0,offset:p=0,padding:d=0,inner:h}=N8(n,l),[b,w="center"]=u.split(" ");Oe(()=>{c&&s(0)},[c]);let{refs:P,floatingStyles:x,context:E}=b8({open:c,placement:b==="selection"?w==="center"?"bottom":`bottom-${w}`:w==="center"?`${b}`:`${b}-${w}`,strategy:"absolute",transform:!1,middleware:[hc({mainAxis:b==="selection"?0:f,crossAxis:p}),sh({padding:d}),b!=="selection"&&ih({padding:d}),b==="selection"&&h?y8({...h,padding:d,overflowRef:i,offset:o,minItemsVisible:hh,referenceOverflowThreshold:d,onFallbackChange($){var I,C;if(!$)return;let M=E.elements.floating;if(!M)return;let y=parseFloat(getComputedStyle(M).scrollPaddingBottom)||0,O=Math.min(hh,M.childElementCount),k=0,T=0;for(let B of(C=(I=E.elements.floating)==null?void 0:I.childNodes)!=null?C:[])if(vn(B)){let R=B.offsetTop,z=R+B.clientHeight+y,_=M.scrollTop,G=_+M.clientHeight;if(R>=_&&z<=G)O--;else{T=Math.max(0,Math.min(z,G)-Math.max(R,_)),k=B.clientHeight;break}}O>=1&&s(B=>{let R=k*O-T+y;return B>=R?B:R})}}):null,t8({padding:d,apply({availableWidth:$,availableHeight:I,elements:C}){Object.assign(C.floating.style,{overflow:"auto",maxWidth:`${$}px`,maxHeight:`min(var(--anchor-max-height, 100vh), ${I}px)`})}})].filter(Boolean),whileElementsMounted:eh}),[A=b,D=w]=E.placement.split("-");b==="selection"&&(A="selection");let L=g.useMemo(()=>({anchor:[A,D].filter(Boolean).join(" ")}),[A,D]),F=v8(E,{overflowRef:i,onChange:s}),{getReferenceProps:m,getFloatingProps:v}=g8([F]),S=pe($=>{a($),P.setFloating($)});return U.createElement(gc.Provider,{value:r},U.createElement(Hr.Provider,{value:{setFloating:S,setReference:P.setReference,styles:x,getReferenceProps:m,getFloatingProps:v,slot:L}},e))}function A8(e){Oe(()=>{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 N8(e,t){var n,r,o;let s=yc((n=e==null?void 0:e.gap)!=null?n:"var(--anchor-gap, 0)",t),i=yc((r=e==null?void 0:e.offset)!=null?r:"var(--anchor-offset, 0)",t),l=yc((o=e==null?void 0:e.padding)!=null?o:"var(--anchor-padding, 0)",t);return{...e,gap:s,offset:i,padding:l}}function yc(e,t,n=void 0){let r=ar(),o=pe((a,c)=>{if(a==null)return[n,null];if(typeof a=="number")return[a,null];if(typeof a=="string"){if(!c)return[n,null];let u=bh(a,c);return[u,f=>{let p=mh(a);{let d=p.map(h=>window.getComputedStyle(c).getPropertyValue(h));r.requestAnimationFrame(function h(){r.nextFrame(h);let b=!1;for(let[P,x]of p.entries()){let E=window.getComputedStyle(c).getPropertyValue(x);if(d[P]!==E){d[P]=E,b=!0;break}}if(!b)return;let w=bh(a,c);u!==w&&(f(w),u=w)})}return r.dispose}]}return[n,null]}),s=g.useMemo(()=>o(e,t)[0],[e,t]),[i=s,l]=g.useState();return Oe(()=>{let[a,c]=o(e,t);if(l(a),!!c)return c(l)},[e,t]),i}function mh(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,...mh(o)]:[r]}return[]}function bh(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 C8({children:e,freeze:t},n){let r=gh(t,e);return g.isValidElement(r)?g.cloneElement(r,{ref:n}):g.createElement(g.Fragment,null,r)}g.forwardRef(C8);function gh(e,t){let[n,r]=g.useState(t);return!e&&n!==t&&r(t),e?n:t}let vc=g.createContext(null);vc.displayName="OpenClosedContext";var Ut=(e=>(e[e.Open=1]="Open",e[e.Closed=2]="Closed",e[e.Closing=4]="Closing",e[e.Opening=8]="Opening",e))(Ut||{});function wc(){return g.useContext(vc)}function yh({value:e,children:t}){return g.createElement(vc.Provider,{value:e},t)}function O8(e){throw new Error("Unexpected object: "+e)}var Ne=(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))(Ne||{});function wi(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:O8(e)}}function vh(e){let t=pe(e),n=g.useRef(!1);g.useEffect(()=>(n.current=!1,()=>{n.current=!0,j0(()=>{n.current&&t()})}),[t])}let I8=g.createContext(!1);function $8(){return g.useContext(I8)}function k8(e){let t=$8(),n=g.useContext(xh),[r,o]=g.useState(()=>{var s;if(!t&&n!==null)return(s=n.current)!=null?s:null;if(Xt.isServer)return null;let i=e==null?void 0:e.getElementById("headlessui-portal-root");if(i)return i;if(e===null)return null;let l=e.createElement("div");return l.setAttribute("id","headlessui-portal-root"),e.body.appendChild(l)});return g.useEffect(()=>{r!==null&&(e!=null&&e.body.contains(r)||e==null||e.body.appendChild(r))},[r,e]),g.useEffect(()=>{t||n!==null&&o(n.current)},[n,o,t]),r}let wh=g.Fragment,M8=nt(function(e,t){let{ownerDocument:n=null,...r}=e,o=g.useRef(null),s=Pt(Hx(p=>{o.current=p}),t),i=Jl(o.current),l=n??i,a=k8(l),c=g.useContext(F8),u=ar(),f=ht();return vh(()=>{var p;a&&a.childNodes.length<=0&&((p=a.parentElement)==null||p.removeChild(a))}),a?Ke.createPortal(g.createElement("div",{"data-headlessui-portal":"",ref:p=>{u.dispose(),c&&p&&u.add(c.register(p))}},f({ourProps:{ref:s},theirProps:r,slot:{},defaultTag:wh,name:"Portal"})),a):null});function D8(e,t){let n=Pt(t),{enabled:r=!0,ownerDocument:o,...s}=e,i=ht();return r?g.createElement(M8,{...s,ownerDocument:o,ref:n}):i({ourProps:{ref:n},theirProps:s,slot:{},defaultTag:wh,name:"Portal"})}let B8=g.Fragment,xh=g.createContext(null);function L8(e,t){let{target:n,...r}=e,o={ref:Pt(t)},s=ht();return g.createElement(xh.Provider,{value:n},s({ourProps:o,theirProps:r,defaultTag:B8,name:"Popover.Group"}))}let F8=g.createContext(null),R8=nt(D8),j8=nt(L8),z8=Object.assign(R8,{Group:j8});const xi={Idle:{kind:"Idle"},Tracked:e=>({kind:"Tracked",position:e}),Moved:{kind:"Moved"}};function Eh(e){let t=e.getBoundingClientRect();return`${t.x},${t.y}`}function U8(e,t,n){let r=pt();if(t.kind==="Tracked"){let o=function(){s!==Eh(e)&&(r.dispose(),n())},{position:s}=t,i=new ResizeObserver(o);i.observe(e),r.add(()=>i.disconnect()),r.addEventListener(window,"scroll",o,{passive:!0}),r.addEventListener(window,"resize",o)}return()=>r.dispose()}function _8(){let e=typeof document>"u";return"useSyncExternalStore"in U?(t=>t.useSyncExternalStore)(U)(()=>()=>{},()=>!1,()=>!e):!1}function Sh(){let e=_8(),[t,n]=U.useState(Xt.isHandoffComplete);return t&&Xt.isHandoffComplete===!1&&n(!1),U.useEffect(()=>{t!==!0&&n(!0)},[t]),U.useEffect(()=>Xt.handoff(),[]),e?!1:t}function W8(){let e=g.useRef(!1);return Oe(()=>(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)||!Xo((t=e.as)!=null?t:Ah)||g.Children.count(e.children)===1}let Ei=g.createContext(null);Ei.displayName="TransitionContext";var V8=(e=>(e.Visible="visible",e.Hidden="hidden",e))(V8||{});function H8(){let e=g.useContext(Ei);if(e===null)throw new Error("A <Transition.Child /> is used but it is missing a parent <Transition /> or <Transition.Root />.");return e}function G8(){let e=g.useContext(Si);if(e===null)throw new Error("A <Transition.Child /> is used but it is missing a parent <Transition /> or <Transition.Root />.");return e}let Si=g.createContext(null);Si.displayName="NestingContext";function Pi(e){return"children"in e?Pi(e.children):e.current.filter(({el:t})=>t.current!==null).filter(({state:t})=>t==="visible").length>0}function Th(e,t){let n=lr(e),r=g.useRef([]),o=W8(),s=ar(),i=pe((d,h=jn.Hidden)=>{let b=r.current.findIndex(({el:w})=>w===d);b!==-1&&(St(h,{[jn.Unmount](){r.current.splice(b,1)},[jn.Hidden](){r.current[b].state="hidden"}}),s.microTask(()=>{var w;!Pi(r)&&o.current&&((w=n.current)==null||w.call(n))}))}),l=pe(d=>{let h=r.current.find(({el:b})=>b===d);return h?h.state!=="visible"&&(h.state="visible"):r.current.push({el:d,state:"visible"}),()=>i(d,jn.Unmount)}),a=g.useRef([]),c=g.useRef(Promise.resolve()),u=g.useRef({enter:[],leave:[]}),f=pe((d,h,b)=>{a.current.splice(0),t&&(t.chains.current[h]=t.chains.current[h].filter(([w])=>w!==d)),t==null||t.chains.current[h].push([d,new Promise(w=>{a.current.push(w)})]),t==null||t.chains.current[h].push([d,new Promise(w=>{Promise.all(u.current[h].map(([P,x])=>x)).then(()=>w())})]),h==="enter"?c.current=c.current.then(()=>t==null?void 0:t.wait.current).then(()=>b(h)):b(h)}),p=pe((d,h,b)=>{Promise.all(u.current[h].splice(0).map(([w,P])=>P)).then(()=>{var w;(w=a.current.shift())==null||w()}).then(()=>b(h))});return g.useMemo(()=>({children:r,register:l,unregister:i,onStart:f,onStop:p,wait:c,chains:u}),[l,i,r,f,p,u,c])}let Ah=g.Fragment,Nh=ri.RenderStrategy;function q8(e,t){var n,r;let{transition:o=!0,beforeEnter:s,afterEnter:i,beforeLeave:l,afterLeave:a,enter:c,enterFrom:u,enterTo:f,entered:p,leave:d,leaveFrom:h,leaveTo:b,...w}=e,[P,x]=g.useState(null),E=g.useRef(null),A=Ph(e),D=Pt(...A?[E,t,x]:t===null?[]:[t]),L=(n=w.unmount)==null||n?jn.Unmount:jn.Hidden,{show:F,appear:m,initial:v}=H8(),[S,$]=g.useState(F?"visible":"hidden"),I=G8(),{register:C,unregister:M}=I;Oe(()=>C(E),[C,E]),Oe(()=>{if(L===jn.Hidden&&E.current){if(F&&S!=="visible"){$("visible");return}return St(S,{hidden:()=>M(E),visible:()=>C(E)})}},[S,E,C,M,F,L]);let y=Sh();Oe(()=>{if(A&&y&&S==="visible"&&E.current===null)throw new Error("Did you forget to passthrough the `ref` to the actual DOM node?")},[E,S,y,A]);let O=v&&!m,k=m&&F&&v,T=g.useRef(!1),B=Th(()=>{T.current||($("hidden"),M(E))},I),R=pe(ne=>{T.current=!0;let be=ne?"enter":"leave";B.onStart(E,be,fe=>{fe==="enter"?s==null||s():fe==="leave"&&(l==null||l())})}),z=pe(ne=>{let be=ne?"enter":"leave";T.current=!1,B.onStop(E,be,fe=>{fe==="enter"?i==null||i():fe==="leave"&&(a==null||a())}),be==="leave"&&!Pi(B)&&($("hidden"),M(E))});g.useEffect(()=>{A&&o||(R(F),z(F))},[F,A,o]);let _=!(!o||!A||!y||O),[,G]=Op(_,P,F,{start:R,end:z}),J=zn({ref:D,className:((r=Fl(w.className,k&&c,k&&u,G.enter&&c,G.enter&&G.closed&&u,G.enter&&!G.closed&&f,G.leave&&d,G.leave&&!G.closed&&h,G.leave&&G.closed&&b,!G.transition&&F&&p))==null?void 0:r.trim())||void 0,...Cp(G)}),K=0;S==="visible"&&(K|=Ut.Open),S==="hidden"&&(K|=Ut.Closed),F&&S==="hidden"&&(K|=Ut.Opening),!F&&S==="visible"&&(K|=Ut.Closing);let W=ht();return g.createElement(Si.Provider,{value:B},g.createElement(yh,{value:K},W({ourProps:J,theirProps:w,defaultTag:Ah,features:Nh,visible:S==="visible",name:"Transition.Child"})))}function K8(e,t){let{show:n,appear:r=!1,unmount:o=!0,...s}=e,i=g.useRef(null),l=Ph(e),a=Pt(...l?[i,t]:t===null?[]:[t]);Sh();let c=wc();if(n===void 0&&c!==null&&(n=(c&Ut.Open)===Ut.Open),n===void 0)throw new Error("A <Transition /> is used but it is missing a `show={true | false}` prop.");let[u,f]=g.useState(n?"visible":"hidden"),p=Th(()=>{n||f("hidden")}),[d,h]=g.useState(!0),b=g.useRef([n]);Oe(()=>{d!==!1&&b.current[b.current.length-1]!==n&&(b.current.push(n),h(!1))},[b,n]);let w=g.useMemo(()=>({show:n,appear:r,initial:d}),[n,r,d]);Oe(()=>{n?f("visible"):!Pi(p)&&i.current!==null&&f("hidden")},[n,p]);let P={unmount:o},x=pe(()=>{var D;d&&h(!1),(D=e.beforeEnter)==null||D.call(e)}),E=pe(()=>{var D;d&&h(!1),(D=e.beforeLeave)==null||D.call(e)}),A=ht();return g.createElement(Si.Provider,{value:p},g.createElement(Ei.Provider,{value:w},A({ourProps:{...P,as:g.Fragment,children:g.createElement(Ch,{ref:a,...P,...s,beforeEnter:x,beforeLeave:E})},theirProps:{},defaultTag:g.Fragment,features:Nh,visible:u==="visible",name:"Transition"})))}function Z8(e,t){let n=g.useContext(Ei)!==null,r=wc()!==null;return g.createElement(g.Fragment,null,!n&&r?g.createElement(xc,{ref:t,...e}):g.createElement(Ch,{ref:t,...e}))}let xc=nt(K8),Ch=nt(q8),Y8=nt(Z8),Ec=Object.assign(xc,{Child:Y8,Root:xc}),Oh=/([\u2700-\u27BF]|[\uE000-\uF8FF]|\uD83C[\uDC00-\uDFFF]|\uD83D[\uDC00-\uDFFF]|[\u2011-\u26FF]|\uD83E[\uDD10-\uDDFF])/g;function Ih(e){var t,n;let r=(t=e.innerText)!=null?t:"",o=e.cloneNode(!0);if(!vn(o))return r;let s=!1;for(let l of o.querySelectorAll('[hidden],[aria-hidden],[role="img"]'))l.remove(),s=!0;let i=s?(n=o.innerText)!=null?n:"":r;return Oh.test(i)&&(i=i.replace(Oh,"")),i}function X8(e){let t=e.getAttribute("aria-label");if(typeof t=="string")return t.trim();let n=e.getAttribute("aria-labelledby");if(n){let r=n.split(" ").map(o=>{let s=document.getElementById(o);if(s){let i=s.getAttribute("aria-label");return typeof i=="string"?i.trim():Ih(s).trim()}return null}).filter(Boolean);if(r.length>0)return r.join(", ")}return Ih(e).trim()}function J8(e){let t=g.useRef(""),n=g.useRef("");return pe(()=>{let r=e.current;if(!r)return"";let o=r.innerText;if(t.current===o)return n.current;let s=X8(r).trim().toLowerCase();return t.current=o,n.current=s,s})}var Q8=Object.defineProperty,e3=(e,t,n)=>t in e?Q8(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,$h=(e,t,n)=>(e3(e,typeof t!="symbol"?t+"":t,n),n),We=(e=>(e[e.Open=0]="Open",e[e.Closed=1]="Closed",e))(We||{}),Wn=(e=>(e[e.Single=0]="Single",e[e.Multi=1]="Multi",e))(Wn||{}),Ti=(e=>(e[e.Pointer=0]="Pointer",e[e.Other=1]="Other",e))(Ti||{}),kh=(e=>(e[e.OpenListbox=0]="OpenListbox",e[e.CloseListbox=1]="CloseListbox",e[e.GoToOption=2]="GoToOption",e[e.Search=3]="Search",e[e.ClearSearch=4]="ClearSearch",e[e.SelectOption=5]="SelectOption",e[e.RegisterOptions=6]="RegisterOptions",e[e.UnregisterOptions=7]="UnregisterOptions",e[e.SetButtonElement=8]="SetButtonElement",e[e.SetOptionsElement=9]="SetOptionsElement",e[e.SortOptions=10]="SortOptions",e[e.MarkButtonAsMoved=11]="MarkButtonAsMoved",e))(kh||{});function Mh(e,t=n=>n){let n=e.activeOptionIndex!==null?e.options[e.activeOptionIndex]:null,r=vp(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 t3={1(e){if(e.dataRef.current.disabled||e.listboxState===1)return e;let t=e.buttonElement?xi.Tracked(Eh(e.buttonElement)):e.buttonPositionState;return{...e,activeOptionIndex:null,pendingFocus:{focus:Ne.Nothing},listboxState:1,__demoMode:!1,buttonPositionState:t}},0(e,t){if(e.dataRef.current.disabled||e.listboxState===0)return e;let n=e.activeOptionIndex,{isSelected:r}=e.dataRef.current,o=e.options.findIndex(s=>r(s.dataRef.current.value));return o!==-1&&(n=o),{...e,frozenValue:!1,pendingFocus:t.focus,listboxState:0,activeOptionIndex:n,__demoMode:!1,buttonPositionState:xi.Idle}},2(e,t){var n,r,o,s,i;if(e.dataRef.current.disabled||e.listboxState===1)return e;let l={...e,searchQuery:"",activationTrigger:(n=t.trigger)!=null?n:1,__demoMode:!1};if(t.focus===Ne.Nothing)return{...l,activeOptionIndex:null};if(t.focus===Ne.Specific)return{...l,activeOptionIndex:e.options.findIndex(u=>u.id===t.id)};if(t.focus===Ne.Previous){let u=e.activeOptionIndex;if(u!==null){let f=e.options[u].dataRef.current.domRef,p=wi(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{...l,activeOptionIndex:p}}}}else if(t.focus===Ne.Next){let u=e.activeOptionIndex;if(u!==null){let f=e.options[u].dataRef.current.domRef,p=wi(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{...l,activeOptionIndex:p}}}}let a=Mh(e),c=wi(t,{resolveItems:()=>a.options,resolveActiveIndex:()=>a.activeOptionIndex,resolveId:u=>u.id,resolveDisabled:u=>u.dataRef.current.disabled});return{...l,...a,activeOptionIndex:c}},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 l;return!i.dataRef.current.disabled&&((l=i.dataRef.current.textValue)==null?void 0:l.startsWith(r))}),s=o?e.options.indexOf(o):-1;return s===-1||s===e.activeOptionIndex?{...e,searchQuery:r}:{...e,searchQuery:r,activeOptionIndex:s,activationTrigger:1}},4(e){return e.dataRef.current.disabled||e.listboxState===1||e.searchQuery===""?e:{...e,searchQuery:""}},5(e){return e.dataRef.current.mode===0?{...e,frozenValue:!0}:{...e}},6:(e,t)=>{let n=e.options.concat(t.options),r=e.activeOptionIndex;if(e.pendingFocus.focus!==Ne.Nothing&&(r=wi(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:Ne.Nothing},pendingShouldSort:!0}},7:(e,t)=>{let n=e.options,r=[],o=new Set(t.options);for(let[s,i]of n.entries())if(o.has(i.id)&&(r.push(s),o.delete(i.id),o.size===0))break;if(r.length>0){n=n.slice();for(let s of r.reverse())n.splice(s,1)}return{...e,options:n,activationTrigger:1}},8:(e,t)=>e.buttonElement===t.element?e:{...e,buttonElement:t.element},9:(e,t)=>e.optionsElement===t.element?e:{...e,optionsElement:t.element},10:e=>e.pendingShouldSort?{...e,...Mh(e),pendingShouldSort:!1}:e,11(e){return e.buttonPositionState.kind!=="Tracked"?e:{...e,buttonPositionState:xi.Moved}}};class Sc extends ap{constructor(t){super(t),$h(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 l=i.slice(),a=l.findIndex(c=>o(c,n));return a===-1?l.push(n):l.splice(a,1),r==null?void 0:r(l)}})},registerOption:Wl(()=>{let n=[],r=new Set;return[(o,s)=>{r.has(s)||(r.add(s),n.push({id:o,dataRef:s}))},()=>(r.clear(),this.send({type:6,options:n.splice(0)}))]}),unregisterOption:Wl(()=>{let n=[];return[r=>n.push(r),()=>{this.send({type:7,options:n.splice(0)})}]}),goToOption:Wl(()=>{let n=null;return[(r,o)=>{n={type:2,...r,trigger:o}},()=>n&&this.send(n)]}),closeListbox:()=>{this.send({type:1})},openListbox:n=>{this.send({type:0,focus:n})},selectActiveOption:()=>{var n;if(this.state.activeOptionIndex!==null){let{dataRef:r}=this.state.options[this.state.activeOptionIndex];this.actions.selectOption(r.current.value)}else this.state.dataRef.current.mode===0&&(this.actions.closeListbox(),(n=this.state.buttonElement)==null||n.focus({preventScroll:!0}))},selectOption:n=>{this.send({type:5,value:n})},search:n=>{this.send({type:3,value:n})},clearSearch:()=>{this.send({type:4})},setButtonElement:n=>{this.send({type:8,element:n})},setOptionsElement:n=>{this.send({type:9,element:n})}}),$h(this,"selectors",{activeDescendantId(n){var r;let o=n.activeOptionIndex,s=n.options;return o===null||(r=s[o])==null?void 0:r.id},isActive(n,r){var o;let s=n.activeOptionIndex,i=n.options;return s!==null?((o=i[s])==null?void 0:o.id)===r:!1},hasFrozenValue(n){return n.frozenValue},shouldScrollIntoView(n,r){return n.__demoMode||n.listboxState!==0||n.activationTrigger===0?!1:this.isActive(n,r)},didButtonMove(n){return n.buttonPositionState.kind==="Moved"}}),this.on(6,()=>{requestAnimationFrame(()=>{this.send({type:10})})});{let n=this.state.id,r=Vl.get(null);this.disposables.add(r.on(fp.Push,o=>{!r.selectors.isTop(o,n)&&this.state.listboxState===0&&this.actions.closeListbox()})),this.on(0,()=>r.actions.push(n)),this.on(1,()=>r.actions.pop(n))}this.disposables.group(n=>{this.on(1,r=>{r.buttonElement&&(n.dispose(),n.add(U8(r.buttonElement,r.buttonPositionState,()=>{this.send({type:11})})))})}),this.on(5,(n,r)=>{var o;this.actions.onChange(r.value),this.state.dataRef.current.mode===0&&(this.actions.closeListbox(),(o=this.state.buttonElement)==null||o.focus({preventScroll:!0}))})}static new({id:t,__demoMode:n=!1}){return new Sc({id:t,dataRef:{current:{}},listboxState:n?0:1,options:[],searchQuery:"",activeOptionIndex:null,activationTrigger:1,buttonElement:null,optionsElement:null,pendingShouldSort:!1,pendingFocus:{focus:Ne.Nothing},frozenValue:!1,__demoMode:n,buttonPositionState:xi.Idle})}reduce(t,n){return St(n.type,t3,t,n)}}const Dh=g.createContext(null);function Pc(e){let t=g.useContext(Dh);if(t===null){let n=new Error(`<${e} /> is missing a parent <Listbox /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,Bh),n}return t}function Bh({id:e,__demoMode:t=!1}){let n=g.useMemo(()=>Sc.new({id:e,__demoMode:t}),[]);return vh(()=>n.dispose()),n}let Ai=g.createContext(null);Ai.displayName="ListboxDataContext";function ss(e){let t=g.useContext(Ai);if(t===null){let n=new Error(`<${e} /> is missing a parent <Listbox /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,ss),n}return t}let n3=g.Fragment;function r3(e,t){let n=g.useId(),r=Ll(),{value:o,defaultValue:s,form:i,name:l,onChange:a,by:c,invalid:u=!1,disabled:f=r||!1,horizontal:p=!1,multiple:d=!1,__demoMode:h=!1,...b}=e;const w=p?"horizontal":"vertical";let P=Pt(t),x=Ix(s),[E=d?[]:void 0,A]=Ox(o,a,x),D=Bh({id:n,__demoMode:h}),L=g.useRef({static:!1,hold:!1}),F=g.useRef(new Map),m=n2(c),v=g.useCallback(_=>St(S.mode,{[Wn.Multi]:()=>E.some(G=>m(G,_)),[Wn.Single]:()=>m(E,_)}),[E]),S=Rn({value:E,disabled:f,invalid:u,mode:d?Wn.Multi:Wn.Single,orientation:w,onChange:A,compare:m,isSelected:v,optionsPropsRef:L,listRef:F});Oe(()=>{D.state.dataRef.current=S},[S]);let $=rt(D,_=>_.listboxState),I=Vl.get(null),C=rt(I,g.useCallback(_=>I.selectors.isTop(_,n),[I,n])),[M,y]=rt(D,_=>[_.buttonElement,_.optionsElement]);O2(C,[M,y],(_,G)=>{D.send({type:kh.CloseListbox}),yp(G,Xl.Loose)||(_.preventDefault(),M==null||M.focus())});let O=Rn({open:$===We.Open,disabled:f,invalid:u,value:E}),[k,T]=Yx({inherit:!0}),B={ref:P},R=g.useCallback(()=>{if(x!==void 0)return A==null?void 0:A(x)},[A,x]),z=ht();return g.createElement(T,{value:k,props:{htmlFor:M==null?void 0:M.id},slot:{open:$===We.Open,disabled:f}},g.createElement(T8,null,g.createElement(Dh.Provider,{value:D},g.createElement(Ai.Provider,{value:S},g.createElement(yh,{value:St($,{[We.Open]:Ut.Open,[We.Closed]:Ut.Closed})},l!=null&&E!=null&&g.createElement(Fx,{disabled:f,data:{[l]:E},form:i,onReset:R}),z({ourProps:B,theirProps:b,slot:O,defaultTag:n3,name:"Listbox"}))))))}let o3="button";function s3(e,t){let n=g.useId(),r=G0(),o=ss("Listbox.Button"),s=Pc("Listbox.Button"),{id:i=r||`headlessui-listbox-button-${n}`,disabled:l=o.disabled||!1,autoFocus:a=!1,...c}=e,u=Pt(t,x8(),s.actions.setButtonElement),f=E8(),[p,d,h]=rt(s,y=>[y.listboxState,y.buttonElement,y.optionsElement]),b=p===We.Open;k2(b,{trigger:d,action:g.useCallback(y=>{if(d!=null&&d.contains(y.target))return ai.Ignore;let O=y.target.closest('[role="option"]:not([data-disabled])');return vn(O)?ai.Select(O):h!=null&&h.contains(y.target)?ai.Ignore:ai.Close},[d,h]),close:s.actions.closeListbox,select:s.actions.selectActiveOption});let w=pe(y=>{switch(y.key){case Le.Enter:$x(y.currentTarget);break;case Le.Space:case Le.ArrowDown:y.preventDefault(),s.actions.openListbox({focus:o.value?Ne.Nothing:Ne.First});break;case Le.ArrowUp:y.preventDefault(),s.actions.openListbox({focus:o.value?Ne.Nothing:Ne.Last});break}}),P=pe(y=>{switch(y.key){case Le.Space:y.preventDefault();break}}),x=o2(y=>{var O;s.state.listboxState===We.Open?(Ke.flushSync(()=>s.actions.closeListbox()),(O=s.state.buttonElement)==null||O.focus({preventScroll:!0})):(y.preventDefault(),s.actions.openListbox({focus:Ne.Nothing}))}),E=pe(y=>y.preventDefault()),A=tp([i]),D=Gx(),{isFocusVisible:L,focusProps:F}=mx({autoFocus:a}),{isHovered:m,hoverProps:v}=hx({isDisabled:l}),{pressed:S,pressProps:$}=Ex({disabled:l}),I=Rn({open:p===We.Open,active:S||p===We.Open,disabled:l,invalid:o.invalid,value:o.value,hover:m,focus:L,autofocus:a}),C=rt(s,y=>y.listboxState===We.Open),M=U0(f(),{ref:u,id:i,type:M2(e,d),"aria-haspopup":"listbox","aria-controls":h==null?void 0:h.id,"aria-expanded":C,"aria-labelledby":A,"aria-describedby":D,disabled:l||void 0,autoFocus:a,onKeyDown:w,onKeyUp:P,onKeyPress:E},x,F,v,$);return ht()({ourProps:M,theirProps:c,slot:I,defaultTag:o3,name:"Listbox.Button"})}let Lh=g.createContext(!1),i3="div",a3=ri.RenderStrategy|ri.Static;function l3(e,t){let n=g.useId(),{id:r=`headlessui-listbox-options-${n}`,anchor:o,portal:s=!1,modal:i=!0,transition:l=!1,...a}=e,c=w8(o),[u,f]=g.useState(null);c&&(s=!0);let p=ss("Listbox.Options"),d=Pc("Listbox.Options"),[h,b,w,P]=rt(d,W=>[W.listboxState,W.buttonElement,W.optionsElement,W.__demoMode]),x=Jl(b),E=Jl(w),A=wc(),[D,L]=Op(l,u,A!==null?(A&Ut.Open)===Ut.Open:h===We.Open);g2(D,b,d.actions.closeListbox);let F=P?!1:i&&h===We.Open;z2(F,E);let m=P?!1:i&&h===We.Open;b2(m,{allowed:g.useCallback(()=>[b,w],[b,w])});let v=rt(d,d.selectors.didButtonMove)?!1:D,S=rt(d,d.selectors.hasFrozenValue)&&!e.static,$=gh(S,p.value),I=g.useCallback(W=>p.compare($,W),[p.compare,$]),C=rt(d,W=>{var ne;if(c==null||!((ne=c==null?void 0:c.to)!=null&&ne.includes("selection")))return null;let be=W.options.findIndex(fe=>I(fe.dataRef.current.value));return be===-1&&(be=0),be}),M=(()=>{if(c==null)return;if(C===null)return{...c,inner:void 0};let W=Array.from(p.listRef.current.values());return{...c,inner:{listRef:{current:W},index:C}}})(),[y,O]=P8(M),k=S8(),T=Pt(t,c?y:null,d.actions.setOptionsElement,f),B=ar();g.useEffect(()=>{let W=w;W&&h===We.Open&&(vx(W)||W==null||W.focus({preventScroll:!0}))},[h,w]);let R=pe(W=>{var ne;switch(B.dispose(),W.key){case Le.Space:if(d.state.searchQuery!=="")return W.preventDefault(),W.stopPropagation(),d.actions.search(W.key);case Le.Enter:W.preventDefault(),W.stopPropagation(),d.actions.selectActiveOption();break;case St(p.orientation,{vertical:Le.ArrowDown,horizontal:Le.ArrowRight}):return W.preventDefault(),W.stopPropagation(),d.actions.goToOption({focus:Ne.Next});case St(p.orientation,{vertical:Le.ArrowUp,horizontal:Le.ArrowLeft}):return W.preventDefault(),W.stopPropagation(),d.actions.goToOption({focus:Ne.Previous});case Le.Home:case Le.PageUp:return W.preventDefault(),W.stopPropagation(),d.actions.goToOption({focus:Ne.First});case Le.End:case Le.PageDown:return W.preventDefault(),W.stopPropagation(),d.actions.goToOption({focus:Ne.Last});case Le.Escape:W.preventDefault(),W.stopPropagation(),Ke.flushSync(()=>d.actions.closeListbox()),(ne=d.state.buttonElement)==null||ne.focus({preventScroll:!0});return;case Le.Tab:W.preventDefault(),W.stopPropagation(),Ke.flushSync(()=>d.actions.closeListbox()),T2(d.state.buttonElement,W.shiftKey?Yl.Previous:Yl.Next);break;default:W.key.length===1&&(d.actions.search(W.key),B.setTimeout(()=>d.actions.clearSearch(),350));break}}),z=rt(d,W=>{var ne;return(ne=W.buttonElement)==null?void 0:ne.id}),_=Rn({open:h===We.Open}),G=U0(c?k():{},{id:r,ref:T,"aria-activedescendant":rt(d,d.selectors.activeDescendantId),"aria-multiselectable":p.mode===Wn.Multi?!0:void 0,"aria-labelledby":z,"aria-orientation":p.orientation,onKeyDown:R,role:"listbox",tabIndex:h===We.Open?0:void 0,style:{...a.style,...O,"--button-width":r2(D,b,!0).width},...Cp(L)}),J=ht(),K=g.useMemo(()=>p.mode===Wn.Multi?p:{...p,isSelected:I},[p,I]);return g.createElement(z8,{enabled:s?e.static||D:!1,ownerDocument:x},g.createElement(Ai.Provider,{value:K},J({ourProps:G,theirProps:a,slot:_,defaultTag:i3,features:a3,visible:v,name:"Listbox.Options"})))}let c3="div";function u3(e,t){let n=g.useId(),{id:r=`headlessui-listbox-option-${n}`,disabled:o=!1,value:s,...i}=e,l=g.useContext(Lh)===!0,a=ss("Listbox.Option"),c=Pc("Listbox.Option"),u=rt(c,S=>c.selectors.isActive(S,r)),f=a.isSelected(s),p=g.useRef(null),d=J8(p),h=lr({disabled:o,value:s,domRef:p,get textValue(){return d()}}),b=Pt(t,p,S=>{S?a.listRef.current.set(r,S):a.listRef.current.delete(r)}),w=rt(c,S=>c.selectors.shouldScrollIntoView(S,r));Oe(()=>{if(w)return pt().requestAnimationFrame(()=>{var S,$;($=(S=p.current)==null?void 0:S.scrollIntoView)==null||$.call(S,{block:"nearest"})})},[w,p]),Oe(()=>{if(!l)return c.actions.registerOption(r,h),()=>c.actions.unregisterOption(r)},[h,r,l]);let P=pe(S=>{if(o)return S.preventDefault();c.actions.selectOption(s)}),x=pe(()=>{if(o)return c.actions.goToOption({focus:Ne.Nothing});c.actions.goToOption({focus:Ne.Specific,id:r})}),E=U2(),A=pe(S=>E.update(S)),D=pe(S=>{E.wasMoved(S)&&(o||u&&c.state.activationTrigger===Ti.Pointer||c.actions.goToOption({focus:Ne.Specific,id:r},Ti.Pointer))}),L=pe(S=>{E.wasMoved(S)&&(o||u&&c.state.activationTrigger===Ti.Pointer&&c.actions.goToOption({focus:Ne.Nothing}))}),F=Rn({active:u,focus:u,selected:f,disabled:o,selectedOption:f&&l}),m=l?{}:{id:r,ref:b,role:"option",tabIndex:o===!0?void 0:-1,"aria-disabled":o===!0?!0:void 0,"aria-selected":f,disabled:void 0,onClick:P,onFocus:x,onPointerEnter:A,onMouseEnter:A,onPointerMove:D,onMouseMove:D,onPointerLeave:L,onMouseLeave:L},v=ht();return!f&&l?null:v({ourProps:m,theirProps:i,slot:F,defaultTag:c3,name:"Listbox.Option"})}let f3=g.Fragment;function d3(e,t){let{options:n,placeholder:r,...o}=e,s={ref:Pt(t)},i=ss("ListboxSelectedOption"),l=Rn({}),a=i.value===void 0||i.value===null||i.mode===Wn.Multi&&Array.isArray(i.value)&&i.value.length===0,c=ht();return g.createElement(Lh.Provider,{value:!0},c({ourProps:s,theirProps:{...o,children:g.createElement(g.Fragment,null,r&&a?r:n)},slot:l,defaultTag:f3,name:"ListboxSelectedOption"}))}let p3=nt(r3),h3=nt(s3),m3=e2,b3=nt(l3),g3=nt(u3),y3=nt(d3),Nt=Object.assign(p3,{Button:h3,Label:m3,Options:b3,Option:g3,SelectedOption:y3});const v3=()=>N.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",children:[N.jsx("g",{clipPath:"url(#clip0_active)",children:N.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"})}),N.jsx("defs",{children:N.jsx("clipPath",{id:"clip0_active",children:N.jsx("rect",{width:"12",height:"12",fill:"white",transform:"translate(0 0.0454102)"})})})]}),w3=()=>N.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",children:[N.jsx("g",{clipPath:"url(#clip0_inactive)",children:N.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"})}),N.jsx("defs",{children:N.jsx("clipPath",{id:"clip0_inactive",children:N.jsx("rect",{width:"12",height:"12",fill:"white",transform:"translate(0 0.0454102)"})})})]}),is=({selectedLevel:e,maxLevel:t,className:n=""})=>{const r=Array.from({length:t},(o,s)=>s+1);return N.jsx("div",{className:`flex items-center ${n}`,children:r.map(o=>N.jsx("div",{className:"flex items-center justify-center",children:o>t-e?N.jsx(v3,{}):N.jsx(w3,{})},o))})};class _t{}ds(_t,"FAST",3),ds(_t,"Medium",2),ds(_t,"SLOW",1),ds(_t,"NONE",0);const x3=Object.values({MAINNET:1,SEPOLIA:11155111}),Pn=e=>{const t=typeof e=="string"?parseInt(e,10):e;return x3.includes(t)},E3={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:!E3[t.toUpperCase()]:!0},S3=({chains:e,selectedChain:t,onChainChange:n,disabled:r=!1,className:o="",walletType:s="mpc"})=>{const{t:i}=$t();return N.jsx("div",{className:`relative ${o}`,children:N.jsx(Nt,{value:t,onChange:n,disabled:r,children:({open:l})=>N.jsxs(N.Fragment,{children:[N.jsxs(Nt.Button,{className:`
139
+ */var aE=["input:not([inert]):not([inert] *)","select:not([inert]):not([inert] *)","textarea:not([inert]):not([inert] *)","a[href]:not([inert]):not([inert] *)","button:not([inert]):not([inert] *)","[tabindex]:not(slot):not([inert]):not([inert] *)","audio[controls]:not([inert]):not([inert] *)","video[controls]:not([inert]):not([inert] *)",'[contenteditable]:not([contenteditable="false"]):not([inert]):not([inert] *)',"details>summary:first-of-type:not([inert]):not([inert] *)","details:not([inert]):not([inert] *)"],lc=aE.join(","),Bp=typeof Element>"u",os=Bp?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,mi=!Bp&&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},bi=function(t,n){var r;n===void 0&&(n=!0);var o=t==null||(r=t.getAttribute)===null||r===void 0?void 0:r.call(t,"inert"),s=o===""||o==="true",i=s||n&&t&&(typeof t.closest=="function"?t.closest("[inert]"):bi(t.parentNode));return i},lE=function(t){var n,r=t==null||(n=t.getAttribute)===null||n===void 0?void 0:n.call(t,"contenteditable");return r===""||r==="true"},cE=function(t,n,r){if(bi(t))return[];var o=Array.prototype.slice.apply(t.querySelectorAll(lc));return n&&os.call(t,lc)&&o.unshift(t),o=o.filter(r),o},cc=function(t,n,r){for(var o=[],s=Array.from(t);s.length;){var i=s.shift();if(!bi(i,!1))if(i.tagName==="SLOT"){var l=i.assignedElements(),a=l.length?l:i.children,c=cc(a,!0,r);r.flatten?o.push.apply(o,c):o.push({scopeParent:i,candidates:c})}else{var u=os.call(i,lc);u&&r.filter(i)&&(n||!t.includes(i))&&o.push(i);var f=i.shadowRoot||typeof r.getShadowRoot=="function"&&r.getShadowRoot(i),p=!bi(f,!1)&&(!r.shadowRootFilter||r.shadowRootFilter(i));if(f&&p){var d=cc(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},Lp=function(t){return!isNaN(parseInt(t.getAttribute("tabindex"),10))},Fp=function(t){if(!t)throw new Error("No node provided");return t.tabIndex<0&&(/^(AUDIO|VIDEO|DETAILS)$/.test(t.tagName)||lE(t))&&!Lp(t)?0:t.tabIndex},uE=function(t,n){var r=Fp(t);return r<0&&n&&!Lp(t)?0:r},fE=function(t,n){return t.tabIndex===n.tabIndex?t.documentOrder-n.documentOrder:t.tabIndex-n.tabIndex},Rp=function(t){return t.tagName==="INPUT"},dE=function(t){return Rp(t)&&t.type==="hidden"},pE=function(t){var n=t.tagName==="DETAILS"&&Array.prototype.slice.apply(t.children).some(function(r){return r.tagName==="SUMMARY"});return n},hE=function(t,n){for(var r=0;r<t.length;r++)if(t[r].checked&&t[r].form===n)return t[r]},mE=function(t){if(!t.name)return!0;var n=t.form||mi(t),r=function(l){return n.querySelectorAll('input[type="radio"][name="'+l+'"]')},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=hE(o,t.form);return!s||s===t},bE=function(t){return Rp(t)&&t.type==="radio"},gE=function(t){return bE(t)&&!mE(t)},yE=function(t){var n,r=t&&mi(t),o=(n=r)===null||n===void 0?void 0:n.host,s=!1;if(r&&r!==t){var i,l,a;for(s=!!((i=o)!==null&&i!==void 0&&(l=i.ownerDocument)!==null&&l!==void 0&&l.contains(o)||t!=null&&(a=t.ownerDocument)!==null&&a!==void 0&&a.contains(t));!s&&o;){var c,u,f;r=mi(o),o=(c=r)===null||c===void 0?void 0:c.host,s=!!((u=o)!==null&&u!==void 0&&(f=u.ownerDocument)!==null&&f!==void 0&&f.contains(o))}}return s},jp=function(t){var n=t.getBoundingClientRect(),r=n.width,o=n.height;return r===0&&o===0},vE=function(t,n){var r=n.displayCheck,o=n.getShadowRoot;if(r==="full-native"&&"checkVisibility"in t){var s=t.checkVisibility({checkOpacity:!1,opacityProperty:!1,contentVisibilityAuto:!0,visibilityProperty:!0,checkVisibilityCSS:!0});return!s}if(getComputedStyle(t).visibility==="hidden")return!0;var i=os.call(t,"details>summary:first-of-type"),l=i?t.parentElement:t;if(os.call(l,"details:not([open]) *"))return!0;if(!r||r==="full"||r==="full-native"||r==="legacy-full"){if(typeof o=="function"){for(var a=t;t;){var c=t.parentElement,u=mi(t);if(c&&!c.shadowRoot&&o(c)===!0)return jp(t);t.assignedSlot?t=t.assignedSlot:!c&&u!==t.ownerDocument?t=u.host:t=c}t=a}if(yE(t))return!t.getClientRects().length;if(r!=="legacy-full")return!0}else if(r==="non-zero-area")return jp(t);return!1},wE=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 os.call(n,"fieldset[disabled] *")?!0:!o.contains(t)}return!0}n=n.parentElement}return!1},xE=function(t,n){return!(n.disabled||dE(n)||vE(n,t)||pE(n)||wE(n))},zp=function(t,n){return!(gE(n)||Fp(n)<0||!xE(t,n))},EE=function(t){var n=parseInt(t.getAttribute("tabindex"),10);return!!(isNaN(n)||n>=0)},Up=function(t){var n=[],r=[];return t.forEach(function(o,s){var i=!!o.scopeParent,l=i?o.scopeParent:o,a=uE(l,i),c=i?Up(o.candidates):l;a===0?i?n.push.apply(n,c):n.push(l):r.push({documentOrder:s,tabIndex:a,item:o,isScope:i,content:c})}),r.sort(fE).reduce(function(o,s){return s.isScope?o.push.apply(o,s.content):o.push(s.content),o},[]).concat(n)},Wp=function(t,n){n=n||{};var r;return n.getShadowRoot?r=cc([t],n.includeContainer,{filter:zp.bind(null,n),flatten:!1,getShadowRoot:n.getShadowRoot,shadowRootFilter:EE}):r=cE(t,n.includeContainer,zp.bind(null,n)),Up(r)};function _p(e,t,n){let{reference:r,floating:o}=e;const s=Sn(t),i=ic(t),l=sc(i),a=Un(t),c=s==="y",u=r.x+r.width/2-o.width/2,f=r.y+r.height/2-o.height/2,p=r[l]/2-o[l]/2;let d;switch(a){case"top":d={x:u,y:r.y-o.height};break;case"bottom":d={x:u,y:r.y+r.height};break;case"right":d={x:r.x+r.width,y:f};break;case"left":d={x:r.x-o.width,y:f};break;default:d={x:r.x,y:r.y}}switch(_r(t)){case"start":d[i]-=p*(n&&c?-1:1);break;case"end":d[i]+=p*(n&&c?-1:1);break}return d}async function Vp(e,t){var n;t===void 0&&(t={});const{x:r,y:o,platform:s,rects:i,elements:l,strategy:a}=e,{boundary:c="clippingAncestors",rootBoundary:u="viewport",elementContext:f="floating",altBoundary:p=!1,padding:d=0}=fr(t,e),h=Dp(d),v=l[p?f==="floating"?"reference":"floating":f],P=hi(await s.getClippingRect({element:(n=await(s.isElement==null?void 0:s.isElement(v)))==null||n?v:v.contextElement||await(s.getDocumentElement==null?void 0:s.getDocumentElement(l.floating)),boundary:c,rootBoundary:u,strategy:a})),x=f==="floating"?{x:r,y:o,width:i.floating.width,height:i.floating.height}:i.reference,E=await(s.getOffsetParent==null?void 0:s.getOffsetParent(l.floating)),N=await(s.isElement==null?void 0:s.isElement(E))?await(s.getScale==null?void 0:s.getScale(E))||{x:1,y:1}:{x:1,y:1},D=hi(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:l,rect:x,offsetParent:E,strategy:a}):x);return{top:(P.top-D.top+h.top)/N.y,bottom:(D.bottom-P.bottom+h.bottom)/N.y,left:(P.left-D.left+h.left)/N.x,right:(D.right-P.right+h.right)/N.x}}const SE=50,PE=async(e,t,n)=>{const{placement:r="bottom",strategy:o="absolute",middleware:s=[],platform:i}=n,l=i.detectOverflow?i:{...i,detectOverflow:Vp},a=await(i.isRTL==null?void 0:i.isRTL(t));let c=await i.getElementRects({reference:e,floating:t,strategy:o}),{x:u,y:f}=_p(c,r,a),p=r,d=0;const h={};for(let b=0;b<s.length;b++){const v=s[b];if(!v)continue;const{name:P,fn:x}=v,{x:E,y:N,data:D,reset:F}=await x({x:u,y:f,initialPlacement:r,placement:p,strategy:o,middlewareData:h,rects:c,platform:l,elements:{reference:e,floating:t}});u=E??u,f=N??f,h[P]={...h[P],...D},F&&d<SE&&(d++,typeof F=="object"&&(F.placement&&(p=F.placement),F.rects&&(c=F.rects===!0?await i.getElementRects({reference:e,floating:t,strategy:o}):F.rects),{x:u,y:f}=_p(c,p,a)),b=-1)}return{x:u,y:f,placement:p,strategy:o,middlewareData:h}},TE=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:o,rects:s,platform:i,elements:l,middlewareData:a}=t,{element:c,padding:u=0}=fr(e,t)||{};if(c==null)return{};const f=Dp(u),p={x:n,y:r},d=ic(o),h=sc(d),b=await i.getDimensions(c),v=d==="y",P=v?"top":"left",x=v?"bottom":"right",E=v?"clientHeight":"clientWidth",N=s.reference[h]+s.reference[d]-p[d]-s.floating[h],D=p[d]-s.reference[d],F=await(i.getOffsetParent==null?void 0:i.getOffsetParent(c));let L=F?F[E]:0;(!L||!await(i.isElement==null?void 0:i.isElement(F)))&&(L=l.floating[E]||s.floating[h]);const m=N/2-D/2,w=L/2-b[h]/2-1,S=En(f[P],w),$=En(f[x],w),I=S,A=L-b[h]-$,k=L/2-b[h]/2+m,y=oc(I,k,A),O=!a.arrow&&_r(o)!=null&&k!==y&&s.reference[h]/2-(k<I?S:$)-b[h]/2<0,M=O?k<I?k-I:k-A:0;return{[d]:p[d]+M,data:{[d]:y,centerOffset:k-y-M,...O&&{alignmentOffset:M}},reset:O}}}),AE=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:l,platform:a,elements:c}=t,{mainAxis:u=!0,crossAxis:f=!0,fallbackPlacements:p,fallbackStrategy:d="bestFit",fallbackAxisSideDirection:h="none",flipAlignment:b=!0,...v}=fr(e,t);if((n=s.arrow)!=null&&n.alignmentOffset)return{};const P=Un(o),x=Sn(l),E=Un(l)===l,N=await(a.isRTL==null?void 0:a.isRTL(c.floating)),D=p||(E||!b?[pi(l)]:tE(l)),F=h!=="none";!p&&F&&D.push(...sE(l,b,h,N));const L=[l,...D],m=await a.detectOverflow(t,v),w=[];let S=((r=s.flip)==null?void 0:r.overflows)||[];if(u&&w.push(m[P]),f){const k=eE(o,i,N);w.push(m[k[0]],m[k[1]])}if(S=[...S,{placement:o,overflows:w}],!w.every(k=>k<=0)){var $,I;const k=((($=s.flip)==null?void 0:$.index)||0)+1,y=L[k];if(y&&(!(f==="alignment"?x!==Sn(y):!1)||S.every(T=>Sn(T.placement)===x?T.overflows[0]>0:!0)))return{data:{index:k,overflows:S},reset:{placement:y}};let O=(I=S.filter(M=>M.overflows[0]<=0).sort((M,T)=>M.overflows[1]-T.overflows[1])[0])==null?void 0:I.placement;if(!O)switch(d){case"bestFit":{var A;const M=(A=S.filter(T=>{if(F){const B=Sn(T.placement);return B===x||B==="y"}return!0}).map(T=>[T.placement,T.overflows.filter(B=>B>0).reduce((B,R)=>B+R,0)]).sort((T,B)=>T[1]-B[1])[0])==null?void 0:A[0];M&&(O=M);break}case"initialPlacement":O=l;break}if(o!==O)return{reset:{placement:O}}}return{}}}},NE=new Set(["left","top"]);async function CE(e,t){const{placement:n,platform:r,elements:o}=e,s=await(r.isRTL==null?void 0:r.isRTL(o.floating)),i=Un(n),l=_r(n),a=Sn(n)==="y",c=NE.has(i)?-1:1,u=s&&a?-1:1,f=fr(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 l&&typeof h=="number"&&(d=l==="end"?h*-1:h),a?{x:d*u,y:p*c}:{x:p*c,y:d*u}}const OE=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:l}=t,a=await CE(t,e);return i===((n=l.offset)==null?void 0:n.placement)&&(r=l.arrow)!=null&&r.alignmentOffset?{}:{x:o+a.x,y:s+a.y,data:{...a,placement:i}}}}},IE=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:o,platform:s}=t,{mainAxis:i=!0,crossAxis:l=!1,limiter:a={fn:P=>{let{x,y:E}=P;return{x,y:E}}},...c}=fr(e,t),u={x:n,y:r},f=await s.detectOverflow(t,c),p=Sn(Un(o)),d=$p(p);let h=u[d],b=u[p];if(i){const P=d==="y"?"top":"left",x=d==="y"?"bottom":"right",E=h+f[P],N=h-f[x];h=oc(E,h,N)}if(l){const P=p==="y"?"top":"left",x=p==="y"?"bottom":"right",E=b+f[P],N=b-f[x];b=oc(E,b,N)}const v=a.fn({...t,[d]:h,[p]:b});return{...v,data:{x:v.x-n,y:v.y-r,enabled:{[d]:i,[p]:l}}}}}},$E=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:l}=t,{apply:a=()=>{},...c}=fr(e,t),u=await i.detectOverflow(t,c),f=Un(o),p=_r(o),d=Sn(o)==="y",{width:h,height:b}=s.floating;let v,P;f==="top"||f==="bottom"?(v=f,P=p===(await(i.isRTL==null?void 0:i.isRTL(l.floating))?"start":"end")?"left":"right"):(P=f,v=p==="end"?"top":"bottom");const x=b-u.top-u.bottom,E=h-u.left-u.right,N=En(b-u[v],x),D=En(h-u[P],E),F=!t.middlewareData.shift;let L=N,m=D;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(m=E),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(L=x),F&&!p){const S=We(u.left,0),$=We(u.right,0),I=We(u.top,0),A=We(u.bottom,0);d?m=h-2*(S!==0||$!==0?S+$:We(u.left,u.right)):L=b-2*(I!==0||A!==0?I+A:We(u.top,u.bottom))}await a({...t,availableWidth:m,availableHeight:L});const w=await i.getDimensions(l.floating);return h!==w.width||b!==w.height?{reset:{rects:!0}}:{}}}};function Hp(e){const t=At(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const o=st(e),s=o?e.offsetWidth:n,i=o?e.offsetHeight:r,l=rs(n)!==s||rs(r)!==i;return l&&(n=s,r=i),{width:n,height:r,$:l}}function uc(e){return me(e)?e:e.contextElement}function Vr(e){const t=uc(e);if(!st(t))return en(1);const n=t.getBoundingClientRect(),{width:r,height:o,$:s}=Hp(t);let i=(s?rs(n.width):n.width)/r,l=(s?rs(n.height):n.height)/o;return(!i||!Number.isFinite(i))&&(i=1),(!l||!Number.isFinite(l))&&(l=1),{x:i,y:l}}const kE=en(0);function Gp(e){const t=ot(e);return!ui()||!t.visualViewport?kE:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function ME(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==ot(e)?!1:t}function dr(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const o=e.getBoundingClientRect(),s=uc(e);let i=en(1);t&&(r?me(r)&&(i=Vr(r)):i=Vr(e));const l=ME(s,n,r)?Gp(s):en(0);let a=(o.left+l.x)/i.x,c=(o.top+l.y)/i.y,u=o.width/i.x,f=o.height/i.y;if(s){const p=ot(s),d=r&&me(r)?ot(r):r;let h=p,b=rc(h);for(;b&&r&&d!==h;){const v=Vr(b),P=b.getBoundingClientRect(),x=At(b),E=P.left+(b.clientLeft+parseFloat(x.paddingLeft))*v.x,N=P.top+(b.clientTop+parseFloat(x.paddingTop))*v.y;a*=v.x,c*=v.y,u*=v.x,f*=v.y,a+=E,c+=N,h=ot(b),b=rc(h)}}return hi({width:u,height:f,x:a,y:c})}function gi(e,t){const n=fi(e).scrollLeft;return t?t.left+n:dr(Qt(e)).left+n}function qp(e,t){const n=e.getBoundingClientRect(),r=n.left+t.scrollLeft-gi(e,n),o=n.top+t.scrollTop;return{x:r,y:o}}function DE(e){let{elements:t,rect:n,offsetParent:r,strategy:o}=e;const s=o==="fixed",i=Qt(r),l=t?ci(t.floating):!1;if(r===i||l&&s)return n;let a={scrollLeft:0,scrollTop:0},c=en(1);const u=en(0),f=st(r);if((f||!f&&!s)&&((Wr(r)!=="body"||ns(i))&&(a=fi(r)),f)){const d=dr(r);c=Vr(r),u.x=d.x+r.clientLeft,u.y=d.y+r.clientTop}const p=i&&!f&&!s?qp(i,a):en(0);return{width:n.width*c.x,height:n.height*c.y,x:n.x*c.x-a.scrollLeft*c.x+u.x+p.x,y:n.y*c.y-a.scrollTop*c.y+u.y+p.y}}function BE(e){return Array.from(e.getClientRects())}function LE(e){const t=Qt(e),n=fi(e),r=e.ownerDocument.body,o=We(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),s=We(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let i=-n.scrollLeft+gi(e);const l=-n.scrollTop;return At(r).direction==="rtl"&&(i+=We(t.clientWidth,r.clientWidth)-o),{width:o,height:s,x:i,y:l}}const Kp=25;function FE(e,t){const n=ot(e),r=Qt(e),o=n.visualViewport;let s=r.clientWidth,i=r.clientHeight,l=0,a=0;if(o){s=o.width,i=o.height;const u=ui();(!u||u&&t==="fixed")&&(l=o.offsetLeft,a=o.offsetTop)}const c=gi(r);if(c<=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<=Kp&&(s-=h)}else c<=Kp&&(s+=c);return{width:s,height:i,x:l,y:a}}function RE(e,t){const n=dr(e,!0,t==="fixed"),r=n.top+e.clientTop,o=n.left+e.clientLeft,s=st(e)?Vr(e):en(1),i=e.clientWidth*s.x,l=e.clientHeight*s.y,a=o*s.x,c=r*s.y;return{width:i,height:l,x:a,y:c}}function Zp(e,t,n){let r;if(t==="viewport")r=FE(e,n);else if(t==="document")r=LE(Qt(e));else if(me(t))r=RE(t,n);else{const o=Gp(e);r={x:t.x-o.x,y:t.y-o.y,width:t.width,height:t.height}}return hi(r)}function Yp(e,t){const n=xn(e);return n===t||!me(n)||wn(n)?!1:At(n).position==="fixed"||Yp(n,t)}function jE(e,t){const n=t.get(e);if(n)return n;let r=zn(e,[],!1).filter(l=>me(l)&&Wr(l)!=="body"),o=null;const s=At(e).position==="fixed";let i=s?xn(e):e;for(;me(i)&&!wn(i);){const l=At(i),a=nc(i);!a&&l.position==="fixed"&&(o=null),(s?!a&&!o:!a&&l.position==="static"&&!!o&&(o.position==="absolute"||o.position==="fixed")||ns(i)&&!a&&Yp(e,i))?r=r.filter(u=>u!==i):o=l,i=xn(i)}return t.set(e,r),r}function zE(e){let{element:t,boundary:n,rootBoundary:r,strategy:o}=e;const i=[...n==="clippingAncestors"?ci(t)?[]:jE(t,this._c):[].concat(n),r],l=Zp(t,i[0],o);let a=l.top,c=l.right,u=l.bottom,f=l.left;for(let p=1;p<i.length;p++){const d=Zp(t,i[p],o);a=We(d.top,a),c=En(d.right,c),u=En(d.bottom,u),f=We(d.left,f)}return{width:c-f,height:u-a,x:f,y:a}}function UE(e){const{width:t,height:n}=Hp(e);return{width:t,height:n}}function WE(e,t,n){const r=st(t),o=Qt(t),s=n==="fixed",i=dr(e,!0,s,t);let l={scrollLeft:0,scrollTop:0};const a=en(0);function c(){a.x=gi(o)}if(r||!r&&!s)if((Wr(t)!=="body"||ns(o))&&(l=fi(t)),r){const d=dr(t,!0,s,t);a.x=d.x+t.clientLeft,a.y=d.y+t.clientTop}else o&&c();s&&!r&&o&&c();const u=o&&!r&&!s?qp(o,l):en(0),f=i.left+l.scrollLeft-a.x-u.x,p=i.top+l.scrollTop-a.y-u.y;return{x:f,y:p,width:i.width,height:i.height}}function fc(e){return At(e).position==="static"}function Xp(e,t){if(!st(e)||At(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return Qt(e)===n&&(n=n.ownerDocument.body),n}function Jp(e,t){const n=ot(e);if(ci(e))return n;if(!st(e)){let o=xn(e);for(;o&&!wn(o);){if(me(o)&&!fc(o))return o;o=xn(o)}return n}let r=Xp(e,t);for(;r&&K2(r)&&fc(r);)r=Xp(r,t);return r&&wn(r)&&fc(r)&&!nc(r)?n:r||X2(e)||n}const _E=async function(e){const t=this.getOffsetParent||Jp,n=this.getDimensions,r=await n(e.floating);return{reference:WE(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function VE(e){return At(e).direction==="rtl"}const HE={convertOffsetParentRelativeRectToViewportRelativeRect:DE,getDocumentElement:Qt,getClippingRect:zE,getOffsetParent:Jp,getElementRects:_E,getClientRects:BE,getDimensions:UE,getScale:Vr,isElement:me,isRTL:VE};function Qp(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function GE(e,t){let n=null,r;const o=Qt(e);function s(){var l;clearTimeout(r),(l=n)==null||l.disconnect(),n=null}function i(l,a){l===void 0&&(l=!1),a===void 0&&(a=1),s();const c=e.getBoundingClientRect(),{left:u,top:f,width:p,height:d}=c;if(l||t(),!p||!d)return;const h=di(f),b=di(o.clientWidth-(u+p)),v=di(o.clientHeight-(f+d)),P=di(u),E={rootMargin:-h+"px "+-b+"px "+-v+"px "+-P+"px",threshold:We(0,En(1,a))||1};let N=!0;function D(F){const L=F[0].intersectionRatio;if(L!==a){if(!N)return i();L?i(!1,L):r=setTimeout(()=>{i(!1,1e-7)},1e3)}L===1&&!Qp(c,e.getBoundingClientRect())&&i(),N=!1}try{n=new IntersectionObserver(D,{...E,root:o.ownerDocument})}catch{n=new IntersectionObserver(D,E)}n.observe(e)}return i(!0),s}function eh(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:o=!0,ancestorResize:s=!0,elementResize:i=typeof ResizeObserver=="function",layoutShift:l=typeof IntersectionObserver=="function",animationFrame:a=!1}=r,c=uc(e),u=o||s?[...c?zn(c):[],...t?zn(t):[]]:[];u.forEach(P=>{o&&P.addEventListener("scroll",n,{passive:!0}),s&&P.addEventListener("resize",n)});const f=c&&l?GE(c,n):null;let p=-1,d=null;i&&(d=new ResizeObserver(P=>{let[x]=P;x&&x.target===c&&d&&t&&(d.unobserve(t),cancelAnimationFrame(p),p=requestAnimationFrame(()=>{var E;(E=d)==null||E.observe(t)})),n()}),c&&!a&&d.observe(c),t&&d.observe(t));let h,b=a?dr(e):null;a&&v();function v(){const P=dr(e);b&&!Qp(b,P)&&n(),b=P,h=requestAnimationFrame(v)}return n(),()=>{var P;u.forEach(x=>{o&&x.removeEventListener("scroll",n),s&&x.removeEventListener("resize",n)}),f==null||f(),(P=d)==null||P.disconnect(),d=null,a&&cancelAnimationFrame(h)}}const dc=Vp,qE=OE,KE=IE,ZE=AE,YE=$E,th=TE,XE=(e,t,n)=>{const r=new Map,o={platform:HE,...n},s={...o.platform,_c:r};return PE(e,t,{...o,platform:s})};var JE=typeof document<"u",QE=function(){},yi=JE?g.useLayoutEffect:QE;function vi(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(!vi(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)&&!vi(e[s],t[s]))return!1}return!0}return e!==e&&t!==t}function nh(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function rh(e,t){const n=nh(e);return Math.round(t*n)/n}function pc(e){const t=U.useRef(e);return yi(()=>{t.current=e}),t}function oh(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:o,elements:{reference:s,floating:i}={},transform:l=!0,whileElementsMounted:a,open:c}=e,[u,f]=U.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[p,d]=U.useState(r);vi(p,r)||d(r);const[h,b]=U.useState(null),[v,P]=U.useState(null),x=U.useCallback(T=>{T!==F.current&&(F.current=T,b(T))},[]),E=U.useCallback(T=>{T!==L.current&&(L.current=T,P(T))},[]),N=s||h,D=i||v,F=U.useRef(null),L=U.useRef(null),m=U.useRef(u),w=a!=null,S=pc(a),$=pc(o),I=pc(c),A=U.useCallback(()=>{if(!F.current||!L.current)return;const T={placement:t,strategy:n,middleware:p};$.current&&(T.platform=$.current),XE(F.current,L.current,T).then(B=>{const R={...B,isPositioned:I.current!==!1};k.current&&!vi(m.current,R)&&(m.current=R,Qr.flushSync(()=>{f(R)}))})},[p,t,n,$,I]);yi(()=>{c===!1&&m.current.isPositioned&&(m.current.isPositioned=!1,f(T=>({...T,isPositioned:!1})))},[c]);const k=U.useRef(!1);yi(()=>(k.current=!0,()=>{k.current=!1}),[]),yi(()=>{if(N&&(F.current=N),D&&(L.current=D),N&&D){if(S.current)return S.current(N,D,A);A()}},[N,D,A,S,w]);const y=U.useMemo(()=>({reference:F,floating:L,setReference:x,setFloating:E}),[x,E]),O=U.useMemo(()=>({reference:N,floating:D}),[N,D]),M=U.useMemo(()=>{const T={position:n,left:0,top:0};if(!O.floating)return T;const B=rh(O.floating,u.x),R=rh(O.floating,u.y);return l?{...T,transform:"translate("+B+"px, "+R+"px)",...nh(O.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:B,top:R}},[n,l,O.floating,u.x,u.y]);return U.useMemo(()=>({...u,update:A,refs:y,elements:O,floatingStyles:M}),[u,A,y,O,M])}const e8=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?th({element:r.current,padding:o}).fn(n):{}:r?th({element:r,padding:o}).fn(n):{}}}},hc=(e,t)=>{const n=qE(e);return{name:n.name,fn:n.fn,options:[e,t]}},sh=(e,t)=>{const n=KE(e);return{name:n.name,fn:n.fn,options:[e,t]}},ih=(e,t)=>{const n=ZE(e);return{name:n.name,fn:n.fn,options:[e,t]}},t8=(e,t)=>{const n=YE(e);return{name:n.name,fn:n.fn,options:[e,t]}},n8=(e,t)=>{const n=e8(e);return{name:n.name,fn:n.fn,options:[e,t]}},ah={...U},r8=ah.useInsertionEffect||(e=>e());function lh(e){const t=U.useRef(()=>{if(process.env.NODE_ENV!=="production")throw new Error("Cannot call an event handler while rendering.")});return r8(()=>{t.current=e}),U.useCallback(function(){for(var n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return t.current==null?void 0:t.current(...r)},[])}var mc=typeof document<"u"?g.useLayoutEffect:g.useEffect;let ch=!1,o8=0;const uh=()=>"floating-ui-"+Math.random().toString(36).slice(2,6)+o8++;function s8(){const[e,t]=U.useState(()=>ch?uh():void 0);return mc(()=>{e==null&&t(uh())},[]),U.useEffect(()=>{ch=!0},[]),e}const i8=ah.useId||s8;let ss;process.env.NODE_ENV!=="production"&&(ss=new Set);function a8(){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=ss)!=null&&e.has(o))){var s;(s=ss)==null||s.add(o),console.warn(o)}}function l8(){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=ss)!=null&&e.has(o))){var s;(s=ss)==null||s.add(o),console.error(o)}}function c8(){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 u8=U.createContext(null),f8=U.createContext(null),d8=()=>{var e;return((e=U.useContext(u8))==null?void 0:e.id)||null},p8=()=>U.useContext(f8),h8="data-floating-ui-focusable";function m8(e){const{open:t=!1,onOpenChange:n,elements:r}=e,o=i8(),s=U.useRef({}),[i]=U.useState(()=>c8()),l=d8()!=null;if(process.env.NODE_ENV!=="production"){const d=r.reference;d&&!me(d)&&l8("Cannot pass a virtual element to the `elements.reference` option,","as it must be a real DOM element. Use `refs.setPositionReference()`","instead.")}const[a,c]=U.useState(r.reference),u=lh((d,h,b)=>{s.current.openEvent=d?h:void 0,i.emit("openchange",{open:d,event:h,reason:b,nested:l}),n==null||n(d,h,b)}),f=U.useMemo(()=>({setPositionReference:c}),[]),p=U.useMemo(()=>({reference:a||r.reference||null,floating:r.floating||null,domReference:r.reference}),[a,r.reference,r.floating]);return U.useMemo(()=>({dataRef:s,open:t,onOpenChange:u,elements:p,events:i,floatingId:o,refs:f}),[t,u,p,i,o,f])}function b8(e){e===void 0&&(e={});const{nodeId:t}=e,n=m8({...e,elements:{reference:null,floating:null,...e.elements}}),r=e.rootContext||n,o=r.elements,[s,i]=U.useState(null),[l,a]=U.useState(null),u=(o==null?void 0:o.domReference)||s,f=U.useRef(null),p=p8();mc(()=>{u&&(f.current=u)},[u]);const d=oh({...e,elements:{...o,...l&&{reference:l}}}),h=U.useCallback(E=>{const N=me(E)?{getBoundingClientRect:()=>E.getBoundingClientRect(),contextElement:E}:E;a(N),d.refs.setReference(N)},[d.refs]),b=U.useCallback(E=>{(me(E)||E===null)&&(f.current=E,i(E)),(me(d.refs.reference.current)||d.refs.reference.current===null||E!==null&&!me(E))&&d.refs.setReference(E)},[d.refs]),v=U.useMemo(()=>({...d.refs,setReference:b,setPositionReference:h,domReference:f}),[d.refs,b,h]),P=U.useMemo(()=>({...d.elements,domReference:u}),[d.elements,u]),x=U.useMemo(()=>({...d,...r,refs:v,elements:P,nodeId:t}),[d,v,P,t,r]);return mc(()=>{r.dataRef.current.floatingContext=x;const E=p==null?void 0:p.nodesRef.current.find(N=>N.id===t);E&&(E.context=x)}),U.useMemo(()=>({...d,context:x,refs:v,elements:P}),[d,v,P,x])}const fh="active",dh="selected";function bc(e,t,n){const r=new Map,o=n==="item";let s=e;if(o&&e){const{[fh]:i,[dh]:l,...a}=e;s=a}return{...n==="floating"&&{tabIndex:-1,[h8]:""},...s,...t.map(i=>{const l=i?i[n]:null;return typeof l=="function"?e?l(e):null:l}).concat(e).reduce((i,l)=>(l&&Object.entries(l).forEach(a=>{let[c,u]=a;if(!(o&&[fh,dh].includes(c)))if(c.indexOf("on")===0){if(r.has(c)||r.set(c,[]),typeof u=="function"){var f;(f=r.get(c))==null||f.push(u),i[c]=function(){for(var p,d=arguments.length,h=new Array(d),b=0;b<d;b++)h[b]=arguments[b];return(p=r.get(c))==null?void 0:p.map(v=>v(...h)).find(v=>v!==void 0)}}}else i[c]=u}),i),{})}}function g8(e){e===void 0&&(e=[]);const t=e.map(l=>l==null?void 0:l.reference),n=e.map(l=>l==null?void 0:l.floating),r=e.map(l=>l==null?void 0:l.item),o=U.useCallback(l=>bc(l,e,"reference"),t),s=U.useCallback(l=>bc(l,e,"floating"),n),i=U.useCallback(l=>bc(l,e,"item"),r);return U.useMemo(()=>({getReferenceProps:o,getFloatingProps:s,getItemProps:i}),[o,s,i])}function ph(e,t){return{...e,rects:{...e.rects,floating:{...e.rects.floating,height:t}}}}const y8=e=>({name:"inner",options:e,async fn(t){const{listRef:n,overflowRef:r,onFallbackChange:o,offset:s=0,index:i=0,minItemsVisible:l=4,referenceOverflowThreshold:a=0,scrollRef:c,...u}=fr(e,t),{rects:f,elements:{floating:p}}=t,d=n.current[i],h=(c==null?void 0:c.current)||p,b=p.clientTop||h.clientTop,v=p.clientTop!==0,P=h.clientTop!==0,x=p===h;if(process.env.NODE_ENV!=="production"&&(t.placement.startsWith("bottom")||a8('`placement` side must be "bottom" when using the `inner`',"middleware.")),!d)return{};const E={...t,...await hc(-d.offsetTop-p.clientTop-f.reference.height/2-d.offsetHeight/2-s).fn(t)},N=await dc(ph(E,h.scrollHeight+b+p.clientTop),u),D=await dc(E,{...u,elementContext:"reference"}),F=We(0,N.top),L=E.y+F,S=(h.scrollHeight>h.clientHeight?$=>$:rs)(We(0,h.scrollHeight+(v&&x||P?b*2:0)-F-We(0,N.bottom)));if(h.style.maxHeight=S+"px",h.scrollTop=F,o){const $=h.offsetHeight<d.offsetHeight*En(l,n.current.length)-1||D.top>=-a||D.bottom>=-a;Qr.flushSync(()=>o($))}return r&&(r.current=await dc(ph({...E,y:L},h.offsetHeight+b+p.clientTop),u)),{y:L}}});function v8(e,t){const{open:n,elements:r}=e,{enabled:o=!0,overflowRef:s,scrollRef:i,onChange:l}=t,a=lh(l),c=U.useRef(!1),u=U.useRef(null),f=U.useRef(null);U.useEffect(()=>{if(!o)return;function d(b){if(b.ctrlKey||!h||s.current==null)return;const v=b.deltaY,P=s.current.top>=-.5,x=s.current.bottom>=-.5,E=h.scrollHeight-h.clientHeight,N=v<0?-1:1,D=v<0?"max":"min";h.scrollHeight<=h.clientHeight||(!P&&v>0||!x&&v<0?(b.preventDefault(),Qr.flushSync(()=>{a(F=>F+Math[D](v,E*N))})):/firefox/i.test(J2())&&(h.scrollTop+=v))}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=U.useMemo(()=>({onKeyDown(){c.current=!0},onWheel(){c.current=!1},onPointerMove(){c.current=!1},onScroll(){const d=(i==null?void 0:i.current)||r.floating;if(!(!s.current||!d||!c.current)){if(u.current!==null){const h=d.scrollTop-u.current;(s.current.bottom<-.5&&h<-1||s.current.top<-.5&&h>1)&&Qr.flushSync(()=>a(b=>b+h))}requestAnimationFrame(()=>{u.current=d.scrollTop})}}}),[r.floating,a,s,i]);return U.useMemo(()=>o?{floating:p}:{},[o,p])}let Hr=g.createContext({styles:void 0,setReference:()=>{},setFloating:()=>{},getReferenceProps:()=>({}),getFloatingProps:()=>({}),slot:{}});Hr.displayName="FloatingContext";let gc=g.createContext(null);gc.displayName="PlacementContext";function w8(e){return g.useMemo(()=>e?typeof e=="string"?{to:e}:e:null,[e])}function x8(){return g.useContext(Hr).setReference}function E8(){return g.useContext(Hr).getReferenceProps}function S8(){let{getFloatingProps:e,slot:t}=g.useContext(Hr);return g.useCallback((...n)=>Object.assign({},e(...n),{"data-anchor":t.anchor}),[e,t])}function P8(e=null){e===!1&&(e=null),typeof e=="string"&&(e={to:e});let t=g.useContext(gc),n=g.useMemo(()=>e,[JSON.stringify(e,(o,s)=>{var i;return(i=s==null?void 0:s.outerHTML)!=null?i:s})]);Oe(()=>{t==null||t(n??null)},[t,n]);let r=g.useContext(Hr);return g.useMemo(()=>[r.setFloating,e?r.styles:{}],[r.setFloating,e,r.styles])}let hh=4;function T8({children:e,enabled:t=!0}){let[n,r]=g.useState(null),[o,s]=g.useState(0),i=g.useRef(null),[l,a]=g.useState(null);A8(l);let c=t&&n!==null&&l!==null,{to:u="bottom",gap:f=0,offset:p=0,padding:d=0,inner:h}=N8(n,l),[b,v="center"]=u.split(" ");Oe(()=>{c&&s(0)},[c]);let{refs:P,floatingStyles:x,context:E}=b8({open:c,placement:b==="selection"?v==="center"?"bottom":`bottom-${v}`:v==="center"?`${b}`:`${b}-${v}`,strategy:"absolute",transform:!1,middleware:[hc({mainAxis:b==="selection"?0:f,crossAxis:p}),sh({padding:d}),b!=="selection"&&ih({padding:d}),b==="selection"&&h?y8({...h,padding:d,overflowRef:i,offset:o,minItemsVisible:hh,referenceOverflowThreshold:d,onFallbackChange($){var I,A;if(!$)return;let k=E.elements.floating;if(!k)return;let y=parseFloat(getComputedStyle(k).scrollPaddingBottom)||0,O=Math.min(hh,k.childElementCount),M=0,T=0;for(let B of(A=(I=E.elements.floating)==null?void 0:I.childNodes)!=null?A:[])if(vn(B)){let R=B.offsetTop,z=R+B.clientHeight+y,W=k.scrollTop,G=W+k.clientHeight;if(R>=W&&z<=G)O--;else{T=Math.max(0,Math.min(z,G)-Math.max(R,W)),M=B.clientHeight;break}}O>=1&&s(B=>{let R=M*O-T+y;return B>=R?B:R})}}):null,t8({padding:d,apply({availableWidth:$,availableHeight:I,elements:A}){Object.assign(A.floating.style,{overflow:"auto",maxWidth:`${$}px`,maxHeight:`min(var(--anchor-max-height, 100vh), ${I}px)`})}})].filter(Boolean),whileElementsMounted:eh}),[N=b,D=v]=E.placement.split("-");b==="selection"&&(N="selection");let F=g.useMemo(()=>({anchor:[N,D].filter(Boolean).join(" ")}),[N,D]),L=v8(E,{overflowRef:i,onChange:s}),{getReferenceProps:m,getFloatingProps:w}=g8([L]),S=pe($=>{a($),P.setFloating($)});return U.createElement(gc.Provider,{value:r},U.createElement(Hr.Provider,{value:{setFloating:S,setReference:P.setReference,styles:x,getReferenceProps:m,getFloatingProps:w,slot:F}},e))}function A8(e){Oe(()=>{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 N8(e,t){var n,r,o;let s=yc((n=e==null?void 0:e.gap)!=null?n:"var(--anchor-gap, 0)",t),i=yc((r=e==null?void 0:e.offset)!=null?r:"var(--anchor-offset, 0)",t),l=yc((o=e==null?void 0:e.padding)!=null?o:"var(--anchor-padding, 0)",t);return{...e,gap:s,offset:i,padding:l}}function yc(e,t,n=void 0){let r=ar(),o=pe((a,c)=>{if(a==null)return[n,null];if(typeof a=="number")return[a,null];if(typeof a=="string"){if(!c)return[n,null];let u=bh(a,c);return[u,f=>{let p=mh(a);{let d=p.map(h=>window.getComputedStyle(c).getPropertyValue(h));r.requestAnimationFrame(function h(){r.nextFrame(h);let b=!1;for(let[P,x]of p.entries()){let E=window.getComputedStyle(c).getPropertyValue(x);if(d[P]!==E){d[P]=E,b=!0;break}}if(!b)return;let v=bh(a,c);u!==v&&(f(v),u=v)})}return r.dispose}]}return[n,null]}),s=g.useMemo(()=>o(e,t)[0],[e,t]),[i=s,l]=g.useState();return Oe(()=>{let[a,c]=o(e,t);if(l(a),!!c)return c(l)},[e,t]),i}function mh(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,...mh(o)]:[r]}return[]}function bh(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 C8({children:e,freeze:t},n){let r=gh(t,e);return g.isValidElement(r)?g.cloneElement(r,{ref:n}):g.createElement(g.Fragment,null,r)}g.forwardRef(C8);function gh(e,t){let[n,r]=g.useState(t);return!e&&n!==t&&r(t),e?n:t}let vc=g.createContext(null);vc.displayName="OpenClosedContext";var Ut=(e=>(e[e.Open=1]="Open",e[e.Closed=2]="Closed",e[e.Closing=4]="Closing",e[e.Opening=8]="Opening",e))(Ut||{});function wc(){return g.useContext(vc)}function yh({value:e,children:t}){return g.createElement(vc.Provider,{value:e},t)}function O8(e){throw new Error("Unexpected object: "+e)}var Ne=(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))(Ne||{});function wi(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:O8(e)}}function vh(e){let t=pe(e),n=g.useRef(!1);g.useEffect(()=>(n.current=!1,()=>{n.current=!0,j0(()=>{n.current&&t()})}),[t])}let I8=g.createContext(!1);function $8(){return g.useContext(I8)}function k8(e){let t=$8(),n=g.useContext(xh),[r,o]=g.useState(()=>{var s;if(!t&&n!==null)return(s=n.current)!=null?s:null;if(Xt.isServer)return null;let i=e==null?void 0:e.getElementById("headlessui-portal-root");if(i)return i;if(e===null)return null;let l=e.createElement("div");return l.setAttribute("id","headlessui-portal-root"),e.body.appendChild(l)});return g.useEffect(()=>{r!==null&&(e!=null&&e.body.contains(r)||e==null||e.body.appendChild(r))},[r,e]),g.useEffect(()=>{t||n!==null&&o(n.current)},[n,o,t]),r}let wh=g.Fragment,M8=nt(function(e,t){let{ownerDocument:n=null,...r}=e,o=g.useRef(null),s=Pt(Hx(p=>{o.current=p}),t),i=Jl(o.current),l=n??i,a=k8(l),c=g.useContext(F8),u=ar(),f=ht();return vh(()=>{var p;a&&a.childNodes.length<=0&&((p=a.parentElement)==null||p.removeChild(a))}),a?Ke.createPortal(g.createElement("div",{"data-headlessui-portal":"",ref:p=>{u.dispose(),c&&p&&u.add(c.register(p))}},f({ourProps:{ref:s},theirProps:r,slot:{},defaultTag:wh,name:"Portal"})),a):null});function D8(e,t){let n=Pt(t),{enabled:r=!0,ownerDocument:o,...s}=e,i=ht();return r?g.createElement(M8,{...s,ownerDocument:o,ref:n}):i({ourProps:{ref:n},theirProps:s,slot:{},defaultTag:wh,name:"Portal"})}let B8=g.Fragment,xh=g.createContext(null);function L8(e,t){let{target:n,...r}=e,o={ref:Pt(t)},s=ht();return g.createElement(xh.Provider,{value:n},s({ourProps:o,theirProps:r,defaultTag:B8,name:"Popover.Group"}))}let F8=g.createContext(null),R8=nt(D8),j8=nt(L8),z8=Object.assign(R8,{Group:j8});const xi={Idle:{kind:"Idle"},Tracked:e=>({kind:"Tracked",position:e}),Moved:{kind:"Moved"}};function Eh(e){let t=e.getBoundingClientRect();return`${t.x},${t.y}`}function U8(e,t,n){let r=pt();if(t.kind==="Tracked"){let o=function(){s!==Eh(e)&&(r.dispose(),n())},{position:s}=t,i=new ResizeObserver(o);i.observe(e),r.add(()=>i.disconnect()),r.addEventListener(window,"scroll",o,{passive:!0}),r.addEventListener(window,"resize",o)}return()=>r.dispose()}function W8(){let e=typeof document>"u";return"useSyncExternalStore"in U?(t=>t.useSyncExternalStore)(U)(()=>()=>{},()=>!1,()=>!e):!1}function Sh(){let e=W8(),[t,n]=U.useState(Xt.isHandoffComplete);return t&&Xt.isHandoffComplete===!1&&n(!1),U.useEffect(()=>{t!==!0&&n(!0)},[t]),U.useEffect(()=>Xt.handoff(),[]),e?!1:t}function _8(){let e=g.useRef(!1);return Oe(()=>(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)||!Jo((t=e.as)!=null?t:Ah)||g.Children.count(e.children)===1}let Ei=g.createContext(null);Ei.displayName="TransitionContext";var V8=(e=>(e.Visible="visible",e.Hidden="hidden",e))(V8||{});function H8(){let e=g.useContext(Ei);if(e===null)throw new Error("A <Transition.Child /> is used but it is missing a parent <Transition /> or <Transition.Root />.");return e}function G8(){let e=g.useContext(Si);if(e===null)throw new Error("A <Transition.Child /> is used but it is missing a parent <Transition /> or <Transition.Root />.");return e}let Si=g.createContext(null);Si.displayName="NestingContext";function Pi(e){return"children"in e?Pi(e.children):e.current.filter(({el:t})=>t.current!==null).filter(({state:t})=>t==="visible").length>0}function Th(e,t){let n=lr(e),r=g.useRef([]),o=_8(),s=ar(),i=pe((d,h=Rn.Hidden)=>{let b=r.current.findIndex(({el:v})=>v===d);b!==-1&&(St(h,{[Rn.Unmount](){r.current.splice(b,1)},[Rn.Hidden](){r.current[b].state="hidden"}}),s.microTask(()=>{var v;!Pi(r)&&o.current&&((v=n.current)==null||v.call(n))}))}),l=pe(d=>{let h=r.current.find(({el:b})=>b===d);return h?h.state!=="visible"&&(h.state="visible"):r.current.push({el:d,state:"visible"}),()=>i(d,Rn.Unmount)}),a=g.useRef([]),c=g.useRef(Promise.resolve()),u=g.useRef({enter:[],leave:[]}),f=pe((d,h,b)=>{a.current.splice(0),t&&(t.chains.current[h]=t.chains.current[h].filter(([v])=>v!==d)),t==null||t.chains.current[h].push([d,new Promise(v=>{a.current.push(v)})]),t==null||t.chains.current[h].push([d,new Promise(v=>{Promise.all(u.current[h].map(([P,x])=>x)).then(()=>v())})]),h==="enter"?c.current=c.current.then(()=>t==null?void 0:t.wait.current).then(()=>b(h)):b(h)}),p=pe((d,h,b)=>{Promise.all(u.current[h].splice(0).map(([v,P])=>P)).then(()=>{var v;(v=a.current.shift())==null||v()}).then(()=>b(h))});return g.useMemo(()=>({children:r,register:l,unregister:i,onStart:f,onStop:p,wait:c,chains:u}),[l,i,r,f,p,u,c])}let Ah=g.Fragment,Nh=ri.RenderStrategy;function q8(e,t){var n,r;let{transition:o=!0,beforeEnter:s,afterEnter:i,beforeLeave:l,afterLeave:a,enter:c,enterFrom:u,enterTo:f,entered:p,leave:d,leaveFrom:h,leaveTo:b,...v}=e,[P,x]=g.useState(null),E=g.useRef(null),N=Ph(e),D=Pt(...N?[E,t,x]:t===null?[]:[t]),F=(n=v.unmount)==null||n?Rn.Unmount:Rn.Hidden,{show:L,appear:m,initial:w}=H8(),[S,$]=g.useState(L?"visible":"hidden"),I=G8(),{register:A,unregister:k}=I;Oe(()=>A(E),[A,E]),Oe(()=>{if(F===Rn.Hidden&&E.current){if(L&&S!=="visible"){$("visible");return}return St(S,{hidden:()=>k(E),visible:()=>A(E)})}},[S,E,A,k,L,F]);let y=Sh();Oe(()=>{if(N&&y&&S==="visible"&&E.current===null)throw new Error("Did you forget to passthrough the `ref` to the actual DOM node?")},[E,S,y,N]);let O=w&&!m,M=m&&L&&w,T=g.useRef(!1),B=Th(()=>{T.current||($("hidden"),k(E))},I),R=pe(ne=>{T.current=!0;let be=ne?"enter":"leave";B.onStart(E,be,fe=>{fe==="enter"?s==null||s():fe==="leave"&&(l==null||l())})}),z=pe(ne=>{let be=ne?"enter":"leave";T.current=!1,B.onStop(E,be,fe=>{fe==="enter"?i==null||i():fe==="leave"&&(a==null||a())}),be==="leave"&&!Pi(B)&&($("hidden"),k(E))});g.useEffect(()=>{N&&o||(R(L),z(L))},[L,N,o]);let W=!(!o||!N||!y||O),[,G]=Op(W,P,L,{start:R,end:z}),J=jn({ref:D,className:((r=Fl(v.className,M&&c,M&&u,G.enter&&c,G.enter&&G.closed&&u,G.enter&&!G.closed&&f,G.leave&&d,G.leave&&!G.closed&&h,G.leave&&G.closed&&b,!G.transition&&L&&p))==null?void 0:r.trim())||void 0,...Cp(G)}),K=0;S==="visible"&&(K|=Ut.Open),S==="hidden"&&(K|=Ut.Closed),L&&S==="hidden"&&(K|=Ut.Opening),!L&&S==="visible"&&(K|=Ut.Closing);let _=ht();return g.createElement(Si.Provider,{value:B},g.createElement(yh,{value:K},_({ourProps:J,theirProps:v,defaultTag:Ah,features:Nh,visible:S==="visible",name:"Transition.Child"})))}function K8(e,t){let{show:n,appear:r=!1,unmount:o=!0,...s}=e,i=g.useRef(null),l=Ph(e),a=Pt(...l?[i,t]:t===null?[]:[t]);Sh();let c=wc();if(n===void 0&&c!==null&&(n=(c&Ut.Open)===Ut.Open),n===void 0)throw new Error("A <Transition /> is used but it is missing a `show={true | false}` prop.");let[u,f]=g.useState(n?"visible":"hidden"),p=Th(()=>{n||f("hidden")}),[d,h]=g.useState(!0),b=g.useRef([n]);Oe(()=>{d!==!1&&b.current[b.current.length-1]!==n&&(b.current.push(n),h(!1))},[b,n]);let v=g.useMemo(()=>({show:n,appear:r,initial:d}),[n,r,d]);Oe(()=>{n?f("visible"):!Pi(p)&&i.current!==null&&f("hidden")},[n,p]);let P={unmount:o},x=pe(()=>{var D;d&&h(!1),(D=e.beforeEnter)==null||D.call(e)}),E=pe(()=>{var D;d&&h(!1),(D=e.beforeLeave)==null||D.call(e)}),N=ht();return g.createElement(Si.Provider,{value:p},g.createElement(Ei.Provider,{value:v},N({ourProps:{...P,as:g.Fragment,children:g.createElement(Ch,{ref:a,...P,...s,beforeEnter:x,beforeLeave:E})},theirProps:{},defaultTag:g.Fragment,features:Nh,visible:u==="visible",name:"Transition"})))}function Z8(e,t){let n=g.useContext(Ei)!==null,r=wc()!==null;return g.createElement(g.Fragment,null,!n&&r?g.createElement(xc,{ref:t,...e}):g.createElement(Ch,{ref:t,...e}))}let xc=nt(K8),Ch=nt(q8),Y8=nt(Z8),Ec=Object.assign(xc,{Child:Y8,Root:xc}),Oh=/([\u2700-\u27BF]|[\uE000-\uF8FF]|\uD83C[\uDC00-\uDFFF]|\uD83D[\uDC00-\uDFFF]|[\u2011-\u26FF]|\uD83E[\uDD10-\uDDFF])/g;function Ih(e){var t,n;let r=(t=e.innerText)!=null?t:"",o=e.cloneNode(!0);if(!vn(o))return r;let s=!1;for(let l of o.querySelectorAll('[hidden],[aria-hidden],[role="img"]'))l.remove(),s=!0;let i=s?(n=o.innerText)!=null?n:"":r;return Oh.test(i)&&(i=i.replace(Oh,"")),i}function X8(e){let t=e.getAttribute("aria-label");if(typeof t=="string")return t.trim();let n=e.getAttribute("aria-labelledby");if(n){let r=n.split(" ").map(o=>{let s=document.getElementById(o);if(s){let i=s.getAttribute("aria-label");return typeof i=="string"?i.trim():Ih(s).trim()}return null}).filter(Boolean);if(r.length>0)return r.join(", ")}return Ih(e).trim()}function J8(e){let t=g.useRef(""),n=g.useRef("");return pe(()=>{let r=e.current;if(!r)return"";let o=r.innerText;if(t.current===o)return n.current;let s=X8(r).trim().toLowerCase();return t.current=o,n.current=s,s})}var Q8=Object.defineProperty,e3=(e,t,n)=>t in e?Q8(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,$h=(e,t,n)=>(e3(e,typeof t!="symbol"?t+"":t,n),n),_e=(e=>(e[e.Open=0]="Open",e[e.Closed=1]="Closed",e))(_e||{}),Wn=(e=>(e[e.Single=0]="Single",e[e.Multi=1]="Multi",e))(Wn||{}),Ti=(e=>(e[e.Pointer=0]="Pointer",e[e.Other=1]="Other",e))(Ti||{}),kh=(e=>(e[e.OpenListbox=0]="OpenListbox",e[e.CloseListbox=1]="CloseListbox",e[e.GoToOption=2]="GoToOption",e[e.Search=3]="Search",e[e.ClearSearch=4]="ClearSearch",e[e.SelectOption=5]="SelectOption",e[e.RegisterOptions=6]="RegisterOptions",e[e.UnregisterOptions=7]="UnregisterOptions",e[e.SetButtonElement=8]="SetButtonElement",e[e.SetOptionsElement=9]="SetOptionsElement",e[e.SortOptions=10]="SortOptions",e[e.MarkButtonAsMoved=11]="MarkButtonAsMoved",e))(kh||{});function Mh(e,t=n=>n){let n=e.activeOptionIndex!==null?e.options[e.activeOptionIndex]:null,r=vp(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 t3={1(e){if(e.dataRef.current.disabled||e.listboxState===1)return e;let t=e.buttonElement?xi.Tracked(Eh(e.buttonElement)):e.buttonPositionState;return{...e,activeOptionIndex:null,pendingFocus:{focus:Ne.Nothing},listboxState:1,__demoMode:!1,buttonPositionState:t}},0(e,t){if(e.dataRef.current.disabled||e.listboxState===0)return e;let n=e.activeOptionIndex,{isSelected:r}=e.dataRef.current,o=e.options.findIndex(s=>r(s.dataRef.current.value));return o!==-1&&(n=o),{...e,frozenValue:!1,pendingFocus:t.focus,listboxState:0,activeOptionIndex:n,__demoMode:!1,buttonPositionState:xi.Idle}},2(e,t){var n,r,o,s,i;if(e.dataRef.current.disabled||e.listboxState===1)return e;let l={...e,searchQuery:"",activationTrigger:(n=t.trigger)!=null?n:1,__demoMode:!1};if(t.focus===Ne.Nothing)return{...l,activeOptionIndex:null};if(t.focus===Ne.Specific)return{...l,activeOptionIndex:e.options.findIndex(u=>u.id===t.id)};if(t.focus===Ne.Previous){let u=e.activeOptionIndex;if(u!==null){let f=e.options[u].dataRef.current.domRef,p=wi(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{...l,activeOptionIndex:p}}}}else if(t.focus===Ne.Next){let u=e.activeOptionIndex;if(u!==null){let f=e.options[u].dataRef.current.domRef,p=wi(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{...l,activeOptionIndex:p}}}}let a=Mh(e),c=wi(t,{resolveItems:()=>a.options,resolveActiveIndex:()=>a.activeOptionIndex,resolveId:u=>u.id,resolveDisabled:u=>u.dataRef.current.disabled});return{...l,...a,activeOptionIndex:c}},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 l;return!i.dataRef.current.disabled&&((l=i.dataRef.current.textValue)==null?void 0:l.startsWith(r))}),s=o?e.options.indexOf(o):-1;return s===-1||s===e.activeOptionIndex?{...e,searchQuery:r}:{...e,searchQuery:r,activeOptionIndex:s,activationTrigger:1}},4(e){return e.dataRef.current.disabled||e.listboxState===1||e.searchQuery===""?e:{...e,searchQuery:""}},5(e){return e.dataRef.current.mode===0?{...e,frozenValue:!0}:{...e}},6:(e,t)=>{let n=e.options.concat(t.options),r=e.activeOptionIndex;if(e.pendingFocus.focus!==Ne.Nothing&&(r=wi(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:Ne.Nothing},pendingShouldSort:!0}},7:(e,t)=>{let n=e.options,r=[],o=new Set(t.options);for(let[s,i]of n.entries())if(o.has(i.id)&&(r.push(s),o.delete(i.id),o.size===0))break;if(r.length>0){n=n.slice();for(let s of r.reverse())n.splice(s,1)}return{...e,options:n,activationTrigger:1}},8:(e,t)=>e.buttonElement===t.element?e:{...e,buttonElement:t.element},9:(e,t)=>e.optionsElement===t.element?e:{...e,optionsElement:t.element},10:e=>e.pendingShouldSort?{...e,...Mh(e),pendingShouldSort:!1}:e,11(e){return e.buttonPositionState.kind!=="Tracked"?e:{...e,buttonPositionState:xi.Moved}}};class Sc extends ap{constructor(t){super(t),$h(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 l=i.slice(),a=l.findIndex(c=>o(c,n));return a===-1?l.push(n):l.splice(a,1),r==null?void 0:r(l)}})},registerOption:_l(()=>{let n=[],r=new Set;return[(o,s)=>{r.has(s)||(r.add(s),n.push({id:o,dataRef:s}))},()=>(r.clear(),this.send({type:6,options:n.splice(0)}))]}),unregisterOption:_l(()=>{let n=[];return[r=>n.push(r),()=>{this.send({type:7,options:n.splice(0)})}]}),goToOption:_l(()=>{let n=null;return[(r,o)=>{n={type:2,...r,trigger:o}},()=>n&&this.send(n)]}),closeListbox:()=>{this.send({type:1})},openListbox:n=>{this.send({type:0,focus:n})},selectActiveOption:()=>{var n;if(this.state.activeOptionIndex!==null){let{dataRef:r}=this.state.options[this.state.activeOptionIndex];this.actions.selectOption(r.current.value)}else this.state.dataRef.current.mode===0&&(this.actions.closeListbox(),(n=this.state.buttonElement)==null||n.focus({preventScroll:!0}))},selectOption:n=>{this.send({type:5,value:n})},search:n=>{this.send({type:3,value:n})},clearSearch:()=>{this.send({type:4})},setButtonElement:n=>{this.send({type:8,element:n})},setOptionsElement:n=>{this.send({type:9,element:n})}}),$h(this,"selectors",{activeDescendantId(n){var r;let o=n.activeOptionIndex,s=n.options;return o===null||(r=s[o])==null?void 0:r.id},isActive(n,r){var o;let s=n.activeOptionIndex,i=n.options;return s!==null?((o=i[s])==null?void 0:o.id)===r:!1},hasFrozenValue(n){return n.frozenValue},shouldScrollIntoView(n,r){return n.__demoMode||n.listboxState!==0||n.activationTrigger===0?!1:this.isActive(n,r)},didButtonMove(n){return n.buttonPositionState.kind==="Moved"}}),this.on(6,()=>{requestAnimationFrame(()=>{this.send({type:10})})});{let n=this.state.id,r=Vl.get(null);this.disposables.add(r.on(fp.Push,o=>{!r.selectors.isTop(o,n)&&this.state.listboxState===0&&this.actions.closeListbox()})),this.on(0,()=>r.actions.push(n)),this.on(1,()=>r.actions.pop(n))}this.disposables.group(n=>{this.on(1,r=>{r.buttonElement&&(n.dispose(),n.add(U8(r.buttonElement,r.buttonPositionState,()=>{this.send({type:11})})))})}),this.on(5,(n,r)=>{var o;this.actions.onChange(r.value),this.state.dataRef.current.mode===0&&(this.actions.closeListbox(),(o=this.state.buttonElement)==null||o.focus({preventScroll:!0}))})}static new({id:t,__demoMode:n=!1}){return new Sc({id:t,dataRef:{current:{}},listboxState:n?0:1,options:[],searchQuery:"",activeOptionIndex:null,activationTrigger:1,buttonElement:null,optionsElement:null,pendingShouldSort:!1,pendingFocus:{focus:Ne.Nothing},frozenValue:!1,__demoMode:n,buttonPositionState:xi.Idle})}reduce(t,n){return St(n.type,t3,t,n)}}const Dh=g.createContext(null);function Pc(e){let t=g.useContext(Dh);if(t===null){let n=new Error(`<${e} /> is missing a parent <Listbox /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,Bh),n}return t}function Bh({id:e,__demoMode:t=!1}){let n=g.useMemo(()=>Sc.new({id:e,__demoMode:t}),[]);return vh(()=>n.dispose()),n}let Ai=g.createContext(null);Ai.displayName="ListboxDataContext";function is(e){let t=g.useContext(Ai);if(t===null){let n=new Error(`<${e} /> is missing a parent <Listbox /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,is),n}return t}let n3=g.Fragment;function r3(e,t){let n=g.useId(),r=Ll(),{value:o,defaultValue:s,form:i,name:l,onChange:a,by:c,invalid:u=!1,disabled:f=r||!1,horizontal:p=!1,multiple:d=!1,__demoMode:h=!1,...b}=e;const v=p?"horizontal":"vertical";let P=Pt(t),x=Ix(s),[E=d?[]:void 0,N]=Ox(o,a,x),D=Bh({id:n,__demoMode:h}),F=g.useRef({static:!1,hold:!1}),L=g.useRef(new Map),m=n2(c),w=g.useCallback(W=>St(S.mode,{[Wn.Multi]:()=>E.some(G=>m(G,W)),[Wn.Single]:()=>m(E,W)}),[E]),S=Fn({value:E,disabled:f,invalid:u,mode:d?Wn.Multi:Wn.Single,orientation:v,onChange:N,compare:m,isSelected:w,optionsPropsRef:F,listRef:L});Oe(()=>{D.state.dataRef.current=S},[S]);let $=rt(D,W=>W.listboxState),I=Vl.get(null),A=rt(I,g.useCallback(W=>I.selectors.isTop(W,n),[I,n])),[k,y]=rt(D,W=>[W.buttonElement,W.optionsElement]);O2(A,[k,y],(W,G)=>{D.send({type:kh.CloseListbox}),yp(G,Xl.Loose)||(W.preventDefault(),k==null||k.focus())});let O=Fn({open:$===_e.Open,disabled:f,invalid:u,value:E}),[M,T]=Yx({inherit:!0}),B={ref:P},R=g.useCallback(()=>{if(x!==void 0)return N==null?void 0:N(x)},[N,x]),z=ht();return g.createElement(T,{value:M,props:{htmlFor:k==null?void 0:k.id},slot:{open:$===_e.Open,disabled:f}},g.createElement(T8,null,g.createElement(Dh.Provider,{value:D},g.createElement(Ai.Provider,{value:S},g.createElement(yh,{value:St($,{[_e.Open]:Ut.Open,[_e.Closed]:Ut.Closed})},l!=null&&E!=null&&g.createElement(Fx,{disabled:f,data:{[l]:E},form:i,onReset:R}),z({ourProps:B,theirProps:b,slot:O,defaultTag:n3,name:"Listbox"}))))))}let o3="button";function s3(e,t){let n=g.useId(),r=G0(),o=is("Listbox.Button"),s=Pc("Listbox.Button"),{id:i=r||`headlessui-listbox-button-${n}`,disabled:l=o.disabled||!1,autoFocus:a=!1,...c}=e,u=Pt(t,x8(),s.actions.setButtonElement),f=E8(),[p,d,h]=rt(s,y=>[y.listboxState,y.buttonElement,y.optionsElement]),b=p===_e.Open;k2(b,{trigger:d,action:g.useCallback(y=>{if(d!=null&&d.contains(y.target))return ai.Ignore;let O=y.target.closest('[role="option"]:not([data-disabled])');return vn(O)?ai.Select(O):h!=null&&h.contains(y.target)?ai.Ignore:ai.Close},[d,h]),close:s.actions.closeListbox,select:s.actions.selectActiveOption});let v=pe(y=>{switch(y.key){case Le.Enter:$x(y.currentTarget);break;case Le.Space:case Le.ArrowDown:y.preventDefault(),s.actions.openListbox({focus:o.value?Ne.Nothing:Ne.First});break;case Le.ArrowUp:y.preventDefault(),s.actions.openListbox({focus:o.value?Ne.Nothing:Ne.Last});break}}),P=pe(y=>{switch(y.key){case Le.Space:y.preventDefault();break}}),x=o2(y=>{var O;s.state.listboxState===_e.Open?(Ke.flushSync(()=>s.actions.closeListbox()),(O=s.state.buttonElement)==null||O.focus({preventScroll:!0})):(y.preventDefault(),s.actions.openListbox({focus:Ne.Nothing}))}),E=pe(y=>y.preventDefault()),N=tp([i]),D=Gx(),{isFocusVisible:F,focusProps:L}=mx({autoFocus:a}),{isHovered:m,hoverProps:w}=hx({isDisabled:l}),{pressed:S,pressProps:$}=Ex({disabled:l}),I=Fn({open:p===_e.Open,active:S||p===_e.Open,disabled:l,invalid:o.invalid,value:o.value,hover:m,focus:F,autofocus:a}),A=rt(s,y=>y.listboxState===_e.Open),k=U0(f(),{ref:u,id:i,type:M2(e,d),"aria-haspopup":"listbox","aria-controls":h==null?void 0:h.id,"aria-expanded":A,"aria-labelledby":N,"aria-describedby":D,disabled:l||void 0,autoFocus:a,onKeyDown:v,onKeyUp:P,onKeyPress:E},x,L,w,$);return ht()({ourProps:k,theirProps:c,slot:I,defaultTag:o3,name:"Listbox.Button"})}let Lh=g.createContext(!1),i3="div",a3=ri.RenderStrategy|ri.Static;function l3(e,t){let n=g.useId(),{id:r=`headlessui-listbox-options-${n}`,anchor:o,portal:s=!1,modal:i=!0,transition:l=!1,...a}=e,c=w8(o),[u,f]=g.useState(null);c&&(s=!0);let p=is("Listbox.Options"),d=Pc("Listbox.Options"),[h,b,v,P]=rt(d,_=>[_.listboxState,_.buttonElement,_.optionsElement,_.__demoMode]),x=Jl(b),E=Jl(v),N=wc(),[D,F]=Op(l,u,N!==null?(N&Ut.Open)===Ut.Open:h===_e.Open);g2(D,b,d.actions.closeListbox);let L=P?!1:i&&h===_e.Open;z2(L,E);let m=P?!1:i&&h===_e.Open;b2(m,{allowed:g.useCallback(()=>[b,v],[b,v])});let w=rt(d,d.selectors.didButtonMove)?!1:D,S=rt(d,d.selectors.hasFrozenValue)&&!e.static,$=gh(S,p.value),I=g.useCallback(_=>p.compare($,_),[p.compare,$]),A=rt(d,_=>{var ne;if(c==null||!((ne=c==null?void 0:c.to)!=null&&ne.includes("selection")))return null;let be=_.options.findIndex(fe=>I(fe.dataRef.current.value));return be===-1&&(be=0),be}),k=(()=>{if(c==null)return;if(A===null)return{...c,inner:void 0};let _=Array.from(p.listRef.current.values());return{...c,inner:{listRef:{current:_},index:A}}})(),[y,O]=P8(k),M=S8(),T=Pt(t,c?y:null,d.actions.setOptionsElement,f),B=ar();g.useEffect(()=>{let _=v;_&&h===_e.Open&&(vx(_)||_==null||_.focus({preventScroll:!0}))},[h,v]);let R=pe(_=>{var ne;switch(B.dispose(),_.key){case Le.Space:if(d.state.searchQuery!=="")return _.preventDefault(),_.stopPropagation(),d.actions.search(_.key);case Le.Enter:_.preventDefault(),_.stopPropagation(),d.actions.selectActiveOption();break;case St(p.orientation,{vertical:Le.ArrowDown,horizontal:Le.ArrowRight}):return _.preventDefault(),_.stopPropagation(),d.actions.goToOption({focus:Ne.Next});case St(p.orientation,{vertical:Le.ArrowUp,horizontal:Le.ArrowLeft}):return _.preventDefault(),_.stopPropagation(),d.actions.goToOption({focus:Ne.Previous});case Le.Home:case Le.PageUp:return _.preventDefault(),_.stopPropagation(),d.actions.goToOption({focus:Ne.First});case Le.End:case Le.PageDown:return _.preventDefault(),_.stopPropagation(),d.actions.goToOption({focus:Ne.Last});case Le.Escape:_.preventDefault(),_.stopPropagation(),Ke.flushSync(()=>d.actions.closeListbox()),(ne=d.state.buttonElement)==null||ne.focus({preventScroll:!0});return;case Le.Tab:_.preventDefault(),_.stopPropagation(),Ke.flushSync(()=>d.actions.closeListbox()),T2(d.state.buttonElement,_.shiftKey?Yl.Previous:Yl.Next);break;default:_.key.length===1&&(d.actions.search(_.key),B.setTimeout(()=>d.actions.clearSearch(),350));break}}),z=rt(d,_=>{var ne;return(ne=_.buttonElement)==null?void 0:ne.id}),W=Fn({open:h===_e.Open}),G=U0(c?M():{},{id:r,ref:T,"aria-activedescendant":rt(d,d.selectors.activeDescendantId),"aria-multiselectable":p.mode===Wn.Multi?!0:void 0,"aria-labelledby":z,"aria-orientation":p.orientation,onKeyDown:R,role:"listbox",tabIndex:h===_e.Open?0:void 0,style:{...a.style,...O,"--button-width":r2(D,b,!0).width},...Cp(F)}),J=ht(),K=g.useMemo(()=>p.mode===Wn.Multi?p:{...p,isSelected:I},[p,I]);return g.createElement(z8,{enabled:s?e.static||D:!1,ownerDocument:x},g.createElement(Ai.Provider,{value:K},J({ourProps:G,theirProps:a,slot:W,defaultTag:i3,features:a3,visible:w,name:"Listbox.Options"})))}let c3="div";function u3(e,t){let n=g.useId(),{id:r=`headlessui-listbox-option-${n}`,disabled:o=!1,value:s,...i}=e,l=g.useContext(Lh)===!0,a=is("Listbox.Option"),c=Pc("Listbox.Option"),u=rt(c,S=>c.selectors.isActive(S,r)),f=a.isSelected(s),p=g.useRef(null),d=J8(p),h=lr({disabled:o,value:s,domRef:p,get textValue(){return d()}}),b=Pt(t,p,S=>{S?a.listRef.current.set(r,S):a.listRef.current.delete(r)}),v=rt(c,S=>c.selectors.shouldScrollIntoView(S,r));Oe(()=>{if(v)return pt().requestAnimationFrame(()=>{var S,$;($=(S=p.current)==null?void 0:S.scrollIntoView)==null||$.call(S,{block:"nearest"})})},[v,p]),Oe(()=>{if(!l)return c.actions.registerOption(r,h),()=>c.actions.unregisterOption(r)},[h,r,l]);let P=pe(S=>{if(o)return S.preventDefault();c.actions.selectOption(s)}),x=pe(()=>{if(o)return c.actions.goToOption({focus:Ne.Nothing});c.actions.goToOption({focus:Ne.Specific,id:r})}),E=U2(),N=pe(S=>E.update(S)),D=pe(S=>{E.wasMoved(S)&&(o||u&&c.state.activationTrigger===Ti.Pointer||c.actions.goToOption({focus:Ne.Specific,id:r},Ti.Pointer))}),F=pe(S=>{E.wasMoved(S)&&(o||u&&c.state.activationTrigger===Ti.Pointer&&c.actions.goToOption({focus:Ne.Nothing}))}),L=Fn({active:u,focus:u,selected:f,disabled:o,selectedOption:f&&l}),m=l?{}:{id:r,ref:b,role:"option",tabIndex:o===!0?void 0:-1,"aria-disabled":o===!0?!0:void 0,"aria-selected":f,disabled:void 0,onClick:P,onFocus:x,onPointerEnter:N,onMouseEnter:N,onPointerMove:D,onMouseMove:D,onPointerLeave:F,onMouseLeave:F},w=ht();return!f&&l?null:w({ourProps:m,theirProps:i,slot:L,defaultTag:c3,name:"Listbox.Option"})}let f3=g.Fragment;function d3(e,t){let{options:n,placeholder:r,...o}=e,s={ref:Pt(t)},i=is("ListboxSelectedOption"),l=Fn({}),a=i.value===void 0||i.value===null||i.mode===Wn.Multi&&Array.isArray(i.value)&&i.value.length===0,c=ht();return g.createElement(Lh.Provider,{value:!0},c({ourProps:s,theirProps:{...o,children:g.createElement(g.Fragment,null,r&&a?r:n)},slot:l,defaultTag:f3,name:"ListboxSelectedOption"}))}let p3=nt(r3),h3=nt(s3),m3=e2,b3=nt(l3),g3=nt(u3),y3=nt(d3),Nt=Object.assign(p3,{Button:h3,Label:m3,Options:b3,Option:g3,SelectedOption:y3});const v3=()=>C.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",children:[C.jsx("g",{clipPath:"url(#clip0_active)",children:C.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"})}),C.jsx("defs",{children:C.jsx("clipPath",{id:"clip0_active",children:C.jsx("rect",{width:"12",height:"12",fill:"white",transform:"translate(0 0.0454102)"})})})]}),w3=()=>C.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",children:[C.jsx("g",{clipPath:"url(#clip0_inactive)",children:C.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"})}),C.jsx("defs",{children:C.jsx("clipPath",{id:"clip0_inactive",children:C.jsx("rect",{width:"12",height:"12",fill:"white",transform:"translate(0 0.0454102)"})})})]}),as=({selectedLevel:e,maxLevel:t,className:n=""})=>{const r=Array.from({length:t},(o,s)=>s+1);return C.jsx("div",{className:`flex items-center ${n}`,children:r.map(o=>C.jsx("div",{className:"flex items-center justify-center",children:o>t-e?C.jsx(v3,{}):C.jsx(w3,{})},o))})};class Wt{}ds(Wt,"FAST",3),ds(Wt,"Medium",2),ds(Wt,"SLOW",1),ds(Wt,"NONE",0);const x3=Object.values({MAINNET:1,SEPOLIA:11155111}),_n=e=>{const t=typeof e=="string"?parseInt(e,10):e;return x3.includes(t)},E3={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:!E3[t.toUpperCase()]:!0},S3=({chains:e,selectedChain:t,onChainChange:n,disabled:r=!1,className:o="",walletType:s="mpc"})=>{const{t:i}=$t();return C.jsx("div",{className:`relative ${o}`,children:C.jsx(Nt,{value:t,onChange:n,disabled:r,children:({open:l})=>C.jsxs(C.Fragment,{children:[C.jsxs(Nt.Button,{className:`
140
140
  relative w-full h-9 text-text-primary bg-fill-input-primary
141
141
  items-center justify-between flex px-3 rounded-lg
142
142
  focus:outline-hidden
143
143
  ${r?"opacity-50 cursor-not-allowed":"cursor-pointer hover:bg-fill-btn-secondary-hover"}
144
144
  ${l?"ring-1 ring-white":""}
145
- `,children:[N.jsx("span",{className:"text-sm leading-[18px] font-medium",children:i("deposit.chain")}),N.jsxs("div",{className:"flex items-center space-x-2",children:[t.chainIconUrl?N.jsx("img",{src:t.chainIconUrl,alt:t.chain,className:"w-4 h-4 rounded-full"}):N.jsx("div",{className:"w-4 h-4 rounded-full bg-blue-500 flex items-center justify-center",children:N.jsx("span",{className:"text-xs text-white font-bold",children:t.chain.charAt(0)})}),N.jsx("span",{className:"text-sm text-white ml-1",children:t.chain}),N.jsxs("svg",{className:`w-3 h-3 ml-2 transition-transform duration-200 ${l?"rotate-180":""}`,xmlns:"http://www.w3.org/2000/svg",width:"10",height:"11",viewBox:"0 0 10 11",fill:"none",children:[N.jsx("g",{clipPath:"url(#clip0_12919_27745)",children:N.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"})}),N.jsx("defs",{children:N.jsx("clipPath",{id:"clip0_12919_27745",children:N.jsx("rect",{width:"10",height:"10",fill:"white",transform:"translate(0 0.955078)"})})})]})]})]}),N.jsx(Ec,{as:g.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:N.jsx(Nt.Options,{className:`
145
+ `,children:[C.jsx("span",{className:"text-sm leading-[18px] font-medium",children:i("deposit.chain")}),C.jsxs("div",{className:"flex items-center space-x-2",children:[t.chainIconUrl?C.jsx("img",{src:t.chainIconUrl,alt:t.chain,className:"w-4 h-4 rounded-full"}):C.jsx("div",{className:"w-4 h-4 rounded-full bg-blue-500 flex items-center justify-center",children:C.jsx("span",{className:"text-xs text-white font-bold",children:t.chain.charAt(0)})}),C.jsx("span",{className:"text-sm text-white ml-1",children:t.chain}),C.jsxs("svg",{className:`w-3 h-3 ml-2 transition-transform duration-200 ${l?"rotate-180":""}`,xmlns:"http://www.w3.org/2000/svg",width:"10",height:"11",viewBox:"0 0 10 11",fill:"none",children:[C.jsx("g",{clipPath:"url(#clip0_12919_27745)",children:C.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"})}),C.jsx("defs",{children:C.jsx("clipPath",{id:"clip0_12919_27745",children:C.jsx("rect",{width:"10",height:"10",fill:"white",transform:"translate(0 0.955078)"})})})]})]})]}),C.jsx(Ec,{as:g.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:C.jsx(Nt.Options,{className:`
146
146
  absolute z-50 mt-1 w-full max-h-60 overflow-auto rounded-lg
147
147
  bg-fill-input-primary border border-line-divider-secondary shadow-lg
148
148
  focus:outline-hidden
149
- `,children:e.filter(a=>a[s==="mpc"?"allowAaDeposit":"allowDeposit"]!==!1).map(a=>N.jsx(Nt.Option,{value:a,className:({active:c,selected:u})=>`relative cursor-pointer select-none py-3 px-3 ${u?"bg-fill-btn-secondary":c?"bg-fill-input-secondary":""}`,children:({selected:c,active:u})=>N.jsx(N.Fragment,{children:N.jsxs("div",{className:"flex items-center justify-between",children:[N.jsxs("div",{className:"flex items-center space-x-3",children:[a.chainIconUrl?N.jsx("img",{src:a.chainIconUrl,alt:a.chain,className:"w-5 h-5 rounded-full"}):N.jsx("div",{className:"w-5 h-5 rounded-full bg-blue-500 flex items-center justify-center",children:N.jsx("span",{className:"text-xs text-white font-bold",children:a.chain.charAt(0)})}),N.jsx("div",{className:"flex flex-col",children:N.jsx("span",{className:`text-sm font-medium ${c||u?"text-text-primary":"text-text-tertiary"}`,children:a.chain})})]}),N.jsx("div",{className:"w-12 bg-fill-page-secondary p-1 h-5 flex rounded",children:N.jsx(is,{className:"w-full justify-between",selectedLevel:Pn(a.chainId)?_t.SLOW:_t.FAST,maxLevel:3})})]})})},a.chainId))})})]})})})},P3=({tokens:e,selectedToken:t,onTokenChange:n,disabled:r=!1,className:o="",walletType:s,accountType:i})=>{const{t:l}=$t(),a=c=>c.token||c.symbol;return N.jsx("div",{className:`relative ${o}`,children:N.jsx(Nt,{value:t,onChange:n,disabled:r,children:({open:c})=>N.jsxs(N.Fragment,{children:[N.jsxs(Nt.Button,{className:`
149
+ `,children:e.filter(a=>a[s==="mpc"?"allowAaDeposit":"allowDeposit"]!==!1).map(a=>C.jsx(Nt.Option,{value:a,className:({active:c,selected:u})=>`relative cursor-pointer select-none py-3 px-3 ${u?"bg-fill-btn-secondary":c?"bg-fill-input-secondary":""}`,children:({selected:c,active:u})=>C.jsx(C.Fragment,{children:C.jsxs("div",{className:"flex items-center justify-between",children:[C.jsxs("div",{className:"flex items-center space-x-3",children:[a.chainIconUrl?C.jsx("img",{src:a.chainIconUrl,alt:a.chain,className:"w-5 h-5 rounded-full"}):C.jsx("div",{className:"w-5 h-5 rounded-full bg-blue-500 flex items-center justify-center",children:C.jsx("span",{className:"text-xs text-white font-bold",children:a.chain.charAt(0)})}),C.jsx("div",{className:"flex flex-col",children:C.jsx("span",{className:`text-sm font-medium ${c||u?"text-text-primary":"text-text-tertiary"}`,children:a.chain})})]}),C.jsx("div",{className:"w-12 bg-fill-page-secondary p-1 h-5 flex rounded",children:C.jsx(as,{className:"w-full justify-between",selectedLevel:_n(a.chainId)?Wt.SLOW:Wt.FAST,maxLevel:3})})]})})},a.chainId))})})]})})})},P3=({tokens:e,selectedToken:t,onTokenChange:n,disabled:r=!1,className:o="",walletType:s,accountType:i})=>{const{t:l}=$t(),a=c=>c.token||c.symbol;return C.jsx("div",{className:`relative ${o}`,children:C.jsx(Nt,{value:t,onChange:n,disabled:r,children:({open:c})=>C.jsxs(C.Fragment,{children:[C.jsxs(Nt.Button,{className:`
150
150
  relative w-full h-9 text-text-primary bg-fill-input-primary
151
151
  items-center justify-between flex px-3 rounded-lg
152
152
  focus:outline-hidden
153
153
  ${r?"opacity-50 cursor-not-allowed":"cursor-pointer hover:bg-fill-btn-secondary-hover"}
154
154
  ${c?"ring-1 ring-white":""}
155
- `,children:[N.jsx("span",{className:"text-sm leading-[18px] font-medium",children:l("deposit.asset")}),N.jsxs("div",{className:"flex items-center space-x-2",children:[N.jsx("img",{src:t.iconUrl,alt:a(t),className:"w-4 h-4 rounded-full"}),N.jsx("span",{className:"text-sm text-white ml-1",children:a(t)}),N.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:[N.jsx("g",{clipPath:"url(#clip0_asset_selector)",children:N.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"})}),N.jsx("defs",{children:N.jsx("clipPath",{id:"clip0_asset_selector",children:N.jsx("rect",{width:"10",height:"10",fill:"white",transform:"translate(0 0.955078)"})})})]})]})]}),N.jsx(Ec,{as:g.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:N.jsx(Nt.Options,{className:`
155
+ `,children:[C.jsx("span",{className:"text-sm leading-[18px] font-medium",children:l("deposit.asset")}),C.jsxs("div",{className:"flex items-center space-x-2",children:[C.jsx("img",{src:t.iconUrl,alt:a(t),className:"w-4 h-4 rounded-full"}),C.jsx("span",{className:"text-sm text-white ml-1",children:a(t)}),C.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:[C.jsx("g",{clipPath:"url(#clip0_asset_selector)",children:C.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"})}),C.jsx("defs",{children:C.jsx("clipPath",{id:"clip0_asset_selector",children:C.jsx("rect",{width:"10",height:"10",fill:"white",transform:"translate(0 0.955078)"})})})]})]})]}),C.jsx(Ec,{as:g.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:C.jsx(Nt.Options,{className:`
156
156
  absolute z-50 mt-1 w-full max-h-[230px] overflow-y-auto rounded-lg
157
157
  bg-fill-input-primary border border-line-divider-secondary shadow-lg
158
158
  focus:outline-hidden
159
- `,children:e.map(u=>N.jsx(Nt.Option,{value:u,className:({active:f,selected:p})=>`relative cursor-pointer select-none py-3 px-3 ${p?"bg-fill-btn-secondary":f?"bg-fill-input-secondary":""}`,children:({selected:f,active:p})=>N.jsxs("div",{className:"flex items-center space-x-3",children:[N.jsx("img",{src:u.iconUrl,alt:a(u),className:"w-5 h-5 rounded-full"}),N.jsxs("div",{className:"flex flex-col",children:[N.jsx("span",{className:`text-sm font-medium ${f||p?"text-text-primary":"text-text-tertiary"}`,children:a(u)}),s===gn&&i==="perpetual"&&u.token==="USDC"&&N.jsx("p",{className:"mt-2 text-xs text-text-tertiary whitespace-pre-line",children:l("deposit.defaultSpotNotice")})]})]})},a(u)))})})]})})})},Rh=({currentActiveChain:e,chainList:t,onChainChange:n,curSelectToken:r,onTokenChange:o,walletType:s=gn,txType:i="deposit",accountType:l})=>{const a=g.useCallback(w=>i==="withdraw"?s===gn?w.allowAaWithdraw!==!1:w.allowWithdraw!==!1:s===gn?w.allowAaDeposit!==!1:w.allowDeposit!==!1,[i,s]),c=g.useMemo(()=>{const w=new Set,P=[];for(const x of t)if(a(x))for(const E of x.tokenList||[]){const A=E.symbol||E.token;!A||!(i!=="withdraw"||E.withdrawEnable===!0&&E.pullOff!==!0)||w.has(A)||(w.add(A),P.push({token:A,symbol:A,iconUrl:E.iconUrl,decimals:E.decimals,tokenAddress:E.tokenAddress}))}return P},[t,a,i]),u=w=>{n(w.chainId)},f=w=>{const P=w.symbol||w.token;o(P);const x=[];for(const E of t){if(!a(E))continue;(E.tokenList||[]).some(D=>(D.symbol||D.token)===P)&&x.push(E.chainId)}!x.includes(e.chainId)&&x[0]!==void 0&&n(x[0])},p=g.useMemo(()=>{var x,E;const w=r||((x=c[0])==null?void 0:x.symbol)||((E=c[0])==null?void 0:E.token);if(!w)return[];const P=[];for(const A of t){if(!a(A))continue;const D=(A.tokenList||[]).find(L=>(L.symbol||L.token)===w?i==="withdraw"?L.withdrawEnable===!0&&L.pullOff!==!0:!0:!1);D&&P.push({...A,tokenList:[{token:D.token,symbol:D.symbol,iconUrl:D.iconUrl,decimals:D.decimals,tokenAddress:D.tokenAddress}]})}return P},[t,r,c,a,i]),d=g.useMemo(()=>p.find(w=>w.chainId===e.chainId)||p[0],[p,e.chainId]),h=g.useMemo(()=>c,[c]),b=g.useMemo(()=>{if(h.length!==0)return h.find(w=>w.token===r||w.symbol===r)||h[0]},[h,r]);return g.useEffect(()=>{if(h.length===0)return;if(!h.some(P=>(P.symbol||P.token)===r)){const P=h[0];o(P.symbol||P.token)}},[h,r,o]),g.useEffect(()=>{if(p.length===0)return;p.some(P=>P.chainId===e.chainId)||n(p[0].chainId)},[p,e.chainId,n]),N.jsxs("div",{className:"space-y-4",children:[h.length>0&&b&&N.jsx(P3,{tokens:h,selectedToken:b,onTokenChange:f,walletType:s,accountType:l}),N.jsx(S3,{chains:p,selectedChain:d,onChainChange:w=>{const P=t.find(x=>x.chainId===w.chainId);P&&u(P)},walletType:s,className:"w-full"})]})},T3=({options:e})=>N.jsx(N.Fragment,{children:e.map(t=>N.jsx(Nt.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})=>N.jsx("div",{className:"flex items-center justify-between",children:N.jsx("div",{className:"flex items-center space-x-3",children:N.jsx("div",{className:"flex flex-col",children:N.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,options:n,disabled:r=!1,className:o=""})=>{var d;const{t:s}=$t(),i=g.useMemo(()=>[{value:"spot",label:s("account.spot")},{value:"perpetual",label:s("account.perp")}],[s]),l=n&&n.length>0?n:i,a=((d=l.find(h=>h.value===(e??"spot")))==null?void 0:d.label)||"",[c,u]=g.useState(e??"spot"),f=e??c,p=h=>{t==null||t(h),e||u(h)};return N.jsx("div",{className:`relative mb-4 ${o}`,children:N.jsx(Nt,{value:f,onChange:p,disabled:r,children:({open:h})=>N.jsxs(N.Fragment,{children:[N.jsxs(Nt.Button,{className:`
159
+ `,children:e.map(u=>C.jsx(Nt.Option,{value:u,className:({active:f,selected:p})=>`relative cursor-pointer select-none py-3 px-3 ${p?"bg-fill-btn-secondary":f?"bg-fill-input-secondary":""}`,children:({selected:f,active:p})=>C.jsxs("div",{className:"flex items-center space-x-3",children:[C.jsx("img",{src:u.iconUrl,alt:a(u),className:"w-5 h-5 rounded-full"}),C.jsxs("div",{className:"flex flex-col",children:[C.jsx("span",{className:`text-sm font-medium ${f||p?"text-text-primary":"text-text-tertiary"}`,children:a(u)}),s===gn&&i==="perpetual"&&u.token==="USDC"&&C.jsx("p",{className:"mt-2 text-xs text-text-tertiary whitespace-pre-line",children:l("deposit.defaultSpotNotice")})]})]})},a(u)))})})]})})})},Rh=({currentActiveChain:e,chainList:t,onChainChange:n,curSelectToken:r,onTokenChange:o,walletType:s=gn,txType:i="deposit",accountType:l})=>{const a=g.useCallback(v=>i==="withdraw"?s===gn?v.allowAaWithdraw!==!1:v.allowWithdraw!==!1:s===gn?v.allowAaDeposit!==!1:v.allowDeposit!==!1,[i,s]),c=g.useMemo(()=>{const v=new Set,P=[];for(const x of t)if(a(x))for(const E of x.tokenList||[]){const N=E.symbol||E.token;!N||!(i!=="withdraw"||E.withdrawEnable===!0&&E.pullOff!==!0)||v.has(N)||(v.add(N),P.push({token:N,symbol:N,iconUrl:E.iconUrl,decimals:E.decimals,tokenAddress:E.tokenAddress}))}return P},[t,a,i]),u=v=>{n(v.chainId)},f=v=>{const P=v.symbol||v.token;o(P);const x=[];for(const E of t){if(!a(E))continue;(E.tokenList||[]).some(D=>(D.symbol||D.token)===P)&&x.push(E.chainId)}!x.includes(e.chainId)&&x[0]!==void 0&&n(x[0])},p=g.useMemo(()=>{var x,E;const v=r||((x=c[0])==null?void 0:x.symbol)||((E=c[0])==null?void 0:E.token);if(!v)return[];const P=[];for(const N of t){if(!a(N))continue;const D=(N.tokenList||[]).find(F=>(F.symbol||F.token)===v?i==="withdraw"?F.withdrawEnable===!0&&F.pullOff!==!0:!0:!1);D&&P.push({...N,tokenList:[{token:D.token,symbol:D.symbol,iconUrl:D.iconUrl,decimals:D.decimals,tokenAddress:D.tokenAddress}]})}return P},[t,r,c,a,i]),d=g.useMemo(()=>p.find(v=>v.chainId===e.chainId)||p[0],[p,e.chainId]),h=g.useMemo(()=>c,[c]),b=g.useMemo(()=>{if(h.length!==0)return h.find(v=>v.token===r||v.symbol===r)||h[0]},[h,r]);return g.useEffect(()=>{if(h.length===0)return;if(!h.some(P=>(P.symbol||P.token)===r)){const P=h[0];o(P.symbol||P.token)}},[h,r,o]),g.useEffect(()=>{if(p.length===0)return;p.some(P=>P.chainId===e.chainId)||n(p[0].chainId)},[p,e.chainId,n]),C.jsxs("div",{className:"space-y-4",children:[h.length>0&&b&&C.jsx(P3,{tokens:h,selectedToken:b,onTokenChange:f,walletType:s,accountType:l}),C.jsx(S3,{chains:p,selectedChain:d,onChainChange:v=>{const P=t.find(x=>x.chainId===v.chainId);P&&u(P)},walletType:s,className:"w-full"})]})},T3=({options:e})=>C.jsx(C.Fragment,{children:e.map(t=>C.jsx(Nt.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})=>C.jsx("div",{className:"flex items-center justify-between",children:C.jsx("div",{className:"flex items-center space-x-3",children:C.jsx("div",{className:"flex flex-col",children:C.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,options:n,disabled:r=!1,className:o=""})=>{var d;const{t:s}=$t(),i=g.useMemo(()=>[{value:"spot",label:s("account.spot")},{value:"perpetual",label:s("account.perp")}],[s]),l=n&&n.length>0?n:i,a=((d=l.find(h=>h.value===(e??"spot")))==null?void 0:d.label)||"",[c,u]=g.useState(e??"spot"),f=e??c,p=h=>{t==null||t(h),e||u(h)};return C.jsx("div",{className:`relative mb-4 ${o}`,children:C.jsx(Nt,{value:f,onChange:p,disabled:r,children:({open:h})=>C.jsxs(C.Fragment,{children:[C.jsxs(Nt.Button,{className:`
160
160
  relative w-full h-9 text-text-primary bg-fill-input-primary
161
161
  items-center justify-between flex px-3 rounded-lg
162
162
  focus:outline-hidden
163
163
  ${r?"opacity-50 cursor-not-allowed":"cursor-pointer hover:bg-fill-btn-secondary-hover"}
164
164
  ${h?"ring-1 ring-white":""}
165
- `,children:[N.jsx("span",{className:"text-sm leading-[18px] font-medium",children:s("account.title")}),N.jsxs("div",{className:"flex items-center space-x-2",children:[N.jsx("span",{className:"text-sm text-white ml-1",children:a}),N.jsxs("svg",{className:`w-3 h-3 ml-2 transition-transform duration-200 ${h?"rotate-180":""}`,xmlns:"http://www.w3.org/2000/svg",width:"10",height:"11",viewBox:"0 0 10 11",fill:"none",children:[N.jsx("g",{clipPath:"url(#clip0_asset_selector)",children:N.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"})}),N.jsx("defs",{children:N.jsx("clipPath",{id:"clip0_asset_selector",children:N.jsx("rect",{width:"10",height:"10",fill:"white",transform:"translate(0 0.955078)"})})})]})]})]}),N.jsx(Ec,{as:g.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:N.jsx(Nt.Options,{className:`
165
+ `,children:[C.jsx("span",{className:"text-sm leading-[18px] font-medium",children:s("account.title")}),C.jsxs("div",{className:"flex items-center space-x-2",children:[C.jsx("span",{className:"text-sm text-white ml-1",children:a}),C.jsxs("svg",{className:`w-3 h-3 ml-2 transition-transform duration-200 ${h?"rotate-180":""}`,xmlns:"http://www.w3.org/2000/svg",width:"10",height:"11",viewBox:"0 0 10 11",fill:"none",children:[C.jsx("g",{clipPath:"url(#clip0_asset_selector)",children:C.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"})}),C.jsx("defs",{children:C.jsx("clipPath",{id:"clip0_asset_selector",children:C.jsx("rect",{width:"10",height:"10",fill:"white",transform:"translate(0 0.955078)"})})})]})]})]}),C.jsx(Ec,{as:g.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:C.jsx(Nt.Options,{className:`
166
166
  absolute z-50 mt-1 w-full max-h-60 overflow-auto rounded-lg
167
167
  bg-fill-input-primary border border-line-divider-secondary shadow-lg
168
168
  focus:outline-hidden
169
- `,children:N.jsx(T3,{options:l})})})]})})})};var Ni={},A3=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()}},N3=A3,zh={"text/plain":"Text","text/html":"Url",default:"Text"},C3="Copy to clipboard: #{key}, Enter";function O3(e){var t=(/mac os x/i.test(navigator.userAgent)?"⌘":"Ctrl")+"+C";return e.replace(/#{\s*key\s*}/g,t)}function I3(e,t){var n,r,o,s,i,l,a=!1;t||(t={}),n=t.debug||!1;try{o=N3(),s=document.createRange(),i=document.getSelection(),l=document.createElement("span"),l.textContent=e,l.ariaHidden="true",l.style.all="unset",l.style.position="fixed",l.style.top=0,l.style.clip="rect(0, 0, 0, 0)",l.style.whiteSpace="pre",l.style.webkitUserSelect="text",l.style.MozUserSelect="text",l.style.msUserSelect="text",l.style.userSelect="text",l.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=zh[t.format]||zh.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(l),s.selectNodeContents(l),i.addRange(s);var c=document.execCommand("copy");if(!c)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=O3("message"in t?t.message:C3),window.prompt(r,e)}}finally{i&&(typeof i.removeRange=="function"?i.removeRange(s):i.removeAllRanges()),l&&document.body.removeChild(l),o()}return a}var $3=I3;Object.defineProperty(Ni,"__esModule",{value:!0}),Ni.CopyToClipboard=void 0;var k3=Uh($3),Ci=Uh(g),M3=["text","onCopy","options","children"];function Uh(e){return e&&e.__esModule?e:{default:e}}function Gr(e){"@babel/helpers - typeof";return Gr=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},Gr(e)}function _h(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 Wh(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?_h(Object(n),!0).forEach(function(r){Ac(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):_h(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function D3(e,t){if(e==null)return{};var n,r,o=B3(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(r=0;r<s.length;r++)n=s[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}function B3(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}function L3(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function F3(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,Hh(r.key),r)}}function R3(e,t,n){return t&&F3(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function j3(e,t,n){return t=Oi(t),z3(e,Vh()?Reflect.construct(t,n||[],Oi(e).constructor):t.apply(e,n))}function z3(e,t){if(t&&(Gr(t)=="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return U3(e)}function U3(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Vh(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(Vh=function(){return!!e})()}function Oi(e){return Oi=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Oi(e)}function _3(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&&Tc(e,t)}function Tc(e,t){return Tc=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,r){return n.__proto__=r,n},Tc(e,t)}function Ac(e,t,n){return(t=Hh(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Hh(e){var t=W3(e,"string");return Gr(t)=="symbol"?t:t+""}function W3(e,t){if(Gr(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(Gr(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var V3=Ni.CopyToClipboard=function(e){function t(){var n;L3(this,t);for(var r=arguments.length,o=new Array(r),s=0;s<r;s++)o[s]=arguments[s];return n=j3(this,t,[].concat(o)),Ac(n,"onClick",function(i){var l=n.props,a=l.text,c=l.onCopy,u=l.children,f=l.options,p=Ci.default.Children.only(u),d=(0,k3.default)(a,f);c&&c(a,d),p!=null&&p.props&&typeof p.props.onClick=="function"&&p.props.onClick(i)}),n}return _3(t,e),R3(t,[{key:"render",value:function(){var r=this.props;r.text,r.onCopy,r.options;var o=r.children,s=D3(r,M3),i=Ci.default.Children.only(o);return Ci.default.cloneElement(i,Wh(Wh({},s),{},{onClick:this.onClick}))}}])}(Ci.default.PureComponent);Ac(V3,"defaultProps",{onCopy:void 0,options:void 0});var H3=Ni,Nc=H3.CopyToClipboard;Nc.CopyToClipboard=Nc;var G3=Nc;const q3=Ym(G3);var K3=Object.defineProperty,Ii=Object.getOwnPropertySymbols,Gh=Object.prototype.hasOwnProperty,qh=Object.prototype.propertyIsEnumerable,Kh=(e,t,n)=>t in e?K3(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Cc=(e,t)=>{for(var n in t||(t={}))Gh.call(t,n)&&Kh(e,n,t[n]);if(Ii)for(var n of Ii(t))qh.call(t,n)&&Kh(e,n,t[n]);return e},Oc=(e,t)=>{var n={};for(var r in e)Gh.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&Ii)for(var r of Ii(e))t.indexOf(r)<0&&qh.call(e,r)&&(n[r]=e[r]);return n};/**
169
+ `,children:C.jsx(T3,{options:l})})})]})})})};var Ni={},A3=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()}},N3=A3,zh={"text/plain":"Text","text/html":"Url",default:"Text"},C3="Copy to clipboard: #{key}, Enter";function O3(e){var t=(/mac os x/i.test(navigator.userAgent)?"⌘":"Ctrl")+"+C";return e.replace(/#{\s*key\s*}/g,t)}function I3(e,t){var n,r,o,s,i,l,a=!1;t||(t={}),n=t.debug||!1;try{o=N3(),s=document.createRange(),i=document.getSelection(),l=document.createElement("span"),l.textContent=e,l.ariaHidden="true",l.style.all="unset",l.style.position="fixed",l.style.top=0,l.style.clip="rect(0, 0, 0, 0)",l.style.whiteSpace="pre",l.style.webkitUserSelect="text",l.style.MozUserSelect="text",l.style.msUserSelect="text",l.style.userSelect="text",l.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=zh[t.format]||zh.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(l),s.selectNodeContents(l),i.addRange(s);var c=document.execCommand("copy");if(!c)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=O3("message"in t?t.message:C3),window.prompt(r,e)}}finally{i&&(typeof i.removeRange=="function"?i.removeRange(s):i.removeAllRanges()),l&&document.body.removeChild(l),o()}return a}var $3=I3;Object.defineProperty(Ni,"__esModule",{value:!0}),Ni.CopyToClipboard=void 0;var k3=Uh($3),Ci=Uh(g),M3=["text","onCopy","options","children"];function Uh(e){return e&&e.__esModule?e:{default:e}}function Gr(e){"@babel/helpers - typeof";return Gr=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},Gr(e)}function Wh(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),n.push.apply(n,r)}return n}function _h(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Wh(Object(n),!0).forEach(function(r){Ac(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Wh(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function D3(e,t){if(e==null)return{};var n,r,o=B3(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(r=0;r<s.length;r++)n=s[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}function B3(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}function L3(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function F3(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,Hh(r.key),r)}}function R3(e,t,n){return t&&F3(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function j3(e,t,n){return t=Oi(t),z3(e,Vh()?Reflect.construct(t,n||[],Oi(e).constructor):t.apply(e,n))}function z3(e,t){if(t&&(Gr(t)=="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return U3(e)}function U3(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Vh(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(Vh=function(){return!!e})()}function Oi(e){return Oi=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Oi(e)}function W3(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&&Tc(e,t)}function Tc(e,t){return Tc=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,r){return n.__proto__=r,n},Tc(e,t)}function Ac(e,t,n){return(t=Hh(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Hh(e){var t=_3(e,"string");return Gr(t)=="symbol"?t:t+""}function _3(e,t){if(Gr(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(Gr(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var V3=Ni.CopyToClipboard=function(e){function t(){var n;L3(this,t);for(var r=arguments.length,o=new Array(r),s=0;s<r;s++)o[s]=arguments[s];return n=j3(this,t,[].concat(o)),Ac(n,"onClick",function(i){var l=n.props,a=l.text,c=l.onCopy,u=l.children,f=l.options,p=Ci.default.Children.only(u),d=(0,k3.default)(a,f);c&&c(a,d),p!=null&&p.props&&typeof p.props.onClick=="function"&&p.props.onClick(i)}),n}return W3(t,e),R3(t,[{key:"render",value:function(){var r=this.props;r.text,r.onCopy,r.options;var o=r.children,s=D3(r,M3),i=Ci.default.Children.only(o);return Ci.default.cloneElement(i,_h(_h({},s),{},{onClick:this.onClick}))}}])}(Ci.default.PureComponent);Ac(V3,"defaultProps",{onCopy:void 0,options:void 0});var H3=Ni,Nc=H3.CopyToClipboard;Nc.CopyToClipboard=Nc;var G3=Nc;const q3=Ym(G3);var K3=Object.defineProperty,Ii=Object.getOwnPropertySymbols,Gh=Object.prototype.hasOwnProperty,qh=Object.prototype.propertyIsEnumerable,Kh=(e,t,n)=>t in e?K3(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Cc=(e,t)=>{for(var n in t||(t={}))Gh.call(t,n)&&Kh(e,n,t[n]);if(Ii)for(var n of Ii(t))qh.call(t,n)&&Kh(e,n,t[n]);return e},Oc=(e,t)=>{var n={};for(var r in e)Gh.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&Ii)for(var r of Ii(e))t.indexOf(r)<0&&qh.call(e,r)&&(n[r]=e[r]);return n};/**
170
170
  * @license QR Code generator library (TypeScript)
171
171
  * Copyright (c) Project Nayuki.
172
172
  * SPDX-License-Identifier: MIT
173
- */var pr;(e=>{const t=class ce{constructor(a,c,u,f){if(this.version=a,this.errorCorrectionLevel=c,this.modules=[],this.isFunction=[],a<ce.MIN_VERSION||a>ce.MAX_VERSION)throw new RangeError("Version value out of range");if(f<-1||f>7)throw new RangeError("Mask value out of range");this.size=a*4+17;let p=[];for(let h=0;h<this.size;h++)p.push(!1);for(let h=0;h<this.size;h++)this.modules.push(p.slice()),this.isFunction.push(p.slice());this.drawFunctionPatterns();const d=this.addEccAndInterleave(u);if(this.drawCodewords(d),f==-1){let h=1e9;for(let b=0;b<8;b++){this.applyMask(b),this.drawFormatBits(b);const w=this.getPenaltyScore();w<h&&(f=b,h=w),this.applyMask(b)}}o(0<=f&&f<=7),this.mask=f,this.applyMask(f),this.drawFormatBits(f),this.isFunction=[]}static encodeText(a,c){const u=e.QrSegment.makeSegments(a);return ce.encodeSegments(u,c)}static encodeBinary(a,c){const u=e.QrSegment.makeBytes(a);return ce.encodeSegments([u],c)}static encodeSegments(a,c,u=1,f=40,p=-1,d=!0){if(!(ce.MIN_VERSION<=u&&u<=f&&f<=ce.MAX_VERSION)||p<-1||p>7)throw new RangeError("Invalid value");let h,b;for(h=u;;h++){const E=ce.getNumDataCodewords(h,c)*8,A=i.getTotalBits(a,h);if(A<=E){b=A;break}if(h>=f)throw new RangeError("Data too long")}for(const E of[ce.Ecc.MEDIUM,ce.Ecc.QUARTILE,ce.Ecc.HIGH])d&&b<=ce.getNumDataCodewords(h,E)*8&&(c=E);let w=[];for(const E of a){n(E.mode.modeBits,4,w),n(E.numChars,E.mode.numCharCountBits(h),w);for(const A of E.getData())w.push(A)}o(w.length==b);const P=ce.getNumDataCodewords(h,c)*8;o(w.length<=P),n(0,Math.min(4,P-w.length),w),n(0,(8-w.length%8)%8,w),o(w.length%8==0);for(let E=236;w.length<P;E^=253)n(E,8,w);let x=[];for(;x.length*8<w.length;)x.push(0);return w.forEach((E,A)=>x[A>>>3]|=E<<7-(A&7)),new ce(h,c,x,p)}getModule(a,c){return 0<=a&&a<this.size&&0<=c&&c<this.size&&this.modules[c][a]}getModules(){return this.modules}drawFunctionPatterns(){for(let u=0;u<this.size;u++)this.setFunctionModule(6,u,u%2==0),this.setFunctionModule(u,6,u%2==0);this.drawFinderPattern(3,3),this.drawFinderPattern(this.size-4,3),this.drawFinderPattern(3,this.size-4);const a=this.getAlignmentPatternPositions(),c=a.length;for(let u=0;u<c;u++)for(let f=0;f<c;f++)u==0&&f==0||u==0&&f==c-1||u==c-1&&f==0||this.drawAlignmentPattern(a[u],a[f]);this.drawFormatBits(0),this.drawVersion()}drawFormatBits(a){const c=this.errorCorrectionLevel.formatBits<<3|a;let u=c;for(let p=0;p<10;p++)u=u<<1^(u>>>9)*1335;const f=(c<<10|u)^21522;o(f>>>15==0);for(let p=0;p<=5;p++)this.setFunctionModule(8,p,r(f,p));this.setFunctionModule(8,7,r(f,6)),this.setFunctionModule(8,8,r(f,7)),this.setFunctionModule(7,8,r(f,8));for(let p=9;p<15;p++)this.setFunctionModule(14-p,8,r(f,p));for(let p=0;p<8;p++)this.setFunctionModule(this.size-1-p,8,r(f,p));for(let p=8;p<15;p++)this.setFunctionModule(8,this.size-15+p,r(f,p));this.setFunctionModule(8,this.size-8,!0)}drawVersion(){if(this.version<7)return;let a=this.version;for(let u=0;u<12;u++)a=a<<1^(a>>>11)*7973;const c=this.version<<12|a;o(c>>>18==0);for(let u=0;u<18;u++){const f=r(c,u),p=this.size-11+u%3,d=Math.floor(u/3);this.setFunctionModule(p,d,f),this.setFunctionModule(d,p,f)}}drawFinderPattern(a,c){for(let u=-4;u<=4;u++)for(let f=-4;f<=4;f++){const p=Math.max(Math.abs(f),Math.abs(u)),d=a+f,h=c+u;0<=d&&d<this.size&&0<=h&&h<this.size&&this.setFunctionModule(d,h,p!=2&&p!=4)}}drawAlignmentPattern(a,c){for(let u=-2;u<=2;u++)for(let f=-2;f<=2;f++)this.setFunctionModule(a+f,c+u,Math.max(Math.abs(f),Math.abs(u))!=1)}setFunctionModule(a,c,u){this.modules[c][a]=u,this.isFunction[c][a]=!0}addEccAndInterleave(a){const c=this.version,u=this.errorCorrectionLevel;if(a.length!=ce.getNumDataCodewords(c,u))throw new RangeError("Invalid argument");const f=ce.NUM_ERROR_CORRECTION_BLOCKS[u.ordinal][c],p=ce.ECC_CODEWORDS_PER_BLOCK[u.ordinal][c],d=Math.floor(ce.getNumRawDataModules(c)/8),h=f-d%f,b=Math.floor(d/f);let w=[];const P=ce.reedSolomonComputeDivisor(p);for(let E=0,A=0;E<f;E++){let D=a.slice(A,A+b-p+(E<h?0:1));A+=D.length;const L=ce.reedSolomonComputeRemainder(D,P);E<h&&D.push(0),w.push(D.concat(L))}let x=[];for(let E=0;E<w[0].length;E++)w.forEach((A,D)=>{(E!=b-p||D>=h)&&x.push(A[E])});return o(x.length==d),x}drawCodewords(a){if(a.length!=Math.floor(ce.getNumRawDataModules(this.version)/8))throw new RangeError("Invalid argument");let c=0;for(let u=this.size-1;u>=1;u-=2){u==6&&(u=5);for(let f=0;f<this.size;f++)for(let p=0;p<2;p++){const d=u-p,b=(u+1&2)==0?this.size-1-f:f;!this.isFunction[b][d]&&c<a.length*8&&(this.modules[b][d]=r(a[c>>>3],7-(c&7)),c++)}}o(c==a.length*8)}applyMask(a){if(a<0||a>7)throw new RangeError("Mask value out of range");for(let c=0;c<this.size;c++)for(let u=0;u<this.size;u++){let f;switch(a){case 0:f=(u+c)%2==0;break;case 1:f=c%2==0;break;case 2:f=u%3==0;break;case 3:f=(u+c)%3==0;break;case 4:f=(Math.floor(u/3)+Math.floor(c/2))%2==0;break;case 5:f=u*c%2+u*c%3==0;break;case 6:f=(u*c%2+u*c%3)%2==0;break;case 7:f=((u+c)%2+u*c%3)%2==0;break;default:throw new Error("Unreachable")}!this.isFunction[c][u]&&f&&(this.modules[c][u]=!this.modules[c][u])}}getPenaltyScore(){let a=0;for(let p=0;p<this.size;p++){let d=!1,h=0,b=[0,0,0,0,0,0,0];for(let w=0;w<this.size;w++)this.modules[p][w]==d?(h++,h==5?a+=ce.PENALTY_N1:h>5&&a++):(this.finderPenaltyAddHistory(h,b),d||(a+=this.finderPenaltyCountPatterns(b)*ce.PENALTY_N3),d=this.modules[p][w],h=1);a+=this.finderPenaltyTerminateAndCount(d,h,b)*ce.PENALTY_N3}for(let p=0;p<this.size;p++){let d=!1,h=0,b=[0,0,0,0,0,0,0];for(let w=0;w<this.size;w++)this.modules[w][p]==d?(h++,h==5?a+=ce.PENALTY_N1:h>5&&a++):(this.finderPenaltyAddHistory(h,b),d||(a+=this.finderPenaltyCountPatterns(b)*ce.PENALTY_N3),d=this.modules[w][p],h=1);a+=this.finderPenaltyTerminateAndCount(d,h,b)*ce.PENALTY_N3}for(let p=0;p<this.size-1;p++)for(let d=0;d<this.size-1;d++){const h=this.modules[p][d];h==this.modules[p][d+1]&&h==this.modules[p+1][d]&&h==this.modules[p+1][d+1]&&(a+=ce.PENALTY_N2)}let c=0;for(const p of this.modules)c=p.reduce((d,h)=>d+(h?1:0),c);const u=this.size*this.size,f=Math.ceil(Math.abs(c*20-u*10)/u)-1;return o(0<=f&&f<=9),a+=f*ce.PENALTY_N4,o(0<=a&&a<=2568888),a}getAlignmentPatternPositions(){if(this.version==1)return[];{const a=Math.floor(this.version/7)+2,c=this.version==32?26:Math.ceil((this.version*4+4)/(a*2-2))*2;let u=[6];for(let f=this.size-7;u.length<a;f-=c)u.splice(1,0,f);return u}}static getNumRawDataModules(a){if(a<ce.MIN_VERSION||a>ce.MAX_VERSION)throw new RangeError("Version number out of range");let c=(16*a+128)*a+64;if(a>=2){const u=Math.floor(a/7)+2;c-=(25*u-10)*u-55,a>=7&&(c-=36)}return o(208<=c&&c<=29648),c}static getNumDataCodewords(a,c){return Math.floor(ce.getNumRawDataModules(a)/8)-ce.ECC_CODEWORDS_PER_BLOCK[c.ordinal][a]*ce.NUM_ERROR_CORRECTION_BLOCKS[c.ordinal][a]}static reedSolomonComputeDivisor(a){if(a<1||a>255)throw new RangeError("Degree out of range");let c=[];for(let f=0;f<a-1;f++)c.push(0);c.push(1);let u=1;for(let f=0;f<a;f++){for(let p=0;p<c.length;p++)c[p]=ce.reedSolomonMultiply(c[p],u),p+1<c.length&&(c[p]^=c[p+1]);u=ce.reedSolomonMultiply(u,2)}return c}static reedSolomonComputeRemainder(a,c){let u=c.map(f=>0);for(const f of a){const p=f^u.shift();u.push(0),c.forEach((d,h)=>u[h]^=ce.reedSolomonMultiply(d,p))}return u}static reedSolomonMultiply(a,c){if(a>>>8||c>>>8)throw new RangeError("Byte out of range");let u=0;for(let f=7;f>=0;f--)u=u<<1^(u>>>7)*285,u^=(c>>>f&1)*a;return o(u>>>8==0),u}finderPenaltyCountPatterns(a){const c=a[1];o(c<=this.size*3);const u=c>0&&a[2]==c&&a[3]==c*3&&a[4]==c&&a[5]==c;return(u&&a[0]>=c*4&&a[6]>=c?1:0)+(u&&a[6]>=c*4&&a[0]>=c?1:0)}finderPenaltyTerminateAndCount(a,c,u){return a&&(this.finderPenaltyAddHistory(c,u),c=0),c+=this.size,this.finderPenaltyAddHistory(c,u),this.finderPenaltyCountPatterns(u)}finderPenaltyAddHistory(a,c){c[0]==0&&(a+=this.size),c.pop(),c.unshift(a)}};t.MIN_VERSION=1,t.MAX_VERSION=40,t.PENALTY_N1=3,t.PENALTY_N2=3,t.PENALTY_N3=40,t.PENALTY_N4=10,t.ECC_CODEWORDS_PER_BLOCK=[[-1,7,10,15,20,26,18,20,24,30,18,20,24,26,30,22,24,28,30,28,28,28,28,30,30,26,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,10,16,26,18,24,16,18,22,22,26,30,22,22,24,24,28,28,26,26,26,26,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28],[-1,13,22,18,26,18,24,18,22,20,24,28,26,24,20,30,24,28,28,26,30,28,30,30,30,30,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,17,28,22,16,22,28,26,26,24,28,24,28,22,24,24,30,28,28,26,28,30,24,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30]],t.NUM_ERROR_CORRECTION_BLOCKS=[[-1,1,1,1,1,1,2,2,2,2,4,4,4,4,4,6,6,6,6,7,8,8,9,9,10,12,12,12,13,14,15,16,17,18,19,19,20,21,22,24,25],[-1,1,1,1,2,2,4,4,4,5,5,5,8,9,9,10,10,11,13,14,16,17,17,18,20,21,23,25,26,28,29,31,33,35,37,38,40,43,45,47,49],[-1,1,1,2,2,4,4,6,6,8,8,8,10,12,16,12,17,16,18,21,20,23,23,25,27,29,34,34,35,38,40,43,45,48,51,53,56,59,62,65,68],[-1,1,1,2,4,4,4,5,6,8,8,11,11,16,16,18,16,19,21,25,25,25,34,30,32,35,37,40,42,45,48,51,54,57,60,63,66,70,74,77,81]],e.QrCode=t;function n(l,a,c){if(a<0||a>31||l>>>a)throw new RangeError("Value out of range");for(let u=a-1;u>=0;u--)c.push(l>>>u&1)}function r(l,a){return(l>>>a&1)!=0}function o(l){if(!l)throw new Error("Assertion error")}const s=class Ce{constructor(a,c,u){if(this.mode=a,this.numChars=c,this.bitData=u,c<0)throw new RangeError("Invalid argument");this.bitData=u.slice()}static makeBytes(a){let c=[];for(const u of a)n(u,8,c);return new Ce(Ce.Mode.BYTE,a.length,c)}static makeNumeric(a){if(!Ce.isNumeric(a))throw new RangeError("String contains non-numeric characters");let c=[];for(let u=0;u<a.length;){const f=Math.min(a.length-u,3);n(parseInt(a.substring(u,u+f),10),f*3+1,c),u+=f}return new Ce(Ce.Mode.NUMERIC,a.length,c)}static makeAlphanumeric(a){if(!Ce.isAlphanumeric(a))throw new RangeError("String contains unencodable characters in alphanumeric mode");let c=[],u;for(u=0;u+2<=a.length;u+=2){let f=Ce.ALPHANUMERIC_CHARSET.indexOf(a.charAt(u))*45;f+=Ce.ALPHANUMERIC_CHARSET.indexOf(a.charAt(u+1)),n(f,11,c)}return u<a.length&&n(Ce.ALPHANUMERIC_CHARSET.indexOf(a.charAt(u)),6,c),new Ce(Ce.Mode.ALPHANUMERIC,a.length,c)}static makeSegments(a){return a==""?[]:Ce.isNumeric(a)?[Ce.makeNumeric(a)]:Ce.isAlphanumeric(a)?[Ce.makeAlphanumeric(a)]:[Ce.makeBytes(Ce.toUtf8ByteArray(a))]}static makeEci(a){let c=[];if(a<0)throw new RangeError("ECI assignment value out of range");if(a<128)n(a,8,c);else if(a<16384)n(2,2,c),n(a,14,c);else if(a<1e6)n(6,3,c),n(a,21,c);else throw new RangeError("ECI assignment value out of range");return new Ce(Ce.Mode.ECI,0,c)}static isNumeric(a){return Ce.NUMERIC_REGEX.test(a)}static isAlphanumeric(a){return Ce.ALPHANUMERIC_REGEX.test(a)}getData(){return this.bitData.slice()}static getTotalBits(a,c){let u=0;for(const f of a){const p=f.mode.numCharCountBits(c);if(f.numChars>=1<<p)return 1/0;u+=4+p+f.bitData.length}return u}static toUtf8ByteArray(a){a=encodeURI(a);let c=[];for(let u=0;u<a.length;u++)a.charAt(u)!="%"?c.push(a.charCodeAt(u)):(c.push(parseInt(a.substring(u+1,u+3),16)),u+=2);return c}};s.NUMERIC_REGEX=/^[0-9]*$/,s.ALPHANUMERIC_REGEX=/^[A-Z0-9 $%*+.\/:-]*$/,s.ALPHANUMERIC_CHARSET="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:";let i=s;e.QrSegment=s})(pr||(pr={})),(e=>{(t=>{const n=class{constructor(o,s){this.ordinal=o,this.formatBits=s}};n.LOW=new n(0,1),n.MEDIUM=new n(1,0),n.QUARTILE=new n(2,3),n.HIGH=new n(3,2),t.Ecc=n})(e.QrCode||(e.QrCode={}))})(pr||(pr={})),(e=>{(t=>{const n=class{constructor(o,s){this.modeBits=o,this.numBitsCharCount=s}numCharCountBits(o){return this.numBitsCharCount[Math.floor((o+7)/17)]}};n.NUMERIC=new n(1,[10,12,14]),n.ALPHANUMERIC=new n(2,[9,11,13]),n.BYTE=new n(4,[8,16,16]),n.KANJI=new n(8,[8,10,12]),n.ECI=new n(7,[0,0,0]),t.Mode=n})(e.QrSegment||(e.QrSegment={}))})(pr||(pr={}));var qr=pr;/**
173
+ */var pr;(e=>{const t=class ce{constructor(a,c,u,f){if(this.version=a,this.errorCorrectionLevel=c,this.modules=[],this.isFunction=[],a<ce.MIN_VERSION||a>ce.MAX_VERSION)throw new RangeError("Version value out of range");if(f<-1||f>7)throw new RangeError("Mask value out of range");this.size=a*4+17;let p=[];for(let h=0;h<this.size;h++)p.push(!1);for(let h=0;h<this.size;h++)this.modules.push(p.slice()),this.isFunction.push(p.slice());this.drawFunctionPatterns();const d=this.addEccAndInterleave(u);if(this.drawCodewords(d),f==-1){let h=1e9;for(let b=0;b<8;b++){this.applyMask(b),this.drawFormatBits(b);const v=this.getPenaltyScore();v<h&&(f=b,h=v),this.applyMask(b)}}o(0<=f&&f<=7),this.mask=f,this.applyMask(f),this.drawFormatBits(f),this.isFunction=[]}static encodeText(a,c){const u=e.QrSegment.makeSegments(a);return ce.encodeSegments(u,c)}static encodeBinary(a,c){const u=e.QrSegment.makeBytes(a);return ce.encodeSegments([u],c)}static encodeSegments(a,c,u=1,f=40,p=-1,d=!0){if(!(ce.MIN_VERSION<=u&&u<=f&&f<=ce.MAX_VERSION)||p<-1||p>7)throw new RangeError("Invalid value");let h,b;for(h=u;;h++){const E=ce.getNumDataCodewords(h,c)*8,N=i.getTotalBits(a,h);if(N<=E){b=N;break}if(h>=f)throw new RangeError("Data too long")}for(const E of[ce.Ecc.MEDIUM,ce.Ecc.QUARTILE,ce.Ecc.HIGH])d&&b<=ce.getNumDataCodewords(h,E)*8&&(c=E);let v=[];for(const E of a){n(E.mode.modeBits,4,v),n(E.numChars,E.mode.numCharCountBits(h),v);for(const N of E.getData())v.push(N)}o(v.length==b);const P=ce.getNumDataCodewords(h,c)*8;o(v.length<=P),n(0,Math.min(4,P-v.length),v),n(0,(8-v.length%8)%8,v),o(v.length%8==0);for(let E=236;v.length<P;E^=253)n(E,8,v);let x=[];for(;x.length*8<v.length;)x.push(0);return v.forEach((E,N)=>x[N>>>3]|=E<<7-(N&7)),new ce(h,c,x,p)}getModule(a,c){return 0<=a&&a<this.size&&0<=c&&c<this.size&&this.modules[c][a]}getModules(){return this.modules}drawFunctionPatterns(){for(let u=0;u<this.size;u++)this.setFunctionModule(6,u,u%2==0),this.setFunctionModule(u,6,u%2==0);this.drawFinderPattern(3,3),this.drawFinderPattern(this.size-4,3),this.drawFinderPattern(3,this.size-4);const a=this.getAlignmentPatternPositions(),c=a.length;for(let u=0;u<c;u++)for(let f=0;f<c;f++)u==0&&f==0||u==0&&f==c-1||u==c-1&&f==0||this.drawAlignmentPattern(a[u],a[f]);this.drawFormatBits(0),this.drawVersion()}drawFormatBits(a){const c=this.errorCorrectionLevel.formatBits<<3|a;let u=c;for(let p=0;p<10;p++)u=u<<1^(u>>>9)*1335;const f=(c<<10|u)^21522;o(f>>>15==0);for(let p=0;p<=5;p++)this.setFunctionModule(8,p,r(f,p));this.setFunctionModule(8,7,r(f,6)),this.setFunctionModule(8,8,r(f,7)),this.setFunctionModule(7,8,r(f,8));for(let p=9;p<15;p++)this.setFunctionModule(14-p,8,r(f,p));for(let p=0;p<8;p++)this.setFunctionModule(this.size-1-p,8,r(f,p));for(let p=8;p<15;p++)this.setFunctionModule(8,this.size-15+p,r(f,p));this.setFunctionModule(8,this.size-8,!0)}drawVersion(){if(this.version<7)return;let a=this.version;for(let u=0;u<12;u++)a=a<<1^(a>>>11)*7973;const c=this.version<<12|a;o(c>>>18==0);for(let u=0;u<18;u++){const f=r(c,u),p=this.size-11+u%3,d=Math.floor(u/3);this.setFunctionModule(p,d,f),this.setFunctionModule(d,p,f)}}drawFinderPattern(a,c){for(let u=-4;u<=4;u++)for(let f=-4;f<=4;f++){const p=Math.max(Math.abs(f),Math.abs(u)),d=a+f,h=c+u;0<=d&&d<this.size&&0<=h&&h<this.size&&this.setFunctionModule(d,h,p!=2&&p!=4)}}drawAlignmentPattern(a,c){for(let u=-2;u<=2;u++)for(let f=-2;f<=2;f++)this.setFunctionModule(a+f,c+u,Math.max(Math.abs(f),Math.abs(u))!=1)}setFunctionModule(a,c,u){this.modules[c][a]=u,this.isFunction[c][a]=!0}addEccAndInterleave(a){const c=this.version,u=this.errorCorrectionLevel;if(a.length!=ce.getNumDataCodewords(c,u))throw new RangeError("Invalid argument");const f=ce.NUM_ERROR_CORRECTION_BLOCKS[u.ordinal][c],p=ce.ECC_CODEWORDS_PER_BLOCK[u.ordinal][c],d=Math.floor(ce.getNumRawDataModules(c)/8),h=f-d%f,b=Math.floor(d/f);let v=[];const P=ce.reedSolomonComputeDivisor(p);for(let E=0,N=0;E<f;E++){let D=a.slice(N,N+b-p+(E<h?0:1));N+=D.length;const F=ce.reedSolomonComputeRemainder(D,P);E<h&&D.push(0),v.push(D.concat(F))}let x=[];for(let E=0;E<v[0].length;E++)v.forEach((N,D)=>{(E!=b-p||D>=h)&&x.push(N[E])});return o(x.length==d),x}drawCodewords(a){if(a.length!=Math.floor(ce.getNumRawDataModules(this.version)/8))throw new RangeError("Invalid argument");let c=0;for(let u=this.size-1;u>=1;u-=2){u==6&&(u=5);for(let f=0;f<this.size;f++)for(let p=0;p<2;p++){const d=u-p,b=(u+1&2)==0?this.size-1-f:f;!this.isFunction[b][d]&&c<a.length*8&&(this.modules[b][d]=r(a[c>>>3],7-(c&7)),c++)}}o(c==a.length*8)}applyMask(a){if(a<0||a>7)throw new RangeError("Mask value out of range");for(let c=0;c<this.size;c++)for(let u=0;u<this.size;u++){let f;switch(a){case 0:f=(u+c)%2==0;break;case 1:f=c%2==0;break;case 2:f=u%3==0;break;case 3:f=(u+c)%3==0;break;case 4:f=(Math.floor(u/3)+Math.floor(c/2))%2==0;break;case 5:f=u*c%2+u*c%3==0;break;case 6:f=(u*c%2+u*c%3)%2==0;break;case 7:f=((u+c)%2+u*c%3)%2==0;break;default:throw new Error("Unreachable")}!this.isFunction[c][u]&&f&&(this.modules[c][u]=!this.modules[c][u])}}getPenaltyScore(){let a=0;for(let p=0;p<this.size;p++){let d=!1,h=0,b=[0,0,0,0,0,0,0];for(let v=0;v<this.size;v++)this.modules[p][v]==d?(h++,h==5?a+=ce.PENALTY_N1:h>5&&a++):(this.finderPenaltyAddHistory(h,b),d||(a+=this.finderPenaltyCountPatterns(b)*ce.PENALTY_N3),d=this.modules[p][v],h=1);a+=this.finderPenaltyTerminateAndCount(d,h,b)*ce.PENALTY_N3}for(let p=0;p<this.size;p++){let d=!1,h=0,b=[0,0,0,0,0,0,0];for(let v=0;v<this.size;v++)this.modules[v][p]==d?(h++,h==5?a+=ce.PENALTY_N1:h>5&&a++):(this.finderPenaltyAddHistory(h,b),d||(a+=this.finderPenaltyCountPatterns(b)*ce.PENALTY_N3),d=this.modules[v][p],h=1);a+=this.finderPenaltyTerminateAndCount(d,h,b)*ce.PENALTY_N3}for(let p=0;p<this.size-1;p++)for(let d=0;d<this.size-1;d++){const h=this.modules[p][d];h==this.modules[p][d+1]&&h==this.modules[p+1][d]&&h==this.modules[p+1][d+1]&&(a+=ce.PENALTY_N2)}let c=0;for(const p of this.modules)c=p.reduce((d,h)=>d+(h?1:0),c);const u=this.size*this.size,f=Math.ceil(Math.abs(c*20-u*10)/u)-1;return o(0<=f&&f<=9),a+=f*ce.PENALTY_N4,o(0<=a&&a<=2568888),a}getAlignmentPatternPositions(){if(this.version==1)return[];{const a=Math.floor(this.version/7)+2,c=this.version==32?26:Math.ceil((this.version*4+4)/(a*2-2))*2;let u=[6];for(let f=this.size-7;u.length<a;f-=c)u.splice(1,0,f);return u}}static getNumRawDataModules(a){if(a<ce.MIN_VERSION||a>ce.MAX_VERSION)throw new RangeError("Version number out of range");let c=(16*a+128)*a+64;if(a>=2){const u=Math.floor(a/7)+2;c-=(25*u-10)*u-55,a>=7&&(c-=36)}return o(208<=c&&c<=29648),c}static getNumDataCodewords(a,c){return Math.floor(ce.getNumRawDataModules(a)/8)-ce.ECC_CODEWORDS_PER_BLOCK[c.ordinal][a]*ce.NUM_ERROR_CORRECTION_BLOCKS[c.ordinal][a]}static reedSolomonComputeDivisor(a){if(a<1||a>255)throw new RangeError("Degree out of range");let c=[];for(let f=0;f<a-1;f++)c.push(0);c.push(1);let u=1;for(let f=0;f<a;f++){for(let p=0;p<c.length;p++)c[p]=ce.reedSolomonMultiply(c[p],u),p+1<c.length&&(c[p]^=c[p+1]);u=ce.reedSolomonMultiply(u,2)}return c}static reedSolomonComputeRemainder(a,c){let u=c.map(f=>0);for(const f of a){const p=f^u.shift();u.push(0),c.forEach((d,h)=>u[h]^=ce.reedSolomonMultiply(d,p))}return u}static reedSolomonMultiply(a,c){if(a>>>8||c>>>8)throw new RangeError("Byte out of range");let u=0;for(let f=7;f>=0;f--)u=u<<1^(u>>>7)*285,u^=(c>>>f&1)*a;return o(u>>>8==0),u}finderPenaltyCountPatterns(a){const c=a[1];o(c<=this.size*3);const u=c>0&&a[2]==c&&a[3]==c*3&&a[4]==c&&a[5]==c;return(u&&a[0]>=c*4&&a[6]>=c?1:0)+(u&&a[6]>=c*4&&a[0]>=c?1:0)}finderPenaltyTerminateAndCount(a,c,u){return a&&(this.finderPenaltyAddHistory(c,u),c=0),c+=this.size,this.finderPenaltyAddHistory(c,u),this.finderPenaltyCountPatterns(u)}finderPenaltyAddHistory(a,c){c[0]==0&&(a+=this.size),c.pop(),c.unshift(a)}};t.MIN_VERSION=1,t.MAX_VERSION=40,t.PENALTY_N1=3,t.PENALTY_N2=3,t.PENALTY_N3=40,t.PENALTY_N4=10,t.ECC_CODEWORDS_PER_BLOCK=[[-1,7,10,15,20,26,18,20,24,30,18,20,24,26,30,22,24,28,30,28,28,28,28,30,30,26,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,10,16,26,18,24,16,18,22,22,26,30,22,22,24,24,28,28,26,26,26,26,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28],[-1,13,22,18,26,18,24,18,22,20,24,28,26,24,20,30,24,28,28,26,30,28,30,30,30,30,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,17,28,22,16,22,28,26,26,24,28,24,28,22,24,24,30,28,28,26,28,30,24,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30]],t.NUM_ERROR_CORRECTION_BLOCKS=[[-1,1,1,1,1,1,2,2,2,2,4,4,4,4,4,6,6,6,6,7,8,8,9,9,10,12,12,12,13,14,15,16,17,18,19,19,20,21,22,24,25],[-1,1,1,1,2,2,4,4,4,5,5,5,8,9,9,10,10,11,13,14,16,17,17,18,20,21,23,25,26,28,29,31,33,35,37,38,40,43,45,47,49],[-1,1,1,2,2,4,4,6,6,8,8,8,10,12,16,12,17,16,18,21,20,23,23,25,27,29,34,34,35,38,40,43,45,48,51,53,56,59,62,65,68],[-1,1,1,2,4,4,4,5,6,8,8,11,11,16,16,18,16,19,21,25,25,25,34,30,32,35,37,40,42,45,48,51,54,57,60,63,66,70,74,77,81]],e.QrCode=t;function n(l,a,c){if(a<0||a>31||l>>>a)throw new RangeError("Value out of range");for(let u=a-1;u>=0;u--)c.push(l>>>u&1)}function r(l,a){return(l>>>a&1)!=0}function o(l){if(!l)throw new Error("Assertion error")}const s=class Ce{constructor(a,c,u){if(this.mode=a,this.numChars=c,this.bitData=u,c<0)throw new RangeError("Invalid argument");this.bitData=u.slice()}static makeBytes(a){let c=[];for(const u of a)n(u,8,c);return new Ce(Ce.Mode.BYTE,a.length,c)}static makeNumeric(a){if(!Ce.isNumeric(a))throw new RangeError("String contains non-numeric characters");let c=[];for(let u=0;u<a.length;){const f=Math.min(a.length-u,3);n(parseInt(a.substring(u,u+f),10),f*3+1,c),u+=f}return new Ce(Ce.Mode.NUMERIC,a.length,c)}static makeAlphanumeric(a){if(!Ce.isAlphanumeric(a))throw new RangeError("String contains unencodable characters in alphanumeric mode");let c=[],u;for(u=0;u+2<=a.length;u+=2){let f=Ce.ALPHANUMERIC_CHARSET.indexOf(a.charAt(u))*45;f+=Ce.ALPHANUMERIC_CHARSET.indexOf(a.charAt(u+1)),n(f,11,c)}return u<a.length&&n(Ce.ALPHANUMERIC_CHARSET.indexOf(a.charAt(u)),6,c),new Ce(Ce.Mode.ALPHANUMERIC,a.length,c)}static makeSegments(a){return a==""?[]:Ce.isNumeric(a)?[Ce.makeNumeric(a)]:Ce.isAlphanumeric(a)?[Ce.makeAlphanumeric(a)]:[Ce.makeBytes(Ce.toUtf8ByteArray(a))]}static makeEci(a){let c=[];if(a<0)throw new RangeError("ECI assignment value out of range");if(a<128)n(a,8,c);else if(a<16384)n(2,2,c),n(a,14,c);else if(a<1e6)n(6,3,c),n(a,21,c);else throw new RangeError("ECI assignment value out of range");return new Ce(Ce.Mode.ECI,0,c)}static isNumeric(a){return Ce.NUMERIC_REGEX.test(a)}static isAlphanumeric(a){return Ce.ALPHANUMERIC_REGEX.test(a)}getData(){return this.bitData.slice()}static getTotalBits(a,c){let u=0;for(const f of a){const p=f.mode.numCharCountBits(c);if(f.numChars>=1<<p)return 1/0;u+=4+p+f.bitData.length}return u}static toUtf8ByteArray(a){a=encodeURI(a);let c=[];for(let u=0;u<a.length;u++)a.charAt(u)!="%"?c.push(a.charCodeAt(u)):(c.push(parseInt(a.substring(u+1,u+3),16)),u+=2);return c}};s.NUMERIC_REGEX=/^[0-9]*$/,s.ALPHANUMERIC_REGEX=/^[A-Z0-9 $%*+.\/:-]*$/,s.ALPHANUMERIC_CHARSET="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:";let i=s;e.QrSegment=s})(pr||(pr={})),(e=>{(t=>{const n=class{constructor(o,s){this.ordinal=o,this.formatBits=s}};n.LOW=new n(0,1),n.MEDIUM=new n(1,0),n.QUARTILE=new n(2,3),n.HIGH=new n(3,2),t.Ecc=n})(e.QrCode||(e.QrCode={}))})(pr||(pr={})),(e=>{(t=>{const n=class{constructor(o,s){this.modeBits=o,this.numBitsCharCount=s}numCharCountBits(o){return this.numBitsCharCount[Math.floor((o+7)/17)]}};n.NUMERIC=new n(1,[10,12,14]),n.ALPHANUMERIC=new n(2,[9,11,13]),n.BYTE=new n(4,[8,16,16]),n.KANJI=new n(8,[8,10,12]),n.ECI=new n(7,[0,0,0]),t.Mode=n})(e.QrSegment||(e.QrSegment={}))})(pr||(pr={}));var qr=pr;/**
174
174
  * @license qrcode.react
175
175
  * Copyright (c) Paul O'Shannessy
176
176
  * SPDX-License-Identifier: ISC
177
- */var Z3={L:qr.QrCode.Ecc.LOW,M:qr.QrCode.Ecc.MEDIUM,Q:qr.QrCode.Ecc.QUARTILE,H:qr.QrCode.Ecc.HIGH},Zh=128,Yh="L",Xh="#FFFFFF",Jh="#000000",Qh=!1,em=1,Y3=4,X3=0,J3=.1;function tm(e,t=0){const n=[];return e.forEach(function(r,o){let s=null;r.forEach(function(i,l){if(!i&&s!==null){n.push(`M${s+t} ${o+t}h${l-s}v1H${s+t}z`),s=null;return}if(l===r.length-1){if(!i)return;s===null?n.push(`M${l+t},${o+t} h1v1H${l+t}z`):n.push(`M${s+t},${o+t} h${l+1-s}v1H${s+t}z`);return}i&&s===null&&(s=l)})}),n.join("")}function nm(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 Q3(e,t,n,r){if(r==null)return null;const o=e.length+n*2,s=Math.floor(t*J3),i=o/t,l=(r.width||s)*i,a=(r.height||s)*i,c=r.x==null?e.length/2-l/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(c),b=Math.floor(u),w=Math.ceil(l+c-h),P=Math.ceil(a+u-b);p={x:h,y:b,w,h:P}}const d=r.crossOrigin;return{x:c,y:u,h:a,w:l,excavation:p,opacity:f,crossOrigin:d}}function eS(e,t){return t!=null?Math.max(Math.floor(t),0):e?Y3:X3}function rm({value:e,level:t,minVersion:n,includeMargin:r,marginSize:o,imageSettings:s,size:i,boostLevel:l}){let a=g.useMemo(()=>{const h=(Array.isArray(e)?e:[e]).reduce((b,w)=>(b.push(...qr.QrSegment.makeSegments(w)),b),[]);return qr.QrCode.encodeSegments(h,Z3[t],n,void 0,void 0,l)},[e,t,n,l]);const{cells:c,margin:u,numCells:f,calculatedImageSettings:p}=g.useMemo(()=>{let d=a.getModules();const h=eS(r,o),b=d.length+h*2,w=Q3(d,i,h,s);return{cells:d,margin:h,numCells:b,calculatedImageSettings:w}},[a,i,s,r,o]);return{qrcode:a,margin:u,cells:c,numCells:f,calculatedImageSettings:p}}var tS=function(){try{new Path2D().addPath(new Path2D)}catch{return!1}return!0}(),nS=g.forwardRef(function(t,n){const r=t,{value:o,size:s=Zh,level:i=Yh,bgColor:l=Xh,fgColor:a=Jh,includeMargin:c=Qh,minVersion:u=em,boostLevel:f,marginSize:p,imageSettings:d}=r,b=Oc(r,["value","size","level","bgColor","fgColor","includeMargin","minVersion","boostLevel","marginSize","imageSettings"]),{style:w}=b,P=Oc(b,["style"]),x=d==null?void 0:d.src,E=g.useRef(null),A=g.useRef(null),D=g.useCallback(M=>{E.current=M,typeof n=="function"?n(M):n&&(n.current=M)},[n]),[L,F]=g.useState(!1),{margin:m,cells:v,numCells:S,calculatedImageSettings:$}=rm({value:o,level:i,minVersion:u,boostLevel:f,includeMargin:c,marginSize:p,imageSettings:d,size:s});g.useEffect(()=>{if(E.current!=null){const M=E.current,y=M.getContext("2d");if(!y)return;let O=v;const k=A.current,T=$!=null&&k!==null&&k.complete&&k.naturalHeight!==0&&k.naturalWidth!==0;T&&$.excavation!=null&&(O=nm(v,$.excavation));const B=window.devicePixelRatio||1;M.height=M.width=s*B;const R=s/S*B;y.scale(R,R),y.fillStyle=l,y.fillRect(0,0,S,S),y.fillStyle=a,tS?y.fill(new Path2D(tm(O,m))):v.forEach(function(z,_){z.forEach(function(G,J){G&&y.fillRect(J+m,_+m,1,1)})}),$&&(y.globalAlpha=$.opacity),T&&y.drawImage(k,$.x+m,$.y+m,$.w,$.h)}}),g.useEffect(()=>{F(!1)},[x]);const I=Cc({height:s,width:s},w);let C=null;return x!=null&&(C=g.createElement("img",{src:x,key:x,style:{display:"none"},onLoad:()=>{F(!0)},ref:A,crossOrigin:$==null?void 0:$.crossOrigin})),g.createElement(g.Fragment,null,g.createElement("canvas",Cc({style:I,height:s,width:s,ref:D,role:"img"},P)),C)});nS.displayName="QRCodeCanvas";var om=g.forwardRef(function(t,n){const r=t,{value:o,size:s=Zh,level:i=Yh,bgColor:l=Xh,fgColor:a=Jh,includeMargin:c=Qh,minVersion:u=em,boostLevel:f,title:p,marginSize:d,imageSettings:h}=r,b=Oc(r,["value","size","level","bgColor","fgColor","includeMargin","minVersion","boostLevel","title","marginSize","imageSettings"]),{margin:w,cells:P,numCells:x,calculatedImageSettings:E}=rm({value:o,level:i,minVersion:u,boostLevel:f,includeMargin:c,marginSize:d,imageSettings:h,size:s});let A=P,D=null;h!=null&&E!=null&&(E.excavation!=null&&(A=nm(P,E.excavation)),D=g.createElement("image",{href:h.src,height:E.h,width:E.w,x:E.x+w,y:E.y+w,preserveAspectRatio:"none",opacity:E.opacity,crossOrigin:E.crossOrigin}));const L=tm(A,w);return g.createElement("svg",Cc({height:s,width:s,viewBox:`0 0 ${x} ${x}`,ref:n,role:"img"},b),!!p&&g.createElement("title",null,p),g.createElement("path",{fill:l,d:`M0,0 h${x}v${x}H0z`,shapeRendering:"crispEdges"}),g.createElement("path",{fill:a,d:L,shapeRendering:"crispEdges"}),D)});om.displayName="QRCodeSVG";function rS(){const e=navigator.userAgentData;return e!=null&&e.platform?e.platform:navigator.platform}function oS(){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 sm(){return/apple/i.test(navigator.vendor)}function sS(){return rS().toLowerCase().startsWith("mac")&&!navigator.maxTouchPoints}function iS(){return oS().includes("jsdom/")}const im="data-floating-ui-focusable",aS="input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])";function Ic(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 Kr(e,t){if(!e||!t)return!1;const n=t.getRootNode==null?void 0:t.getRootNode();if(e.contains(t))return!0;if(n&&ec(n)){let r=t;for(;r;){if(e===r)return!0;r=r.parentNode||r.host}}return!1}function Zr(e){return"composedPath"in e?e.composedPath()[0]:e.target}function $c(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 lS(e){return e.matches("html,body")}function tn(e){return(e==null?void 0:e.ownerDocument)||document}function am(e){return st(e)&&e.matches(aS)}function cS(e){if(!e||iS())return!0;try{return e.matches(":focus-visible")}catch{return!0}}function uS(e){return e?e.hasAttribute(im)?e:e.querySelector("["+im+"]")||e:null}function $i(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,...$i(e,o.id,n)])}function fS(e){return"nativeEvent"in e}function as(e,t){const n=["mouse","pen"];return t||n.push("",void 0),n.includes(e)}var dS=typeof document<"u",pS=function(){},nn=dS?g.useLayoutEffect:pS;const hS={...U};function ki(e){const t=U.useRef(e);return nn(()=>{t.current=e}),t}const mS=hS.useInsertionEffect||(e=>e());function rn(e){const t=U.useRef(()=>{if(process.env.NODE_ENV!=="production")throw new Error("Cannot call an event handler while rendering.")});return mS(()=>{t.current=e}),U.useCallback(function(){for(var n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return t.current==null?void 0:t.current(...r)},[])}const lm=()=>({getShadowRoot:!0,displayCheck:typeof ResizeObserver=="function"&&ResizeObserver.toString().includes("[native code]")?"full":"none"});function cm(e,t){const n=_p(e,lm()),r=n.length;if(r===0)return;const o=Ic(tn(e)),s=n.indexOf(o),i=s===-1?t===1?0:r-1:s+t;return n[i]}function bS(e){return cm(tn(e).body,1)||e}function gS(e){return cm(tn(e).body,-1)||e}function kc(e,t){const n=t||e.currentTarget,r=e.relatedTarget;return!r||!Kr(n,r)}function yS(e){_p(e,lm()).forEach(n=>{n.dataset.tabindex=n.getAttribute("tabindex")||"",n.setAttribute("tabindex","-1")})}function um(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 vS="data-floating-ui-focusable",fm="active",dm="selected",wS={...U};let pm=!1,xS=0;const hm=()=>"floating-ui-"+Math.random().toString(36).slice(2,6)+xS++;function ES(){const[e,t]=U.useState(()=>pm?hm():void 0);return nn(()=>{e==null&&t(hm())},[]),U.useEffect(()=>{pm=!0},[]),e}const Mc=wS.useId||ES;let Dc;process.env.NODE_ENV!=="production"&&(Dc=new Set);function SS(){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=Dc)!=null&&e.has(o))){var s;(s=Dc)==null||s.add(o),console.error(o)}}function PS(){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 TS=U.createContext(null),AS=U.createContext(null),Bc=()=>{var e;return((e=U.useContext(TS))==null?void 0:e.id)||null},Lc=()=>U.useContext(AS);function ls(e){return"data-floating-ui-"+e}function Ct(e){e.current!==-1&&(clearTimeout(e.current),e.current=-1)}const mm=ls("safe-polygon");function Fc(e,t,n){if(n&&!as(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 Rc(e){return typeof e=="function"?e():e}function NS(e,t){t===void 0&&(t={});const{open:n,onOpenChange:r,dataRef:o,events:s,elements:i}=e,{enabled:l=!0,delay:a=0,handleClose:c=null,mouseOnly:u=!1,restMs:f=0,move:p=!0}=t,d=Lc(),h=Bc(),b=ki(c),w=ki(a),P=ki(n),x=ki(f),E=U.useRef(),A=U.useRef(-1),D=U.useRef(),L=U.useRef(-1),F=U.useRef(!0),m=U.useRef(!1),v=U.useRef(()=>{}),S=U.useRef(!1),$=rn(()=>{var k;const T=(k=o.current.openEvent)==null?void 0:k.type;return(T==null?void 0:T.includes("mouse"))&&T!=="mousedown"});U.useEffect(()=>{if(!l)return;function k(T){let{open:B}=T;B||(Ct(A),Ct(L),F.current=!0,S.current=!1)}return s.on("openchange",k),()=>{s.off("openchange",k)}},[l,s]),U.useEffect(()=>{if(!l||!b.current||!n)return;function k(B){$()&&r(!1,B,"hover")}const T=tn(i.floating).documentElement;return T.addEventListener("mouseleave",k),()=>{T.removeEventListener("mouseleave",k)}},[i.floating,n,r,l,b,$]);const I=U.useCallback(function(k,T,B){T===void 0&&(T=!0),B===void 0&&(B="hover");const R=Fc(w.current,"close",E.current);R&&!D.current?(Ct(A),A.current=window.setTimeout(()=>r(!1,k,B),R)):T&&(Ct(A),r(!1,k,B))},[w,r]),C=rn(()=>{v.current(),D.current=void 0}),M=rn(()=>{if(m.current){const k=tn(i.floating).body;k.style.pointerEvents="",k.removeAttribute(mm),m.current=!1}}),y=rn(()=>o.current.openEvent?["click","mousedown"].includes(o.current.openEvent.type):!1);U.useEffect(()=>{if(!l)return;function k(_){if(Ct(A),F.current=!1,u&&!as(E.current)||Rc(x.current)>0&&!Fc(w.current,"open"))return;const G=Fc(w.current,"open",E.current);G?A.current=window.setTimeout(()=>{P.current||r(!0,_,"hover")},G):n||r(!0,_,"hover")}function T(_){if(y()){M();return}v.current();const G=tn(i.floating);if(Ct(L),S.current=!1,b.current&&o.current.floatingContext){n||Ct(A),D.current=b.current({...o.current.floatingContext,tree:d,x:_.clientX,y:_.clientY,onClose(){M(),C(),y()||I(_,!0,"safe-polygon")}});const K=D.current;G.addEventListener("mousemove",K),v.current=()=>{G.removeEventListener("mousemove",K)};return}(E.current==="touch"?!Kr(i.floating,_.relatedTarget):!0)&&I(_)}function B(_){y()||o.current.floatingContext&&(b.current==null||b.current({...o.current.floatingContext,tree:d,x:_.clientX,y:_.clientY,onClose(){M(),C(),y()||I(_)}})(_))}function R(){Ct(A)}function z(_){y()||I(_,!1)}if(me(i.domReference)){const _=i.domReference,G=i.floating;return n&&_.addEventListener("mouseleave",B),p&&_.addEventListener("mousemove",k,{once:!0}),_.addEventListener("mouseenter",k),_.addEventListener("mouseleave",T),G&&(G.addEventListener("mouseleave",B),G.addEventListener("mouseenter",R),G.addEventListener("mouseleave",z)),()=>{n&&_.removeEventListener("mouseleave",B),p&&_.removeEventListener("mousemove",k),_.removeEventListener("mouseenter",k),_.removeEventListener("mouseleave",T),G&&(G.removeEventListener("mouseleave",B),G.removeEventListener("mouseenter",R),G.removeEventListener("mouseleave",z))}}},[i,l,e,u,p,I,C,M,r,n,P,d,w,b,o,y,x]),nn(()=>{var k;if(l&&n&&(k=b.current)!=null&&(k=k.__options)!=null&&k.blockPointerEvents&&$()){m.current=!0;const B=i.floating;if(me(i.domReference)&&B){var T;const R=tn(i.floating).body;R.setAttribute(mm,"");const z=i.domReference,_=d==null||(T=d.nodesRef.current.find(G=>G.id===h))==null||(T=T.context)==null?void 0:T.elements.floating;return _&&(_.style.pointerEvents=""),R.style.pointerEvents="none",z.style.pointerEvents="auto",B.style.pointerEvents="auto",()=>{R.style.pointerEvents="",z.style.pointerEvents="",B.style.pointerEvents=""}}}},[l,n,h,i,d,b,$]),nn(()=>{n||(E.current=void 0,S.current=!1,C(),M())},[n,C,M]),U.useEffect(()=>()=>{C(),Ct(A),Ct(L),M()},[l,i.domReference,C,M]);const O=U.useMemo(()=>{function k(T){E.current=T.pointerType}return{onPointerDown:k,onPointerEnter:k,onMouseMove(T){const{nativeEvent:B}=T;function R(){!F.current&&!P.current&&r(!0,B,"hover")}u&&!as(E.current)||n||Rc(x.current)===0||S.current&&T.movementX**2+T.movementY**2<2||(Ct(L),E.current==="touch"?R():(S.current=!0,L.current=window.setTimeout(R,Rc(x.current))))}}},[u,r,n,P,x]);return U.useMemo(()=>l?{reference:O}:{},[l,O])}const CS={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},bm=U.forwardRef(function(t,n){const[r,o]=U.useState();nn(()=>{sm()&&o("button")},[]);const s={ref:n,tabIndex:0,role:r,"aria-hidden":r?void 0:!0,[ls("focus-guard")]:"",style:CS};return N.jsx("span",{...t,...s})}),OS={clipPath:"inset(50%)",position:"fixed",top:0,left:0},gm=U.createContext(null),ym=ls("portal");function IS(e){e===void 0&&(e={});const{id:t,root:n}=e,r=Mc(),o=kS(),[s,i]=U.useState(null),l=U.useRef(null);return nn(()=>()=>{s==null||s.remove(),queueMicrotask(()=>{l.current=null})},[s]),nn(()=>{if(!r||l.current)return;const a=t?document.getElementById(t):null;if(!a)return;const c=document.createElement("div");c.id=r,c.setAttribute(ym,""),a.appendChild(c),l.current=c,i(c)},[t,r]),nn(()=>{if(n===null||!r||l.current)return;let a=n||(o==null?void 0:o.portalNode);a&&!Ql(a)&&(a=a.current),a=a||document.body;let c=null;t&&(c=document.createElement("div"),c.id=t,a.appendChild(c));const u=document.createElement("div");u.id=r,u.setAttribute(ym,""),a=c||a,a.appendChild(u),l.current=u,i(u)},[t,n,r,o]),s}function $S(e){const{children:t,id:n,root:r,preserveTabOrder:o=!0}=e,s=IS({id:n,root:r}),[i,l]=U.useState(null),a=U.useRef(null),c=U.useRef(null),u=U.useRef(null),f=U.useRef(null),p=i==null?void 0:i.modal,d=i==null?void 0:i.open,h=!!i&&!i.modal&&i.open&&o&&!!(r||s);return U.useEffect(()=>{if(!s||!o||p)return;function b(w){s&&kc(w)&&(w.type==="focusin"?um:yS)(s)}return s.addEventListener("focusin",b,!0),s.addEventListener("focusout",b,!0),()=>{s.removeEventListener("focusin",b,!0),s.removeEventListener("focusout",b,!0)}},[s,o,p]),U.useEffect(()=>{s&&(d||um(s))},[d,s]),N.jsxs(gm.Provider,{value:U.useMemo(()=>({preserveTabOrder:o,beforeOutsideRef:a,afterOutsideRef:c,beforeInsideRef:u,afterInsideRef:f,portalNode:s,setFocusManagerState:l}),[o,s]),children:[h&&s&&N.jsx(bm,{"data-type":"outside",ref:a,onFocus:b=>{if(kc(b,s)){var w;(w=u.current)==null||w.focus()}else{const P=i?i.domReference:null,x=gS(P);x==null||x.focus()}}}),h&&s&&N.jsx("span",{"aria-owns":s.id,style:OS}),s&&Jr.createPortal(t,s),h&&s&&N.jsx(bm,{"data-type":"outside",ref:c,onFocus:b=>{if(kc(b,s)){var w;(w=f.current)==null||w.focus()}else{const P=i?i.domReference:null,x=bS(P);x==null||x.focus(),i!=null&&i.closeOnFocusOut&&(i==null||i.onOpenChange(!1,b.nativeEvent,"focus-out"))}}})]})}const kS=()=>U.useContext(gm);function vm(e){return st(e.target)&&e.target.tagName==="BUTTON"}function MS(e){return st(e.target)&&e.target.tagName==="A"}function wm(e){return am(e)}function DS(e,t){t===void 0&&(t={});const{open:n,onOpenChange:r,dataRef:o,elements:{domReference:s}}=e,{enabled:i=!0,event:l="click",toggle:a=!0,ignoreMouse:c=!1,keyboardHandlers:u=!0,stickIfOpen:f=!0}=t,p=U.useRef(),d=U.useRef(!1),h=U.useMemo(()=>({onPointerDown(b){p.current=b.pointerType},onMouseDown(b){const w=p.current;b.button===0&&l!=="click"&&(as(w,!0)&&c||(n&&a&&(!(o.current.openEvent&&f)||o.current.openEvent.type==="mousedown")?r(!1,b.nativeEvent,"click"):(b.preventDefault(),r(!0,b.nativeEvent,"click"))))},onClick(b){const w=p.current;if(l==="mousedown"&&p.current){p.current=void 0;return}as(w,!0)&&c||(n&&a&&(!(o.current.openEvent&&f)||o.current.openEvent.type==="click")?r(!1,b.nativeEvent,"click"):r(!0,b.nativeEvent,"click"))},onKeyDown(b){p.current=void 0,!(b.defaultPrevented||!u||vm(b))&&(b.key===" "&&!wm(s)&&(b.preventDefault(),d.current=!0),!MS(b)&&b.key==="Enter"&&r(!(n&&a),b.nativeEvent,"click"))},onKeyUp(b){b.defaultPrevented||!u||vm(b)||wm(s)||b.key===" "&&d.current&&(d.current=!1,r(!(n&&a),b.nativeEvent,"click"))}}),[o,s,l,c,u,r,n,f,a]);return U.useMemo(()=>i?{reference:h}:{},[i,h])}const BS={pointerdown:"onPointerDown",mousedown:"onMouseDown",click:"onClick"},LS={pointerdown:"onPointerDownCapture",mousedown:"onMouseDownCapture",click:"onClickCapture"},xm=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 FS(e,t){t===void 0&&(t={});const{open:n,onOpenChange:r,elements:o,dataRef:s}=e,{enabled:i=!0,escapeKey:l=!0,outsidePress:a=!0,outsidePressEvent:c="pointerdown",referencePress:u=!1,referencePressEvent:f="pointerdown",ancestorScroll:p=!1,bubbles:d,capture:h}=t,b=Lc(),w=rn(typeof a=="function"?a:()=>!1),P=typeof a=="function"?w:a,x=U.useRef(!1),{escapeKey:E,outsidePress:A}=xm(d),{escapeKey:D,outsidePress:L}=xm(h),F=U.useRef(!1),m=rn(M=>{var y;if(!n||!i||!l||M.key!=="Escape"||F.current)return;const O=(y=s.current.floatingContext)==null?void 0:y.nodeId,k=b?$i(b.nodesRef.current,O):[];if(!E&&(M.stopPropagation(),k.length>0)){let T=!0;if(k.forEach(B=>{var R;if((R=B.context)!=null&&R.open&&!B.context.dataRef.current.__escapeKeyBubbles){T=!1;return}}),!T)return}r(!1,fS(M)?M.nativeEvent:M,"escape-key")}),v=rn(M=>{var y;const O=()=>{var k;m(M),(k=Zr(M))==null||k.removeEventListener("keydown",O)};(y=Zr(M))==null||y.addEventListener("keydown",O)}),S=rn(M=>{var y;const O=s.current.insideReactTree;s.current.insideReactTree=!1;const k=x.current;if(x.current=!1,c==="click"&&k||O||typeof P=="function"&&!P(M))return;const T=Zr(M),B="["+ls("inert")+"]",R=tn(o.floating).querySelectorAll(B);let z=me(T)?T:null;for(;z&&!wn(z);){const K=xn(z);if(wn(K)||!me(K))break;z=K}if(R.length&&me(T)&&!lS(T)&&!Kr(T,o.floating)&&Array.from(R).every(K=>!Kr(z,K)))return;if(st(T)&&C){const K=wn(T),W=At(T),ne=/auto|scroll/,be=K||ne.test(W.overflowX),fe=K||ne.test(W.overflowY),xe=be&&T.clientWidth>0&&T.scrollWidth>T.clientWidth,ye=fe&&T.clientHeight>0&&T.scrollHeight>T.clientHeight,Y=W.direction==="rtl",H=ye&&(Y?M.offsetX<=T.offsetWidth-T.clientWidth:M.offsetX>T.clientWidth),ee=xe&&M.offsetY>T.clientHeight;if(H||ee)return}const _=(y=s.current.floatingContext)==null?void 0:y.nodeId,G=b&&$i(b.nodesRef.current,_).some(K=>{var W;return $c(M,(W=K.context)==null?void 0:W.elements.floating)});if($c(M,o.floating)||$c(M,o.domReference)||G)return;const J=b?$i(b.nodesRef.current,_):[];if(J.length>0){let K=!0;if(J.forEach(W=>{var ne;if((ne=W.context)!=null&&ne.open&&!W.context.dataRef.current.__outsidePressBubbles){K=!1;return}}),!K)return}r(!1,M,"outside-press")}),$=rn(M=>{var y;const O=()=>{var k;S(M),(k=Zr(M))==null||k.removeEventListener(c,O)};(y=Zr(M))==null||y.addEventListener(c,O)});U.useEffect(()=>{if(!n||!i)return;s.current.__escapeKeyBubbles=E,s.current.__outsidePressBubbles=A;let M=-1;function y(R){r(!1,R,"ancestor-scroll")}function O(){window.clearTimeout(M),F.current=!0}function k(){M=window.setTimeout(()=>{F.current=!1},ui()?5:0)}const T=tn(o.floating);l&&(T.addEventListener("keydown",D?v:m,D),T.addEventListener("compositionstart",O),T.addEventListener("compositionend",k)),P&&T.addEventListener(c,L?$:S,L);let B=[];return p&&(me(o.domReference)&&(B=Un(o.domReference)),me(o.floating)&&(B=B.concat(Un(o.floating))),!me(o.reference)&&o.reference&&o.reference.contextElement&&(B=B.concat(Un(o.reference.contextElement)))),B=B.filter(R=>{var z;return R!==((z=T.defaultView)==null?void 0:z.visualViewport)}),B.forEach(R=>{R.addEventListener("scroll",y,{passive:!0})}),()=>{l&&(T.removeEventListener("keydown",D?v:m,D),T.removeEventListener("compositionstart",O),T.removeEventListener("compositionend",k)),P&&T.removeEventListener(c,L?$:S,L),B.forEach(R=>{R.removeEventListener("scroll",y)}),window.clearTimeout(M)}},[s,o,l,P,c,n,r,p,i,E,A,m,D,v,S,L,$]),U.useEffect(()=>{s.current.insideReactTree=!1},[s,P,c]);const I=U.useMemo(()=>({onKeyDown:m,...u&&{[BS[f]]:M=>{r(!1,M.nativeEvent,"reference-press")},...f!=="click"&&{onClick(M){r(!1,M.nativeEvent,"reference-press")}}}}),[m,r,u,f]),C=U.useMemo(()=>{function M(y){y.button===0&&(x.current=!0)}return{onKeyDown:m,onMouseDown:M,onMouseUp:M,[LS[c]]:()=>{s.current.insideReactTree=!0}}},[m,c,s]);return U.useMemo(()=>i?{reference:I,floating:C}:{},[i,I,C])}function RS(e){const{open:t=!1,onOpenChange:n,elements:r}=e,o=Mc(),s=U.useRef({}),[i]=U.useState(()=>PS()),l=Bc()!=null;if(process.env.NODE_ENV!=="production"){const d=r.reference;d&&!me(d)&&SS("Cannot pass a virtual element to the `elements.reference` option,","as it must be a real DOM element. Use `refs.setPositionReference()`","instead.")}const[a,c]=U.useState(r.reference),u=rn((d,h,b)=>{s.current.openEvent=d?h:void 0,i.emit("openchange",{open:d,event:h,reason:b,nested:l}),n==null||n(d,h,b)}),f=U.useMemo(()=>({setPositionReference:c}),[]),p=U.useMemo(()=>({reference:a||r.reference||null,floating:r.floating||null,domReference:r.reference}),[a,r.reference,r.floating]);return U.useMemo(()=>({dataRef:s,open:t,onOpenChange:u,elements:p,events:i,floatingId:o,refs:f}),[t,u,p,i,o,f])}function jS(e){e===void 0&&(e={});const{nodeId:t}=e,n=RS({...e,elements:{reference:null,floating:null,...e.elements}}),r=e.rootContext||n,o=r.elements,[s,i]=U.useState(null),[l,a]=U.useState(null),u=(o==null?void 0:o.domReference)||s,f=U.useRef(null),p=Lc();nn(()=>{u&&(f.current=u)},[u]);const d=oh({...e,elements:{...o,...l&&{reference:l}}}),h=U.useCallback(E=>{const A=me(E)?{getBoundingClientRect:()=>E.getBoundingClientRect(),getClientRects:()=>E.getClientRects(),contextElement:E}:E;a(A),d.refs.setReference(A)},[d.refs]),b=U.useCallback(E=>{(me(E)||E===null)&&(f.current=E,i(E)),(me(d.refs.reference.current)||d.refs.reference.current===null||E!==null&&!me(E))&&d.refs.setReference(E)},[d.refs]),w=U.useMemo(()=>({...d.refs,setReference:b,setPositionReference:h,domReference:f}),[d.refs,b,h]),P=U.useMemo(()=>({...d.elements,domReference:u}),[d.elements,u]),x=U.useMemo(()=>({...d,...r,refs:w,elements:P,nodeId:t}),[d,w,P,t,r]);return nn(()=>{r.dataRef.current.floatingContext=x;const E=p==null?void 0:p.nodesRef.current.find(A=>A.id===t);E&&(E.context=x)}),U.useMemo(()=>({...d,context:x,refs:w,elements:P}),[d,w,P,x])}function jc(){return sS()&&sm()}function zS(e,t){t===void 0&&(t={});const{open:n,onOpenChange:r,events:o,dataRef:s,elements:i}=e,{enabled:l=!0,visibleOnly:a=!0}=t,c=U.useRef(!1),u=U.useRef(-1),f=U.useRef(!0);U.useEffect(()=>{if(!l)return;const d=ot(i.domReference);function h(){!n&&st(i.domReference)&&i.domReference===Ic(tn(i.domReference))&&(c.current=!0)}function b(){f.current=!0}function w(){f.current=!1}return d.addEventListener("blur",h),jc()&&(d.addEventListener("keydown",b,!0),d.addEventListener("pointerdown",w,!0)),()=>{d.removeEventListener("blur",h),jc()&&(d.removeEventListener("keydown",b,!0),d.removeEventListener("pointerdown",w,!0))}},[i.domReference,n,l]),U.useEffect(()=>{if(!l)return;function d(h){let{reason:b}=h;(b==="reference-press"||b==="escape-key")&&(c.current=!0)}return o.on("openchange",d),()=>{o.off("openchange",d)}},[o,l]),U.useEffect(()=>()=>{Ct(u)},[]);const p=U.useMemo(()=>({onMouseLeave(){c.current=!1},onFocus(d){if(c.current)return;const h=Zr(d.nativeEvent);if(a&&me(h)){if(jc()&&!d.relatedTarget){if(!f.current&&!am(h))return}else if(!cS(h))return}r(!0,d.nativeEvent,"focus")},onBlur(d){c.current=!1;const h=d.relatedTarget,b=d.nativeEvent,w=me(h)&&h.hasAttribute(ls("focus-guard"))&&h.getAttribute("data-type")==="outside";u.current=window.setTimeout(()=>{var P;const x=Ic(i.domReference?i.domReference.ownerDocument:document);!h&&x===i.domReference||Kr((P=s.current.floatingContext)==null?void 0:P.refs.floating.current,x)||Kr(i.domReference,x)||w||r(!1,b,"focus")})}}),[s,i.domReference,r,a]);return U.useMemo(()=>l?{reference:p}:{},[l,p])}function zc(e,t,n){const r=new Map,o=n==="item";let s=e;if(o&&e){const{[fm]:i,[dm]:l,...a}=e;s=a}return{...n==="floating"&&{tabIndex:-1,[vS]:""},...s,...t.map(i=>{const l=i?i[n]:null;return typeof l=="function"?e?l(e):null:l}).concat(e).reduce((i,l)=>(l&&Object.entries(l).forEach(a=>{let[c,u]=a;if(!(o&&[fm,dm].includes(c)))if(c.indexOf("on")===0){if(r.has(c)||r.set(c,[]),typeof u=="function"){var f;(f=r.get(c))==null||f.push(u),i[c]=function(){for(var p,d=arguments.length,h=new Array(d),b=0;b<d;b++)h[b]=arguments[b];return(p=r.get(c))==null?void 0:p.map(w=>w(...h)).find(w=>w!==void 0)}}}else i[c]=u}),i),{})}}function US(e){e===void 0&&(e=[]);const t=e.map(l=>l==null?void 0:l.reference),n=e.map(l=>l==null?void 0:l.floating),r=e.map(l=>l==null?void 0:l.item),o=U.useCallback(l=>zc(l,e,"reference"),t),s=U.useCallback(l=>zc(l,e,"floating"),n),i=U.useCallback(l=>zc(l,e,"item"),r);return U.useMemo(()=>({getReferenceProps:o,getFloatingProps:s,getItemProps:i}),[o,s,i])}const _S=new Map([["select","listbox"],["combobox","listbox"],["label",!1]]);function WS(e,t){var n,r;t===void 0&&(t={});const{open:o,elements:s,floatingId:i}=e,{enabled:l=!0,role:a="dialog"}=t,c=Mc(),u=((n=s.domReference)==null?void 0:n.id)||c,f=U.useMemo(()=>{var x;return((x=uS(s.floating))==null?void 0:x.id)||i},[s.floating,i]),p=(r=_S.get(a))!=null?r:a,h=Bc()!=null,b=U.useMemo(()=>p==="tooltip"||a==="label"?{["aria-"+(a==="label"?"labelledby":"describedby")]:o?f:void 0}:{"aria-expanded":o?"true":"false","aria-haspopup":p==="alertdialog"?"dialog":p,"aria-controls":o?f:void 0,...p==="listbox"&&{role:"combobox"},...p==="menu"&&{id:u},...p==="menu"&&h&&{role:"menuitem"},...a==="select"&&{"aria-autocomplete":"none"},...a==="combobox"&&{"aria-autocomplete":"list"}},[p,f,h,o,u,a]),w=U.useMemo(()=>{const x={id:f,...p&&{role:p}};return p==="tooltip"||a==="label"?x:{...x,...p==="menu"&&{"aria-labelledby":u}}},[p,f,u,a]),P=U.useCallback(x=>{let{active:E,selected:A}=x;const D={role:"option",...E&&{id:f+"-fui-option"}};switch(a){case"select":case"combobox":return{...D,"aria-selected":A}}return{}},[f,a]);return U.useMemo(()=>l?{reference:b,floating:w,item:P}:{},[l,b,w,P])}const Em=g.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 N.jsx("div",{ref:n,className:`absolute w-0 h-0 ${t}`,style:o})});Em.displayName="TooltipArrow";const Tn=({children:e,content:t,placement:n="top",delay:r=200,showArrow:o=!0,className:s="",disabled:i=!1,maxWidth:l="max-w-xs",trigger:a=["hover","focus"]})=>{const[c,u]=g.useState(!1),f=g.useRef(null),{refs:p,floatingStyles:d,context:h}=jS({open:c&&!i,onOpenChange:u,placement:n,whileElementsMounted:eh,middleware:[hc(o?12:8),ih({fallbackAxisSideDirection:"start",padding:8}),sh({padding:8}),...o?[n8({element:f})]:[]]}),b=NS(h,{enabled:a.includes("hover"),delay:{open:r,close:150}}),w=zS(h,{enabled:a.includes("focus")}),P=DS(h,{enabled:a.includes("click")}),x=FS(h),E=WS(h,{role:"tooltip"}),{getReferenceProps:A,getFloatingProps:D}=US([b,w,P,x,E]);return i?N.jsx(N.Fragment,{children:e}):N.jsxs(N.Fragment,{children:[N.jsx("div",{ref:p.setReference,...A(),style:{cursor:"help"},children:e}),c&&N.jsx($S,{children:N.jsx("div",{className:"edgex-components",children:N.jsxs("div",{ref:p.setFloating,...D(),style:{...d,zIndex:101},className:`
177
+ */var Z3={L:qr.QrCode.Ecc.LOW,M:qr.QrCode.Ecc.MEDIUM,Q:qr.QrCode.Ecc.QUARTILE,H:qr.QrCode.Ecc.HIGH},Zh=128,Yh="L",Xh="#FFFFFF",Jh="#000000",Qh=!1,em=1,Y3=4,X3=0,J3=.1;function tm(e,t=0){const n=[];return e.forEach(function(r,o){let s=null;r.forEach(function(i,l){if(!i&&s!==null){n.push(`M${s+t} ${o+t}h${l-s}v1H${s+t}z`),s=null;return}if(l===r.length-1){if(!i)return;s===null?n.push(`M${l+t},${o+t} h1v1H${l+t}z`):n.push(`M${s+t},${o+t} h${l+1-s}v1H${s+t}z`);return}i&&s===null&&(s=l)})}),n.join("")}function nm(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 Q3(e,t,n,r){if(r==null)return null;const o=e.length+n*2,s=Math.floor(t*J3),i=o/t,l=(r.width||s)*i,a=(r.height||s)*i,c=r.x==null?e.length/2-l/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(c),b=Math.floor(u),v=Math.ceil(l+c-h),P=Math.ceil(a+u-b);p={x:h,y:b,w:v,h:P}}const d=r.crossOrigin;return{x:c,y:u,h:a,w:l,excavation:p,opacity:f,crossOrigin:d}}function eS(e,t){return t!=null?Math.max(Math.floor(t),0):e?Y3:X3}function rm({value:e,level:t,minVersion:n,includeMargin:r,marginSize:o,imageSettings:s,size:i,boostLevel:l}){let a=g.useMemo(()=>{const h=(Array.isArray(e)?e:[e]).reduce((b,v)=>(b.push(...qr.QrSegment.makeSegments(v)),b),[]);return qr.QrCode.encodeSegments(h,Z3[t],n,void 0,void 0,l)},[e,t,n,l]);const{cells:c,margin:u,numCells:f,calculatedImageSettings:p}=g.useMemo(()=>{let d=a.getModules();const h=eS(r,o),b=d.length+h*2,v=Q3(d,i,h,s);return{cells:d,margin:h,numCells:b,calculatedImageSettings:v}},[a,i,s,r,o]);return{qrcode:a,margin:u,cells:c,numCells:f,calculatedImageSettings:p}}var tS=function(){try{new Path2D().addPath(new Path2D)}catch{return!1}return!0}(),nS=g.forwardRef(function(t,n){const r=t,{value:o,size:s=Zh,level:i=Yh,bgColor:l=Xh,fgColor:a=Jh,includeMargin:c=Qh,minVersion:u=em,boostLevel:f,marginSize:p,imageSettings:d}=r,b=Oc(r,["value","size","level","bgColor","fgColor","includeMargin","minVersion","boostLevel","marginSize","imageSettings"]),{style:v}=b,P=Oc(b,["style"]),x=d==null?void 0:d.src,E=g.useRef(null),N=g.useRef(null),D=g.useCallback(k=>{E.current=k,typeof n=="function"?n(k):n&&(n.current=k)},[n]),[F,L]=g.useState(!1),{margin:m,cells:w,numCells:S,calculatedImageSettings:$}=rm({value:o,level:i,minVersion:u,boostLevel:f,includeMargin:c,marginSize:p,imageSettings:d,size:s});g.useEffect(()=>{if(E.current!=null){const k=E.current,y=k.getContext("2d");if(!y)return;let O=w;const M=N.current,T=$!=null&&M!==null&&M.complete&&M.naturalHeight!==0&&M.naturalWidth!==0;T&&$.excavation!=null&&(O=nm(w,$.excavation));const B=window.devicePixelRatio||1;k.height=k.width=s*B;const R=s/S*B;y.scale(R,R),y.fillStyle=l,y.fillRect(0,0,S,S),y.fillStyle=a,tS?y.fill(new Path2D(tm(O,m))):w.forEach(function(z,W){z.forEach(function(G,J){G&&y.fillRect(J+m,W+m,1,1)})}),$&&(y.globalAlpha=$.opacity),T&&y.drawImage(M,$.x+m,$.y+m,$.w,$.h)}}),g.useEffect(()=>{L(!1)},[x]);const I=Cc({height:s,width:s},v);let A=null;return x!=null&&(A=g.createElement("img",{src:x,key:x,style:{display:"none"},onLoad:()=>{L(!0)},ref:N,crossOrigin:$==null?void 0:$.crossOrigin})),g.createElement(g.Fragment,null,g.createElement("canvas",Cc({style:I,height:s,width:s,ref:D,role:"img"},P)),A)});nS.displayName="QRCodeCanvas";var om=g.forwardRef(function(t,n){const r=t,{value:o,size:s=Zh,level:i=Yh,bgColor:l=Xh,fgColor:a=Jh,includeMargin:c=Qh,minVersion:u=em,boostLevel:f,title:p,marginSize:d,imageSettings:h}=r,b=Oc(r,["value","size","level","bgColor","fgColor","includeMargin","minVersion","boostLevel","title","marginSize","imageSettings"]),{margin:v,cells:P,numCells:x,calculatedImageSettings:E}=rm({value:o,level:i,minVersion:u,boostLevel:f,includeMargin:c,marginSize:d,imageSettings:h,size:s});let N=P,D=null;h!=null&&E!=null&&(E.excavation!=null&&(N=nm(P,E.excavation)),D=g.createElement("image",{href:h.src,height:E.h,width:E.w,x:E.x+v,y:E.y+v,preserveAspectRatio:"none",opacity:E.opacity,crossOrigin:E.crossOrigin}));const F=tm(N,v);return g.createElement("svg",Cc({height:s,width:s,viewBox:`0 0 ${x} ${x}`,ref:n,role:"img"},b),!!p&&g.createElement("title",null,p),g.createElement("path",{fill:l,d:`M0,0 h${x}v${x}H0z`,shapeRendering:"crispEdges"}),g.createElement("path",{fill:a,d:F,shapeRendering:"crispEdges"}),D)});om.displayName="QRCodeSVG";function rS(){const e=navigator.userAgentData;return e!=null&&e.platform?e.platform:navigator.platform}function oS(){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 sm(){return/apple/i.test(navigator.vendor)}function sS(){return rS().toLowerCase().startsWith("mac")&&!navigator.maxTouchPoints}function iS(){return oS().includes("jsdom/")}const im="data-floating-ui-focusable",aS="input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])";function Ic(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 Kr(e,t){if(!e||!t)return!1;const n=t.getRootNode==null?void 0:t.getRootNode();if(e.contains(t))return!0;if(n&&ec(n)){let r=t;for(;r;){if(e===r)return!0;r=r.parentNode||r.host}}return!1}function Zr(e){return"composedPath"in e?e.composedPath()[0]:e.target}function $c(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 lS(e){return e.matches("html,body")}function tn(e){return(e==null?void 0:e.ownerDocument)||document}function am(e){return st(e)&&e.matches(aS)}function cS(e){if(!e||iS())return!0;try{return e.matches(":focus-visible")}catch{return!0}}function uS(e){return e?e.hasAttribute(im)?e:e.querySelector("["+im+"]")||e:null}function $i(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,...$i(e,o.id,n)])}function fS(e){return"nativeEvent"in e}function ls(e,t){const n=["mouse","pen"];return t||n.push("",void 0),n.includes(e)}var dS=typeof document<"u",pS=function(){},nn=dS?g.useLayoutEffect:pS;const hS={...U};function ki(e){const t=U.useRef(e);return nn(()=>{t.current=e}),t}const mS=hS.useInsertionEffect||(e=>e());function rn(e){const t=U.useRef(()=>{if(process.env.NODE_ENV!=="production")throw new Error("Cannot call an event handler while rendering.")});return mS(()=>{t.current=e}),U.useCallback(function(){for(var n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return t.current==null?void 0:t.current(...r)},[])}const lm=()=>({getShadowRoot:!0,displayCheck:typeof ResizeObserver=="function"&&ResizeObserver.toString().includes("[native code]")?"full":"none"});function cm(e,t){const n=Wp(e,lm()),r=n.length;if(r===0)return;const o=Ic(tn(e)),s=n.indexOf(o),i=s===-1?t===1?0:r-1:s+t;return n[i]}function bS(e){return cm(tn(e).body,1)||e}function gS(e){return cm(tn(e).body,-1)||e}function kc(e,t){const n=t||e.currentTarget,r=e.relatedTarget;return!r||!Kr(n,r)}function yS(e){Wp(e,lm()).forEach(n=>{n.dataset.tabindex=n.getAttribute("tabindex")||"",n.setAttribute("tabindex","-1")})}function um(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 vS="data-floating-ui-focusable",fm="active",dm="selected",wS={...U};let pm=!1,xS=0;const hm=()=>"floating-ui-"+Math.random().toString(36).slice(2,6)+xS++;function ES(){const[e,t]=U.useState(()=>pm?hm():void 0);return nn(()=>{e==null&&t(hm())},[]),U.useEffect(()=>{pm=!0},[]),e}const Mc=wS.useId||ES;let Dc;process.env.NODE_ENV!=="production"&&(Dc=new Set);function SS(){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=Dc)!=null&&e.has(o))){var s;(s=Dc)==null||s.add(o),console.error(o)}}function PS(){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 TS=U.createContext(null),AS=U.createContext(null),Bc=()=>{var e;return((e=U.useContext(TS))==null?void 0:e.id)||null},Lc=()=>U.useContext(AS);function cs(e){return"data-floating-ui-"+e}function Ct(e){e.current!==-1&&(clearTimeout(e.current),e.current=-1)}const mm=cs("safe-polygon");function Fc(e,t,n){if(n&&!ls(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 Rc(e){return typeof e=="function"?e():e}function NS(e,t){t===void 0&&(t={});const{open:n,onOpenChange:r,dataRef:o,events:s,elements:i}=e,{enabled:l=!0,delay:a=0,handleClose:c=null,mouseOnly:u=!1,restMs:f=0,move:p=!0}=t,d=Lc(),h=Bc(),b=ki(c),v=ki(a),P=ki(n),x=ki(f),E=U.useRef(),N=U.useRef(-1),D=U.useRef(),F=U.useRef(-1),L=U.useRef(!0),m=U.useRef(!1),w=U.useRef(()=>{}),S=U.useRef(!1),$=rn(()=>{var M;const T=(M=o.current.openEvent)==null?void 0:M.type;return(T==null?void 0:T.includes("mouse"))&&T!=="mousedown"});U.useEffect(()=>{if(!l)return;function M(T){let{open:B}=T;B||(Ct(N),Ct(F),L.current=!0,S.current=!1)}return s.on("openchange",M),()=>{s.off("openchange",M)}},[l,s]),U.useEffect(()=>{if(!l||!b.current||!n)return;function M(B){$()&&r(!1,B,"hover")}const T=tn(i.floating).documentElement;return T.addEventListener("mouseleave",M),()=>{T.removeEventListener("mouseleave",M)}},[i.floating,n,r,l,b,$]);const I=U.useCallback(function(M,T,B){T===void 0&&(T=!0),B===void 0&&(B="hover");const R=Fc(v.current,"close",E.current);R&&!D.current?(Ct(N),N.current=window.setTimeout(()=>r(!1,M,B),R)):T&&(Ct(N),r(!1,M,B))},[v,r]),A=rn(()=>{w.current(),D.current=void 0}),k=rn(()=>{if(m.current){const M=tn(i.floating).body;M.style.pointerEvents="",M.removeAttribute(mm),m.current=!1}}),y=rn(()=>o.current.openEvent?["click","mousedown"].includes(o.current.openEvent.type):!1);U.useEffect(()=>{if(!l)return;function M(W){if(Ct(N),L.current=!1,u&&!ls(E.current)||Rc(x.current)>0&&!Fc(v.current,"open"))return;const G=Fc(v.current,"open",E.current);G?N.current=window.setTimeout(()=>{P.current||r(!0,W,"hover")},G):n||r(!0,W,"hover")}function T(W){if(y()){k();return}w.current();const G=tn(i.floating);if(Ct(F),S.current=!1,b.current&&o.current.floatingContext){n||Ct(N),D.current=b.current({...o.current.floatingContext,tree:d,x:W.clientX,y:W.clientY,onClose(){k(),A(),y()||I(W,!0,"safe-polygon")}});const K=D.current;G.addEventListener("mousemove",K),w.current=()=>{G.removeEventListener("mousemove",K)};return}(E.current==="touch"?!Kr(i.floating,W.relatedTarget):!0)&&I(W)}function B(W){y()||o.current.floatingContext&&(b.current==null||b.current({...o.current.floatingContext,tree:d,x:W.clientX,y:W.clientY,onClose(){k(),A(),y()||I(W)}})(W))}function R(){Ct(N)}function z(W){y()||I(W,!1)}if(me(i.domReference)){const W=i.domReference,G=i.floating;return n&&W.addEventListener("mouseleave",B),p&&W.addEventListener("mousemove",M,{once:!0}),W.addEventListener("mouseenter",M),W.addEventListener("mouseleave",T),G&&(G.addEventListener("mouseleave",B),G.addEventListener("mouseenter",R),G.addEventListener("mouseleave",z)),()=>{n&&W.removeEventListener("mouseleave",B),p&&W.removeEventListener("mousemove",M),W.removeEventListener("mouseenter",M),W.removeEventListener("mouseleave",T),G&&(G.removeEventListener("mouseleave",B),G.removeEventListener("mouseenter",R),G.removeEventListener("mouseleave",z))}}},[i,l,e,u,p,I,A,k,r,n,P,d,v,b,o,y,x]),nn(()=>{var M;if(l&&n&&(M=b.current)!=null&&(M=M.__options)!=null&&M.blockPointerEvents&&$()){m.current=!0;const B=i.floating;if(me(i.domReference)&&B){var T;const R=tn(i.floating).body;R.setAttribute(mm,"");const z=i.domReference,W=d==null||(T=d.nodesRef.current.find(G=>G.id===h))==null||(T=T.context)==null?void 0:T.elements.floating;return W&&(W.style.pointerEvents=""),R.style.pointerEvents="none",z.style.pointerEvents="auto",B.style.pointerEvents="auto",()=>{R.style.pointerEvents="",z.style.pointerEvents="",B.style.pointerEvents=""}}}},[l,n,h,i,d,b,$]),nn(()=>{n||(E.current=void 0,S.current=!1,A(),k())},[n,A,k]),U.useEffect(()=>()=>{A(),Ct(N),Ct(F),k()},[l,i.domReference,A,k]);const O=U.useMemo(()=>{function M(T){E.current=T.pointerType}return{onPointerDown:M,onPointerEnter:M,onMouseMove(T){const{nativeEvent:B}=T;function R(){!L.current&&!P.current&&r(!0,B,"hover")}u&&!ls(E.current)||n||Rc(x.current)===0||S.current&&T.movementX**2+T.movementY**2<2||(Ct(F),E.current==="touch"?R():(S.current=!0,F.current=window.setTimeout(R,Rc(x.current))))}}},[u,r,n,P,x]);return U.useMemo(()=>l?{reference:O}:{},[l,O])}const CS={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},bm=U.forwardRef(function(t,n){const[r,o]=U.useState();nn(()=>{sm()&&o("button")},[]);const s={ref:n,tabIndex:0,role:r,"aria-hidden":r?void 0:!0,[cs("focus-guard")]:"",style:CS};return C.jsx("span",{...t,...s})}),OS={clipPath:"inset(50%)",position:"fixed",top:0,left:0},gm=U.createContext(null),ym=cs("portal");function IS(e){e===void 0&&(e={});const{id:t,root:n}=e,r=Mc(),o=kS(),[s,i]=U.useState(null),l=U.useRef(null);return nn(()=>()=>{s==null||s.remove(),queueMicrotask(()=>{l.current=null})},[s]),nn(()=>{if(!r||l.current)return;const a=t?document.getElementById(t):null;if(!a)return;const c=document.createElement("div");c.id=r,c.setAttribute(ym,""),a.appendChild(c),l.current=c,i(c)},[t,r]),nn(()=>{if(n===null||!r||l.current)return;let a=n||(o==null?void 0:o.portalNode);a&&!Ql(a)&&(a=a.current),a=a||document.body;let c=null;t&&(c=document.createElement("div"),c.id=t,a.appendChild(c));const u=document.createElement("div");u.id=r,u.setAttribute(ym,""),a=c||a,a.appendChild(u),l.current=u,i(u)},[t,n,r,o]),s}function $S(e){const{children:t,id:n,root:r,preserveTabOrder:o=!0}=e,s=IS({id:n,root:r}),[i,l]=U.useState(null),a=U.useRef(null),c=U.useRef(null),u=U.useRef(null),f=U.useRef(null),p=i==null?void 0:i.modal,d=i==null?void 0:i.open,h=!!i&&!i.modal&&i.open&&o&&!!(r||s);return U.useEffect(()=>{if(!s||!o||p)return;function b(v){s&&kc(v)&&(v.type==="focusin"?um:yS)(s)}return s.addEventListener("focusin",b,!0),s.addEventListener("focusout",b,!0),()=>{s.removeEventListener("focusin",b,!0),s.removeEventListener("focusout",b,!0)}},[s,o,p]),U.useEffect(()=>{s&&(d||um(s))},[d,s]),C.jsxs(gm.Provider,{value:U.useMemo(()=>({preserveTabOrder:o,beforeOutsideRef:a,afterOutsideRef:c,beforeInsideRef:u,afterInsideRef:f,portalNode:s,setFocusManagerState:l}),[o,s]),children:[h&&s&&C.jsx(bm,{"data-type":"outside",ref:a,onFocus:b=>{if(kc(b,s)){var v;(v=u.current)==null||v.focus()}else{const P=i?i.domReference:null,x=gS(P);x==null||x.focus()}}}),h&&s&&C.jsx("span",{"aria-owns":s.id,style:OS}),s&&Qr.createPortal(t,s),h&&s&&C.jsx(bm,{"data-type":"outside",ref:c,onFocus:b=>{if(kc(b,s)){var v;(v=f.current)==null||v.focus()}else{const P=i?i.domReference:null,x=bS(P);x==null||x.focus(),i!=null&&i.closeOnFocusOut&&(i==null||i.onOpenChange(!1,b.nativeEvent,"focus-out"))}}})]})}const kS=()=>U.useContext(gm);function vm(e){return st(e.target)&&e.target.tagName==="BUTTON"}function MS(e){return st(e.target)&&e.target.tagName==="A"}function wm(e){return am(e)}function DS(e,t){t===void 0&&(t={});const{open:n,onOpenChange:r,dataRef:o,elements:{domReference:s}}=e,{enabled:i=!0,event:l="click",toggle:a=!0,ignoreMouse:c=!1,keyboardHandlers:u=!0,stickIfOpen:f=!0}=t,p=U.useRef(),d=U.useRef(!1),h=U.useMemo(()=>({onPointerDown(b){p.current=b.pointerType},onMouseDown(b){const v=p.current;b.button===0&&l!=="click"&&(ls(v,!0)&&c||(n&&a&&(!(o.current.openEvent&&f)||o.current.openEvent.type==="mousedown")?r(!1,b.nativeEvent,"click"):(b.preventDefault(),r(!0,b.nativeEvent,"click"))))},onClick(b){const v=p.current;if(l==="mousedown"&&p.current){p.current=void 0;return}ls(v,!0)&&c||(n&&a&&(!(o.current.openEvent&&f)||o.current.openEvent.type==="click")?r(!1,b.nativeEvent,"click"):r(!0,b.nativeEvent,"click"))},onKeyDown(b){p.current=void 0,!(b.defaultPrevented||!u||vm(b))&&(b.key===" "&&!wm(s)&&(b.preventDefault(),d.current=!0),!MS(b)&&b.key==="Enter"&&r(!(n&&a),b.nativeEvent,"click"))},onKeyUp(b){b.defaultPrevented||!u||vm(b)||wm(s)||b.key===" "&&d.current&&(d.current=!1,r(!(n&&a),b.nativeEvent,"click"))}}),[o,s,l,c,u,r,n,f,a]);return U.useMemo(()=>i?{reference:h}:{},[i,h])}const BS={pointerdown:"onPointerDown",mousedown:"onMouseDown",click:"onClick"},LS={pointerdown:"onPointerDownCapture",mousedown:"onMouseDownCapture",click:"onClickCapture"},xm=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 FS(e,t){t===void 0&&(t={});const{open:n,onOpenChange:r,elements:o,dataRef:s}=e,{enabled:i=!0,escapeKey:l=!0,outsidePress:a=!0,outsidePressEvent:c="pointerdown",referencePress:u=!1,referencePressEvent:f="pointerdown",ancestorScroll:p=!1,bubbles:d,capture:h}=t,b=Lc(),v=rn(typeof a=="function"?a:()=>!1),P=typeof a=="function"?v:a,x=U.useRef(!1),{escapeKey:E,outsidePress:N}=xm(d),{escapeKey:D,outsidePress:F}=xm(h),L=U.useRef(!1),m=rn(k=>{var y;if(!n||!i||!l||k.key!=="Escape"||L.current)return;const O=(y=s.current.floatingContext)==null?void 0:y.nodeId,M=b?$i(b.nodesRef.current,O):[];if(!E&&(k.stopPropagation(),M.length>0)){let T=!0;if(M.forEach(B=>{var R;if((R=B.context)!=null&&R.open&&!B.context.dataRef.current.__escapeKeyBubbles){T=!1;return}}),!T)return}r(!1,fS(k)?k.nativeEvent:k,"escape-key")}),w=rn(k=>{var y;const O=()=>{var M;m(k),(M=Zr(k))==null||M.removeEventListener("keydown",O)};(y=Zr(k))==null||y.addEventListener("keydown",O)}),S=rn(k=>{var y;const O=s.current.insideReactTree;s.current.insideReactTree=!1;const M=x.current;if(x.current=!1,c==="click"&&M||O||typeof P=="function"&&!P(k))return;const T=Zr(k),B="["+cs("inert")+"]",R=tn(o.floating).querySelectorAll(B);let z=me(T)?T:null;for(;z&&!wn(z);){const K=xn(z);if(wn(K)||!me(K))break;z=K}if(R.length&&me(T)&&!lS(T)&&!Kr(T,o.floating)&&Array.from(R).every(K=>!Kr(z,K)))return;if(st(T)&&A){const K=wn(T),_=At(T),ne=/auto|scroll/,be=K||ne.test(_.overflowX),fe=K||ne.test(_.overflowY),xe=be&&T.clientWidth>0&&T.scrollWidth>T.clientWidth,ye=fe&&T.clientHeight>0&&T.scrollHeight>T.clientHeight,Y=_.direction==="rtl",H=ye&&(Y?k.offsetX<=T.offsetWidth-T.clientWidth:k.offsetX>T.clientWidth),ee=xe&&k.offsetY>T.clientHeight;if(H||ee)return}const W=(y=s.current.floatingContext)==null?void 0:y.nodeId,G=b&&$i(b.nodesRef.current,W).some(K=>{var _;return $c(k,(_=K.context)==null?void 0:_.elements.floating)});if($c(k,o.floating)||$c(k,o.domReference)||G)return;const J=b?$i(b.nodesRef.current,W):[];if(J.length>0){let K=!0;if(J.forEach(_=>{var ne;if((ne=_.context)!=null&&ne.open&&!_.context.dataRef.current.__outsidePressBubbles){K=!1;return}}),!K)return}r(!1,k,"outside-press")}),$=rn(k=>{var y;const O=()=>{var M;S(k),(M=Zr(k))==null||M.removeEventListener(c,O)};(y=Zr(k))==null||y.addEventListener(c,O)});U.useEffect(()=>{if(!n||!i)return;s.current.__escapeKeyBubbles=E,s.current.__outsidePressBubbles=N;let k=-1;function y(R){r(!1,R,"ancestor-scroll")}function O(){window.clearTimeout(k),L.current=!0}function M(){k=window.setTimeout(()=>{L.current=!1},ui()?5:0)}const T=tn(o.floating);l&&(T.addEventListener("keydown",D?w:m,D),T.addEventListener("compositionstart",O),T.addEventListener("compositionend",M)),P&&T.addEventListener(c,F?$:S,F);let B=[];return p&&(me(o.domReference)&&(B=zn(o.domReference)),me(o.floating)&&(B=B.concat(zn(o.floating))),!me(o.reference)&&o.reference&&o.reference.contextElement&&(B=B.concat(zn(o.reference.contextElement)))),B=B.filter(R=>{var z;return R!==((z=T.defaultView)==null?void 0:z.visualViewport)}),B.forEach(R=>{R.addEventListener("scroll",y,{passive:!0})}),()=>{l&&(T.removeEventListener("keydown",D?w:m,D),T.removeEventListener("compositionstart",O),T.removeEventListener("compositionend",M)),P&&T.removeEventListener(c,F?$:S,F),B.forEach(R=>{R.removeEventListener("scroll",y)}),window.clearTimeout(k)}},[s,o,l,P,c,n,r,p,i,E,N,m,D,w,S,F,$]),U.useEffect(()=>{s.current.insideReactTree=!1},[s,P,c]);const I=U.useMemo(()=>({onKeyDown:m,...u&&{[BS[f]]:k=>{r(!1,k.nativeEvent,"reference-press")},...f!=="click"&&{onClick(k){r(!1,k.nativeEvent,"reference-press")}}}}),[m,r,u,f]),A=U.useMemo(()=>{function k(y){y.button===0&&(x.current=!0)}return{onKeyDown:m,onMouseDown:k,onMouseUp:k,[LS[c]]:()=>{s.current.insideReactTree=!0}}},[m,c,s]);return U.useMemo(()=>i?{reference:I,floating:A}:{},[i,I,A])}function RS(e){const{open:t=!1,onOpenChange:n,elements:r}=e,o=Mc(),s=U.useRef({}),[i]=U.useState(()=>PS()),l=Bc()!=null;if(process.env.NODE_ENV!=="production"){const d=r.reference;d&&!me(d)&&SS("Cannot pass a virtual element to the `elements.reference` option,","as it must be a real DOM element. Use `refs.setPositionReference()`","instead.")}const[a,c]=U.useState(r.reference),u=rn((d,h,b)=>{s.current.openEvent=d?h:void 0,i.emit("openchange",{open:d,event:h,reason:b,nested:l}),n==null||n(d,h,b)}),f=U.useMemo(()=>({setPositionReference:c}),[]),p=U.useMemo(()=>({reference:a||r.reference||null,floating:r.floating||null,domReference:r.reference}),[a,r.reference,r.floating]);return U.useMemo(()=>({dataRef:s,open:t,onOpenChange:u,elements:p,events:i,floatingId:o,refs:f}),[t,u,p,i,o,f])}function jS(e){e===void 0&&(e={});const{nodeId:t}=e,n=RS({...e,elements:{reference:null,floating:null,...e.elements}}),r=e.rootContext||n,o=r.elements,[s,i]=U.useState(null),[l,a]=U.useState(null),u=(o==null?void 0:o.domReference)||s,f=U.useRef(null),p=Lc();nn(()=>{u&&(f.current=u)},[u]);const d=oh({...e,elements:{...o,...l&&{reference:l}}}),h=U.useCallback(E=>{const N=me(E)?{getBoundingClientRect:()=>E.getBoundingClientRect(),getClientRects:()=>E.getClientRects(),contextElement:E}:E;a(N),d.refs.setReference(N)},[d.refs]),b=U.useCallback(E=>{(me(E)||E===null)&&(f.current=E,i(E)),(me(d.refs.reference.current)||d.refs.reference.current===null||E!==null&&!me(E))&&d.refs.setReference(E)},[d.refs]),v=U.useMemo(()=>({...d.refs,setReference:b,setPositionReference:h,domReference:f}),[d.refs,b,h]),P=U.useMemo(()=>({...d.elements,domReference:u}),[d.elements,u]),x=U.useMemo(()=>({...d,...r,refs:v,elements:P,nodeId:t}),[d,v,P,t,r]);return nn(()=>{r.dataRef.current.floatingContext=x;const E=p==null?void 0:p.nodesRef.current.find(N=>N.id===t);E&&(E.context=x)}),U.useMemo(()=>({...d,context:x,refs:v,elements:P}),[d,v,P,x])}function jc(){return sS()&&sm()}function zS(e,t){t===void 0&&(t={});const{open:n,onOpenChange:r,events:o,dataRef:s,elements:i}=e,{enabled:l=!0,visibleOnly:a=!0}=t,c=U.useRef(!1),u=U.useRef(-1),f=U.useRef(!0);U.useEffect(()=>{if(!l)return;const d=ot(i.domReference);function h(){!n&&st(i.domReference)&&i.domReference===Ic(tn(i.domReference))&&(c.current=!0)}function b(){f.current=!0}function v(){f.current=!1}return d.addEventListener("blur",h),jc()&&(d.addEventListener("keydown",b,!0),d.addEventListener("pointerdown",v,!0)),()=>{d.removeEventListener("blur",h),jc()&&(d.removeEventListener("keydown",b,!0),d.removeEventListener("pointerdown",v,!0))}},[i.domReference,n,l]),U.useEffect(()=>{if(!l)return;function d(h){let{reason:b}=h;(b==="reference-press"||b==="escape-key")&&(c.current=!0)}return o.on("openchange",d),()=>{o.off("openchange",d)}},[o,l]),U.useEffect(()=>()=>{Ct(u)},[]);const p=U.useMemo(()=>({onMouseLeave(){c.current=!1},onFocus(d){if(c.current)return;const h=Zr(d.nativeEvent);if(a&&me(h)){if(jc()&&!d.relatedTarget){if(!f.current&&!am(h))return}else if(!cS(h))return}r(!0,d.nativeEvent,"focus")},onBlur(d){c.current=!1;const h=d.relatedTarget,b=d.nativeEvent,v=me(h)&&h.hasAttribute(cs("focus-guard"))&&h.getAttribute("data-type")==="outside";u.current=window.setTimeout(()=>{var P;const x=Ic(i.domReference?i.domReference.ownerDocument:document);!h&&x===i.domReference||Kr((P=s.current.floatingContext)==null?void 0:P.refs.floating.current,x)||Kr(i.domReference,x)||v||r(!1,b,"focus")})}}),[s,i.domReference,r,a]);return U.useMemo(()=>l?{reference:p}:{},[l,p])}function zc(e,t,n){const r=new Map,o=n==="item";let s=e;if(o&&e){const{[fm]:i,[dm]:l,...a}=e;s=a}return{...n==="floating"&&{tabIndex:-1,[vS]:""},...s,...t.map(i=>{const l=i?i[n]:null;return typeof l=="function"?e?l(e):null:l}).concat(e).reduce((i,l)=>(l&&Object.entries(l).forEach(a=>{let[c,u]=a;if(!(o&&[fm,dm].includes(c)))if(c.indexOf("on")===0){if(r.has(c)||r.set(c,[]),typeof u=="function"){var f;(f=r.get(c))==null||f.push(u),i[c]=function(){for(var p,d=arguments.length,h=new Array(d),b=0;b<d;b++)h[b]=arguments[b];return(p=r.get(c))==null?void 0:p.map(v=>v(...h)).find(v=>v!==void 0)}}}else i[c]=u}),i),{})}}function US(e){e===void 0&&(e=[]);const t=e.map(l=>l==null?void 0:l.reference),n=e.map(l=>l==null?void 0:l.floating),r=e.map(l=>l==null?void 0:l.item),o=U.useCallback(l=>zc(l,e,"reference"),t),s=U.useCallback(l=>zc(l,e,"floating"),n),i=U.useCallback(l=>zc(l,e,"item"),r);return U.useMemo(()=>({getReferenceProps:o,getFloatingProps:s,getItemProps:i}),[o,s,i])}const WS=new Map([["select","listbox"],["combobox","listbox"],["label",!1]]);function _S(e,t){var n,r;t===void 0&&(t={});const{open:o,elements:s,floatingId:i}=e,{enabled:l=!0,role:a="dialog"}=t,c=Mc(),u=((n=s.domReference)==null?void 0:n.id)||c,f=U.useMemo(()=>{var x;return((x=uS(s.floating))==null?void 0:x.id)||i},[s.floating,i]),p=(r=WS.get(a))!=null?r:a,h=Bc()!=null,b=U.useMemo(()=>p==="tooltip"||a==="label"?{["aria-"+(a==="label"?"labelledby":"describedby")]:o?f:void 0}:{"aria-expanded":o?"true":"false","aria-haspopup":p==="alertdialog"?"dialog":p,"aria-controls":o?f:void 0,...p==="listbox"&&{role:"combobox"},...p==="menu"&&{id:u},...p==="menu"&&h&&{role:"menuitem"},...a==="select"&&{"aria-autocomplete":"none"},...a==="combobox"&&{"aria-autocomplete":"list"}},[p,f,h,o,u,a]),v=U.useMemo(()=>{const x={id:f,...p&&{role:p}};return p==="tooltip"||a==="label"?x:{...x,...p==="menu"&&{"aria-labelledby":u}}},[p,f,u,a]),P=U.useCallback(x=>{let{active:E,selected:N}=x;const D={role:"option",...E&&{id:f+"-fui-option"}};switch(a){case"select":case"combobox":return{...D,"aria-selected":N}}return{}},[f,a]);return U.useMemo(()=>l?{reference:b,floating:v,item:P}:{},[l,b,v,P])}const Em=g.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 C.jsx("div",{ref:n,className:`absolute w-0 h-0 ${t}`,style:o})});Em.displayName="TooltipArrow";const Pn=({children:e,content:t,placement:n="top",delay:r=200,showArrow:o=!0,className:s="",disabled:i=!1,maxWidth:l="max-w-xs",trigger:a=["hover","focus"]})=>{const[c,u]=g.useState(!1),f=g.useRef(null),{refs:p,floatingStyles:d,context:h}=jS({open:c&&!i,onOpenChange:u,placement:n,whileElementsMounted:eh,middleware:[hc(o?12:8),ih({fallbackAxisSideDirection:"start",padding:8}),sh({padding:8}),...o?[n8({element:f})]:[]]}),b=NS(h,{enabled:a.includes("hover"),delay:{open:r,close:150}}),v=zS(h,{enabled:a.includes("focus")}),P=DS(h,{enabled:a.includes("click")}),x=FS(h),E=_S(h,{role:"tooltip"}),{getReferenceProps:N,getFloatingProps:D}=US([b,v,P,x,E]);return i?C.jsx(C.Fragment,{children:e}):C.jsxs(C.Fragment,{children:[C.jsx("div",{ref:p.setReference,...N(),style:{cursor:"help"},children:e}),c&&C.jsx($S,{children:C.jsx("div",{className:"edgex-components",children:C.jsxs("div",{ref:p.setFloating,...D(),style:{...d,zIndex:101},className:`
178
178
  z-101 px-3 py-2 cursor-help
179
179
  bg-fill-page-secondary
180
180
  text-text-primary text-sm font-medium
@@ -182,6 +182,6 @@ ${$g(d)}`),super(t.shortMessage,{cause:t,docsPath:r,metaMessages:[...t.metaMessa
182
182
  relative
183
183
  ${l}
184
184
  ${s}
185
- `,children:[t,o&&N.jsx(Em,{ref:f,placement:h.placement||n})]})})})]})},cs="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=",Uc="DEPOSIT_MODE_FAST",Sm="DEPOSIT_MODE_NORMAL",VS=({currentActiveChain:e,selectedToken:t,address:n,accountType:r,accountId:o,accountKey:s,onDeposit:i,onCopy:l,getUserBizConfig:a,saveUserBizConfig:c,onClose:u})=>{const{t:f}=$t(),p=r===D5,d=!p,h=(t||"").toUpperCase(),b=g.useMemo(()=>{const R=Number(e==null?void 0:e.chainId),z=String((e==null?void 0:e.chain)||"").trim().toUpperCase();return R===33431||R===3343||z==="EDGE"},[e==null?void 0:e.chainId,e==null?void 0:e.chain]),w=g.useMemo(()=>{const R=Number((e==null?void 0:e.cctpResolvedMaxFee)??0);return Number.isFinite(R)?h==="USDC"&&!b&&R!==0:!1},[h,b,e==null?void 0:e.cctpResolvedMaxFee]),P=!(r===B5&&h==="USDC"),x=g.useMemo(()=>{if(!e)return!1;const R=Number(e.chainId);return!Number.isNaN(R)&&(R===42161||R===421614)},[e]),E=p,A=g.useMemo(()=>{var R;return(R=e==null?void 0:e.tokenList)==null?void 0:R.find(z=>z.token===t||z.symbol===t)},[e,t]),D=g.useMemo(()=>{const R=(t||"").toUpperCase();if(!E&&R==="USDC")return f("deposit.defaultSpotToPerpNotice",{coin:t,v:e==null?void 0:e.chain});const G=f(E?"deposit.crossChainDepositFeeTip":"deposit.depositAllTip",{coin:t,v:e==null?void 0:e.chain});return E&&(!x||R==="USDC")?String(G).split(`
186
- `)[0]:G},[f,t,e==null?void 0:e.chain,E,x]),L=(A==null?void 0:A.minDepositSize)||"10",F=g.useMemo(()=>{const R=A==null?void 0:A.depositFeeRate;if(R==null)return"";const z=String(R).trim();return z?`${z}%`:""},[A==null?void 0:A.depositFeeRate]),[m,v]=g.useState("fast"),[S,$]=g.useState(""),[I,C]=g.useState(!1),M=g.useRef(!1),y=g.useMemo(()=>!!F&&m!=="standard",[F,m]),O=g.useMemo(()=>{const R=Number((e==null?void 0:e.blockTime)??0),z=Number((e==null?void 0:e.txConfirm)??0);if(!Number.isFinite(R)||!Number.isFinite(z))return 0;const _=R*z/60;return Math.trunc(_*100)/100},[e==null?void 0:e.blockTime,e==null?void 0:e.txConfirm]),T=w&&I&&m==="standard"?20:O;g.useEffect(()=>{if(M.current)return;M.current=!0;let R=!1;return C(!1),a?((async()=>{try{const _=await a();if(R)return;const G=_==null?void 0:_.depositMode;if(!(G===Uc||G===Sm)){C(!1);return}v(G===Uc?"fast":"standard"),$((_==null?void 0:_.destinationPreference)||""),C(!0)}catch(_){console.error("[MPCDeposit] getUserBizConfig failed:",_),C(!1)}})(),()=>{R=!0}):()=>{R=!0}},[a]);const B=g.useCallback(async R=>{if(v(R),!c)return;const z=S||r||"";try{await c({depositMode:R==="fast"?Uc:Sm,destinationPreference:z})}catch(_){console.error("[MPCDeposit] saveUserBizConfig failed:",_)}},[c,S,r]);return N.jsxs(N.Fragment,{children:[w&&I&&N.jsx("div",{className:"bg-fill-input-primary rounded-lg p-1 mt-4 mb-3",children:N.jsxs("div",{className:"grid gap-1 grid-cols-2",children:[N.jsx("button",{type:"button",onClick:()=>{B("fast")},className:`h-[30px] rounded-md text-sm font-medium transition-colors ${m==="fast"?"bg-fill-btn-primary text-text-on-sec-btn":"text-text-primary hover:bg-fill-input-secondary"}`,children:f("deposit.fast")}),N.jsx("button",{type:"button",onClick:()=>{B("standard")},className:`h-[30px] rounded-md text-sm font-medium transition-colors ${m==="standard"?"bg-fill-btn-primary text-text-on-sec-btn":"text-text-primary hover:bg-fill-input-secondary"}`,children:f("deposit.standard")})]})}),N.jsx("div",{className:"flex justify-center mt-4 mb-3",children:n&&N.jsx("div",{className:"bg-white rounded-lg",children:N.jsx(om,{value:n,size:80,level:"L",bgColor:"#ffffff",fgColor:"#000000",marginSize:0})})}),n&&N.jsxs("div",{className:"flex items-center justify-between bg-fill-input-primary rounded-lg py-2 px-3 mb-3",children:[N.jsx("span",{className:"flex-1 text-text-primary text-xs font-medium break-all mr-3",children:n}),N.jsx(q3,{onCopy:()=>{l&&l(n)},text:n,children:N.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:[N.jsx("rect",{x:"2.08496",y:"4.02295",width:"9.89893",height:"9.89893",rx:"2",stroke:"#F9F9F9"}),N.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")]}),N.jsxs("div",{className:"border-b border-dashed border-line-divider-secondary pb-4",children:[N.jsxs("div",{className:"flex items-start",children:[N.jsx("div",{className:"w-5",children:N.jsx("img",{src:cs,className:"w-4 h-4",alt:"Warning"})}),N.jsx("div",{className:"flex-1",children:N.jsx("p",{className:"text-xs text-functional-orange-1",children:D})})]}),d&&N.jsxs(N.Fragment,{children:[N.jsx("div",{className:"my-2 ml-5 h-px border-b border-dashed border-line-divider-secondary"}),N.jsx("div",{className:"flex items-start pl-5 text-functional-orange-1 text-xs",children:f("deposit.addressUpdatedNotice")})]})]}),N.jsxs("div",{className:"text-sm",children:[P&&N.jsxs("div",{className:"flex justify-between items-center h-[18px] mt-4",children:[N.jsx("span",{className:"text-text-tertiary",children:f("deposit.arrivalTime")}),N.jsx(Tn,{content:N.jsx("div",{className:"grid grow max-w-[300px] min-w-[80px] rounded-2xl flex-col gap-[10px]",children:N.jsx("p",{children:f("deposit.arrivaltimeTooltip2")})}),placement:"top",children:N.jsx("span",{className:"text-text-primary font-medium text-right border-b-2 border-dashed border-line-divider-primary decoration-dashed",children:f("deposit.arrivalEstimated",{v:T})})})]}),y&&N.jsxs("div",{className:`flex justify-between items-center h-[18px] ${P?"mt-1":"mt-4"}`,children:[N.jsx("span",{className:"text-text-tertiary",children:f("withdraw.feeRate")}),N.jsx(Tn,{content:f("deposit.feeRateTooltip"),placement:"top",children:N.jsx("span",{className:"text-text-primary font-medium border-b-2 border-dashed border-line-divider-primary decoration-dashed text-right",children:F})})]}),N.jsxs("div",{className:`flex justify-between items-center h-[18px] ${P||y?"mt-1":"mt-4"}`,children:[N.jsx("span",{className:"text-text-tertiary",children:f("deposit.minDeposit")}),N.jsxs("span",{className:"text-text-primary font-medium text-right",children:[L," ",t]})]}),d&&h!=="USDC"&&N.jsxs("div",{className:"flex justify-between items-center h-[18px] mt-1",children:[N.jsx("span",{className:"text-text-tertiary",children:f("deposit.maxDeposit")}),N.jsxs("span",{className:"text-text-primary font-medium text-right",children:["200,000 ",t]})]})]}),N.jsx("button",{className:"w-full h-[38px] bg-fill-btn-primary rounded-xl text-sm font-medium text-text-on-sec-btn mt-4",onClick:()=>{i&&i({amount:"",chainId:e.chainId,tokenAddress:n,tokenSymbol:t,depositSpeed:m,accountType:r,accountId:o,key:s}),u()},children:f("deposit.title")})]})},us=({size:e="xs",color:t,className:n="",label:r="Loading...",inline:o=!1})=>{const s=t?`loading-${t}`:"",i=o?"loading-inline":"";return N.jsx("span",{className:`loading loading-${e} loading-spinner ${s} ${i} ${n}`.trim(),"aria-label":r,role:"status","aria-live":"polite"})},HS=(e,t)=>Number(e)>Number(t),Wt=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"},Mi=(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 Mi(a,t)}const s=parseFloat(e),i=parseFloat(t);return!isNaN(s)&&!isNaN(i)&&s>i?{isValid:!0,formattedValue:Wt(t),errorType:"auto_adjusted_to_max"}:{isValid:!0,formattedValue:e}},GS=(e,t,n)=>{const r=parseFloat(String(e)||"0"),o=parseFloat(String(t)||"0");if(o>0){const s=r-o,i=Wt(Math.max(0,s).toString());return N.jsxs("span",{className:"flex items-center gap-1",children:[Wt(e),N.jsx("span",{className:"text-sm font-edgex-harmony text-functional-green-1 leading-[18px] font-medium",children:"→"}),i," ",n]})}return`${Wt(e)} ${n}`},qS=(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)},KS=(e,t,n)=>{if(!Fh(e,n))return!1;try{const r=new Re(t||"0"),o=new Re("200000");return r.isNaN()||o.isNaN()?!1:r.gte(o)}catch{return!1}},ZS=(e,t,n,r)=>{let o=t||"0";if(!(r==="spot")&&Fh(e,n))try{const i=new Re(o),l=new Re("200000");i.gt(l)&&(o="200000")}catch(i){console.warn("Error calculating max amount limit:",i)}try{const i=new Re(o||"0");return i.isNaN()?o:i.decimalPlaces(6,Re.ROUND_DOWN).toString()}catch{return o}},Pm={accountChains:[],defaultChainId:1,defaultAccountType:"",balances:{}};let it=null;const Tm=g.forwardRef((e,t)=>{const[n,r]=g.useState(!1),[o,s]=g.useState(!1),[i,l]=g.useState(Pm),a=g.useCallback(h=>{l(h),r(!0)},[]),c=g.useCallback(h=>{l(b=>({...b,...h}))},[]),u=g.useCallback(()=>{r(!1),s(!1),i.onClose&&i.onClose()},[i.onClose]),f=g.useCallback(h=>{s(h)},[]),p=g.useCallback(()=>n,[n]),d=g.useCallback(()=>o,[o]);return g.useImperativeHandle(t,()=>({openDeposit:a,closeDeposit:u,updateDepositOptions:c,setDepositLoading:f,isOpen:p,isLoading:d}),[a,u,c,f,p,d]),g.useEffect(()=>(it={openDeposit:a,closeDeposit:u,updateDepositOptions:c,setDepositLoading:f,isOpen:p,isLoading:d},()=>{it=null}),[a,u,c,f,p,d]),n?N.jsx(Mm,{isOpen:n,isLoading:o,onClose:u,accountChains:i.accountChains,defaultChainId:i.defaultChainId,defaultSymbol:i.defaultSymbol,defaultAccountType:i.defaultAccountType,balances:i.balances,wagmiHooks:i.wagmiHooks,onDeposit:i.onDeposit,onCopy:i.onCopy,getUserBizConfig:i.getUserBizConfig,saveUserBizConfig:i.saveUserBizConfig,onChainChange:h=>{var b;return(b=i.onChainChange)==null?void 0:b.call(i,h)},onTokenChange:h=>{var b;return(b=i.onTokenChange)==null?void 0:b.call(i,h)}}):null});Tm.displayName="DepositManager";const Am=e=>{if(!it){console.error("DepositManager not initialized. Make sure to render <DepositManager /> in your app.");return}it.openDeposit(e||Pm)},Nm=()=>{if(!it){console.error("DepositManager not initialized. Make sure to render <DepositManager /> in your app.");return}it.closeDeposit()},Cm=e=>{it&&it.updateDepositOptions(e)},Di=e=>{if(!it){console.error("DepositManager not initialized. Make sure to render <DepositManager /> in your app.");return}it.setDepositLoading(e)},YS=()=>it?it.isOpen():!1,Om=()=>it?it.isLoading():!1,XS=()=>({openDeposit:Am,closeDeposit:Nm,updateDepositOptions:Cm,setDepositLoading:Di,isOpen:YS,isLoading:Om}),JS=e=>{const{t}=$t(),{isNetworkMismatch:n,depositAmount:r,approved:o,currentTokenBalance:s,selectedToken:i,showLayerZeroTip:l,minDeposit:a=10}=e;return g.useMemo(()=>{if(n)return{text:t("deposit.switchNetwork"),disabled:!0,isNetworkSwitch:!0};const c=parseFloat(r||"0"),u=a,f=qS(r,s||"0",o);return!r||c===0||!o?{text:t(l?"deposit.layerZeroDepositButton":"deposit.confirmDeposit"),disabled:!0,isNetworkSwitch:!1}:c<u?{text:t("deposit.minDepositParsed",{amount:u,token:i}),disabled:!0,isNetworkSwitch:!1}:{text:t(l?"deposit.layerZeroDepositButton":"deposit.confirmDeposit"),disabled:!f,isNetworkSwitch:!1}},[n,r,o,s,i,l,a,t])};function QS(e){const{account:t,accountChainId:n,targetChainId:r,tokenInfo:o,amount:s}=e,{useReadContract:i,useWriteContract:l,usePublicClient:a,useSwitchChain:c}=e.wagmiHooks,u=o==null?void 0:o.tokenAddress,f=(o==null?void 0:o.decimals)??18,p=(o==null?void 0:o.approveSpender)||(o==null?void 0:o.contractAddress),d=!u||u.toLowerCase()==="0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",{switchChainAsync:h}=c(),{writeContractAsync:b}=l(),w=a(),P=i({address:u,abi:Mr,functionName:"allowance",args:[un(t||""),p],chainId:r,query:{enabled:!!(!d&&t&&r&&u&&p)}}),x=P!=null&&P.isSuccess?P.data:void 0,E=g.useMemo(()=>{if(d)return!0;if(!P.isSuccess||x===void 0||x===0n)return!1;try{const D=_6(String(Number(s||"0")||0),Number(f));return x>=D}catch{return!1}},[d,P.isSuccess,x,s,f]),A=g.useCallback(async()=>{try{if(r&&n&&+n!=+r&&await h({chainId:+r}),!b||!w||!u||!p)return;const L=un(u),F=un(p);if((x||0n)>0n){const S=await b({abi:Mr,address:L,functionName:"approve",args:[F,0n]});await w.waitForTransactionReceipt({hash:S})}const v=await b({abi:Mr,address:L,functionName:"approve",args:[F,wf]});await w.waitForTransactionReceipt({hash:v}),P!=null&&P.refetch&&await P.refetch()}catch(D){console.error("[useApprove] onApprove failed:",D)}},[r,n,u,p,x,P,b,w,h]);return{approve:E,onApprove:A}}const eP=({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 g.useEffect(()=>{o(un(e.tokenAddress),{balance:s})},[s,e.tokenAddress,o]),null},tP=({account:e,chainId:t,contractAddress:n,tokens:r=[],wagmiHooks:o})=>{var x;const s=typeof t=="string"?Number.isFinite(Number(t))?Number(t):void 0:t,i=g.useMemo(()=>{const E="0x0000000000000000000000000000000000000000",A="0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee";return r.filter(D=>{const L=D.tokenAddress;if(!L)return!1;const F=L.toLowerCase();return!(L===E||F===A)})},[r]),[l,a]=g.useState({}),c=g.useCallback((E,A)=>{a(D=>({...D,[E]:A}))},[]),u=(x=o==null?void 0:o.useBalance)==null?void 0:x.call(o,{address:e,chainId:s,query:{enabled:!!e&&!!s&&!!(o!=null&&o.useBalance)}}),[f,p]=g.useState(0),d=g.useMemo(()=>i.map(E=>g.createElement(eP,{key:`${E.tokenAddress}-${f}`,token:E,account:e,chainId:s,contractAddress:n,wagmiHooks:o,onResult:c})),[i,e,s,n,o,c,f]),h=g.useMemo(()=>{const E=u!=null&&u.data?{value:u.data.value,formatted:u.data.formatted,decimals:u.data.decimals,symbol:u.data.symbol}:{value:BigInt(0),formatted:"0",decimals:18,symbol:"ETH"},A=i.map(L=>{const F=l[un(L.tokenAddress)],m=F==null?void 0:F.balance,v=m==null?void 0:m.data;return{address:un(L.tokenAddress),value:(v==null?void 0:v.value)||BigInt(0),formatted:(v==null?void 0:v.formatted)||"0",decimals:(v==null?void 0:v.decimals)||L.decimals}}).filter(L=>L.address),D=A.reduce((L,F)=>({...L,[F.address]:{balance:F}}),{});return{balanceList:A,baseTokenBalance:E,combinedData:D}},[u,l,i]),b=g.useCallback(async()=>h,[h]),w=g.useMemo(()=>{const E=(u==null?void 0:u.isLoading)||!1,A=Object.values(l).some(D=>{var L;return(L=D.balance)==null?void 0:L.isLoading});return E||A},[u==null?void 0:u.isLoading,l]),P=g.useCallback(()=>p(E=>E+1),[]);return{multicallRun:b,multicallRefresh:P,multicallResult:h,validErcTokens:i,isLoading:w,queryComponents:d}},nP=({address:e,currentActiveChain:t,selectedToken:n,accountType:r,accountId:o,accountKey:s,platformBalance:i,isLoading:l,wagmiHooks:a,onChainChange:c,onDeposit:u})=>{const{t:f}=$t(),p=a.useAccount(),d=t.tokenList.find(Y=>Y.token===n||Y.symbol===n),h=t.chainId,b=g.useMemo(()=>{if(!((n||"").toUpperCase()==="USDC"))return!1;const H=Number((t==null?void 0:t.cctpResolvedMaxFee)??0);return Number.isFinite(H)?H!==0:!1},[t==null?void 0:t.cctpResolvedMaxFee,n]),[w,P]=g.useState(""),[x,E]=g.useState(()=>b?"fast":"standard");g.useEffect(()=>{P("")},[n,t.chainId]),g.useEffect(()=>{E(b?"fast":"standard")},[t.chainId,b]);const{multicallResult:A,queryComponents:D}=tP({account:e,chainId:t.chainId,contractAddress:(d==null?void 0:d.contractAddress)||(t==null?void 0:t.contractAddress),tokens:(t==null?void 0:t.tokenList)||[],wagmiHooks:a}),L=g.useMemo(()=>{var H;if(!d)return"0";if(!d.tokenAddress||d.tokenAddress.toLowerCase()==="0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee")return A.baseTokenBalance.formatted;const Y=A.combinedData[d.tokenAddress];return((H=Y==null?void 0:Y.balance)==null?void 0:H.formatted)||"0"},[d,A]),F="0xfd086bc7cd5c481dcc9c85ebe478a1c0b69fcbb9",m="0xceeed84620e5eb9ab1d6dfc316867d2cda332e41",v=g.useMemo(()=>{var Y,H;return A5({chain:I5,transport:O5(t.rpcUrl||((Y=window==null?void 0:window.ENV)==null?void 0:Y.CHAIN_RPC_URL_42161)||((H=window==null?void 0:window.ENV)==null?void 0:H.CHAIN_RPC_URL_421614))})},[t.rpcUrl]),S="1000000000000",{formatted:$}=$5({client:v,tokenAddress:F,holder:m,decimals:6,fallbackFormatted:S,pollingInterval:12e3}),[I,C]=g.useState(!1),{approve:M,onApprove:y}=QS({account:e,accountChainId:p.chainId,targetChainId:+t.chainId,tokenInfo:d,amount:w,wagmiHooks:a}),O=g.useCallback(async()=>{if(!I)try{C(!0),await y()}catch(Y){console.error("Approve failed:",Y)}finally{C(!1)}},[I,y]),k=g.useMemo(()=>+p.chainId!=+t.chainId,[p.chainId,t.chainId]),T=g.useCallback(async()=>{c&&c(h)},[c,h]);g.useEffect(()=>{k&&T()},[k,T]);const{showLayerZeroTip:B,layerZeroTipKey:R}=g.useMemo(()=>{const Y=+t.chainId==42161||+t.chainId==421614,H=(n==null?void 0:n.toUpperCase())==="USDT",ee=new Re(w||"0"),Q=new Re("200000");let ve=!1,Z;if(Y&&H&&w)if(ee.gte(Q))ve=!0,Z="deposit.layerZeroDepositTipGte200k";else{const ie=$;if(typeof ie=="string"&&ie.length>0){const Ee=new Re(ie);!Ee.isNaN()&&ee.gte(Ee)&&(ve=!0,Z="deposit.layerZeroDepositTipExceedPool")}}return{showLayerZeroTip:ve,layerZeroTipKey:Z}},[t.chainId,n,w,$]),z=g.useCallback(()=>ZS(+t.chainId,L||"0",n,r),[L,t==null?void 0:t.chainId,n,r]),_=g.useMemo(()=>r!=="spot"&&KS(+t.chainId,w,n),[r,t==null?void 0:t.chainId,w,n]),G=g.useMemo(()=>"deposit.maxDepositSplitTip",[]),J=g.useMemo(()=>{const Y=Number((t==null?void 0:t.blockTime)??0),H=Number((t==null?void 0:t.txConfirm)??0);if(!Number.isFinite(Y)||!Number.isFinite(H))return 0;const ee=Y*H/60;return Math.trunc(ee*100)/100},[t==null?void 0:t.blockTime,t==null?void 0:t.txConfirm]),W=b&&x==="standard"?20:J,ne=g.useMemo(()=>{const Y=d==null?void 0:d.depositFeeRate;if(Y==null)return"";const H=String(Y).trim();return H?`${H}%`:""},[d==null?void 0:d.depositFeeRate]),be=b&&x==="fast"&&!!ne,fe=JS({isNetworkMismatch:k,depositAmount:w,approved:M,currentTokenBalance:L,selectedToken:n,showLayerZeroTip:B,minDeposit:d!=null&&d.minDepositSize?parseFloat(d.minDepositSize):10}),xe=Y=>{const H=Y.target.value,ee=z(),Q=Mi(H,ee);if(Q.isValid)P(Q.formattedValue),Q.errorType;else return Q.errorType==="exceed_balance",void 0},ye=g.useCallback(async()=>{Di(!0);try{u&&u({amount:w,chainId:h,tokenAddress:(d==null?void 0:d.tokenAddress)||"",tokenSymbol:n,depositSpeed:x,accountType:r,accountId:o,key:s})}catch(Y){console.error("Deposit error:",Y),Di(!1)}},[u,w,h,d==null?void 0:d.tokenAddress,x,r,o,s,n]);return N.jsxs(N.Fragment,{children:[D,b&&N.jsx("div",{className:"bg-fill-input-primary rounded-lg p-1 my-4",children:N.jsxs("div",{className:"grid gap-1 grid-cols-2",children:[N.jsx("button",{type:"button",onClick:()=>E("fast"),className:`h-[30px] rounded-md text-sm font-medium transition-colors ${x==="fast"?"bg-fill-btn-primary text-text-on-sec-btn":"text-text-primary hover:bg-fill-input-secondary"}`,children:f("deposit.fast")}),N.jsx("button",{type:"button",onClick:()=>E("standard"),className:`h-[30px] rounded-md text-sm font-medium transition-colors ${x==="standard"?"bg-fill-btn-primary text-text-on-sec-btn":"text-text-primary hover:bg-fill-input-secondary"}`,children:f("deposit.standard")})]})}),N.jsxs("div",{className:"bg-fill-input-primary rounded-lg px-3 py-3 my-4",children:[N.jsxs("div",{className:"flex justify-between items-center h-[18px] mb-3",children:[N.jsx("input",{type:"text",placeholder:f("deposit.amount"),value:w,onChange:xe,className:"flex-1 bg-transparent text-text-primary text-sm font-medium placeholder-text-tertiary placeholder:font-normal focus:outline-hidden border-none p-0 h-full"}),N.jsx("button",{onClick:()=>{const Y=z();P(Y)},className:"text-theme-normal text-xs font-medium cursor-pointer hover:opacity-80 transition-opacity h-full flex items-center",children:f("deposit.max")})]}),N.jsx("div",{className:"h-px bg-line-divider-secondary mb-2"}),N.jsxs("div",{className:"flex justify-between items-center",children:[N.jsx(Tn,{content:f("deposit.availableDesc"),children:N.jsx("span",{className:"text-text-tertiary text-xs leading-[14px] border-b border-dashed border-line-divider-primary",children:f("deposit.available")})}),N.jsx("span",{className:"text-text-primary text-xs leading-[14px]",children:GS(L||"0",w,n)})]})]}),!M&&HS(w||"0",0)&&N.jsxs("div",{className:"flex justify-center flex-col items-center",children:[N.jsx("h3",{className:"text-text-primary text-sm leading-4 font-medium",children:f("deposit.enableSystemProWithToken",{token:n,network:t==null?void 0:t.chain})}),N.jsx("p",{className:"text-text-secondary text-xs leading-3 mt-4",children:f("deposit.enableTokenDesc",{token:n,network:t==null?void 0:t.chain})}),N.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:O,disabled:I,children:I?N.jsx(us,{size:"xs",inline:!0}):f("deposit.enableWithToken",{token:n})})]}),B&&N.jsxs(N.Fragment,{children:[N.jsxs("div",{className:"flex mb-4",children:[N.jsx("div",{className:"w-5",children:N.jsx("img",{src:cs,className:"w-4 h-4",alt:"Warning"})}),N.jsx("div",{className:"flex-1 text-xs text-functional-orange-1",children:f(R||"deposit.layerZeroDepositTip")})]}),N.jsx("div",{className:"my-2 ml-5 h-px border-b border-dashed border-line-divider-secondary"})]}),_&&N.jsxs("div",{className:"flex mb-4",children:[N.jsx("div",{className:"w-5",children:N.jsx("img",{src:cs,className:"w-4 h-4",alt:"Warning"})}),N.jsx("div",{className:"flex-1 text-xs text-functional-orange-1",children:f(G)})]}),_&&N.jsx("div",{className:"my-2 ml-5 h-px border-b border-dashed border-line-divider-secondary"}),N.jsxs("div",{className:"flex mb-4",children:[N.jsx("div",{className:"w-5",children:!(_||B)&&N.jsx("img",{src:cs,className:"w-4 h-4",alt:"Warning"})}),N.jsx("div",{className:"flex-1 text-xs text-functional-orange-1 whitespace-pre-line",children:f("deposit.noPrivateKeyWalletWarning")})]}),N.jsxs("div",{className:"border-t border-line-divider-secondary border-dashed py-4",children:[N.jsxs("div",{className:"flex justify-between items-center h-[18px] leading-4",children:[N.jsx("span",{className:"text-sm text-text-tertiary",children:f("deposit.arrivalTime")}),N.jsx(Tn,{content:N.jsx("div",{className:"grid grow max-w-[300px] min-w-[80px] rounded-2xl flex-col gap-[10px]",children:N.jsx("p",{children:f("deposit.arrivaltimeTooltip2")})}),placement:"top",children:N.jsx("span",{className:"text-text-primary font-medium text-right border-b-2 border-dashed border-line-divider-primary decoration-dashed text-sm",children:f("deposit.arrivalEstimated",{v:W})})})]}),be&&N.jsxs("div",{className:"flex justify-between items-center h-[18px] leading-4 mt-2",children:[N.jsx("span",{className:"text-sm text-text-tertiary",children:f("withdraw.feeRate")}),N.jsx(Tn,{content:f("deposit.feeRateTooltip"),placement:"top",children:N.jsx("span",{className:"text-sm text-text-primary font-medium border-b-2 border-dashed border-line-divider-primary decoration-dashed text-right",children:ne})})]}),N.jsxs("div",{className:"flex justify-between items-center h-[18px] leading-4 mt-2",children:[N.jsx("span",{className:"text-sm text-text-tertiary",children:f("deposit.equity")}),N.jsx("span",{className:"text-sm text-text-primary font-medium",children:w?N.jsxs("span",{className:"flex items-center gap-1",children:[Wt(i),N.jsx("span",{className:"text-sm font-edgex-harmony text-functional-green-1 leading-[18px] font-medium",children:"→"}),Wt((parseFloat(i)+parseFloat(w)).toString())," ",n]}):`${Wt(i)} ${n}`})]})]}),N.jsxs("button",{className:`w-full h-[38px] text-sm rounded-xl font-medium transition-colors flex items-center justify-center gap-2 ${fe.disabled||l?"bg-text-disabled text-text-secondary cursor-not-allowed":"bg-fill-btn-primary text-text-on-sec-btn"}`,onClick:ye,disabled:fe.disabled||l,children:[(l||k)&&N.jsx(us,{size:"xs"}),fe.text]})]})},Im=e=>e.toLocaleUpperCase()===gn?gn:Zs,fs=e=>Im(e.wallet)===gn,_c=e=>Im(e.wallet)===Zs,Bi=e=>e?e==="perp"?ze.PERPETUAL:e==="perp-v2"||e==="perp_v2"?ze.PERPETUALV2:e:"",$m="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGAAAAAoCAYAAAABk/85AAAACXBIWXMAABYlAAAWJQFJUiTwAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAABBMSURBVHgBvVt7kBTHef/17N77fRwSiNeBBAGBpVNJERKyoqOSuByiVLAScOKqJKAYJU4F8XCVY8d/cLiSkKSS4pDtKJKRdFhxYoNskTKS4jixFguEICAdiDtAvJb3cRzcg7u9vX1M5/t6puexO7u3Byd+VDOzPT3dPd/39ffqPoFbhJSymS5NVJ6yr7V2YfRRidrlMJWIECKC28Bnv5dslqZskjCeEhA0nvSPJ0SU5hQ1IA/DQGTPqqIIbgMLvjzcbAjxoBRoFlLSeKJWqjEFDY0++p6oCRmFFO2Aufvo1rIIbgFiLI3pA/mD11BZC/fjC0WUSoTKRp58IS80vyZrEylzjTDlLYxHYwgZKUqHNka+Uth4TWtlbWowvkZArjWlqBEikz4SNsmkdZXqB7WDaVrfV1SEje3/WhZFgSiIATbhN8Ai/HigDXkYwYRPJkwaT47PeAJt+RjBhE8PDm+QEGvpW/VLkglMUFeuFja13HvBtHHu1SOp3nktHMa3CmHEqAygDlniWzB2iR8NUVhMaPNWPv5yeo0hZcv4j0cqSsiN7z8XbvPWLlgVXwMz3UJk9I4nLekWmqD6t9WTUEzw1vme8zNqc84wzI0ff6+yLe+s8j2kwTdj/KQ+F1rpA9fxzRMvpTePm9TnhGjd+2chNd78Z2ObiVZrbYJaT4Ur4TYhhbMoPM8z7h3dZD+RVhU1MURrx9bydTlnE1Rpq5w3qTTjDqB/BO2//f10H825GXcAMiXb+z8c6SPiNXuIK7XOt+oE/WbVI2wmKBpLr9632nrbeVWVh7RSthfL5OL2trq+zLmEc8zxXSpN8cEBlFZW49OEGR/A2rcqmiBxxzDQmWgiowlbcO2RpUfStd6XnnpNfOsdVk26NfVFxDcVE/z92CsIsimOMAv04sy5hDIrbLWzlO9f+OJnkDwVwcRygVD9NIhwCcYDTPTBfa/jo3//W/z1OzGcLnsYdwqxaBLJ3rS6l9Z/mpD21ZJk3d4yspZIewjrFW/nfVtdaXXkukxWXePEpm/W9rT/3c+88/GpIBpsBV1e4/uO997B97+5QtUvnGpg4bQQyh9ejvJHlqFk1uO4FcTP7MPQwR2Id/wXdh/vxc/Ll+Hk45txpzByLYXBUwm49HFhMUPYasiRcjw6NyTmTQ9hLpUpDRa5bsYkjp03ceB4Cv93Ig29iiz1IzNtgcMEezWsO9FW0+q0cCYgZSMs1cNXbN/0PA698yOnq+oSgWfmh+lKy6ZuGioeXoayR5YjXDcV+cDSfvO9rRjcs9W6HwHeoolfMqbi6G+8gXjlNNwJmCMS/R1xpONewrvCyuLrld4vfLZI/OXSYiK6kbffSz0mvrMzgTf3JLXb6qwatz/nN3fdNyLMmVHbHngZwJK/Qv/esGQ22AZ4wUxYOM3AvInupKrvmYaiHJYkkSIDe/mC8/tYt4k950yMpCROLmpF96zluBVMrhK4bwJQWWz9HiSh7hoETvbkNiQ3T41gpDul7r06Ah5isYROmWBg06oylnyMBcyIP/77GC5eM7M8J3jcVNt4t57YVqM8Ix09NNLlrG49PNiPliVzcg7WNNnArzVaE2TiV1UEtxuIEROStPTpuw9cTOPwFWX5MEJSf3DpfowFVcUCyz4DLF9goDKHKeq6CXx4ReK1gxJXBl0KsPT3HBzSXjy0+pH2b9t7B6ua764pH1Xqc4GZ8BdbhnD8vDLejoekepd+25IwZB2vAj3SBm9HZZU1qJuUWzW0EyHbPkxhgNRJMuX6xV6kTYv4rHLe7Eg5xGecf+CrGAuWLxDY8YcGnn04N/EZk6qAJXOo7Ze4rauKh84n7ElK+5+tr/mhJBeGChP9dojP4Hf/ZU0FpkxwAzW+Sm1grHtlW8IpgwNc6NGaMzub9dCivIMNkFT9x5Ekjl0jlZLMfp5KWSrnh0dS6In5OTRwV2FGnKX+208beH5RfsIHgZm16XOGUlMjfZbqMSU0BRQbTJc6eP0bFbdFfA3uY9Oqcrtf6bsSo4XFCF4Npgo4Q3ZWMyv67O26gE8OvJt3MJbyMzekYsCcu/yT/8UnJn55Nq3aeDFw9yJcnrcKheDlpSHMv9sfKw7Sitp5XOLf2iVeOiDxzicS/3tGKjswoUz4GDWjVmCyMPHT90YCl6ntXuKZJ0uoFGO8MJVsJHlKov2UYryt87zRmVJFpfUPfH03m89m3AbYMM8OkJxG+viPuwSpIP+H999dmPSz5FZm0OTVQxI7jppKrWXio8sSL7xvSb5X/XScTtr6QCpt73go/M+0wtbnnynFeGPF50vQ9rO4urd4bzqT0oyn/x9kBjwY1EEhEbDlmobUNRMNFLz9Hj37cUfax4Sh+vkoBCzRq3elSQWFFCO+8XNTEXk0vHqI2l0R2PSbhvKMfvBBUqkaSwyl4/loLJwbyqt6/uqlIew/lrTesvjlfOzC+8P4h+cqA9/jPtmT2n+MV4H2sixPSKtB+rGYGdAY1AEb4nyYUmPg6TkGSsJOBtCXrmUwY5gJuyhY6RmyKuMVuY0763wmtvZgrty0mMB1J6+P3l6DGbXyJ2nFxP4B046CYPufAto956pH54aRDx8cS7BrCX/+3yZiZ36BWDi3CB90JlVbw9BRsnQibrp7ICcD7pm9QK0CbyxQWiQw9y6Be8lXnlLhl/ogBjCYCV+iYS4RA05fN7E/BwOUwf0dQ3kyq39qEsFdJgRhcqXVnsHtM5mg30vF0q7Ho77fjbbI/8H9M/IzwJFWx4UUlPuR0h/xBmPKRJ2qtvJFbqCm7rnzOv6CwLw7u6GfW/k1NNYbaL4vhBWPhvH1Xw/jdxeEMK0q/9hmgGDwO/xuqjhYtTExdXDF97Mn5B5DE5+ZxYXvuS4I6ZQJ1wtxvFHnd1XFaHR00wzS9SOd3/kwpSEEK2nnJPWk9Y7lDdFNTV6/6/EnFxHhQ8QAgxhhTXSQXErTDPhQT13QvPidwVjwhDMNbj4meImvMRoT7FnZc/O4h1JitCysJqAmupVW0JnS0WEzzJNZdQRBZVSZAX25XjbP78uqS5E9unot6ZSe6ylVEil3Qqm0dOq9bUdIJ1eaA1l9aoPb5VE3QUwIIr5GEBNmk9BUl7HKMLUfDouY0OaY9Hsa+cDvmaZmmss33U8+DMTs5eYpWgB4FdBtX14GpI7syKqrrRGorXLF9XSsjKRfIiTcxSQovuO6IzddD6Ga3qmnBVeB/sCxtMHNxYQg4nNbb3svE5j4fF9V7joJbnGlufNcEgVAuhJsFqyCOqNJn+qzm0tbHkAki7IFakeAIZZ9FyG7O7I6ZUPLTAiFi/DPp6bg7ct1+Js5ZzBLxOFkV6jN8eFqbDxzL5bc04uv3ncJFWUGeQJp3JfsxNWSYEOsmcCupya0ZgIHYJnE57YMb3vNBKXWKChjI3uBknBCZCbhLFvVGU0hHxbOK4Klsz3a2u5o4bxRPKjOhMNoT2paOHvKJqKskzgKzkrKp49sR2LX+sCOudNYnKS5jIKiZAjRvmLMqRlBSbGdbEsIXIoVYWJFGlVFaQzFQigrNYkBEj8pfRYvVm5APkyu8hM1E5r42tPJ1/6Vt2P41rabTiDmfIN95Zq9327A1LvGlv0cDRe703hi9TXAE/x5DY7tNW5ktrYHdRCkfjS4r9ISi9hM4AUNw1ltZtUm1DNGcbFFfMa96U6MhiB1pJFJ/NHaT58cdlSFzgFJjzvE95vfGMR4o5X6tG2v7UVJrxOlYJiIGPaJtSw7cHMIuNHvLxevmjh1LqVKF3E4aa9eZogmMCPkESZuc7k75bzXcHEvKgIMcSaCiBpE/NHav3w8RFupwklHuEbQTkXQdXskhn0dCYwXLtL3/uhdysUr1WVaW2vuzpieQzT6xuSIVmxbMjspvjc7Z1NeaqgOkrT5k0pbTBq28zJFYQ8D7F75GbfhZcjvsCtaVhrCb/W9gkLgJWo+4o/Wvmp6GVy6+11KvRrWf7dXqY3bBfexvOWGuueATRtvNZrUDFGRSITr9IYMB2O93o5GaP+256VlWQOkyN283ptCVSXtEZdZlB6umoqNb0fV/oDGPy2difJBazcsNky2YjCNhvowrQ6BIaMaz878GIWCdTy7qkFJuELamzTn87+46iRytAoQvpMjQs5vDIlXvlZP9iCMWwEb+y//Y6/siCZFwLkiexVYgV26yJjV9cPJUcOaiGAV5FsFvPEuSrOj1jAt54qKEEm5QLp+DmKPrcfBCcvw36clPrjolhMz/kg94zY8m4oKQxGfwSpoSX9hq4DBUlwo8YPaGzTn6hkV/kgW7j37+VKmBREOv7+hR6mQseL9oyNYRu92RBPK39KpB+m4Qa4Kov+3MfH5zrsnzKvgLDypid7t6xE7tN03EDOFmTMw6QkMl04EGRHsOfARtrz6A1+7P/2DZ/D55kUqE1k6fBU1V/epVSXjlv7nVbB6xl51vRPgVXDhl90wkzpkzzg5Iv0nGr64uALrlldh2iirgaV+665BbH2LDbl7CiIYSvrPmcWhxVkMsGfhc0ljB7ejd8d6RXC2CXz1Hkm5cOIIus8ew9Bw3I4yXVRVVqqIo+6eWZj1wK869cyEkdP7kKDrmzfmYduE/C7peKL/3BBuHB9w4gAb3vBApxOdnP1j95fIRQtKxPyZxaguh2rC0TMT/v2jcTLeI94TENAqx3vEUfWo9ZBhrOj68dRtevAsblFDPrOi9ivN4QHVwijNLaV917pw4tB7iMf8rlxpeSV+5ZEnUdswKee7fEzlOx9VYvvHo8T044jrx/vRFx2y9qjc7K0vV09fLC0CSmQfUXfgDYQ9u15SCH+44R5XlGi9snO675yoyNHzuxjDThkTP5MBlTX1CBcVts23eldhmy3jhcv7exDvtdxOLbkW9AlnJ0wLUCnek9LSlnT3eGOOtvSfPHxl54yHMqaS93AuM6EJdwB9cUSeft2shfpLlE8fZsKMnP6fy7RpKvRuoC267uFcr+rQGzBe2GLuBLlutKvfsy5WUxEpRfoL0Z0zs+KtwHQ0e0VUmFtb8OljS12ZWLz3udBDtFY/9fF4jH2rixd3/2fjQxDmC4A3X595isHNnsE5xKv1u5S+WELdet+z+jSEuaVr5/TFQcRn5N0PICawUV4J648pxhs8oXX2GAp7/rxoLdnylfzHFBh/0HjmOh5DV1zdOXMt6X7r+7wuqvSnj634zQngpOW2qsyozu/LrHaUziQXcN0VGiPfpAQKgH1yroXKn2B8wJLeYscfWXjsRdkYMpItJB/jMh5Lfbgk3BJZGTzepKVnG4mmGyg1sUK19xxVtKNW4VcvfrWUqaIMIbeUGUZLLqn3zQ1jgIcRTyHHXnIe6GCvNRfhM+EyIkTjqbHHNJ4wifCl4dZchM8EMyKdxgZaFc1Ez0b4AgVtI6zUjtc7Us8M9BMbtpQbRmshhNcYEwO8sA90cWFD1mgX75+pcuFM626+3vafqb6YbCaF2Qw2nEI02sLgGY/sFmQ7xaC7hSna93zl9v5MteHpk80U9z9FdqKJyNtIdG8kdtRa+wqil3R3vwlB34WINFOHe3bNjuAW8P/4M203oLS1YgAAAABJRU5ErkJggg==",km="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGAAAAAoCAYAAAABk/85AAAACXBIWXMAABYlAAAWJQFJUiTwAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAA0WSURBVHgB1ZsNcFTVFYDPe7thd7NZsonIT6CwQWvAnwTaRNuxQoJ2SqpViW3RiiMgVq2dgcy0dnRqkwz9Ga0dNjOt2BYVi2hpVaSFBmyRRWBajUoIWIlYWERAhWE3xoT87O7rOfftDW/fu+9vEzrTb+bN7rvvvnd2z7n3nHN/ngR5kvh7US2AMkvKKHMBpFkgQRgUPAgJkvg9jtfjkj+yTy6cGgvVbI3BCFAUpRY/ZuExN/sZzh5EEo949tiHR0ySpBiMhG+ivAzQ/5qL/8UoT8rKU1CeDDF4IT95kpvKiY3hsFw0uFxRpBXDynZO3Ddlaaz/g3UtJfXJuJMbUOkkYzkeKwDcy8MjhkcLGiPu6I6bUZ48AnkSyiuAFvijQ3ng0ABM8YVDTYr6w0aEHJgG8piStcGrdpsqJqv4JhgFeVnWgpUhVMWPnjwJ5Tk0hK0Bul8JLFdAbs6jxdsR945vaCmavW6tthCVTy2wGWD05YFqhLU5pbegPOX8yYOXdPJ0WBqge1twlTJ6rVCIJ1AWDc051EjfUfmrwIG8gVQG9hw6DfHTvew8Mi4INeWlEPJ7wQFRNAKTBw3O5I2QKBqh0eyi0ADkcqTg0EZsGbXwP8AfaezwXbKSAmmtVT1SfOexbtj/YZJ910LKr5g4Fg1RAnac+RQ6LljKEoVaq3qzIviDLgeoiqjfw0G1PH4KozDafuc7GGQOAHTEwRoJOiANdfCylDReEpDcFtwLaqbhCsmLiVAq6fY2KPryP8ETusKyTtfJHmiPJ6Cnf4idH/l3J+zZvJF9r7luPlR84Sr2nQxRHSmFGZNCps+a/QNU2hFzWYvrAO7Eo/YycET8E/Q1f8JAs8OiEgXoF6U6Y7GOfN2O7J8GwZo2SJ15Dc6+c6/j+/wVj4Bv2v2m108kz0L7kQT7ZOeHD0H79q34+X5OvXGTJsP8O5ZBqKSUnZMhbpo92eCWGp9Cn7BFLIsUvmoJtrxyyAsyxJJfY694x7SKwR3lGCDxSnCxpMDT4BKufDkwlZ0PHn/WkRHGlC2CwOVPCK/19KdQ8Weg66Me9TxxBt7c3gYH33rD8pkVX7wSaq6tHzZExcTQcHygFkoKErH8BtTOEhgVmrE3tGwwvdyIRojyk2EDJNr8EUn2UCeKgAv0yufYGcHsPr2fH+g/C517YrB/90723SnV6JYqr64Fnz/AzicXj4Plvy9mrVRP07dRaQthVLEwQhIHeOU8Hnh46UN3+igjqAUXmCmRPXhsJV6fCqlTm4X3+mc8At7Sa3LKyM9v6TwJx870QTqjQNdbr8OWp5+AY+8dhHQqBW4gF/V+59vgCwTQPU2Bx/9WBAeO+gz1zofyCRY/JDVQ6/BjuR/ebdkGkO0B2dZ/BFxgpXwtop5A94bm5P6yTXtP2Pr5fPGPmwntvl8ayiPjMZivhvNK3U9MYkIGSqgXsAglezxNigKOMVO+kurGTKg4p2zM5EXsU2sE38UP5tShlk/KZ35+28twcN8+GE3eT39NWL6jBRxBKSdlTZR+EpEL1UDN01Irnv6+mnUle3UXZJboNDMDKC7yfTPlZ85+AL1v1oO35BpDYNUbwVsyJ+f6p9nUsuvt102VPzYUhBu/fh1UXFIOkydNgOMnP4aHV0Zh0cKbWJmW9Rv+AgffOzx83uurNDyPUk3qAVaQ0lo3q1mTQYHZZ5ALs3oOXVuBAb7ZGA/YiN+baGOzmhFwgJ3yM2ePwiAehJkRBk+ut3VbemZ8fjo8+fgvIBQ61+Ta1+xnhrhv2Xdyyjdt+YeqfB+WDfSi8q+AQY9RQ6Q4KyhY1zWBMGhzKKsi90I9ycoIy68XGiBMM64ydoVacEim/yikMc/PKdMonzN4Av3+AWMGlE7sZj3ELdFHf5yj5BMnP4HVa56De5fdllNOrF7zPGQq5kC6uoGdkwH0kPuwUhi1djvlc7ihkn3mdchVCQd1ON0tYxSuAhf0oRsZwsDK7hcon6M3An2nMk+oEtxALbxsUq62Hl65Cm66/jp2aCGjnPgsA5maBshUzgelbCacLZhueKbdCJfSRyfK51Dd1r9a16EpDQPo+mXMgyJWNzK3U93GPjlkhP7//NygfHI7voseGj7nRuDKV5/n3P1wF6OFXEzXocOGct4r0qh8JXQhK0vPuwcGC43D2rk2BlgbA9ewOGHRC2guyYAEVV4r/6/1+fTZ217P3BAxgAbQQsqnkS2HX+eKH35m4TRwCvl9LaqSn4fbMfDqe8Wj0d+h3y9k7odDhhj0jKWunkO40Fwm+XRRwLWD7nnmVXXiTkRC/Myw12yeXx9wRUbg6JXvz/YCvZEKsI4+TTVD5HpWr1nPBi6iXvHqzn+pv/PEu5BB18PJDBnnG638vxvXo2eF60kcCMumlyTn5QrGAidlTtc/zVzPpi3bDb2ip6dXDbzl1TgDdyHIu9fB/xPe7AK6oReQbycfz/w/tn6rgNufbenc/2t9vhYqoykIu15gpmQKuvpe8eyGTWrgvXYRZHpOg3fTT8Hz5ouYBd3CrssFiqEXWLkYu7GBFU0LzQM8nynVkSQXRJNCQjfEjRC47Ak2iNIqnxQ5GH982B1xI5ChtMovyLqmoWyZMpS0NIDY9TwndD3DgReDLQu8eKQr68HTuZXFAirzCAywL24+5cwXXvKJAzTgMosvMVGhBHF0QVIHWMCNYMh2pt6vxghNdkRG0Cu/EOvSwQ2R7tlvKqts4gShkqmVU84vDLyoZG3gzVD+PyYInld/y879xWmDHKsVLFI+KdItNCq2Cu47DwgKM3BUxnXYneACbcDlgVlrBA5XPocbIXVml+mzH1i2wFC29HsPwry5XzLk/Dzwput1y62YCaWwR0gYjIsP74LABcZZVIsFEwaNXN24IqprN7IWysSlShkU6x6QUx9dh34eR2QEvfKHy0u/gn66U/jsmkiJYfWKDaxwzueBFd/NKecxgf2mfVsNz6IBmIJBuS/2Bwj4PzNcp4m1mKhFZqFeYDe9wKE6dnXJ/wsNIENMLqn/LMYCsQNotlN1R7kZjtYIZsqnGNCHwTmV2MWeoyUUKIDq8tKcMu7fRTGBBV40DJPd9RpLPfWk6u4BamJFRzawQKznmRhYQgrd+1jWrwtmPamMgi7VsTMUrRcLiNNuuux6QFGzJCtN4BDaXMWzIy1kGNFEG1c+h7Ilv2bELOIudD1khLaNT+aUU9n8BUtzyijYpr71M3UCTvs70TgUCz6asRJO9cw2yNj7K5MRqg42HR0/N0bgcztOpqPpnvL7BBdo89aL0hJ1HOD3RsEF5wKzsSfo0SufGDz6G7CC/Hv72/vhhyvuNlxjgVeH1HMKU8+XDOUsE0J3VCW3gQhaoHcCVzgFWjpuvtKZ8gmzNWi2cw7ICyEldcmkokit4AIzI2gRKZ8gFzRgYgQ+3UBBl4KvFu2IV4+MqafeFY31pKHu9ruh4Y6FMK+q23AP+eVG96NXx5DrMQm+a/m2xXMjYZ+32Wks4FgZwUz5HJqm0McCgvz9oltvNKSj2sBrhkypJ64B+CQFrirug9smJWFmqQf/moz+WhG22uhmyx0MeUPKbxY/N85bPzG8KP/IM/39P7ptzIAkw3xwASmRFt4Lxn8DpAJ1gGWnfEZmAAcFA+Ad91XDpcrLZxjm+fe89wns7zoCp08eN32kNNgHM6d/Dm6sCMK0wBB4JXVbyvVVZXDR+AD4CwC2CXI+aqUUDIVTxnlgoXyiEf58biu7YXomsbUoKklsg6wreGBOJ16zV74Gu41ZBG1PeWqXumeA1o13vLAejusW7CdPvxiqr62HMvwkysIBtk2RPrWQy4mKN2o4SimtsN2YpUArbJRyNr2Jtya+EtyRz75QMoJorsgOMpx+i4oe2qBFO+T41sSut96A9u1qcL36hgYov1Rd+aKxxLyZ4w2K12K6UyGLk7VeLTSuaN1iuzWxA7Oe2cZiAYkd4bA0NLQj+2bIeWfMhAWxQNU6mo+yldf5YRI6j306bAgO+fnKzxXDFVPC7LsVp7ohNv4u9kaPpTyaL6LshxZwaJqBG4SnpTSnxAZ1NiNrti80DQscb87l5OuO3CD5p7QWz+1i3RKnRSgdtpXHty3y7enk52kgZ6f4LK2SlHUDC1CeBOf1/4ncjhbbKfpEW3CxpL49EoFRRCooSRZMvLWl8NLHcsYgaITFAKMvD9T3yOgFjdwxT8P5lafdByrC2StKbf4IyJ5mrHwnjBDawg5yUWsm+XFzyYKkMO1FI0RAfUtmxPKy0BinGZUvTrNvRnkSUBo+OvKo1dNbNy9Ltmm900UqhsYQ9KZixM29UkE4mRnoboV+b9RM8Xo0hnAtD9QWSIqPmipezzlD5C8vA1Eniue4MoAWtqFLhlp0T1Vo7Qhb3M99TTUp+yZ0pPs/3um94JqOUXpNlQ7aRhPJHtrXVOmgLJ+m1ztG6TXVWtq5wGQpAnmU2SgoT8bPPF9T/S+t/b7McgGVIAAAAABJRU5ErkJggg==",Mm=({isOpen:e,isLoading:t=!1,onClose:n,accountChains:r,defaultChainId:o,defaultSymbol:s,defaultAccountType:i,balances:l,wagmiHooks:a,onDeposit:c,onCopy:u,getUserBizConfig:f,saveUserBizConfig:p,onChainChange:d,onTokenChange:h})=>{const{t:b}=$t(),w=g.useMemo(()=>r.map(H=>({...H,key:Bi(H.key)})),[r]),P=g.useMemo(()=>Bi(i),[i]),x=g.useMemo(()=>w.some(H=>H.key===ze.PERPETUALV2),[w]),E=g.useMemo(()=>{var ee;if(!w||w.length===0)return P;const H=w.find(Q=>Q.key===P);return(H==null?void 0:H.key)||((ee=w[0])==null?void 0:ee.key)||P},[w,P]),[A,D]=g.useState(E),L=g.useCallback(H=>{var ee;return((ee=w.find(Q=>Q.key===H))==null?void 0:ee.chains)||[]},[w]),F=L(E),m=()=>{var he;if(!F||F.length===0)return{chainId:o||1,token:""};const H=o||((he=F[0])==null?void 0:he.chainId),ee=F.find(Ee=>Ee.chainId===H)||F[0],Q=(ee==null?void 0:ee.tokenList)||[],ve=(s||"").toUpperCase();if(ve&&Q.length>0){const Ee=Q.find(Fe=>(Fe.token||Fe.symbol||"").toUpperCase()===ve);if(Ee)return{chainId:ee.chainId,token:Ee.token||Ee.symbol||""}}if(ve)for(const Ee of F){const we=((Ee==null?void 0:Ee.tokenList)||[]).find(Ae=>(Ae.token||Ae.symbol||"").toUpperCase()===ve);if(we)return{chainId:Ee.chainId,token:we.token||we.symbol||""}}const Z=Q.length>0?ee:F.find(Ee=>(Ee.tokenList||[]).length>0)||ee,ie=((Z==null?void 0:Z.tokenList)||[])[0];return{chainId:(Z==null?void 0:Z.chainId)||ee.chainId||1,token:(ie==null?void 0:ie.token)||(ie==null?void 0:ie.symbol)||""}},[{chainId:v,token:S}]=g.useState(()=>m()),[$,I]=g.useState(v),C=g.useMemo(()=>w.find(H=>H.key===A)||w[0],[w,A]),M=g.useMemo(()=>(C==null?void 0:C.chains)||[],[C]),y=g.useMemo(()=>{var Z,ie;if(!C||!_c(C.account)||!(A===ze.SPOT||A===ze.PERPETUALV2))return!1;const Q=!!((Z=C.walletOptions)!=null&&Z.evm),ve=!!((ie=C.walletOptions)!=null&&ie.mpc);return Q&&ve},[C,A]),O=g.useCallback(()=>{var H,ee;return(H=C==null?void 0:C.walletOptions)!=null&&H.evm?"evm":(ee=C==null?void 0:C.walletOptions)!=null&&ee.mpc||C!=null&&C.account&&fs(C.account)?"mpc":"evm"},[C]),[k,T]=g.useState(()=>y?null:O()),B=g.useRef(A),R=g.useRef(y);g.useEffect(()=>{const H=B.current!==A,ee=!R.current&&y;if(B.current=A,R.current=y,y){(H||ee)&&T(null);return}T(O())},[A,y,O]);const z=g.useMemo(()=>{if(!C)return;if(!y)return C.account;if(!k)return;const H=C.walletOptions;return k==="mpc"?(H==null?void 0:H.mpc)||C.account:(H==null?void 0:H.evm)||C.account},[C,k,y]),_=g.useMemo(()=>z&&fs(z)?gn:Zs,[z]),G=M.find(H=>H.chainId===$)||M[0],[J,K]=g.useState(S),W=g.useCallback(H=>{I(H),d==null||d(H)},[d]),ne=g.useCallback(H=>{K(H),h==null||h(H)},[h]),be=g.useMemo(()=>{const H=(J||"").toLowerCase();if(!H)return"0";const ee=(l==null?void 0:l[A])||(A===ze.PERPETUAL?l==null?void 0:l.perp:void 0),Q=ee==null?void 0:ee[H];return typeof Q=="string"&&Q.length>0?Q:"0"},[l,A,J]),[fe,xe]=g.useState(!1),ye=H=>{H.target===H.currentTarget?xe(!0):xe(!1)},Y=H=>{fe&&H.target===H.currentTarget&&n(),xe(!1)};return e?Ke.createPortal(N.jsx("div",{className:"edgex-components",children:N.jsx("div",{className:"fixed top-0 left-0 right-0 bottom-0 w-screen h-screen",style:{zIndex:98},children:N.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:ye,onMouseUp:Y,"aria-hidden":"true",children:N.jsxs("div",{className:"relative w-[420px] max-h-[85vh] bg-fill-page-secondary overflow-auto rounded-lg p-6 shadow-xl border-2 border-solid border-line-divider-secondary",onClick:H=>{H.stopPropagation()},children:[N.jsxs("div",{className:"flex items-center justify-between mb-4",children:[N.jsx("h2",{className:"text-lg font-semibold text-white",children:b("deposit.title")}),N.jsx("button",{className:"text-gray-400 hover:text-gray-200 transition-colors",onClick:n,"aria-label":"Close",children:N.jsx(C0,{className:"h-4 w-4"})})]}),N.jsx(jh,{selectedAccount:A,options:w.map(H=>({value:H.key,label:H.key===ze.SPOT?b("account.spot"):H.key===ze.PERPETUAL?b(x?"account.perpetual-v1":"account.perp"):H.key===ze.PERPETUALV2?b("account.perpetual-v2"):H.key})),onAccountChange:H=>{var we,Ae;const ee=H||A;D(ee);const Q=L(ee);if(!Q||Q.length===0)return;const ve=Q.find(lt=>lt.chainId===$),Z=ve?ve.chainId:Q[0].chainId;I(Z),d==null||d(Z);const ie=Q.find(lt=>lt.chainId===Z),he=(ie==null?void 0:ie.tokenList)||[],Fe=he.some(lt=>(lt.symbol||lt.token)===J)?J:((we=he[0])==null?void 0:we.symbol)||((Ae=he[0])==null?void 0:Ae.token)||"";Fe&&(K(Fe),h==null||h(Fe))},className:"w-full"}),N.jsx(Rh,{currentActiveChain:G,chainList:M,onChainChange:W,curSelectToken:J,onTokenChange:ne,walletType:_,accountType:A}),y&&!k&&N.jsxs("div",{className:"mb-4",children:[N.jsx("div",{className:"h-px w-full bg-[#404040] my-4"}),N.jsx("button",{type:"button",onClick:()=>T("evm"),className:"w-full text-left rounded-lg px-3 py-[10px] bg-[#303030]",children:N.jsxs("div",{className:"flex flex-col gap-2",children:[N.jsxs("div",{className:"flex items-center justify-between gap-3",children:[N.jsx("div",{className:"text-text-primary font-edgex-harmony text-[14px] font-medium leading-[18px]",children:b("deposit.connectedWalletTitle")}),N.jsx("div",{className:"flex items-center gap-1 shrink-0",children:N.jsx("img",{src:$m,className:"w-12 h-5"})})]}),N.jsx("div",{className:"text-text-secondary font-edgex-harmony text-[12px] font-normal leading-[18px]",children:b("deposit.connectedWalletDesc")})]})}),N.jsxs("div",{className:"flex items-center my-2",children:[N.jsx("div",{className:"flex-1 border-t border-dashed border-[#242424]"}),N.jsx("span",{className:"mx-4 text-xs text-text-tertiary",children:b("deposit.or")}),N.jsx("div",{className:"flex-1 border-t border-dashed border-[#242424]"})]}),N.jsx("button",{type:"button",onClick:()=>T("mpc"),className:"w-full text-left rounded-lg px-3 py-[10px] bg-[#303030]",children:N.jsxs("div",{className:"flex flex-col gap-2",children:[N.jsxs("div",{className:"flex items-center justify-between gap-3",children:[N.jsx("div",{className:"text-text-primary font-edgex-harmony text-[14px] font-medium leading-[18px]",children:b("deposit.externalWalletTitle")}),N.jsx("div",{className:"flex items-center gap-1 shrink-0",children:N.jsx("img",{src:km,className:"w-12 h-5"})})]}),N.jsx("div",{className:"text-text-secondary font-edgex-harmony text-[12px] font-normal leading-[18px]",children:b("deposit.externalWalletDesc")})]})})]}),(!y||k)&&N.jsxs(N.Fragment,{children:[z&&fs(z)&&N.jsx(VS,{address:z.smartWalletAddress,currentActiveChain:G,selectedToken:J,accountType:A,accountId:z.accountId,accountKey:C==null?void 0:C.key,onDeposit:c,onCopy:u,getUserBizConfig:f,saveUserBizConfig:p,onClose:n}),z&&_c(z)&&N.jsx(nP,{address:z.ethAddress,currentActiveChain:G,selectedToken:J,accountType:A,accountId:z.accountId,accountKey:C==null?void 0:C.key,platformBalance:be,isLoading:t,wagmiHooks:a,onChainChange:W,onDeposit:c,onClose:n})]})]})})})}),document.body):null},rP=({withdrawAmount:e,curSelectToken:t,tokenInfo:n,currentActiveChain:r,platformBalance:o="0",fee:s="0.00",walletType:i="evm",receiverAddress:l="",accountType:a="perpetual",onWithdrawAmountChange:c,onReceiverAddressChange:u,onAmountChanged:f,showPoolBalanceInsufficientTip:p=!1})=>{const{t:d}=$t(),h=g.useMemo(()=>{if(a==="spot"||!Pn(r==null?void 0:r.chainId)){const L=new Re(e||"0").minus(s||"0");if(L.isNegative()||L.isZero())return"0";const F=Math.min(L.decimalPlaces()??0,18);return L.decimalPlaces(F,Re.ROUND_DOWN).toString()}return e||"0"},[e,s,r==null?void 0:r.chainId,a]),b=g.useMemo(()=>o||"0",[o]),w=g.useMemo(()=>{const L=(n==null?void 0:n.feeRate)||(n==null?void 0:n.withdrawFeeRate)||(r==null?void 0:r.feeRate)||0;try{return new Re(L||0).times(100).toString()}catch{return"0"}},[n==null?void 0:n.feeRate,n==null?void 0:n.withdrawFeeRate,r==null?void 0:r.feeRate]),P=g.useMemo(()=>w==="0",[w]),x=g.useMemo(()=>{const L=(t||"").toUpperCase();return L==="USDT"||L==="USDC"},[t]),E=L=>{const F=L.target.value,v=Mi(F,b||"0");if(v.isValid)c(v.formattedValue),v.errorType;else return v.errorType==="exceed_balance",void 0;f==null||f(v.formattedValue)},A=()=>{const L=b||"0",m=Mi(L,L).formattedValue;c(m),f==null||f(m)},D=()=>{const L=parseFloat(o||"0"),F=parseFloat(e||"0");if(F>0){const m=L-F,v=Wt(Math.max(0,m).toString());return N.jsxs("span",{className:"flex items-center gap-1",children:[Wt(o||"0"),N.jsx("span",{className:"text-sm font-edgex-harmony text-functional-green-1 leading-[18px] font-medium",children:"→"}),v," ",t]})}return`${Wt(o||"0")} ${t}`};return N.jsxs(N.Fragment,{children:[N.jsxs("div",{className:"bg-fill-input-primary rounded-lg px-3 py-3 my-4",children:[N.jsxs("div",{className:"flex justify-between items-center h-[18px] mb-3",children:[N.jsx("input",{type:"text",placeholder:d("deposit.amount"),value:e,onChange:E,className:"flex-1 bg-transparent text-text-primary text-sm font-medium placeholder-text-tertiary placeholder:font-normal focus:outline-hidden border-none p-0 h-full"}),N.jsx("button",{onClick:A,className:"text-theme-normal text-xs font-medium cursor-pointer hover:opacity-80 transition-opacity h-full flex items-center",children:d("deposit.max")})]}),N.jsx("div",{className:"h-px bg-line-divider-secondary mb-2"}),N.jsxs("div",{className:"flex justify-between items-center",children:[N.jsx(Tn,{content:d("withdraw.availableDesc"),children:N.jsx("span",{className:"text-text-tertiary text-xs leading-[14px] border-b border-dashed border-line-divider-primary",children:d("deposit.available")})}),N.jsx("span",{className:"text-text-primary text-xs leading-[14px]",children:D()})]})]}),i==="mpc"&&(a==="spot"||!Pn(r==null?void 0:r.chainId))?N.jsx("div",{className:"bg-fill-input-primary rounded-lg my-4 h-9 flex items-center px-3",children:N.jsx("input",{type:"text",placeholder:d("withdraw.receiverAddress"),value:l,onChange:L=>u==null?void 0:u(L.target.value),className:"flex-1 bg-transparent text-text-primary text-sm font-medium placeholder-text-tertiary placeholder:font-normal focus:outline-hidden border-none p-0 h-full"})}):null,N.jsx("div",{className:"bg-fill-page-secondary rounded-lg mb-4",children:Pn(r==null?void 0:r.chainId)?N.jsxs(N.Fragment,{children:[N.jsx("p",{className:"text-text-tertiary text-xs leading-[18px]",children:d("withdraw.noticeDesc")}),N.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")})]}):N.jsx("p",{className:"text-text-tertiary text-xs leading-[18px]",children:d("withdraw.crossChainTips")})}),p&&N.jsxs("div",{className:"flex mb-4",children:[N.jsx("div",{className:"w-5",children:N.jsx("img",{src:cs,className:"w-4 h-4",alt:"Warning"})}),N.jsx("div",{className:"flex-1 text-xs text-functional-orange-1",children:d("withdraw.poolBalanceInsufficientTip")})]}),N.jsxs("div",{className:"py-4 border-t border-line-divider-secondary border-dashed",children:[N.jsxs("div",{className:"flex items-center justify-between h-[18px] leading-[18px]",children:[N.jsx(Tn,{content:N.jsxs("div",{children:[N.jsx("div",{children:d("withdraw.speedNote")}),N.jsxs("div",{className:"flex gap-1 items-center mt-1",children:[N.jsx(is,{selectedLevel:_t.FAST,maxLevel:3}),N.jsx("span",{children:d("withdraw.speedNoteSpeed1")})]}),N.jsxs("div",{className:"flex gap-1 items-center mt-1",children:[N.jsx(is,{selectedLevel:_t.Medium,maxLevel:3}),N.jsx("span",{children:d("withdraw.speedNoteSpeed2")})]}),N.jsxs("div",{className:"flex gap-1 items-center mt-1",children:[N.jsx(is,{selectedLevel:_t.SLOW,maxLevel:3}),N.jsx("span",{children:d("withdraw.speedNoteSpeed3")})]})]}),children:N.jsx("span",{className:"text-text-tertiary text-sm leading-4 border-b border-dashed border-line-divider-primary",children:d("withdraw.speed")})}),N.jsx("div",{className:"flex items-center",children:N.jsx(is,{selectedLevel:Pn(r==null?void 0:r.chainId)?_t.SLOW:_t.FAST,maxLevel:3})})]}),(a==="spot"||!Pn(r==null?void 0:r.chainId))&&N.jsxs("div",{className:"flex items-center justify-between mt-2 h-[18px]",children:[P||!x?N.jsx("span",{className:"text-text-tertiary text-sm leading-4",children:P?d("withdraw.fee"):`${d("withdraw.fee")}/${d("withdraw.feeRate")}`}):N.jsx(Tn,{className:"w-[320px] font-normal flex items-center justify-center",content:N.jsx("span",{className:"flex items-center justify-center text-center",children:d("withdraw.feeCalculationTip")}),children:N.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")}`})}),N.jsxs("span",{className:"text-text-primary text-sm leading-4 font-medium",children:[s," ",t,!P&&` / ${w}%`]})]}),N.jsxs("div",{className:"flex items-center justify-between mt-2 h-[18px]",children:[N.jsx("span",{className:"text-text-tertiary text-sm leading-4",children:d(Pn(r==null?void 0:r.chainId)?"withdraw.withdrawlAmount":"withdraw.amountToReceive")}),N.jsxs("span",{className:"text-text-primary text-sm leading-4 font-medium",children:[Wt(h)," ",t]})]})]})]})};let at=null;const Wc={accountChains:[],defaultAccountType:""},Dm=g.forwardRef((e,t)=>{const[n,r]=g.useState(!1),[o,s]=g.useState(!1),[i,l]=g.useState(Wc),a=g.useCallback(h=>{l(h||Wc),r(!0)},[]),c=g.useCallback(h=>{l(b=>({...b,...h}))},[]),u=g.useCallback(()=>{r(!1),s(!1),i.onClose&&i.onClose()},[i.onClose]),f=g.useCallback(h=>{s(h)},[]),p=g.useCallback(()=>n,[n]),d=g.useCallback(()=>o,[o]);return g.useImperativeHandle(t,()=>({openWithdraw:a,closeWithdraw:u,updateWithdrawOptions:c,setWithdrawLoading:f,isOpen:p,isLoading:d}),[a,u,c,f,p,d]),g.useEffect(()=>(at={openWithdraw:a,closeWithdraw:u,updateWithdrawOptions:c,setWithdrawLoading:f,isOpen:p,isLoading:d},()=>{at=null}),[a,u,c,f,p,d]),n?N.jsx(jm,{isOpen:n,isLoading:o,onClose:u,config:i.config||{symbol:"USDT"},accountChains:i.accountChains,balances:i.balances,defaultChainId:i.defaultChainId,defaultSymbol:i.defaultSymbol,defaultAmount:i.defaultAmount,defaultAccountType:i.defaultAccountType,currentEquity:i.currentEquity??5e3,platformBalance:i.platformBalance||"0",fee:i.fee,wagmiHooks:i.wagmiHooks,onWithdraw:i.onWithdraw,onAccountChange:i.onAccountChange,onChainChange:i.onChainChange,onTokenChange:i.onTokenChange,onAmountChanged:i.onAmountChanged}):null});Dm.displayName="WithdrawManager";const Bm=e=>{if(!at){console.error("WithdrawManager not initialized. Make sure to render <WithdrawManager /> in your app.");return}at.openWithdraw(e||Wc)},Lm=()=>{if(!at){console.error("WithdrawManager not initialized. Make sure to render <WithdrawManager /> in your app.");return}at.closeWithdraw()},Fm=e=>{if(!at){console.error("WithdrawManager not initialized. Make sure to render <WithdrawManager /> in your app.");return}at.updateWithdrawOptions(e)},Li=e=>{if(!at){console.error("WithdrawManager not initialized. Make sure to render <WithdrawManager /> in your app.");return}at.setWithdrawLoading(e)},oP=()=>at?at.isOpen():!1,Rm=()=>at?at.isLoading():!1,sP=()=>({openWithdraw:Bm,closeWithdraw:Lm,updateWithdrawOptions:Fm,setWithdrawLoading:Li,isOpen:oP,isLoading:Rm}),iP=({accountChains:e,defaultChainId:t,defaultSymbol:n,defaultAmount:r="",defaultAccountType:o,currentEquity:s,platformBalance:i="0",balances:l,fee:a="0.00",isLoading:c=!1,onWithdraw:u,onClose:f,onChainChange:p,onTokenChange:d,onAmountChanged:h,onAccountChange:b})=>{var ve;const{t:w}=$t(),P=g.useMemo(()=>e.map(Z=>({...Z,key:Bi(Z.key)})),[e]),x=g.useMemo(()=>Bi(o),[o]),E=g.useMemo(()=>P.some(Z=>Z.key===ze.PERPETUALV2),[P]),A=g.useMemo(()=>{var ie;if(!P||P.length===0)return x;const Z=P.find(he=>he.key===x);return(Z==null?void 0:Z.key)||((ie=P[0])==null?void 0:ie.key)||x},[P,x]),[D,L]=g.useState(A),F=g.useCallback(Z=>{var ie;return((ie=P.find(he=>he.key===Z))==null?void 0:ie.chains)||[]},[P]),m=g.useMemo(()=>P.find(Z=>Z.key===D)||P[0],[P,D]),v=g.useMemo(()=>(m==null?void 0:m.chains)||[],[m]),S=g.useMemo(()=>{var Fe,we;if(!m||!_c(m.account)||!(D===ze.SPOT||D===ze.PERPETUALV2))return!1;const he=!!((Fe=m.walletOptions)!=null&&Fe.evm),Ee=!!((we=m.walletOptions)!=null&&we.mpc);return he&&Ee},[m,D]),$=g.useCallback(()=>{var Z,ie;return(Z=m==null?void 0:m.walletOptions)!=null&&Z.evm?"evm":(ie=m==null?void 0:m.walletOptions)!=null&&ie.mpc||m!=null&&m.account&&fs(m.account)?"mpc":"evm"},[m]),[I,C]=g.useState(()=>S?null:$());g.useEffect(()=>{C(S?null:$())},[D,S,$]);const M=g.useMemo(()=>{if(!m)return;if(!S)return m.account;if(!I)return;const Z=m.walletOptions;return I==="mpc"?(Z==null?void 0:Z.mpc)||m.account:(Z==null?void 0:Z.evm)||m.account},[m,S,I]),y=g.useMemo(()=>M&&fs(M)?"mpc":"evm",[M]),O=y==="mpc"?gn:Zs,k=g.useMemo(()=>{if(!v||v.length===0)return{chainId:1,tokenSymbol:""};const Z=we=>{const Ae=we||[];if(!Ae.length)return"";const Ge="USDC".toUpperCase(),Vn=Ae.find(Ht=>(Ht.token||Ht.symbol||"").toUpperCase()===Ge)||Ae[0];return Vn.token||Vn.symbol||""};if(n){const we=n==null?void 0:n.toUpperCase();for(const Ae of v){const lt=Ae.tokenList||[];let Ge;if(we&&(Ge=lt.find(Vt=>(Vt.token||Vt.symbol||"").toUpperCase()===we)),Ge){const Vt=Ge.token||Ge.symbol||n||"";return{chainId:Ae.chainId,tokenSymbol:Vt}}}}if(t){const we=v.find(Ge=>Ge.chainId===t)||v[0],Ae=we.tokenList||[],lt=Z(Ae);return{chainId:we.chainId,tokenSymbol:lt}}const ie="USDC",he=we=>Array.isArray(we.tokenList)&&we.tokenList.some(Ae=>(Ae.token||Ae.symbol||"").toUpperCase()===ie),Ee=v.find(he)||v[0];if(!Ee)return{chainId:1,tokenSymbol:""};const Fe=Z(Ee.tokenList);return{chainId:Ee.chainId,tokenSymbol:Fe}},[v,t,n]),[T,B]=g.useState(()=>k.chainId),[R,z]=g.useState(()=>k.tokenSymbol),[_,G]=g.useState(r),[J,K]=g.useState(""),W=g.useCallback(Z=>{B(Z),p==null||p(Z)},[p]),ne=g.useCallback(Z=>{z(Z),d==null||d(Z)},[d]),be=g.useRef(!0),fe=g.useRef(R),xe=g.useRef(T);g.useEffect(()=>{if(be.current){be.current=!1,fe.current=R,xe.current=T;return}(fe.current!==R||xe.current!==T)&&(G(""),fe.current=R,xe.current=T)},[R,T]);const ye=v&&v.length>0?v.find(Z=>Z.chainId===T)||v[0]:null,Y=(ve=ye==null?void 0:ye.tokenList)==null?void 0:ve.find(Z=>Z.token===R),H=g.useMemo(()=>{const Z=new Re(_||"0"),ie=new Re(a||"0"),he=Pn(T);return Y!=null&&Y.minWithdrawSize&&Z.lt(Y.minWithdrawSize)?{text:w("withdraw.minWithdrawParsed",{amount:Y.minWithdrawSize,token:Y.symbol||Y.token}),disabled:!0}:!_||Z.isZero()||!he&&Z.isLessThan(ie)?{text:w("withdraw.confirmWithdraw"),disabled:!0}:y==="mpc"&&(!he||D==="spot")&&!J.trim()?{text:w("withdraw.invalidReceiverAddress"),disabled:!0}:{text:w("withdraw.confirmWithdraw"),disabled:!1}},[w,T,_,y,J,a,D,Y]),ee=g.useMemo(()=>{const Z=(R||"").toLowerCase();if(!Z)return i||"0";const ie=(l==null?void 0:l[D])||(D===ze.PERPETUAL?l==null?void 0:l.perp:void 0),he=ie==null?void 0:ie[Z];return typeof he=="string"&&he.length>0?he:i||"0"},[l,D,R,i]),Q=g.useCallback(async()=>{Li(!0);try{if(u){const ie={amount:new Re(_||"0").toString(),chainId:T,tokenAddress:(Y==null?void 0:Y.tokenAddress)||"",coinId:(Y==null?void 0:Y.coinId)||"",tokenSymbol:R,accountType:D,selectedToken:Y};y==="mpc"&&(!Pn(T)||D==="spot")&&(ie.receiverAddress=J),u(ie)}}catch{Li(!1)}},[u,D,Y,_,T,R,y,J]);return!v||v.length===0?N.jsx("div",{className:"text-center py-8",children:N.jsx("p",{className:"text-gray-400",children:"No chains available"})}):ye?N.jsxs(N.Fragment,{children:[N.jsx(jh,{selectedAccount:D,options:P.map(Z=>({value:Z.key,label:Z.key===ze.SPOT?w("account.spot"):Z.key===ze.PERPETUAL?w(E?"account.perpetual-v1":"account.perp"):Z.key===ze.PERPETUALV2?w("account.perpetual-v2"):Z.key})),onAccountChange:Z=>{var Vt,Vn;const ie=Z||D;L(ie),b==null||b(ie);const he=F(ie);if(!he||he.length===0)return;const Ee=he.find(Ht=>Ht.chainId===T),Fe=Ee?Ee.chainId:he[0].chainId;B(Fe),p==null||p(Fe);const we=he.find(Ht=>Ht.chainId===Fe),Ae=(we==null?void 0:we.tokenList)||[],Ge=Ae.some(Ht=>(Ht.symbol||Ht.token)===R)?R:((Vt=Ae[0])==null?void 0:Vt.symbol)||((Vn=Ae[0])==null?void 0:Vn.token)||"";Ge&&(z(Ge),d==null||d(Ge))},className:"w-full"}),N.jsx(Rh,{currentActiveChain:ye,chainList:v,onChainChange:W,curSelectToken:R,onTokenChange:ne,walletType:O,txType:"withdraw"}),S&&!I&&N.jsxs("div",{className:"mb-4",children:[N.jsx("div",{className:"h-px w-full bg-[#404040] my-4"}),N.jsx("button",{type:"button",onClick:()=>C("evm"),className:"w-full text-left rounded-lg px-3 py-[10px] bg-[#303030]",children:N.jsxs("div",{className:"flex flex-col gap-2",children:[N.jsxs("div",{className:"flex items-center justify-between gap-3",children:[N.jsx("div",{className:"text-text-primary font-edgex-harmony text-[14px] font-medium leading-[18px]",children:w("withdraw.connectedWalletTitle")}),N.jsx("div",{className:"flex items-center gap-1 shrink-0",children:N.jsx("img",{src:$m,className:"w-12 h-5",alt:"EVM"})})]}),N.jsx("div",{className:"text-text-secondary font-edgex-harmony text-[12px] font-normal leading-[18px]",children:w("withdraw.connectedWalletDesc")})]})}),N.jsxs("div",{className:"flex items-center my-2",children:[N.jsx("div",{className:"flex-1 border-t border-dashed border-[#242424]"}),N.jsx("span",{className:"mx-4 text-xs text-text-tertiary",children:w("deposit.or")}),N.jsx("div",{className:"flex-1 border-t border-dashed border-[#242424]"})]}),N.jsx("button",{type:"button",onClick:()=>C("mpc"),className:"w-full text-left rounded-lg px-3 py-[10px] bg-[#303030]",children:N.jsxs("div",{className:"flex flex-col gap-2",children:[N.jsxs("div",{className:"flex items-center justify-between gap-3",children:[N.jsx("div",{className:"text-text-primary font-edgex-harmony text-[14px] font-medium leading-[18px]",children:w("withdraw.externalWalletTitle")}),N.jsx("div",{className:"flex items-center gap-1 shrink-0",children:N.jsx("img",{src:km,className:"w-12 h-5",alt:"MPC"})})]}),N.jsx("div",{className:"text-text-secondary font-edgex-harmony text-[12px] font-normal leading-[18px]",children:w("withdraw.externalWalletDesc")})]})})]}),(!S||I)&&N.jsxs(N.Fragment,{children:[N.jsx(rP,{withdrawAmount:_,curSelectToken:R,tokenInfo:Y,curSelectTokenData:{balance:Y==null?void 0:Y.balance,allowance:Y==null?void 0:Y.allowance},currentActiveChain:ye,currentEquity:s||0,decimals:(Y==null?void 0:Y.decimals)||6,platformBalance:ee,fee:a,walletType:y,accountType:D,receiverAddress:J,onWithdrawAmountChange:G,onReceiverAddressChange:K,onAmountChanged:h}),N.jsxs("button",{className:`w-full h-[38px] text-sm rounded-xl font-medium transition-colors flex items-center justify-center gap-2 ${H.disabled||c?"bg-text-disabled text-text-secondary cursor-not-allowed":"bg-fill-btn-primary text-text-on-sec-btn"}`,onClick:Q,disabled:H.disabled||c,children:[c&&N.jsx(us,{size:"xs"}),H.text]})]})]}):N.jsx("div",{className:"text-center py-8",children:N.jsx("p",{className:"text-gray-400",children:"Loading..."})})},jm=({isOpen:e,isLoading:t=!1,defaultAccountType:n,onClose:r,config:o,accountChains:s,defaultChainId:i,defaultSymbol:l,defaultAmount:a="",currentEquity:c=5e3,platformBalance:u="0",balances:f,fee:p,wagmiHooks:d,onWithdraw:h,onChainChange:b,onTokenChange:w,onAmountChanged:P,onAccountChange:x})=>{const{t:E}=$t(),[A,D]=g.useState(!1),L=m=>{m.target===m.currentTarget?D(!0):D(!1)},F=m=>{A&&m.target===m.currentTarget&&r(),D(!1)};return e?Ke.createPortal(N.jsx("div",{className:"edgex-components",children:N.jsx("div",{className:"fixed top-0 left-0 right-0 bottom-0 w-screen h-screen",style:{zIndex:98},children:N.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:L,onMouseUp:F,"aria-hidden":"true",children:N.jsxs("div",{className:"relative w-[420px] max-h-[85vh] bg-fill-page-secondary overflow-auto rounded-lg p-6 shadow-xl",onClick:m=>{m.stopPropagation()},children:[N.jsxs("div",{className:"flex items-center justify-between mb-4",children:[N.jsx("h2",{className:"text-lg font-semibold text-white",children:E("withdraw.withdraw")}),N.jsx("button",{className:"text-gray-400 hover:text-gray-200 transition-colors",onClick:r,"aria-label":"Close",children:N.jsx(C0,{className:"h-4 w-4"})})]}),N.jsx(iP,{accountChains:s,defaultChainId:i,defaultSymbol:l,defaultAmount:a,defaultAccountType:n,currentEquity:c,platformBalance:u,balances:f,fee:p,isLoading:t,wagmiHooks:d,onWithdraw:h,onClose:r,onChainChange:b,onTokenChange:w,onAmountChanged:P,onAccountChange:x})]})})})}),document.body):null};le.ChromeLoader=us,le.ComponentProvider=fb,le.DEFAULT_LOCALE=ps,le.Deposit=Mm,le.DepositManager=Tm,le.LOCALE_NAMES=lb,le.LoadingSpinner=us,le.SUPPORTED_LOCALES=Ri,le.Tooltip=Tn,le.Withdraw=jm,le.WithdrawManager=Dm,le.closeDeposit=Nm,le.closeWithdraw=Lm,le.formatThousands=pb,le.isDepositLoading=Om,le.isWithdrawLoading=Rm,le.openDeposit=Am,le.openWithdraw=Bm,le.setDepositLoading=Di,le.setWithdrawLoading=Li,le.updateDepositOptions=Cm,le.updateWithdrawOptions=Fm,le.useComponentConfig=tu,le.useDeposit=k5,le.useDepositManager=XS,le.useTranslation=$t,le.useWithdraw=M5,le.useWithdrawManager=sP,Object.defineProperty(le,Symbol.toStringTag,{value:"Module"})});
185
+ `,children:[t,o&&C.jsx(Em,{ref:f,placement:h.placement||n})]})})})]})},Yr="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=",Uc="DEPOSIT_MODE_FAST",Sm="DEPOSIT_MODE_NORMAL",VS=({currentActiveChain:e,selectedToken:t,address:n,accountType:r,accountId:o,accountKey:s,onDeposit:i,onCopy:l,getUserBizConfig:a,saveUserBizConfig:c,onClose:u})=>{const{t:f}=$t(),p=r===D5,d=!p,h=(t||"").toUpperCase(),b=g.useMemo(()=>{const R=Number(e==null?void 0:e.chainId),z=String((e==null?void 0:e.chain)||"").trim().toUpperCase();return R===33431||R===3343||z==="EDGE"},[e==null?void 0:e.chainId,e==null?void 0:e.chain]),v=g.useMemo(()=>{const R=Number((e==null?void 0:e.cctpResolvedMaxFee)??0);return Number.isFinite(R)?h==="USDC"&&!b&&R!==0:!1},[h,b,e==null?void 0:e.cctpResolvedMaxFee]),P=!(r===B5&&h==="USDC"),x=g.useMemo(()=>{if(!e)return!1;const R=Number(e.chainId);return!Number.isNaN(R)&&(R===42161||R===421614)},[e]),E=p,N=g.useMemo(()=>{var R;return(R=e==null?void 0:e.tokenList)==null?void 0:R.find(z=>z.token===t||z.symbol===t)},[e,t]),D=g.useMemo(()=>{const R=(t||"").toUpperCase();if(!E&&R==="USDC")return f("deposit.defaultSpotToPerpNotice",{coin:t,v:e==null?void 0:e.chain});const G=f(E?"deposit.crossChainDepositFeeTip":"deposit.depositAllTip",{coin:t,v:e==null?void 0:e.chain});return E&&(!x||R==="USDC")?String(G).split(`
186
+ `)[0]:G},[f,t,e==null?void 0:e.chain,E,x]),F=(N==null?void 0:N.minDepositSize)||"10",L=g.useMemo(()=>{const R=N==null?void 0:N.depositFeeRate;if(R==null)return"";const z=String(R).trim();return z?`${z}%`:""},[N==null?void 0:N.depositFeeRate]),[m,w]=g.useState("fast"),[S,$]=g.useState(""),[I,A]=g.useState(!1),k=g.useRef(!1),y=g.useMemo(()=>!!L&&m!=="standard",[L,m]),O=g.useMemo(()=>{const R=Number((e==null?void 0:e.blockTime)??0),z=Number((e==null?void 0:e.txConfirm)??0);if(!Number.isFinite(R)||!Number.isFinite(z))return 0;const W=R*z/60;return Math.trunc(W*100)/100},[e==null?void 0:e.blockTime,e==null?void 0:e.txConfirm]),T=v&&I&&m==="standard"?20:O;g.useEffect(()=>{if(k.current)return;k.current=!0;let R=!1;return A(!1),a?((async()=>{try{const W=await a();if(R)return;const G=W==null?void 0:W.depositMode;if(!(G===Uc||G===Sm)){A(!1);return}w(G===Uc?"fast":"standard"),$((W==null?void 0:W.destinationPreference)||""),A(!0)}catch(W){console.error("[MPCDeposit] getUserBizConfig failed:",W),A(!1)}})(),()=>{R=!0}):()=>{R=!0}},[a]);const B=g.useCallback(async R=>{if(w(R),!c)return;const z=S||r||"";try{await c({depositMode:R==="fast"?Uc:Sm,destinationPreference:z})}catch(W){console.error("[MPCDeposit] saveUserBizConfig failed:",W)}},[c,S,r]);return C.jsxs(C.Fragment,{children:[v&&I&&C.jsx("div",{className:"bg-fill-input-primary rounded-lg p-1 mt-4 mb-3",children:C.jsxs("div",{className:"grid gap-1 grid-cols-2",children:[C.jsx("button",{type:"button",onClick:()=>{B("fast")},className:`h-[30px] rounded-md text-sm font-medium transition-colors ${m==="fast"?"bg-fill-btn-primary text-text-on-sec-btn":"text-text-primary hover:bg-fill-input-secondary"}`,children:f("deposit.fast")}),C.jsx("button",{type:"button",onClick:()=>{B("standard")},className:`h-[30px] rounded-md text-sm font-medium transition-colors ${m==="standard"?"bg-fill-btn-primary text-text-on-sec-btn":"text-text-primary hover:bg-fill-input-secondary"}`,children:f("deposit.standard")})]})}),C.jsx("div",{className:"flex justify-center mt-4 mb-3",children:n&&C.jsx("div",{className:"bg-white rounded-lg",children:C.jsx(om,{value:n,size:80,level:"L",bgColor:"#ffffff",fgColor:"#000000",marginSize:0})})}),n&&C.jsxs("div",{className:"flex items-center justify-between bg-fill-input-primary rounded-lg py-2 px-3 mb-3",children:[C.jsx("span",{className:"flex-1 text-text-primary text-xs font-medium break-all mr-3",children:n}),C.jsx(q3,{onCopy:()=>{l&&l(n)},text:n,children:C.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:[C.jsx("rect",{x:"2.08496",y:"4.02295",width:"9.89893",height:"9.89893",rx:"2",stroke:"#F9F9F9"}),C.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")]}),C.jsxs("div",{className:"border-b border-dashed border-line-divider-secondary pb-4",children:[C.jsxs("div",{className:"flex items-start",children:[C.jsx("div",{className:"w-5",children:C.jsx("img",{src:Yr,className:"w-4 h-4",alt:"Warning"})}),C.jsx("div",{className:"flex-1",children:C.jsx("p",{className:"text-xs text-functional-orange-1",children:D})})]}),d&&C.jsxs(C.Fragment,{children:[C.jsx("div",{className:"my-2 ml-5 h-px border-b border-dashed border-line-divider-secondary"}),C.jsx("div",{className:"flex items-start pl-5 text-functional-orange-1 text-xs",children:f("deposit.addressUpdatedNotice")})]})]}),C.jsxs("div",{className:"text-sm",children:[P&&C.jsxs("div",{className:"flex justify-between items-center h-[18px] mt-4",children:[C.jsx("span",{className:"text-text-tertiary",children:f("deposit.arrivalTime")}),C.jsx(Pn,{content:C.jsx("div",{className:"grid grow max-w-[300px] min-w-[80px] rounded-2xl flex-col gap-[10px]",children:C.jsx("p",{children:f("deposit.arrivaltimeTooltip2")})}),placement:"top",children:C.jsx("span",{className:"text-text-primary font-medium text-right border-b-2 border-dashed border-line-divider-primary decoration-dashed",children:f("deposit.arrivalEstimated",{v:T})})})]}),y&&C.jsxs("div",{className:`flex justify-between items-center h-[18px] ${P?"mt-1":"mt-4"}`,children:[C.jsx("span",{className:"text-text-tertiary",children:f("withdraw.feeRate")}),C.jsx(Pn,{content:f("deposit.feeRateTooltip"),placement:"top",children:C.jsx("span",{className:"text-text-primary font-medium border-b-2 border-dashed border-line-divider-primary decoration-dashed text-right",children:L})})]}),C.jsxs("div",{className:`flex justify-between items-center h-[18px] ${P||y?"mt-1":"mt-4"}`,children:[C.jsx("span",{className:"text-text-tertiary",children:f("deposit.minDeposit")}),C.jsxs("span",{className:"text-text-primary font-medium text-right",children:[F," ",t]})]}),d&&h!=="USDC"&&C.jsxs("div",{className:"flex justify-between items-center h-[18px] mt-1",children:[C.jsx("span",{className:"text-text-tertiary",children:f("deposit.maxDeposit")}),C.jsxs("span",{className:"text-text-primary font-medium text-right",children:["200,000 ",t]})]})]}),C.jsx("button",{className:"w-full h-[38px] bg-fill-btn-primary rounded-xl text-sm font-medium text-text-on-sec-btn mt-4",onClick:()=>{i&&i({amount:"",chainId:e.chainId,tokenAddress:n,tokenSymbol:t,depositSpeed:m,accountType:r,accountId:o,key:s}),u()},children:f("deposit.title")})]})},us=({size:e="xs",color:t,className:n="",label:r="Loading...",inline:o=!1})=>{const s=t?`loading-${t}`:"",i=o?"loading-inline":"";return C.jsx("span",{className:`loading loading-${e} loading-spinner ${s} ${i} ${n}`.trim(),"aria-label":r,role:"status","aria-live":"polite"})},HS=(e,t)=>Number(e)>Number(t),_t=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"},Mi=(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 Mi(a,t)}const s=parseFloat(e),i=parseFloat(t);return!isNaN(s)&&!isNaN(i)&&s>i?{isValid:!0,formattedValue:_t(t),errorType:"auto_adjusted_to_max"}:{isValid:!0,formattedValue:e}},GS=(e,t,n)=>{const r=parseFloat(String(e)||"0"),o=parseFloat(String(t)||"0");if(o>0){const s=r-o,i=_t(Math.max(0,s).toString());return C.jsxs("span",{className:"flex items-center gap-1",children:[_t(e),C.jsx("span",{className:"text-sm font-edgex-harmony text-functional-green-1 leading-[18px] font-medium",children:"→"}),i," ",n]})}return`${_t(e)} ${n}`},qS=(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)},KS=(e,t,n)=>{if(!Fh(e,n))return!1;try{const r=new Re(t||"0"),o=new Re("200000");return r.isNaN()||o.isNaN()?!1:r.gte(o)}catch{return!1}},ZS=(e,t,n,r)=>{let o=t||"0";if(!(r==="spot")&&Fh(e,n))try{const i=new Re(o),l=new Re("200000");i.gt(l)&&(o="200000")}catch(i){console.warn("Error calculating max amount limit:",i)}try{const i=new Re(o||"0");return i.isNaN()?o:i.decimalPlaces(6,Re.ROUND_DOWN).toString()}catch{return o}},Pm={accountChains:[],defaultChainId:1,defaultAccountType:"",balances:{}};let it=null;const Tm=g.forwardRef((e,t)=>{const[n,r]=g.useState(!1),[o,s]=g.useState(!1),[i,l]=g.useState(Pm),a=g.useCallback(h=>{l(h),r(!0)},[]),c=g.useCallback(h=>{l(b=>({...b,...h}))},[]),u=g.useCallback(()=>{r(!1),s(!1),i.onClose&&i.onClose()},[i.onClose]),f=g.useCallback(h=>{s(h)},[]),p=g.useCallback(()=>n,[n]),d=g.useCallback(()=>o,[o]);return g.useImperativeHandle(t,()=>({openDeposit:a,closeDeposit:u,updateDepositOptions:c,setDepositLoading:f,isOpen:p,isLoading:d}),[a,u,c,f,p,d]),g.useEffect(()=>(it={openDeposit:a,closeDeposit:u,updateDepositOptions:c,setDepositLoading:f,isOpen:p,isLoading:d},()=>{it=null}),[a,u,c,f,p,d]),n?C.jsx(Mm,{isOpen:n,isLoading:o,onClose:u,accountChains:i.accountChains,defaultChainId:i.defaultChainId,defaultSymbol:i.defaultSymbol,defaultAccountType:i.defaultAccountType,balances:i.balances,wagmiHooks:i.wagmiHooks,onDeposit:i.onDeposit,onCopy:i.onCopy,getUserBizConfig:i.getUserBizConfig,saveUserBizConfig:i.saveUserBizConfig,onChainChange:h=>{var b;return(b=i.onChainChange)==null?void 0:b.call(i,h)},onTokenChange:h=>{var b;return(b=i.onTokenChange)==null?void 0:b.call(i,h)}}):null});Tm.displayName="DepositManager";const Am=e=>{if(!it){console.error("DepositManager not initialized. Make sure to render <DepositManager /> in your app.");return}it.openDeposit(e||Pm)},Nm=()=>{if(!it){console.error("DepositManager not initialized. Make sure to render <DepositManager /> in your app.");return}it.closeDeposit()},Cm=e=>{it&&it.updateDepositOptions(e)},Di=e=>{if(!it){console.error("DepositManager not initialized. Make sure to render <DepositManager /> in your app.");return}it.setDepositLoading(e)},YS=()=>it?it.isOpen():!1,Om=()=>it?it.isLoading():!1,XS=()=>({openDeposit:Am,closeDeposit:Nm,updateDepositOptions:Cm,setDepositLoading:Di,isOpen:YS,isLoading:Om}),JS=e=>{const{t}=$t(),{isNetworkMismatch:n,depositAmount:r,approved:o,currentTokenBalance:s,selectedToken:i,showLayerZeroTip:l,minDeposit:a=10}=e;return g.useMemo(()=>{if(n)return{text:t("deposit.switchNetwork"),disabled:!0,isNetworkSwitch:!0};const c=parseFloat(r||"0"),u=a,f=qS(r,s||"0",o);return!r||c===0||!o?{text:t(l?"deposit.layerZeroDepositButton":"deposit.confirmDeposit"),disabled:!0,isNetworkSwitch:!1}:c<u?{text:t("deposit.minDepositParsed",{amount:u,token:i}),disabled:!0,isNetworkSwitch:!1}:{text:t(l?"deposit.layerZeroDepositButton":"deposit.confirmDeposit"),disabled:!f,isNetworkSwitch:!1}},[n,r,o,s,i,l,a,t])};function QS(e){const{account:t,accountChainId:n,targetChainId:r,tokenInfo:o,amount:s}=e,{useReadContract:i,useWriteContract:l,usePublicClient:a,useSwitchChain:c}=e.wagmiHooks,u=o==null?void 0:o.tokenAddress,f=(o==null?void 0:o.decimals)??18,p=(o==null?void 0:o.approveSpender)||(o==null?void 0:o.contractAddress),d=!u||u.toLowerCase()==="0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",{switchChainAsync:h}=c(),{writeContractAsync:b}=l(),v=a(),P=i({address:u,abi:Mr,functionName:"allowance",args:[un(t||""),p],chainId:r,query:{enabled:!!(!d&&t&&r&&u&&p)}}),x=P!=null&&P.isSuccess?P.data:void 0,E=g.useMemo(()=>{if(d)return!0;if(!P.isSuccess||x===void 0||x===0n)return!1;try{const D=W6(String(Number(s||"0")||0),Number(f));return x>=D}catch{return!1}},[d,P.isSuccess,x,s,f]),N=g.useCallback(async()=>{try{if(r&&n&&+n!=+r&&await h({chainId:+r}),!b||!v||!u||!p)return;const F=un(u),L=un(p);if((x||0n)>0n){const S=await b({abi:Mr,address:F,functionName:"approve",args:[L,0n]});await v.waitForTransactionReceipt({hash:S})}const w=await b({abi:Mr,address:F,functionName:"approve",args:[L,wf]});await v.waitForTransactionReceipt({hash:w}),P!=null&&P.refetch&&await P.refetch()}catch(D){console.error("[useApprove] onApprove failed:",D)}},[r,n,u,p,x,P,b,v,h]);return{approve:E,onApprove:N}}const eP=({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 g.useEffect(()=>{o(un(e.tokenAddress),{balance:s})},[s,e.tokenAddress,o]),null},tP=({account:e,chainId:t,contractAddress:n,tokens:r=[],wagmiHooks:o})=>{var x;const s=typeof t=="string"?Number.isFinite(Number(t))?Number(t):void 0:t,i=g.useMemo(()=>{const E="0x0000000000000000000000000000000000000000",N="0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee";return r.filter(D=>{const F=D.tokenAddress;if(!F)return!1;const L=F.toLowerCase();return!(F===E||L===N)})},[r]),[l,a]=g.useState({}),c=g.useCallback((E,N)=>{a(D=>({...D,[E]:N}))},[]),u=(x=o==null?void 0:o.useBalance)==null?void 0:x.call(o,{address:e,chainId:s,query:{enabled:!!e&&!!s&&!!(o!=null&&o.useBalance)}}),[f,p]=g.useState(0),d=g.useMemo(()=>i.map(E=>g.createElement(eP,{key:`${E.tokenAddress}-${f}`,token:E,account:e,chainId:s,contractAddress:n,wagmiHooks:o,onResult:c})),[i,e,s,n,o,c,f]),h=g.useMemo(()=>{const E=u!=null&&u.data?{value:u.data.value,formatted:u.data.formatted,decimals:u.data.decimals,symbol:u.data.symbol}:{value:BigInt(0),formatted:"0",decimals:18,symbol:"ETH"},N=i.map(F=>{const L=l[un(F.tokenAddress)],m=L==null?void 0:L.balance,w=m==null?void 0:m.data;return{address:un(F.tokenAddress),value:(w==null?void 0:w.value)||BigInt(0),formatted:(w==null?void 0:w.formatted)||"0",decimals:(w==null?void 0:w.decimals)||F.decimals}}).filter(F=>F.address),D=N.reduce((F,L)=>({...F,[L.address]:{balance:L}}),{});return{balanceList:N,baseTokenBalance:E,combinedData:D}},[u,l,i]),b=g.useCallback(async()=>h,[h]),v=g.useMemo(()=>{const E=(u==null?void 0:u.isLoading)||!1,N=Object.values(l).some(D=>{var F;return(F=D.balance)==null?void 0:F.isLoading});return E||N},[u==null?void 0:u.isLoading,l]),P=g.useCallback(()=>p(E=>E+1),[]);return{multicallRun:b,multicallRefresh:P,multicallResult:h,validErcTokens:i,isLoading:v,queryComponents:d}},nP=({address:e,currentActiveChain:t,selectedToken:n,accountType:r,accountId:o,accountKey:s,platformBalance:i,isLoading:l,wagmiHooks:a,onChainChange:c,onDeposit:u})=>{const{t:f}=$t(),p=a.useAccount(),d=t.tokenList.find(Y=>Y.token===n||Y.symbol===n),h=t.chainId,b=g.useMemo(()=>{if(!((n||"").toUpperCase()==="USDC"))return!1;const H=Number((t==null?void 0:t.cctpResolvedMaxFee)??0);return Number.isFinite(H)?H!==0:!1},[t==null?void 0:t.cctpResolvedMaxFee,n]),[v,P]=g.useState(""),[x,E]=g.useState(()=>b?"fast":"standard");g.useEffect(()=>{P("")},[n,t.chainId]),g.useEffect(()=>{E(b?"fast":"standard")},[t.chainId,b]);const{multicallResult:N,queryComponents:D}=tP({account:e,chainId:t.chainId,contractAddress:(d==null?void 0:d.contractAddress)||(t==null?void 0:t.contractAddress),tokens:(t==null?void 0:t.tokenList)||[],wagmiHooks:a}),F=g.useMemo(()=>{var H;if(!d)return"0";if(!d.tokenAddress||d.tokenAddress.toLowerCase()==="0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee")return N.baseTokenBalance.formatted;const Y=N.combinedData[d.tokenAddress];return((H=Y==null?void 0:Y.balance)==null?void 0:H.formatted)||"0"},[d,N]),L="0xfd086bc7cd5c481dcc9c85ebe478a1c0b69fcbb9",m="0xceeed84620e5eb9ab1d6dfc316867d2cda332e41",w=g.useMemo(()=>{var Y,H;return A5({chain:I5,transport:O5(t.rpcUrl||((Y=window==null?void 0:window.ENV)==null?void 0:Y.CHAIN_RPC_URL_42161)||((H=window==null?void 0:window.ENV)==null?void 0:H.CHAIN_RPC_URL_421614))})},[t.rpcUrl]),S="1000000000000",{formatted:$}=$5({client:w,tokenAddress:L,holder:m,decimals:6,fallbackFormatted:S,pollingInterval:12e3}),[I,A]=g.useState(!1),{approve:k,onApprove:y}=QS({account:e,accountChainId:p.chainId,targetChainId:+t.chainId,tokenInfo:d,amount:v,wagmiHooks:a}),O=g.useCallback(async()=>{if(!I)try{A(!0),await y()}catch(Y){console.error("Approve failed:",Y)}finally{A(!1)}},[I,y]),M=g.useMemo(()=>+p.chainId!=+t.chainId,[p.chainId,t.chainId]),T=g.useCallback(async()=>{c&&c(h)},[c,h]);g.useEffect(()=>{M&&T()},[M,T]);const{showLayerZeroTip:B,layerZeroTipKey:R}=g.useMemo(()=>{const Y=+t.chainId==42161||+t.chainId==421614,H=(n==null?void 0:n.toUpperCase())==="USDT",ee=new Re(v||"0"),Q=new Re("200000");let ve=!1,Z;if(Y&&H&&v)if(ee.gte(Q))ve=!0,Z="deposit.layerZeroDepositTipGte200k";else{const ie=$;if(typeof ie=="string"&&ie.length>0){const Ee=new Re(ie);!Ee.isNaN()&&ee.gte(Ee)&&(ve=!0,Z="deposit.layerZeroDepositTipExceedPool")}}return{showLayerZeroTip:ve,layerZeroTipKey:Z}},[t.chainId,n,v,$]),z=g.useCallback(()=>ZS(+t.chainId,F||"0",n,r),[F,t==null?void 0:t.chainId,n,r]),W=g.useMemo(()=>r!=="spot"&&KS(+t.chainId,v,n),[r,t==null?void 0:t.chainId,v,n]),G=g.useMemo(()=>"deposit.maxDepositSplitTip",[]),J=g.useMemo(()=>{const Y=Number((t==null?void 0:t.blockTime)??0),H=Number((t==null?void 0:t.txConfirm)??0);if(!Number.isFinite(Y)||!Number.isFinite(H))return 0;const ee=Y*H/60;return Math.trunc(ee*100)/100},[t==null?void 0:t.blockTime,t==null?void 0:t.txConfirm]),_=b&&x==="standard"?20:J,ne=g.useMemo(()=>{const Y=d==null?void 0:d.depositFeeRate;if(Y==null)return"";const H=String(Y).trim();return H?`${H}%`:""},[d==null?void 0:d.depositFeeRate]),be=b&&x==="fast"&&!!ne,fe=JS({isNetworkMismatch:M,depositAmount:v,approved:k,currentTokenBalance:F,selectedToken:n,showLayerZeroTip:B,minDeposit:d!=null&&d.minDepositSize?parseFloat(d.minDepositSize):10}),xe=Y=>{const H=Y.target.value,ee=z(),Q=Mi(H,ee);if(Q.isValid)P(Q.formattedValue),Q.errorType;else return Q.errorType==="exceed_balance",void 0},ye=g.useCallback(async()=>{Di(!0);try{u&&u({amount:v,chainId:h,tokenAddress:(d==null?void 0:d.tokenAddress)||"",tokenSymbol:n,depositSpeed:x,accountType:r,accountId:o,key:s})}catch(Y){console.error("Deposit error:",Y),Di(!1)}},[u,v,h,d==null?void 0:d.tokenAddress,x,r,o,s,n]);return C.jsxs(C.Fragment,{children:[D,b&&C.jsx("div",{className:"bg-fill-input-primary rounded-lg p-1 my-4",children:C.jsxs("div",{className:"grid gap-1 grid-cols-2",children:[C.jsx("button",{type:"button",onClick:()=>E("fast"),className:`h-[30px] rounded-md text-sm font-medium transition-colors ${x==="fast"?"bg-fill-btn-primary text-text-on-sec-btn":"text-text-primary hover:bg-fill-input-secondary"}`,children:f("deposit.fast")}),C.jsx("button",{type:"button",onClick:()=>E("standard"),className:`h-[30px] rounded-md text-sm font-medium transition-colors ${x==="standard"?"bg-fill-btn-primary text-text-on-sec-btn":"text-text-primary hover:bg-fill-input-secondary"}`,children:f("deposit.standard")})]})}),C.jsxs("div",{className:"bg-fill-input-primary rounded-lg px-3 py-3 my-4",children:[C.jsxs("div",{className:"flex justify-between items-center h-[18px] mb-3",children:[C.jsx("input",{type:"text",placeholder:f("deposit.amount"),value:v,onChange:xe,className:"flex-1 bg-transparent text-text-primary text-sm font-medium placeholder-text-tertiary placeholder:font-normal focus:outline-hidden border-none p-0 h-full"}),C.jsx("button",{onClick:()=>{const Y=z();P(Y)},className:"text-theme-normal text-xs font-medium cursor-pointer hover:opacity-80 transition-opacity h-full flex items-center",children:f("deposit.max")})]}),C.jsx("div",{className:"h-px bg-line-divider-secondary mb-2"}),C.jsxs("div",{className:"flex justify-between items-center",children:[C.jsx(Pn,{content:f("deposit.availableDesc"),children:C.jsx("span",{className:"text-text-tertiary text-xs leading-[14px] border-b border-dashed border-line-divider-primary",children:f("deposit.available")})}),C.jsx("span",{className:"text-text-primary text-xs leading-[14px]",children:GS(F||"0",v,n)})]})]}),!k&&HS(v||"0",0)&&C.jsxs("div",{className:"flex justify-center flex-col items-center",children:[C.jsx("h3",{className:"text-text-primary text-sm leading-4 font-medium",children:f("deposit.enableSystemProWithToken",{token:n,network:t==null?void 0:t.chain})}),C.jsx("p",{className:"text-text-secondary text-xs leading-3 mt-4",children:f("deposit.enableTokenDesc",{token:n,network:t==null?void 0:t.chain})}),C.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:O,disabled:I,children:I?C.jsx(us,{size:"xs",inline:!0}):f("deposit.enableWithToken",{token:n})})]}),B&&C.jsxs(C.Fragment,{children:[C.jsxs("div",{className:"flex mb-4",children:[C.jsx("div",{className:"w-5",children:C.jsx("img",{src:Yr,className:"w-4 h-4",alt:"Warning"})}),C.jsx("div",{className:"flex-1 text-xs text-functional-orange-1",children:f(R||"deposit.layerZeroDepositTip")})]}),C.jsx("div",{className:"my-2 ml-5 h-px border-b border-dashed border-line-divider-secondary"})]}),W&&C.jsxs("div",{className:"flex mb-4",children:[C.jsx("div",{className:"w-5",children:C.jsx("img",{src:Yr,className:"w-4 h-4",alt:"Warning"})}),C.jsx("div",{className:"flex-1 text-xs text-functional-orange-1",children:f(G)})]}),W&&C.jsx("div",{className:"my-2 ml-5 h-px border-b border-dashed border-line-divider-secondary"}),C.jsxs("div",{className:"flex mb-4",children:[C.jsx("div",{className:"w-5",children:!(W||B)&&C.jsx("img",{src:Yr,className:"w-4 h-4",alt:"Warning"})}),C.jsx("div",{className:"flex-1 text-xs text-functional-orange-1 whitespace-pre-line",children:f("deposit.noPrivateKeyWalletWarning")})]}),C.jsxs("div",{className:"border-t border-line-divider-secondary border-dashed py-4",children:[C.jsxs("div",{className:"flex justify-between items-center h-[18px] leading-4",children:[C.jsx("span",{className:"text-sm text-text-tertiary",children:f("deposit.arrivalTime")}),C.jsx(Pn,{content:C.jsx("div",{className:"grid grow max-w-[300px] min-w-[80px] rounded-2xl flex-col gap-[10px]",children:C.jsx("p",{children:f("deposit.arrivaltimeTooltip2")})}),placement:"top",children:C.jsx("span",{className:"text-text-primary font-medium text-right border-b-2 border-dashed border-line-divider-primary decoration-dashed text-sm",children:f("deposit.arrivalEstimated",{v:_})})})]}),be&&C.jsxs("div",{className:"flex justify-between items-center h-[18px] leading-4 mt-2",children:[C.jsx("span",{className:"text-sm text-text-tertiary",children:f("withdraw.feeRate")}),C.jsx(Pn,{content:f("deposit.feeRateTooltip"),placement:"top",children:C.jsx("span",{className:"text-sm text-text-primary font-medium border-b-2 border-dashed border-line-divider-primary decoration-dashed text-right",children:ne})})]}),C.jsxs("div",{className:"flex justify-between items-center h-[18px] leading-4 mt-2",children:[C.jsx("span",{className:"text-sm text-text-tertiary",children:f("deposit.equity")}),C.jsx("span",{className:"text-sm text-text-primary font-medium",children:v?C.jsxs("span",{className:"flex items-center gap-1",children:[_t(i),C.jsx("span",{className:"text-sm font-edgex-harmony text-functional-green-1 leading-[18px] font-medium",children:"→"}),_t((parseFloat(i)+parseFloat(v)).toString())," ",n]}):`${_t(i)} ${n}`})]})]}),C.jsxs("button",{className:`w-full h-[38px] text-sm rounded-xl font-medium transition-colors flex items-center justify-center gap-2 ${fe.disabled||l?"bg-text-disabled text-text-secondary cursor-not-allowed":"bg-fill-btn-primary text-text-on-sec-btn"}`,onClick:ye,disabled:fe.disabled||l,children:[(l||M)&&C.jsx(us,{size:"xs"}),fe.text]})]})},Im=e=>e.toLocaleUpperCase()===gn?gn:Zs,fs=e=>Im(e.wallet)===gn,Wc=e=>Im(e.wallet)===Zs,Bi=e=>e?e==="perp"?ze.PERPETUAL:e==="perp-v2"||e==="perp_v2"?ze.PERPETUALV2:e:"",$m="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGAAAAAoCAYAAAABk/85AAAACXBIWXMAABYlAAAWJQFJUiTwAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAABBMSURBVHgBvVt7kBTHef/17N77fRwSiNeBBAGBpVNJERKyoqOSuByiVLAScOKqJKAYJU4F8XCVY8d/cLiSkKSS4pDtKJKRdFhxYoNskTKS4jixFguEICAdiDtAvJb3cRzcg7u9vX1M5/t6puexO7u3Byd+VDOzPT3dPd/39ffqPoFbhJSymS5NVJ6yr7V2YfRRidrlMJWIECKC28Bnv5dslqZskjCeEhA0nvSPJ0SU5hQ1IA/DQGTPqqIIbgMLvjzcbAjxoBRoFlLSeKJWqjEFDY0++p6oCRmFFO2Aufvo1rIIbgFiLI3pA/mD11BZC/fjC0WUSoTKRp58IS80vyZrEylzjTDlLYxHYwgZKUqHNka+Uth4TWtlbWowvkZArjWlqBEikz4SNsmkdZXqB7WDaVrfV1SEje3/WhZFgSiIATbhN8Ai/HigDXkYwYRPJkwaT47PeAJt+RjBhE8PDm+QEGvpW/VLkglMUFeuFja13HvBtHHu1SOp3nktHMa3CmHEqAygDlniWzB2iR8NUVhMaPNWPv5yeo0hZcv4j0cqSsiN7z8XbvPWLlgVXwMz3UJk9I4nLekWmqD6t9WTUEzw1vme8zNqc84wzI0ff6+yLe+s8j2kwTdj/KQ+F1rpA9fxzRMvpTePm9TnhGjd+2chNd78Z2ObiVZrbYJaT4Ur4TYhhbMoPM8z7h3dZD+RVhU1MURrx9bydTlnE1Rpq5w3qTTjDqB/BO2//f10H825GXcAMiXb+z8c6SPiNXuIK7XOt+oE/WbVI2wmKBpLr9632nrbeVWVh7RSthfL5OL2trq+zLmEc8zxXSpN8cEBlFZW49OEGR/A2rcqmiBxxzDQmWgiowlbcO2RpUfStd6XnnpNfOsdVk26NfVFxDcVE/z92CsIsimOMAv04sy5hDIrbLWzlO9f+OJnkDwVwcRygVD9NIhwCcYDTPTBfa/jo3//W/z1OzGcLnsYdwqxaBLJ3rS6l9Z/mpD21ZJk3d4yspZIewjrFW/nfVtdaXXkukxWXePEpm/W9rT/3c+88/GpIBpsBV1e4/uO997B97+5QtUvnGpg4bQQyh9ejvJHlqFk1uO4FcTP7MPQwR2Id/wXdh/vxc/Ll+Hk45txpzByLYXBUwm49HFhMUPYasiRcjw6NyTmTQ9hLpUpDRa5bsYkjp03ceB4Cv93Ig29iiz1IzNtgcMEezWsO9FW0+q0cCYgZSMs1cNXbN/0PA698yOnq+oSgWfmh+lKy6ZuGioeXoayR5YjXDcV+cDSfvO9rRjcs9W6HwHeoolfMqbi6G+8gXjlNNwJmCMS/R1xpONewrvCyuLrld4vfLZI/OXSYiK6kbffSz0mvrMzgTf3JLXb6qwatz/nN3fdNyLMmVHbHngZwJK/Qv/esGQ22AZ4wUxYOM3AvInupKrvmYaiHJYkkSIDe/mC8/tYt4k950yMpCROLmpF96zluBVMrhK4bwJQWWz9HiSh7hoETvbkNiQ3T41gpDul7r06Ah5isYROmWBg06oylnyMBcyIP/77GC5eM7M8J3jcVNt4t57YVqM8Ix09NNLlrG49PNiPliVzcg7WNNnArzVaE2TiV1UEtxuIEROStPTpuw9cTOPwFWX5MEJSf3DpfowFVcUCyz4DLF9goDKHKeq6CXx4ReK1gxJXBl0KsPT3HBzSXjy0+pH2b9t7B6ua764pH1Xqc4GZ8BdbhnD8vDLejoekepd+25IwZB2vAj3SBm9HZZU1qJuUWzW0EyHbPkxhgNRJMuX6xV6kTYv4rHLe7Eg5xGecf+CrGAuWLxDY8YcGnn04N/EZk6qAJXOo7Ze4rauKh84n7ElK+5+tr/mhJBeGChP9dojP4Hf/ZU0FpkxwAzW+Sm1grHtlW8IpgwNc6NGaMzub9dCivIMNkFT9x5Ekjl0jlZLMfp5KWSrnh0dS6In5OTRwV2FGnKX+208beH5RfsIHgZm16XOGUlMjfZbqMSU0BRQbTJc6eP0bFbdFfA3uY9Oqcrtf6bsSo4XFCF4Npgo4Q3ZWMyv67O26gE8OvJt3MJbyMzekYsCcu/yT/8UnJn55Nq3aeDFw9yJcnrcKheDlpSHMv9sfKw7Sitp5XOLf2iVeOiDxzicS/3tGKjswoUz4GDWjVmCyMPHT90YCl6ntXuKZJ0uoFGO8MJVsJHlKov2UYryt87zRmVJFpfUPfH03m89m3AbYMM8OkJxG+viPuwSpIP+H999dmPSz5FZm0OTVQxI7jppKrWXio8sSL7xvSb5X/XScTtr6QCpt73go/M+0wtbnnynFeGPF50vQ9rO4urd4bzqT0oyn/x9kBjwY1EEhEbDlmobUNRMNFLz9Hj37cUfax4Sh+vkoBCzRq3elSQWFFCO+8XNTEXk0vHqI2l0R2PSbhvKMfvBBUqkaSwyl4/loLJwbyqt6/uqlIew/lrTesvjlfOzC+8P4h+cqA9/jPtmT2n+MV4H2sixPSKtB+rGYGdAY1AEb4nyYUmPg6TkGSsJOBtCXrmUwY5gJuyhY6RmyKuMVuY0763wmtvZgrty0mMB1J6+P3l6DGbXyJ2nFxP4B046CYPufAto956pH54aRDx8cS7BrCX/+3yZiZ36BWDi3CB90JlVbw9BRsnQibrp7ICcD7pm9QK0CbyxQWiQw9y6Be8lXnlLhl/ogBjCYCV+iYS4RA05fN7E/BwOUwf0dQ3kyq39qEsFdJgRhcqXVnsHtM5mg30vF0q7Ho77fjbbI/8H9M/IzwJFWx4UUlPuR0h/xBmPKRJ2qtvJFbqCm7rnzOv6CwLw7u6GfW/k1NNYbaL4vhBWPhvH1Xw/jdxeEMK0q/9hmgGDwO/xuqjhYtTExdXDF97Mn5B5DE5+ZxYXvuS4I6ZQJ1wtxvFHnd1XFaHR00wzS9SOd3/kwpSEEK2nnJPWk9Y7lDdFNTV6/6/EnFxHhQ8QAgxhhTXSQXErTDPhQT13QvPidwVjwhDMNbj4meImvMRoT7FnZc/O4h1JitCysJqAmupVW0JnS0WEzzJNZdQRBZVSZAX25XjbP78uqS5E9unot6ZSe6ylVEil3Qqm0dOq9bUdIJ1eaA1l9aoPb5VE3QUwIIr5GEBNmk9BUl7HKMLUfDouY0OaY9Hsa+cDvmaZmmss33U8+DMTs5eYpWgB4FdBtX14GpI7syKqrrRGorXLF9XSsjKRfIiTcxSQovuO6IzddD6Ga3qmnBVeB/sCxtMHNxYQg4nNbb3svE5j4fF9V7joJbnGlufNcEgVAuhJsFqyCOqNJn+qzm0tbHkAki7IFakeAIZZ9FyG7O7I6ZUPLTAiFi/DPp6bg7ct1+Js5ZzBLxOFkV6jN8eFqbDxzL5bc04uv3ncJFWUGeQJp3JfsxNWSYEOsmcCupya0ZgIHYJnE57YMb3vNBKXWKChjI3uBknBCZCbhLFvVGU0hHxbOK4Klsz3a2u5o4bxRPKjOhMNoT2paOHvKJqKskzgKzkrKp49sR2LX+sCOudNYnKS5jIKiZAjRvmLMqRlBSbGdbEsIXIoVYWJFGlVFaQzFQigrNYkBEj8pfRYvVm5APkyu8hM1E5r42tPJ1/6Vt2P41rabTiDmfIN95Zq9327A1LvGlv0cDRe703hi9TXAE/x5DY7tNW5ktrYHdRCkfjS4r9ISi9hM4AUNw1ltZtUm1DNGcbFFfMa96U6MhiB1pJFJ/NHaT58cdlSFzgFJjzvE95vfGMR4o5X6tG2v7UVJrxOlYJiIGPaJtSw7cHMIuNHvLxevmjh1LqVKF3E4aa9eZogmMCPkESZuc7k75bzXcHEvKgIMcSaCiBpE/NHav3w8RFupwklHuEbQTkXQdXskhn0dCYwXLtL3/uhdysUr1WVaW2vuzpieQzT6xuSIVmxbMjspvjc7Z1NeaqgOkrT5k0pbTBq28zJFYQ8D7F75GbfhZcjvsCtaVhrCb/W9gkLgJWo+4o/Wvmp6GVy6+11KvRrWf7dXqY3bBfexvOWGuueATRtvNZrUDFGRSITr9IYMB2O93o5GaP+256VlWQOkyN283ptCVSXtEZdZlB6umoqNb0fV/oDGPy2difJBazcsNky2YjCNhvowrQ6BIaMaz878GIWCdTy7qkFJuELamzTn87+46iRytAoQvpMjQs5vDIlXvlZP9iCMWwEb+y//Y6/siCZFwLkiexVYgV26yJjV9cPJUcOaiGAV5FsFvPEuSrOj1jAt54qKEEm5QLp+DmKPrcfBCcvw36clPrjolhMz/kg94zY8m4oKQxGfwSpoSX9hq4DBUlwo8YPaGzTn6hkV/kgW7j37+VKmBREOv7+hR6mQseL9oyNYRu92RBPK39KpB+m4Qa4Kov+3MfH5zrsnzKvgLDypid7t6xE7tN03EDOFmTMw6QkMl04EGRHsOfARtrz6A1+7P/2DZ/D55kUqE1k6fBU1V/epVSXjlv7nVbB6xl51vRPgVXDhl90wkzpkzzg5Iv0nGr64uALrlldh2iirgaV+665BbH2LDbl7CiIYSvrPmcWhxVkMsGfhc0ljB7ejd8d6RXC2CXz1Hkm5cOIIus8ew9Bw3I4yXVRVVqqIo+6eWZj1wK869cyEkdP7kKDrmzfmYduE/C7peKL/3BBuHB9w4gAb3vBApxOdnP1j95fIRQtKxPyZxaguh2rC0TMT/v2jcTLeI94TENAqx3vEUfWo9ZBhrOj68dRtevAsblFDPrOi9ivN4QHVwijNLaV917pw4tB7iMf8rlxpeSV+5ZEnUdswKee7fEzlOx9VYvvHo8T044jrx/vRFx2y9qjc7K0vV09fLC0CSmQfUXfgDYQ9u15SCH+44R5XlGi9snO675yoyNHzuxjDThkTP5MBlTX1CBcVts23eldhmy3jhcv7exDvtdxOLbkW9AlnJ0wLUCnek9LSlnT3eGOOtvSfPHxl54yHMqaS93AuM6EJdwB9cUSeft2shfpLlE8fZsKMnP6fy7RpKvRuoC267uFcr+rQGzBe2GLuBLlutKvfsy5WUxEpRfoL0Z0zs+KtwHQ0e0VUmFtb8OljS12ZWLz3udBDtFY/9fF4jH2rixd3/2fjQxDmC4A3X595isHNnsE5xKv1u5S+WELdet+z+jSEuaVr5/TFQcRn5N0PICawUV4J648pxhs8oXX2GAp7/rxoLdnylfzHFBh/0HjmOh5DV1zdOXMt6X7r+7wuqvSnj634zQngpOW2qsyozu/LrHaUziQXcN0VGiPfpAQKgH1yroXKn2B8wJLeYscfWXjsRdkYMpItJB/jMh5Lfbgk3BJZGTzepKVnG4mmGyg1sUK19xxVtKNW4VcvfrWUqaIMIbeUGUZLLqn3zQ1jgIcRTyHHXnIe6GCvNRfhM+EyIkTjqbHHNJ4wifCl4dZchM8EMyKdxgZaFc1Ez0b4AgVtI6zUjtc7Us8M9BMbtpQbRmshhNcYEwO8sA90cWFD1mgX75+pcuFM626+3vafqb6YbCaF2Qw2nEI02sLgGY/sFmQ7xaC7hSna93zl9v5MteHpk80U9z9FdqKJyNtIdG8kdtRa+wqil3R3vwlB34WINFOHe3bNjuAW8P/4M203oLS1YgAAAABJRU5ErkJggg==",km="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGAAAAAoCAYAAAABk/85AAAACXBIWXMAABYlAAAWJQFJUiTwAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAA0WSURBVHgB1ZsNcFTVFYDPe7thd7NZsonIT6CwQWvAnwTaRNuxQoJ2SqpViW3RiiMgVq2dgcy0dnRqkwz9Ga0dNjOt2BYVi2hpVaSFBmyRRWBajUoIWIlYWERAhWE3xoT87O7rOfftDW/fu+9vEzrTb+bN7rvvvnd2z7n3nHN/ngR5kvh7US2AMkvKKHMBpFkgQRgUPAgJkvg9jtfjkj+yTy6cGgvVbI3BCFAUpRY/ZuExN/sZzh5EEo949tiHR0ySpBiMhG+ivAzQ/5qL/8UoT8rKU1CeDDF4IT95kpvKiY3hsFw0uFxRpBXDynZO3Ddlaaz/g3UtJfXJuJMbUOkkYzkeKwDcy8MjhkcLGiPu6I6bUZ48AnkSyiuAFvijQ3ng0ABM8YVDTYr6w0aEHJgG8piStcGrdpsqJqv4JhgFeVnWgpUhVMWPnjwJ5Tk0hK0Bul8JLFdAbs6jxdsR945vaCmavW6tthCVTy2wGWD05YFqhLU5pbegPOX8yYOXdPJ0WBqge1twlTJ6rVCIJ1AWDc051EjfUfmrwIG8gVQG9hw6DfHTvew8Mi4INeWlEPJ7wQFRNAKTBw3O5I2QKBqh0eyi0ADkcqTg0EZsGbXwP8AfaezwXbKSAmmtVT1SfOexbtj/YZJ910LKr5g4Fg1RAnac+RQ6LljKEoVaq3qzIviDLgeoiqjfw0G1PH4KozDafuc7GGQOAHTEwRoJOiANdfCylDReEpDcFtwLaqbhCsmLiVAq6fY2KPryP8ETusKyTtfJHmiPJ6Cnf4idH/l3J+zZvJF9r7luPlR84Sr2nQxRHSmFGZNCps+a/QNU2hFzWYvrAO7Eo/YycET8E/Q1f8JAs8OiEgXoF6U6Y7GOfN2O7J8GwZo2SJ15Dc6+c6/j+/wVj4Bv2v2m108kz0L7kQT7ZOeHD0H79q34+X5OvXGTJsP8O5ZBqKSUnZMhbpo92eCWGp9Cn7BFLIsUvmoJtrxyyAsyxJJfY694x7SKwR3lGCDxSnCxpMDT4BKufDkwlZ0PHn/WkRHGlC2CwOVPCK/19KdQ8Weg66Me9TxxBt7c3gYH33rD8pkVX7wSaq6tHzZExcTQcHygFkoKErH8BtTOEhgVmrE3tGwwvdyIRojyk2EDJNr8EUn2UCeKgAv0yufYGcHsPr2fH+g/C517YrB/90723SnV6JYqr64Fnz/AzicXj4Plvy9mrVRP07dRaQthVLEwQhIHeOU8Hnh46UN3+igjqAUXmCmRPXhsJV6fCqlTm4X3+mc8At7Sa3LKyM9v6TwJx870QTqjQNdbr8OWp5+AY+8dhHQqBW4gF/V+59vgCwTQPU2Bx/9WBAeO+gz1zofyCRY/JDVQ6/BjuR/ebdkGkO0B2dZ/BFxgpXwtop5A94bm5P6yTXtP2Pr5fPGPmwntvl8ayiPjMZivhvNK3U9MYkIGSqgXsAglezxNigKOMVO+kurGTKg4p2zM5EXsU2sE38UP5tShlk/KZ35+28twcN8+GE3eT39NWL6jBRxBKSdlTZR+EpEL1UDN01Irnv6+mnUle3UXZJboNDMDKC7yfTPlZ85+AL1v1oO35BpDYNUbwVsyJ+f6p9nUsuvt102VPzYUhBu/fh1UXFIOkydNgOMnP4aHV0Zh0cKbWJmW9Rv+AgffOzx83uurNDyPUk3qAVaQ0lo3q1mTQYHZZ5ALs3oOXVuBAb7ZGA/YiN+baGOzmhFwgJ3yM2ePwiAehJkRBk+ut3VbemZ8fjo8+fgvIBQ61+Ta1+xnhrhv2Xdyyjdt+YeqfB+WDfSi8q+AQY9RQ6Q4KyhY1zWBMGhzKKsi90I9ycoIy68XGiBMM64ydoVacEim/yikMc/PKdMonzN4Av3+AWMGlE7sZj3ELdFHf5yj5BMnP4HVa56De5fdllNOrF7zPGQq5kC6uoGdkwH0kPuwUhi1djvlc7ihkn3mdchVCQd1ON0tYxSuAhf0oRsZwsDK7hcon6M3An2nMk+oEtxALbxsUq62Hl65Cm66/jp2aCGjnPgsA5maBshUzgelbCacLZhueKbdCJfSRyfK51Dd1r9a16EpDQPo+mXMgyJWNzK3U93GPjlkhP7//NygfHI7voseGj7nRuDKV5/n3P1wF6OFXEzXocOGct4r0qh8JXQhK0vPuwcGC43D2rk2BlgbA9ewOGHRC2guyYAEVV4r/6/1+fTZ217P3BAxgAbQQsqnkS2HX+eKH35m4TRwCvl9LaqSn4fbMfDqe8Wj0d+h3y9k7odDhhj0jKWunkO40Fwm+XRRwLWD7nnmVXXiTkRC/Myw12yeXx9wRUbg6JXvz/YCvZEKsI4+TTVD5HpWr1nPBi6iXvHqzn+pv/PEu5BB18PJDBnnG638vxvXo2eF60kcCMumlyTn5QrGAidlTtc/zVzPpi3bDb2ip6dXDbzl1TgDdyHIu9fB/xPe7AK6oReQbycfz/w/tn6rgNufbenc/2t9vhYqoykIu15gpmQKuvpe8eyGTWrgvXYRZHpOg3fTT8Hz5ouYBd3CrssFiqEXWLkYu7GBFU0LzQM8nynVkSQXRJNCQjfEjRC47Ak2iNIqnxQ5GH982B1xI5ChtMovyLqmoWyZMpS0NIDY9TwndD3DgReDLQu8eKQr68HTuZXFAirzCAywL24+5cwXXvKJAzTgMosvMVGhBHF0QVIHWMCNYMh2pt6vxghNdkRG0Cu/EOvSwQ2R7tlvKqts4gShkqmVU84vDLyoZG3gzVD+PyYInld/y879xWmDHKsVLFI+KdItNCq2Cu47DwgKM3BUxnXYneACbcDlgVlrBA5XPocbIXVml+mzH1i2wFC29HsPwry5XzLk/Dzwput1y62YCaWwR0gYjIsP74LABcZZVIsFEwaNXN24IqprN7IWysSlShkU6x6QUx9dh34eR2QEvfKHy0u/gn66U/jsmkiJYfWKDaxwzueBFd/NKecxgf2mfVsNz6IBmIJBuS/2Bwj4PzNcp4m1mKhFZqFeYDe9wKE6dnXJ/wsNIENMLqn/LMYCsQNotlN1R7kZjtYIZsqnGNCHwTmV2MWeoyUUKIDq8tKcMu7fRTGBBV40DJPd9RpLPfWk6u4BamJFRzawQKznmRhYQgrd+1jWrwtmPamMgi7VsTMUrRcLiNNuuux6QFGzJCtN4BDaXMWzIy1kGNFEG1c+h7Ilv2bELOIudD1khLaNT+aUU9n8BUtzyijYpr71M3UCTvs70TgUCz6asRJO9cw2yNj7K5MRqg42HR0/N0bgcztOpqPpnvL7BBdo89aL0hJ1HOD3RsEF5wKzsSfo0SufGDz6G7CC/Hv72/vhhyvuNlxjgVeH1HMKU8+XDOUsE0J3VCW3gQhaoHcCVzgFWjpuvtKZ8gmzNWi2cw7ICyEldcmkokit4AIzI2gRKZ8gFzRgYgQ+3UBBl4KvFu2IV4+MqafeFY31pKHu9ruh4Y6FMK+q23AP+eVG96NXx5DrMQm+a/m2xXMjYZ+32Wks4FgZwUz5HJqm0McCgvz9oltvNKSj2sBrhkypJ64B+CQFrirug9smJWFmqQf/moz+WhG22uhmyx0MeUPKbxY/N85bPzG8KP/IM/39P7ptzIAkw3xwASmRFt4Lxn8DpAJ1gGWnfEZmAAcFA+Ad91XDpcrLZxjm+fe89wns7zoCp08eN32kNNgHM6d/Dm6sCMK0wBB4JXVbyvVVZXDR+AD4CwC2CXI+aqUUDIVTxnlgoXyiEf58biu7YXomsbUoKklsg6wreGBOJ16zV74Gu41ZBG1PeWqXumeA1o13vLAejusW7CdPvxiqr62HMvwkysIBtk2RPrWQy4mKN2o4SimtsN2YpUArbJRyNr2Jtya+EtyRz75QMoJorsgOMpx+i4oe2qBFO+T41sSut96A9u1qcL36hgYov1Rd+aKxxLyZ4w2K12K6UyGLk7VeLTSuaN1iuzWxA7Oe2cZiAYkd4bA0NLQj+2bIeWfMhAWxQNU6mo+yldf5YRI6j306bAgO+fnKzxXDFVPC7LsVp7ohNv4u9kaPpTyaL6LshxZwaJqBG4SnpTSnxAZ1NiNrti80DQscb87l5OuO3CD5p7QWz+1i3RKnRSgdtpXHty3y7enk52kgZ6f4LK2SlHUDC1CeBOf1/4ncjhbbKfpEW3CxpL49EoFRRCooSRZMvLWl8NLHcsYgaITFAKMvD9T3yOgFjdwxT8P5lafdByrC2StKbf4IyJ5mrHwnjBDawg5yUWsm+XFzyYKkMO1FI0RAfUtmxPKy0BinGZUvTrNvRnkSUBo+OvKo1dNbNy9Ltmm900UqhsYQ9KZixM29UkE4mRnoboV+b9RM8Xo0hnAtD9QWSIqPmipezzlD5C8vA1Eniue4MoAWtqFLhlp0T1Vo7Qhb3M99TTUp+yZ0pPs/3um94JqOUXpNlQ7aRhPJHtrXVOmgLJ+m1ztG6TXVWtq5wGQpAnmU2SgoT8bPPF9T/S+t/b7McgGVIAAAAABJRU5ErkJggg==",Mm=({isOpen:e,isLoading:t=!1,onClose:n,accountChains:r,defaultChainId:o,defaultSymbol:s,defaultAccountType:i,balances:l,wagmiHooks:a,onDeposit:c,onCopy:u,getUserBizConfig:f,saveUserBizConfig:p,onChainChange:d,onTokenChange:h})=>{const{t:b}=$t(),v=g.useMemo(()=>r.map(H=>({...H,key:Bi(H.key)})),[r]),P=g.useMemo(()=>Bi(i),[i]),x=g.useMemo(()=>v.some(H=>H.key===ze.PERPETUALV2),[v]),E=g.useMemo(()=>{var ee;if(!v||v.length===0)return P;const H=v.find(Q=>Q.key===P);return(H==null?void 0:H.key)||((ee=v[0])==null?void 0:ee.key)||P},[v,P]),[N,D]=g.useState(E),F=g.useCallback(H=>{var ee;return((ee=v.find(Q=>Q.key===H))==null?void 0:ee.chains)||[]},[v]),L=F(E),m=()=>{var he;if(!L||L.length===0)return{chainId:o||1,token:""};const H=o||((he=L[0])==null?void 0:he.chainId),ee=L.find(Ee=>Ee.chainId===H)||L[0],Q=(ee==null?void 0:ee.tokenList)||[],ve=(s||"").toUpperCase();if(ve&&Q.length>0){const Ee=Q.find(Fe=>(Fe.token||Fe.symbol||"").toUpperCase()===ve);if(Ee)return{chainId:ee.chainId,token:Ee.token||Ee.symbol||""}}if(ve)for(const Ee of L){const we=((Ee==null?void 0:Ee.tokenList)||[]).find(Ae=>(Ae.token||Ae.symbol||"").toUpperCase()===ve);if(we)return{chainId:Ee.chainId,token:we.token||we.symbol||""}}const Z=Q.length>0?ee:L.find(Ee=>(Ee.tokenList||[]).length>0)||ee,ie=((Z==null?void 0:Z.tokenList)||[])[0];return{chainId:(Z==null?void 0:Z.chainId)||ee.chainId||1,token:(ie==null?void 0:ie.token)||(ie==null?void 0:ie.symbol)||""}},[{chainId:w,token:S}]=g.useState(()=>m()),[$,I]=g.useState(w),A=g.useMemo(()=>v.find(H=>H.key===N)||v[0],[v,N]),k=g.useMemo(()=>(A==null?void 0:A.chains)||[],[A]),y=g.useMemo(()=>{var Z,ie;if(!A||!Wc(A.account)||!(N===ze.SPOT||N===ze.PERPETUALV2))return!1;const Q=!!((Z=A.walletOptions)!=null&&Z.evm),ve=!!((ie=A.walletOptions)!=null&&ie.mpc);return Q&&ve},[A,N]),O=g.useCallback(()=>{var H,ee;return(H=A==null?void 0:A.walletOptions)!=null&&H.evm?"evm":(ee=A==null?void 0:A.walletOptions)!=null&&ee.mpc||A!=null&&A.account&&fs(A.account)?"mpc":"evm"},[A]),[M,T]=g.useState(()=>y?null:O()),B=g.useRef(N),R=g.useRef(y);g.useEffect(()=>{const H=B.current!==N,ee=!R.current&&y;if(B.current=N,R.current=y,y){(H||ee)&&T(null);return}T(O())},[N,y,O]);const z=g.useMemo(()=>{if(!A)return;if(!y)return A.account;if(!M)return;const H=A.walletOptions;return M==="mpc"?(H==null?void 0:H.mpc)||A.account:(H==null?void 0:H.evm)||A.account},[A,M,y]),W=g.useMemo(()=>z&&fs(z)?gn:Zs,[z]),G=k.find(H=>H.chainId===$)||k[0],[J,K]=g.useState(S),_=g.useCallback(H=>{I(H),d==null||d(H)},[d]),ne=g.useCallback(H=>{K(H),h==null||h(H)},[h]),be=g.useMemo(()=>{const H=(J||"").toLowerCase();if(!H)return"0";const ee=(l==null?void 0:l[N])||(N===ze.PERPETUAL?l==null?void 0:l.perp:void 0),Q=ee==null?void 0:ee[H];return typeof Q=="string"&&Q.length>0?Q:"0"},[l,N,J]),[fe,xe]=g.useState(!1),ye=H=>{H.target===H.currentTarget?xe(!0):xe(!1)},Y=H=>{fe&&H.target===H.currentTarget&&n(),xe(!1)};return e?Ke.createPortal(C.jsx("div",{className:"edgex-components",children:C.jsx("div",{className:"fixed top-0 left-0 right-0 bottom-0 w-screen h-screen",style:{zIndex:98},children:C.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:ye,onMouseUp:Y,"aria-hidden":"true",children:C.jsxs("div",{className:"relative w-[420px] max-h-[85vh] bg-fill-page-secondary overflow-auto rounded-lg p-6 shadow-xl border-2 border-solid border-line-divider-secondary",onClick:H=>{H.stopPropagation()},children:[C.jsxs("div",{className:"flex items-center justify-between mb-4",children:[C.jsx("h2",{className:"text-lg font-semibold text-white",children:b("deposit.title")}),C.jsx("button",{className:"text-gray-400 hover:text-gray-200 transition-colors",onClick:n,"aria-label":"Close",children:C.jsx(C0,{className:"h-4 w-4"})})]}),C.jsx(jh,{selectedAccount:N,options:v.map(H=>({value:H.key,label:H.key===ze.SPOT?b("account.spot"):H.key===ze.PERPETUAL?b(x?"account.perpetual-v1":"account.perp"):H.key===ze.PERPETUALV2?b("account.perpetual-v2"):H.key})),onAccountChange:H=>{var we,Ae;const ee=H||N;D(ee);const Q=F(ee);if(!Q||Q.length===0)return;const ve=Q.find(lt=>lt.chainId===$),Z=ve?ve.chainId:Q[0].chainId;I(Z),d==null||d(Z);const ie=Q.find(lt=>lt.chainId===Z),he=(ie==null?void 0:ie.tokenList)||[],Fe=he.some(lt=>(lt.symbol||lt.token)===J)?J:((we=he[0])==null?void 0:we.symbol)||((Ae=he[0])==null?void 0:Ae.token)||"";Fe&&(K(Fe),h==null||h(Fe))},className:"w-full"}),C.jsx(Rh,{currentActiveChain:G,chainList:k,onChainChange:_,curSelectToken:J,onTokenChange:ne,walletType:W,accountType:N}),y&&!M&&C.jsxs("div",{className:"mb-4",children:[C.jsx("div",{className:"h-px w-full bg-[#404040] my-4"}),C.jsx("button",{type:"button",onClick:()=>T("evm"),className:"w-full text-left rounded-lg px-3 py-[10px] bg-[#303030]",children:C.jsxs("div",{className:"flex flex-col gap-2",children:[C.jsxs("div",{className:"flex items-center justify-between gap-3",children:[C.jsx("div",{className:"text-text-primary font-edgex-harmony text-[14px] font-medium leading-[18px]",children:b("deposit.connectedWalletTitle")}),C.jsx("div",{className:"flex items-center gap-1 shrink-0",children:C.jsx("img",{src:$m,className:"w-12 h-5"})})]}),C.jsx("div",{className:"text-text-secondary font-edgex-harmony text-[12px] font-normal leading-[18px]",children:b("deposit.connectedWalletDesc")})]})}),C.jsxs("div",{className:"flex items-center my-2",children:[C.jsx("div",{className:"flex-1 border-t border-dashed border-[#242424]"}),C.jsx("span",{className:"mx-4 text-xs text-text-tertiary",children:b("deposit.or")}),C.jsx("div",{className:"flex-1 border-t border-dashed border-[#242424]"})]}),C.jsx("button",{type:"button",onClick:()=>T("mpc"),className:"w-full text-left rounded-lg px-3 py-[10px] bg-[#303030]",children:C.jsxs("div",{className:"flex flex-col gap-2",children:[C.jsxs("div",{className:"flex items-center justify-between gap-3",children:[C.jsx("div",{className:"text-text-primary font-edgex-harmony text-[14px] font-medium leading-[18px]",children:b("deposit.externalWalletTitle")}),C.jsx("div",{className:"flex items-center gap-1 shrink-0",children:C.jsx("img",{src:km,className:"w-12 h-5"})})]}),C.jsx("div",{className:"text-text-secondary font-edgex-harmony text-[12px] font-normal leading-[18px]",children:b("deposit.externalWalletDesc")})]})})]}),(!y||M)&&C.jsxs(C.Fragment,{children:[z&&fs(z)&&C.jsx(VS,{address:z.smartWalletAddress,currentActiveChain:G,selectedToken:J,accountType:N,accountId:z.accountId,accountKey:A==null?void 0:A.key,onDeposit:c,onCopy:u,getUserBizConfig:f,saveUserBizConfig:p,onClose:n}),z&&Wc(z)&&C.jsx(nP,{address:z.ethAddress,currentActiveChain:G,selectedToken:J,accountType:N,accountId:z.accountId,accountKey:A==null?void 0:A.key,platformBalance:be,isLoading:t,wagmiHooks:a,onChainChange:_,onDeposit:c,onClose:n})]})]})})})}),document.body):null},rP=({withdrawAmount:e,curSelectToken:t,tokenInfo:n,currentActiveChain:r,platformBalance:o="0",fee:s="0.00",walletType:i="evm",receiverAddress:l="",accountType:a="perpetual",onWithdrawAmountChange:c,onReceiverAddressChange:u,onAmountChanged:f,showPoolBalanceInsufficientTip:p=!1})=>{const{t:d}=$t(),h=g.useMemo(()=>{if(a==="spot"||!_n(r==null?void 0:r.chainId)){const A=new Re(e||"0").minus(s||"0");if(A.isNegative()||A.isZero())return"0";const k=Math.min(A.decimalPlaces()??0,18);return A.decimalPlaces(k,Re.ROUND_DOWN).toString()}return e||"0"},[e,s,r==null?void 0:r.chainId,a]),b=g.useMemo(()=>o||"0",[o]),v=g.useMemo(()=>{const A=(n==null?void 0:n.feeRate)||(n==null?void 0:n.withdrawFeeRate)||(r==null?void 0:r.feeRate)||0;try{return new Re(A||0).times(100).toString()}catch{return"0"}},[n==null?void 0:n.feeRate,n==null?void 0:n.withdrawFeeRate,r==null?void 0:r.feeRate]),P=g.useMemo(()=>v==="0",[v]),x=g.useMemo(()=>(t||"").toUpperCase()==="USDC",[t]),E=g.useMemo(()=>{const A=Number(r==null?void 0:r.chainId),k=String((r==null?void 0:r.chain)||"").trim().toUpperCase();return A===33431||A===3343||k==="EDGE"},[r==null?void 0:r.chainId,r==null?void 0:r.chain]),N=g.useMemo(()=>{const A=(t||"").toUpperCase();return A==="USDT"||A==="USDC"},[t]),D=g.useMemo(()=>x&&P,[x,P]),F=g.useMemo(()=>!E&&D,[E,D]),L=g.useMemo(()=>D,[D]),m=g.useMemo(()=>!D,[D]),w=g.useMemo(()=>F,[F]),S=A=>{const k=A.target.value,O=Mi(k,b||"0");if(O.isValid)c(O.formattedValue),O.errorType;else return O.errorType==="exceed_balance",void 0;f==null||f(O.formattedValue)},$=()=>{const A=b||"0",y=Mi(A,A).formattedValue;c(y),f==null||f(y)},I=()=>{const A=parseFloat(o||"0"),k=parseFloat(e||"0");if(k>0){const y=A-k,O=_t(Math.max(0,y).toString());return C.jsxs("span",{className:"flex items-center gap-1",children:[_t(o||"0"),C.jsx("span",{className:"text-sm font-edgex-harmony text-functional-green-1 leading-[18px] font-medium",children:"→"}),O," ",t]})}return`${_t(o||"0")} ${t}`};return C.jsxs(C.Fragment,{children:[C.jsxs("div",{className:"bg-fill-input-primary rounded-lg px-3 py-3 my-4",children:[C.jsxs("div",{className:"flex justify-between items-center h-[18px] mb-3",children:[C.jsx("input",{type:"text",placeholder:d("deposit.amount"),value:e,onChange:S,className:"flex-1 bg-transparent text-text-primary text-sm font-medium placeholder-text-tertiary placeholder:font-normal focus:outline-hidden border-none p-0 h-full"}),C.jsx("button",{onClick:$,className:"text-theme-normal text-xs font-medium cursor-pointer hover:opacity-80 transition-opacity h-full flex items-center",children:d("deposit.max")})]}),C.jsx("div",{className:"h-px bg-line-divider-secondary mb-2"}),C.jsxs("div",{className:"flex justify-between items-center",children:[C.jsx(Pn,{content:d("withdraw.availableDesc"),children:C.jsx("span",{className:"text-text-tertiary text-xs leading-[14px] border-b border-dashed border-line-divider-primary",children:d("deposit.available")})}),C.jsx("span",{className:"text-text-primary text-xs leading-[14px]",children:I()})]})]}),i==="mpc"&&(a==="spot"||!_n(r==null?void 0:r.chainId))?C.jsx("div",{className:"bg-fill-input-primary rounded-lg my-4 h-9 flex items-center px-3",children:C.jsx("input",{type:"text",placeholder:d("withdraw.receiverAddress"),value:l,onChange:A=>u==null?void 0:u(A.target.value),className:"flex-1 bg-transparent text-text-primary text-sm font-medium placeholder-text-tertiary placeholder:font-normal focus:outline-hidden border-none p-0 h-full"})}):null,p&&C.jsxs("div",{className:"flex mb-4",children:[C.jsx("div",{className:"w-5",children:C.jsx("img",{src:Yr,className:"w-4 h-4",alt:"Warning"})}),C.jsx("div",{className:"flex-1 text-xs text-functional-orange-1",children:d("withdraw.poolBalanceInsufficientTip")})]}),w&&C.jsxs("div",{className:"flex mb-4",children:[C.jsx("div",{className:"w-5",children:C.jsx("img",{src:Yr,className:"w-4 h-4",alt:"Warning"})}),C.jsx("div",{className:"flex-1 text-xs text-functional-orange-1",children:d("withdraw.largeWithdrawFeeTip")})]}),C.jsxs("div",{className:"py-4 border-t border-line-divider-secondary border-dashed",children:[C.jsxs("div",{className:"flex items-center justify-between h-[18px] leading-[18px]",children:[C.jsx(Pn,{content:C.jsxs("div",{children:[C.jsx("div",{children:d("withdraw.speedNote")}),C.jsxs("div",{className:"flex gap-1 items-center mt-1",children:[C.jsx(as,{selectedLevel:Wt.FAST,maxLevel:3}),C.jsx("span",{children:d("withdraw.speedNoteSpeed1")})]}),C.jsxs("div",{className:"flex gap-1 items-center mt-1",children:[C.jsx(as,{selectedLevel:Wt.Medium,maxLevel:3}),C.jsx("span",{children:d("withdraw.speedNoteSpeed2")})]}),C.jsxs("div",{className:"flex gap-1 items-center mt-1",children:[C.jsx(as,{selectedLevel:Wt.SLOW,maxLevel:3}),C.jsx("span",{children:d("withdraw.speedNoteSpeed3")})]})]}),children:C.jsx("span",{className:"text-text-tertiary text-sm leading-4 border-b border-dashed border-line-divider-primary",children:d("withdraw.speed")})}),C.jsx("div",{className:"flex items-center",children:C.jsx(as,{selectedLevel:_n(r==null?void 0:r.chainId)?Wt.SLOW:Wt.FAST,maxLevel:3})})]}),(a==="spot"||!_n(r==null?void 0:r.chainId))&&!L&&C.jsxs("div",{className:"flex items-center justify-between mt-2 h-[18px]",children:[P||!N?C.jsx("span",{className:"text-text-tertiary text-sm leading-4",children:P?d("withdraw.fee"):`${d("withdraw.fee")}/${d("withdraw.feeRate")}`}):C.jsx(Pn,{className:"w-[320px] font-normal flex items-center justify-center",content:C.jsx("span",{className:"flex items-center justify-center text-center",children:d("withdraw.feeCalculationTip")}),children:C.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")}`})}),C.jsxs("span",{className:"text-text-primary text-sm leading-4 font-medium",children:[s," ",t,!P&&` / ${v}%`]})]}),m&&C.jsxs("div",{className:"flex items-center justify-between mt-2 h-[18px]",children:[C.jsx("span",{className:"text-text-tertiary text-sm leading-4",children:d(_n(r==null?void 0:r.chainId)?"withdraw.withdrawlAmount":"withdraw.amountToReceive")}),C.jsxs("span",{className:"text-text-primary text-sm leading-4 font-medium",children:[_t(h)," ",t]})]})]})]})};let at=null;const _c={accountChains:[],defaultAccountType:""},Dm=g.forwardRef((e,t)=>{const[n,r]=g.useState(!1),[o,s]=g.useState(!1),[i,l]=g.useState(_c),a=g.useCallback(h=>{l(h||_c),r(!0)},[]),c=g.useCallback(h=>{l(b=>({...b,...h}))},[]),u=g.useCallback(()=>{r(!1),s(!1),i.onClose&&i.onClose()},[i.onClose]),f=g.useCallback(h=>{s(h)},[]),p=g.useCallback(()=>n,[n]),d=g.useCallback(()=>o,[o]);return g.useImperativeHandle(t,()=>({openWithdraw:a,closeWithdraw:u,updateWithdrawOptions:c,setWithdrawLoading:f,isOpen:p,isLoading:d}),[a,u,c,f,p,d]),g.useEffect(()=>(at={openWithdraw:a,closeWithdraw:u,updateWithdrawOptions:c,setWithdrawLoading:f,isOpen:p,isLoading:d},()=>{at=null}),[a,u,c,f,p,d]),n?C.jsx(jm,{isOpen:n,isLoading:o,onClose:u,config:i.config||{symbol:"USDT"},accountChains:i.accountChains,balances:i.balances,defaultChainId:i.defaultChainId,defaultSymbol:i.defaultSymbol,defaultAmount:i.defaultAmount,defaultAccountType:i.defaultAccountType,currentEquity:i.currentEquity??5e3,platformBalance:i.platformBalance||"0",fee:i.fee,wagmiHooks:i.wagmiHooks,onWithdraw:i.onWithdraw,onAccountChange:i.onAccountChange,onChainChange:i.onChainChange,onTokenChange:i.onTokenChange,onAmountChanged:i.onAmountChanged}):null});Dm.displayName="WithdrawManager";const Bm=e=>{if(!at){console.error("WithdrawManager not initialized. Make sure to render <WithdrawManager /> in your app.");return}at.openWithdraw(e||_c)},Lm=()=>{if(!at){console.error("WithdrawManager not initialized. Make sure to render <WithdrawManager /> in your app.");return}at.closeWithdraw()},Fm=e=>{if(!at){console.error("WithdrawManager not initialized. Make sure to render <WithdrawManager /> in your app.");return}at.updateWithdrawOptions(e)},Li=e=>{if(!at){console.error("WithdrawManager not initialized. Make sure to render <WithdrawManager /> in your app.");return}at.setWithdrawLoading(e)},oP=()=>at?at.isOpen():!1,Rm=()=>at?at.isLoading():!1,sP=()=>({openWithdraw:Bm,closeWithdraw:Lm,updateWithdrawOptions:Fm,setWithdrawLoading:Li,isOpen:oP,isLoading:Rm}),iP=({accountChains:e,defaultChainId:t,defaultSymbol:n,defaultAmount:r="",defaultAccountType:o,currentEquity:s,platformBalance:i="0",balances:l,fee:a="0.00",isLoading:c=!1,onWithdraw:u,onClose:f,onChainChange:p,onTokenChange:d,onAmountChanged:h,onAccountChange:b})=>{var ve;const{t:v}=$t(),P=g.useMemo(()=>e.map(Z=>({...Z,key:Bi(Z.key)})),[e]),x=g.useMemo(()=>Bi(o),[o]),E=g.useMemo(()=>P.some(Z=>Z.key===ze.PERPETUALV2),[P]),N=g.useMemo(()=>{var ie;if(!P||P.length===0)return x;const Z=P.find(he=>he.key===x);return(Z==null?void 0:Z.key)||((ie=P[0])==null?void 0:ie.key)||x},[P,x]),[D,F]=g.useState(N),L=g.useCallback(Z=>{var ie;return((ie=P.find(he=>he.key===Z))==null?void 0:ie.chains)||[]},[P]),m=g.useMemo(()=>P.find(Z=>Z.key===D)||P[0],[P,D]),w=g.useMemo(()=>(m==null?void 0:m.chains)||[],[m]),S=g.useMemo(()=>{var Fe,we;if(!m||!Wc(m.account)||!(D===ze.SPOT||D===ze.PERPETUALV2))return!1;const he=!!((Fe=m.walletOptions)!=null&&Fe.evm),Ee=!!((we=m.walletOptions)!=null&&we.mpc);return he&&Ee},[m,D]),$=g.useCallback(()=>{var Z,ie;return(Z=m==null?void 0:m.walletOptions)!=null&&Z.evm?"evm":(ie=m==null?void 0:m.walletOptions)!=null&&ie.mpc||m!=null&&m.account&&fs(m.account)?"mpc":"evm"},[m]),[I,A]=g.useState(()=>S?null:$());g.useEffect(()=>{A(S?null:$())},[D,S,$]);const k=g.useMemo(()=>{if(!m)return;if(!S)return m.account;if(!I)return;const Z=m.walletOptions;return I==="mpc"?(Z==null?void 0:Z.mpc)||m.account:(Z==null?void 0:Z.evm)||m.account},[m,S,I]),y=g.useMemo(()=>k&&fs(k)?"mpc":"evm",[k]),O=y==="mpc"?gn:Zs,M=g.useMemo(()=>{if(!w||w.length===0)return{chainId:1,tokenSymbol:""};const Z=we=>{const Ae=we||[];if(!Ae.length)return"";const Ge="USDC".toUpperCase(),Vn=Ae.find(Ht=>(Ht.token||Ht.symbol||"").toUpperCase()===Ge)||Ae[0];return Vn.token||Vn.symbol||""};if(n){const we=n==null?void 0:n.toUpperCase();for(const Ae of w){const lt=Ae.tokenList||[];let Ge;if(we&&(Ge=lt.find(Vt=>(Vt.token||Vt.symbol||"").toUpperCase()===we)),Ge){const Vt=Ge.token||Ge.symbol||n||"";return{chainId:Ae.chainId,tokenSymbol:Vt}}}}if(t){const we=w.find(Ge=>Ge.chainId===t)||w[0],Ae=we.tokenList||[],lt=Z(Ae);return{chainId:we.chainId,tokenSymbol:lt}}const ie="USDC",he=we=>Array.isArray(we.tokenList)&&we.tokenList.some(Ae=>(Ae.token||Ae.symbol||"").toUpperCase()===ie),Ee=w.find(he)||w[0];if(!Ee)return{chainId:1,tokenSymbol:""};const Fe=Z(Ee.tokenList);return{chainId:Ee.chainId,tokenSymbol:Fe}},[w,t,n]),[T,B]=g.useState(()=>M.chainId),[R,z]=g.useState(()=>M.tokenSymbol),[W,G]=g.useState(r),[J,K]=g.useState(""),_=g.useCallback(Z=>{B(Z),p==null||p(Z)},[p]),ne=g.useCallback(Z=>{z(Z),d==null||d(Z)},[d]),be=g.useRef(!0),fe=g.useRef(R),xe=g.useRef(T);g.useEffect(()=>{if(be.current){be.current=!1,fe.current=R,xe.current=T;return}(fe.current!==R||xe.current!==T)&&(G(""),fe.current=R,xe.current=T)},[R,T]);const ye=w&&w.length>0?w.find(Z=>Z.chainId===T)||w[0]:null,Y=(ve=ye==null?void 0:ye.tokenList)==null?void 0:ve.find(Z=>Z.token===R),H=g.useMemo(()=>{const Z=new Re(W||"0"),ie=new Re(a||"0"),he=_n(T);return Y!=null&&Y.minWithdrawSize&&Z.lt(Y.minWithdrawSize)?{text:v("withdraw.minWithdrawParsed",{amount:Y.minWithdrawSize,token:Y.symbol||Y.token}),disabled:!0}:!W||Z.isZero()||!he&&Z.isLessThan(ie)?{text:v("withdraw.confirmWithdraw"),disabled:!0}:y==="mpc"&&(!he||D==="spot")&&!J.trim()?{text:v("withdraw.invalidReceiverAddress"),disabled:!0}:{text:v("withdraw.confirmWithdraw"),disabled:!1}},[v,T,W,y,J,a,D,Y]),ee=g.useMemo(()=>{const Z=(R||"").toLowerCase();if(!Z)return i||"0";const ie=(l==null?void 0:l[D])||(D===ze.PERPETUAL?l==null?void 0:l.perp:void 0),he=ie==null?void 0:ie[Z];return typeof he=="string"&&he.length>0?he:i||"0"},[l,D,R,i]),Q=g.useCallback(async()=>{Li(!0);try{if(u){const ie={amount:new Re(W||"0").toString(),chainId:T,tokenAddress:(Y==null?void 0:Y.tokenAddress)||"",coinId:(Y==null?void 0:Y.coinId)||"",tokenSymbol:R,accountType:D,selectedToken:Y};y==="mpc"&&(!_n(T)||D==="spot")&&(ie.receiverAddress=J),u(ie)}}catch{Li(!1)}},[u,D,Y,W,T,R,y,J]);return!w||w.length===0?C.jsx("div",{className:"text-center py-8",children:C.jsx("p",{className:"text-gray-400",children:"No chains available"})}):ye?C.jsxs(C.Fragment,{children:[C.jsx(jh,{selectedAccount:D,options:P.map(Z=>({value:Z.key,label:Z.key===ze.SPOT?v("account.spot"):Z.key===ze.PERPETUAL?v(E?"account.perpetual-v1":"account.perp"):Z.key===ze.PERPETUALV2?v("account.perpetual-v2"):Z.key})),onAccountChange:Z=>{var Vt,Vn;const ie=Z||D;F(ie),b==null||b(ie);const he=L(ie);if(!he||he.length===0)return;const Ee=he.find(Ht=>Ht.chainId===T),Fe=Ee?Ee.chainId:he[0].chainId;B(Fe),p==null||p(Fe);const we=he.find(Ht=>Ht.chainId===Fe),Ae=(we==null?void 0:we.tokenList)||[],Ge=Ae.some(Ht=>(Ht.symbol||Ht.token)===R)?R:((Vt=Ae[0])==null?void 0:Vt.symbol)||((Vn=Ae[0])==null?void 0:Vn.token)||"";Ge&&(z(Ge),d==null||d(Ge))},className:"w-full"}),C.jsx(Rh,{currentActiveChain:ye,chainList:w,onChainChange:_,curSelectToken:R,onTokenChange:ne,walletType:O,txType:"withdraw"}),S&&!I&&C.jsxs("div",{className:"mb-4",children:[C.jsx("div",{className:"h-px w-full bg-[#404040] my-4"}),C.jsx("button",{type:"button",onClick:()=>A("evm"),className:"w-full text-left rounded-lg px-3 py-[10px] bg-[#303030]",children:C.jsxs("div",{className:"flex flex-col gap-2",children:[C.jsxs("div",{className:"flex items-center justify-between gap-3",children:[C.jsx("div",{className:"text-text-primary font-edgex-harmony text-[14px] font-medium leading-[18px]",children:v("withdraw.connectedWalletTitle")}),C.jsx("div",{className:"flex items-center gap-1 shrink-0",children:C.jsx("img",{src:$m,className:"w-12 h-5",alt:"EVM"})})]}),C.jsx("div",{className:"text-text-secondary font-edgex-harmony text-[12px] font-normal leading-[18px]",children:v("withdraw.connectedWalletDesc")})]})}),C.jsxs("div",{className:"flex items-center my-2",children:[C.jsx("div",{className:"flex-1 border-t border-dashed border-[#242424]"}),C.jsx("span",{className:"mx-4 text-xs text-text-tertiary",children:v("deposit.or")}),C.jsx("div",{className:"flex-1 border-t border-dashed border-[#242424]"})]}),C.jsx("button",{type:"button",onClick:()=>A("mpc"),className:"w-full text-left rounded-lg px-3 py-[10px] bg-[#303030]",children:C.jsxs("div",{className:"flex flex-col gap-2",children:[C.jsxs("div",{className:"flex items-center justify-between gap-3",children:[C.jsx("div",{className:"text-text-primary font-edgex-harmony text-[14px] font-medium leading-[18px]",children:v("withdraw.externalWalletTitle")}),C.jsx("div",{className:"flex items-center gap-1 shrink-0",children:C.jsx("img",{src:km,className:"w-12 h-5",alt:"MPC"})})]}),C.jsx("div",{className:"text-text-secondary font-edgex-harmony text-[12px] font-normal leading-[18px]",children:v("withdraw.externalWalletDesc")})]})})]}),(!S||I)&&C.jsxs(C.Fragment,{children:[C.jsx(rP,{withdrawAmount:W,curSelectToken:R,tokenInfo:Y,curSelectTokenData:{balance:Y==null?void 0:Y.balance,allowance:Y==null?void 0:Y.allowance},currentActiveChain:ye,currentEquity:s||0,decimals:(Y==null?void 0:Y.decimals)||6,platformBalance:ee,fee:a,walletType:y,accountType:D,receiverAddress:J,onWithdrawAmountChange:G,onReceiverAddressChange:K,onAmountChanged:h}),C.jsxs("button",{className:`w-full h-[38px] text-sm rounded-xl font-medium transition-colors flex items-center justify-center gap-2 ${H.disabled||c?"bg-text-disabled text-text-secondary cursor-not-allowed":"bg-fill-btn-primary text-text-on-sec-btn"}`,onClick:Q,disabled:H.disabled||c,children:[c&&C.jsx(us,{size:"xs"}),H.text]})]})]}):C.jsx("div",{className:"text-center py-8",children:C.jsx("p",{className:"text-gray-400",children:"Loading..."})})},jm=({isOpen:e,isLoading:t=!1,defaultAccountType:n,onClose:r,config:o,accountChains:s,defaultChainId:i,defaultSymbol:l,defaultAmount:a="",currentEquity:c=5e3,platformBalance:u="0",balances:f,fee:p,wagmiHooks:d,onWithdraw:h,onChainChange:b,onTokenChange:v,onAmountChanged:P,onAccountChange:x})=>{const{t:E}=$t(),[N,D]=g.useState(!1),F=m=>{m.target===m.currentTarget?D(!0):D(!1)},L=m=>{N&&m.target===m.currentTarget&&r(),D(!1)};return e?Ke.createPortal(C.jsx("div",{className:"edgex-components",children:C.jsx("div",{className:"fixed top-0 left-0 right-0 bottom-0 w-screen h-screen",style:{zIndex:98},children:C.jsx("div",{className:"fixed top-0 left-0 right-0 bottom-0 z-99 flex items-center justify-center",style:{background:"rgba(0, 0, 0, 0.6)",backdropFilter:"blur(10px)",WebkitBackdropFilter:"blur(10px)"},onMouseDown:F,onMouseUp:L,"aria-hidden":"true",children:C.jsxs("div",{className:"relative w-[420px] max-h-[85vh] bg-fill-page-secondary overflow-auto rounded-lg p-6 shadow-xl",onClick:m=>{m.stopPropagation()},children:[C.jsxs("div",{className:"flex items-center justify-between mb-4",children:[C.jsx("h2",{className:"text-lg font-semibold text-white",children:E("withdraw.withdraw")}),C.jsx("button",{className:"text-gray-400 hover:text-gray-200 transition-colors",onClick:r,"aria-label":"Close",children:C.jsx(C0,{className:"h-4 w-4"})})]}),C.jsx(iP,{accountChains:s,defaultChainId:i,defaultSymbol:l,defaultAmount:a,defaultAccountType:n,currentEquity:c,platformBalance:u,balances:f,fee:p,isLoading:t,wagmiHooks:d,onWithdraw:h,onClose:r,onChainChange:b,onTokenChange:v,onAmountChanged:P,onAccountChange:x})]})})})}),document.body):null};le.ChromeLoader=us,le.ComponentProvider=fb,le.DEFAULT_LOCALE=ps,le.Deposit=Mm,le.DepositManager=Tm,le.LOCALE_NAMES=lb,le.LoadingSpinner=us,le.SUPPORTED_LOCALES=Ri,le.Tooltip=Pn,le.Withdraw=jm,le.WithdrawManager=Dm,le.closeDeposit=Nm,le.closeWithdraw=Lm,le.formatThousands=pb,le.isDepositLoading=Om,le.isWithdrawLoading=Rm,le.openDeposit=Am,le.openWithdraw=Bm,le.setDepositLoading=Di,le.setWithdrawLoading=Li,le.updateDepositOptions=Cm,le.updateWithdrawOptions=Fm,le.useComponentConfig=tu,le.useDeposit=k5,le.useDepositManager=XS,le.useTranslation=$t,le.useWithdraw=M5,le.useWithdrawManager=sP,Object.defineProperty(le,Symbol.toStringTag,{value:"Module"})});
187
187
  //# sourceMappingURL=index.umd.js.map